src/ZF/Tools/datatype_package.ML
changeset 60647 54bc3517161e
parent 59936 b8ffc3dc9e24
child 61466 9a468c3a1fa1
equal deleted inserted replaced
60646:441e268564c7 60647:54bc3517161e
    15    {con_defs   : thm list,             (*definitions made in thy*)
    15    {con_defs   : thm list,             (*definitions made in thy*)
    16     case_eqns  : thm list,             (*equations for case operator*)
    16     case_eqns  : thm list,             (*equations for case operator*)
    17     recursor_eqns : thm list,          (*equations for the recursor*)
    17     recursor_eqns : thm list,          (*equations for the recursor*)
    18     free_iffs  : thm list,             (*freeness rewrite rules*)
    18     free_iffs  : thm list,             (*freeness rewrite rules*)
    19     free_SEs   : thm list,             (*freeness destruct rules*)
    19     free_SEs   : thm list,             (*freeness destruct rules*)
    20     mk_free    : string -> thm};       (*function to make freeness theorems*)
    20     mk_free    : Proof.context -> string -> thm};    (*function to make freeness theorems*)
    21 
    21 
    22 signature DATATYPE_ARG =
    22 signature DATATYPE_ARG =
    23 sig
    23 sig
    24   val intrs : thm list
    24   val intrs : thm list
    25   val elims : thm list
    25   val elims : thm list
   341 
   341 
   342   val {intrs, elim, induct, mutual_induct, ...} = ind_result
   342   val {intrs, elim, induct, mutual_induct, ...} = ind_result
   343 
   343 
   344   (*Typical theorems have the form ~con1=con2, con1=con2==>False,
   344   (*Typical theorems have the form ~con1=con2, con1=con2==>False,
   345     con1(x)=con1(y) ==> x=y, con1(x)=con1(y) <-> x=y, etc.  *)
   345     con1(x)=con1(y) ==> x=y, con1(x)=con1(y) <-> x=y, etc.  *)
   346   fun mk_free s =
   346   fun mk_free ctxt s =
   347     let
   347     let
   348       val thy = Thm.theory_of_thm elim;
   348       val thy = Proof_Context.theory_of ctxt;
   349       val ctxt = Proof_Context.init_global thy;
       
   350     in
   349     in
   351       Goal.prove_global thy [] [] (Syntax.read_prop ctxt s)
   350       Goal.prove_global thy [] [] (Syntax.read_prop ctxt s)
   352         (fn {context = ctxt', ...} => EVERY
   351         (fn {context = ctxt', ...} => EVERY
   353          [rewrite_goals_tac ctxt' con_defs,
   352          [rewrite_goals_tac ctxt' con_defs,
   354           fast_tac (put_claset ZF_cs ctxt' addSEs free_SEs @ Su.free_SEs) 1])
   353           fast_tac (put_claset ZF_cs ctxt' addSEs free_SEs @ Su.free_SEs) 1])