src/Doc/Datatypes/Datatypes.thy
changeset 53677 b51ebeda414d
parent 53675 d4a4b32038eb
child 53691 fa103abdbade
equal deleted inserted replaced
53675:d4a4b32038eb 53677:b51ebeda414d
  1600 \abovedisplayskip=.5\abovedisplayskip
  1600 \abovedisplayskip=.5\abovedisplayskip
  1601 \belowdisplayskip=.5\belowdisplayskip
  1601 \belowdisplayskip=.5\belowdisplayskip
  1602 
  1602 
  1603 \item The \emph{constructor view} specifies $f$ by equations of the form
  1603 \item The \emph{constructor view} specifies $f$ by equations of the form
  1604 \[@{text "f x\<^sub>1 \<dots> x\<^sub>n = \<dots>"}\]
  1604 \[@{text "f x\<^sub>1 \<dots> x\<^sub>n = \<dots>"}\]
  1605 Haskell and other lazy functional programming languages support this style.
  1605 Lazy functional programming languages such as Haskell support this style.
  1606 
  1606 
  1607 \item The \emph{destructor view} specifies $f$ by implications of the form
  1607 \item The \emph{destructor view} specifies $f$ by implications of the form
  1608 \[@{text "\<dots> \<Longrightarrow> is_C\<^sub>j (f x\<^sub>1 \<dots> x\<^sub>n)"}\] and
  1608 \[@{text "\<dots> \<Longrightarrow> is_C\<^sub>j (f x\<^sub>1 \<dots> x\<^sub>n)"}\] and
  1609 equations of the form
  1609 equations of the form
  1610 \[@{text "un_C\<^sub>ji (f x\<^sub>1 \<dots> x\<^sub>n) = \<dots>"}\]
  1610 \[@{text "un_C\<^sub>ji (f x\<^sub>1 \<dots> x\<^sub>n) = \<dots>"}\]
  1620 appears directly to the right of the equal sign:
  1620 appears directly to the right of the equal sign:
  1621 *}
  1621 *}
  1622 
  1622 
  1623     primcorec_notyet literate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a llist" where
  1623     primcorec_notyet literate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a llist" where
  1624       "literate f x = LCons x (literate f (f x))"
  1624       "literate f x = LCons x (literate f (f x))"
       
  1625 
       
  1626 text {* \blankline *}
  1625 
  1627 
  1626     primcorec_notyet siterate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a stream" where
  1628     primcorec_notyet siterate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a stream" where
  1627       "siterate f x = SCons x (siterate f (f x))"
  1629       "siterate f x = SCons x (siterate f (f x))"
  1628 
  1630 
  1629 text {*
  1631 text {*
  1647     primcorec literate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a llist" where
  1649     primcorec literate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a llist" where
  1648       "\<not> lnull (literate _ x)" |
  1650       "\<not> lnull (literate _ x)" |
  1649       "lhd (literate _ x) = x" |
  1651       "lhd (literate _ x) = x" |
  1650       "ltl (literate f x) = literate f (f x)"
  1652       "ltl (literate f x) = literate f (f x)"
  1651     .
  1653     .
       
  1654 
       
  1655 text {* \blankline *}
  1652 
  1656 
  1653     primcorec siterate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a stream" where
  1657     primcorec siterate :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a stream" where
  1654       "shd (siterate _ x) = x" |
  1658       "shd (siterate _ x) = x" |
  1655       "stl (siterate f x) = siterate f (f x)"
  1659       "stl (siterate f x) = siterate f (f x)"
  1656     .
  1660     .
  1848 tree\<^sub>i\<^sub>i}) or as a finite set (@{text tree\<^sub>i\<^sub>s}):
  1852 tree\<^sub>i\<^sub>i}) or as a finite set (@{text tree\<^sub>i\<^sub>s}):
  1849 *}
  1853 *}
  1850 
  1854 
  1851     primcorec_notyet iterate\<^sub>i\<^sub>i :: "('a \<Rightarrow> 'a llist) \<Rightarrow> 'a \<Rightarrow> 'a tree\<^sub>i\<^sub>i" where
  1855     primcorec_notyet iterate\<^sub>i\<^sub>i :: "('a \<Rightarrow> 'a llist) \<Rightarrow> 'a \<Rightarrow> 'a tree\<^sub>i\<^sub>i" where
  1852       "iterate\<^sub>i\<^sub>i f x = Node\<^sub>i\<^sub>i x (lmap (iterate\<^sub>i\<^sub>i f) (f x))"
  1856       "iterate\<^sub>i\<^sub>i f x = Node\<^sub>i\<^sub>i x (lmap (iterate\<^sub>i\<^sub>i f) (f x))"
       
  1857 
       
  1858 text {* \blankline *}
  1853 
  1859 
  1854     primcorec_notyet iterate\<^sub>i\<^sub>s :: "('a \<Rightarrow> 'a fset) \<Rightarrow> 'a \<Rightarrow> 'a tree\<^sub>i\<^sub>s" where
  1860     primcorec_notyet iterate\<^sub>i\<^sub>s :: "('a \<Rightarrow> 'a fset) \<Rightarrow> 'a \<Rightarrow> 'a tree\<^sub>i\<^sub>s" where
  1855       "iterate\<^sub>i\<^sub>s f x = Node\<^sub>i\<^sub>s x (fmap (iterate\<^sub>i\<^sub>s f) (f x))"
  1861       "iterate\<^sub>i\<^sub>s f x = Node\<^sub>i\<^sub>s x (fmap (iterate\<^sub>i\<^sub>s f) (f x))"
  1856 
  1862 
  1857 text {*
  1863 text {*