src/HOLCF/Tutorial/Domain_ex.thy
changeset 40329 73f2b99b549d
parent 40321 d065b195ec89
child 40501 2ed71459136e
equal deleted inserted replaced
40328:ae8d187600e7 40329:73f2b99b549d
   103 
   103 
   104 lemma "(x::triv) = \<bottom>" by (induct x, simp_all)
   104 lemma "(x::triv) = \<bottom>" by (induct x, simp_all)
   105 
   105 
   106 text {* Lazy constructor arguments may have unpointed types. *}
   106 text {* Lazy constructor arguments may have unpointed types. *}
   107 
   107 
   108 domain natlist = nnil | ncons (lazy "nat discr") natlist
   108 domain (unsafe) natlist = nnil | ncons (lazy "nat discr") natlist
   109 
   109 
   110 text {* Class constraints may be given for type parameters on the LHS. *}
   110 text {* Class constraints may be given for type parameters on the LHS. *}
   111 
   111 
   112 domain ('a::cpo) box = Box (lazy 'a)
   112 domain (unsafe) ('a::cpo) box = Box (lazy 'a)
       
   113 
       
   114 domain (unsafe) ('a::type) stream = snil | scons (lazy "'a discr") "'a stream"
   113 
   115 
   114 
   116 
   115 subsection {* Generated constants and theorems *}
   117 subsection {* Generated constants and theorems *}
   116 
   118 
   117 domain 'a tree = Leaf (lazy 'a) | Node (left :: "'a tree") (right :: "'a tree")
   119 domain 'a tree = Leaf (lazy 'a) | Node (left :: "'a tree") (right :: "'a tree")
   194 (*
   196 (*
   195 domain xx = xx ("x y")
   197 domain xx = xx ("x y")
   196   -- "Inner syntax error: unexpected end of input"
   198   -- "Inner syntax error: unexpected end of input"
   197 *)
   199 *)
   198 
   200 
   199 text {*
       
   200   Non-cpo type parameters currently do not work.
       
   201 *}
       
   202 (*
       
   203 domain ('a::type) stream = snil | scons (lazy "'a discr") "'a stream"
       
   204 *)
       
   205 
       
   206 end
   201 end