2083
|
1 |
theory NoneExamples
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
2 |
imports "../NewParser"
|
1589
|
3 |
begin
|
|
4 |
|
|
5 |
atom_decl name
|
|
6 |
|
2436
|
7 |
|
|
8 |
text {*
|
|
9 |
"Weirdo" example from Peter Sewell's bestiary.
|
|
10 |
|
|
11 |
This example is not covered by our binding
|
|
12 |
specification.
|
|
13 |
|
|
14 |
*}
|
|
15 |
|
|
16 |
nominal_datatype weird =
|
|
17 |
Foo_var "name"
|
|
18 |
| Foo_pair "weird" "weird"
|
|
19 |
| Foo x::"name" y::"name" p1::"weird" p2::"weird" p3::"weird"
|
|
20 |
bind x in p1 p2,
|
|
21 |
bind y in p2 p3
|
|
22 |
|
|
23 |
(* e1 occurs in two bodies *)
|
|
24 |
|
|
25 |
nominal_datatype exp =
|
|
26 |
Var name
|
|
27 |
| Pair exp exp
|
|
28 |
| LetRec x::name p::pat e1::exp e2::exp bind x in e1 e2, bind "bp p" in e1
|
|
29 |
and pat =
|
|
30 |
PVar name
|
|
31 |
| PUnit
|
|
32 |
| PPair pat pat
|
|
33 |
binder
|
|
34 |
bp :: "pat \<Rightarrow> atom list"
|
|
35 |
where
|
|
36 |
"bp (PVar x) = [atom x]"
|
|
37 |
| "bp (PUnit) = []"
|
|
38 |
| "bp (PPair p1 p2) = bp p1 @ bp p2"
|
|
39 |
|
|
40 |
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
41 |
(* this example binds bound names and
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
42 |
so is not respectful *)
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
43 |
(*
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
44 |
nominal_datatype trm =
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
45 |
Vr "name"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
46 |
| Lm x::"name" t::"trm" bind x in t
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
47 |
| Lt left::"trm" right::"trm" bind "bv left" in right
|
1589
|
48 |
binder
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
49 |
bv
|
1589
|
50 |
where
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
51 |
"bv (Vr n) = {}"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
52 |
| "bv (Lm n t) = {atom n} \<union> bv t"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
53 |
| "bv (Lt l r) = bv l \<union> bv r"
|
1589
|
54 |
*)
|
|
55 |
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
56 |
(* this example uses "-" in the binding function;
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
57 |
at the moment this is unsupported *)
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
58 |
(*
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
59 |
nominal_datatype trm' =
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
60 |
Vr' "name"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
61 |
| Lm' l::"name" r::"trm'" bind l in r
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
62 |
| Lt' l::"trm'" r::"trm'" bind "bv' l" in r
|
1589
|
63 |
binder
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
64 |
bv'
|
1589
|
65 |
where
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
66 |
"bv' (Vr' n) = {atom n}"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
67 |
| "bv' (Lm' n t) = bv' t - {atom n}"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
68 |
| "bv' (Lt' l r) = bv' l \<union> bv' r"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
69 |
*)
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
70 |
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
71 |
(* this example again binds bound names *)
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
72 |
(*
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
73 |
nominal_datatype trm'' =
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
74 |
Va'' "name"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
75 |
| Lm'' n::"name" l::"trm''" bind n in l
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
76 |
and bla'' =
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
77 |
Bla'' f::"trm''" s::"trm''" bind "bv'' f" in s
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
78 |
binder
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
79 |
bv''
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
80 |
where
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
81 |
"bv'' (Vm'' x) = {}"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
82 |
| "bv'' (Lm'' x b) = {atom x}"
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
83 |
*)
|
1589
|
84 |
|
|
85 |
end
|
|
86 |
|
|
87 |
|
|
88 |
|