Debian Codegraph @

test-suite/success/proof_using.v

raw
1 Require Import TestSuite.admit.
2 Section Foo.
3
4 Variable a : nat.
5
6 Lemma l1 : True.
7 Fail Proof using non_existing.
8 Proof using a.
9 exact I.
10 Qed.
11
12 Lemma l2 : True.
13 Proof using a.
14 Admitted.
15
16 Lemma l3 : True.
17 Proof using a.
18 admit.
19 Qed.
20
21 End Foo.
22
23 Check (l1 3).
24 Check (l2 3).
25 Check (l3 3).
26
27 Section Bar.
28
29 Variable T : Type.
30 Variable a b : T.
31 Variable H : a = b.
32
33 Lemma l4 : a = b.
34 Proof using H.
35 exact H.
36 Qed.
37
38 End Bar.
39
40 Check (l4 _ 1 1 _ : 1 = 1).
41
42 Section S1.
43
44 Variable v1 : nat.
45
46 Section S2.
47
48 Variable v2 : nat.
49
50 Lemma deep : v1 = v2.
51 Proof using v1 v2.
52 admit.
53 Qed.
54
55 Lemma deep2 : v1 = v2.
56 Proof using v1 v2.
57 Admitted.
58
59 End S2.
60
61 Check (deep 3 : v1 = 3).
62 Check (deep2 3 : v1 = 3).
63
64 End S1.
65
66 Check (deep 3 4 : 3 = 4).
67 Check (deep2 3 4 : 3 = 4).
68
69
70 Section P1.
71
72 Variable x : nat.
73 Variable y : nat.
74 Variable z : nat.
75
76
77 Collection TOTO := x y.
78
79 Collection TITI := TOTO - x.
80
81 Lemma t1 : True. Proof using TOTO. trivial. Qed.
82 Lemma t2 : True. Proof using TITI. trivial. Qed.
83
84 Section P2.
85 Collection TOTO := x.
86 Lemma t3 : True. Proof using TOTO. trivial. Qed.
87 End P2.
88
89 Lemma t4 : True. Proof using TOTO. trivial. Qed.
90
91 End P1.
92
93 Lemma t5 : True. Fail Proof using TOTO. trivial. Qed.
94
95 Check (t1 1 2 : True).
96 Check (t2 1 : True).
97 Check (t3 1 : True).
98 Check (t4 1 2 : True).
99
100
101 Section T1.
102
103 Variable x : nat.
104 Hypothesis px : 1 = x.
105 Let w := x + 1.
106
107 Set Suggest Proof Using.
108
109 Set Default Proof Using "Type".
110
111 Lemma bla : 2 = w.
112 Proof.
113 admit.
114 Qed.
115
116 End T1.
117
118 Check (bla 7 : 2 = 8).
119
120 Section A.
121 Variable a : nat.
122 Variable b : nat.
123 Variable c : nat.
124 Variable H1 : a = 3.
125 Variable H2 : a = 3 -> b = 7.
126 Variable H3 : c = 3.
127
128 Lemma foo : a = a.
129 Proof using Type*.
130 pose H1 as e1.
131 pose H2 as e2.
132 reflexivity.
133 Qed.
134
135 Lemma bar : a = 3 -> b = 7.
136 Proof using b*.
137 exact H2.
138 Qed.
139
140 Lemma baz : c=3.
141 Proof using c*.
142 exact H3.
143 Qed.
144
145 Lemma baz2 : c=3.
146 Proof using c* a.
147 exact H3.
148 Qed.
149
150 End A.
151
152 Check (foo 3 7 (refl_equal 3)
153 (fun _ => refl_equal 7)).
154 Check (bar 3 7 (refl_equal 3)
155 (fun _ => refl_equal 7)).
156 Check (baz2 99 3 (refl_equal 3)).
157 Check (baz 3 (refl_equal 3)).
158
159 Section Let.
160
161 Variables a b : nat.
162 Let pa : a = a. Proof. reflexivity. Qed.
163 Unset Default Proof Using.
164 Set Suggest Proof Using.
165 Lemma test_let : a = a.
166 Proof using a.
167 exact pa.
168 Qed.
169
170 Let ppa : pa = pa. Proof. reflexivity. Qed.
171
172 Lemma test_let2 : pa = pa.
173 Proof using Type.
174 exact ppa.
175 Qed.
176
177 End Let.
178
179 Check (test_let 3).
180
181 (* Disabled
182 Section Clear.
183
184 Variable a: nat.
185 Hypotheses H : a = 4.
186
187 Set Proof Using Clear Unused.
188
189 Lemma test_clear : a = a.
190 Proof using a.
191 Fail rewrite H.
192 trivial.
193 Qed.
194
195 End Clear.
196 *)
197
198 Module InteractiveUsing.
199
200 Section S.
201
202 Variable m : nat.
203 Variable e : m = m.
204
205 #[using="e"]
206 Definition a := 0.
207
208 #[using="e"]
209 Definition a' : nat.
210 exact 0.
211 Defined.
212
213 #[using="e"]
214 Fixpoint f (n:nat) : nat :=
215 match n with 0 => 0 | S n => f n end.
216
217 #[using="e"]
218 Fixpoint f' (n:nat) : nat.
219 exact (match n with 0 => 0 | S n => f n end).
220 Defined.
221
222 #[using="Type"]
223 Fixpoint f1 (n:nat) : nat :=
224 match n with 0 => 0 | S n => match f2 n with eq_refl => n end end
225 with f2 (n:nat) : m = m :=
226 match n with 0 => eq_refl | S n => match f1 n with 0 => eq_refl | S _ => eq_refl end end.
227
228 #[using="Type"]
229 Fixpoint f1' (n:nat) : nat with f2' (n:nat) : m = m.
230 exact (match n with 0 => 0 | S n => match f2' n with eq_refl => n end end).
231 exact (match n with 0 => eq_refl | S n => match f1' n with 0 => eq_refl | S _ => eq_refl end end).
232 Defined.
233
234 CoInductive Stream : Set := Cons : Stream -> Stream.
235
236 #[using="e"]
237 CoFixpoint g : Stream := Cons g.
238
239 #[using="e"]
240 CoFixpoint g' : Stream.
241 exact (Cons g).
242 Defined.
243
244 #[using="e"]
245 Lemma g1 (n:nat) : nat with g2 (n:nat) : m = m.
246 exact (match n with 0 => 0 | S n => match g2 n with eq_refl => n end end).
247 exact (match n with 0 => eq_refl | S n => match g1 n with 0 => eq_refl | S _ => eq_refl end end).
248 Defined.
249
250 #[using="Type"]
251 Lemma g1' (n:nat) : nat with g2' (n:nat) : m = m.
252 exact (match n with 0 => 0 | S n => match g2' n with eq_refl => n end end).
253 exact (match n with 0 => eq_refl | S n => match g1' n with 0 => eq_refl | S _ => eq_refl end end).
254 Defined.
255
256 End S.
257
258 Check eq_refl : a 0 (eq_refl 0) = 0.
259 Check eq_refl : a' 0 (eq_refl 0) = 0.
260 Check eq_refl : f 10 (eq_refl 10) 2 = 0.
261 Check eq_refl : f' 10 (eq_refl 10) 2 = 0.
262 Check eq_refl : f1 10 2 = 1.
263 Check eq_refl : f1' 10 2 = 1.
264 Check g 0 eq_refl : Stream.
265 Check g' 0 eq_refl : Stream.
266 Check eq_refl : g1 10 (eq_refl 10) 2 = 1.
267 Check eq_refl : g1' 10 2 = 1.
268
269 End InteractiveUsing.