14350
|
1 |
(* Title: HOL/ex/Refute_Examples.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Tjark Weber
|
|
4 |
Copyright 2003-2004
|
|
5 |
*)
|
|
6 |
|
|
7 |
(* See 'HOL/Refute.thy' for help. *)
|
|
8 |
|
|
9 |
header {* Examples for the 'refute' command *}
|
|
10 |
|
|
11 |
theory Refute_Examples = Main:
|
|
12 |
|
14455
|
13 |
lemma "P x"
|
14350
|
14 |
refute
|
|
15 |
oops
|
|
16 |
|
|
17 |
lemma "P \<and> Q"
|
|
18 |
apply (rule conjI)
|
|
19 |
refute 1 -- {* refutes @{term "P"} *}
|
|
20 |
refute 2 -- {* refutes @{term "Q"} *}
|
|
21 |
refute -- {* equivalent to 'refute 1' *}
|
14455
|
22 |
-- {* here 'refute 3' would cause an exception, since we only have 2 subgoals *}
|
14465
|
23 |
refute [maxsize=5] -- {* we can override parameters ... *}
|
|
24 |
refute [satsolver="dpll"] 2 -- {* ... and specify a subgoal at the same time *}
|
14350
|
25 |
oops
|
|
26 |
|
14455
|
27 |
section {* Examples and Test Cases *}
|
14350
|
28 |
|
|
29 |
subsection {* Propositional logic *}
|
|
30 |
|
|
31 |
lemma "True"
|
|
32 |
refute
|
|
33 |
apply auto
|
|
34 |
done
|
|
35 |
|
|
36 |
lemma "False"
|
|
37 |
refute
|
|
38 |
oops
|
|
39 |
|
|
40 |
lemma "P"
|
|
41 |
refute
|
|
42 |
oops
|
|
43 |
|
|
44 |
lemma "~ P"
|
|
45 |
refute
|
|
46 |
oops
|
|
47 |
|
|
48 |
lemma "P & Q"
|
|
49 |
refute
|
|
50 |
oops
|
|
51 |
|
|
52 |
lemma "P | Q"
|
|
53 |
refute
|
|
54 |
oops
|
|
55 |
|
|
56 |
lemma "P \<longrightarrow> Q"
|
|
57 |
refute
|
|
58 |
oops
|
|
59 |
|
|
60 |
lemma "(P::bool) = Q"
|
|
61 |
refute
|
|
62 |
oops
|
|
63 |
|
|
64 |
lemma "(P | Q) \<longrightarrow> (P & Q)"
|
|
65 |
refute
|
|
66 |
oops
|
|
67 |
|
|
68 |
subsection {* Predicate logic *}
|
|
69 |
|
14455
|
70 |
lemma "P x y z"
|
14350
|
71 |
refute
|
|
72 |
oops
|
|
73 |
|
|
74 |
lemma "P x y \<longrightarrow> P y x"
|
|
75 |
refute
|
|
76 |
oops
|
|
77 |
|
14455
|
78 |
lemma "P (f (f x)) \<longrightarrow> P x \<longrightarrow> P (f x)"
|
|
79 |
refute
|
|
80 |
oops
|
|
81 |
|
14350
|
82 |
subsection {* Equality *}
|
|
83 |
|
|
84 |
lemma "P = True"
|
|
85 |
refute
|
|
86 |
oops
|
|
87 |
|
|
88 |
lemma "P = False"
|
|
89 |
refute
|
|
90 |
oops
|
|
91 |
|
|
92 |
lemma "x = y"
|
|
93 |
refute
|
|
94 |
oops
|
|
95 |
|
|
96 |
lemma "f x = g x"
|
|
97 |
refute
|
|
98 |
oops
|
|
99 |
|
|
100 |
lemma "(f::'a\<Rightarrow>'b) = g"
|
|
101 |
refute
|
|
102 |
oops
|
|
103 |
|
|
104 |
lemma "(f::('d\<Rightarrow>'d)\<Rightarrow>('c\<Rightarrow>'d)) = g"
|
|
105 |
refute
|
|
106 |
oops
|
|
107 |
|
|
108 |
lemma "distinct [a,b]"
|
14809
|
109 |
refute
|
14350
|
110 |
apply simp
|
|
111 |
refute
|
|
112 |
oops
|
|
113 |
|
|
114 |
subsection {* First-Order Logic *}
|
|
115 |
|
|
116 |
lemma "\<exists>x. P x"
|
|
117 |
refute
|
|
118 |
oops
|
|
119 |
|
|
120 |
lemma "\<forall>x. P x"
|
|
121 |
refute
|
|
122 |
oops
|
|
123 |
|
|
124 |
lemma "EX! x. P x"
|
|
125 |
refute
|
|
126 |
oops
|
|
127 |
|
|
128 |
lemma "Ex P"
|
|
129 |
refute
|
|
130 |
oops
|
|
131 |
|
|
132 |
lemma "All P"
|
|
133 |
refute
|
|
134 |
oops
|
|
135 |
|
|
136 |
lemma "Ex1 P"
|
|
137 |
refute
|
|
138 |
oops
|
|
139 |
|
|
140 |
lemma "(\<exists>x. P x) \<longrightarrow> (\<forall>x. P x)"
|
|
141 |
refute
|
|
142 |
oops
|
|
143 |
|
|
144 |
lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>y. \<forall>x. P x y)"
|
|
145 |
refute
|
|
146 |
oops
|
|
147 |
|
|
148 |
lemma "(\<exists>x. P x) \<longrightarrow> (EX! x. P x)"
|
|
149 |
refute
|
|
150 |
oops
|
|
151 |
|
|
152 |
text {* A true statement (also testing names of free and bound variables being identical) *}
|
|
153 |
|
|
154 |
lemma "(\<forall>x y. P x y \<longrightarrow> P y x) \<longrightarrow> (\<forall>x. P x y) \<longrightarrow> P y x"
|
14809
|
155 |
refute [maxsize=6]
|
14350
|
156 |
apply fast
|
|
157 |
done
|
|
158 |
|
14809
|
159 |
text {* "A type has at most 4 elements." *}
|
14350
|
160 |
|
14809
|
161 |
lemma "a=b | a=c | a=d | a=e | b=c | b=d | b=e | c=d | c=e | d=e"
|
14455
|
162 |
refute
|
|
163 |
oops
|
|
164 |
|
14809
|
165 |
lemma "\<forall>a b c d e. a=b | a=c | a=d | a=e | b=c | b=d | b=e | c=d | c=e | d=e"
|
14350
|
166 |
refute
|
|
167 |
oops
|
|
168 |
|
|
169 |
text {* "Every reflexive and symmetric relation is transitive." *}
|
|
170 |
|
|
171 |
lemma "\<lbrakk> \<forall>x. P x x; \<forall>x y. P x y \<longrightarrow> P y x \<rbrakk> \<Longrightarrow> P x y \<longrightarrow> P y z \<longrightarrow> P x z"
|
14489
|
172 |
refute
|
14350
|
173 |
oops
|
|
174 |
|
14465
|
175 |
text {* The "Drinker's theorem" ... *}
|
14350
|
176 |
|
|
177 |
lemma "\<exists>x. f x = g x \<longrightarrow> f = g"
|
14809
|
178 |
refute [maxsize=4]
|
14350
|
179 |
apply (auto simp add: ext)
|
|
180 |
done
|
|
181 |
|
14465
|
182 |
text {* ... and an incorrect version of it *}
|
14350
|
183 |
|
|
184 |
lemma "(\<exists>x. f x = g x) \<longrightarrow> f = g"
|
|
185 |
refute
|
|
186 |
oops
|
|
187 |
|
|
188 |
text {* "Every function has a fixed point." *}
|
|
189 |
|
|
190 |
lemma "\<exists>x. f x = x"
|
|
191 |
refute
|
|
192 |
oops
|
|
193 |
|
|
194 |
text {* "Function composition is commutative." *}
|
|
195 |
|
|
196 |
lemma "f (g x) = g (f x)"
|
|
197 |
refute
|
|
198 |
oops
|
|
199 |
|
|
200 |
text {* "Two functions that are equivalent wrt.\ the same predicate 'P' are equal." *}
|
|
201 |
|
|
202 |
lemma "((P::('a\<Rightarrow>'b)\<Rightarrow>bool) f = P g) \<longrightarrow> (f x = g x)"
|
|
203 |
refute
|
|
204 |
oops
|
|
205 |
|
|
206 |
subsection {* Higher-Order Logic *}
|
|
207 |
|
|
208 |
lemma "\<exists>P. P"
|
|
209 |
refute
|
|
210 |
apply auto
|
|
211 |
done
|
|
212 |
|
|
213 |
lemma "\<forall>P. P"
|
|
214 |
refute
|
|
215 |
oops
|
|
216 |
|
|
217 |
lemma "EX! P. P"
|
|
218 |
refute
|
|
219 |
apply auto
|
|
220 |
done
|
|
221 |
|
|
222 |
lemma "EX! P. P x"
|
|
223 |
refute
|
|
224 |
oops
|
|
225 |
|
|
226 |
lemma "P Q | Q x"
|
|
227 |
refute
|
|
228 |
oops
|
|
229 |
|
14455
|
230 |
lemma "P All"
|
|
231 |
refute
|
|
232 |
oops
|
|
233 |
|
|
234 |
lemma "P Ex"
|
|
235 |
refute
|
|
236 |
oops
|
|
237 |
|
|
238 |
lemma "P Ex1"
|
|
239 |
refute
|
|
240 |
oops
|
|
241 |
|
14350
|
242 |
text {* "The transitive closure 'T' of an arbitrary relation 'P' is non-empty." *}
|
|
243 |
|
|
244 |
constdefs
|
|
245 |
"trans" :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
|
|
246 |
"trans P == (ALL x y z. P x y \<longrightarrow> P y z \<longrightarrow> P x z)"
|
|
247 |
"subset" :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
|
|
248 |
"subset P Q == (ALL x y. P x y \<longrightarrow> Q x y)"
|
|
249 |
"trans_closure" :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
|
|
250 |
"trans_closure P Q == (subset Q P) & (trans P) & (ALL R. subset Q R \<longrightarrow> trans R \<longrightarrow> subset P R)"
|
|
251 |
|
|
252 |
lemma "trans_closure T P \<longrightarrow> (\<exists>x y. T x y)"
|
|
253 |
refute
|
|
254 |
oops
|
|
255 |
|
|
256 |
text {* "The union of transitive closures is equal to the transitive closure of unions." *}
|
|
257 |
|
|
258 |
lemma "(\<forall>x y. (P x y | R x y) \<longrightarrow> T x y) \<longrightarrow> trans T \<longrightarrow> (\<forall>Q. (\<forall>x y. (P x y | R x y) \<longrightarrow> Q x y) \<longrightarrow> trans Q \<longrightarrow> subset T Q)
|
|
259 |
\<longrightarrow> trans_closure TP P
|
|
260 |
\<longrightarrow> trans_closure TR R
|
|
261 |
\<longrightarrow> (T x y = (TP x y | TR x y))"
|
14809
|
262 |
refute [satsolver="dpll"]
|
14350
|
263 |
oops
|
|
264 |
|
|
265 |
text {* "Every surjective function is invertible." *}
|
|
266 |
|
|
267 |
lemma "(\<forall>y. \<exists>x. y = f x) \<longrightarrow> (\<exists>g. \<forall>x. g (f x) = x)"
|
|
268 |
refute
|
|
269 |
oops
|
|
270 |
|
|
271 |
text {* "Every invertible function is surjective." *}
|
|
272 |
|
|
273 |
lemma "(\<exists>g. \<forall>x. g (f x) = x) \<longrightarrow> (\<forall>y. \<exists>x. y = f x)"
|
|
274 |
refute
|
|
275 |
oops
|
|
276 |
|
|
277 |
text {* Every point is a fixed point of some function. *}
|
|
278 |
|
|
279 |
lemma "\<exists>f. f x = x"
|
14809
|
280 |
refute [maxsize=4]
|
14350
|
281 |
apply (rule_tac x="\<lambda>x. x" in exI)
|
|
282 |
apply simp
|
|
283 |
done
|
|
284 |
|
14465
|
285 |
text {* Axiom of Choice: first an incorrect version ... *}
|
14350
|
286 |
|
|
287 |
lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (EX!f. \<forall>x. P x (f x))"
|
|
288 |
refute
|
|
289 |
oops
|
|
290 |
|
14465
|
291 |
text {* ... and now two correct ones *}
|
14350
|
292 |
|
|
293 |
lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>f. \<forall>x. P x (f x))"
|
14809
|
294 |
refute [maxsize=4]
|
14350
|
295 |
apply (simp add: choice)
|
|
296 |
done
|
|
297 |
|
|
298 |
lemma "(\<forall>x. EX!y. P x y) \<longrightarrow> (EX!f. \<forall>x. P x (f x))"
|
14809
|
299 |
refute [maxsize=2, satsolver="dpll"]
|
14350
|
300 |
apply auto
|
|
301 |
apply (simp add: ex1_implies_ex choice)
|
|
302 |
apply (fast intro: ext)
|
|
303 |
done
|
|
304 |
|
|
305 |
subsection {* Meta-logic *}
|
|
306 |
|
|
307 |
lemma "!!x. P x"
|
|
308 |
refute
|
|
309 |
oops
|
|
310 |
|
|
311 |
lemma "f x == g x"
|
|
312 |
refute
|
|
313 |
oops
|
|
314 |
|
|
315 |
lemma "P \<Longrightarrow> Q"
|
|
316 |
refute
|
|
317 |
oops
|
|
318 |
|
|
319 |
lemma "\<lbrakk> P; Q; R \<rbrakk> \<Longrightarrow> S"
|
|
320 |
refute
|
|
321 |
oops
|
|
322 |
|
|
323 |
subsection {* Schematic variables *}
|
|
324 |
|
|
325 |
lemma "?P"
|
|
326 |
refute
|
|
327 |
apply auto
|
|
328 |
done
|
|
329 |
|
|
330 |
lemma "x = ?y"
|
|
331 |
refute
|
|
332 |
apply auto
|
|
333 |
done
|
|
334 |
|
|
335 |
subsection {* Abstractions *}
|
|
336 |
|
|
337 |
lemma "(\<lambda>x. x) = (\<lambda>x. y)"
|
|
338 |
refute
|
|
339 |
oops
|
|
340 |
|
|
341 |
lemma "(\<lambda>f. f x) = (\<lambda>f. True)"
|
|
342 |
refute
|
|
343 |
oops
|
|
344 |
|
|
345 |
lemma "(\<lambda>x. x) = (\<lambda>y. y)"
|
|
346 |
refute
|
|
347 |
apply simp
|
|
348 |
done
|
|
349 |
|
|
350 |
subsection {* Sets *}
|
|
351 |
|
|
352 |
lemma "P (A::'a set)"
|
|
353 |
refute
|
|
354 |
oops
|
|
355 |
|
|
356 |
lemma "P (A::'a set set)"
|
|
357 |
refute
|
|
358 |
oops
|
|
359 |
|
|
360 |
lemma "{x. P x} = {y. P y}"
|
14489
|
361 |
refute
|
14350
|
362 |
apply simp
|
|
363 |
done
|
|
364 |
|
|
365 |
lemma "x : {x. P x}"
|
|
366 |
refute
|
|
367 |
oops
|
|
368 |
|
14455
|
369 |
lemma "P op:"
|
|
370 |
refute
|
|
371 |
oops
|
|
372 |
|
|
373 |
lemma "P (op: x)"
|
|
374 |
refute
|
|
375 |
oops
|
|
376 |
|
|
377 |
lemma "P Collect"
|
|
378 |
refute
|
|
379 |
oops
|
|
380 |
|
14350
|
381 |
lemma "A Un B = A Int B"
|
|
382 |
refute
|
|
383 |
oops
|
|
384 |
|
|
385 |
lemma "(A Int B) Un C = (A Un C) Int B"
|
|
386 |
refute
|
|
387 |
oops
|
|
388 |
|
|
389 |
lemma "Ball A P \<longrightarrow> Bex A P"
|
14455
|
390 |
refute
|
|
391 |
oops
|
|
392 |
|
|
393 |
subsection {* arbitrary *}
|
|
394 |
|
|
395 |
lemma "arbitrary"
|
|
396 |
refute
|
|
397 |
oops
|
|
398 |
|
|
399 |
lemma "P arbitrary"
|
|
400 |
refute
|
|
401 |
oops
|
|
402 |
|
|
403 |
lemma "arbitrary x"
|
|
404 |
refute
|
|
405 |
oops
|
|
406 |
|
|
407 |
lemma "arbitrary arbitrary"
|
|
408 |
refute
|
|
409 |
oops
|
|
410 |
|
|
411 |
subsection {* The *}
|
|
412 |
|
|
413 |
lemma "The P"
|
|
414 |
refute
|
|
415 |
oops
|
|
416 |
|
|
417 |
lemma "P The"
|
14350
|
418 |
refute
|
|
419 |
oops
|
|
420 |
|
14455
|
421 |
lemma "P (The P)"
|
|
422 |
refute
|
|
423 |
oops
|
|
424 |
|
|
425 |
lemma "(THE x. x=y) = z"
|
|
426 |
refute
|
|
427 |
oops
|
|
428 |
|
|
429 |
lemma "Ex P \<longrightarrow> P (The P)"
|
14489
|
430 |
refute
|
14455
|
431 |
oops
|
|
432 |
|
|
433 |
subsection {* Eps *}
|
|
434 |
|
|
435 |
lemma "Eps P"
|
|
436 |
refute
|
|
437 |
oops
|
|
438 |
|
|
439 |
lemma "P Eps"
|
|
440 |
refute
|
|
441 |
oops
|
|
442 |
|
|
443 |
lemma "P (Eps P)"
|
|
444 |
refute
|
|
445 |
oops
|
|
446 |
|
|
447 |
lemma "(SOME x. x=y) = z"
|
|
448 |
refute
|
|
449 |
oops
|
|
450 |
|
|
451 |
lemma "Ex P \<longrightarrow> P (Eps P)"
|
14489
|
452 |
refute [maxsize=3]
|
14455
|
453 |
apply (auto simp add: someI)
|
|
454 |
done
|
|
455 |
|
14809
|
456 |
subsection {* Subtypes (typedef), typedecl *}
|
|
457 |
|
|
458 |
typedef 'a myTdef = "insert (arbitrary::'a) (arbitrary::'a set)"
|
|
459 |
-- {* a completely unspecified non-empty subset of @{typ "'a"} *}
|
|
460 |
by auto
|
|
461 |
|
|
462 |
lemma "(x::'a myTdef) = y"
|
|
463 |
refute [satsolver=dpll]
|
|
464 |
oops
|
|
465 |
|
|
466 |
typedecl myTdecl
|
|
467 |
|
|
468 |
typedef 'a T_bij = "{(f::'a\<Rightarrow>'a). \<forall>y. \<exists>!x. f x = y}"
|
|
469 |
by auto
|
|
470 |
|
|
471 |
lemma "P (f::(myTdecl myTdef) T_bij)"
|
|
472 |
refute
|
|
473 |
oops
|
|
474 |
|
14455
|
475 |
subsection {* Inductive datatypes *}
|
14350
|
476 |
|
|
477 |
subsubsection {* unit *}
|
|
478 |
|
|
479 |
lemma "P (x::unit)"
|
|
480 |
refute
|
|
481 |
oops
|
|
482 |
|
|
483 |
lemma "\<forall>x::unit. P x"
|
|
484 |
refute
|
|
485 |
oops
|
|
486 |
|
|
487 |
lemma "P ()"
|
|
488 |
refute
|
|
489 |
oops
|
|
490 |
|
14455
|
491 |
subsubsection {* option *}
|
|
492 |
|
|
493 |
lemma "P (x::'a option)"
|
|
494 |
refute
|
|
495 |
oops
|
|
496 |
|
|
497 |
lemma "\<forall>x::'a option. P x"
|
|
498 |
refute
|
|
499 |
oops
|
|
500 |
|
14809
|
501 |
lemma "P None"
|
|
502 |
refute
|
|
503 |
oops
|
|
504 |
|
14455
|
505 |
lemma "P (Some x)"
|
|
506 |
refute
|
|
507 |
oops
|
|
508 |
|
14350
|
509 |
subsubsection {* * *}
|
|
510 |
|
|
511 |
lemma "P (x::'a*'b)"
|
14455
|
512 |
refute
|
14350
|
513 |
oops
|
|
514 |
|
|
515 |
lemma "\<forall>x::'a*'b. P x"
|
14455
|
516 |
refute
|
14350
|
517 |
oops
|
|
518 |
|
|
519 |
lemma "P (x,y)"
|
14455
|
520 |
refute
|
14350
|
521 |
oops
|
|
522 |
|
|
523 |
lemma "P (fst x)"
|
14455
|
524 |
refute
|
14350
|
525 |
oops
|
|
526 |
|
|
527 |
lemma "P (snd x)"
|
14455
|
528 |
refute
|
|
529 |
oops
|
|
530 |
|
|
531 |
lemma "P Pair"
|
|
532 |
refute
|
14350
|
533 |
oops
|
|
534 |
|
|
535 |
subsubsection {* + *}
|
|
536 |
|
|
537 |
lemma "P (x::'a+'b)"
|
14455
|
538 |
refute
|
14350
|
539 |
oops
|
|
540 |
|
|
541 |
lemma "\<forall>x::'a+'b. P x"
|
14455
|
542 |
refute
|
14350
|
543 |
oops
|
|
544 |
|
|
545 |
lemma "P (Inl x)"
|
14455
|
546 |
refute
|
14350
|
547 |
oops
|
|
548 |
|
|
549 |
lemma "P (Inr x)"
|
14455
|
550 |
refute
|
|
551 |
oops
|
|
552 |
|
|
553 |
lemma "P Inl"
|
|
554 |
refute
|
14350
|
555 |
oops
|
|
556 |
|
|
557 |
subsubsection {* Non-recursive datatypes *}
|
|
558 |
|
14455
|
559 |
datatype T1 = A | B
|
14350
|
560 |
|
|
561 |
lemma "P (x::T1)"
|
|
562 |
refute
|
|
563 |
oops
|
|
564 |
|
|
565 |
lemma "\<forall>x::T1. P x"
|
|
566 |
refute
|
|
567 |
oops
|
|
568 |
|
14455
|
569 |
lemma "P A"
|
14350
|
570 |
refute
|
|
571 |
oops
|
|
572 |
|
14455
|
573 |
datatype 'a T2 = C T1 | D 'a
|
|
574 |
|
|
575 |
lemma "P (x::'a T2)"
|
14350
|
576 |
refute
|
|
577 |
oops
|
|
578 |
|
14455
|
579 |
lemma "\<forall>x::'a T2. P x"
|
14350
|
580 |
refute
|
|
581 |
oops
|
|
582 |
|
14455
|
583 |
lemma "P D"
|
14350
|
584 |
refute
|
|
585 |
oops
|
|
586 |
|
14455
|
587 |
datatype ('a,'b) T3 = E "'a \<Rightarrow> 'b"
|
|
588 |
|
14809
|
589 |
lemma "P (x::('a,'b) T3)"
|
|
590 |
refute
|
|
591 |
oops
|
|
592 |
|
|
593 |
lemma "\<forall>x::('a,'b) T3. P x"
|
|
594 |
refute
|
|
595 |
oops
|
|
596 |
|
14455
|
597 |
lemma "P E"
|
|
598 |
refute
|
14350
|
599 |
oops
|
|
600 |
|
|
601 |
subsubsection {* Recursive datatypes *}
|
|
602 |
|
14809
|
603 |
lemma "P (x::nat)"
|
|
604 |
refute
|
|
605 |
oops
|
14350
|
606 |
|
14809
|
607 |
lemma "\<forall>x::nat. P x"
|
|
608 |
refute
|
14350
|
609 |
oops
|
|
610 |
|
14809
|
611 |
lemma "P (Suc 0)"
|
|
612 |
refute
|
14350
|
613 |
oops
|
|
614 |
|
14809
|
615 |
lemma "P Suc"
|
|
616 |
refute -- {* @{term "Suc"} is a partial function (regardless of the size
|
|
617 |
of the model), hence @{term "P Suc"} is undefined, hence no
|
|
618 |
model will be found *}
|
14350
|
619 |
oops
|
|
620 |
|
|
621 |
datatype 'a BinTree = Leaf 'a | Node "'a BinTree" "'a BinTree"
|
|
622 |
|
|
623 |
lemma "P (x::'a BinTree)"
|
14809
|
624 |
refute
|
14350
|
625 |
oops
|
|
626 |
|
|
627 |
lemma "\<forall>x::'a BinTree. P x"
|
14809
|
628 |
refute
|
|
629 |
oops
|
|
630 |
|
|
631 |
lemma "P (Node (Leaf x) (Leaf y))"
|
|
632 |
refute
|
14350
|
633 |
oops
|
|
634 |
|
|
635 |
subsubsection {* Mutually recursive datatypes *}
|
|
636 |
|
|
637 |
datatype 'a aexp = Number 'a | ITE "'a bexp" "'a aexp" "'a aexp"
|
|
638 |
and 'a bexp = Equal "'a aexp" "'a aexp"
|
|
639 |
|
|
640 |
lemma "P (x::'a aexp)"
|
14809
|
641 |
refute
|
14350
|
642 |
oops
|
|
643 |
|
|
644 |
lemma "\<forall>x::'a aexp. P x"
|
14809
|
645 |
refute
|
14350
|
646 |
oops
|
|
647 |
|
|
648 |
lemma "P (x::'a bexp)"
|
14809
|
649 |
refute
|
14350
|
650 |
oops
|
|
651 |
|
|
652 |
lemma "\<forall>x::'a bexp. P x"
|
14809
|
653 |
refute
|
14350
|
654 |
oops
|
|
655 |
|
|
656 |
lemma "P (ITE (Equal (Number x) (Number y)) (Number x) (Number y))"
|
14809
|
657 |
refute
|
14350
|
658 |
oops
|
|
659 |
|
|
660 |
subsubsection {* Other datatype examples *}
|
|
661 |
|
14809
|
662 |
datatype InfTree = Leaf | Node "nat \<Rightarrow> InfTree"
|
14350
|
663 |
|
|
664 |
lemma "P (x::InfTree)"
|
14809
|
665 |
refute
|
14350
|
666 |
oops
|
|
667 |
|
|
668 |
datatype 'a lambda = Var 'a | App "'a lambda" "'a lambda" | Lam "'a \<Rightarrow> 'a lambda"
|
|
669 |
|
14809
|
670 |
lemma "P (x::'a lambda) | P (App x y)"
|
|
671 |
refute
|
|
672 |
oops
|
|
673 |
|
|
674 |
lemma "(xs::'a list) = ys"
|
|
675 |
refute
|
|
676 |
oops
|
|
677 |
|
|
678 |
lemma "a # xs = b # xs"
|
|
679 |
refute
|
|
680 |
oops
|
|
681 |
|
|
682 |
lemma "P [x, y]"
|
|
683 |
refute
|
14350
|
684 |
oops
|
|
685 |
|
|
686 |
end
|