equal
deleted
inserted
replaced
160 by (auto intro: is_D_or_E.intros) |
160 by (auto intro: is_D_or_E.intros) |
161 |
161 |
162 code_pred (expected_modes: o => bool, i => bool) is_D_or_E |
162 code_pred (expected_modes: o => bool, i => bool) is_D_or_E |
163 proof - |
163 proof - |
164 case is_D_or_E |
164 case is_D_or_E |
165 from this(1) show thesis |
165 from is_D_or_E.prems show thesis |
166 proof |
166 proof |
167 fix xa |
167 fix xa |
168 assume x: "x = xa" |
168 assume x: "x = xa" |
169 assume "xa = D \<or> xa = E" |
169 assume "xa = D \<or> xa = E" |
170 from this show thesis |
170 from this show thesis |
245 case cons |
245 case cons |
246 from alt_cons cons show thesis by fastsimp |
246 from alt_cons cons show thesis by fastsimp |
247 qed |
247 qed |
248 qed |
248 qed |
249 |
249 |
|
250 |
|
251 inductive ya_even and ya_odd :: "nat => bool" |
|
252 where |
|
253 even_zero: "ya_even 0" |
|
254 | odd_plus1: "ya_even x ==> ya_odd (x + 1)" |
|
255 | even_plus1: "ya_odd x ==> ya_even (x + 1)" |
|
256 |
|
257 |
|
258 declare even_zero[code_pred_intro even_0] |
|
259 |
|
260 lemma [code_pred_intro odd_Suc]: "ya_even x ==> ya_odd (Suc x)" |
|
261 by (auto simp only: Suc_eq_plus1 intro: ya_even_ya_odd.intros) |
|
262 |
|
263 lemma [code_pred_intro even_Suc]:"ya_odd x ==> ya_even (Suc x)" |
|
264 by (auto simp only: Suc_eq_plus1 intro: ya_even_ya_odd.intros) |
|
265 |
|
266 code_pred ya_even |
|
267 proof - |
|
268 case ya_even |
|
269 from ya_even.prems show thesis |
|
270 proof (cases) |
|
271 case even_zero |
|
272 from even_zero even_0 show thesis by simp |
|
273 next |
|
274 case even_plus1 |
|
275 from even_plus1 even_Suc show thesis by simp |
|
276 qed |
|
277 next |
|
278 case ya_odd |
|
279 from ya_odd.prems show thesis |
|
280 proof (cases) |
|
281 case odd_plus1 |
|
282 from odd_plus1 odd_Suc show thesis by simp |
|
283 qed |
|
284 qed |
|
285 |
250 subsection {* Preprocessor Inlining *} |
286 subsection {* Preprocessor Inlining *} |
251 |
287 |
252 definition "equals == (op =)" |
288 definition "equals == (op =)" |
253 |
289 |
254 inductive zerozero' :: "nat * nat => bool" where |
290 inductive zerozero' :: "nat * nat => bool" where |