2083
|
1 |
theory NoneExamples
|
2454
|
2 |
imports "../Nominal2"
|
1589
|
3 |
begin
|
|
4 |
|
2454
|
5 |
text {*
|
2622
|
6 |
These examples are not covered by our binding
|
2454
|
7 |
specification.
|
|
8 |
*}
|
|
9 |
|
1589
|
10 |
atom_decl name
|
|
11 |
|
2436
|
12 |
text {*
|
|
13 |
"Weirdo" example from Peter Sewell's bestiary.
|
|
14 |
|
2454
|
15 |
p2 occurs in two bodies
|
2436
|
16 |
*}
|
|
17 |
|
2454
|
18 |
(*
|
2436
|
19 |
nominal_datatype weird =
|
|
20 |
Foo_var "name"
|
|
21 |
| Foo_pair "weird" "weird"
|
|
22 |
| Foo x::"name" y::"name" p1::"weird" p2::"weird" p3::"weird"
|
|
23 |
bind x in p1 p2,
|
|
24 |
bind y in p2 p3
|
2454
|
25 |
*)
|
2436
|
26 |
|
2454
|
27 |
text {*
|
2622
|
28 |
This example binds bound names and therefore the
|
2454
|
29 |
fv-function is not respectful - the proof just fails.
|
|
30 |
*}
|
2436
|
31 |
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
32 |
(*
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
33 |
nominal_datatype trm =
|
2454
|
34 |
Var "name"
|
|
35 |
| Lam x::"name" t::"trm" bind x in t
|
|
36 |
| Let left::"trm" right::"trm" bind (set) "bv left" in right
|
1589
|
37 |
binder
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
38 |
bv
|
1589
|
39 |
where
|
2454
|
40 |
"bv (Var n) = {}"
|
|
41 |
| "bv (Lam n t) = {atom n} \<union> bv t"
|
|
42 |
| "bv (Let l r) = bv l \<union> bv r"
|
1589
|
43 |
*)
|
|
44 |
|
2454
|
45 |
text {*
|
2622
|
46 |
This example uses "-" in the binding function;
|
2454
|
47 |
at the moment this is unsupported
|
|
48 |
*}
|
|
49 |
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
50 |
(*
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
51 |
nominal_datatype trm' =
|
2454
|
52 |
Var "name"
|
|
53 |
| Lam l::"name" r::"trm'" bind l in r
|
|
54 |
| Let l::"trm'" r::"trm'" bind (set) "bv' l" in r
|
1589
|
55 |
binder
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
56 |
bv'
|
1589
|
57 |
where
|
2454
|
58 |
"bv' (Var n) = {atom n}"
|
|
59 |
| "bv' (Lam n t) = bv' t - {atom n}"
|
|
60 |
| "bv' (Let l r) = bv' l \<union> bv' r"
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
61 |
*)
|
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
62 |
|
2454
|
63 |
text {*
|
2622
|
64 |
Again this example binds bound names - so is not respectful
|
2454
|
65 |
*}
|
|
66 |
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
67 |
(*
|
2454
|
68 |
nominal_datatype trm =
|
|
69 |
Var "name"
|
|
70 |
| Lam n::"name" l::"trm" bind n in l
|
|
71 |
and bla =
|
|
72 |
Bla f::"trm" s::"trm" bind (set) "bv f" in s
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
73 |
binder
|
2454
|
74 |
bv :: "trm \<Rightarrow> atom set"
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
75 |
where
|
2622
|
76 |
"bv (Var x) = {}"
|
2454
|
77 |
| "bv (Lam x b) = {atom x}"
|
2082
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
78 |
*)
|
1589
|
79 |
|
2622
|
80 |
text {*
|
|
81 |
This example has mal-formed deep recursive binders.
|
|
82 |
|
|
83 |
- Bla1: recursive deep binder used twice
|
|
84 |
- Bla2: deep binder used recursively and non-recursively
|
|
85 |
- Bla3: x used in recursive deep binder and somewhere else
|
|
86 |
*}
|
|
87 |
|
|
88 |
(*
|
|
89 |
nominal_datatype trm =
|
|
90 |
Var "name"
|
|
91 |
and bla =
|
|
92 |
App "trm" "trm"
|
|
93 |
| Bla1 f::"trm" s1::"trm" s2::"trm" bind "bv f" in s1 f, bind "bv f" in s2 f
|
|
94 |
| Bla2 f::"trm" s1::"trm" s2::"trm" bind "bv f" in s1, bind "bv f" in s2 f
|
|
95 |
| Bla3 f::"trm" s1::"trm" s2::"trm" x::"name" y::"name" bind "bv f" x in s1 f, bind y x in s2
|
|
96 |
binder
|
|
97 |
bv :: "trm \<Rightarrow> atom list"
|
|
98 |
where
|
|
99 |
"bv (Var a) = [atom a]"
|
|
100 |
*)
|
|
101 |
|
|
102 |
|
1589
|
103 |
end
|
|
104 |
|
|
105 |
|
|
106 |
|