1941
+ − 1
theory NewParser
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 2
imports "../Nominal-General/Nominal2_Base"
1941
+ − 3
"../Nominal-General/Nominal2_Eqvt"
+ − 4
"../Nominal-General/Nominal2_Supp"
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 5
"Perm" "NewAlpha" "Tacs" "Equivp" "Lift"
1941
+ − 6
begin
+ − 7
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 8
1941
+ − 9
section{* Interface for nominal_datatype *}
+ − 10
+ − 11
+ − 12
ML {*
+ − 13
(* nominal datatype parser *)
+ − 14
local
+ − 15
structure P = OuterParse;
+ − 16
structure S = Scan
+ − 17
+ − 18
fun triple1 ((x, y), z) = (x, y, z)
+ − 19
fun triple2 (x, (y, z)) = (x, y, z)
+ − 20
fun tuple ((x, y, z), u) = (x, y, z, u)
+ − 21
fun tswap (((x, y), z), u) = (x, y, u, z)
+ − 22
in
+ − 23
+ − 24
val _ = OuterKeyword.keyword "bind"
+ − 25
val _ = OuterKeyword.keyword "bind_set"
+ − 26
val _ = OuterKeyword.keyword "bind_res"
+ − 27
1943
+ − 28
val anno_typ = S.option (P.name --| P.$$$ "::") -- P.typ
1941
+ − 29
+ − 30
val bind_mode = P.$$$ "bind" || P.$$$ "bind_set" || P.$$$ "bind_res"
+ − 31
+ − 32
val bind_clauses =
+ − 33
P.enum "," (bind_mode -- S.repeat1 P.term -- (P.$$$ "in" |-- S.repeat1 P.name) >> triple1)
+ − 34
+ − 35
val cnstr_parser =
1943
+ − 36
P.binding -- S.repeat anno_typ -- bind_clauses -- P.opt_mixfix >> tswap
1941
+ − 37
+ − 38
(* datatype parser *)
+ − 39
val dt_parser =
+ − 40
(P.type_args -- P.binding -- P.opt_mixfix >> triple1) --
1943
+ − 41
(P.$$$ "=" |-- P.enum1 "|" cnstr_parser) >> tuple
1941
+ − 42
+ − 43
(* binding function parser *)
+ − 44
val bnfun_parser =
1944
+ − 45
S.optional (P.$$$ "binder" |-- P.fixes -- SpecParse.where_alt_specs) ([], [])
1941
+ − 46
+ − 47
(* main parser *)
+ − 48
val main_parser =
1944
+ − 49
P.and_list1 dt_parser -- bnfun_parser >> triple2
1941
+ − 50
+ − 51
end
+ − 52
*}
+ − 53
+ − 54
ML {*
+ − 55
fun get_cnstrs dts =
+ − 56
map (fn (_, _, _, constrs) => constrs) dts
+ − 57
+ − 58
fun get_typed_cnstrs dts =
+ − 59
flat (map (fn (_, bn, _, constrs) =>
+ − 60
(map (fn (bn', _, _) => (Binding.name_of bn, Binding.name_of bn')) constrs)) dts)
+ − 61
+ − 62
fun get_cnstr_strs dts =
+ − 63
map (fn (bn, _, _) => Binding.name_of bn) (flat (get_cnstrs dts))
+ − 64
+ − 65
fun get_bn_fun_strs bn_funs =
+ − 66
map (fn (bn_fun, _, _) => Binding.name_of bn_fun) bn_funs
+ − 67
*}
+ − 68
2106
+ − 69
1941
+ − 70
ML {*
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 71
(* exports back the results *)
1941
+ − 72
fun add_primrec_wrapper funs eqs lthy =
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 73
if null funs then ([], [], lthy)
1941
+ − 74
else
+ − 75
let
+ − 76
val eqs' = map (fn (_, eq) => (Attrib.empty_binding, eq)) eqs
+ − 77
val funs' = map (fn (bn, ty, mx) => (bn, SOME ty, mx)) funs
2106
+ − 78
val ((funs'', eqs''), lthy') = Primrec.add_primrec funs' eqs' lthy
+ − 79
val phi = ProofContext.export_morphism lthy' lthy
1941
+ − 80
in
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 81
(map (Morphism.term phi) funs'', map (Morphism.thm phi) eqs'', lthy')
1941
+ − 82
end
+ − 83
*}
+ − 84
+ − 85
ML {*
+ − 86
fun add_datatype_wrapper dt_names dts =
+ − 87
let
+ − 88
val conf = Datatype.default_config
+ − 89
in
+ − 90
Local_Theory.theory_result (Datatype.add_datatype conf dt_names dts)
+ − 91
end
+ − 92
*}
+ − 93
1944
+ − 94
+ − 95
text {* Infrastructure for adding "_raw" to types and terms *}
+ − 96
1941
+ − 97
ML {*
+ − 98
fun add_raw s = s ^ "_raw"
+ − 99
fun add_raws ss = map add_raw ss
+ − 100
fun raw_bind bn = Binding.suffix_name "_raw" bn
+ − 101
+ − 102
fun replace_str ss s =
+ − 103
case (AList.lookup (op=) ss s) of
+ − 104
SOME s' => s'
+ − 105
| NONE => s
+ − 106
+ − 107
fun replace_typ ty_ss (Type (a, Ts)) = Type (replace_str ty_ss a, map (replace_typ ty_ss) Ts)
+ − 108
| replace_typ ty_ss T = T
+ − 109
+ − 110
fun raw_dts ty_ss dts =
+ − 111
let
+ − 112
fun raw_dts_aux1 (bind, tys, mx) =
+ − 113
(raw_bind bind, map (replace_typ ty_ss) tys, mx)
+ − 114
+ − 115
fun raw_dts_aux2 (ty_args, bind, mx, constrs) =
+ − 116
(ty_args, raw_bind bind, mx, map raw_dts_aux1 constrs)
+ − 117
in
+ − 118
map raw_dts_aux2 dts
+ − 119
end
+ − 120
+ − 121
fun replace_aterm trm_ss (Const (a, T)) = Const (replace_str trm_ss a, T)
+ − 122
| replace_aterm trm_ss (Free (a, T)) = Free (replace_str trm_ss a, T)
+ − 123
| replace_aterm trm_ss trm = trm
+ − 124
+ − 125
fun replace_term trm_ss ty_ss trm =
+ − 126
trm |> Term.map_aterms (replace_aterm trm_ss) |> map_types (replace_typ ty_ss)
+ − 127
*}
+ − 128
+ − 129
ML {*
+ − 130
fun rawify_dts dt_names dts dts_env =
+ − 131
let
+ − 132
val raw_dts = raw_dts dts_env dts
+ − 133
val raw_dt_names = add_raws dt_names
+ − 134
in
+ − 135
(raw_dt_names, raw_dts)
+ − 136
end
+ − 137
*}
+ − 138
+ − 139
ML {*
+ − 140
fun rawify_bn_funs dts_env cnstrs_env bn_fun_env bn_funs bn_eqs =
+ − 141
let
+ − 142
val bn_funs' = map (fn (bn, ty, mx) =>
+ − 143
(raw_bind bn, replace_typ dts_env ty, mx)) bn_funs
+ − 144
+ − 145
val bn_eqs' = map (fn (attr, trm) =>
+ − 146
(attr, replace_term (cnstrs_env @ bn_fun_env) dts_env trm)) bn_eqs
+ − 147
in
+ − 148
(bn_funs', bn_eqs')
+ − 149
end
+ − 150
*}
+ − 151
+ − 152
ML {*
+ − 153
fun rawify_bclauses dts_env cnstrs_env bn_fun_env bclauses =
+ − 154
let
+ − 155
fun rawify_bnds bnds =
+ − 156
map (apfst (Option.map (replace_term (cnstrs_env @ bn_fun_env) dts_env))) bnds
+ − 157
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 158
fun rawify_bclause (BC (mode, bnds, bdys)) = BC (mode, rawify_bnds bnds, bdys)
1941
+ − 159
in
+ − 160
map (map (map rawify_bclause)) bclauses
+ − 161
end
+ − 162
*}
+ − 163
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 164
(* strip_bn_fun takes a rhs of a bn function: this can only contain unions or
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 165
appends of elements; in case of recursive calls it retruns also the applied
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 166
bn function *)
1941
+ − 167
ML {*
+ − 168
fun strip_bn_fun t =
+ − 169
case t of
+ − 170
Const (@{const_name sup}, _) $ l $ r => strip_bn_fun l @ strip_bn_fun r
+ − 171
| Const (@{const_name append}, _) $ l $ r => strip_bn_fun l @ strip_bn_fun r
+ − 172
| Const (@{const_name insert}, _) $ (Const (@{const_name atom}, _) $ Bound i) $ y =>
+ − 173
(i, NONE) :: strip_bn_fun y
+ − 174
| Const (@{const_name Cons}, _) $ (Const (@{const_name atom}, _) $ Bound i) $ y =>
+ − 175
(i, NONE) :: strip_bn_fun y
+ − 176
| Const (@{const_name bot}, _) => []
+ − 177
| Const (@{const_name Nil}, _) => []
+ − 178
| (f as Free _) $ Bound i => [(i, SOME f)]
+ − 179
| _ => error ("Unsupported binding function: " ^ (PolyML.makestring t))
+ − 180
*}
+ − 181
+ − 182
ML {*
+ − 183
fun find [] _ = error ("cannot find element")
+ − 184
| find ((x, z)::xs) y = if (Long_Name.base_name x) = y then z else find xs y
+ − 185
*}
+ − 186
+ − 187
ML {*
2122
+ − 188
fun prep_bn lthy dt_names dts eqs =
1941
+ − 189
let
+ − 190
fun aux eq =
+ − 191
let
+ − 192
val (lhs, rhs) = eq
+ − 193
|> strip_qnt_body "all"
+ − 194
|> HOLogic.dest_Trueprop
+ − 195
|> HOLogic.dest_eq
+ − 196
val (bn_fun, [cnstr]) = strip_comb lhs
+ − 197
val (_, ty) = dest_Free bn_fun
+ − 198
val (ty_name, _) = dest_Type (domain_type ty)
+ − 199
val dt_index = find_index (fn x => x = ty_name) dt_names
+ − 200
val (cnstr_head, cnstr_args) = strip_comb cnstr
+ − 201
val rhs_elements = strip_bn_fun rhs
+ − 202
val included = map (apfst (fn i => length (cnstr_args) - i - 1)) rhs_elements
+ − 203
in
+ − 204
(dt_index, (bn_fun, (cnstr_head, included)))
2122
+ − 205
end
1941
+ − 206
fun order dts i ts =
+ − 207
let
+ − 208
val dt = nth dts i
+ − 209
val cts = map (fn (x, _, _) => Binding.name_of x) ((fn (_, _, _, x) => x) dt)
+ − 210
val ts' = map (fn (x, y) => (fst (dest_Const x), y)) ts
+ − 211
in
+ − 212
map (find ts') cts
+ − 213
end
+ − 214
+ − 215
val unordered = AList.group (op=) (map aux eqs)
+ − 216
val unordered' = map (fn (x, y) => (x, AList.group (op=) y)) unordered
+ − 217
val ordered = map (fn (x, y) => (x, map (fn (v, z) => (v, order dts x z)) y)) unordered'
2118
+ − 218
val ordered' = flat (map (fn (ith, l) => map (fn (bn, data) => (bn, ith, data)) l) ordered)
2122
+ − 219
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 220
(*val _ = tracing ("eqs\n" ^ cat_lines (map (Syntax.string_of_term lthy) eqs))*)
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 221
(*val _ = tracing ("map eqs\n" ^ @{make_string} (map aux2 eqs))*)
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 222
(*val _ = tracing ("ordered'\n" ^ @{make_string} ordered')*)
1941
+ − 223
in
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 224
ordered'
1941
+ − 225
end
+ − 226
*}
+ − 227
+ − 228
ML {*
+ − 229
fun raw_nominal_decls dts bn_funs bn_eqs binds lthy =
+ − 230
let
+ − 231
val thy = ProofContext.theory_of lthy
+ − 232
val thy_name = Context.theory_name thy
+ − 233
+ − 234
val dt_names = map (fn (_, s, _, _) => Binding.name_of s) dts
+ − 235
val dt_full_names = map (Long_Name.qualify thy_name) dt_names
+ − 236
val dt_full_names' = add_raws dt_full_names
+ − 237
val dts_env = dt_full_names ~~ dt_full_names'
+ − 238
+ − 239
val cnstrs = get_cnstr_strs dts
+ − 240
val cnstrs_ty = get_typed_cnstrs dts
+ − 241
val cnstrs_full_names = map (Long_Name.qualify thy_name) cnstrs
+ − 242
val cnstrs_full_names' = map (fn (x, y) => Long_Name.qualify thy_name
+ − 243
(Long_Name.qualify (add_raw x) (add_raw y))) cnstrs_ty
+ − 244
val cnstrs_env = cnstrs_full_names ~~ cnstrs_full_names'
+ − 245
+ − 246
val bn_fun_strs = get_bn_fun_strs bn_funs
+ − 247
val bn_fun_strs' = add_raws bn_fun_strs
+ − 248
val bn_fun_env = bn_fun_strs ~~ bn_fun_strs'
+ − 249
val bn_fun_full_env = map (pairself (Long_Name.qualify thy_name))
+ − 250
(bn_fun_strs ~~ bn_fun_strs')
+ − 251
+ − 252
val (raw_dt_names, raw_dts) = rawify_dts dt_names dts dts_env
+ − 253
val (raw_bn_funs, raw_bn_eqs) = rawify_bn_funs dts_env cnstrs_env bn_fun_env bn_funs bn_eqs
+ − 254
val raw_bclauses = rawify_bclauses dts_env cnstrs_env bn_fun_full_env binds
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 255
val raw_bns = prep_bn lthy dt_full_names' raw_dts (map snd raw_bn_eqs)
1941
+ − 256
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 257
val (raw_dt_names, lthy1) = add_datatype_wrapper raw_dt_names raw_dts lthy
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 258
val (raw_bn_funs, raw_bn_eqs, lthy2) = add_primrec_wrapper raw_bn_funs raw_bn_eqs lthy1
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 259
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 260
val morphism_2_0 = ProofContext.export_morphism lthy2 lthy
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 261
fun export_fun f (t, n , l) = (f t, n, map (map (apsnd (Option.map f))) l);
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 262
val bn_funs_decls = map (export_fun (Morphism.term morphism_2_0)) raw_bns;
1941
+ − 263
in
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 264
(raw_dt_names, raw_bn_eqs, raw_bclauses, bn_funs_decls, raw_bns, lthy2)
1941
+ − 265
end
+ − 266
*}
+ − 267
2017
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 268
lemma equivp_hack: "equivp x"
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 269
sorry
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 270
ML {*
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 271
fun equivp_hack ctxt rel =
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 272
let
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 273
val thy = ProofContext.theory_of ctxt
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 274
val ty = domain_type (fastype_of rel)
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 275
val cty = ctyp_of thy ty
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 276
val ct = cterm_of thy rel
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 277
in
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 278
Drule.instantiate' [SOME cty] [SOME ct] @{thm equivp_hack}
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 279
end
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 280
*}
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 281
2023
+ − 282
ML {* val cheat_equivp = Unsynchronized.ref false *}
+ − 283
ML {* val cheat_fv_rsp = Unsynchronized.ref false *}
+ − 284
ML {* val cheat_alpha_bn_rsp = Unsynchronized.ref false *}
+ − 285
ML {* val cheat_supp_eq = Unsynchronized.ref false *}
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 286
2025
+ − 287
ML {*
+ − 288
fun remove_loop t =
+ − 289
let val _ = HOLogic.dest_eq (HOLogic.dest_Trueprop (prop_of t)) in t end
+ − 290
handle TERM _ => @{thm eqTrueI} OF [t]
+ − 291
*}
+ − 292
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 293
text {*
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 294
nominal_datatype2 does the following things in order:
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 295
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 296
Parser.thy/raw_nominal_decls
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 297
1) define the raw datatype
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 298
2) define the raw binding functions
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 299
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 300
Perm.thy/define_raw_perms
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 301
3) define permutations of the raw datatype and show that the raw type is
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 302
in the pt typeclass
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 303
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 304
Lift.thy/define_fv_alpha_export, Fv.thy/define_fv & define_alpha
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 305
4) define fv and fv_bn
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 306
5) define alpha and alpha_bn
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 307
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 308
Perm.thy/distinct_rel
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 309
6) prove alpha_distincts (C1 x \<notsimeq> C2 y ...) (Proof by cases; simp)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 310
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 311
Tacs.thy/build_rel_inj
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 312
6) prove alpha_eq_iff (C1 x = C2 y \<leftrightarrow> P x y ...)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 313
(left-to-right by intro rule, right-to-left by cases; simp)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 314
Equivp.thy/prove_eqvt
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 315
7) prove bn_eqvt (common induction on the raw datatype)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 316
8) prove fv_eqvt (common induction on the raw datatype with help of above)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 317
Rsp.thy/build_alpha_eqvts
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 318
9) prove alpha_eqvt and alpha_bn_eqvt
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 319
(common alpha-induction, unfolding alpha_gen, permute of #* and =)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 320
Equivp.thy/build_alpha_refl & Equivp.thy/build_equivps
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 321
10) prove that alpha and alpha_bn are equivalence relations
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 322
(common induction and application of 'compose' lemmas)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 323
Lift.thy/define_quotient_types
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 324
11) define quotient types
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 325
Rsp.thy/build_fvbv_rsps
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 326
12) prove bn respects (common induction and simp with alpha_gen)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 327
Rsp.thy/prove_const_rsp
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 328
13) prove fv respects (common induction and simp with alpha_gen)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 329
14) prove permute respects (unfolds to alpha_eqvt)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 330
Rsp.thy/prove_alpha_bn_rsp
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 331
15) prove alpha_bn respects
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 332
(alpha_induct then cases then sym and trans of the relations)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 333
Rsp.thy/prove_alpha_alphabn
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 334
16) show that alpha implies alpha_bn (by unduction, needed in following step)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 335
Rsp.thy/prove_const_rsp
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 336
17) prove respects for all datatype constructors
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 337
(unfold eq_iff and alpha_gen; introduce zero permutations; simp)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 338
Perm.thy/quotient_lift_consts_export
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 339
18) define lifted constructors, fv, bn, alpha_bn, permutations
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 340
Perm.thy/define_lifted_perms
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 341
19) lift permutation zero and add properties to show that quotient type is in the pt typeclass
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 342
Lift.thy/lift_thm
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 343
20) lift permutation simplifications
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 344
21) lift induction
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 345
22) lift fv
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 346
23) lift bn
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 347
24) lift eq_iff
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 348
25) lift alpha_distincts
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 349
26) lift fv and bn eqvts
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 350
Equivp.thy/prove_supports
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 351
27) prove that union of arguments supports constructors
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 352
Equivp.thy/prove_fs
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 353
28) show that the lifted type is in fs typeclass (* by q_induct, supports *)
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 354
Equivp.thy/supp_eq
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 355
29) prove supp = fv
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 356
*}
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 357
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 358
ML {*
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 359
(* for testing porposes - to exit the procedure early *)
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 360
exception TEST of Proof.context
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 361
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 362
val (STEPS, STEPS_setup) = Attrib.config_int "STEPS" (K 10);
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 363
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 364
fun get_STEPS ctxt = Config.get ctxt STEPS
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 365
*}
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 366
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 367
setup STEPS_setup
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 368
1941
+ − 369
ML {*
+ − 370
fun nominal_datatype2 dts bn_funs bn_eqs bclauses lthy =
+ − 371
let
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 372
(* definition of the raw datatypes and raw bn-functions *)
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 373
val (raw_dt_names, raw_bn_eqs, raw_bclauses, raw_bns, raw_bns2, lthy1) =
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 374
if get_STEPS lthy > 1 then raw_nominal_decls dts bn_funs bn_eqs bclauses lthy
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 375
else raise TEST lthy
1941
+ − 376
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 377
(*val _ = tracing ("exported: " ^ commas (map @{make_string} raw_bns))*)
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 378
(*val _ = tracing ("plain: " ^ commas (map @{make_string} raw_bns2))*)
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 379
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 380
val dtinfo = Datatype.the_info (ProofContext.theory_of lthy1) (hd raw_dt_names)
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 381
val {descr, sorts, ...} = dtinfo
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 382
val all_tys = map (fn (i, _) => nth_dtyp descr sorts i) descr
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 383
val all_full_tnames = map (fn (_, (n, _, _)) => n) descr
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 384
val dtinfos = map (Datatype.the_info (ProofContext.theory_of lthy1)) all_full_tnames
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 385
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 386
val inject_thms = flat (map #inject dtinfos);
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 387
val distinct_thms = flat (map #distinct dtinfos);
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 388
val rel_dtinfos = List.take (dtinfos, (length dts));
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 389
val rel_distinct = map #distinct rel_dtinfos; (* thm list list *)
2047
+ − 390
val induct_thm = #induct dtinfo;
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 391
val exhaust_thms = map #exhaust dtinfos;
1999
+ − 392
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 393
(* definitions of raw permutations *)
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 394
val ((perms, raw_perm_defs, raw_perm_simps), lthy2) =
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 395
if get_STEPS lthy1 > 2
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 396
then Local_Theory.theory_result (define_raw_perms descr sorts induct_thm (length dts)) lthy1
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 397
else raise TEST lthy1
2144
+ − 398
+ − 399
(* noting the raw permutations as eqvt theorems *)
+ − 400
val eqvt_attrib = Attrib.internal (K Nominal_ThmDecls.eqvt_add)
+ − 401
val (_, lthy2a) = Local_Theory.note ((Binding.empty, [eqvt_attrib]), raw_perm_defs) lthy2
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 402
2105
+ − 403
val thy = Local_Theory.exit_global lthy2a;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 404
val thy_name = Context.theory_name thy
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 405
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 406
(* definition of raw fv_functions *)
1960
+ − 407
val lthy3 = Theory_Target.init NONE thy;
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 408
val raw_bn_funs = map (fn (f, _, _) => f) raw_bns;
1960
+ − 409
2146
+ − 410
val (fv, fvbn, fv_def, lthy3a) =
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 411
if get_STEPS lthy2 > 3
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 412
then define_raw_fvs descr sorts raw_bns raw_bns2 raw_bclauses lthy3
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 413
else raise TEST lthy3
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 414
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 415
(* definition of raw alphas *)
1999
+ − 416
val (((alpha_ts, alpha_intros), (alpha_cases, alpha_induct)), lthy4) =
2125
60ee289a8c63
made out of STEPS a configuration value so that it can be set individually in each file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 417
if get_STEPS lthy > 4
2142
c39d4fe31100
moved the exporting part into the parser (this is still a hack); re-added CoreHaskell again to the examples - there seems to be a problem with the variable name pat
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 418
then define_raw_alpha dtinfo raw_bns raw_bclauses fv lthy3a
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 419
else raise TEST lthy3a
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 420
1999
+ − 421
val (alpha_ts_nobn, alpha_ts_bn) = chop (length fv) alpha_ts
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 422
2000
+ − 423
val dts_names = map (fn (i, (s, _, _)) => (s, i)) (#descr dtinfo);
+ − 424
val bn_tys = map (domain_type o fastype_of) raw_bn_funs;
+ − 425
val bn_nos = map (dtyp_no_of_typ dts_names) bn_tys;
+ − 426
val bns = raw_bn_funs ~~ bn_nos;
+ − 427
val rel_dists = flat (map (distinct_rel lthy4 alpha_cases)
+ − 428
(rel_distinct ~~ alpha_ts_nobn));
+ − 429
val rel_dists_bn = flat (map (distinct_rel lthy4 alpha_cases)
+ − 430
((map (fn i => nth rel_distinct i) bn_nos) ~~ alpha_ts_bn))
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 431
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 432
(* definition of raw_alpha_eq_iff lemmas *)
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 433
val alpha_eq_iff = build_rel_inj alpha_intros (inject_thms @ distinct_thms) alpha_cases lthy4
2025
+ − 434
val alpha_eq_iff_simp = map remove_loop alpha_eq_iff;
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 435
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 436
(*val _ = map tracing (map PolyML.makestring alpha_eq_iff_simp);*)
2022
+ − 437
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 438
(* proving equivariance lemmas *)
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 439
val _ = warning "Proving equivariance";
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 440
val (bv_eqvt, lthy5) = prove_eqvt all_tys induct_thm (raw_bn_eqs @ raw_perm_defs) (map fst bns) lthy4
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 441
val (fv_eqvt, lthy6) = prove_eqvt all_tys induct_thm (fv_def @ raw_perm_defs) (fv @ fvbn) lthy5
2114
+ − 442
val (alpha_eqvt, lthy6a) = Nominal_Eqvt.equivariance alpha_ts alpha_induct alpha_intros lthy6;
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 443
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 444
(* proving alpha equivalence *)
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 445
val _ = warning "Proving equivalence";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 446
val fv_alpha_all = combine_fv_alpha_bns (fv, fvbn) (alpha_ts_nobn, alpha_ts_bn) bn_nos;
2114
+ − 447
val reflps = build_alpha_refl fv_alpha_all alpha_ts induct_thm alpha_eq_iff_simp lthy6a;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 448
val alpha_equivp =
2114
+ − 449
if !cheat_equivp then map (equivp_hack lthy6a) alpha_ts
2017
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 450
else build_equivps alpha_ts reflps alpha_induct
2114
+ − 451
inject_thms alpha_eq_iff_simp distinct_thms alpha_cases alpha_eqvt lthy6a;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 452
val qty_binds = map (fn (_, b, _, _) => b) dts;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 453
val qty_names = map Name.of_binding qty_binds;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 454
val qty_full_names = map (Long_Name.qualify thy_name) qty_names
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 455
val (qtys, lthy7) = define_quotient_types qty_binds all_tys alpha_ts_nobn alpha_equivp lthy6a;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 456
val const_names = map Name.of_binding (flat (map (fn (_, _, _, t) => map (fn (b, _, _) => b) t) dts));
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 457
val raw_consts =
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 458
flat (map (fn (i, (_, _, l)) =>
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 459
map (fn (cname, dts) =>
2016
+ − 460
Const (cname, map (Datatype_Aux.typ_of_dtyp descr sorts) dts --->
+ − 461
Datatype_Aux.typ_of_dtyp descr sorts (Datatype_Aux.DtRec i))) l) descr);
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 462
val (consts, const_defs, lthy8) = quotient_lift_consts_export qtys (const_names ~~ raw_consts) lthy7;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 463
val _ = warning "Proving respects";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 464
val bns_rsp_pre' = build_fvbv_rsps alpha_ts alpha_induct raw_bn_eqs (map fst bns) lthy8;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 465
val (bns_rsp_pre, lthy9) = fold_map (
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 466
fn (bn_t, _) => prove_const_rsp qtys Binding.empty [bn_t] (fn _ =>
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 467
resolve_tac bns_rsp_pre' 1)) bns lthy8;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 468
val bns_rsp = flat (map snd bns_rsp_pre);
2017
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 469
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 470
fun fv_rsp_tac _ = if !cheat_fv_rsp then Skip_Proof.cheat_tac thy
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 471
else fvbv_rsp_tac alpha_induct fv_def lthy8 1;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 472
val fv_rsps = prove_fv_rsp fv_alpha_all alpha_ts fv_rsp_tac lthy9;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 473
val (fv_rsp_pre, lthy10) = fold_map
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 474
(fn fv => fn ctxt => prove_const_rsp qtys Binding.empty [fv]
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 475
(fn _ => asm_simp_tac (HOL_ss addsimps fv_rsps) 1) ctxt) (fv @ fvbn) lthy9;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 476
val fv_rsp = flat (map snd fv_rsp_pre);
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 477
val (perms_rsp, lthy11) = prove_const_rsp qtys Binding.empty perms
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 478
(fn _ => asm_simp_tac (HOL_ss addsimps alpha_eqvt) 1) lthy10;
2023
+ − 479
fun alpha_bn_rsp_tac _ = if !cheat_alpha_bn_rsp then Skip_Proof.cheat_tac thy
+ − 480
else
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 481
let val alpha_bn_rsp_pre = prove_alpha_bn_rsp alpha_ts alpha_induct (alpha_eq_iff_simp @ rel_dists @ rel_dists_bn) alpha_equivp exhaust_thms alpha_ts_bn lthy11 in asm_simp_tac (HOL_ss addsimps alpha_bn_rsp_pre) 1 end;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 482
val (alpha_bn_rsps, lthy11a) = fold_map (fn cnst => prove_const_rsp qtys Binding.empty [cnst]
2023
+ − 483
alpha_bn_rsp_tac) alpha_ts_bn lthy11
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 484
fun const_rsp_tac _ =
2022
+ − 485
let val alpha_alphabn = prove_alpha_alphabn alpha_ts alpha_induct alpha_eq_iff_simp alpha_ts_bn lthy11a
+ − 486
in constr_rsp_tac alpha_eq_iff_simp (fv_rsp @ bns_rsp @ reflps @ alpha_alphabn) 1 end
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 487
val (const_rsps, lthy12) = fold_map (fn cnst => prove_const_rsp qtys Binding.empty [cnst]
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 488
const_rsp_tac) raw_consts lthy11a
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 489
val qfv_names = map (unsuffix "_raw" o Long_Name.base_name o fst o dest_Const) (fv @ fvbn)
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 490
val (qfv_ts, qfv_defs, lthy12a) = quotient_lift_consts_export qtys (qfv_names ~~ (fv @ fvbn)) lthy12;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 491
val (qfv_ts_nobn, qfv_ts_bn) = chop (length perms) qfv_ts;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 492
val qbn_names = map (fn (b, _ , _) => Name.of_binding b) bn_funs
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 493
val (qbn_ts, qbn_defs, lthy12b) = quotient_lift_consts_export qtys (qbn_names ~~ raw_bn_funs) lthy12a;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 494
val qalpha_bn_names = map (unsuffix "_raw" o Long_Name.base_name o fst o dest_Const) alpha_ts_bn
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 495
val (qalpha_ts_bn, qalphabn_defs, lthy12c) =
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 496
quotient_lift_consts_export qtys (qalpha_bn_names ~~ alpha_ts_bn) lthy12b;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 497
val _ = warning "Lifting permutations";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 498
val thy = Local_Theory.exit_global lthy12c;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 499
val perm_names = map (fn x => "permute_" ^ x) qty_names
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 500
val thy' = define_lifted_perms qtys qty_full_names (perm_names ~~ perms) raw_perm_simps thy;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 501
val lthy13 = Theory_Target.init NONE thy';
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 502
val q_name = space_implode "_" qty_names;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 503
fun suffix_bind s = Binding.qualify true q_name (Binding.name s);
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 504
val _ = warning "Lifting induction";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 505
val constr_names = map (Long_Name.base_name o fst o dest_Const) consts;
2047
+ − 506
val q_induct = Rule_Cases.name constr_names (lift_thm qtys lthy13 induct_thm);
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 507
fun note_suffix s th ctxt =
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 508
snd (Local_Theory.note ((suffix_bind s, []), th) ctxt);
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 509
fun note_simp_suffix s th ctxt =
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 510
snd (Local_Theory.note ((suffix_bind s, [Attrib.internal (K Simplifier.simp_add)]), th) ctxt);
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 511
val (_, lthy14) = Local_Theory.note ((suffix_bind "induct",
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 512
[Attrib.internal (K (Rule_Cases.case_names constr_names))]),
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 513
[Rule_Cases.name constr_names q_induct]) lthy13;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 514
val q_inducts = Project_Rule.projects lthy13 (1 upto (length fv)) q_induct
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 515
val (_, lthy14a) = Local_Theory.note ((suffix_bind "inducts", []), q_inducts) lthy14;
2143
871d8a5e0c67
somewhat simplified the main parsing function; failed to move a Note-statement to define_raw_perms
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 516
val q_perm = map (lift_thm qtys lthy14) raw_perm_defs;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 517
val lthy15 = note_simp_suffix "perm" q_perm lthy14a;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 518
val q_fv = map (lift_thm qtys lthy15) fv_def;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 519
val lthy16 = note_simp_suffix "fv" q_fv lthy15;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 520
val q_bn = map (lift_thm qtys lthy16) raw_bn_eqs;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 521
val lthy17 = note_simp_suffix "bn" q_bn lthy16;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 522
val _ = warning "Lifting eq-iff";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 523
(*val _ = map tracing (map PolyML.makestring alpha_eq_iff);*)
2089
+ − 524
val eq_iff_unfolded0 = map (Local_Defs.unfold lthy17 @{thms alphas}) alpha_eq_iff_simp
+ − 525
val eq_iff_unfolded1 = map (Local_Defs.unfold lthy17 @{thms Pair_eqvt}) eq_iff_unfolded0
+ − 526
val q_eq_iff_pre0 = map (lift_thm qtys lthy17) eq_iff_unfolded1;
+ − 527
val q_eq_iff_pre1 = map (Local_Defs.fold lthy17 @{thms Pair_eqvt}) q_eq_iff_pre0
+ − 528
val q_eq_iff_pre2 = map (Local_Defs.fold lthy17 @{thms alphas}) q_eq_iff_pre1
+ − 529
val q_eq_iff = map (Local_Defs.unfold lthy17 (Quotient_Info.id_simps_get lthy17)) q_eq_iff_pre2
2025
+ − 530
val (_, lthy18) = Local_Theory.note ((suffix_bind "eq_iff", []), q_eq_iff) lthy17;
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 531
val q_dis = map (lift_thm qtys lthy18) rel_dists;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 532
val lthy19 = note_simp_suffix "distinct" q_dis lthy18;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 533
val q_eqvt = map (lift_thm qtys lthy19) (bv_eqvt @ fv_eqvt);
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 534
val (_, lthy20) = Local_Theory.note ((Binding.empty,
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 535
[Attrib.internal (fn _ => Nominal_ThmDecls.eqvt_add)]), q_eqvt) lthy19;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 536
val _ = warning "Supports";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 537
val supports = map (prove_supports lthy20 q_perm) consts;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 538
val fin_supp = HOLogic.conj_elims (prove_fs lthy20 q_induct supports qtys);
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 539
val thy3 = Local_Theory.exit_global lthy20;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 540
val _ = warning "Instantiating FS";
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 541
val lthy21 = Theory_Target.instantiation (qty_full_names, [], @{sort fs}) thy3;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 542
fun tac _ = Class.intro_classes_tac [] THEN (ALLGOALS (resolve_tac fin_supp))
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 543
val lthy22 = Class.prove_instantiation_instance tac lthy21
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 544
val fv_alpha_all = combine_fv_alpha_bns (qfv_ts_nobn, qfv_ts_bn) (alpha_ts_nobn, qalpha_ts_bn) bn_nos;
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 545
val (names, supp_eq_t) = supp_eq fv_alpha_all;
2020
+ − 546
val _ = warning "Support Equations";
2023
+ − 547
fun supp_eq_tac' _ = if !cheat_supp_eq then Skip_Proof.cheat_tac thy else
2025
+ − 548
supp_eq_tac q_induct q_fv q_perm q_eq_iff lthy22 1;
2023
+ − 549
val q_supp = HOLogic.conj_elims (Goal.prove lthy22 names [] supp_eq_t supp_eq_tac') handle e =>
+ − 550
let val _ = warning ("Support eqs failed") in [] end;
2020
+ − 551
val lthy23 = note_suffix "supp" q_supp lthy22;
1941
+ − 552
in
2020
+ − 553
(0, lthy23)
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 554
end handle TEST ctxt => (0, ctxt)
1941
+ − 555
*}
+ − 556
+ − 557
section {* Preparing and parsing of the specification *}
+ − 558
+ − 559
ML {*
+ − 560
(* parsing the datatypes and declaring *)
+ − 561
(* constructors in the local theory *)
+ − 562
fun prepare_dts dt_strs lthy =
+ − 563
let
+ − 564
val thy = ProofContext.theory_of lthy
+ − 565
+ − 566
fun mk_type full_tname tvrs =
+ − 567
Type (full_tname, map (fn a => TVar ((a, 0), [])) tvrs)
+ − 568
+ − 569
fun prep_cnstr full_tname tvs (cname, anno_tys, mx, _) =
+ − 570
let
+ − 571
val tys = map (Syntax.read_typ lthy o snd) anno_tys
+ − 572
val ty = mk_type full_tname tvs
+ − 573
in
+ − 574
((cname, tys ---> ty, mx), (cname, tys, mx))
+ − 575
end
+ − 576
+ − 577
fun prep_dt (tvs, tname, mx, cnstrs) =
+ − 578
let
+ − 579
val full_tname = Sign.full_name thy tname
+ − 580
val (cnstrs', cnstrs'') =
+ − 581
split_list (map (prep_cnstr full_tname tvs) cnstrs)
+ − 582
in
+ − 583
(cnstrs', (tvs, tname, mx, cnstrs''))
+ − 584
end
+ − 585
+ − 586
val (cnstrs, dts) = split_list (map prep_dt dt_strs)
+ − 587
in
+ − 588
lthy
+ − 589
|> Local_Theory.theory (Sign.add_consts_i (flat cnstrs))
+ − 590
|> pair dts
+ − 591
end
+ − 592
*}
+ − 593
+ − 594
ML {*
+ − 595
(* parsing the binding function specification and *)
+ − 596
(* declaring the functions in the local theory *)
+ − 597
fun prepare_bn_funs bn_fun_strs bn_eq_strs lthy =
+ − 598
let
+ − 599
val ((bn_funs, bn_eqs), _) =
+ − 600
Specification.read_spec bn_fun_strs bn_eq_strs lthy
+ − 601
+ − 602
fun prep_bn_fun ((bn, T), mx) = (bn, T, mx)
+ − 603
+ − 604
val bn_funs' = map prep_bn_fun bn_funs
+ − 605
in
+ − 606
lthy
+ − 607
|> Local_Theory.theory (Sign.add_consts_i bn_funs')
+ − 608
|> pair (bn_funs', bn_eqs)
+ − 609
end
+ − 610
*}
+ − 611
+ − 612
text {* associates every SOME with the index in the list; drops NONEs *}
+ − 613
ML {*
+ − 614
fun indexify xs =
+ − 615
let
+ − 616
fun mapp _ [] = []
+ − 617
| mapp i (NONE :: xs) = mapp (i + 1) xs
+ − 618
| mapp i (SOME x :: xs) = (x, i) :: mapp (i + 1) xs
+ − 619
in
+ − 620
mapp 0 xs
+ − 621
end
+ − 622
+ − 623
fun index_lookup xs x =
+ − 624
case AList.lookup (op=) xs x of
+ − 625
SOME x => x
+ − 626
| NONE => error ("Cannot find " ^ x ^ " as argument annotation.");
+ − 627
*}
+ − 628
+ − 629
ML {*
+ − 630
fun prepare_bclauses dt_strs lthy =
+ − 631
let
+ − 632
val annos_bclauses =
+ − 633
get_cnstrs dt_strs
+ − 634
|> map (map (fn (_, antys, _, bns) => (map fst antys, bns)))
+ − 635
+ − 636
fun prep_binder env bn_str =
+ − 637
case (Syntax.read_term lthy bn_str) of
+ − 638
Free (x, _) => (NONE, index_lookup env x)
+ − 639
| Const (a, T) $ Free (x, _) => (SOME (Const (a, T)), index_lookup env x)
+ − 640
| _ => error ("The term " ^ bn_str ^ " is not allowed as binding function.")
+ − 641
+ − 642
fun prep_body env bn_str = index_lookup env bn_str
+ − 643
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 644
fun prep_mode "bind" = Lst
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 645
| prep_mode "bind_set" = Set
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 646
| prep_mode "bind_res" = Res
1941
+ − 647
+ − 648
fun prep_bclause env (mode, binders, bodies) =
+ − 649
let
+ − 650
val binders' = map (prep_binder env) binders
+ − 651
val bodies' = map (prep_body env) bodies
+ − 652
in
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 653
BC (prep_mode mode, binders', bodies')
1941
+ − 654
end
+ − 655
+ − 656
fun prep_bclauses (annos, bclause_strs) =
+ − 657
let
+ − 658
val env = indexify annos (* for every label, associate the index *)
+ − 659
in
+ − 660
map (prep_bclause env) bclause_strs
+ − 661
end
+ − 662
in
+ − 663
map (map prep_bclauses) annos_bclauses
+ − 664
end
+ − 665
*}
+ − 666
1943
+ − 667
text {*
+ − 668
adds an empty binding clause for every argument
+ − 669
that is not already part of a binding clause
+ − 670
*}
+ − 671
1941
+ − 672
ML {*
+ − 673
fun included i bcs =
+ − 674
let
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 675
fun incl (BC (_, bns, bds)) = (member (op =) (map snd bns) i) orelse (member (op =) bds i)
1941
+ − 676
in
+ − 677
exists incl bcs
+ − 678
end
+ − 679
*}
+ − 680
+ − 681
ML {*
+ − 682
fun complete dt_strs bclauses =
+ − 683
let
+ − 684
val args =
+ − 685
get_cnstrs dt_strs
+ − 686
|> map (map (fn (_, antys, _, _) => length antys))
+ − 687
+ − 688
fun complt n bcs =
+ − 689
let
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 690
fun add bcs i = (if included i bcs then [] else [BC (Lst, [], [i])])
1941
+ − 691
in
+ − 692
bcs @ (flat (map_range (add bcs) n))
+ − 693
end
+ − 694
in
+ − 695
map2 (map2 complt) args bclauses
+ − 696
end
+ − 697
*}
+ − 698
+ − 699
ML {*
+ − 700
fun nominal_datatype2_cmd (dt_strs, bn_fun_strs, bn_eq_strs) lthy =
+ − 701
let
+ − 702
fun prep_typ (tvs, tname, mx, _) = (tname, length tvs, mx)
+ − 703
val lthy0 =
+ − 704
Local_Theory.theory (Sign.add_types (map prep_typ dt_strs)) lthy
1944
+ − 705
val (dts, lthy1) = prepare_dts dt_strs lthy0
+ − 706
val ((bn_funs, bn_eqs), lthy2) = prepare_bn_funs bn_fun_strs bn_eq_strs lthy1
1941
+ − 707
val bclauses = prepare_bclauses dt_strs lthy2
+ − 708
val bclauses' = complete dt_strs bclauses
+ − 709
in
+ − 710
nominal_datatype2 dts bn_funs bn_eqs bclauses' lthy |> snd
+ − 711
end
+ − 712
+ − 713
+ − 714
(* Command Keyword *)
+ − 715
+ − 716
val _ = OuterSyntax.local_theory "nominal_datatype" "test" OuterKeyword.thy_decl
+ − 717
(main_parser >> nominal_datatype2_cmd)
+ − 718
*}
+ − 719
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 720
(*
2035
3622cae9b10e
to my best knowledge the number of datatypes is equal to the length of the dt_descr; so we can save one argument in define_raw_perm
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 721
atom_decl name
1941
+ − 722
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 723
nominal_datatype lam =
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 724
Var name
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 725
| App lam lam
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 726
| Lam x::name t::lam bind_set x in t
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 727
| Let p::pt t::lam bind_set "bn p" in t
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 728
and pt =
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 729
P1 name
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 730
| P2 pt pt
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 731
binder
1981
+ − 732
bn::"pt \<Rightarrow> atom set"
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 733
where
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 734
"bn (P1 x) = {atom x}"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 735
| "bn (P2 p1 p2) = bn p1 \<union> bn p2"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 736
2046
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 737
find_theorems Var_raw
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 738
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 739
73c50e913db6
tuned and added some comments to the code; added also an exception for early exit of the nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 740
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 741
thm lam_pt.bn
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 742
thm lam_pt.fv[simplified lam_pt.supp(1-2)]
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 743
thm lam_pt.eq_iff
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 744
thm lam_pt.induct
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 745
thm lam_pt.perm
1941
+ − 746
+ − 747
nominal_datatype exp =
+ − 748
EVar name
+ − 749
| EUnit
1988
+ − 750
| EPair q1::exp q2::exp
1941
+ − 751
| ELetRec l::lrbs e::exp bind "b_lrbs l" in e l
+ − 752
+ − 753
and fnclause =
1988
+ − 754
K x::name p::pat f::exp bind_res "b_pat p" in f
1941
+ − 755
+ − 756
and fnclauses =
+ − 757
S fnclause
+ − 758
| ORs fnclause fnclauses
+ − 759
+ − 760
and lrb =
+ − 761
Clause fnclauses
+ − 762
+ − 763
and lrbs =
+ − 764
Single lrb
+ − 765
| More lrb lrbs
+ − 766
+ − 767
and pat =
+ − 768
PVar name
+ − 769
| PUnit
+ − 770
| PPair pat pat
+ − 771
+ − 772
binder
1988
+ − 773
b_lrbs :: "lrbs \<Rightarrow> atom list" and
1941
+ − 774
b_pat :: "pat \<Rightarrow> atom set" and
1988
+ − 775
b_fnclauses :: "fnclauses \<Rightarrow> atom list" and
+ − 776
b_fnclause :: "fnclause \<Rightarrow> atom list" and
+ − 777
b_lrb :: "lrb \<Rightarrow> atom list"
1941
+ − 778
+ − 779
where
+ − 780
"b_lrbs (Single l) = b_lrb l"
1988
+ − 781
| "b_lrbs (More l ls) = append (b_lrb l) (b_lrbs ls)"
1941
+ − 782
| "b_pat (PVar x) = {atom x}"
+ − 783
| "b_pat (PUnit) = {}"
+ − 784
| "b_pat (PPair p1 p2) = b_pat p1 \<union> b_pat p2"
+ − 785
| "b_fnclauses (S fc) = (b_fnclause fc)"
1988
+ − 786
| "b_fnclauses (ORs fc fcs) = append (b_fnclause fc) (b_fnclauses fcs)"
1941
+ − 787
| "b_lrb (Clause fcs) = (b_fnclauses fcs)"
1988
+ − 788
| "b_fnclause (K x pat exp) = [atom x]"
1941
+ − 789
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 790
thm exp_fnclause_fnclauses_lrb_lrbs_pat.bn
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 791
thm exp_fnclause_fnclauses_lrb_lrbs_pat.fv
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 792
thm exp_fnclause_fnclauses_lrb_lrbs_pat.eq_iff
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 793
thm exp_fnclause_fnclauses_lrb_lrbs_pat.induct
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 794
thm exp_fnclause_fnclauses_lrb_lrbs_pat.perm
1945
+ − 795
1988
+ − 796
nominal_datatype ty =
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 797
Vr "name"
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 798
| Fn "ty" "ty"
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 799
and tys =
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 800
Al xs::"name fset" t::"ty" bind_res xs in t
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 801
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 802
thm ty_tys.fv[simplified ty_tys.supp]
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 803
thm ty_tys.eq_iff
2011
12ce87b55f97
tried to add some comments in the huge(!) nominal2_cmd function
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 804
2017
6a4049e1d68d
Add explicit cheats in NewParser and comment out the examples for outside use.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 805
*)
2001
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 806
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 807
(* some further tests *)
7c8242a02f39
NewParser with Parser functionality, but some cheats included since the order of datayupes is wrong.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 808
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 809
(*
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 810
nominal_datatype ty2 =
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 811
Vr2 "name"
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 812
| Fn2 "ty2" "ty2"
1988
+ − 813
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 814
nominal_datatype tys2 =
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 815
All2 xs::"name fset" ty::"ty2" bind_res xs in ty
1964
+ − 816
1971
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 817
nominal_datatype lam2 =
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 818
Var2 "name"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 819
| App2 "lam2" "lam2 list"
8daf6ff5e11a
simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 820
| Lam2 x::"name" t::"lam2" bind x in t
2008
1bddffddc03f
attempted to remove dependency on (old) Fv and (old) Parser; lifting still uses Fv.thy; the examples do not work at the moment (with equivp proofs failing)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 821
*)
1964
+ − 822
1941
+ − 823
+ − 824
+ − 825
end
+ − 826
+ − 827
+ − 828