5851
|
1 |
Term = Main +
|
9255
|
2 |
datatype
|
|
3 |
'a aexp = IF ('a bexp) ('a aexp) ('a aexp)
|
|
4 |
| Sum ('a aexp list)
|
|
5 |
| Diff ('a aexp) ('a aexp)
|
|
6 |
| Var 'a
|
|
7 |
| Num nat
|
|
8 |
and 'a bexp = Less ('a aexp) ('a aexp)
|
|
9 |
| And ('a bexp) ('a bexp)
|
|
10 |
| Neg ('a bexp)
|
5851
|
11 |
datatype ('a,'b)term = Var 'a | App 'b ((('a,'b)term)list)
|
|
12 |
consts
|
|
13 |
subst :: ('a => ('a,'b)term) => ('a,'b)term => ('a,'b)term
|
|
14 |
substs :: ('a => ('a,'b)term) => ('a,'b)term list => ('a,'b)term list
|
|
15 |
primrec
|
|
16 |
"subst s (Var x) = s x"
|
|
17 |
"subst s (App f ts) = App f (substs s ts)"
|
|
18 |
"substs s [] = []"
|
|
19 |
"substs s (t # ts) = subst s t # substs s ts"
|
|
20 |
end
|