src/Doc/Datatypes/Datatypes.thy
changeset 58311 a684dd412115
parent 58310 91ea607a34d8
child 58335 a5a3b576fcfb
equal deleted inserted replaced
58310:91ea607a34d8 58311:a684dd412115
   115 
   115 
   116 \item Section
   116 \item Section
   117 \ref{sec:deriving-destructors-and-theorems-for-free-constructors},
   117 \ref{sec:deriving-destructors-and-theorems-for-free-constructors},
   118 ``Deriving Destructors and Theorems for Free Constructors,'' explains how to
   118 ``Deriving Destructors and Theorems for Free Constructors,'' explains how to
   119 use the command @{command free_constructors} to derive destructor constants
   119 use the command @{command free_constructors} to derive destructor constants
   120 and theorems for freely generated types, as performed internally by @{command
   120 and theorems for freely generated types, as performed internally by
   121 datatype} and @{command codatatype}.
   121 @{command datatype} and @{command codatatype}.
   122 
   122 
   123 %\item Section \ref{sec:using-the-standard-ml-interface}, ``Using the Standard
   123 %\item Section \ref{sec:using-the-standard-ml-interface}, ``Using the Standard
   124 ML Interface,'' %describes the package's programmatic interface.
   124 ML Interface,'' %describes the package's programmatic interface.
   125 
   125 
   126 \item Section \ref{sec:controlling-plugins}, ``Controlling Plugins,''
   126 \item Section \ref{sec:controlling-plugins}, ``Controlling Plugins,''
   320 type arguments are called \emph{dead}. In @{typ "'a \<Rightarrow> 'b"} and
   320 type arguments are called \emph{dead}. In @{typ "'a \<Rightarrow> 'b"} and
   321 @{typ "('a, 'b) fun_copy"}, the type variable @{typ 'a} is dead and
   321 @{typ "('a, 'b) fun_copy"}, the type variable @{typ 'a} is dead and
   322 @{typ 'b} is live.
   322 @{typ 'b} is live.
   323 
   323 
   324 Type constructors must be registered as BNFs to have live arguments. This is
   324 Type constructors must be registered as BNFs to have live arguments. This is
   325 done automatically for datatypes and codatatypes introduced by the @{command
   325 done automatically for datatypes and codatatypes introduced by the
   326 datatype} and @{command codatatype} commands.
   326 @{command datatype} and @{command codatatype} commands.
   327 Section~\ref{sec:introducing-bounded-natural-functors} explains how to
   327 Section~\ref{sec:introducing-bounded-natural-functors} explains how to
   328 register arbitrary type constructors as BNFs.
   328 register arbitrary type constructors as BNFs.
   329 
   329 
   330 Here is another example that fails:
   330 Here is another example that fails:
   331 *}
   331 *}
   614 \item All types through which recursion takes place must be new-style datatypes
   614 \item All types through which recursion takes place must be new-style datatypes
   615 or the function type. In principle, it should be possible to support old-style
   615 or the function type. In principle, it should be possible to support old-style
   616 datatypes as well, but this has not been implemented yet (and there is currently
   616 datatypes as well, but this has not been implemented yet (and there is currently
   617 no way to register old-style datatypes as new-style datatypes).
   617 no way to register old-style datatypes as new-style datatypes).
   618 \end{itemize}
   618 \end{itemize}
   619 
       
   620 An alternative to @{command datatype_compat} is to use the old package's
       
   621 \keyw{rep_\allowbreak datatype} command. The associated proof obligations must then be
       
   622 discharged manually.
       
   623 *}
   619 *}
   624 
   620 
   625 
   621 
   626 subsection {* Generated Constants
   622 subsection {* Generated Constants
   627   \label{ssec:datatype-generated-constants} *}
   623   \label{ssec:datatype-generated-constants} *}
  1055 Section~\ref{sssec:primrec-nested-as-mutual-recursion}. For recursion through
  1051 Section~\ref{sssec:primrec-nested-as-mutual-recursion}. For recursion through
  1056 functions, the old-style induction rule can be obtained by applying the
  1052 functions, the old-style induction rule can be obtained by applying the
  1057 @{text "[unfolded all_mem_range]"} attribute on @{text t.induct}.
  1053 @{text "[unfolded all_mem_range]"} attribute on @{text t.induct}.
  1058 
  1054 
  1059 \item \emph{The internal constructions are completely different.} Proof texts
  1055 \item \emph{The internal constructions are completely different.} Proof texts
  1060 that unfold the definition of constants introduced by \keyw{old\_datatype} will
  1056 that unfold the definition of constants introduced by \keyw{old_datatype} will
  1061 be difficult to port.
  1057 be difficult to port.
  1062 
  1058 
  1063 \item \emph{Some constants and theorems have different names.}
  1059 \item \emph{Some constants and theorems have different names.}
  1064 For non-mutually recursive datatypes,
  1060 For non-mutually recursive datatypes,
  1065 the alias @{text t.inducts} for @{text t.induct} is no longer generated.
  1061 the alias @{text t.inducts} for @{text t.induct} is no longer generated.