src/HOL/Nominal/nominal_primrec.ML
changeset 33671 4b0f2599ed48
parent 33670 02b7738aef6a
child 33726 0878aecbf119
equal deleted inserted replaced
33670:02b7738aef6a 33671:4b0f2599ed48
   278     val names2 = map fst eqns;
   278     val names2 = map fst eqns;
   279     val _ = if eq_set (op =) (names1, names2) then ()
   279     val _ = if eq_set (op =) (names1, names2) then ()
   280       else primrec_err ("functions " ^ commas_quote names2 ^
   280       else primrec_err ("functions " ^ commas_quote names2 ^
   281         "\nare not mutually recursive");
   281         "\nare not mutually recursive");
   282     val (defs_thms, lthy') = lthy |>
   282     val (defs_thms, lthy') = lthy |>
   283       set_group ? LocalTheory.set_group (serial ()) |>
   283       set_group ? Local_Theory.set_group (serial ()) |>
   284       fold_map (apfst (snd o snd) oo
   284       fold_map (apfst (snd o snd) oo Local_Theory.define Thm.definitionK o fst) defs';
   285         LocalTheory.define Thm.definitionK o fst) defs';
       
   286     val qualify = Binding.qualify false
   285     val qualify = Binding.qualify false
   287       (space_implode "_" (map (Long_Name.base_name o #1) defs));
   286       (space_implode "_" (map (Long_Name.base_name o #1) defs));
   288     val names_atts' = map (apfst qualify) names_atts;
   287     val names_atts' = map (apfst qualify) names_atts;
   289     val cert = cterm_of (ProofContext.theory_of lthy');
   288     val cert = cterm_of (ProofContext.theory_of lthy');
   290 
   289 
   365     Variable.add_fixes (map fst lsrs) |> snd |>
   364     Variable.add_fixes (map fst lsrs) |> snd |>
   366     Proof.theorem_i NONE
   365     Proof.theorem_i NONE
   367       (fn thss => fn goal_ctxt =>
   366       (fn thss => fn goal_ctxt =>
   368          let
   367          let
   369            val simps = ProofContext.export goal_ctxt lthy' (flat thss);
   368            val simps = ProofContext.export goal_ctxt lthy' (flat thss);
   370            val (simps', lthy'') = fold_map LocalTheory.note (names_atts' ~~ map single simps) lthy';
   369            val (simps', lthy'') =
       
   370             fold_map Local_Theory.note (names_atts' ~~ map single simps) lthy';
   371          in
   371          in
   372            lthy''
   372            lthy''
   373            |> LocalTheory.note ((qualify (Binding.name "simps"),
   373            |> Local_Theory.note ((qualify (Binding.name "simps"),
   374                 map (Attrib.internal o K) [Simplifier.simp_add, Nitpick_Simps.add]),
   374                 map (Attrib.internal o K) [Simplifier.simp_add, Nitpick_Simps.add]),
   375                 maps snd simps')
   375                 maps snd simps')
   376            |> snd
   376            |> snd
   377          end)
   377          end)
   378       [goals] |>
   378       [goals] |>