| 1 |
|
| 2 |
January 25. 1991 |
| 3 |
Defining mutually recursive types in HOL |
| 4 |
======================================== |
| 5 |
|
| 6 |
As a minor project towards our masters degree, we have implemented |
| 7 |
a facility for automatically defining mutually recursive types in |
| 8 |
HOL. Superficially it is an extension of Tom Melhams 'define_type' |
| 9 |
package. |
| 10 |
|
| 11 |
The code works but is inefficient and neither guaranteed nor pretty. |
| 12 |
We have no current plans to improve, extend or maintain the system. |
| 13 |
With these restrictions in mind you're welcome to use it. |
| 14 |
|
| 15 |
The system consists of the following files: |
| 16 |
|
| 17 |
- Makefile : Standard UNIX makefile |
| 18 |
- microc.ml : 'Open term surgery' by David Shepherd, INMOS ltd |
| 19 |
- tools.ml : Miscellaneous useful functions |
| 20 |
- mut_thms.ml : Builds the theory 'mut_rec_tools' |
| 21 |
- mut_conv.ml : Miscellaneous conversions |
| 22 |
- mut_eu.ml : Fundamental tactic dealing with n simultaneous ?!'s |
| 23 |
- mut_def.ml : Defines 'define_mut_rec_type' |
| 24 |
|
| 25 |
|
| 26 |
How to use 'define_mut_rec_type' |
| 27 |
================================ |
| 28 |
|
| 29 |
1) Build the system by typing 'make' in your shell. Start HOL. |
| 30 |
2) Open a theory eg. |
| 31 |
|
| 32 |
new_theory `dummy`;; |
| 33 |
|
| 34 |
3) Add 'mut_rec_tools' as a parent. |
| 35 |
|
| 36 |
new_parent `mut_rec_tools`;; |
| 37 |
|
| 38 |
4) load the system. |
| 39 |
|
| 40 |
loadf `mut_def`;; |
| 41 |
|
| 42 |
5) Define your type, eg. |
| 43 |
|
| 44 |
define_mut_rec_type [`A = A1 | A2 B`; |
| 45 |
`B = B1 num | B2 A B`];; |
| 46 |
|
| 47 |
|
| 48 |
The syntax for defining types is as in Tom's package, generalised |
| 49 |
to a list of strings, each defining one type. |
| 50 |
|
| 51 |
Due to debugging, 'define_mut_rec_type' is a bit talkative, which |
| 52 |
doesn't hurt as it tells you that it's alive :-) |
| 53 |
|
| 54 |
The above example returns the following theorem: |
| 55 |
|
| 56 |
|- !f1 f2 f3 f4. |
| 57 |
?! x1 x2. |
| 58 |
(x1 A1 = f1) /\ |
| 59 |
(!z1. x1(A2 z1) = f2(x2 z1)z1) /\ |
| 60 |
(!z1. x2(B1 z1) = f3 z1) /\ |
| 61 |
(!z1 z2. x2(B2 z1 z2) = f4(x1 z1)(x2 z2)z1 z2) |
| 62 |
|
| 63 |
It took about five minutes on a SUN 3/280 (SunOS 4.0.3) running Franz Hol. |
| 64 |
We don't know for sure, but it might easily be exponential in both the |
| 65 |
number of types and the number of constructors. It IS quite memory hungry. |
| 66 |
|
| 67 |
Culprits |
| 68 |
======== |
| 69 |
|
| 70 |
Peter Strarup Jensen (No fixed E-mail address at the moment) |
| 71 |
Ann-Grete Tan ([email protected] until September 1991) |
| 72 |
Anders Pilegaard ([email protected] until September 1991) |
| 73 |
|
| 74 |
|
| 75 |
There is an internal report (DAIMI IR-99) available for a small fee from: |
| 76 |
|
| 77 |
The Computer Science Department |
| 78 |
Aarhus University |
| 79 |
Ny Munkegade 116 |
| 80 |
DK-8000 Aarhus C |
| 81 |
Denmark. |
| 82 |
|
| 83 |
|
| 84 |
PS |
| 85 |
== |
| 86 |
|
| 87 |
There is a second implementation of the same facility by |
| 88 |
|
| 89 |
Poul Christiansen ([email protected]) |
| 90 |
Hans Jakob Pedersen ([email protected]) |