src/FOL/simpdata.ML
changeset 5555 4b9386224084
parent 5496 42d13691be86
child 6114 45958e54d72e
equal deleted inserted replaced
5554:3cae5d6510c2 5555:4b9386224084
    74 
    74 
    75 val P_iff_T = int_prove_fun "P ==> (P <-> True)";
    75 val P_iff_T = int_prove_fun "P ==> (P <-> True)";
    76 val iff_reflection_T = P_iff_T RS iff_reflection;
    76 val iff_reflection_T = P_iff_T RS iff_reflection;
    77 
    77 
    78 (*Make meta-equalities.  The operator below is Trueprop*)
    78 (*Make meta-equalities.  The operator below is Trueprop*)
       
    79 
    79 fun mk_meta_eq th = case concl_of th of
    80 fun mk_meta_eq th = case concl_of th of
       
    81     _ $ (Const("op =",_)$_$_)   => th RS eq_reflection
       
    82   | _ $ (Const("op <->",_)$_$_) => th RS iff_reflection
       
    83   | _                           => 
       
    84   error("conclusion must be a =-equality or <->");;
       
    85 
       
    86 fun mk_eq th = case concl_of th of
    80     Const("==",_)$_$_           => th
    87     Const("==",_)$_$_           => th
    81   | _ $ (Const("op =",_)$_$_)   => th RS eq_reflection
    88   | _ $ (Const("op =",_)$_$_)   => mk_meta_eq th
    82   | _ $ (Const("op <->",_)$_$_) => th RS iff_reflection
    89   | _ $ (Const("op <->",_)$_$_) => mk_meta_eq th
    83   | _ $ (Const("Not",_)$_)      => th RS iff_reflection_F
    90   | _ $ (Const("Not",_)$_)      => th RS iff_reflection_F
    84   | _                           => th RS iff_reflection_T;
    91   | _                           => th RS iff_reflection_T;
       
    92 
       
    93 fun mk_meta_cong rl = standard (mk_meta_eq rl); 
       
    94 (*FIXME: how about the premises?*)
    85 
    95 
    86 val mksimps_pairs =
    96 val mksimps_pairs =
    87   [("op -->", [mp]), ("op &", [conjunct1,conjunct2]),
    97   [("op -->", [mp]), ("op &", [conjunct1,conjunct2]),
    88    ("All", [spec]), ("True", []), ("False", [])];
    98    ("All", [spec]), ("True", []), ("False", [])];
    89 
    99 
    90 (* FIXME: move to Provers/simplifier.ML
   100 (* ###FIXME: move to Provers/simplifier.ML
    91 val mk_atomize:      (string * thm list) list -> thm -> thm list
   101 val mk_atomize:      (string * thm list) list -> thm -> thm list
    92 *)
   102 *)
    93 (* FIXME: move to Provers/simplifier.ML*)
   103 (* ###FIXME: move to Provers/simplifier.ML *)
    94 fun mk_atomize pairs =
   104 fun mk_atomize pairs =
    95   let fun atoms th =
   105   let fun atoms th =
    96         (case concl_of th of
   106         (case concl_of th of
    97            Const("Trueprop",_) $ p =>
   107            Const("Trueprop",_) $ p =>
    98              (case head_of p of
   108              (case head_of p of
   102                    | None => [th])
   112                    | None => [th])
   103               | _ => [th])
   113               | _ => [th])
   104          | _ => [th])
   114          | _ => [th])
   105   in atoms end;
   115   in atoms end;
   106 
   116 
   107 fun mksimps pairs = (map mk_meta_eq o mk_atomize pairs o gen_all);
   117 fun mksimps pairs = (map mk_eq o mk_atomize pairs o gen_all);
   108 
   118 
   109 (*** Classical laws ***)
   119 (*** Classical laws ***)
   110 
   120 
   111 fun prove_fun s = 
   121 fun prove_fun s = 
   112  (writeln s;  
   122  (writeln s;  
   250   (fn [prem] => [rewtac prem, rtac iffI 1, atac 1, atac 1]);
   260   (fn [prem] => [rewtac prem, rtac iffI 1, atac 1, atac 1]);
   251 
   261 
   252 structure SplitterData =
   262 structure SplitterData =
   253   struct
   263   struct
   254   structure Simplifier = Simplifier
   264   structure Simplifier = Simplifier
   255   val mk_meta_eq     = mk_meta_eq
   265   val mk_eq          = mk_eq
   256   val meta_eq_to_iff = meta_eq_to_iff
   266   val meta_eq_to_iff = meta_eq_to_iff
   257   val iffD           = iffD2
   267   val iffD           = iffD2
   258   val disjE          = disjE
   268   val disjE          = disjE
   259   val conjE          = conjE
   269   val conjE          = conjE
   260   val exE            = exE
   270   val exE            = exE
   278 
   288 
   279 structure Induction = InductionFun(struct val spec=IFOL.spec end);
   289 structure Induction = InductionFun(struct val spec=IFOL.spec end);
   280 
   290 
   281 open Induction;
   291 open Induction;
   282 
   292 
   283 (*Add congruence rules for = or <-> (instead of ==) *)
   293 
       
   294 (* Add congruence rules for = or <-> (instead of ==) *)
       
   295 
       
   296 (* ###FIXME: Move to simplifier, 
       
   297    taking mk_meta_cong as input, eliminating addeqcongs and deleqcongs *)
   284 infix 4 addcongs delcongs;
   298 infix 4 addcongs delcongs;
   285 fun ss addcongs congs =
   299 fun ss addcongs congs = ss addeqcongs (map mk_meta_cong congs);
   286         ss addeqcongs (map standard (congs RL [eq_reflection,iff_reflection]));
   300 fun ss delcongs congs = ss deleqcongs (map mk_meta_cong congs);
   287 fun ss delcongs congs =
       
   288         ss deleqcongs (map standard (congs RL [eq_reflection,iff_reflection]));
       
   289 
       
   290 fun Addcongs congs = (simpset_ref() := simpset() addcongs congs);
   301 fun Addcongs congs = (simpset_ref() := simpset() addcongs congs);
   291 fun Delcongs congs = (simpset_ref() := simpset() delcongs congs);
   302 fun Delcongs congs = (simpset_ref() := simpset() delcongs congs);
   292 
   303 
   293 
   304 
   294 val meta_simps =
   305 val meta_simps =
   340 
   351 
   341 
   352 
   342 (*** integration of simplifier with classical reasoner ***)
   353 (*** integration of simplifier with classical reasoner ***)
   343 
   354 
   344 structure Clasimp = ClasimpFun
   355 structure Clasimp = ClasimpFun
   345  (structure Simplifier = Simplifier and Classical = Cla and Blast = Blast
   356  (structure Simplifier = Simplifier 
   346   val op addcongs = op addcongs and op delcongs = op delcongs
   357         and Classical  = Cla
   347   and op addSaltern = op addSaltern and op addbefore = op addbefore);
   358         and Blast      = Blast);
   348 
       
   349 open Clasimp;
   359 open Clasimp;
   350 
   360 
   351 val FOL_css = (FOL_cs, FOL_ss);
   361 val FOL_css = (FOL_cs, FOL_ss);