src/HOL/Tools/inductive_package.ML
changeset 25114 7aa178165ee4
parent 25035 4bfae4c030be
child 25143 2a1acc88a180
equal deleted inserted replaced
25113:008c964dd47f 25114:7aa178165ee4
   813     val cs = map (Free o fst) cnames_syn';
   813     val cs = map (Free o fst) cnames_syn';
   814     val ps = map Free pnames;
   814     val ps = map Free pnames;
   815 
   815 
   816     val ctxt2 = lthy
   816     val ctxt2 = lthy
   817       |> Variable.add_fixes (map (fst o fst) cnames_syn') |> snd
   817       |> Variable.add_fixes (map (fst o fst) cnames_syn') |> snd
   818       |> fold (snd oo LocalDefs.add_def) abbrevs;
   818       |> fold (snd oo LocalDefs.fixed_abbrev) abbrevs;
   819     val expand = Assumption.export_term ctxt2 lthy;
   819     val expand = Assumption.export_term ctxt2 lthy #> ProofContext.cert_term lthy;
   820 
   820 
   821     fun close_rule r = list_all_free (rev (fold_aterms
   821     fun close_rule r = list_all_free (rev (fold_aterms
   822       (fn t as Free (v as (s, _)) =>
   822       (fn t as Free (v as (s, _)) =>
   823           if Variable.is_fixed ctxt1 s orelse
   823           if Variable.is_fixed ctxt1 s orelse
   824             member (op =) ps t then I else insert (op =) v
   824             member (op =) ps t then I else insert (op =) v
   832     ||> fold (snd oo LocalTheory.abbrev Syntax.mode_default) abbrevs
   832     ||> fold (snd oo LocalTheory.abbrev Syntax.mode_default) abbrevs
   833   end;
   833   end;
   834 
   834 
   835 fun gen_add_inductive mk_def verbose coind cnames_syn pnames_syn intro_srcs raw_monos lthy =
   835 fun gen_add_inductive mk_def verbose coind cnames_syn pnames_syn intro_srcs raw_monos lthy =
   836   let
   836   let
   837     val ((vars, specs), _) = lthy |> Specification.read_specification
   837     val ((vars, specs), _) = lthy |> ProofContext.set_mode ProofContext.mode_abbrev
   838       (cnames_syn @ pnames_syn) (map (fn (a, s) => [(a, [s])]) intro_srcs);
   838       |> Specification.read_specification
       
   839           (cnames_syn @ pnames_syn) (map (fn (a, s) => [(a, [s])]) intro_srcs);
   839     val (cs, ps) = chop (length cnames_syn) vars;
   840     val (cs, ps) = chop (length cnames_syn) vars;
   840     val intrs = map (apsnd the_single) specs;
   841     val intrs = map (apsnd the_single) specs;
   841     val monos = Attrib.eval_thms lthy raw_monos;
   842     val monos = Attrib.eval_thms lthy raw_monos;
   842     val flags = {verbose = verbose, kind = Thm.theoremK, alt_name = "",
   843     val flags = {verbose = verbose, kind = Thm.theoremK, alt_name = "",
   843       coind = coind, no_elim = false, no_ind = false};
   844       coind = coind, no_elim = false, no_ind = false};