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