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
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
1335
+ − 17
thm eqvts
+ − 18
+ − 19
local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding weird_inj}, []), (build_alpha_inj @{thms alpha_weird_raw.intros} @{thms weird_raw.distinct weird_raw.inject} @{thms alpha_weird_raw.cases} ctxt)) ctxt)) *}
+ − 20
thm weird_inj
+ − 21
+ − 22
local_setup {*
+ − 23
(fn ctxt => snd (Local_Theory.note ((@{binding alpha_eqvt}, []),
+ − 24
build_alpha_eqvts [@{term alpha_weird_raw}] [@{term "permute :: perm \<Rightarrow> weird_raw \<Rightarrow> weird_raw"}] @{thms permute_weird_raw.simps weird_inj} @{thm alpha_weird_raw.induct} ctxt) ctxt)) *}
+ − 25
+ − 26
ML {*
+ − 27
fun is_ex (Const ("Ex", _) $ Abs _) = true
+ − 28
| is_ex _ = false;
+ − 29
*}
+ − 30
+ − 31
ML {*
+ − 32
fun eetac rule = Subgoal.FOCUS_PARAMS
+ − 33
(fn (focus) =>
+ − 34
let
+ − 35
val concl = #concl focus
+ − 36
val prems = Logic.strip_imp_prems (term_of concl)
+ − 37
val exs = filter (fn x => is_ex (HOLogic.dest_Trueprop x)) prems
+ − 38
val cexs = map (SOME o (cterm_of (ProofContext.theory_of (#context focus)))) exs
+ − 39
val thins = map (fn cex => Drule.instantiate' [] [cex] Drule.thin_rl) cexs
+ − 40
in
+ − 41
(etac rule THEN' RANGE[
+ − 42
atac,
+ − 43
eresolve_tac thins
+ − 44
]) 1
+ − 45
end
+ − 46
)
+ − 47
*}
+ − 48
1337
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 49
ML {*
1335
+ − 50
fun transp_tac ctxt induct alpha_inj term_inj distinct cases eqvt =
+ − 51
ind_tac induct THEN_ALL_NEW
+ − 52
(TRY o rtac allI THEN' imp_elim_tac cases ctxt) THEN_ALL_NEW
+ − 53
asm_full_simp_tac ((mk_minimal_ss ctxt) addsimps alpha_inj) THEN_ALL_NEW
+ − 54
split_conjs THEN_ALL_NEW REPEAT o (eetac @{thm exi_sum} ctxt)
+ − 55
THEN_ALL_NEW split_conjs
+ − 56
*}
1337
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 57
(*apply (tactic {* transp_tac @{context} @{thm alpha_weird_raw.induct} @{thms weird_inj} @{thms weird_raw.inject} @{thms weird_raw.distinct} @{thms alpha_weird_raw.cases} @{thms alpha_eqvt} 1 *})*)
1335
+ − 58
1337
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 59
lemma "alpha_weird_raw x y \<longrightarrow> (\<forall>z. alpha_weird_raw y z \<longrightarrow> alpha_weird_raw x z)"
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 60
apply (rule impI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 61
apply (erule alpha_weird_raw.induct)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 62
apply (simp_all add: weird_inj)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 63
defer
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 64
apply (rule allI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 65
apply (rule impI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 66
apply (erule alpha_weird_raw.cases)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 67
apply (simp_all add: weird_inj)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 68
apply (rule allI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 69
apply (rule impI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 70
apply (erule alpha_weird_raw.cases)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 71
apply (simp_all add: weird_inj)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 72
apply (erule conjE)+
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 73
apply (erule exE)+
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 74
apply (rule conjI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 75
apply (rule_tac x="pica + pic" in exI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 76
apply (erule alpha_gen_compose_trans)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 77
apply assumption
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 78
apply (simp add: alpha_eqvt)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 79
apply (rule conjI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 80
defer
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 81
apply (rule_tac x="pia + pi" in exI)
1335
+ − 82
apply (erule alpha_gen_compose_trans)
+ − 83
apply assumption
+ − 84
apply (simp add: alpha_eqvt)
1337
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 85
(* Normally: (pia + pb + (pib + pa)) *)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 86
apply (rule_tac x="piaa + pib" in exI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 87
apply (rule_tac x="piab + piba" in exI)
1335
+ − 88
apply (erule alpha_gen_compose_trans)
+ − 89
apply assumption
+ − 90
apply (simp add: alpha_eqvt)
1337
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 91
done
1335
+ − 92
1337
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 93
lemma "alpha_weird_raw x y \<Longrightarrow> alpha_weird_raw y x"
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 94
apply (erule alpha_weird_raw.induct)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 95
apply (simp_all add: weird_inj)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 96
apply (erule conjE)+
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 97
apply (erule exE)+
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 98
apply (rule conjI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 99
defer (* simple *)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 100
apply (rule conjI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 101
apply (rule_tac x="- pia" in exI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 102
apply (rule_tac x="- pib" in exI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 103
apply (simp add: minus_add[symmetric])
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 104
apply (erule alpha_gen_compose_sym)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 105
apply (simp_all add: alpha_eqvt)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 106
apply (rule_tac x="- pi" in exI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 107
apply (erule alpha_gen_compose_sym)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 108
apply (simp_all add: alpha_eqvt)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 109
apply (rule_tac x="- pic" in exI)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 110
apply (erule alpha_gen_compose_sym)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 111
apply (simp_all add: alpha_eqvt)
7ae031bd5d2f
Prove symp and transp of weird without the supp /\ supp = {} assumption.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 112
done
1335
+ − 113
1332
+ − 114
1321
+ − 115
abbreviation "WBind \<equiv> WBind_raw"
+ − 116
abbreviation "WP \<equiv> WP_raw"
+ − 117
abbreviation "WV \<equiv> WV_raw"
+ − 118
+ − 119
lemma test:
+ − 120
assumes a: "distinct [x, y, z]"
1332
+ − 121
shows "alpha_weird_raw (WBind x y (WP (WV x) (WV z)) (WP (WV x) (WV y)) (WP (WV z) (WV y)))
+ − 122
(WBind y x (WP (WV y) (WV z)) (WP (WV y) (WV x)) (WP (WV z) (WV x)))"
+ − 123
apply(rule_tac alpha_weird_raw.intros)
1321
+ − 124
unfolding alpha_gen
+ − 125
using a
1332
+ − 126
apply(auto)
1321
+ − 127
apply(rule_tac x="(x \<leftrightarrow> y)" in exI)
1332
+ − 128
apply(auto)
+ − 129
apply(simp add: fresh_star_def flip_def fresh_def supp_swap)
+ − 130
apply(rule alpha_weird_raw.intros)
+ − 131
apply(simp add: alpha_weird_raw.intros(2))
+ − 132
apply(rule_tac x="(x \<leftrightarrow> y)" in exI)
+ − 133
apply(rule_tac x="0" in exI)
1321
+ − 134
apply(simp add: fresh_star_def)
+ − 135
apply(auto)
1332
+ − 136
apply(rule alpha_weird_raw.intros)
+ − 137
apply(simp add: alpha_weird_raw.intros(2))
+ − 138
apply(simp add: flip_def supp_swap supp_perm)
+ − 139
apply(rule_tac x="(x \<leftrightarrow> y)" in exI)
1321
+ − 140
apply(simp)
1332
+ − 141
apply(auto)
+ − 142
apply(simp add: flip_def fresh_def supp_swap)
+ − 143
apply(rule alpha_weird_raw.intros)
+ − 144
apply(simp add: alpha_weird_raw.intros(2))
+ − 145
done
1321
+ − 146
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 147
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
+ − 148
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 149
(* ML {* set show_hyps *} *)
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 150
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 151
nominal_datatype lam =
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 152
VAR "name"
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 153
| APP "lam" "lam"
1287
+ − 154
| 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
+ − 155
and bp =
1287
+ − 156
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
+ − 157
binder
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 158
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
+ − 159
where
1295
0ecc775e5fce
Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 160
"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
+ − 161
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
+ − 162
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
+ − 163
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
+ − 164
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
+ − 165
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
+ − 166
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
+ − 167
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
+ − 168
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
+ − 169
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
+ − 170
thm fv_lam_raw_fv_bp_raw.simps[no_vars]
1309
+ − 171
thm eqvts
1299
+ − 172
961
+ − 173
print_theorems
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 174
1261
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 175
text {* example 2 *}
853abc14c5c6
added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 176
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 177
nominal_datatype trm' =
961
+ − 178
Var "name"
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 179
| App "trm'" "trm'"
1272
+ − 180
| 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
+ − 181
| 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
+ − 182
and pat' =
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 183
PN
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 184
| 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
+ − 185
| 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
+ − 186
binder
1299
+ − 187
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
+ − 188
where
978
b44592adf235
Improper interface for datatype and function packages and proper interface lateron.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 189
"f PN = {}"
1299
+ − 190
| "f (PS x) = {atom x}"
+ − 191
| "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
+ − 192
1320
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 193
447666754176
Another problem with permutations in alpha and possibly also in fv
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 194
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
+ − 195
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
+ − 196
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
+ − 197
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 198
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
+ − 199
Var0 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 200
| 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
+ − 201
| 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
+ − 202
| 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
+ − 203
and pat0 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 204
PN0
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 205
| PS0 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 206
| 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
+ − 207
binder
1299
+ − 208
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
+ − 209
where
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 210
"f0 PN0 = {}"
1299
+ − 211
| "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
+ − 212
| "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
+ − 213
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 214
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
+ − 215
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 216
text {* example type schemes *}
1285
+ − 217
1304
+ − 218
(* does not work yet
1302
+ − 219
nominal_datatype t =
+ − 220
Var "name"
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 221
| 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
+ − 222
1302
+ − 223
nominal_datatype tyS =
1299
+ − 224
All xs::"name list" ty::"t_raw" bind xs in ty
+ − 225
*)
954
c009d2535896
very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
+ − 226
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 227
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 228
(* alpha_eqvt fails...
1299
+ − 229
nominal_datatype t =
+ − 230
Var "name"
+ − 231
| Fun "t" "t"
+ − 232
and tyS =
1316
0577afdb1732
Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 233
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
+ − 234
1251
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 235
(* 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
+ − 236
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 237
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
+ − 238
Vr1 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 239
| Ap1 "trm1" "trm1"
1290
+ − 240
| 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
+ − 241
| 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
+ − 242
and bp1 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 243
BUnit1
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 244
| BV1 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 245
| 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
+ − 246
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 247
bv1
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 248
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 249
"bv1 (BUnit1) = {}"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 250
| "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
+ − 251
| "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
+ − 252
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 253
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
+ − 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 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
+ − 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 trm2 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 258
Vr2 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 259
| 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
+ − 260
| 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
+ − 261
| 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
+ − 262
and rassign =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 263
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
+ − 264
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 265
bv2
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 266
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 267
"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
+ − 268
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 269
(* 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
+ − 270
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 271
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
+ − 272
Vr3 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 273
| 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
+ − 274
| 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
+ − 275
| 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
+ − 276
and rassigns3 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 277
ANil
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 278
| 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
+ − 279
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 280
bv3
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 281
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 282
"bv3 ANil = {}"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 283
| "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
+ − 284
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 285
(* 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
+ − 286
1326
+ − 287
(* fv_eqvt does not work, we need to repaire defined permute functions
+ − 288
defined fv and defined alpha... *)
+ − 289
(*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
+ − 290
Vr4 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 291
| 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
+ − 292
| Lm4 x::"name" t::"trm4" bind x in t
1302
+ − 293
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
+ − 294
thm alpha_trm4_raw_alpha_trm4_raw_list.intros[no_vars]
1326
+ − 295
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
+ − 296
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 297
(* 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
+ − 298
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 299
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
+ − 300
Vr5 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 301
| 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
+ − 302
| 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
+ − 303
and lts =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 304
Lnil
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 305
| 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
+ − 306
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 307
bv5
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 308
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 309
"bv5 Lnil = {}"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 310
| "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
+ − 311
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 312
(* 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
+ − 313
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 314
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
+ − 315
Vr6 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 316
| 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
+ − 317
| 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
+ − 318
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 319
bv6
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 320
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 321
"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
+ − 322
| "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
+ − 323
| "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
+ − 324
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 325
(* 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
+ − 326
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 327
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
+ − 328
Vr7 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 329
| 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
+ − 330
| 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
+ − 331
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 332
bv7
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 333
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 334
"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
+ − 335
| "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
+ − 336
| "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
+ − 337
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 338
(* 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
+ − 339
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 340
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
+ − 341
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
+ − 342
| 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
+ − 343
and bar8 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 344
Bar0 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 345
| 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
+ − 346
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 347
bv8
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 348
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 349
"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
+ − 350
| "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
+ − 351
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 352
(* 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
+ − 353
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 354
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
+ − 355
Var9 "name"
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 356
| 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
+ − 357
and bla9 =
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 358
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
+ − 359
binder
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 360
bv9
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 361
where
11b8798dea5d
parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 362
"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
+ − 363
| "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
+ − 364
1285
+ − 365
(* example from my PHD *)
+ − 366
+ − 367
atom_decl coname
1272
+ − 368
1285
+ − 369
nominal_datatype phd =
1290
+ − 370
Ax "name" "coname"
+ − 371
| Cut n::"coname" t1::"phd" c::"coname" t2::"phd" bind n in t1, bind c in t2
+ − 372
| AndR c1::"coname" t1::"phd" c2::"coname" t2::"phd" "coname" bind c1 in t1, bind c2 in t2
+ − 373
| AndL1 n::"name" t::"phd" "name" bind n in t
+ − 374
| AndL2 n::"name" t::"phd" "name" bind n in t
+ − 375
| 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
+ − 376
| 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
+ − 377
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
+ − 378
(* 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
+ − 379
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
+ − 380
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
+ − 381
thm fv_phd_raw.simps[no_vars]
1285
+ − 382
+ − 383
(* example form Leroy 96 about modules; OTT *)
1284
+ − 384
1272
+ − 385
nominal_datatype mexp =
1296
+ − 386
Acc "path"
+ − 387
| Stru "body"
+ − 388
| Funct x::"name" "sexp" m::"mexp" bind x in m
+ − 389
| FApp "mexp" "path"
+ − 390
| Ascr "mexp" "sexp"
1272
+ − 391
and body =
+ − 392
Empty
1296
+ − 393
| Seq c::defn d::"body" bind "cbinders c" in d
1272
+ − 394
and defn =
1296
+ − 395
Type "name" "tyty"
+ − 396
| Dty "name"
+ − 397
| DStru "name" "mexp"
+ − 398
| Val "name" "trmtrm"
1272
+ − 399
and sexp =
+ − 400
Sig sbody
1296
+ − 401
| SFunc "name" "sexp" "sexp"
1272
+ − 402
and sbody =
+ − 403
SEmpty
1296
+ − 404
| SSeq C::spec D::sbody bind "Cbinders C" in D
1272
+ − 405
and spec =
1296
+ − 406
Type1 "name"
+ − 407
| Type2 "name" "tyty"
+ − 408
| SStru "name" "sexp"
+ − 409
| SVal "name" "tyty"
1272
+ − 410
and tyty =
1296
+ − 411
Tyref1 "name"
+ − 412
| Tyref2 "path" "tyty"
+ − 413
| Fun "tyty" "tyty"
1272
+ − 414
and path =
1296
+ − 415
Sref1 "name"
+ − 416
| Sref2 "path" "name"
1272
+ − 417
and trmtrm =
1296
+ − 418
Tref1 "name"
+ − 419
| Tref2 "path" "name"
+ − 420
| Lam v::"name" "tyty" M::"trmtrm" bind v in M
+ − 421
| App "trmtrm" "trmtrm"
+ − 422
| Let "body" "trmtrm"
1272
+ − 423
binder
+ − 424
cbinders :: "defn \<Rightarrow> atom set"
+ − 425
and Cbinders :: "spec \<Rightarrow> atom set"
+ − 426
where
+ − 427
"cbinders (Type t T) = {atom t}"
+ − 428
| "cbinders (Dty t) = {atom t}"
+ − 429
| "cbinders (DStru x s) = {atom x}"
+ − 430
| "cbinders (Val v M) = {atom v}"
+ − 431
| "Cbinders (Type1 t) = {atom t}"
+ − 432
| "Cbinders (Type2 t T) = {atom t}"
+ − 433
| "Cbinders (SStru x S) = {atom x}"
+ − 434
| "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
+ − 435
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 436
(* core haskell *)
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 437
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 438
atom_decl var
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 439
atom_decl tvar
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 440
atom_decl co
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 441
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 442
datatype sort =
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 443
TY tvar
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 444
| CO co
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 445
1299
+ − 446
nominal_datatype kind =
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 447
KStar
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 448
| KFun kind kind
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 449
| KEq kind kind
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 450
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 451
(* there are types, coercion types and regular types *)
1299
+ − 452
(*
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 453
nominal_datatype ty =
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 454
TVar tvar
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 455
| TFun string "ty list"
1299
+ − 456
| 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
+ − 457
| TSym ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 458
| TCir ty ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 459
| TApp ty ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 460
| TLeft ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 461
| TRight ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 462
| TEq ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 463
| TRightc ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 464
| TLeftc ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 465
| TCoe ty ty
1299
+ − 466
*)
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 467
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
+ − 468
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 469
abbreviation
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 470
"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
+ − 471
1299
+ − 472
(* 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
+ − 473
nominal_datatype trm =
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 474
Var var
1299
+ − 475
| 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
+ − 476
| APP trm ty
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 477
| 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
+ − 478
| App trm trm
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 479
| 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
+ − 480
| Case trm "assoc list"
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 481
| 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
+ − 482
and assoc =
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 483
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
+ − 484
and pat =
1299
+ − 485
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
+ − 486
binder
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
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
+ − 488
where
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 489
"bv (K s ts vs) = (atoms (set (map fst ts))) \<union> (atoms (set (map fst vs)))"
1299
+ − 490
*)
1265
fc8f5897b00a
first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 491
1312
+ − 492
(*thm bv_raw.simps*)
+ − 493
+ − 494
(* example 3 from Peter Sewell's bestiary *)
+ − 495
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
+ − 496
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
+ − 497
| 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
+ − 498
| 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
+ − 499
| Let x::"name" p::"pat" e1::"exp" e2::"exp" bind x in e2, bind "bp p" in e1
1312
+ − 500
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
+ − 501
PVar "name"
1312
+ − 502
| 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
+ − 503
| PPair "pat" "pat"
1312
+ − 504
binder
+ − 505
bp :: "pat \<Rightarrow> atom set"
+ − 506
where
+ − 507
"bp (PVar x) = {atom x}"
+ − 508
| "bp (PUnit) = {}"
+ − 509
| "bp (PPair p1 p2) = bp p1 \<union> bp p2"
+ − 510
+ − 511
(* example 6 from Peter Sewell's bestiary *)
+ − 512
nominal_datatype exp6 =
+ − 513
EVar name
+ − 514
| EPair exp6 exp6
+ − 515
| ELetRec x::name p::pat6 e1::exp6 e2::exp6 bind x in e1, bind x in e2, bind "bp6 p" in e1
+ − 516
and pat6 =
+ − 517
PVar name
+ − 518
| PUnit
+ − 519
| PPair pat6 pat6
+ − 520
binder
+ − 521
bp6 :: "pat6 \<Rightarrow> atom set"
+ − 522
where
+ − 523
"bp6 (PVar x) = {atom x}"
+ − 524
| "bp6 (PUnit) = {}"
+ − 525
| "bp6 (PPair p1 p2) = bp6 p1 \<union> bp6 p2"
+ − 526
+ − 527
(* example 7 from Peter Sewell's bestiary *)
+ − 528
nominal_datatype exp7 =
+ − 529
EVar name
+ − 530
| EUnit
+ − 531
| EPair exp7 exp7
+ − 532
| ELetRec l::lrbs e::exp7 bind "b7s l" in e, bind "b7s l" in l
+ − 533
and lrb =
+ − 534
Assign name exp7
+ − 535
and lrbs =
+ − 536
Single lrb
+ − 537
| More lrb lrbs
+ − 538
binder
+ − 539
b7 :: "lrb \<Rightarrow> atom set" and
+ − 540
b7s :: "lrbs \<Rightarrow> atom set"
+ − 541
where
+ − 542
"b7 (Assign x e) = {atom x}"
+ − 543
| "b7s (Single a) = b7 a"
+ − 544
| "b7s (More a as) = (b7 a) \<union> (b7s as)"
+ − 545
+ − 546
(* example 8 from Peter Sewell's bestiary *)
+ − 547
nominal_datatype exp8 =
+ − 548
EVar name
+ − 549
| EUnit
+ − 550
| EPair exp8 exp8
+ − 551
| ELetRec l::lrbs8 e::exp8 bind "b_lrbs8 l" in e, bind "b_lrbs8 l" in l
+ − 552
and fnclause =
+ − 553
K x::name p::pat8 e::exp8 bind "b_pat p" in e
+ − 554
and fnclauses =
+ − 555
S fnclause
+ − 556
| ORs fnclause fnclauses
+ − 557
and lrb8 =
+ − 558
Clause fnclauses
+ − 559
and lrbs8 =
+ − 560
Single lrb8
+ − 561
| More lrb8 lrbs8
+ − 562
and pat8 =
+ − 563
PVar name
+ − 564
| PUnit
+ − 565
| PPair pat8 pat8
+ − 566
binder
+ − 567
b_lrbs8 :: "lrbs8 \<Rightarrow> atom set" and
+ − 568
b_pat :: "pat8 \<Rightarrow> atom set" and
+ − 569
b_fnclauses :: "fnclauses \<Rightarrow> atom set" and
+ − 570
b_fnclause :: "fnclause \<Rightarrow> atom set" and
+ − 571
b_lrb8 :: "lrb8 \<Rightarrow> atom set"
+ − 572
where
+ − 573
"b_lrbs8 (Single l) = b_lrb8 l"
+ − 574
| "b_lrbs8 (More l ls) = b_lrb8 l \<union> b_lrbs8 ls"
+ − 575
| "b_pat (PVar x) = {atom x}"
+ − 576
| "b_pat (PUnit) = {}"
+ − 577
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2"
+ − 578
| "b_fnclauses (S fc) = (b_fnclause fc)"
+ − 579
| "b_fnclauses (ORs fc fcs) = (b_fnclause fc) \<union> (b_fnclauses fcs)"
+ − 580
| "b_lrb8 (Clause fcs) = (b_fnclauses fcs)"
+ − 581
| "b_fnclause (K x pat exp8) = {atom x}"
+ − 582
+ − 583
+ − 584
+ − 585
+ − 586
(* example 9 from Peter Sewell's bestiary *)
+ − 587
(* 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
+ − 588
961
+ − 589
end
1223
160343d86a6f
"raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 590
160343d86a6f
"raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 591
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
+ − 592