src/FOLP/simpdata.ML
changeset 1459 d12da312eff4
parent 1009 eb7c50688405
child 1463 49ca5e875691
equal deleted inserted replaced
1458:fd510875fb71 1459:d12da312eff4
     1 (*  Title: 	FOL/simpdata
     1 (*  Title:      FOL/simpdata
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1991  University of Cambridge
     4     Copyright   1991  University of Cambridge
     5 
     5 
     6 Simplification data for FOL
     6 Simplification data for FOL
     7 *)
     7 *)
     8 
     8 
    13        (fn prems => [ (cut_facts_tac prems 1), (Int.fast_tac 1) ]));
    13        (fn prems => [ (cut_facts_tac prems 1), (Int.fast_tac 1) ]));
    14 
    14 
    15 fun int_prove_fun s = int_prove_fun_raw ("?p : "^s);
    15 fun int_prove_fun s = int_prove_fun_raw ("?p : "^s);
    16 
    16 
    17 val conj_rews = map int_prove_fun
    17 val conj_rews = map int_prove_fun
    18  ["P & True <-> P", 	"True & P <-> P",
    18  ["P & True <-> P",     "True & P <-> P",
    19   "P & False <-> False", "False & P <-> False",
    19   "P & False <-> False", "False & P <-> False",
    20   "P & P <-> P",
    20   "P & P <-> P",
    21   "P & ~P <-> False", 	"~P & P <-> False",
    21   "P & ~P <-> False",   "~P & P <-> False",
    22   "(P & Q) & R <-> P & (Q & R)"];
    22   "(P & Q) & R <-> P & (Q & R)"];
    23 
    23 
    24 val disj_rews = map int_prove_fun
    24 val disj_rews = map int_prove_fun
    25  ["P | True <-> True", 	"True | P <-> True",
    25  ["P | True <-> True",  "True | P <-> True",
    26   "P | False <-> P", 	"False | P <-> P",
    26   "P | False <-> P",    "False | P <-> P",
    27   "P | P <-> P",
    27   "P | P <-> P",
    28   "(P | Q) | R <-> P | (Q | R)"];
    28   "(P | Q) | R <-> P | (Q | R)"];
    29 
    29 
    30 val not_rews = map int_prove_fun
    30 val not_rews = map int_prove_fun
    31  ["~ False <-> True",	"~ True <-> False"];
    31  ["~ False <-> True",   "~ True <-> False"];
    32 
    32 
    33 val imp_rews = map int_prove_fun
    33 val imp_rews = map int_prove_fun
    34  ["(P --> False) <-> ~P",	"(P --> True) <-> True",
    34  ["(P --> False) <-> ~P",       "(P --> True) <-> True",
    35   "(False --> P) <-> True",	"(True --> P) <-> P", 
    35   "(False --> P) <-> True",     "(True --> P) <-> P", 
    36   "(P --> P) <-> True",		"(P --> ~P) <-> ~P"];
    36   "(P --> P) <-> True",         "(P --> ~P) <-> ~P"];
    37 
    37 
    38 val iff_rews = map int_prove_fun
    38 val iff_rews = map int_prove_fun
    39  ["(True <-> P) <-> P", 	"(P <-> True) <-> P",
    39  ["(True <-> P) <-> P",         "(P <-> True) <-> P",
    40   "(P <-> P) <-> True",
    40   "(P <-> P) <-> True",
    41   "(False <-> P) <-> ~P", 	"(P <-> False) <-> ~P"];
    41   "(False <-> P) <-> ~P",       "(P <-> False) <-> ~P"];
    42 
    42 
    43 val quant_rews = map int_prove_fun
    43 val quant_rews = map int_prove_fun
    44  ["(ALL x.P) <-> P",	"(EX x.P) <-> P"];
    44  ["(ALL x.P) <-> P",    "(EX x.P) <-> P"];
    45 
    45 
    46 (*These are NOT supplied by default!*)
    46 (*These are NOT supplied by default!*)
    47 val distrib_rews  = map int_prove_fun
    47 val distrib_rews  = map int_prove_fun
    48  ["~(P|Q) <-> ~P & ~Q",
    48  ["~(P|Q) <-> ~P & ~Q",
    49   "P & (Q | R) <-> P&Q | P&R", "(Q | R) & P <-> Q&P | R&P",
    49   "P & (Q | R) <-> P&Q | P&R", "(Q | R) & P <-> Q&P | R&P",
    58 fun make_iff_T th = th RS P_Imp_P_iff_T;
    58 fun make_iff_T th = th RS P_Imp_P_iff_T;
    59 
    59 
    60 val refl_iff_T = make_iff_T refl;
    60 val refl_iff_T = make_iff_T refl;
    61 
    61 
    62 val norm_thms = [(norm_eq RS sym, norm_eq),
    62 val norm_thms = [(norm_eq RS sym, norm_eq),
    63 		 (NORM_iff RS iff_sym, NORM_iff)];
    63                  (NORM_iff RS iff_sym, NORM_iff)];
    64 
    64 
    65 
    65 
    66 (* Conversion into rewrite rules *)
    66 (* Conversion into rewrite rules *)
    67 
    67 
    68 val not_P_imp_P_iff_F = int_prove_fun_raw "p:~P ==> ?p:(P <-> False)";
    68 val not_P_imp_P_iff_F = int_prove_fun_raw "p:~P ==> ?p:(P <-> False)";
    74     | _ => make_iff_T th;
    74     | _ => make_iff_T th;
    75 
    75 
    76 fun atomize th = case concl_of th of (*The operator below is "Proof $ P $ p"*)
    76 fun atomize th = case concl_of th of (*The operator below is "Proof $ P $ p"*)
    77       _ $ (Const("op -->",_) $ _ $ _) $ _ => atomize(th RS mp)
    77       _ $ (Const("op -->",_) $ _ $ _) $ _ => atomize(th RS mp)
    78     | _ $ (Const("op &",_) $ _ $ _) $ _ => atomize(th RS conjunct1) @
    78     | _ $ (Const("op &",_) $ _ $ _) $ _ => atomize(th RS conjunct1) @
    79 				       atomize(th RS conjunct2)
    79                                        atomize(th RS conjunct2)
    80     | _ $ (Const("All",_) $ _) $ _ => atomize(th RS spec)
    80     | _ $ (Const("All",_) $ _) $ _ => atomize(th RS spec)
    81     | _ $ (Const("True",_)) $ _ => []
    81     | _ $ (Const("True",_)) $ _ => []
    82     | _ $ (Const("False",_)) $ _ => []
    82     | _ $ (Const("False",_)) $ _ => []
    83     | _ => [th];
    83     | _ => [th];
    84 
    84 
    88 fun dest_red(_ $ (red $ lhs $ rhs) $ _) = (red,lhs,rhs)
    88 fun dest_red(_ $ (red $ lhs $ rhs) $ _) = (red,lhs,rhs)
    89   | dest_red t = raise TERM("FOL/dest_red", [t]);
    89   | dest_red t = raise TERM("FOL/dest_red", [t]);
    90 
    90 
    91 structure FOLP_SimpData : SIMP_DATA =
    91 structure FOLP_SimpData : SIMP_DATA =
    92   struct
    92   struct
    93   val refl_thms		= [refl, iff_refl]
    93   val refl_thms         = [refl, iff_refl]
    94   val trans_thms	= [trans, iff_trans]
    94   val trans_thms        = [trans, iff_trans]
    95   val red1		= iffD1
    95   val red1              = iffD1
    96   val red2		= iffD2
    96   val red2              = iffD2
    97   val mk_rew_rules	= mk_rew_rules
    97   val mk_rew_rules      = mk_rew_rules
    98   val case_splits	= []         (*NO IF'S!*)
    98   val case_splits       = []         (*NO IF'S!*)
    99   val norm_thms		= norm_thms
    99   val norm_thms         = norm_thms
   100   val subst_thms	= [subst];
   100   val subst_thms        = [subst];
   101   val dest_red		= dest_red
   101   val dest_red          = dest_red
   102   end;
   102   end;
   103 
   103 
   104 structure FOLP_Simp = SimpFun(FOLP_SimpData);
   104 structure FOLP_Simp = SimpFun(FOLP_SimpData);
   105 
   105 
   106 (*not a component of SIMP_DATA, but an argument of SIMP_TAC *)
   106 (*not a component of SIMP_DATA, but an argument of SIMP_TAC *)
   122 fun prove_fun s = 
   122 fun prove_fun s = 
   123     (writeln s;  prove_goal FOLP.thy s
   123     (writeln s;  prove_goal FOLP.thy s
   124        (fn prems => [ (cut_facts_tac prems 1), (Cla.fast_tac FOLP_cs 1) ]));
   124        (fn prems => [ (cut_facts_tac prems 1), (Cla.fast_tac FOLP_cs 1) ]));
   125 
   125 
   126 val cla_rews = map prove_fun
   126 val cla_rews = map prove_fun
   127  ["?p:P | ~P", 		"?p:~P | P",
   127  ["?p:P | ~P",          "?p:~P | P",
   128   "?p:~ ~ P <-> P",	"?p:(~P --> P) <-> P"];
   128   "?p:~ ~ P <-> P",     "?p:(~P --> P) <-> P"];
   129 
   129 
   130 val FOLP_rews = IFOLP_rews@cla_rews;
   130 val FOLP_rews = IFOLP_rews@cla_rews;
   131 
   131 
   132 val FOLP_ss = auto_ss addcongs FOLP_congs addrews FOLP_rews;
   132 val FOLP_ss = auto_ss addcongs FOLP_congs addrews FOLP_rews;
   133 
   133