Nominal/Lift.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Thu, 18 Mar 2010 08:03:42 +0100
changeset 1497 1c9931e5039a
parent 1494 923413256cbb
child 1498 2ff84b1f551f
permissions -rw-r--r--
Move most of the exporting out of the parser.

theory Lift
imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "Abs" "Perm" "Fv" "Rsp"
begin

ML {*
fun lift_thm ctxt thm =
let
  fun un_raw name = unprefix "_raw" name handle Fail _ => name
  fun add_under names = hd names :: (map (prefix "_") (tl names))
  fun un_raws name = implode (map un_raw (add_under (space_explode "_" name)))
  val un_raw_names = rename_vars un_raws
in
  un_raw_names (snd (Quotient_Tacs.lifted_attrib (Context.Proof ctxt, thm)))
end
*}

ML {*
fun quotient_lift_consts_export spec ctxt =
let
  val (result, ctxt') = fold_map Quotient_Def.quotient_lift_const spec ctxt;
  val (ts_loc, defs_loc) = split_list result;
  val morphism = ProofContext.export_morphism ctxt' ctxt;
  val ts = map (Morphism.term morphism) ts_loc
  val defs = Morphism.fact morphism defs_loc
in
  (ts, defs, ctxt')
end
*}

ML {*
fun define_fv_alpha_export dt binds bns ctxt =
let
  val (((fv_ts_loc, fv_def_loc), alpha), ctxt') =
    define_fv_alpha dt binds bns ctxt;
  val alpha_ts_loc = #preds alpha
  val alpha_induct_loc = #induct alpha
  val alpha_intros_loc = #intrs alpha;
  val alpha_cases_loc = #elims alpha
  val morphism = ProofContext.export_morphism ctxt' ctxt;
  val fv_ts = map (Morphism.term morphism) fv_ts_loc;
  val fv_def = Morphism.fact morphism fv_def_loc;
  val alpha_ts = map (Morphism.term morphism) alpha_ts_loc;
  val alpha_induct = Morphism.thm morphism alpha_induct_loc;
  val alpha_intros = Morphism.fact morphism alpha_intros_loc
  val alpha_cases = Morphism.fact morphism alpha_cases_loc
in
  (((fv_ts, fv_def), ((alpha_ts, alpha_intros), (alpha_cases, alpha_induct))), ctxt')
end;
*}

end