src/HOL/Tools/old_primrec.ML
changeset 35845 e5980f0ad025
parent 35756 cfde251d03a5
child 36610 bafd82950e24
equal deleted inserted replaced
35844:65258d2c3214 35845:e5980f0ad025
    33 (*the following code ensures that each recursive set always has the
    33 (*the following code ensures that each recursive set always has the
    34   same type in all introduction rules*)
    34   same type in all introduction rules*)
    35 fun unify_consts thy cs intr_ts =
    35 fun unify_consts thy cs intr_ts =
    36   (let
    36   (let
    37     fun varify t (i, ts) =
    37     fun varify t (i, ts) =
    38       let val t' = map_types (Logic.incr_tvar (i + 1)) (snd (Type.varify [] t))
    38       let val t' = map_types (Logic.incr_tvar (i + 1)) (snd (Type.varify_global [] t))
    39       in (maxidx_of_term t', t'::ts) end;
    39       in (maxidx_of_term t', t'::ts) end;
    40     val (i, cs') = fold_rev varify cs (~1, []);
    40     val (i, cs') = fold_rev varify cs (~1, []);
    41     val (i', intr_ts') = fold_rev varify intr_ts (i, []);
    41     val (i', intr_ts') = fold_rev varify intr_ts (i, []);
    42     val rec_consts = fold Term.add_consts cs' [];
    42     val rec_consts = fold Term.add_consts cs' [];
    43     val intr_consts = fold Term.add_consts intr_ts' [];
    43     val intr_consts = fold Term.add_consts intr_ts' [];
   279         (fn _ => EVERY [rewrite_goals_tac rewrites, rtac refl 1])) eqns;
   279         (fn _ => EVERY [rewrite_goals_tac rewrites, rtac refl 1])) eqns;
   280     val (simps', thy'') =
   280     val (simps', thy'') =
   281       thy'
   281       thy'
   282       |> fold_map note ((map fst eqns ~~ atts) ~~ map single simps);
   282       |> fold_map note ((map fst eqns ~~ atts) ~~ map single simps);
   283     val simps'' = maps snd simps';
   283     val simps'' = maps snd simps';
   284     val lhss = map (Logic.varify o fst o Logic.dest_equals o snd) defs';
   284     val lhss = map (Logic.varify_global o fst o Logic.dest_equals o snd) defs';
   285   in
   285   in
   286     thy''
   286     thy''
   287     |> note (("simps",
   287     |> note (("simps",
   288         [Simplifier.simp_add, Nitpick_Simps.add, Code.add_default_eqn_attribute]), simps'')
   288         [Simplifier.simp_add, Nitpick_Simps.add, Code.add_default_eqn_attribute]), simps'')
   289     |> snd
   289     |> snd