equal
deleted
inserted
replaced
108 |
108 |
109 \item Section \ref{sec:defining-corecursive-functions}, ``Defining Corecursive |
109 \item Section \ref{sec:defining-corecursive-functions}, ``Defining Corecursive |
110 Functions,'' describes how to specify corecursive functions using the |
110 Functions,'' describes how to specify corecursive functions using the |
111 @{command primcorec} and @{command primcorecursive} commands. |
111 @{command primcorec} and @{command primcorecursive} commands. |
112 |
112 |
113 \item Section \ref{sec:introducing-bounded-natural-functors}, ``Introducing |
113 \item Section \ref{sec:registering-bounded-natural-functors}, ``Registering |
114 Bounded Natural Functors,'' explains how to use the @{command bnf} command |
114 Bounded Natural Functors,'' explains how to use the @{command bnf} command |
115 to register arbitrary type constructors as BNFs. |
115 to register arbitrary type constructors as BNFs. |
116 |
116 |
117 \item Section |
117 \item Section |
118 \ref{sec:deriving-destructors-and-theorems-for-free-constructors}, |
118 \ref{sec:deriving-destructors-and-theorems-for-free-constructors}, |
323 @{typ 'b} is live. |
323 @{typ 'b} is live. |
324 |
324 |
325 Type constructors must be registered as BNFs to have live arguments. This is |
325 Type constructors must be registered as BNFs to have live arguments. This is |
326 done automatically for datatypes and codatatypes introduced by the |
326 done automatically for datatypes and codatatypes introduced by the |
327 @{command datatype} and @{command codatatype} commands. |
327 @{command datatype} and @{command codatatype} commands. |
328 Section~\ref{sec:introducing-bounded-natural-functors} explains how to |
328 Section~\ref{sec:registering-bounded-natural-functors} explains how to |
329 register arbitrary type constructors as BNFs. |
329 register arbitrary type constructors as BNFs. |
330 |
330 |
331 Here is another example that fails: |
331 Here is another example that fails: |
332 *} |
332 *} |
333 |
333 |
1135 |
1135 |
1136 In the other direction, there is currently no way to register old-style |
1136 In the other direction, there is currently no way to register old-style |
1137 datatypes as new-style datatypes. If the goal is to define new-style datatypes |
1137 datatypes as new-style datatypes. If the goal is to define new-style datatypes |
1138 with nested recursion through old-style datatypes, the old-style |
1138 with nested recursion through old-style datatypes, the old-style |
1139 datatypes can be registered as a BNF |
1139 datatypes can be registered as a BNF |
1140 (Section~\ref{sec:introducing-bounded-natural-functors}). If the goal is |
1140 (Section~\ref{sec:registering-bounded-natural-functors}). If the goal is |
1141 to derive discriminators and selectors, this can be achieved using |
1141 to derive discriminators and selectors, this can be achieved using |
1142 @{command free_constructors} |
1142 @{command free_constructors} |
1143 (Section~\ref{sec:deriving-destructors-and-theorems-for-free-constructors}). |
1143 (Section~\ref{sec:deriving-destructors-and-theorems-for-free-constructors}). |
1144 *} |
1144 *} |
1145 |
1145 |
2625 partial_function to the rescue |
2625 partial_function to the rescue |
2626 *} |
2626 *} |
2627 *) |
2627 *) |
2628 |
2628 |
2629 |
2629 |
2630 section {* Introducing Bounded Natural Functors |
2630 section {* Registering Bounded Natural Functors |
2631 \label{sec:introducing-bounded-natural-functors} *} |
2631 \label{sec:registering-bounded-natural-functors} *} |
2632 |
2632 |
2633 text {* |
2633 text {* |
2634 The (co)datatype package can be set up to allow nested recursion through |
2634 The (co)datatype package can be set up to allow nested recursion through |
2635 arbitrary type constructors, as long as they adhere to the BNF requirements |
2635 arbitrary type constructors, as long as they adhere to the BNF requirements |
2636 and are registered as BNFs. It is also possible to declare a BNF abstractly |
2636 and are registered as BNFs. It is also possible to declare a BNF abstractly |