equal
deleted
inserted
replaced
3 Copyright 2009-2011 |
3 Copyright 2009-2011 |
4 |
4 |
5 Examples featuring Nitpick's functional core. |
5 Examples featuring Nitpick's functional core. |
6 *) |
6 *) |
7 |
7 |
8 section {* Examples Featuring Nitpick's Functional Core *} |
8 section \<open>Examples Featuring Nitpick's Functional Core\<close> |
9 |
9 |
10 theory Core_Nits |
10 theory Core_Nits |
11 imports Main |
11 imports Main |
12 begin |
12 begin |
13 |
13 |
14 nitpick_params [verbose, card = 1-6, unary_ints, max_potential = 0, |
14 nitpick_params [verbose, card = 1-6, unary_ints, max_potential = 0, |
15 sat_solver = MiniSat_JNI, max_threads = 1, timeout = 240] |
15 sat_solver = MiniSat_JNI, max_threads = 1, timeout = 240] |
16 |
16 |
17 subsection {* Curry in a Hurry *} |
17 subsection \<open>Curry in a Hurry\<close> |
18 |
18 |
19 lemma "(\<lambda>f x y. (curry o case_prod) f x y) = (\<lambda>f x y. (\<lambda>x. x) f x y)" |
19 lemma "(\<lambda>f x y. (curry o case_prod) f x y) = (\<lambda>f x y. (\<lambda>x. x) f x y)" |
20 nitpick [card = 1-12, expect = none] |
20 nitpick [card = 1-12, expect = none] |
21 by auto |
21 by auto |
22 |
22 |
34 |
34 |
35 lemma "case_prod (\<lambda>x y. f (x, y)) = f" |
35 lemma "case_prod (\<lambda>x y. f (x, y)) = f" |
36 nitpick [card = 1-12, expect = none] |
36 nitpick [card = 1-12, expect = none] |
37 by auto |
37 by auto |
38 |
38 |
39 subsection {* Representations *} |
39 subsection \<open>Representations\<close> |
40 |
40 |
41 lemma "\<exists>f. f = (\<lambda>x. x) \<and> f y = y" |
41 lemma "\<exists>f. f = (\<lambda>x. x) \<and> f y = y" |
42 nitpick [expect = none] |
42 nitpick [expect = none] |
43 by auto |
43 by auto |
44 |
44 |
154 |
154 |
155 lemma "f = (\<lambda>x::'a\<times>'b. x)" |
155 lemma "f = (\<lambda>x::'a\<times>'b. x)" |
156 nitpick [card = 8, expect = genuine] |
156 nitpick [card = 8, expect = genuine] |
157 oops |
157 oops |
158 |
158 |
159 subsection {* Quantifiers *} |
159 subsection \<open>Quantifiers\<close> |
160 |
160 |
161 lemma "x = y" |
161 lemma "x = y" |
162 nitpick [card 'a = 1, expect = none] |
162 nitpick [card 'a = 1, expect = none] |
163 nitpick [card 'a = 100, expect = genuine] |
163 nitpick [card 'a = 100, expect = genuine] |
164 oops |
164 oops |
262 |
262 |
263 lemma "let x = (\<forall>x::'a \<times> 'b. P x) in if x then x else \<not> x" |
263 lemma "let x = (\<forall>x::'a \<times> 'b. P x) in if x then x else \<not> x" |
264 nitpick [expect = none] |
264 nitpick [expect = none] |
265 by auto |
265 by auto |
266 |
266 |
267 subsection {* Schematic Variables *} |
267 subsection \<open>Schematic Variables\<close> |
268 |
268 |
269 schematic_goal "x = ?x" |
269 schematic_goal "x = ?x" |
270 nitpick [expect = none] |
270 nitpick [expect = none] |
271 by auto |
271 by auto |
272 |
272 |
288 |
288 |
289 schematic_goal "\<exists>x. ?x = ?y" |
289 schematic_goal "\<exists>x. ?x = ?y" |
290 nitpick [expect = none] |
290 nitpick [expect = none] |
291 by auto |
291 by auto |
292 |
292 |
293 subsection {* Known Constants *} |
293 subsection \<open>Known Constants\<close> |
294 |
294 |
295 lemma "x \<equiv> Pure.all \<Longrightarrow> False" |
295 lemma "x \<equiv> Pure.all \<Longrightarrow> False" |
296 nitpick [card = 1, expect = genuine] |
296 nitpick [card = 1, expect = genuine] |
297 nitpick [card = 1, box "('a \<Rightarrow> prop) \<Rightarrow> prop", expect = genuine] |
297 nitpick [card = 1, box "('a \<Rightarrow> prop) \<Rightarrow> prop", expect = genuine] |
298 nitpick [card = 6, expect = genuine] |
298 nitpick [card = 6, expect = genuine] |
676 |
676 |
677 lemma "All finite" |
677 lemma "All finite" |
678 nitpick [expect = none] |
678 nitpick [expect = none] |
679 oops |
679 oops |
680 |
680 |
681 subsection {* The and Eps *} |
681 subsection \<open>The and Eps\<close> |
682 |
682 |
683 lemma "x = The" |
683 lemma "x = The" |
684 nitpick [card = 5, expect = genuine] |
684 nitpick [card = 5, expect = genuine] |
685 oops |
685 oops |
686 |
686 |
917 nitpick [card nat = 6, expect = none] |
917 nitpick [card nat = 6, expect = none] |
918 sorry |
918 sorry |
919 |
919 |
920 nitpick_params [max_potential = 0] |
920 nitpick_params [max_potential = 0] |
921 |
921 |
922 subsection {* Destructors and Recursors *} |
922 subsection \<open>Destructors and Recursors\<close> |
923 |
923 |
924 lemma "(x::'a) = (case True of True \<Rightarrow> x | False \<Rightarrow> x)" |
924 lemma "(x::'a) = (case True of True \<Rightarrow> x | False \<Rightarrow> x)" |
925 nitpick [card = 2, expect = none] |
925 nitpick [card = 2, expect = none] |
926 by auto |
926 by auto |
927 |
927 |