equal
deleted
inserted
replaced
358 subsection {* Bounded universal quantifiers *} |
358 subsection {* Bounded universal quantifiers *} |
359 |
359 |
360 class bounded_forall = |
360 class bounded_forall = |
361 fixes bounded_forall :: "('a \<Rightarrow> bool) \<Rightarrow> code_numeral \<Rightarrow> bool" |
361 fixes bounded_forall :: "('a \<Rightarrow> bool) \<Rightarrow> code_numeral \<Rightarrow> bool" |
362 |
362 |
363 |
|
364 instantiation nat :: bounded_forall |
|
365 begin |
|
366 |
|
367 fun bounded_forall_nat :: "(nat => bool) => code_numeral => bool" |
|
368 where |
|
369 "bounded_forall P d = ((P 0) \<and> (if d > 0 then bounded_forall (%n. P (Suc n)) (d - 1) else True))" |
|
370 |
|
371 instance .. |
|
372 |
|
373 end |
|
374 |
|
375 subsection {* Defining combinators for any first-order data type *} |
363 subsection {* Defining combinators for any first-order data type *} |
376 |
364 |
377 definition catch_match :: "term list option => term list option => term list option" |
365 definition catch_match :: "term list option => term list option => term list option" |
378 where |
366 where |
379 [code del]: "catch_match t1 t2 = (SOME t. t = t1 \<or> t = t2)" |
367 [code del]: "catch_match t1 t2 = (SOME t. t = t1 \<or> t = t2)" |