summaryrefslogtreecommitdiff
path: root/test-suite/success/proof_using.v
blob: c83f45e2a485fa43dd7386f2c5cd3f8ccb887060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Require Import TestSuite.admit.
Section Foo.

Variable a : nat.

Lemma l1 : True.
Fail Proof using non_existing.
Proof using a.
exact I.
Qed.

Lemma l2 : True.
Proof using a.
Admitted.

Lemma l3 : True.
Proof using a.
admit.
Qed.

End Foo.

Check (l1 3).
Check (l2 3).
Check (l3 3).

Section Bar.

Variable T : Type.
Variable a b : T.
Variable H : a = b.

Lemma l4 : a = b.
Proof using H.
exact H.
Qed.

End Bar.

Check (l4 _ 1 1 _ : 1 = 1).

Section S1.

Variable v1 : nat.

Section S2.

Variable v2 : nat.

Lemma deep : v1 = v2.
Proof using v1 v2.
admit.
Qed.

Lemma deep2 : v1 = v2.
Proof using v1 v2.
Admitted.

End S2.

Check (deep 3 : v1 = 3).
Check (deep2 3 : v1 = 3).

End S1.

Check (deep 3 4 : 3 = 4).
Check (deep2 3 4 : 3 = 4).


Section P1.

Variable x : nat.
Variable y : nat.
Variable z : nat.


Collection TOTO := x y.

Collection TITI := TOTO - x.

Lemma t1 : True. Proof using TOTO. trivial. Qed.
Lemma t2 : True. Proof using TITI. trivial. Qed.

 Section P2.
 Collection TOTO := x.
 Lemma t3 : True. Proof using TOTO. trivial. Qed.
 End P2.

Lemma t4 : True. Proof using TOTO. trivial. Qed.

End P1.

Lemma t5 : True. Fail Proof using TOTO. trivial. Qed.

Check (t1 1 2 : True).
Check (t2 1 : True).
Check (t3 1 : True).
Check (t4 1 2 : True).


Section T1.

Variable x : nat.
Hypothesis px : 1 = x.
Let w := x + 1.

Set Suggest Proof Using.

Set Default Proof Using "Type".

Lemma bla : 2 = w.
Proof.
admit.
Qed.

End T1.

Check (bla 7 : 2 = 8).

Section A.
Variable a : nat.
Variable b : nat.
Variable c : nat.
Variable H1 : a = 3.
Variable H2 : a = 3 -> b = 7.
Variable H3 : c = 3.

Lemma foo : a = a.
Proof using Type*.
pose H1 as e1.
pose H2 as e2.
reflexivity.
Qed.

Lemma bar : a = 3 -> b = 7.
Proof using b*.
exact H2.
Qed.

Lemma baz : c=3.
Proof using c*.
exact H3.
Qed.

Lemma baz2 : c=3.
Proof using c* a.
exact H3.
Qed.

End A.

Check (foo 3 7 (refl_equal 3)
               (fun _ => refl_equal 7)).
Check (bar 3 7 (refl_equal 3)
               (fun _ => refl_equal 7)).
Check (baz2 99 3 (refl_equal 3)).
Check (baz 3 (refl_equal 3)).

Section Let.

Variables a b : nat.
Let pa : a = a. Proof. reflexivity. Qed.
Unset Default Proof Using.
Set Suggest Proof Using.
Lemma test_let : a = a.
Proof using a.
exact pa.
Qed.

Let ppa : pa = pa. Proof. reflexivity. Qed.

Lemma test_let2 : pa = pa.
Proof using Type.
exact ppa.
Qed.

End Let.

Check (test_let 3).

Section Clear.

Variable a: nat.
Hypotheses H : a = 4.

Set Proof Using Clear Unused.

Lemma test_clear : a = a.
Proof using a.
Fail rewrite H.
trivial.
Qed.

End Clear.