author | blanchet |
Tue, 09 Sep 2014 20:51:36 +0200 | |
changeset 58249 | 180f1b3508ed |
parent 56245 | 84fc7dfa3cd4 |
child 58268 | 990f89288143 |
permissions | -rw-r--r-- |
33197 | 1 |
(* Title: HOL/Nitpick_Examples/Refute_Nits.thy |
2 |
Author: Jasmin Blanchette, TU Muenchen |
|
45035 | 3 |
Copyright 2009-2011 |
33197 | 4 |
|
5 |
Refute examples adapted to Nitpick. |
|
6 |
*) |
|
7 |
||
8 |
header {* Refute Examples Adapted to Nitpick *} |
|
9 |
||
10 |
theory Refute_Nits |
|
11 |
imports Main |
|
12 |
begin |
|
13 |
||
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
14 |
nitpick_params [verbose, card = 1-6, max_potential = 0, |
54680
93f6d33a754e
reverted 86e0b402994c, which was accidentally qfinish'ed and pushed
blanchet
parents:
54633
diff
changeset
|
15 |
sat_solver = MiniSat_JNI, max_threads = 1, timeout = 240] |
34083
652719832159
make Nitpick tests more robust by specifying SAT solver, singlethreading (in Kodkod, not in Isabelle), and higher time limits
blanchet
parents:
33735
diff
changeset
|
16 |
|
33197 | 17 |
lemma "P \<and> Q" |
18 |
apply (rule conjI) |
|
19 |
nitpick [expect = genuine] 1 |
|
20 |
nitpick [expect = genuine] 2 |
|
21 |
nitpick [expect = genuine] |
|
22 |
nitpick [card = 5, expect = genuine] |
|
33735
0c0e7b2ecf2e
use SAT solver that's available everywhere for this example
blanchet
parents:
33197
diff
changeset
|
23 |
nitpick [sat_solver = SAT4J, expect = genuine] 2 |
33197 | 24 |
oops |
25 |
||
26 |
subsection {* Examples and Test Cases *} |
|
27 |
||
28 |
subsubsection {* Propositional logic *} |
|
29 |
||
30 |
lemma "True" |
|
31 |
nitpick [expect = none] |
|
32 |
apply auto |
|
33 |
done |
|
34 |
||
35 |
lemma "False" |
|
36 |
nitpick [expect = genuine] |
|
37 |
oops |
|
38 |
||
39 |
lemma "P" |
|
40 |
nitpick [expect = genuine] |
|
41 |
oops |
|
42 |
||
43 |
lemma "\<not> P" |
|
44 |
nitpick [expect = genuine] |
|
45 |
oops |
|
46 |
||
47 |
lemma "P \<and> Q" |
|
48 |
nitpick [expect = genuine] |
|
49 |
oops |
|
50 |
||
51 |
lemma "P \<or> Q" |
|
52 |
nitpick [expect = genuine] |
|
53 |
oops |
|
54 |
||
55 |
lemma "P \<longrightarrow> Q" |
|
56 |
nitpick [expect = genuine] |
|
57 |
oops |
|
58 |
||
59 |
lemma "(P\<Colon>bool) = Q" |
|
60 |
nitpick [expect = genuine] |
|
61 |
oops |
|
62 |
||
63 |
lemma "(P \<or> Q) \<longrightarrow> (P \<and> Q)" |
|
64 |
nitpick [expect = genuine] |
|
65 |
oops |
|
66 |
||
67 |
subsubsection {* Predicate logic *} |
|
68 |
||
69 |
lemma "P x y z" |
|
70 |
nitpick [expect = genuine] |
|
71 |
oops |
|
72 |
||
73 |
lemma "P x y \<longrightarrow> P y x" |
|
74 |
nitpick [expect = genuine] |
|
75 |
oops |
|
76 |
||
77 |
lemma "P (f (f x)) \<longrightarrow> P x \<longrightarrow> P (f x)" |
|
78 |
nitpick [expect = genuine] |
|
79 |
oops |
|
80 |
||
81 |
subsubsection {* Equality *} |
|
82 |
||
83 |
lemma "P = True" |
|
84 |
nitpick [expect = genuine] |
|
85 |
oops |
|
86 |
||
87 |
lemma "P = False" |
|
88 |
nitpick [expect = genuine] |
|
89 |
oops |
|
90 |
||
91 |
lemma "x = y" |
|
92 |
nitpick [expect = genuine] |
|
93 |
oops |
|
94 |
||
95 |
lemma "f x = g x" |
|
96 |
nitpick [expect = genuine] |
|
97 |
oops |
|
98 |
||
99 |
lemma "(f\<Colon>'a\<Rightarrow>'b) = g" |
|
100 |
nitpick [expect = genuine] |
|
101 |
oops |
|
102 |
||
103 |
lemma "(f\<Colon>('d\<Rightarrow>'d)\<Rightarrow>('c\<Rightarrow>'d)) = g" |
|
104 |
nitpick [expect = genuine] |
|
105 |
oops |
|
106 |
||
107 |
lemma "distinct [a, b]" |
|
108 |
nitpick [expect = genuine] |
|
109 |
apply simp |
|
110 |
nitpick [expect = genuine] |
|
111 |
oops |
|
112 |
||
113 |
subsubsection {* First-Order Logic *} |
|
114 |
||
115 |
lemma "\<exists>x. P x" |
|
116 |
nitpick [expect = genuine] |
|
117 |
oops |
|
118 |
||
119 |
lemma "\<forall>x. P x" |
|
120 |
nitpick [expect = genuine] |
|
121 |
oops |
|
122 |
||
123 |
lemma "\<exists>!x. P x" |
|
124 |
nitpick [expect = genuine] |
|
125 |
oops |
|
126 |
||
127 |
lemma "Ex P" |
|
128 |
nitpick [expect = genuine] |
|
129 |
oops |
|
130 |
||
131 |
lemma "All P" |
|
132 |
nitpick [expect = genuine] |
|
133 |
oops |
|
134 |
||
135 |
lemma "Ex1 P" |
|
136 |
nitpick [expect = genuine] |
|
137 |
oops |
|
138 |
||
139 |
lemma "(\<exists>x. P x) \<longrightarrow> (\<forall>x. P x)" |
|
140 |
nitpick [expect = genuine] |
|
141 |
oops |
|
142 |
||
143 |
lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>y. \<forall>x. P x y)" |
|
144 |
nitpick [expect = genuine] |
|
145 |
oops |
|
146 |
||
147 |
lemma "(\<exists>x. P x) \<longrightarrow> (\<exists>!x. P x)" |
|
148 |
nitpick [expect = genuine] |
|
149 |
oops |
|
150 |
||
151 |
text {* A true statement (also testing names of free and bound variables being identical) *} |
|
152 |
||
153 |
lemma "(\<forall>x y. P x y \<longrightarrow> P y x) \<longrightarrow> (\<forall>x. P x y) \<longrightarrow> P y x" |
|
154 |
nitpick [expect = none] |
|
155 |
apply fast |
|
156 |
done |
|
157 |
||
158 |
text {* "A type has at most 4 elements." *} |
|
159 |
||
160 |
lemma "\<not> distinct [a, b, c, d, e]" |
|
161 |
nitpick [expect = genuine] |
|
162 |
apply simp |
|
163 |
nitpick [expect = genuine] |
|
164 |
oops |
|
165 |
||
166 |
lemma "distinct [a, b, c, d]" |
|
167 |
nitpick [expect = genuine] |
|
168 |
apply simp |
|
169 |
nitpick [expect = genuine] |
|
170 |
oops |
|
171 |
||
172 |
text {* "Every reflexive and symmetric relation is transitive." *} |
|
173 |
||
174 |
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" |
|
175 |
nitpick [expect = genuine] |
|
176 |
oops |
|
177 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
178 |
text {* The ``Drinker's theorem'' *} |
33197 | 179 |
|
180 |
lemma "\<exists>x. f x = g x \<longrightarrow> f = g" |
|
181 |
nitpick [expect = none] |
|
182 |
apply (auto simp add: ext) |
|
183 |
done |
|
184 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
185 |
text {* And an incorrect version of it *} |
33197 | 186 |
|
187 |
lemma "(\<exists>x. f x = g x) \<longrightarrow> f = g" |
|
188 |
nitpick [expect = genuine] |
|
189 |
oops |
|
190 |
||
191 |
text {* "Every function has a fixed point." *} |
|
192 |
||
193 |
lemma "\<exists>x. f x = x" |
|
194 |
nitpick [expect = genuine] |
|
195 |
oops |
|
196 |
||
197 |
text {* "Function composition is commutative." *} |
|
198 |
||
199 |
lemma "f (g x) = g (f x)" |
|
200 |
nitpick [expect = genuine] |
|
201 |
oops |
|
202 |
||
203 |
text {* "Two functions that are equivalent wrt.\ the same predicate 'P' are equal." *} |
|
204 |
||
205 |
lemma "((P\<Colon>('a\<Rightarrow>'b)\<Rightarrow>bool) f = P g) \<longrightarrow> (f x = g x)" |
|
206 |
nitpick [expect = genuine] |
|
207 |
oops |
|
208 |
||
209 |
subsubsection {* Higher-Order Logic *} |
|
210 |
||
211 |
lemma "\<exists>P. P" |
|
212 |
nitpick [expect = none] |
|
213 |
apply auto |
|
214 |
done |
|
215 |
||
216 |
lemma "\<forall>P. P" |
|
217 |
nitpick [expect = genuine] |
|
218 |
oops |
|
219 |
||
220 |
lemma "\<exists>!P. P" |
|
221 |
nitpick [expect = none] |
|
222 |
apply auto |
|
223 |
done |
|
224 |
||
225 |
lemma "\<exists>!P. P x" |
|
226 |
nitpick [expect = genuine] |
|
227 |
oops |
|
228 |
||
229 |
lemma "P Q \<or> Q x" |
|
230 |
nitpick [expect = genuine] |
|
231 |
oops |
|
232 |
||
233 |
lemma "x \<noteq> All" |
|
234 |
nitpick [expect = genuine] |
|
235 |
oops |
|
236 |
||
237 |
lemma "x \<noteq> Ex" |
|
238 |
nitpick [expect = genuine] |
|
239 |
oops |
|
240 |
||
241 |
lemma "x \<noteq> Ex1" |
|
242 |
nitpick [expect = genuine] |
|
243 |
oops |
|
244 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
245 |
text {* ``The transitive closure of an arbitrary relation is non-empty.'' *} |
33197 | 246 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35342
diff
changeset
|
247 |
definition "trans" :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where |
33197 | 248 |
"trans P \<equiv> (ALL x y z. P x y \<longrightarrow> P y z \<longrightarrow> P x z)" |
35421 | 249 |
|
250 |
definition |
|
251 |
"subset" :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where |
|
33197 | 252 |
"subset P Q \<equiv> (ALL x y. P x y \<longrightarrow> Q x y)" |
35421 | 253 |
|
254 |
definition |
|
255 |
"trans_closure" :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where |
|
33197 | 256 |
"trans_closure P Q \<equiv> (subset Q P) \<and> (trans P) \<and> (ALL R. subset Q R \<longrightarrow> trans R \<longrightarrow> subset P R)" |
257 |
||
258 |
lemma "trans_closure T P \<longrightarrow> (\<exists>x y. T x y)" |
|
259 |
nitpick [expect = genuine] |
|
260 |
oops |
|
261 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
262 |
text {* ``The union of transitive closures is equal to the transitive closure of unions.'' *} |
33197 | 263 |
|
264 |
lemma "(\<forall>x y. (P x y \<or> R x y) \<longrightarrow> T x y) \<longrightarrow> trans T \<longrightarrow> (\<forall>Q. (\<forall>x y. (P x y \<or> R x y) \<longrightarrow> Q x y) \<longrightarrow> trans Q \<longrightarrow> subset T Q) |
|
265 |
\<longrightarrow> trans_closure TP P |
|
266 |
\<longrightarrow> trans_closure TR R |
|
267 |
\<longrightarrow> (T x y = (TP x y \<or> TR x y))" |
|
268 |
nitpick [expect = genuine] |
|
269 |
oops |
|
270 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
271 |
text {* ``Every surjective function is invertible.'' *} |
33197 | 272 |
|
273 |
lemma "(\<forall>y. \<exists>x. y = f x) \<longrightarrow> (\<exists>g. \<forall>x. g (f x) = x)" |
|
274 |
nitpick [expect = genuine] |
|
275 |
oops |
|
276 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
277 |
text {* ``Every invertible function is surjective.'' *} |
33197 | 278 |
|
279 |
lemma "(\<exists>g. \<forall>x. g (f x) = x) \<longrightarrow> (\<forall>y. \<exists>x. y = f x)" |
|
280 |
nitpick [expect = genuine] |
|
281 |
oops |
|
282 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
283 |
text {* ``Every point is a fixed point of some function.'' *} |
33197 | 284 |
|
285 |
lemma "\<exists>f. f x = x" |
|
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
286 |
nitpick [card = 1-7, expect = none] |
33197 | 287 |
apply (rule_tac x = "\<lambda>x. x" in exI) |
288 |
apply simp |
|
289 |
done |
|
290 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
291 |
text {* Axiom of Choice: first an incorrect version *} |
33197 | 292 |
|
293 |
lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>!f. \<forall>x. P x (f x))" |
|
294 |
nitpick [expect = genuine] |
|
295 |
oops |
|
296 |
||
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
297 |
text {* And now two correct ones *} |
33197 | 298 |
|
299 |
lemma "(\<forall>x. \<exists>y. P x y) \<longrightarrow> (\<exists>f. \<forall>x. P x (f x))" |
|
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
300 |
nitpick [card = 1-4, expect = none] |
33197 | 301 |
apply (simp add: choice) |
302 |
done |
|
303 |
||
304 |
lemma "(\<forall>x. \<exists>!y. P x y) \<longrightarrow> (\<exists>!f. \<forall>x. P x (f x))" |
|
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
305 |
nitpick [card = 1-3, expect = none] |
33197 | 306 |
apply auto |
307 |
apply (simp add: ex1_implies_ex choice) |
|
308 |
apply (fast intro: ext) |
|
309 |
done |
|
310 |
||
311 |
subsubsection {* Metalogic *} |
|
312 |
||
313 |
lemma "\<And>x. P x" |
|
314 |
nitpick [expect = genuine] |
|
315 |
oops |
|
316 |
||
317 |
lemma "f x \<equiv> g x" |
|
318 |
nitpick [expect = genuine] |
|
319 |
oops |
|
320 |
||
321 |
lemma "P \<Longrightarrow> Q" |
|
322 |
nitpick [expect = genuine] |
|
323 |
oops |
|
324 |
||
325 |
lemma "\<lbrakk>P; Q; R\<rbrakk> \<Longrightarrow> S" |
|
326 |
nitpick [expect = genuine] |
|
327 |
oops |
|
328 |
||
56245 | 329 |
lemma "(x \<equiv> Pure.all) \<Longrightarrow> False" |
33197 | 330 |
nitpick [expect = genuine] |
331 |
oops |
|
332 |
||
333 |
lemma "(x \<equiv> (op \<equiv>)) \<Longrightarrow> False" |
|
334 |
nitpick [expect = genuine] |
|
335 |
oops |
|
336 |
||
337 |
lemma "(x \<equiv> (op \<Longrightarrow>)) \<Longrightarrow> False" |
|
338 |
nitpick [expect = genuine] |
|
339 |
oops |
|
340 |
||
341 |
subsubsection {* Schematic Variables *} |
|
342 |
||
36319 | 343 |
schematic_lemma "?P" |
33197 | 344 |
nitpick [expect = none] |
345 |
apply auto |
|
346 |
done |
|
347 |
||
36319 | 348 |
schematic_lemma "x = ?y" |
33197 | 349 |
nitpick [expect = none] |
350 |
apply auto |
|
351 |
done |
|
352 |
||
353 |
subsubsection {* Abstractions *} |
|
354 |
||
355 |
lemma "(\<lambda>x. x) = (\<lambda>x. y)" |
|
356 |
nitpick [expect = genuine] |
|
357 |
oops |
|
358 |
||
359 |
lemma "(\<lambda>f. f x) = (\<lambda>f. True)" |
|
360 |
nitpick [expect = genuine] |
|
361 |
oops |
|
362 |
||
363 |
lemma "(\<lambda>x. x) = (\<lambda>y. y)" |
|
364 |
nitpick [expect = none] |
|
365 |
apply simp |
|
366 |
done |
|
367 |
||
368 |
subsubsection {* Sets *} |
|
369 |
||
370 |
lemma "P (A\<Colon>'a set)" |
|
371 |
nitpick [expect = genuine] |
|
372 |
oops |
|
373 |
||
374 |
lemma "P (A\<Colon>'a set set)" |
|
375 |
nitpick [expect = genuine] |
|
376 |
oops |
|
377 |
||
378 |
lemma "{x. P x} = {y. P y}" |
|
379 |
nitpick [expect = none] |
|
380 |
apply simp |
|
381 |
done |
|
382 |
||
383 |
lemma "x \<in> {x. P x}" |
|
384 |
nitpick [expect = genuine] |
|
385 |
oops |
|
386 |
||
387 |
lemma "P (op \<in>)" |
|
388 |
nitpick [expect = genuine] |
|
389 |
oops |
|
390 |
||
391 |
lemma "P (op \<in> x)" |
|
392 |
nitpick [expect = genuine] |
|
393 |
oops |
|
394 |
||
395 |
lemma "P Collect" |
|
396 |
nitpick [expect = genuine] |
|
397 |
oops |
|
398 |
||
399 |
lemma "A Un B = A Int B" |
|
400 |
nitpick [expect = genuine] |
|
401 |
oops |
|
402 |
||
403 |
lemma "(A Int B) Un C = (A Un C) Int B" |
|
404 |
nitpick [expect = genuine] |
|
405 |
oops |
|
406 |
||
407 |
lemma "Ball A P \<longrightarrow> Bex A P" |
|
408 |
nitpick [expect = genuine] |
|
409 |
oops |
|
410 |
||
411 |
subsubsection {* @{const undefined} *} |
|
412 |
||
413 |
lemma "undefined" |
|
414 |
nitpick [expect = genuine] |
|
415 |
oops |
|
416 |
||
417 |
lemma "P undefined" |
|
418 |
nitpick [expect = genuine] |
|
419 |
oops |
|
420 |
||
421 |
lemma "undefined x" |
|
422 |
nitpick [expect = genuine] |
|
423 |
oops |
|
424 |
||
425 |
lemma "undefined undefined" |
|
426 |
nitpick [expect = genuine] |
|
427 |
oops |
|
428 |
||
429 |
subsubsection {* @{const The} *} |
|
430 |
||
431 |
lemma "The P" |
|
432 |
nitpick [expect = genuine] |
|
433 |
oops |
|
434 |
||
435 |
lemma "P The" |
|
436 |
nitpick [expect = genuine] |
|
437 |
oops |
|
438 |
||
439 |
lemma "P (The P)" |
|
440 |
nitpick [expect = genuine] |
|
441 |
oops |
|
442 |
||
443 |
lemma "(THE x. x=y) = z" |
|
444 |
nitpick [expect = genuine] |
|
445 |
oops |
|
446 |
||
447 |
lemma "Ex P \<longrightarrow> P (The P)" |
|
448 |
nitpick [expect = genuine] |
|
449 |
oops |
|
450 |
||
451 |
subsubsection {* @{const Eps} *} |
|
452 |
||
453 |
lemma "Eps P" |
|
454 |
nitpick [expect = genuine] |
|
455 |
oops |
|
456 |
||
457 |
lemma "P Eps" |
|
458 |
nitpick [expect = genuine] |
|
459 |
oops |
|
460 |
||
461 |
lemma "P (Eps P)" |
|
462 |
nitpick [expect = genuine] |
|
463 |
oops |
|
464 |
||
465 |
lemma "(SOME x. x=y) = z" |
|
466 |
nitpick [expect = genuine] |
|
467 |
oops |
|
468 |
||
469 |
lemma "Ex P \<longrightarrow> P (Eps P)" |
|
470 |
nitpick [expect = none] |
|
471 |
apply (auto simp add: someI) |
|
472 |
done |
|
473 |
||
474 |
subsubsection {* Operations on Natural Numbers *} |
|
475 |
||
476 |
lemma "(x\<Colon>nat) + y = 0" |
|
477 |
nitpick [expect = genuine] |
|
478 |
oops |
|
479 |
||
480 |
lemma "(x\<Colon>nat) = x + x" |
|
481 |
nitpick [expect = genuine] |
|
482 |
oops |
|
483 |
||
484 |
lemma "(x\<Colon>nat) - y + y = x" |
|
485 |
nitpick [expect = genuine] |
|
486 |
oops |
|
487 |
||
488 |
lemma "(x\<Colon>nat) = x * x" |
|
489 |
nitpick [expect = genuine] |
|
490 |
oops |
|
491 |
||
492 |
lemma "(x\<Colon>nat) < x + y" |
|
493 |
nitpick [card = 1, expect = genuine] |
|
494 |
oops |
|
495 |
||
496 |
text {* \<times> *} |
|
497 |
||
498 |
lemma "P (x\<Colon>'a\<times>'b)" |
|
499 |
nitpick [expect = genuine] |
|
500 |
oops |
|
501 |
||
502 |
lemma "\<forall>x\<Colon>'a\<times>'b. P x" |
|
503 |
nitpick [expect = genuine] |
|
504 |
oops |
|
505 |
||
506 |
lemma "P (x, y)" |
|
507 |
nitpick [expect = genuine] |
|
508 |
oops |
|
509 |
||
510 |
lemma "P (fst x)" |
|
511 |
nitpick [expect = genuine] |
|
512 |
oops |
|
513 |
||
514 |
lemma "P (snd x)" |
|
515 |
nitpick [expect = genuine] |
|
516 |
oops |
|
517 |
||
518 |
lemma "P Pair" |
|
519 |
nitpick [expect = genuine] |
|
520 |
oops |
|
521 |
||
522 |
lemma "P (case x of Pair a b \<Rightarrow> f a b)" |
|
523 |
nitpick [expect = genuine] |
|
524 |
oops |
|
525 |
||
526 |
subsubsection {* Subtypes (typedef), typedecl *} |
|
527 |
||
528 |
text {* A completely unspecified non-empty subset of @{typ "'a"}: *} |
|
529 |
||
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45035
diff
changeset
|
530 |
definition "myTdef = insert (undefined::'a) (undefined::'a set)" |
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45035
diff
changeset
|
531 |
|
49834 | 532 |
typedef 'a myTdef = "myTdef :: 'a set" |
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45035
diff
changeset
|
533 |
unfolding myTdef_def by auto |
33197 | 534 |
|
535 |
lemma "(x\<Colon>'a myTdef) = y" |
|
536 |
nitpick [expect = genuine] |
|
537 |
oops |
|
538 |
||
539 |
typedecl myTdecl |
|
540 |
||
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45035
diff
changeset
|
541 |
definition "T_bij = {(f::'a\<Rightarrow>'a). \<forall>y. \<exists>!x. f x = y}" |
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45035
diff
changeset
|
542 |
|
49834 | 543 |
typedef 'a T_bij = "T_bij :: ('a \<Rightarrow> 'a) set" |
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
45035
diff
changeset
|
544 |
unfolding T_bij_def by auto |
33197 | 545 |
|
546 |
lemma "P (f\<Colon>(myTdecl myTdef) T_bij)" |
|
547 |
nitpick [expect = genuine] |
|
548 |
oops |
|
549 |
||
550 |
subsubsection {* Inductive Datatypes *} |
|
551 |
||
552 |
text {* unit *} |
|
553 |
||
554 |
lemma "P (x\<Colon>unit)" |
|
555 |
nitpick [expect = genuine] |
|
556 |
oops |
|
557 |
||
558 |
lemma "\<forall>x\<Colon>unit. P x" |
|
559 |
nitpick [expect = genuine] |
|
560 |
oops |
|
561 |
||
562 |
lemma "P ()" |
|
563 |
nitpick [expect = genuine] |
|
564 |
oops |
|
565 |
||
566 |
lemma "P (case x of () \<Rightarrow> u)" |
|
567 |
nitpick [expect = genuine] |
|
568 |
oops |
|
569 |
||
570 |
text {* option *} |
|
571 |
||
572 |
lemma "P (x\<Colon>'a option)" |
|
573 |
nitpick [expect = genuine] |
|
574 |
oops |
|
575 |
||
576 |
lemma "\<forall>x\<Colon>'a option. P x" |
|
577 |
nitpick [expect = genuine] |
|
578 |
oops |
|
579 |
||
580 |
lemma "P None" |
|
581 |
nitpick [expect = genuine] |
|
582 |
oops |
|
583 |
||
584 |
lemma "P (Some x)" |
|
585 |
nitpick [expect = genuine] |
|
586 |
oops |
|
587 |
||
588 |
lemma "P (case x of None \<Rightarrow> n | Some u \<Rightarrow> s u)" |
|
589 |
nitpick [expect = genuine] |
|
590 |
oops |
|
591 |
||
592 |
text {* + *} |
|
593 |
||
594 |
lemma "P (x\<Colon>'a+'b)" |
|
595 |
nitpick [expect = genuine] |
|
596 |
oops |
|
597 |
||
598 |
lemma "\<forall>x\<Colon>'a+'b. P x" |
|
599 |
nitpick [expect = genuine] |
|
600 |
oops |
|
601 |
||
602 |
lemma "P (Inl x)" |
|
603 |
nitpick [expect = genuine] |
|
604 |
oops |
|
605 |
||
606 |
lemma "P (Inr x)" |
|
607 |
nitpick [expect = genuine] |
|
608 |
oops |
|
609 |
||
610 |
lemma "P Inl" |
|
611 |
nitpick [expect = genuine] |
|
612 |
oops |
|
613 |
||
614 |
lemma "P (case x of Inl a \<Rightarrow> l a | Inr b \<Rightarrow> r b)" |
|
615 |
nitpick [expect = genuine] |
|
616 |
oops |
|
617 |
||
618 |
text {* Non-recursive datatypes *} |
|
619 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
620 |
datatype_new T1 = A | B |
33197 | 621 |
|
622 |
lemma "P (x\<Colon>T1)" |
|
623 |
nitpick [expect = genuine] |
|
624 |
oops |
|
625 |
||
626 |
lemma "\<forall>x\<Colon>T1. P x" |
|
627 |
nitpick [expect = genuine] |
|
628 |
oops |
|
629 |
||
630 |
lemma "P A" |
|
631 |
nitpick [expect = genuine] |
|
632 |
oops |
|
633 |
||
634 |
lemma "P B" |
|
635 |
nitpick [expect = genuine] |
|
636 |
oops |
|
637 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
638 |
lemma "rec_T1 a b A = a" |
33197 | 639 |
nitpick [expect = none] |
640 |
apply simp |
|
641 |
done |
|
642 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
643 |
lemma "rec_T1 a b B = b" |
33197 | 644 |
nitpick [expect = none] |
645 |
apply simp |
|
646 |
done |
|
647 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
648 |
lemma "P (rec_T1 a b x)" |
33197 | 649 |
nitpick [expect = genuine] |
650 |
oops |
|
651 |
||
652 |
lemma "P (case x of A \<Rightarrow> a | B \<Rightarrow> b)" |
|
653 |
nitpick [expect = genuine] |
|
654 |
oops |
|
655 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
656 |
datatype_new 'a T2 = C T1 | D 'a |
33197 | 657 |
|
658 |
lemma "P (x\<Colon>'a T2)" |
|
659 |
nitpick [expect = genuine] |
|
660 |
oops |
|
661 |
||
662 |
lemma "\<forall>x\<Colon>'a T2. P x" |
|
663 |
nitpick [expect = genuine] |
|
664 |
oops |
|
665 |
||
666 |
lemma "P D" |
|
667 |
nitpick [expect = genuine] |
|
668 |
oops |
|
669 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
670 |
lemma "rec_T2 c d (C x) = c x" |
33197 | 671 |
nitpick [expect = none] |
672 |
apply simp |
|
673 |
done |
|
674 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
675 |
lemma "rec_T2 c d (D x) = d x" |
33197 | 676 |
nitpick [expect = none] |
677 |
apply simp |
|
678 |
done |
|
679 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
680 |
lemma "P (rec_T2 c d x)" |
33197 | 681 |
nitpick [expect = genuine] |
682 |
oops |
|
683 |
||
684 |
lemma "P (case x of C u \<Rightarrow> c u | D v \<Rightarrow> d v)" |
|
685 |
nitpick [expect = genuine] |
|
686 |
oops |
|
687 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
688 |
datatype_new ('a, 'b) T3 = E "'a \<Rightarrow> 'b" |
33197 | 689 |
|
690 |
lemma "P (x\<Colon>('a, 'b) T3)" |
|
691 |
nitpick [expect = genuine] |
|
692 |
oops |
|
693 |
||
694 |
lemma "\<forall>x\<Colon>('a, 'b) T3. P x" |
|
695 |
nitpick [expect = genuine] |
|
696 |
oops |
|
697 |
||
698 |
lemma "P E" |
|
699 |
nitpick [expect = genuine] |
|
700 |
oops |
|
701 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
702 |
lemma "rec_T3 e (E x) = e x" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
703 |
nitpick [card = 1-4, expect = none] |
33197 | 704 |
apply simp |
705 |
done |
|
706 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
707 |
lemma "P (rec_T3 e x)" |
33197 | 708 |
nitpick [expect = genuine] |
709 |
oops |
|
710 |
||
711 |
lemma "P (case x of E f \<Rightarrow> e f)" |
|
712 |
nitpick [expect = genuine] |
|
713 |
oops |
|
714 |
||
715 |
text {* Recursive datatypes *} |
|
716 |
||
717 |
text {* nat *} |
|
718 |
||
719 |
lemma "P (x\<Colon>nat)" |
|
720 |
nitpick [expect = genuine] |
|
721 |
oops |
|
722 |
||
723 |
lemma "\<forall>x\<Colon>nat. P x" |
|
724 |
nitpick [expect = genuine] |
|
725 |
oops |
|
726 |
||
727 |
lemma "P (Suc 0)" |
|
728 |
nitpick [expect = genuine] |
|
729 |
oops |
|
730 |
||
731 |
lemma "P Suc" |
|
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
732 |
nitpick [card = 1-7, expect = none] |
33197 | 733 |
oops |
734 |
||
55415 | 735 |
lemma "rec_nat zero suc 0 = zero" |
33197 | 736 |
nitpick [expect = none] |
737 |
apply simp |
|
738 |
done |
|
739 |
||
55415 | 740 |
lemma "rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)" |
33197 | 741 |
nitpick [expect = none] |
742 |
apply simp |
|
743 |
done |
|
744 |
||
55415 | 745 |
lemma "P (rec_nat zero suc x)" |
33197 | 746 |
nitpick [expect = genuine] |
747 |
oops |
|
748 |
||
749 |
lemma "P (case x of 0 \<Rightarrow> zero | Suc n \<Rightarrow> suc n)" |
|
750 |
nitpick [expect = genuine] |
|
751 |
oops |
|
752 |
||
753 |
text {* 'a list *} |
|
754 |
||
755 |
lemma "P (xs\<Colon>'a list)" |
|
756 |
nitpick [expect = genuine] |
|
757 |
oops |
|
758 |
||
759 |
lemma "\<forall>xs\<Colon>'a list. P xs" |
|
760 |
nitpick [expect = genuine] |
|
761 |
oops |
|
762 |
||
763 |
lemma "P [x, y]" |
|
764 |
nitpick [expect = genuine] |
|
765 |
oops |
|
766 |
||
55413
a8e96847523c
adapted theories to '{case,rec}_{list,option}' names
blanchet
parents:
55395
diff
changeset
|
767 |
lemma "rec_list nil cons [] = nil" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
768 |
nitpick [card = 1-5, expect = none] |
33197 | 769 |
apply simp |
770 |
done |
|
771 |
||
55413
a8e96847523c
adapted theories to '{case,rec}_{list,option}' names
blanchet
parents:
55395
diff
changeset
|
772 |
lemma "rec_list nil cons (x#xs) = cons x xs (rec_list nil cons xs)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
773 |
nitpick [card = 1-5, expect = none] |
33197 | 774 |
apply simp |
775 |
done |
|
776 |
||
55413
a8e96847523c
adapted theories to '{case,rec}_{list,option}' names
blanchet
parents:
55395
diff
changeset
|
777 |
lemma "P (rec_list nil cons xs)" |
33197 | 778 |
nitpick [expect = genuine] |
779 |
oops |
|
780 |
||
781 |
lemma "P (case x of Nil \<Rightarrow> nil | Cons a b \<Rightarrow> cons a b)" |
|
782 |
nitpick [expect = genuine] |
|
783 |
oops |
|
784 |
||
785 |
lemma "(xs\<Colon>'a list) = ys" |
|
786 |
nitpick [expect = genuine] |
|
787 |
oops |
|
788 |
||
789 |
lemma "a # xs = b # xs" |
|
790 |
nitpick [expect = genuine] |
|
791 |
oops |
|
792 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
793 |
datatype_new BitList = BitListNil | Bit0 BitList | Bit1 BitList |
33197 | 794 |
|
795 |
lemma "P (x\<Colon>BitList)" |
|
796 |
nitpick [expect = genuine] |
|
797 |
oops |
|
798 |
||
799 |
lemma "\<forall>x\<Colon>BitList. P x" |
|
800 |
nitpick [expect = genuine] |
|
801 |
oops |
|
802 |
||
803 |
lemma "P (Bit0 (Bit1 BitListNil))" |
|
804 |
nitpick [expect = genuine] |
|
805 |
oops |
|
806 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
807 |
lemma "rec_BitList nil bit0 bit1 BitListNil = nil" |
33197 | 808 |
nitpick [expect = none] |
809 |
apply simp |
|
810 |
done |
|
811 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
812 |
lemma "rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)" |
33197 | 813 |
nitpick [expect = none] |
814 |
apply simp |
|
815 |
done |
|
816 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
817 |
lemma "rec_BitList nil bit0 bit1 (Bit1 xs) = bit1 xs (rec_BitList nil bit0 bit1 xs)" |
33197 | 818 |
nitpick [expect = none] |
819 |
apply simp |
|
820 |
done |
|
821 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
822 |
lemma "P (rec_BitList nil bit0 bit1 x)" |
33197 | 823 |
nitpick [expect = genuine] |
824 |
oops |
|
825 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
826 |
datatype_new 'a BinTree = Leaf 'a | Node "'a BinTree" "'a BinTree" |
33197 | 827 |
|
828 |
lemma "P (x\<Colon>'a BinTree)" |
|
829 |
nitpick [expect = genuine] |
|
830 |
oops |
|
831 |
||
832 |
lemma "\<forall>x\<Colon>'a BinTree. P x" |
|
833 |
nitpick [expect = genuine] |
|
834 |
oops |
|
835 |
||
836 |
lemma "P (Node (Leaf x) (Leaf y))" |
|
837 |
nitpick [expect = genuine] |
|
838 |
oops |
|
839 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
840 |
lemma "rec_BinTree l n (Leaf x) = l x" |
33197 | 841 |
nitpick [expect = none] |
842 |
apply simp |
|
843 |
done |
|
844 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
845 |
lemma "rec_BinTree l n (Node x y) = n x y (rec_BinTree l n x) (rec_BinTree l n y)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
846 |
nitpick [card = 1-5, expect = none] |
33197 | 847 |
apply simp |
848 |
done |
|
849 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
850 |
lemma "P (rec_BinTree l n x)" |
33197 | 851 |
nitpick [expect = genuine] |
852 |
oops |
|
853 |
||
854 |
lemma "P (case x of Leaf a \<Rightarrow> l a | Node a b \<Rightarrow> n a b)" |
|
855 |
nitpick [expect = genuine] |
|
856 |
oops |
|
857 |
||
858 |
text {* Mutually recursive datatypes *} |
|
859 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
860 |
datatype_new 'a aexp = Number 'a | ITE "'a bexp" "'a aexp" "'a aexp" |
33197 | 861 |
and 'a bexp = Equal "'a aexp" "'a aexp" |
862 |
||
863 |
lemma "P (x\<Colon>'a aexp)" |
|
864 |
nitpick [expect = genuine] |
|
865 |
oops |
|
866 |
||
867 |
lemma "\<forall>x\<Colon>'a aexp. P x" |
|
868 |
nitpick [expect = genuine] |
|
869 |
oops |
|
870 |
||
871 |
lemma "P (ITE (Equal (Number x) (Number y)) (Number x) (Number y))" |
|
872 |
nitpick [expect = genuine] |
|
873 |
oops |
|
874 |
||
875 |
lemma "P (x\<Colon>'a bexp)" |
|
876 |
nitpick [expect = genuine] |
|
877 |
oops |
|
878 |
||
879 |
lemma "\<forall>x\<Colon>'a bexp. P x" |
|
880 |
nitpick [expect = genuine] |
|
881 |
oops |
|
882 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
883 |
lemma "rec_aexp number ite equal (Number x) = number x" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
884 |
nitpick [card = 1-3, expect = none] |
33197 | 885 |
apply simp |
886 |
done |
|
887 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
888 |
lemma "rec_aexp number ite equal (ITE x y z) = ite x y z (rec_aexp_bexp_2 number ite equal x) (rec_aexp number ite equal y) (rec_aexp number ite equal z)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
889 |
nitpick [card = 1-3, expect = none] |
33197 | 890 |
apply simp |
891 |
done |
|
892 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
893 |
lemma "P (rec_aexp number ite equal x)" |
33197 | 894 |
nitpick [expect = genuine] |
895 |
oops |
|
896 |
||
897 |
lemma "P (case x of Number a \<Rightarrow> number a | ITE b a1 a2 \<Rightarrow> ite b a1 a2)" |
|
898 |
nitpick [expect = genuine] |
|
899 |
oops |
|
900 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
901 |
lemma "rec_aexp_bexp_2 number ite equal (Equal x y) = equal x y (rec_aexp number ite equal x) (rec_aexp number ite equal y)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
902 |
nitpick [card = 1-3, expect = none] |
33197 | 903 |
apply simp |
904 |
done |
|
905 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
906 |
lemma "P (rec_aexp_bexp_2 number ite equal x)" |
33197 | 907 |
nitpick [expect = genuine] |
908 |
oops |
|
909 |
||
910 |
lemma "P (case x of Equal a1 a2 \<Rightarrow> equal a1 a2)" |
|
911 |
nitpick [expect = genuine] |
|
912 |
oops |
|
913 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
914 |
datatype_new X = A | B X | C Y and Y = D X | E Y | F |
33197 | 915 |
|
916 |
lemma "P (x\<Colon>X)" |
|
917 |
nitpick [expect = genuine] |
|
918 |
oops |
|
919 |
||
920 |
lemma "P (y\<Colon>Y)" |
|
921 |
nitpick [expect = genuine] |
|
922 |
oops |
|
923 |
||
924 |
lemma "P (B (B A))" |
|
925 |
nitpick [expect = genuine] |
|
926 |
oops |
|
927 |
||
928 |
lemma "P (B (C F))" |
|
929 |
nitpick [expect = genuine] |
|
930 |
oops |
|
931 |
||
932 |
lemma "P (C (D A))" |
|
933 |
nitpick [expect = genuine] |
|
934 |
oops |
|
935 |
||
936 |
lemma "P (C (E F))" |
|
937 |
nitpick [expect = genuine] |
|
938 |
oops |
|
939 |
||
940 |
lemma "P (D (B A))" |
|
941 |
nitpick [expect = genuine] |
|
942 |
oops |
|
943 |
||
944 |
lemma "P (D (C F))" |
|
945 |
nitpick [expect = genuine] |
|
946 |
oops |
|
947 |
||
948 |
lemma "P (E (D A))" |
|
949 |
nitpick [expect = genuine] |
|
950 |
oops |
|
951 |
||
952 |
lemma "P (E (E F))" |
|
953 |
nitpick [expect = genuine] |
|
954 |
oops |
|
955 |
||
956 |
lemma "P (C (D (C F)))" |
|
957 |
nitpick [expect = genuine] |
|
958 |
oops |
|
959 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
960 |
lemma "rec_X a b c d e f A = a" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
961 |
nitpick [card = 1-5, expect = none] |
33197 | 962 |
apply simp |
963 |
done |
|
964 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
965 |
lemma "rec_X a b c d e f (B x) = b x (rec_X a b c d e f x)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
966 |
nitpick [card = 1-5, expect = none] |
33197 | 967 |
apply simp |
968 |
done |
|
969 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
970 |
lemma "rec_X a b c d e f (C y) = c y (rec_X_Y_2 a b c d e f y)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
971 |
nitpick [card = 1-5, expect = none] |
33197 | 972 |
apply simp |
973 |
done |
|
974 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
975 |
lemma "rec_X_Y_2 a b c d e f (D x) = d x (rec_X a b c d e f x)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
976 |
nitpick [card = 1-5, expect = none] |
33197 | 977 |
apply simp |
978 |
done |
|
979 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
980 |
lemma "rec_X_Y_2 a b c d e f (E y) = e y (rec_X_Y_2 a b c d e f y)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
981 |
nitpick [card = 1-5, expect = none] |
33197 | 982 |
apply simp |
983 |
done |
|
984 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
985 |
lemma "rec_X_Y_2 a b c d e f F = f" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
986 |
nitpick [card = 1-5, expect = none] |
33197 | 987 |
apply simp |
988 |
done |
|
989 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
990 |
lemma "P (rec_X a b c d e f x)" |
33197 | 991 |
nitpick [expect = genuine] |
992 |
oops |
|
993 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
994 |
lemma "P (rec_X_Y_2 a b c d e f y)" |
33197 | 995 |
nitpick [expect = genuine] |
996 |
oops |
|
997 |
||
998 |
text {* Other datatype examples *} |
|
999 |
||
1000 |
text {* Indirect recursion is implemented via mutual recursion. *} |
|
1001 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1002 |
datatype_new XOpt = CX "XOpt option" | DX "bool \<Rightarrow> XOpt option" |
33197 | 1003 |
|
1004 |
lemma "P (x\<Colon>XOpt)" |
|
1005 |
nitpick [expect = genuine] |
|
1006 |
oops |
|
1007 |
||
1008 |
lemma "P (CX None)" |
|
1009 |
nitpick [expect = genuine] |
|
1010 |
oops |
|
1011 |
||
1012 |
lemma "P (CX (Some (CX None)))" |
|
1013 |
nitpick [expect = genuine] |
|
1014 |
oops |
|
1015 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1016 |
lemma "rec_X cx dx n1 s1 n2 s2 (CX x) = cx x (rec_XOpt_2 cx dx n1 s1 n2 s2 x)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1017 |
nitpick [card = 1-5, expect = none] |
33197 | 1018 |
apply simp |
1019 |
done |
|
1020 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1021 |
lemma "rec_X cx dx n1 s1 n2 s2 (DX x) = dx x (\<lambda>b. rec_XOpt_3 cx dx n1 s1 n2 s2 (x b))" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1022 |
nitpick [card = 1-3, expect = none] |
33197 | 1023 |
apply simp |
1024 |
done |
|
1025 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1026 |
lemma "rec_XOpt_2 cx dx n1 s1 n2 s2 None = n1" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1027 |
nitpick [card = 1-4, expect = none] |
33197 | 1028 |
apply simp |
1029 |
done |
|
1030 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1031 |
lemma "rec_XOpt_2 cx dx n1 s1 n2 s2 (Some x) = s1 x (rec_X cx dx n1 s1 n2 s2 x)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1032 |
nitpick [card = 1-4, expect = none] |
33197 | 1033 |
apply simp |
1034 |
done |
|
1035 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1036 |
lemma "rec_XOpt_3 cx dx n1 s1 n2 s2 None = n2" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1037 |
nitpick [card = 1-4, expect = none] |
33197 | 1038 |
apply simp |
1039 |
done |
|
1040 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1041 |
lemma "rec_XOpt_3 cx dx n1 s1 n2 s2 (Some x) = s2 x (rec_X cx dx n1 s1 n2 s2 x)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1042 |
nitpick [card = 1-4, expect = none] |
33197 | 1043 |
apply simp |
1044 |
done |
|
1045 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1046 |
lemma "P (rec_X cx dx n1 s1 n2 s2 x)" |
33197 | 1047 |
nitpick [expect = genuine] |
1048 |
oops |
|
1049 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1050 |
lemma "P (rec_XOpt_2 cx dx n1 s1 n2 s2 x)" |
33197 | 1051 |
nitpick [expect = genuine] |
1052 |
oops |
|
1053 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1054 |
lemma "P (rec_XOpt_3 cx dx n1 s1 n2 s2 x)" |
33197 | 1055 |
nitpick [expect = genuine] |
1056 |
oops |
|
1057 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1058 |
datatype_new 'a YOpt = CY "('a \<Rightarrow> 'a YOpt) option" |
33197 | 1059 |
|
1060 |
lemma "P (x\<Colon>'a YOpt)" |
|
1061 |
nitpick [expect = genuine] |
|
1062 |
oops |
|
1063 |
||
1064 |
lemma "P (CY None)" |
|
1065 |
nitpick [expect = genuine] |
|
1066 |
oops |
|
1067 |
||
1068 |
lemma "P (CY (Some (\<lambda>a. CY None)))" |
|
1069 |
nitpick [expect = genuine] |
|
1070 |
oops |
|
1071 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1072 |
datatype_new Trie = TR "Trie list" |
33197 | 1073 |
|
1074 |
lemma "P (x\<Colon>Trie)" |
|
1075 |
nitpick [expect = genuine] |
|
1076 |
oops |
|
1077 |
||
1078 |
lemma "\<forall>x\<Colon>Trie. P x" |
|
1079 |
nitpick [expect = genuine] |
|
1080 |
oops |
|
1081 |
||
1082 |
lemma "P (TR [TR []])" |
|
1083 |
nitpick [expect = genuine] |
|
1084 |
oops |
|
1085 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1086 |
datatype_new InfTree = Leaf | Node "nat \<Rightarrow> InfTree" |
33197 | 1087 |
|
1088 |
lemma "P (x\<Colon>InfTree)" |
|
1089 |
nitpick [expect = genuine] |
|
1090 |
oops |
|
1091 |
||
1092 |
lemma "\<forall>x\<Colon>InfTree. P x" |
|
1093 |
nitpick [expect = genuine] |
|
1094 |
oops |
|
1095 |
||
1096 |
lemma "P (Node (\<lambda>n. Leaf))" |
|
1097 |
nitpick [expect = genuine] |
|
1098 |
oops |
|
1099 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1100 |
lemma "rec_InfTree leaf node Leaf = leaf" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1101 |
nitpick [card = 1-3, expect = none] |
33197 | 1102 |
apply simp |
1103 |
done |
|
1104 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1105 |
lemma "rec_InfTree leaf node (Node x) = node x (\<lambda>n. rec_InfTree leaf node (x n))" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1106 |
nitpick [card = 1-3, expect = none] |
33197 | 1107 |
apply simp |
1108 |
done |
|
1109 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1110 |
lemma "P (rec_InfTree leaf node x)" |
33197 | 1111 |
nitpick [expect = genuine] |
1112 |
oops |
|
1113 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1114 |
datatype_new 'a lambda = Var 'a | App "'a lambda" "'a lambda" | Lam "'a \<Rightarrow> 'a lambda" |
33197 | 1115 |
|
1116 |
lemma "P (x\<Colon>'a lambda)" |
|
1117 |
nitpick [expect = genuine] |
|
1118 |
oops |
|
1119 |
||
1120 |
lemma "\<forall>x\<Colon>'a lambda. P x" |
|
1121 |
nitpick [expect = genuine] |
|
1122 |
oops |
|
1123 |
||
1124 |
lemma "P (Lam (\<lambda>a. Var a))" |
|
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1125 |
nitpick [card = 1-5, expect = none] |
33197 | 1126 |
nitpick [card 'a = 4, card "'a lambda" = 5, expect = genuine] |
1127 |
oops |
|
1128 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1129 |
lemma "rec_lambda var app lam (Var x) = var x" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1130 |
nitpick [card = 1-3, expect = none] |
33197 | 1131 |
apply simp |
1132 |
done |
|
1133 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1134 |
lemma "rec_lambda var app lam (App x y) = app x y (rec_lambda var app lam x) (rec_lambda var app lam y)" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1135 |
nitpick [card = 1-3, expect = none] |
33197 | 1136 |
apply simp |
1137 |
done |
|
1138 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1139 |
lemma "rec_lambda var app lam (Lam x) = lam x (\<lambda>a. rec_lambda var app lam (x a))" |
55893
aed17a173d16
fixed handling of 'case_prod' and other 'case' functions for interpreted types
blanchet
parents:
55867
diff
changeset
|
1140 |
nitpick [card = 1-3, expect = none] |
33197 | 1141 |
apply simp |
1142 |
done |
|
1143 |
||
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
55415
diff
changeset
|
1144 |
lemma "P (rec_lambda v a l x)" |
33197 | 1145 |
nitpick [expect = genuine] |
1146 |
oops |
|
1147 |
||
1148 |
text {* Taken from "Inductive datatypes in HOL", p. 8: *} |
|
1149 |
||
58249
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1150 |
datatype_new ('a, 'b) T = C "'a \<Rightarrow> bool" | D "'b list" |
180f1b3508ed
use 'datatype_new' (soon to be renamed 'datatype') in Isabelle's libraries
blanchet
parents:
56245
diff
changeset
|
1151 |
datatype_new 'c U = E "('c, 'c U) T" |
33197 | 1152 |
|
1153 |
lemma "P (x\<Colon>'c U)" |
|
1154 |
nitpick [expect = genuine] |
|
1155 |
oops |
|
1156 |
||
1157 |
lemma "\<forall>x\<Colon>'c U. P x" |
|
1158 |
nitpick [expect = genuine] |
|
1159 |
oops |
|
1160 |
||
1161 |
lemma "P (E (C (\<lambda>a. True)))" |
|
1162 |
nitpick [expect = genuine] |
|
1163 |
oops |
|
1164 |
||
1165 |
subsubsection {* Records *} |
|
1166 |
||
1167 |
record ('a, 'b) point = |
|
1168 |
xpos :: 'a |
|
1169 |
ypos :: 'b |
|
1170 |
||
1171 |
lemma "(x\<Colon>('a, 'b) point) = y" |
|
1172 |
nitpick [expect = genuine] |
|
1173 |
oops |
|
1174 |
||
1175 |
record ('a, 'b, 'c) extpoint = "('a, 'b) point" + |
|
1176 |
ext :: 'c |
|
1177 |
||
1178 |
lemma "(x\<Colon>('a, 'b, 'c) extpoint) = y" |
|
1179 |
nitpick [expect = genuine] |
|
1180 |
oops |
|
1181 |
||
1182 |
subsubsection {* Inductively Defined Sets *} |
|
1183 |
||
1184 |
inductive_set undefinedSet :: "'a set" where |
|
1185 |
"undefined \<in> undefinedSet" |
|
1186 |
||
1187 |
lemma "x \<in> undefinedSet" |
|
1188 |
nitpick [expect = genuine] |
|
1189 |
oops |
|
1190 |
||
1191 |
inductive_set evenCard :: "'a set set" |
|
1192 |
where |
|
1193 |
"{} \<in> evenCard" | |
|
1194 |
"\<lbrakk>S \<in> evenCard; x \<notin> S; y \<notin> S; x \<noteq> y\<rbrakk> \<Longrightarrow> S \<union> {x, y} \<in> evenCard" |
|
1195 |
||
1196 |
lemma "S \<in> evenCard" |
|
1197 |
nitpick [expect = genuine] |
|
1198 |
oops |
|
1199 |
||
1200 |
inductive_set |
|
1201 |
even :: "nat set" |
|
1202 |
and odd :: "nat set" |
|
1203 |
where |
|
1204 |
"0 \<in> even" | |
|
1205 |
"n \<in> even \<Longrightarrow> Suc n \<in> odd" | |
|
1206 |
"n \<in> odd \<Longrightarrow> Suc n \<in> even" |
|
1207 |
||
1208 |
lemma "n \<in> odd" |
|
1209 |
nitpick [expect = genuine] |
|
1210 |
oops |
|
1211 |
||
1212 |
consts f :: "'a \<Rightarrow> 'a" |
|
1213 |
||
1214 |
inductive_set a_even :: "'a set" and a_odd :: "'a set" where |
|
1215 |
"undefined \<in> a_even" | |
|
1216 |
"x \<in> a_even \<Longrightarrow> f x \<in> a_odd" | |
|
1217 |
"x \<in> a_odd \<Longrightarrow> f x \<in> a_even" |
|
1218 |
||
1219 |
lemma "x \<in> a_odd" |
|
1220 |
nitpick [expect = genuine] |
|
1221 |
oops |
|
1222 |
||
1223 |
subsubsection {* Examples Involving Special Functions *} |
|
1224 |
||
1225 |
lemma "card x = 0" |
|
1226 |
nitpick [expect = genuine] |
|
1227 |
oops |
|
1228 |
||
1229 |
lemma "finite x" |
|
1230 |
nitpick [expect = none] |
|
1231 |
oops |
|
1232 |
||
1233 |
lemma "xs @ [] = ys @ []" |
|
1234 |
nitpick [expect = genuine] |
|
1235 |
oops |
|
1236 |
||
1237 |
lemma "xs @ ys = ys @ xs" |
|
1238 |
nitpick [expect = genuine] |
|
1239 |
oops |
|
1240 |
||
1241 |
lemma "f (lfp f) = lfp f" |
|
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
1242 |
nitpick [card = 2, expect = genuine] |
33197 | 1243 |
oops |
1244 |
||
1245 |
lemma "f (gfp f) = gfp f" |
|
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
1246 |
nitpick [card = 2, expect = genuine] |
33197 | 1247 |
oops |
1248 |
||
1249 |
lemma "lfp f = gfp f" |
|
35284
9edc2bd6d2bd
enabled Nitpick's support for quotient types + shortened the Nitpick tests a bit
blanchet
parents:
35087
diff
changeset
|
1250 |
nitpick [card = 2, expect = genuine] |
33197 | 1251 |
oops |
1252 |
||
1253 |
subsubsection {* Axiomatic Type Classes and Overloading *} |
|
1254 |
||
1255 |
text {* A type class without axioms: *} |
|
1256 |
||
35338 | 1257 |
class classA |
33197 | 1258 |
|
1259 |
lemma "P (x\<Colon>'a\<Colon>classA)" |
|
1260 |
nitpick [expect = genuine] |
|
1261 |
oops |
|
1262 |
||
1263 |
text {* An axiom with a type variable (denoting types which have at least two elements): *} |
|
1264 |
||
35338 | 1265 |
class classC = |
1266 |
assumes classC_ax: "\<exists>x y. x \<noteq> y" |
|
33197 | 1267 |
|
1268 |
lemma "P (x\<Colon>'a\<Colon>classC)" |
|
1269 |
nitpick [expect = genuine] |
|
1270 |
oops |
|
1271 |
||
1272 |
lemma "\<exists>x y. (x\<Colon>'a\<Colon>classC) \<noteq> y" |
|
1273 |
nitpick [expect = none] |
|
1274 |
sorry |
|
1275 |
||
1276 |
text {* A type class for which a constant is defined: *} |
|
1277 |
||
35338 | 1278 |
class classD = |
1279 |
fixes classD_const :: "'a \<Rightarrow> 'a" |
|
1280 |
assumes classD_ax: "classD_const (classD_const x) = classD_const x" |
|
33197 | 1281 |
|
1282 |
lemma "P (x\<Colon>'a\<Colon>classD)" |
|
1283 |
nitpick [expect = genuine] |
|
1284 |
oops |
|
1285 |
||
1286 |
text {* A type class with multiple superclasses: *} |
|
1287 |
||
35338 | 1288 |
class classE = classC + classD |
33197 | 1289 |
|
1290 |
lemma "P (x\<Colon>'a\<Colon>classE)" |
|
1291 |
nitpick [expect = genuine] |
|
1292 |
oops |
|
1293 |
||
1294 |
text {* OFCLASS: *} |
|
1295 |
||
1296 |
lemma "OFCLASS('a\<Colon>type, type_class)" |
|
1297 |
nitpick [expect = none] |
|
1298 |
apply intro_classes |
|
1299 |
done |
|
1300 |
||
1301 |
lemma "OFCLASS('a\<Colon>classC, type_class)" |
|
1302 |
nitpick [expect = none] |
|
1303 |
apply intro_classes |
|
1304 |
done |
|
1305 |
||
1306 |
lemma "OFCLASS('a\<Colon>type, classC_class)" |
|
1307 |
nitpick [expect = genuine] |
|
1308 |
oops |
|
1309 |
||
1310 |
text {* Overloading: *} |
|
1311 |
||
1312 |
consts inverse :: "'a \<Rightarrow> 'a" |
|
1313 |
||
1314 |
defs (overloaded) |
|
1315 |
inverse_bool: "inverse (b\<Colon>bool) \<equiv> \<not> b" |
|
1316 |
inverse_set: "inverse (S\<Colon>'a set) \<equiv> -S" |
|
1317 |
inverse_pair: "inverse p \<equiv> (inverse (fst p), inverse (snd p))" |
|
1318 |
||
1319 |
lemma "inverse b" |
|
1320 |
nitpick [expect = genuine] |
|
1321 |
oops |
|
1322 |
||
1323 |
lemma "P (inverse (S\<Colon>'a set))" |
|
1324 |
nitpick [expect = genuine] |
|
1325 |
oops |
|
1326 |
||
1327 |
lemma "P (inverse (p\<Colon>'a\<times>'b))" |
|
1328 |
nitpick [expect = genuine] |
|
1329 |
oops |
|
1330 |
||
1331 |
end |