src/ZF/Tools/primrec_package.ML
changeset 28083 103d9282a946
parent 27691 ce171cbd4b93
child 28965 1de908189869
equal deleted inserted replaced
28082:37350f301128 28083:103d9282a946
     7 Package for defining functions on datatypes by primitive recursion
     7 Package for defining functions on datatypes by primitive recursion
     8 *)
     8 *)
     9 
     9 
    10 signature PRIMREC_PACKAGE =
    10 signature PRIMREC_PACKAGE =
    11 sig
    11 sig
    12   val add_primrec: ((bstring * string) * Attrib.src list) list -> theory -> theory * thm list
    12   val add_primrec: ((Name.binding * string) * Attrib.src list) list -> theory -> theory * thm list
    13   val add_primrec_i: ((bstring * term) * attribute list) list -> theory -> theory * thm list
    13   val add_primrec_i: ((Name.binding * term) * attribute list) list -> theory -> theory * thm list
    14 end;
    14 end;
    15 
    15 
    16 structure PrimrecPackage : PRIMREC_PACKAGE =
    16 structure PrimrecPackage : PRIMREC_PACKAGE =
    17 struct
    17 struct
    18 
    18 
   178         Goal.prove_global thy1 [] [] (Ind_Syntax.traceIt "next primrec equation = " thy1 t)
   178         Goal.prove_global thy1 [] [] (Ind_Syntax.traceIt "next primrec equation = " thy1 t)
   179           (fn _ => EVERY [rewrite_goals_tac rewrites, rtac refl 1]));
   179           (fn _ => EVERY [rewrite_goals_tac rewrites, rtac refl 1]));
   180 
   180 
   181     val (eqn_thms', thy2) =
   181     val (eqn_thms', thy2) =
   182       thy1
   182       thy1
   183       |> PureThy.add_thms ((eqn_names ~~ eqn_thms) ~~ eqn_atts);
   183       |> PureThy.add_thms ((map Name.name_of eqn_names ~~ eqn_thms) ~~ eqn_atts);
   184     val (_, thy3) =
   184     val (_, thy3) =
   185       thy2
   185       thy2
   186       |> PureThy.add_thmss [(("simps", eqn_thms'), [Simplifier.simp_add])]
   186       |> PureThy.add_thmss [(("simps", eqn_thms'), [Simplifier.simp_add])]
   187       ||> Sign.parent_path;
   187       ||> Sign.parent_path;
   188   in (thy3, eqn_thms') end;
   188   in (thy3, eqn_thms') end;