author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Thu, 14 Jan 2010 15:25:24 +0100 | |
changeset 875 | cc951743c5e2 |
parent 874 | ab8a58973861 |
child 892 | 693aecde755d |
permissions | -rw-r--r-- |
872
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory Terms |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
imports Nominal "../QuotMain" "../QuotList" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
atom_decl name |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
|
874
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
7 |
(*** lets with binding patterns ***) |
872
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
datatype trm1 = |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
Vr1 "name" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
| Ap1 "trm1" "trm1" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
| Lm1 "name" "trm1" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
| Lt1 "bp" "trm1" "trm1" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
and bp = |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
BUnit |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
| BVr "name" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
| BPr "bp" "bp" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
|
874
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
18 |
(* to be given by the user *) |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
19 |
fun |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
20 |
bv1 |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
21 |
where |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
22 |
"bv1 (BUnit) = {}" |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
23 |
| "bv1 (BVr x) = {x}" |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
24 |
| "bv1 (BPr bp1 bp2) = (bv1 bp1) \<union> (bv1 bp1)" |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
25 |
|
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
26 |
(*** lets with single assignments ***) |
872
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
datatype trm2 = |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
28 |
Vr2 "name" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
29 |
| Ap2 "trm2" "trm2" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
30 |
| Lm2 "name" "trm2" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
| Lt2 "assign" "trm2" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
32 |
and assign = |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
33 |
As "name" "trm2" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
34 |
|
874
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
35 |
(* to be given by the user *) |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
36 |
fun |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
37 |
bv2 |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
38 |
where |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
39 |
"bv2 (As x t) = {x}" |
872
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
|
874
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
41 |
|
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
42 |
(*** lets with many assignments ***) |
872
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
43 |
datatype trm3 = |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
Vr3 "name" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
| Ap3 "trm3" "trm3" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
| Lm3 "name" "trm3" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
| Lt3 "assign" "trm3" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
and assigns = |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
ANil |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
50 |
| ACons "name" "trm3" "assigns" |
2605ea41bbdd
added 3 calculi with interesting binding structure
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
51 |
|
874
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
52 |
(* to be given by the user *) |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
53 |
fun |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
54 |
bv3 |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
55 |
where |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
56 |
"bv3 ANil = {}" |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
57 |
| "bv3 (ACons x t as) = {x} \<union> (bv3 as)" |
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
58 |
|
ab8a58973861
added bound-variable functions to terms
Christian Urban <urbanc@in.tum.de>
parents:
872
diff
changeset
|
59 |
end |