author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Wed, 03 Mar 2010 14:22:58 +0100 | |
changeset 1331 | 0f329449e304 |
parent 1330 | 88d2d4beb9e0 |
child 1332 | 103eb390f1b1 |
child 1335 | c3dfd4193b42 |
permissions | -rw-r--r-- |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory Test |
1261
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
parents:
1258
diff
changeset
|
2 |
imports "Parser" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
5 |
text {* weirdo example from Peter Sewell's bestiary *} |
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
6 |
|
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
7 |
nominal_datatype weird = |
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
8 |
WBind x::"name" y::"name" p1::"weird" p2::"weird" p3::"weird" |
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
9 |
bind x in p1, bind x in p2, bind y in p2, bind y in p3 |
1321
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
10 |
| WV "name" |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
11 |
| WP "weird" "weird" |
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
12 |
|
1321
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
13 |
thm permute_weird_raw.simps[no_vars] |
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
14 |
thm alpha_weird_raw.intros[no_vars] |
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
15 |
thm fv_weird_raw.simps[no_vars] |
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
16 |
|
1321
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
17 |
(* |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
18 |
abbreviation "WBind \<equiv> WBind_raw" |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
19 |
abbreviation "WP \<equiv> WP_raw" |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
20 |
abbreviation "WV \<equiv> WV_raw" |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
21 |
|
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
22 |
lemma test: |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
23 |
assumes a: "distinct [x, y, z]" |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
24 |
shows "alpha_weird (WBind x y (WP (WV x) (WV z)) (WP (WV x) (WV y)) (WP (WV z) (WV y))) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
25 |
(WBind y x (WP (WV y) (WV z)) (WP (WV y) (WV x)) (WP (WV z) (WV x)))" |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
26 |
apply(rule_tac alpha_weird.intros) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
27 |
unfolding alpha_gen |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
28 |
using a |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
29 |
apply(simp) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
30 |
apply(rule_tac x="(x \<leftrightarrow> y)" in exI) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
31 |
apply(rule_tac x="(x \<leftrightarrow> y)" in exI) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
32 |
apply(simp add: fresh_star_def) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
33 |
apply(simp add: flip_def) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
34 |
apply(auto) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
35 |
prefer 2 |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
36 |
apply(rule alpha_weird.intros) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
37 |
apply(simp add: alpha_weird.intros(2)) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
38 |
prefer 2 |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
39 |
apply(rule alpha_weird.intros) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
40 |
apply(simp add: alpha_weird.intros(2)) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
41 |
apply(simp) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
42 |
apply(rule alpha_weird.intros) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
43 |
apply(simp) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
44 |
apply(simp add: alpha_gen) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
45 |
using a |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
46 |
apply(simp) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
47 |
*) |
bfd9af005e23
preliinary test about alpha-weirdo
Christian Urban <urbanc@in.tum.de>
parents:
1320
diff
changeset
|
48 |
|
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
text {* example 1 *} |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
50 |
|
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1309
diff
changeset
|
51 |
(* ML {* set show_hyps *} *) |
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1309
diff
changeset
|
52 |
|
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
nominal_datatype lam = |
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
VAR "name" |
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
| APP "lam" "lam" |
1287
8557af71724e
slight simplification of the raw-decl generation
Christian Urban <urbanc@in.tum.de>
parents:
1285
diff
changeset
|
56 |
| LET bp::"bp" t::"lam" bind "bi bp" in t |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
and bp = |
1287
8557af71724e
slight simplification of the raw-decl generation
Christian Urban <urbanc@in.tum.de>
parents:
1285
diff
changeset
|
58 |
BP "name" "lam" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
59 |
binder |
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1290
diff
changeset
|
60 |
bi::"bp \<Rightarrow> atom set" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
where |
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1290
diff
changeset
|
62 |
"bi (BP x t) = {atom x}" |
1228
c179ad9d2446
declarartion of the raw datatype already works; raw binding functions throw an exception about mutual recursive types
Christian Urban <urbanc@in.tum.de>
parents:
1223
diff
changeset
|
63 |
|
c179ad9d2446
declarartion of the raw datatype already works; raw binding functions throw an exception about mutual recursive types
Christian Urban <urbanc@in.tum.de>
parents:
1223
diff
changeset
|
64 |
typ lam_raw |
c179ad9d2446
declarartion of the raw datatype already works; raw binding functions throw an exception about mutual recursive types
Christian Urban <urbanc@in.tum.de>
parents:
1223
diff
changeset
|
65 |
term VAR_raw |
1283
6a133abb7633
generated the "binding list" from the input; at the moment it is only printed out as tracing; does not yet include the "bind itself binders"
Christian Urban <urbanc@in.tum.de>
parents:
1272
diff
changeset
|
66 |
term APP_raw |
6a133abb7633
generated the "binding list" from the input; at the moment it is only printed out as tracing; does not yet include the "bind itself binders"
Christian Urban <urbanc@in.tum.de>
parents:
1272
diff
changeset
|
67 |
term LET_raw |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
68 |
term Test.BP_raw |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
69 |
thm bi_raw.simps |
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1290
diff
changeset
|
70 |
thm permute_lam_raw_permute_bp_raw.simps |
1319
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
71 |
thm alpha_lam_raw_alpha_bp_raw.intros[no_vars] |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
72 |
thm fv_lam_raw_fv_bp_raw.simps[no_vars] |
1309 | 73 |
thm eqvts |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
74 |
|
961
0f88e04eb486
Variable takes a 'name'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
954
diff
changeset
|
75 |
print_theorems |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
76 |
|
1261
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
parents:
1258
diff
changeset
|
77 |
text {* example 2 *} |
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
parents:
1258
diff
changeset
|
78 |
|
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
79 |
nominal_datatype trm' = |
961
0f88e04eb486
Variable takes a 'name'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
954
diff
changeset
|
80 |
Var "name" |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
81 |
| App "trm'" "trm'" |
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
82 |
| Lam x::"name" t::"trm'" bind x in t |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
83 |
| Let p::"pat'" "trm'" t::"trm'" bind "f p" in t |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
84 |
and pat' = |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
85 |
PN |
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
86 |
| PS "name" |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
87 |
| PD "name" "name" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
binder |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
89 |
f::"pat' \<Rightarrow> atom set" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
90 |
where |
978
b44592adf235
Improper interface for datatype and function packages and proper interface lateron.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
973
diff
changeset
|
91 |
"f PN = {}" |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
92 |
| "f (PS x) = {atom x}" |
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
93 |
| "f (PD x y) = {atom x, atom y}" |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
94 |
|
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
95 |
|
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
96 |
thm alpha_trm'_raw_alpha_pat'_raw.intros[no_vars] |
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
parents:
1319
diff
changeset
|
97 |
thm fv_trm'_raw_fv_pat'_raw.simps[no_vars] |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
98 |
thm f_raw.simps |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
99 |
|
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
100 |
nominal_datatype trm0 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
101 |
Var0 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
102 |
| App0 "trm0" "trm0" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
103 |
| Lam0 x::"name" t::"trm0" bind x in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
104 |
| Let0 p::"pat0" "trm0" t::"trm0" bind "f0 p" in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
105 |
and pat0 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
106 |
PN0 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
107 |
| PS0 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
108 |
| PD0 "pat0" "pat0" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
109 |
binder |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
110 |
f0::"pat0 \<Rightarrow> atom set" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
111 |
where |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
112 |
"f0 PN0 = {}" |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
113 |
| "f0 (PS0 x) = {atom x}" |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
114 |
| "f0 (PD0 p1 p2) = (f0 p1) \<union> (f0 p2)" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
115 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
116 |
thm f0_raw.simps |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
117 |
|
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
118 |
text {* example type schemes *} |
1285
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
119 |
|
1304
dc65319809cc
Change type schemes to name set.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1302
diff
changeset
|
120 |
(* does not work yet |
1302
d3101a5b9c4d
Length fix for nested recursions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1299
diff
changeset
|
121 |
nominal_datatype t = |
d3101a5b9c4d
Length fix for nested recursions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1299
diff
changeset
|
122 |
Var "name" |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
123 |
| Fun "t" "t" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
124 |
|
1302
d3101a5b9c4d
Length fix for nested recursions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1299
diff
changeset
|
125 |
nominal_datatype tyS = |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
126 |
All xs::"name list" ty::"t_raw" bind xs in ty |
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
127 |
*) |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
128 |
|
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1309
diff
changeset
|
129 |
|
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1309
diff
changeset
|
130 |
(* alpha_eqvt fails... |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
131 |
nominal_datatype t = |
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
132 |
Var "name" |
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
133 |
| Fun "t" "t" |
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
134 |
and tyS = |
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1309
diff
changeset
|
135 |
All xs::"name set" ty::"t" bind xs in ty *) |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
136 |
|
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
137 |
(* example 1 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
138 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
139 |
nominal_datatype trm1 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
140 |
Vr1 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
141 |
| Ap1 "trm1" "trm1" |
1290
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
142 |
| Lm1 x::"name" t::"trm1" bind x in t |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
143 |
| Lt1 p::"bp1" "trm1" t::"trm1" bind "bv1 p" in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
144 |
and bp1 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
145 |
BUnit1 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
146 |
| BV1 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
147 |
| BP1 "bp1" "bp1" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
148 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
149 |
bv1 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
150 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
151 |
"bv1 (BUnit1) = {}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
152 |
| "bv1 (BV1 x) = {atom x}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
153 |
| "bv1 (BP1 bp1 bp2) = (bv1 bp1) \<union> (bv1 bp2)" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
154 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
155 |
thm bv1_raw.simps |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
156 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
157 |
(* example 2 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
158 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
159 |
nominal_datatype trm2 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
160 |
Vr2 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
161 |
| Ap2 "trm2" "trm2" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
162 |
| Lm2 x::"name" t::"trm2" bind x in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
163 |
| Lt2 r::"rassign" t::"trm2" bind "bv2 r" in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
164 |
and rassign = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
165 |
As "name" "trm2" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
166 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
167 |
bv2 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
168 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
169 |
"bv2 (As x t) = {atom x}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
170 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
171 |
(* example 3 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
172 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
173 |
nominal_datatype trm3 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
174 |
Vr3 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
175 |
| Ap3 "trm3" "trm3" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
176 |
| Lm3 x::"name" t::"trm3" bind x in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
177 |
| Lt3 r::"rassigns3" t::"trm3" bind "bv3 r" in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
178 |
and rassigns3 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
179 |
ANil |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
180 |
| ACons "name" "trm3" "rassigns3" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
181 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
182 |
bv3 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
183 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
184 |
"bv3 ANil = {}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
185 |
| "bv3 (ACons x t as) = {atom x} \<union> (bv3 as)" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
186 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
187 |
(* example 4 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
188 |
|
1326 | 189 |
(* fv_eqvt does not work, we need to repaire defined permute functions |
190 |
defined fv and defined alpha... *) |
|
191 |
(*nominal_datatype trm4 = |
|
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
192 |
Vr4 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
193 |
| Ap4 "trm4" "trm4 list" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
194 |
| Lm4 x::"name" t::"trm4" bind x in t |
1302
d3101a5b9c4d
Length fix for nested recursions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1299
diff
changeset
|
195 |
|
1319
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
196 |
thm alpha_trm4_raw_alpha_trm4_raw_list.intros[no_vars] |
1326 | 197 |
thm fv_trm4_raw_fv_trm4_raw_list.simps[no_vars]*) |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
198 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
199 |
(* example 5 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
200 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
201 |
nominal_datatype trm5 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
202 |
Vr5 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
203 |
| Ap5 "trm5" "trm5" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
204 |
| Lt5 l::"lts" t::"trm5" bind "bv5 l" in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
205 |
and lts = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
206 |
Lnil |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
207 |
| Lcons "name" "trm5" "lts" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
208 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
209 |
bv5 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
210 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
211 |
"bv5 Lnil = {}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
212 |
| "bv5 (Lcons n t ltl) = {atom n} \<union> (bv5 ltl)" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
213 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
214 |
(* example 6 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
215 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
216 |
nominal_datatype trm6 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
217 |
Vr6 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
218 |
| Lm6 x::"name" t::"trm6" bind x in t |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
219 |
| Lt6 left::"trm6" right::"trm6" bind "bv6 left" in right |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
220 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
221 |
bv6 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
222 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
223 |
"bv6 (Vr6 n) = {}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
224 |
| "bv6 (Lm6 n t) = {atom n} \<union> bv6 t" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
225 |
| "bv6 (Lt6 l r) = bv6 l \<union> bv6 r" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
226 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
227 |
(* example 7 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
228 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
229 |
nominal_datatype trm7 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
230 |
Vr7 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
231 |
| Lm7 l::"name" r::"trm7" bind l in r |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
232 |
| Lt7 l::"trm7" r::"trm7" bind "bv7 l" in r |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
233 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
234 |
bv7 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
235 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
236 |
"bv7 (Vr7 n) = {atom n}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
237 |
| "bv7 (Lm7 n t) = bv7 t - {atom n}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
238 |
| "bv7 (Lt7 l r) = bv7 l \<union> bv7 r" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
239 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
240 |
(* example 8 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
241 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
242 |
nominal_datatype foo8 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
243 |
Foo0 "name" |
1283
6a133abb7633
generated the "binding list" from the input; at the moment it is only printed out as tracing; does not yet include the "bind itself binders"
Christian Urban <urbanc@in.tum.de>
parents:
1272
diff
changeset
|
244 |
| Foo1 b::"bar8" f::"foo8" bind "bv8 b" in f --"check fo error if this is called foo" |
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
245 |
and bar8 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
246 |
Bar0 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
247 |
| Bar1 "name" s::"name" b::"bar8" bind s in b |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
248 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
249 |
bv8 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
250 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
251 |
"bv8 (Bar0 x) = {}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
252 |
| "bv8 (Bar1 v x b) = {atom v}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
253 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
254 |
(* example 9 from Terms.thy *) |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
255 |
|
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
256 |
nominal_datatype lam9 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
257 |
Var9 "name" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
258 |
| Lam9 n::"name" l::"lam9" bind n in l |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
259 |
and bla9 = |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
260 |
Bla9 f::"lam9" s::"lam9" bind "bv9 f" in s |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
261 |
binder |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
262 |
bv9 |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
263 |
where |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
264 |
"bv9 (Var9 x) = {}" |
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents:
1232
diff
changeset
|
265 |
| "bv9 (Lam9 x b) = {atom x}" |
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
266 |
|
1285
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
267 |
(* example from my PHD *) |
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
268 |
|
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
269 |
atom_decl coname |
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
270 |
|
1285
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
271 |
nominal_datatype phd = |
1290
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
272 |
Ax "name" "coname" |
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
273 |
| Cut n::"coname" t1::"phd" c::"coname" t2::"phd" bind n in t1, bind c in t2 |
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
274 |
| AndR c1::"coname" t1::"phd" c2::"coname" t2::"phd" "coname" bind c1 in t1, bind c2 in t2 |
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
275 |
| AndL1 n::"name" t::"phd" "name" bind n in t |
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
276 |
| AndL2 n::"name" t::"phd" "name" bind n in t |
a7e7ffb7f362
modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents:
1287
diff
changeset
|
277 |
| ImpL c::"coname" t1::"phd" n::"name" t2::"phd" "name" bind c in t1, bind n in t2 |
1319
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
278 |
| ImpR c::"coname" n::"name" t::"phd" "coname" bind n in t, bind c in t |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
279 |
|
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
280 |
(* PROBLEM?: why does it create for the Cut AndR ImpL cases |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
281 |
two permutations, but only one is used *) |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
282 |
thm alpha_phd_raw.intros[no_vars] |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
283 |
thm fv_phd_raw.simps[no_vars] |
1285
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
284 |
|
e3ac56d3b7af
added example from my phd
Christian Urban <urbanc@in.tum.de>
parents:
1284
diff
changeset
|
285 |
(* example form Leroy 96 about modules; OTT *) |
1284 | 286 |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
287 |
nominal_datatype mexp = |
1296 | 288 |
Acc "path" |
289 |
| Stru "body" |
|
290 |
| Funct x::"name" "sexp" m::"mexp" bind x in m |
|
291 |
| FApp "mexp" "path" |
|
292 |
| Ascr "mexp" "sexp" |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
293 |
and body = |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
294 |
Empty |
1296 | 295 |
| Seq c::defn d::"body" bind "cbinders c" in d |
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
296 |
and defn = |
1296 | 297 |
Type "name" "tyty" |
298 |
| Dty "name" |
|
299 |
| DStru "name" "mexp" |
|
300 |
| Val "name" "trmtrm" |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
301 |
and sexp = |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
302 |
Sig sbody |
1296 | 303 |
| SFunc "name" "sexp" "sexp" |
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
304 |
and sbody = |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
305 |
SEmpty |
1296 | 306 |
| SSeq C::spec D::sbody bind "Cbinders C" in D |
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
307 |
and spec = |
1296 | 308 |
Type1 "name" |
309 |
| Type2 "name" "tyty" |
|
310 |
| SStru "name" "sexp" |
|
311 |
| SVal "name" "tyty" |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
312 |
and tyty = |
1296 | 313 |
Tyref1 "name" |
314 |
| Tyref2 "path" "tyty" |
|
315 |
| Fun "tyty" "tyty" |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
316 |
and path = |
1296 | 317 |
Sref1 "name" |
318 |
| Sref2 "path" "name" |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
319 |
and trmtrm = |
1296 | 320 |
Tref1 "name" |
321 |
| Tref2 "path" "name" |
|
322 |
| Lam v::"name" "tyty" M::"trmtrm" bind v in M |
|
323 |
| App "trmtrm" "trmtrm" |
|
324 |
| Let "body" "trmtrm" |
|
1272
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
325 |
binder |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
326 |
cbinders :: "defn \<Rightarrow> atom set" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
327 |
and Cbinders :: "spec \<Rightarrow> atom set" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
328 |
where |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
329 |
"cbinders (Type t T) = {atom t}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
330 |
| "cbinders (Dty t) = {atom t}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
331 |
| "cbinders (DStru x s) = {atom x}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
332 |
| "cbinders (Val v M) = {atom v}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
333 |
| "Cbinders (Type1 t) = {atom t}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
334 |
| "Cbinders (Type2 t T) = {atom t}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
335 |
| "Cbinders (SStru x S) = {atom x}" |
6d140b2c751f
added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents:
1265
diff
changeset
|
336 |
| "Cbinders (SVal v T) = {atom v}" |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
337 |
|
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
338 |
(* core haskell *) |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
339 |
|
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
340 |
atom_decl var |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
341 |
atom_decl tvar |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
342 |
atom_decl co |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
343 |
|
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
344 |
datatype sort = |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
345 |
TY tvar |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
346 |
| CO co |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
347 |
|
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
348 |
nominal_datatype kind = |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
349 |
KStar |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
350 |
| KFun kind kind |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
351 |
| KEq kind kind |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
352 |
|
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
353 |
(* there are types, coercion types and regular types *) |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
354 |
(* |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
355 |
nominal_datatype ty = |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
356 |
TVar tvar |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
357 |
| TFun string "ty list" |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
358 |
| TAll tvar kind_raw ty --"some binding" |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
359 |
| TSym ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
360 |
| TCir ty ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
361 |
| TApp ty ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
362 |
| TLeft ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
363 |
| TRight ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
364 |
| TEq ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
365 |
| TRightc ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
366 |
| TLeftc ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
367 |
| TCoe ty ty |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
368 |
*) |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
369 |
typedecl ty --"hack since ty is not yet defined" |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
370 |
|
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
371 |
abbreviation |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
372 |
"atoms A \<equiv> atom ` A" |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
373 |
|
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
374 |
(* does not work yet |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
375 |
nominal_datatype trm = |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
376 |
Var var |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
377 |
| LAM tv::tvar kind_raw t::trm bind tv in t |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
378 |
| APP trm ty |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
379 |
| Lam v::var ty t::trm bind v in t |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
380 |
| App trm trm |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
381 |
| Let x::var ty trm t::trm bind x in t |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
382 |
| Case trm "assoc list" |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
383 |
| Cast trm ty --"ty is supposed to be a coercion type only" |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
384 |
and assoc = |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
385 |
A p::pat t::trm bind "bv p" in t |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
386 |
and pat = |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
387 |
K string "(tvar \<times> kind_raw) list" "(var \<times> ty) list" |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
388 |
binder |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
389 |
bv :: "pat \<Rightarrow> atom set" |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
390 |
where |
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
391 |
"bv (K s ts vs) = (atoms (set (map fst ts))) \<union> (atoms (set (map fst vs)))" |
1299
cbcd4997dac5
most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents:
1298
diff
changeset
|
392 |
*) |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
393 |
|
1312
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
394 |
(*thm bv_raw.simps*) |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
395 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
396 |
(* example 3 from Peter Sewell's bestiary *) |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
397 |
nominal_datatype exp = |
1319
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
398 |
Var "name" |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
399 |
| App "exp" "exp" |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
400 |
| Lam x::"name" e::"exp" bind x in e |
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
401 |
| Let x::"name" p::"pat" e1::"exp" e2::"exp" bind x in e2, bind "bp p" in e1 |
1312
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
402 |
and pat = |
1319
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
403 |
PVar "name" |
1312
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
404 |
| PUnit |
1319
d793ce9cd06f
potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents:
1313
diff
changeset
|
405 |
| PPair "pat" "pat" |
1312
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
406 |
binder |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
407 |
bp :: "pat \<Rightarrow> atom set" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
408 |
where |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
409 |
"bp (PVar x) = {atom x}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
410 |
| "bp (PUnit) = {}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
411 |
| "bp (PPair p1 p2) = bp p1 \<union> bp p2" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
412 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
413 |
(* example 6 from Peter Sewell's bestiary *) |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
414 |
nominal_datatype exp6 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
415 |
EVar name |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
416 |
| EPair exp6 exp6 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
417 |
| ELetRec x::name p::pat6 e1::exp6 e2::exp6 bind x in e1, bind x in e2, bind "bp6 p" in e1 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
418 |
and pat6 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
419 |
PVar name |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
420 |
| PUnit |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
421 |
| PPair pat6 pat6 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
422 |
binder |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
423 |
bp6 :: "pat6 \<Rightarrow> atom set" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
424 |
where |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
425 |
"bp6 (PVar x) = {atom x}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
426 |
| "bp6 (PUnit) = {}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
427 |
| "bp6 (PPair p1 p2) = bp6 p1 \<union> bp6 p2" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
428 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
429 |
(* example 7 from Peter Sewell's bestiary *) |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
430 |
nominal_datatype exp7 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
431 |
EVar name |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
432 |
| EUnit |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
433 |
| EPair exp7 exp7 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
434 |
| ELetRec l::lrbs e::exp7 bind "b7s l" in e, bind "b7s l" in l |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
435 |
and lrb = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
436 |
Assign name exp7 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
437 |
and lrbs = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
438 |
Single lrb |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
439 |
| More lrb lrbs |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
440 |
binder |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
441 |
b7 :: "lrb \<Rightarrow> atom set" and |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
442 |
b7s :: "lrbs \<Rightarrow> atom set" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
443 |
where |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
444 |
"b7 (Assign x e) = {atom x}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
445 |
| "b7s (Single a) = b7 a" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
446 |
| "b7s (More a as) = (b7 a) \<union> (b7s as)" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
447 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
448 |
(* example 8 from Peter Sewell's bestiary *) |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
449 |
nominal_datatype exp8 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
450 |
EVar name |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
451 |
| EUnit |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
452 |
| EPair exp8 exp8 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
453 |
| ELetRec l::lrbs8 e::exp8 bind "b_lrbs8 l" in e, bind "b_lrbs8 l" in l |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
454 |
and fnclause = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
455 |
K x::name p::pat8 e::exp8 bind "b_pat p" in e |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
456 |
and fnclauses = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
457 |
S fnclause |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
458 |
| ORs fnclause fnclauses |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
459 |
and lrb8 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
460 |
Clause fnclauses |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
461 |
and lrbs8 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
462 |
Single lrb8 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
463 |
| More lrb8 lrbs8 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
464 |
and pat8 = |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
465 |
PVar name |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
466 |
| PUnit |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
467 |
| PPair pat8 pat8 |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
468 |
binder |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
469 |
b_lrbs8 :: "lrbs8 \<Rightarrow> atom set" and |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
470 |
b_pat :: "pat8 \<Rightarrow> atom set" and |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
471 |
b_fnclauses :: "fnclauses \<Rightarrow> atom set" and |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
472 |
b_fnclause :: "fnclause \<Rightarrow> atom set" and |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
473 |
b_lrb8 :: "lrb8 \<Rightarrow> atom set" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
474 |
where |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
475 |
"b_lrbs8 (Single l) = b_lrb8 l" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
476 |
| "b_lrbs8 (More l ls) = b_lrb8 l \<union> b_lrbs8 ls" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
477 |
| "b_pat (PVar x) = {atom x}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
478 |
| "b_pat (PUnit) = {}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
479 |
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
480 |
| "b_fnclauses (S fc) = (b_fnclause fc)" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
481 |
| "b_fnclauses (ORs fc fcs) = (b_fnclause fc) \<union> (b_fnclauses fcs)" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
482 |
| "b_lrb8 (Clause fcs) = (b_fnclauses fcs)" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
483 |
| "b_fnclause (K x pat exp8) = {atom x}" |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
484 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
485 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
486 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
487 |
|
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
488 |
(* example 9 from Peter Sewell's bestiary *) |
b0eae8c93314
added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents:
1304
diff
changeset
|
489 |
(* run out of steam at the moment *) |
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents:
1261
diff
changeset
|
490 |
|
961
0f88e04eb486
Variable takes a 'name'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
954
diff
changeset
|
491 |
end |
1223
160343d86a6f
"raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
parents:
1194
diff
changeset
|
492 |
|
160343d86a6f
"raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
parents:
1194
diff
changeset
|
493 |
|
1228
c179ad9d2446
declarartion of the raw datatype already works; raw binding functions throw an exception about mutual recursive types
Christian Urban <urbanc@in.tum.de>
parents:
1223
diff
changeset
|
494 |