next up previous contents index
Next: Adding Set Definitions Up: Definitions Previous: Adding Typed Non-Recursive

Adding Recursive Definitions

 

Nuprl 's object language contains terms for doing recursion over types such as lists and integers. These terms can be awkward to use, and we recommend instead that all recursive definitions are built using the Y combinator  . The ML function recdef  greatly simplifies constructing general recursive definitions using the Y-combinator. recdef  also takes care of introducing a well-formedness lemma for the definition. Its usage is:

The term tdef should have structure

where the term lhs has form

, the variables are a subset of the variables variables , and none of the variables are free in any of the antecedent propositions .

recdef allows you to create recursive definitions with both curried arguments supplied by application, and subterm arguments . The parameters are specified as in abstraction definitions.

The rhs term should include at least one instance of the head of the application in lhs. That is, a term of form

where the 's are the same as in lhs. All the free variables in lhs should be appropriately typed in the context . place is a library position.

On evaluation of recdef, four objects are added to the library.

As with def, so_apply abstraction should be used for the second-order variables in lhs and rhs. recdef takes care of converting these to second-order variables for the abstraction object.

The basic conversions associated with a recursive definition are RecUnfoldTopC and RecFoldTopC. If the definition has arguments provided by application, then additional conversions RecEtaExpC and RecEtaConC are defined to =-expand and -contract the definition. More information on these and related conversions can be found in Section gif .

An example invocation of recdef from the ML Top Loop is:

This creates the following library objects:



next up previous contents index
Next: Adding Set Definitions Up: Definitions Previous: Adding Typed Non-Recursive



Karla Consroe
Wed Oct 23 13:48:45 EDT 1996