author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Mon, 20 Jul 2015 11:21:59 +0100 | |
changeset 3242 | 4af8a92396ce |
parent 3240 | f80fa0d18d81 |
permissions | -rw-r--r-- |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory TypeVarsTest |
2454
9ffee4eb1ae1
renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
2440
diff
changeset
|
2 |
imports "../Nominal2" |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
3239
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
5 |
atom_decl var |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
6 |
|
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
7 |
ML {* trace := true *} |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
8 |
declare [[ML_print_depth = 1000]] |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
9 |
|
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
10 |
nominal_datatype exp = |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
11 |
Var var |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
12 |
| App exp var |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
13 |
| LetA as::assn body::exp binds "bn as" in "body" "as" |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
14 |
| Lam x::var body::exp binds x in body |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
15 |
and assn = |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
16 |
ANil | ACons var exp assn |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
17 |
binder |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
18 |
bn |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
19 |
where "bn ANil = []" | "bn (ACons x t as) = (atom x) # (bn as)" |
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
20 |
|
3240
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
21 |
(* NEEDS FIXING |
3239
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
22 |
nominal_datatype ('ann::fs) exp2 = |
3240
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
23 |
Var2 var |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
24 |
| App2 "'ann exp2" var |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
25 |
| LetA2 as::"'ann assn2" body::"'ann exp2" binds "bn2 as" in body as |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
26 |
| Lam2 x::var body::"'ann exp2" binds x in body |
3239
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
27 |
and ('ann::fs) assn2 = |
3240
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
28 |
ANil2 |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
29 |
| ACons2 var "'ann exp2" 'ann "'ann assn2" |
3239
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
30 |
binder |
3240
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
31 |
bn2 :: "('ann::fs) assn2 \<Rightarrow> atom list" |
3239
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
32 |
where |
3240
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
33 |
"bn2 ANil2 = []" |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
34 |
| "bn2 (ACons2 x a t as) = (atom x) # (bn2 as)" |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
35 |
*) |
3239
67370521c09c
updated for Isabelle 2015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3228
diff
changeset
|
36 |
|
2617
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
37 |
(* a nominal datatype with type variables and sorts *) |
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
38 |
|
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
39 |
|
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
40 |
(* the sort constraints need to be attached to the *) |
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
41 |
(* first occurence of the type variables on the *) |
2622 | 42 |
(* right-hand side *) |
2617
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
43 |
|
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
atom_decl name |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
|
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
class s1 |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
class s2 |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
|
2571
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2557
diff
changeset
|
49 |
instance nat :: s1 .. |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2557
diff
changeset
|
50 |
instance int :: s2 .. |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2557
diff
changeset
|
51 |
|
3091
578e0265b235
the default sort for type-variables in nominal specifications is fs; it is automatically addded
Christian Urban <urbanc@in.tum.de>
parents:
3065
diff
changeset
|
52 |
nominal_datatype ('a::s1, 'b::s2, 'c::at) lam = |
3240
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
53 |
Var3 "name" |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
54 |
| App3 "('a, 'b, 'c) lam" "('a, 'b, 'c) lam" |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
55 |
| Lam3 x::"name" l::"('a, 'b, 'c) lam" binds x in l |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
56 |
| Foo3 "'a" "'b" |
f80fa0d18d81
updated examples
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3239
diff
changeset
|
57 |
| Bar3 x::"'c" l::"('a, 'b, 'c) lam" binds x in l (* Bar binds a polymorphic atom *) |
2617
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
58 |
|
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
59 |
term Foo |
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
60 |
term Bar |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
|
3228
040519ec99e9
fixed bug with support and freshness lemmas not being simplified properly
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3091
diff
changeset
|
62 |
thm lam.supp lam.fresh |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
thm lam.distinct |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
64 |
thm lam.induct |
2617
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
65 |
thm lam.exhaust |
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
66 |
thm lam.strong_exhaust |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
67 |
thm lam.fv_defs |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |
thm lam.bn_defs |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
69 |
thm lam.perm_simps |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
70 |
thm lam.eq_iff |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
71 |
thm lam.fv_bn_eqvt |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
thm lam.size_eqvt |
2557
781fbc8c0591
fixed locally the problem with the function package; all tests work again
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
73 |
|
2730
eebc24b9cf39
added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents:
2622
diff
changeset
|
74 |
|
2888
eda5aeb056a6
fixed nasty bug with type variables in nominal_datatypes; this included to be careful with the output of the inductive and function package
Christian Urban <urbanc@in.tum.de>
parents:
2730
diff
changeset
|
75 |
nominal_datatype ('alpha, 'beta, 'gamma) psi = |
2730
eebc24b9cf39
added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents:
2622
diff
changeset
|
76 |
PsiNil |
3091
578e0265b235
the default sort for type-variables in nominal specifications is fs; it is automatically addded
Christian Urban <urbanc@in.tum.de>
parents:
3065
diff
changeset
|
77 |
| Output "'alpha" "'alpha" "('alpha, 'beta, 'gamma) psi" |
2730
eebc24b9cf39
added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents:
2622
diff
changeset
|
78 |
|
3228
040519ec99e9
fixed bug with support and freshness lemmas not being simplified properly
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
3091
diff
changeset
|
79 |
thm psi.supp psi.fresh |
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
80 |
|
3029 | 81 |
nominal_datatype 'a foo = |
3091
578e0265b235
the default sort for type-variables in nominal specifications is fs; it is automatically addded
Christian Urban <urbanc@in.tum.de>
parents:
3065
diff
changeset
|
82 |
Node x::"name" f::"'a foo" binds x in f |
3029 | 83 |
| Leaf "'a" |
84 |
||
85 |
term "Leaf" |
|
86 |
||
87 |
||
88 |
||
2436
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
89 |
end |
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
90 |
|
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
91 |
|
3885dc2669f9
cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
92 |