Debian Codegraph @

test-suite/bugs/bug_7015.v

raw
1 Set Universe Polymorphism.
2 Set Polymorphic Inductive Cumulativity.
3 Set Printing Universes.
4
5 Module Simple.
6
7 (* in the real world foo@{i} might be [@paths@{i} nat] I guess *)
8 Inductive foo : nat -> Type :=.
9
10 (* on [refl (fun x => f x)] this computes to [refl f] *)
11 Definition eta_out {A B} (f g : forall x : A, B x) (e : (fun x => f x) = (fun x => g x)) : f = g.
12 Proof.
13 change (f = g) in e. destruct e;reflexivity.
14 Defined.
15
16 Section univs.
17 Universes i j.
18 Constraint i < j. (* fail instead of forcing equality *)
19
20 Definition one : (fun n => foo@{i} n) = fun n => foo@{j} n := eq_refl.
21
22 Definition two : foo@{i} = foo@{j} := eta_out _ _ one.
23
24 Definition two' : foo@{i} = foo@{j} := Eval compute in two.
25
26 Definition three := @eq_refl (foo@{i} = foo@{j}) two.
27 Definition four := Eval compute in three.
28
29 Definition five : foo@{i} = foo@{j} := eq_refl.
30 End univs.
31
32 (* inference tries and succeeds with syntactic equality which doesn't eta expand *)
33 Fail Definition infer@{i j k|i < k, j < k, k < eq.u0}
34 : foo@{i} = foo@{j} :> (nat -> Type@{k})
35 := eq_refl.
36
37 End Simple.
38
39 Module WithRed.
40 (** this test needs to reduce the parameter's type to work *)
41
42
43 Inductive foo@{i j} (b:bool) (x:if b return Type@{j} then Type@{i} else nat) : Type@{i} := .
44
45 (* on [refl (fun x => f x)] this computes to [refl f] *)
46 Definition eta_out {A B} (f g : forall x : A, B x) (e : (fun x => f x) = (fun x => g x)) : f = g.
47 Proof.
48 change (f = g) in e. destruct e;reflexivity.
49 Defined.
50
51 Section univs.
52 Universes i j k.
53 Constraint i < j. (* fail instead of forcing equality *)
54
55 Definition one : (fun n => foo@{i k} false n) = fun n => foo@{j k} false n := eq_refl.
56
57 Definition two : foo@{i k} false = foo@{j k} false := eta_out _ _ one.
58
59 Definition two' : foo@{i k} false = foo@{j k} false := Eval compute in two.
60
61 (* Failure of SR doesn't just mean that the type changes, sometimes
62 we lose being well-typed entirely. *)
63 Definition three := @eq_refl (foo@{i k} false = foo@{j k} false) two.
64 Definition four := Eval compute in three.
65
66 Definition five : foo@{i k} false = foo@{j k} false := eq_refl.
67 End univs.
68
69 (* inference tries and succeeds with syntactic equality which doesn't eta expand *)
70 Fail Definition infer@{i j k|i < k, j < k, k < eq.u0}
71 : foo@{i k} false = foo@{j k} false :> (nat -> Type@{k})
72 := eq_refl.
73
74 End WithRed.