Debian Codegraph @

test-suite/success/record_postponed_eta.v

raw
1 Set Primitive Projections.
2
3 Record RTypeToSProp (A : SProp) : Type := {
4 f1 : A
5 }.
6
7 (* Conversion when record is in Type and field in SProp fails correctly *)
8 Goal forall (A:SProp) (r2 : RTypeToSProp A), eq r2 {| f1 := r2.(f1 A) |}.
9 Proof. intros A r2. Fail reflexivity. Abort.
10 (* The command has indeed failed with message:
11 In environment
12 A : SProp
13 r2 : RTypeToSProp A
14 Unable to unify "{| f1 := f1 _ r2 |}" with "r2" *)
15
16 Record RPropToSProp (A : SProp) : Prop := {
17 f2 : A
18 }.
19
20 (* Conversion when record is in Prop and field in SProp fails correctly *)
21 Goal forall (A:SProp) (r2 : RPropToSProp A), eq r2 {| f2 := r2.(f2 A) |}.
22 Proof. intros A r2. Fail reflexivity. Abort.
23 (* The command has indeed failed with message:
24 In environment
25 A : SProp
26 r2 : RPropToSProp A
27 Unable to unify "{| f2 := f2 _ r2 |}" with "r2". *)
28
29 Set Universe Polymorphism.
30
31 Record RSToSProp@{s;u|s -> SProp} (A : SProp) : Type@{s;u} := {
32 f3 : A
33 }.
34
35 Inductive eq@{s s'; u} (A : Type@{s;u}) (a : A) : A -> Prop :=
36 eq_refl : eq A a a.
37
38 Arguments eq {_}.
39 Arguments eq_refl {_ _}.
40
41 (* Conversion when record is in Type and field in SProp fails correctly *)
42 Goal forall (A:SProp) (r2 : RSToSProp@{Type;0} A), eq r2 {| f3 := r2.(f3 A) |}.
43 Proof. intros A r2. Fail reflexivity. Abort.
44 (* The command has indeed failed with message:
45 In environment
46 A : SProp
47 r2 : RSToProp A
48 Unable to unify "{| f3 := f3 _ r2 |}" with "r2". *)
49
50 Set Debug "cClosure".
51 (* Conversion when record and field are instantiated to SProp checks correctly *)
52 Goal forall (A:SProp) (r2 : RSToSProp@{SProp;0} A), eq r2 {| f3 := r2.(f3 A) |}.
53 Proof. intros A r2. reflexivity. Qed.
54
55 Record RSToS'@{s1 s2;u1 u2| s2 -> s1 +} (A : Type@{s1;u1}): Type@{s2;u2} := {
56 f4 : A
57 }.
58
59 (* Conversion when record is in Type and field in SProp fails correctly *)
60 Goal forall (A:SProp) (r2 : RSToS'@{SProp Type;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
61 Proof. intros A r2. Fail reflexivity. Abort.
62 (* The command has indeed failed with message:
63 In environment
64 A : SProp
65 r2 : RSToS' A
66 Unable to unify "{| f4 := f4 _ r2 |}" with "r2". *)
67
68 (* Conversion when record is in Prop and field in SProp fails correctly *)
69 Goal forall (A:SProp) (r2 : RSToS'@{SProp Prop;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
70 Proof.
71 intros A r2.
72 Fail reflexivity.
73 (* The command has indeed failed with message:
74 In environment
75 A : SProp
76 r2 : RSToS' A
77 Unable to unify "{| f4 := f4 _ r2 |}" with "r2". *)
78 Fail destruct r2. (* prim record must have eta for dependent elim *)
79 Abort.
80
81 (* Conversion when record and field are instantiated to SProp checks correctly *)
82 Goal forall (A:SProp) (r2 : RSToS'@{SProp SProp;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
83 Proof. intros A r2. reflexivity. Qed.
84
85 (* Conversion when record and field are instantiated to the same sort (Type) still fails correctly because we haven't implemented it *)
86 Goal forall (A:Set) (r2 : RSToS'@{Type Type;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
87 Proof. intros A r2. Fail reflexivity. Abort.
88
89 (* Conversion when record and field are instantiated to the same sort (Prop) still fails correctly because we haven't implemented it *)
90 Goal forall (A:Prop) (r2 : RSToS'@{Prop Prop;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
91 Proof. intros A r2. Fail reflexivity. Abort.
92
93 (* Conversion when record is in Type and field is in Prop still fails correctly because we haven't implemented it *)
94 Goal forall (A:Prop) (r2 : RSToS'@{Prop Type;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
95 Proof. intros A r2. Fail reflexivity. Abort.
96
97 Section Sorts.
98 Sort s s'.
99
100 Constraint s -> SProp.
101
102 (* Conversion when record is in Type and field in SProp fails correctly *)
103 Goal forall (A:SProp) (r2 : RSToSProp@{s;0} A), eq r2 {| f3 := r2.(f3 A) |}.
104 Proof. intros A r2. Fail reflexivity. Abort.
105 (* The command has indeed failed with message:
106 In environment
107 A : SProp
108 r2 : RSToProp A
109 Unable to unify "{| f3 := f3 _ r2 |}" with "r2". *)
110
111 Constraint s' -> s.
112
113 (* Conversion when record and field are instantiated to the different sorts fails correctly *)
114 Goal forall (A:Type@{s;0}) (r2 : RSToS'@{s s';0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
115 Proof. intros A r2. Fail reflexivity. Abort.
116 (* The command has indeed failed with message:
117 In environment
118 A : Type@{s ; _}
119 r2 : RSToS' A
120 Unable to unify "{| f4 := f4 _ r2 |}" with "r2". *)
121
122 (* Conversion when record and field are instantiated to the same sort (Type) still fails correctly because we haven't implemented it *)
123 Goal forall (A:Type@{s;0}) (r2 : RSToS'@{s s;0 0} A), eq r2 {| f4 := r2.(f4 A) |}.
124 Proof. intros A r2. Fail reflexivity. Abort.
125 End Sorts.