33197
|
1 |
(* Title: HOL/Nitpick_Examples/Induct_Nits.thy
|
|
2 |
Author: Jasmin Blanchette, TU Muenchen
|
|
3 |
Copyright 2009
|
|
4 |
|
|
5 |
Examples featuring Nitpick applied to (co)inductive definitions.
|
|
6 |
*)
|
|
7 |
|
|
8 |
header {* Examples Featuring Nitpick Applied to (Co)inductive Definitions *}
|
|
9 |
|
|
10 |
theory Induct_Nits
|
|
11 |
imports Main
|
|
12 |
begin
|
|
13 |
|
|
14 |
nitpick_params [show_all]
|
|
15 |
|
|
16 |
inductive p1 :: "nat \<Rightarrow> bool" where
|
|
17 |
"p1 0" |
|
|
18 |
"p1 n \<Longrightarrow> p1 (n + 2)"
|
|
19 |
|
|
20 |
coinductive q1 :: "nat \<Rightarrow> bool" where
|
|
21 |
"q1 0" |
|
|
22 |
"q1 n \<Longrightarrow> q1 (n + 2)"
|
|
23 |
|
|
24 |
lemma "p1 = q1"
|
|
25 |
nitpick [expect = none]
|
|
26 |
nitpick [wf, expect = none]
|
|
27 |
nitpick [non_wf, expect = none]
|
|
28 |
nitpick [non_wf, dont_star_linear_preds, expect = none]
|
|
29 |
oops
|
|
30 |
|
|
31 |
lemma "p1 \<noteq> q1"
|
|
32 |
nitpick [expect = potential]
|
|
33 |
nitpick [wf, expect = potential]
|
|
34 |
nitpick [non_wf, expect = potential]
|
|
35 |
nitpick [non_wf, dont_star_linear_preds, expect = potential]
|
|
36 |
oops
|
|
37 |
|
|
38 |
lemma "p1 (n - 2) \<Longrightarrow> p1 n"
|
|
39 |
nitpick [expect = genuine]
|
|
40 |
nitpick [non_wf, expect = genuine]
|
|
41 |
nitpick [non_wf, dont_star_linear_preds, expect = genuine]
|
|
42 |
oops
|
|
43 |
|
|
44 |
lemma "q1 (n - 2) \<Longrightarrow> q1 n"
|
|
45 |
nitpick [expect = genuine]
|
|
46 |
nitpick [non_wf, expect = genuine]
|
|
47 |
nitpick [non_wf, dont_star_linear_preds, expect = genuine]
|
|
48 |
oops
|
|
49 |
|
|
50 |
inductive p2 :: "nat \<Rightarrow> bool" where
|
|
51 |
"p2 n \<Longrightarrow> p2 n"
|
|
52 |
|
|
53 |
coinductive q2 :: "nat \<Rightarrow> bool" where
|
|
54 |
"q2 n \<Longrightarrow> q2 n"
|
|
55 |
|
|
56 |
lemma "p2 = {}"
|
|
57 |
nitpick [expect = none]
|
|
58 |
nitpick [dont_star_linear_preds, expect = none]
|
|
59 |
sorry
|
|
60 |
|
|
61 |
lemma "q2 = {}"
|
|
62 |
nitpick [expect = genuine]
|
|
63 |
nitpick [dont_star_linear_preds, expect = genuine]
|
|
64 |
nitpick [wf, expect = likely_genuine]
|
|
65 |
oops
|
|
66 |
|
|
67 |
lemma "p2 = UNIV"
|
|
68 |
nitpick [expect = genuine]
|
|
69 |
nitpick [dont_star_linear_preds, expect = genuine]
|
|
70 |
oops
|
|
71 |
|
|
72 |
lemma "q2 = UNIV"
|
|
73 |
nitpick [expect = none]
|
|
74 |
nitpick [dont_star_linear_preds, expect = none]
|
|
75 |
nitpick [wf, expect = likely_genuine]
|
|
76 |
sorry
|
|
77 |
|
|
78 |
lemma "p2 = q2"
|
|
79 |
nitpick [expect = genuine]
|
|
80 |
nitpick [dont_star_linear_preds, expect = genuine]
|
|
81 |
oops
|
|
82 |
|
|
83 |
lemma "p2 n"
|
|
84 |
nitpick [expect = genuine]
|
|
85 |
nitpick [dont_star_linear_preds, expect = genuine]
|
|
86 |
nitpick [dont_specialize, expect = genuine]
|
|
87 |
oops
|
|
88 |
|
|
89 |
lemma "q2 n"
|
|
90 |
nitpick [expect = none]
|
|
91 |
nitpick [dont_star_linear_preds, expect = none]
|
|
92 |
sorry
|
|
93 |
|
|
94 |
lemma "\<not> p2 n"
|
|
95 |
nitpick [expect = none]
|
|
96 |
nitpick [dont_star_linear_preds, expect = none]
|
|
97 |
sorry
|
|
98 |
|
|
99 |
lemma "\<not> q2 n"
|
|
100 |
nitpick [expect = genuine]
|
|
101 |
nitpick [dont_star_linear_preds, expect = genuine]
|
|
102 |
nitpick [dont_specialize, expect = genuine]
|
|
103 |
oops
|
|
104 |
|
|
105 |
inductive p3 and p4 where
|
|
106 |
"p3 0" |
|
|
107 |
"p3 n \<Longrightarrow> p4 (Suc n)" |
|
|
108 |
"p4 n \<Longrightarrow> p3 (Suc n)"
|
|
109 |
|
|
110 |
coinductive q3 and q4 where
|
|
111 |
"q3 0" |
|
|
112 |
"q3 n \<Longrightarrow> q4 (Suc n)" |
|
|
113 |
"q4 n \<Longrightarrow> q3 (Suc n)"
|
|
114 |
|
|
115 |
lemma "p3 = q3"
|
|
116 |
nitpick [expect = none]
|
|
117 |
nitpick [dont_star_linear_preds, expect = none]
|
|
118 |
nitpick [non_wf, expect = potential]
|
|
119 |
nitpick [non_wf, dont_box, expect = none]
|
|
120 |
nitpick [non_wf, dont_star_linear_preds, expect = none]
|
|
121 |
sorry
|
|
122 |
|
|
123 |
lemma "p4 = q4"
|
|
124 |
nitpick [expect = none]
|
|
125 |
nitpick [dont_star_linear_preds, expect = none]
|
|
126 |
nitpick [non_wf, expect = potential]
|
|
127 |
nitpick [non_wf, dont_box, expect = none]
|
|
128 |
nitpick [non_wf, dont_star_linear_preds, expect = none]
|
|
129 |
sorry
|
|
130 |
|
|
131 |
lemma "p3 = UNIV - p4"
|
|
132 |
nitpick [expect = none]
|
|
133 |
nitpick [dont_star_linear_preds, expect = none]
|
|
134 |
nitpick [non_wf, expect = potential]
|
|
135 |
nitpick [non_wf, dont_box, expect = none]
|
|
136 |
nitpick [non_wf, dont_star_linear_preds, expect = none]
|
|
137 |
sorry
|
|
138 |
|
|
139 |
lemma "q3 = UNIV - q4"
|
|
140 |
nitpick [expect = none]
|
|
141 |
nitpick [dont_star_linear_preds, expect = none]
|
|
142 |
nitpick [non_wf, expect = none]
|
|
143 |
nitpick [non_wf, dont_box, expect = none]
|
|
144 |
nitpick [non_wf, dont_star_linear_preds, expect = none]
|
|
145 |
sorry
|
|
146 |
|
|
147 |
lemma "p3 \<inter> q4 \<noteq> {}"
|
|
148 |
nitpick [expect = potential]
|
|
149 |
nitpick [non_wf, expect = potential]
|
|
150 |
nitpick [non_wf, dont_star_linear_preds, expect = potential]
|
|
151 |
sorry
|
|
152 |
|
|
153 |
lemma "q3 \<inter> p4 \<noteq> {}"
|
|
154 |
nitpick [expect = potential]
|
|
155 |
nitpick [non_wf, expect = potential]
|
|
156 |
nitpick [non_wf, dont_star_linear_preds, expect = potential]
|
|
157 |
sorry
|
|
158 |
|
|
159 |
lemma "p3 \<union> q4 \<noteq> UNIV"
|
|
160 |
nitpick [expect = potential]
|
|
161 |
nitpick [non_wf, expect = potential]
|
|
162 |
nitpick [non_wf, dont_star_linear_preds, expect = potential]
|
|
163 |
sorry
|
|
164 |
|
|
165 |
lemma "q3 \<union> p4 \<noteq> UNIV"
|
|
166 |
nitpick [expect = potential]
|
|
167 |
nitpick [non_wf, expect = potential]
|
|
168 |
nitpick [non_wf, dont_star_linear_preds, expect = potential]
|
|
169 |
sorry
|
|
170 |
|
|
171 |
end
|