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
1335
+ − 2
imports "Parser" "../Attic/Prove"
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
1398
+ − 5
text {* example 1, equivalent to example 2 from Terms *}
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 6
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 7
nominal_datatype lam =
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 8
VAR "name"
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 9
| APP "lam" "lam"
1287
+ − 10
| LET bp::"bp" t::"lam" bind "bi bp" in t
1398
+ − 11
and bp =
+ − 12
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
+ − 13
binder
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 14
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
+ − 15
where
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 16
"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
+ − 17
1367
+ − 18
(* compat should be
+ − 19
compat (BP x t) pi (BP x' t')
+ − 20
\<equiv> alpha_trm t t' \<and> pi o x = x'
+ − 21
*)
+ − 22
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
+ − 23
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
+ − 24
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
+ − 25
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
+ − 26
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
+ − 27
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
+ − 28
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
+ − 29
thm permute_lam_raw_permute_bp_raw.simps
1396
+ − 30
thm alpha_lam_raw_alpha_bp_raw_alpha_bi_raw.intros[no_vars]
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
+ − 31
thm fv_lam_raw_fv_bp_raw.simps[no_vars]
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 32
1261
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 33
text {* example 2 *}
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 34
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 35
nominal_datatype trm' =
961
+ − 36
Var "name"
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 37
| App "trm'" "trm'"
1398
+ − 38
| 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
+ − 39
| 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
+ − 40
and pat' =
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 41
PN
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 42
| 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
+ − 43
| 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
+ − 44
binder
1299
+ − 45
f::"pat' \<Rightarrow> atom set"
1398
+ − 46
where
978
b44592adf235
Improper interface for datatype and function packages and proper interface lateron.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 47
"f PN = {}"
1380
dab8d99b37c1
added bn-information, but it is not yet ordered according to the dts
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 48
| "f (PD x y) = {atom x, atom y}"
1299
+ − 49
| "f (PS x) = {atom x}"
1380
dab8d99b37c1
added bn-information, but it is not yet ordered according to the dts
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 50
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 51
1367
+ − 52
(* compat should be
1368
+ − 53
compat (PN) pi (PN) == True
+ − 54
compat (PS x) pi (PS x') == pi o x = x'
+ − 55
compat (PD p1 p2) pi (PD p1' p2') == compat p1 pi p1' & compat p2 pi p2'
1367
+ − 56
*)
+ − 57
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 58
1396
+ − 59
thm alpha_trm'_raw_alpha_pat'_raw_alpha_f_raw.intros[no_vars]
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 60
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
+ − 61
thm f_raw.simps
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 62
(*thm trm'_pat'_induct
1340
+ − 63
thm trm'_pat'_perm
+ − 64
thm trm'_pat'_fv
+ − 65
thm trm'_pat'_bn
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 66
thm trm'_pat'_inject*)
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 67
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 68
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
+ − 69
Var0 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 70
| App0 "trm0" "trm0"
1398
+ − 71
| Lam0 x::"name" t::"trm0" 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
+ − 72
| 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
+ − 73
and pat0 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 74
PN0
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 75
| PS0 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 76
| 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
+ − 77
binder
1299
+ − 78
f0::"pat0 \<Rightarrow> atom set"
1398
+ − 79
where
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 80
"f0 PN0 = {}"
1299
+ − 81
| "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
+ − 82
| "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
+ − 83
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 84
thm f0_raw.simps
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 85
(*thm trm0_pat0_induct
1340
+ − 86
thm trm0_pat0_perm
+ − 87
thm trm0_pat0_fv
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 88
thm trm0_pat0_bn*)
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 89
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 90
text {* example type schemes *}
1285
+ − 91
1302
+ − 92
nominal_datatype t =
+ − 93
Var "name"
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 94
| Fun "t" "t"
1398
+ − 95
and tyS =
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 96
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
+ − 97
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 98
(* 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
+ − 99
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 100
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
+ − 101
Vr1 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 102
| Ap1 "trm1" "trm1"
1398
+ − 103
| Lm1 x::"name" t::"trm1" bind x in t
+ − 104
| Lt1 p::"bp1" "trm1" t::"trm1" bind "bv1 p" 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
+ − 105
and bp1 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 106
BUnit1
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 107
| BV1 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
| 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
+ − 109
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 110
bv1
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 111
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 112
"bv1 (BUnit1) = {}"
1392
+ − 113
| "bv1 (BP1 bp1 bp2) = (bv1 bp1) \<union> (bv1 bp2)"
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 114
| "bv1 (BV1 x) = {atom x}"
1392
+ − 115
1251
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 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
+ − 118
1367
+ − 119
text {* example 3 from Terms.thy *}
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 120
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 121
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
+ − 122
Vr3 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 123
| 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
+ − 124
| 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
+ − 125
| 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
+ − 126
and rassigns3 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 127
ANil
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 128
| 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
+ − 129
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 130
bv3
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 131
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 132
"bv3 ANil = {}"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 133
| "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
+ − 134
1367
+ − 135
+ − 136
(* compat should be
+ − 137
compat (ANil) pi (PNil) \<equiv> TRue
+ − 138
compat (ACons x t ts) pi (ACons x' t' ts') \<equiv> pi o x = x' \<and> alpha t t' \<and> compat ts pi ts'
+ − 139
*)
+ − 140
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 141
(* 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
+ − 142
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 143
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
+ − 144
Vr5 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 145
| 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
+ − 146
| 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
+ − 147
and lts =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 148
Lnil
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 149
| 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
+ − 150
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 151
bv5
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 152
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 153
"bv5 Lnil = {}"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 154
| "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
+ − 155
1285
+ − 156
(* example from my PHD *)
+ − 157
+ − 158
atom_decl coname
1272
+ − 159
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 160
nominal_datatype phd =
1290
+ − 161
Ax "name" "coname"
+ − 162
| Cut n::"coname" t1::"phd" c::"coname" t2::"phd" bind n in t1, bind c in t2
+ − 163
| AndR c1::"coname" t1::"phd" c2::"coname" t2::"phd" "coname" bind c1 in t1, bind c2 in t2
+ − 164
| AndL1 n::"name" t::"phd" "name" bind n in t
+ − 165
| AndL2 n::"name" t::"phd" "name" bind n in t
+ − 166
| 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
+ − 167
| 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
+ − 168
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
+ − 169
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
+ − 170
thm fv_phd_raw.simps[no_vars]
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 171
1285
+ − 172
+ − 173
(* example form Leroy 96 about modules; OTT *)
1284
+ − 174
1272
+ − 175
nominal_datatype mexp =
1296
+ − 176
Acc "path"
+ − 177
| Stru "body"
+ − 178
| Funct x::"name" "sexp" m::"mexp" bind x in m
+ − 179
| FApp "mexp" "path"
+ − 180
| Ascr "mexp" "sexp"
1272
+ − 181
and body =
+ − 182
Empty
1296
+ − 183
| Seq c::defn d::"body" bind "cbinders c" in d
1398
+ − 184
and defn =
1296
+ − 185
Type "name" "tyty"
+ − 186
| Dty "name"
+ − 187
| DStru "name" "mexp"
+ − 188
| Val "name" "trmtrm"
1272
+ − 189
and sexp =
+ − 190
Sig sbody
1296
+ − 191
| SFunc "name" "sexp" "sexp"
1398
+ − 192
and sbody =
1272
+ − 193
SEmpty
1296
+ − 194
| SSeq C::spec D::sbody bind "Cbinders C" in D
1272
+ − 195
and spec =
1398
+ − 196
Type1 "name"
1296
+ − 197
| Type2 "name" "tyty"
+ − 198
| SStru "name" "sexp"
+ − 199
| SVal "name" "tyty"
1272
+ − 200
and tyty =
1296
+ − 201
Tyref1 "name"
+ − 202
| Tyref2 "path" "tyty"
+ − 203
| Fun "tyty" "tyty"
1272
+ − 204
and path =
1296
+ − 205
Sref1 "name"
+ − 206
| Sref2 "path" "name"
1272
+ − 207
and trmtrm =
1296
+ − 208
Tref1 "name"
+ − 209
| Tref2 "path" "name"
1340
+ − 210
| Lam' v::"name" "tyty" M::"trmtrm" bind v in M
+ − 211
| App' "trmtrm" "trmtrm"
+ − 212
| Let' "body" "trmtrm"
1272
+ − 213
binder
+ − 214
cbinders :: "defn \<Rightarrow> atom set"
+ − 215
and Cbinders :: "spec \<Rightarrow> atom set"
+ − 216
where
+ − 217
"cbinders (Type t T) = {atom t}"
+ − 218
| "cbinders (Dty t) = {atom t}"
+ − 219
| "cbinders (DStru x s) = {atom x}"
1396
+ − 220
| "cbinders (Val v M) = {atom v}"
1272
+ − 221
| "Cbinders (Type1 t) = {atom t}"
+ − 222
| "Cbinders (Type2 t T) = {atom t}"
+ − 223
| "Cbinders (SStru x S) = {atom x}"
1396
+ − 224
| "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
+ − 225
1392
+ − 226
1312
+ − 227
(* example 3 from Peter Sewell's bestiary *)
+ − 228
nominal_datatype exp =
1340
+ − 229
VarP "name"
+ − 230
| AppP "exp" "exp"
+ − 231
| LamP x::"name" e::"exp" bind x in e
1396
+ − 232
| LetP x::"name" p::"pat3" e1::"exp" e2::"exp" bind x in e2, bind "bp' p" in e1
1378
+ − 233
and pat3 =
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
+ − 234
PVar "name"
1312
+ − 235
| PUnit
1378
+ − 236
| PPair "pat3" "pat3"
1312
+ − 237
binder
1396
+ − 238
bp' :: "pat3 \<Rightarrow> atom set"
1312
+ − 239
where
1396
+ − 240
"bp' (PVar x) = {atom x}"
+ − 241
| "bp' (PUnit) = {}"
+ − 242
| "bp' (PPair p1 p2) = bp' p1 \<union> bp' p2"
+ − 243
thm alpha_exp_raw_alpha_pat3_raw_alpha_bp'_raw.intros
1312
+ − 244
+ − 245
(* example 6 from Peter Sewell's bestiary *)
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 246
nominal_datatype exp6 =
1312
+ − 247
EVar name
+ − 248
| EPair exp6 exp6
+ − 249
| ELetRec x::name p::pat6 e1::exp6 e2::exp6 bind x in e1, bind x in e2, bind "bp6 p" in e1
+ − 250
and pat6 =
1340
+ − 251
PVar' name
+ − 252
| PUnit'
+ − 253
| PPair' pat6 pat6
1312
+ − 254
binder
+ − 255
bp6 :: "pat6 \<Rightarrow> atom set"
+ − 256
where
1340
+ − 257
"bp6 (PVar' x) = {atom x}"
+ − 258
| "bp6 (PUnit') = {}"
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 259
| "bp6 (PPair' p1 p2) = bp6 p1 \<union> bp6 p2"
1396
+ − 260
thm alpha_exp6_raw_alpha_pat6_raw_alpha_bp6_raw.intros
1312
+ − 261
1398
+ − 262
(* THE REST ARE NOT SUPPOSED TO WORK YET *)
+ − 263
1312
+ − 264
(* example 7 from Peter Sewell's bestiary *)
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 265
nominal_datatype exp7 =
1312
+ − 266
EVar name
+ − 267
| EUnit
+ − 268
| EPair exp7 exp7
+ − 269
| ELetRec l::lrbs e::exp7 bind "b7s l" in e, bind "b7s l" in l
+ − 270
and lrb =
+ − 271
Assign name exp7
+ − 272
and lrbs =
+ − 273
Single lrb
+ − 274
| More lrb lrbs
+ − 275
binder
+ − 276
b7 :: "lrb \<Rightarrow> atom set" and
+ − 277
b7s :: "lrbs \<Rightarrow> atom set"
+ − 278
where
+ − 279
"b7 (Assign x e) = {atom x}"
+ − 280
| "b7s (Single a) = b7 a"
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 281
| "b7s (More a as) = (b7 a) \<union> (b7s as)"
1361
1e811e3424f3
With restricted_nominal=1, exp7 and exp8 work. Not sure about proving bn_rsp there.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 282
thm alpha_exp7_raw_alpha_lrb_raw_alpha_lrbs_raw.intros
1312
+ − 283
+ − 284
(* example 8 from Peter Sewell's bestiary *)
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 285
nominal_datatype exp8 =
1312
+ − 286
EVar name
+ − 287
| EUnit
+ − 288
| EPair exp8 exp8
+ − 289
| ELetRec l::lrbs8 e::exp8 bind "b_lrbs8 l" in e, bind "b_lrbs8 l" in l
+ − 290
and fnclause =
+ − 291
K x::name p::pat8 e::exp8 bind "b_pat p" in e
+ − 292
and fnclauses =
+ − 293
S fnclause
+ − 294
| ORs fnclause fnclauses
+ − 295
and lrb8 =
+ − 296
Clause fnclauses
+ − 297
and lrbs8 =
+ − 298
Single lrb8
+ − 299
| More lrb8 lrbs8
+ − 300
and pat8 =
+ − 301
PVar name
+ − 302
| PUnit
+ − 303
| PPair pat8 pat8
+ − 304
binder
+ − 305
b_lrbs8 :: "lrbs8 \<Rightarrow> atom set" and
+ − 306
b_pat :: "pat8 \<Rightarrow> atom set" and
+ − 307
b_fnclauses :: "fnclauses \<Rightarrow> atom set" and
+ − 308
b_fnclause :: "fnclause \<Rightarrow> atom set" and
+ − 309
b_lrb8 :: "lrb8 \<Rightarrow> atom set"
+ − 310
where
+ − 311
"b_lrbs8 (Single l) = b_lrb8 l"
+ − 312
| "b_lrbs8 (More l ls) = b_lrb8 l \<union> b_lrbs8 ls"
+ − 313
| "b_pat (PVar x) = {atom x}"
+ − 314
| "b_pat (PUnit) = {}"
+ − 315
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2"
+ − 316
| "b_fnclauses (S fc) = (b_fnclause fc)"
+ − 317
| "b_fnclauses (ORs fc fcs) = (b_fnclause fc) \<union> (b_fnclauses fcs)"
+ − 318
| "b_lrb8 (Clause fcs) = (b_fnclauses fcs)"
1341
c25f797c7e6e
Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 319
| "b_fnclause (K x pat exp8) = {atom x}"
1361
1e811e3424f3
With restricted_nominal=1, exp7 and exp8 work. Not sure about proving bn_rsp there.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 320
thm alpha_exp8_raw_alpha_fnclause_raw_alpha_fnclauses_raw_alpha_lrb8_raw_alpha_lrbs8_raw_alpha_pat8_raw.intros
1312
+ − 321
1398
+ − 322
(* example 4 from Terms.thy *)
+ − 323
(* fv_eqvt does not work, we need to repaire defined permute functions
+ − 324
defined fv and defined alpha... *)
+ − 325
nominal_datatype trm4 =
+ − 326
Vr4 "name"
+ − 327
| Ap4 "trm4" "trm4 list"
+ − 328
| Lm4 x::"name" t::"trm4" bind x in t
+ − 329
+ − 330
thm alpha_trm4_raw_alpha_trm4_raw_list.intros[no_vars]
+ − 331
thm fv_trm4_raw_fv_trm4_raw_list.simps[no_vars]
+ − 332
+ − 333
(* core haskell *)
+ − 334
atom_decl var
+ − 335
atom_decl tvar
+ − 336
+ − 337
(* there are types, coercion types and regular types *)
+ − 338
nominal_datatype tkind =
+ − 339
KStar
+ − 340
| KFun "tkind" "tkind"
+ − 341
and ckind =
+ − 342
CKEq "ty" "ty"
+ − 343
and ty =
+ − 344
TVar "tvar"
+ − 345
| TC "string"
+ − 346
| TApp "ty" "ty"
+ − 347
| TFun "string" "ty list"
+ − 348
| TAll tv::"tvar" "tkind" T::"ty" bind tv in T
+ − 349
| TEq "ty" "ty" "ty"
+ − 350
and co =
+ − 351
CC "string"
+ − 352
| CApp "co" "co"
+ − 353
| CFun "string" "co list"
+ − 354
| CAll tv::"tvar" "ckind" C::"co" bind tv in C
+ − 355
| CEq "co" "co" "co"
+ − 356
| CSym "co"
+ − 357
| CCir "co" "co"
+ − 358
| CLeft "co"
+ − 359
| CRight "co"
+ − 360
| CSim "co"
+ − 361
| CRightc "co"
+ − 362
| CLeftc "co"
+ − 363
| CCoe "co" "co"
+ − 364
+ − 365
+ − 366
typedecl ty --"hack since ty is not yet defined"
+ − 367
typedecl kind
+ − 368
+ − 369
instance ty and kind:: pt
+ − 370
sorry
+ − 371
+ − 372
abbreviation
+ − 373
"atoms A \<equiv> atom ` A"
+ − 374
+ − 375
nominal_datatype trm =
+ − 376
Var "var"
+ − 377
| C "string"
+ − 378
| LAM tv::"tvar" "kind" t::"trm" bind tv in t
+ − 379
| APP "trm" "ty"
+ − 380
| Lam v::"var" "ty" t::"trm" bind v in t
+ − 381
| App "trm" "trm"
+ − 382
| Let x::"var" "ty" "trm" t::"trm" bind x in t
+ − 383
| Case "trm" "assoc list"
+ − 384
| Cast "trm" "ty" --"ty is supposed to be a coercion type only"
+ − 385
and assoc =
+ − 386
A p::"pat" t::"trm" bind "bv p" in t
+ − 387
and pat =
+ − 388
K "string" "(tvar \<times> kind) list" "(var \<times> ty) list"
+ − 389
binder
+ − 390
bv :: "pat \<Rightarrow> atom set"
+ − 391
where
+ − 392
"bv (K s ts vs) = (atoms (set (map fst ts))) \<union> (atoms (set (map fst vs)))"
+ − 393
+ − 394
(*
+ − 395
compat (K s ts vs) pi (K s' ts' vs') ==
+ − 396
s = s' &
+ − 397
+ − 398
*)
+ − 399
+ − 400
+ − 401
+ − 402
text {* weirdo example from Peter Sewell's bestiary *}
+ − 403
+ − 404
nominal_datatype weird =
+ − 405
WBind x::"name" y::"name" p1::"weird" p2::"weird" p3::"weird"
+ − 406
bind x in p1, bind x in p2, bind y in p2, bind y in p3
+ − 407
| WV "name"
+ − 408
| WP "weird" "weird"
+ − 409
+ − 410
thm permute_weird_raw.simps[no_vars]
+ − 411
thm alpha_weird_raw.intros[no_vars]
+ − 412
thm fv_weird_raw.simps[no_vars]
+ − 413
+ − 414
(* example 6 from Terms.thy *)
+ − 415
+ − 416
(* BV is not respectful, needs to fail*)
+ − 417
nominal_datatype trm6 =
+ − 418
Vr6 "name"
+ − 419
| Lm6 x::"name" t::"trm6" bind x in t
+ − 420
| Lt6 left::"trm6" right::"trm6" bind "bv6 left" in right
+ − 421
binder
+ − 422
bv6
+ − 423
where
+ − 424
"bv6 (Vr6 n) = {}"
+ − 425
| "bv6 (Lm6 n t) = {atom n} \<union> bv6 t"
+ − 426
| "bv6 (Lt6 l r) = bv6 l \<union> bv6 r"
+ − 427
(* example 7 from Terms.thy *)
+ − 428
+ − 429
(* BV is not respectful, needs to fail*)
+ − 430
nominal_datatype trm7 =
+ − 431
Vr7 "name"
+ − 432
| Lm7 l::"name" r::"trm7" bind l in r
+ − 433
| Lt7 l::"trm7" r::"trm7" bind "bv7 l" in r
+ − 434
binder
+ − 435
bv7
+ − 436
where
+ − 437
"bv7 (Vr7 n) = {atom n}"
+ − 438
| "bv7 (Lm7 n t) = bv7 t - {atom n}"
+ − 439
| "bv7 (Lt7 l r) = bv7 l \<union> bv7 r"
+ − 440
+ − 441
(* example 8 from Terms.thy *)
+ − 442
+ − 443
(* Binding in a term under a bn, needs to fail *)
+ − 444
nominal_datatype foo8 =
+ − 445
Foo0 "name"
+ − 446
| Foo1 b::"bar8" f::"foo8" bind "bv8 b" in f --"check fo error if this is called foo"
+ − 447
and bar8 =
+ − 448
Bar0 "name"
+ − 449
| Bar1 "name" s::"name" b::"bar8" bind s in b
+ − 450
binder
+ − 451
bv8
+ − 452
where
+ − 453
"bv8 (Bar0 x) = {}"
+ − 454
| "bv8 (Bar1 v x b) = {atom v}"
+ − 455
+ − 456
(* example 9 from Terms.thy *)
+ − 457
+ − 458
(* BV is not respectful, needs to fail*)
+ − 459
nominal_datatype lam9 =
+ − 460
Var9 "name"
+ − 461
| Lam9 n::"name" l::"lam9" bind n in l
+ − 462
and bla9 =
+ − 463
Bla9 f::"lam9" s::"lam9" bind "bv9 f" in s
+ − 464
binder
+ − 465
bv9
+ − 466
where
+ − 467
"bv9 (Var9 x) = {}"
+ − 468
| "bv9 (Lam9 x b) = {atom x}"
+ − 469
+ − 470
+ − 471
(* Type schemes with separate datatypes *)
+ − 472
nominal_datatype t =
+ − 473
Var "name"
+ − 474
| Fun "t" "t"
+ − 475
+ − 476
nominal_datatype tyS =
+ − 477
All xs::"name list" ty::"t_raw" bind xs in ty
+ − 478
1312
+ − 479
+ − 480
+ − 481
+ − 482
(* example 9 from Peter Sewell's bestiary *)
+ − 483
(* 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
+ − 484
961
+ − 485
end
1223
160343d86a6f
"raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 486
160343d86a6f
"raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
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
+ − 488