Debian Codegraph @

test-suite/success/Tauto.v

raw
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (**** Tactics Tauto and Intuition ****)
12
13 (**** Tauto:
14 Tactic for automating proof in Intuionnistic Propositional Calculus, based on
15 the contraction-free LJT* of Dickhoff ****)
16
17 (**** Intuition:
18 Simplifications of goals, based on LJT* calcul ****)
19
20 (**** Examples of intuitionistic tautologies ****)
21 Parameter A B C D E F : Prop.
22 Parameter even : nat -> Prop.
23 Parameter P : nat -> Prop.
24
25 Lemma Ex_Wallen : (A -> B /\ C) -> (A -> B) \/ (A -> C).
26 Proof.
27 tauto.
28 Qed.
29
30 Lemma Ex_Klenne : ~ ~ (A \/ ~ A).
31 Proof.
32 tauto.
33 Qed.
34
35 Lemma Ex_Klenne' : forall n : nat, ~ ~ (even n \/ ~ even n).
36 Proof.
37 tauto.
38 Qed.
39
40 Lemma Ex_Klenne'' :
41 ~ ~ ((forall n : nat, even n) \/ ~ (forall m : nat, even m)).
42 Proof.
43 tauto.
44 Qed.
45
46 Lemma tauto : (forall x : nat, P x) -> forall y : nat, P y.
47 Proof.
48 tauto.
49 Qed.
50
51 Lemma tauto1 : A -> A.
52 Proof.
53 tauto.
54 Qed.
55
56 Lemma tauto2 : (A -> B -> C) -> (A -> B) -> A -> C.
57 Proof.
58 tauto.
59 Qed.
60
61 Lemma a : forall (x0 : A \/ B) (x1 : B /\ C), A -> B.
62 Proof.
63 tauto.
64 Qed.
65
66 Lemma a2 : (A -> B /\ C) -> (A -> B) \/ (A -> C).
67 Proof.
68 tauto.
69 Qed.
70
71 Lemma a4 : ~ A -> ~ A.
72 Proof.
73 tauto.
74 Qed.
75
76 Lemma e2 : ~ ~ (A \/ ~ A).
77 Proof.
78 tauto.
79 Qed.
80
81 Lemma e4 : ~ ~ (A \/ B -> A \/ B).
82 Proof.
83 tauto.
84 Qed.
85
86 Lemma y0 :
87 forall (x0 : A) (x1 : ~ A) (x2 : A -> B) (x3 : A \/ B) (x4 : A /\ B),
88 A -> False.
89 Proof.
90 tauto.
91 Qed.
92
93 Lemma y1 : forall x0 : (A /\ B) /\ C, B.
94 Proof.
95 tauto.
96 Qed.
97
98 Lemma y2 : forall (x0 : A) (x1 : B), C \/ B.
99 Proof.
100 tauto.
101 Qed.
102
103 Lemma y3 : forall x0 : A /\ B, B /\ A.
104 Proof.
105 tauto.
106 Qed.
107
108 Lemma y5 : forall x0 : A \/ B, B \/ A.
109 Proof.
110 tauto.
111 Qed.
112
113 Lemma y6 : forall (x0 : A -> B) (x1 : A), B.
114 Proof.
115 tauto.
116 Qed.
117
118 Lemma y7 : forall (x0 : A /\ B -> C) (x1 : B) (x2 : A), C.
119 Proof.
120 tauto.
121 Qed.
122
123 Lemma y8 : forall (x0 : A \/ B -> C) (x1 : A), C.
124 Proof.
125 tauto.
126 Qed.
127
128 Lemma y9 : forall (x0 : A \/ B -> C) (x1 : B), C.
129 Proof.
130 tauto.
131 Qed.
132
133 Lemma y10 : forall (x0 : (A -> B) -> C) (x1 : B), C.
134 Proof.
135 tauto.
136 Qed.
137
138 (* This example took much time with the old version of Tauto *)
139 Lemma critical_example0 : (~ ~ B -> B) -> (A -> B) -> ~ ~ A -> B.
140 Proof.
141 tauto.
142 Qed.
143
144 (* Same remark as previously *)
145 Lemma critical_example1 : (~ ~ B -> B) -> (~ B -> ~ A) -> ~ ~ A -> B.
146 Proof.
147 tauto.
148 Qed.
149
150 (* This example took very much time (about 3mn on a PIII 450MHz in bytecode)
151 with the old Tauto. Now, it's immediate (less than 1s). *)
152 Lemma critical_example2 : (~ A <-> B) -> (~ B <-> A) -> (~ ~ A <-> A).
153 Proof.
154 tauto.
155 Qed.
156
157 (* This example was a bug *)
158 Lemma old_bug0 :
159 (~ A <-> B) -> (~ (C \/ E) <-> D /\ F) -> (~ (C \/ A \/ E) <-> D /\ B /\ F).
160 Proof.
161 tauto.
162 Qed.
163
164 (* Another bug *)
165 Lemma old_bug1 : ((A -> B -> False) -> False) -> (B -> False) -> False.
166 Proof.
167 tauto.
168 Qed.
169
170 (* A bug again *)
171 Lemma old_bug2 :
172 ((((C -> False) -> A) -> ((B -> False) -> A) -> False) -> False) ->
173 (((C -> B -> False) -> False) -> False) -> ~ A -> A.
174 Proof.
175 tauto.
176 Qed.
177
178 (* A bug from CNF form *)
179 Lemma old_bug3 :
180 ((~ A \/ B) /\ (~ B \/ B) /\ (~ A \/ ~ B) /\ (~ B \/ ~ B) -> False) ->
181 ~ ((A -> B) -> B) -> False.
182 Proof.
183 tauto.
184 Qed.
185
186 (* sometimes, the behaviour of Tauto depends on the order of the hyps *)
187 Lemma old_bug3bis :
188 ~ ((A -> B) -> B) ->
189 ((~ B \/ ~ B) /\ (~ B \/ ~ A) /\ (B \/ ~ B) /\ (B \/ ~ A) -> False) -> False.
190 Proof.
191 tauto.
192 Qed.
193
194 (* A bug found by Freek Wiedijk <[email protected]> *)
195 Lemma new_bug :
196 ((A <-> B) -> (B <-> C)) ->
197 ((B <-> C) -> (C <-> A)) -> ((C <-> A) -> (A <-> B)) -> (A <-> B).
198 Proof.
199 tauto.
200 Qed.
201
202
203 (* A private club has the following rules :
204 *
205 * . rule 1 : Every non-scottish member wears red socks
206 * . rule 2 : Every member wears a kilt or doesn't wear red socks
207 * . rule 3 : The married members don't go out on sunday
208 * . rule 4 : A member goes out on sunday if and only if he is scottish
209 * . rule 5 : Every member who wears a kilt is scottish and married
210 * . rule 6 : Every scottish member wears a kilt
211 *
212 * Actually, no one can be accepted !
213 *)
214
215 Section club.
216
217 Variable Scottish RedSocks WearKilt Married GoOutSunday : Prop.
218
219 Hypothesis rule1 : ~ Scottish -> RedSocks.
220 Hypothesis rule2 : WearKilt \/ ~ RedSocks.
221 Hypothesis rule3 : Married -> ~ GoOutSunday.
222 Hypothesis rule4 : GoOutSunday <-> Scottish.
223 Hypothesis rule5 : WearKilt -> Scottish /\ Married.
224 Hypothesis rule6 : Scottish -> WearKilt.
225
226 Lemma NoMember : False.
227 tauto.
228 Qed.
229
230 End club.
231
232 (**** Use of Intuition ****)
233 Lemma intu0 :
234 (forall x : nat, P x) /\ B -> (forall y : nat, P y) /\ P 0 \/ B /\ P 0.
235 Proof.
236 intuition.
237 Qed.
238
239 Lemma intu1 :
240 (forall A : Prop, A \/ ~ A) -> forall x y : nat, x = y \/ x <> y.
241 Proof.
242 intuition.
243 Qed.
244