src/HOL/Datatype_Examples/Misc_Datatype.thy
changeset 62536 656e9653c645
parent 58966 0297e1277ed2
child 63167 0909deb8059b
equal deleted inserted replaced
62535:cb262f03ac12 62536:656e9653c645
    55 (*
    55 (*
    56   ('a, 'b1, 'b2) F1 = 'a * 'b1 + 'a * 'b2
    56   ('a, 'b1, 'b2) F1 = 'a * 'b1 + 'a * 'b2
    57   ('a, 'b1, 'b2) F2 = unit + 'b1 * 'b2
    57   ('a, 'b1, 'b2) F2 = unit + 'b1 * 'b2
    58 *)
    58 *)
    59 
    59 
    60 datatype (discs_sels) 'a I1 = I11 'a "'a I1" | I12 'a "'a I2"
    60 locale loc =
    61 and 'a I2 = I21 | I22 "'a I1" "'a I2"
    61   fixes c :: 'a and d :: 'a
    62 
    62   assumes "c \<noteq> d"
    63 datatype (discs_sels) 'a tree = TEmpty | TNode 'a "'a forest"
    63 begin
    64 and 'a forest = FNil | FCons "'a tree" "'a forest"
    64 
       
    65 datatype (discs_sels) 'b I1 = I11 'b "'b I1" | I12 'b "'b I2"
       
    66 and 'b I2 = I21 | I22 "'b I1" "'b I2"
       
    67 
       
    68 datatype (discs_sels) 'b tree = TEmpty | TNode 'b "'b forest"
       
    69 and 'b forest = FNil | FCons "'b tree" "'b forest"
       
    70 
       
    71 end
    65 
    72 
    66 datatype (discs_sels) 'a tree' = TEmpty' | TNode' "'a branch" "'a branch"
    73 datatype (discs_sels) 'a tree' = TEmpty' | TNode' "'a branch" "'a branch"
    67 and 'a branch = Branch 'a "'a tree'"
    74 and 'a branch = Branch 'a "'a tree'"
    68 
    75 
    69 datatype (discs_sels) 'a bin_rose_tree = BRTree 'a "'a bin_rose_tree mylist" "'a bin_rose_tree mylist"
    76 datatype (discs_sels) 'a bin_rose_tree = BRTree 'a "'a bin_rose_tree mylist" "'a bin_rose_tree mylist"
   215 
   222 
   216 instance par_lambda :: (countable) countable
   223 instance par_lambda :: (countable) countable
   217   by countable_datatype
   224   by countable_datatype
   218 *)
   225 *)
   219 
   226 
   220 instance I1 and I2 :: (countable) countable
       
   221   by countable_datatype
       
   222 
       
   223 instance tree and forest :: (countable) countable
       
   224   by countable_datatype
       
   225 
       
   226 instance tree' and branch :: (countable) countable
   227 instance tree' and branch :: (countable) countable
   227   by countable_datatype
   228   by countable_datatype
   228 
   229 
   229 instance bin_rose_tree :: (countable) countable
   230 instance bin_rose_tree :: (countable) countable
   230   by countable_datatype
   231   by countable_datatype
   316 datatype_compat simple
   317 datatype_compat simple
   317 datatype_compat simple'
   318 datatype_compat simple'
   318 datatype_compat simple''
   319 datatype_compat simple''
   319 datatype_compat mylist
   320 datatype_compat mylist
   320 datatype_compat some_passive
   321 datatype_compat some_passive
   321 datatype_compat I1 I2
       
   322 datatype_compat tree forest
       
   323 datatype_compat tree' branch
   322 datatype_compat tree' branch
   324 datatype_compat bin_rose_tree
   323 datatype_compat bin_rose_tree
   325 datatype_compat exp trm factor
   324 datatype_compat exp trm factor
   326 datatype_compat ftree
   325 datatype_compat ftree
   327 datatype_compat nofail1
   326 datatype_compat nofail1