src/HOL/simpdata.ML
changeset 6128 2acc5d36610c
parent 5975 cd19eaa90f45
child 6293 2a4357301973
equal deleted inserted replaced
6127:ece970eb5850 6128:2acc5d36610c
    62 
    62 
    63 local
    63 local
    64 
    64 
    65   fun prover s = prove_goal HOL.thy s (K [Blast_tac 1]);
    65   fun prover s = prove_goal HOL.thy s (K [Blast_tac 1]);
    66 
    66 
    67   val P_imp_P_iff_True = prover "P --> (P = True)" RS mp;
       
    68   val P_imp_P_eq_True = P_imp_P_iff_True RS eq_reflection;
       
    69 
       
    70   val not_P_imp_P_iff_F = prover "~P --> (P = False)" RS mp;
       
    71   val not_P_imp_P_eq_False = not_P_imp_P_iff_F RS eq_reflection;
       
    72 
       
    73 in
    67 in
    74 
    68 
    75 (*Make meta-equalities.  The operator below is Trueprop*)
    69 (*Make meta-equalities.  The operator below is Trueprop*)
    76 
    70 
    77   fun mk_meta_eq r = r RS eq_reflection;
    71 fun mk_meta_eq r = r RS eq_reflection;
    78 
    72 
    79   fun mk_eq th = case concl_of th of
    73 val Eq_TrueI  = mk_meta_eq(prover  "P --> (P = True)"  RS mp);
    80           Const("==",_)$_$_       => th
    74 val Eq_FalseI = mk_meta_eq(prover "~P --> (P = False)" RS mp);
    81       |   _$(Const("op =",_)$_$_) => mk_meta_eq th
    75 
    82       |   _$(Const("Not",_)$_)    => th RS not_P_imp_P_eq_False
    76 fun mk_eq th = case concl_of th of
    83       |   _                       => th RS P_imp_P_eq_True;
    77         Const("==",_)$_$_       => th
    84   (* last 2 lines requires all formulae to be of the from Trueprop(.) *)
    78     |   _$(Const("op =",_)$_$_) => mk_meta_eq th
    85 
    79     |   _$(Const("Not",_)$_)    => th RS Eq_FalseI
    86   fun mk_eq_True r = Some(r RS meta_eq_to_obj_eq RS P_imp_P_eq_True);
    80     |   _                       => th RS Eq_TrueI;
    87 
    81 (* last 2 lines requires all formulae to be of the from Trueprop(.) *)
    88   fun mk_meta_cong rl =
    82 
    89     standard(mk_meta_eq(replicate (nprems_of rl) meta_eq_to_obj_eq MRS rl))
    83 fun mk_eq_True r = Some(r RS meta_eq_to_obj_eq RS Eq_TrueI);
    90     handle THM _ =>
    84 
    91     error("Premises and conclusion of congruence rules must be =-equalities");
    85 fun mk_meta_cong rl =
       
    86   standard(mk_meta_eq(replicate (nprems_of rl) meta_eq_to_obj_eq MRS rl))
       
    87   handle THM _ =>
       
    88   error("Premises and conclusion of congruence rules must be =-equalities");
    92 
    89 
    93 val not_not = prover "(~ ~ P) = P";
    90 val not_not = prover "(~ ~ P) = P";
    94 
    91 
    95 val simp_thms = [not_not] @ map prover
    92 val simp_thms = [not_not] @ map prover
    96  [ "(x=x) = True",
    93  [ "(x=x) = True",
   503         REPEAT(eresolve_tac [conjE, exE] 1 ORELSE
   500         REPEAT(eresolve_tac [conjE, exE] 1 ORELSE
   504                filter_prems_tac test 1 ORELSE
   501                filter_prems_tac test 1 ORELSE
   505                eresolve_tac [disjE] 1) THEN
   502                eresolve_tac [disjE] 1) THEN
   506         ref_tac 1;
   503         ref_tac 1;
   507   in EVERY'[TRY o filter_prems_tac test,
   504   in EVERY'[TRY o filter_prems_tac test,
   508             REPEAT o etac rev_mp, prep_tac, rtac ccontr, prem_nnf_tac,
   505             DETERM o REPEAT o etac rev_mp, prep_tac, rtac ccontr, prem_nnf_tac,
   509             SELECT_GOAL (DEPTH_SOLVE refute_prems_tac)]
   506             SELECT_GOAL (DEPTH_SOLVE refute_prems_tac)]
   510   end;
   507   end;