src/ZF/Datatype.ML
changeset 15531 08c8dad8e399
parent 13780 af7b79271364
child 15570 8d8c70b41bab
equal deleted inserted replaced
15530:6f43714517ee 15531:08c8dad8e399
    72        val (lhead, largs) = strip_comb lhs
    72        val (lhead, largs) = strip_comb lhs
    73        and (rhead, rargs) = strip_comb rhs
    73        and (rhead, rargs) = strip_comb rhs
    74        val lname = #1 (dest_Const lhead) handle TERM _ => raise Match;
    74        val lname = #1 (dest_Const lhead) handle TERM _ => raise Match;
    75        val rname = #1 (dest_Const rhead) handle TERM _ => raise Match;
    75        val rname = #1 (dest_Const rhead) handle TERM _ => raise Match;
    76        val lcon_info = the (Symtab.lookup (ConstructorsData.get_sg sg, lname))
    76        val lcon_info = the (Symtab.lookup (ConstructorsData.get_sg sg, lname))
    77          handle Library.OPTION => raise Match;
    77          handle Option => raise Match;
    78        val rcon_info = the (Symtab.lookup (ConstructorsData.get_sg sg, rname))
    78        val rcon_info = the (Symtab.lookup (ConstructorsData.get_sg sg, rname))
    79          handle Library.OPTION => raise Match;
    79          handle Option => raise Match;
    80        val new = 
    80        val new = 
    81            if #big_rec_name lcon_info = #big_rec_name rcon_info 
    81            if #big_rec_name lcon_info = #big_rec_name rcon_info 
    82                andalso not (null (#free_iffs lcon_info)) then
    82                andalso not (null (#free_iffs lcon_info)) then
    83                if lname = rname then mk_new (largs, rargs)
    83                if lname = rname then mk_new (largs, rargs)
    84                else Const("False",FOLogic.oT)
    84                else Const("False",FOLogic.oT)
    90        val thm = Tactic.prove sg [] [] goal (fn _ => rtac iff_reflection 1 THEN
    90        val thm = Tactic.prove sg [] [] goal (fn _ => rtac iff_reflection 1 THEN
    91            simp_tac (datatype_ss addsimps #free_iffs lcon_info) 1)
    91            simp_tac (datatype_ss addsimps #free_iffs lcon_info) 1)
    92          handle ERROR_MESSAGE msg =>
    92          handle ERROR_MESSAGE msg =>
    93          (warning (msg ^ "\ndata_free simproc:\nfailed to prove " ^ Sign.string_of_term sg goal);
    93          (warning (msg ^ "\ndata_free simproc:\nfailed to prove " ^ Sign.string_of_term sg goal);
    94           raise Match)
    94           raise Match)
    95    in Some thm end
    95    in SOME thm end
    96    handle Match => None;
    96    handle Match => NONE;
    97 
    97 
    98 
    98 
    99  val conv = 
    99  val conv = 
   100      Simplifier.simproc (Theory.sign_of (theory "ZF")) "data_free" 
   100      Simplifier.simproc (Theory.sign_of (theory "ZF")) "data_free" 
   101                         ["(x::i) = y"] proc;
   101                         ["(x::i) = y"] proc;