src/HOL/ex/Predicate_Compile_ex.thy
changeset 33475 42fed8eac357
parent 33473 3b275a0bf18c
child 33477 1272cfc7b910
equal deleted inserted replaced
33474:767cfb37833e 33475:42fed8eac357
   186 (*code_pred [inductify] one_or_two .*)
   186 (*code_pred [inductify] one_or_two .*)
   187 code_pred [inductify, random] one_or_two .
   187 code_pred [inductify, random] one_or_two .
   188 (*values "{x. one_or_two x}"*)
   188 (*values "{x. one_or_two x}"*)
   189 values [random] "{x. one_or_two x}"
   189 values [random] "{x. one_or_two x}"
   190 
   190 
   191 definition one_or_two':
   191 inductive one_or_two' :: "nat => bool"
   192   "one_or_two' == {1, (2::nat)}"
   192 where
   193 
   193   "one_or_two' 1"
   194 code_pred [inductify] one_or_two' .
   194 | "one_or_two' 2"
       
   195 
       
   196 code_pred one_or_two' .
   195 thm one_or_two'.equation
   197 thm one_or_two'.equation
   196 (* TODO: handling numerals *)
   198 
   197 (*values "{x. one_or_two' x}"*)
   199 values "{x. one_or_two' x}"
       
   200 
       
   201 definition one_or_two'':
       
   202   "one_or_two'' == {1, (2::nat)}"
       
   203 
       
   204 code_pred [inductify] one_or_two'' .
       
   205 thm one_or_two''.equation
       
   206 
       
   207 values "{x. one_or_two'' x}"
   198 
   208 
   199 
   209 
   200 subsection {* even predicate *}
   210 subsection {* even predicate *}
   201 
   211 
   202 inductive even :: "nat \<Rightarrow> bool" and odd :: "nat \<Rightarrow> bool" where
   212 inductive even :: "nat \<Rightarrow> bool" and odd :: "nat \<Rightarrow> bool" where