src/Provers/blast.ML
changeset 43346 911cb8242dfe
parent 43331 01f051619eee
child 43348 3e153e719039
equal deleted inserted replaced
43345:165188299a25 43346:911cb8242dfe
    61   val depth_limit: int Config.T
    61   val depth_limit: int Config.T
    62   val blast_tac: Proof.context -> int -> tactic
    62   val blast_tac: Proof.context -> int -> tactic
    63   val setup: theory -> theory
    63   val setup: theory -> theory
    64   (*debugging tools*)
    64   (*debugging tools*)
    65   type branch
    65   type branch
       
    66   val trace: bool Config.T
    66   val stats: bool Config.T
    67   val stats: bool Config.T
    67   val trace: bool Config.T
       
    68   val fromType: (indexname * term) list Unsynchronized.ref -> Term.typ -> term
    68   val fromType: (indexname * term) list Unsynchronized.ref -> Term.typ -> term
    69   val fromTerm: theory -> Term.term -> term
    69   val fromTerm: theory -> Term.term -> term
    70   val fromSubgoal: theory -> Term.term -> term
    70   val fromSubgoal: theory -> Term.term -> term
    71   val instVars: term -> (unit -> unit)
    71   val instVars: term -> (unit -> unit)
    72   val toTerm: int -> term -> Term.term
    72   val toTerm: int -> term -> Term.term
    80 functor Blast(Data: BLAST_DATA): BLAST =
    80 functor Blast(Data: BLAST_DATA): BLAST =
    81 struct
    81 struct
    82 
    82 
    83 structure Classical = Data.Classical;
    83 structure Classical = Data.Classical;
    84 
    84 
    85 val trace = Config.bool (Config.declare "Blast.trace" (K (Config.Bool false)));
    85 (* options *)
    86 val stats = Config.bool (Config.declare "Blast.stats" (K (Config.Bool false)));
    86 
    87 (*for runtime and search statistics*)
    87 val (depth_limit, setup_depth_limit) = Attrib.config_int @{binding blast_depth_limit} (K 20);
       
    88 val (trace, setup_trace) = Attrib.config_bool @{binding blast_trace} (K false);
       
    89 val (stats, setup_stats) = Attrib.config_bool @{binding blast_stats} (K false);
       
    90 
    88 
    91 
    89 datatype term =
    92 datatype term =
    90     Const  of string * term list  (*typargs constant--as a terms!*)
    93     Const  of string * term list  (*typargs constant--as a terms!*)
    91   | Skolem of string * term option Unsynchronized.ref list
    94   | Skolem of string * term option Unsynchronized.ref list
    92   | Free   of string
    95   | Free   of string
  1249           let val start = Timing.start ()
  1252           let val start = Timing.start ()
  1250           in
  1253           in
  1251           case Seq.pull(EVERY' (rev tacs) 1 st) of
  1254           case Seq.pull(EVERY' (rev tacs) 1 st) of
  1252               NONE => (writeln ("PROOF FAILED for depth " ^
  1255               NONE => (writeln ("PROOF FAILED for depth " ^
  1253                                 string_of_int lim);
  1256                                 string_of_int lim);
  1254                        if trace then error "************************\n"
       
  1255                        else ();
       
  1256                        backtrack trace choices)
  1257                        backtrack trace choices)
  1257             | cell => (if (trace orelse stats)
  1258             | cell => (if (trace orelse stats)
  1258                        then writeln (Timing.message (Timing.result start) ^ " for reconstruction")
  1259                        then writeln (Timing.message (Timing.result start) ^ " for reconstruction")
  1259                        else ();
  1260                        else ();
  1260                        Seq.make(fn()=> cell))
  1261                        Seq.make(fn()=> cell))
  1269   SELECT_GOAL
  1270   SELECT_GOAL
  1270     (Object_Logic.atomize_prems_tac 1 THEN
  1271     (Object_Logic.atomize_prems_tac 1 THEN
  1271       raw_blast (Timing.start ()) ctxt lim) i st;
  1272       raw_blast (Timing.start ()) ctxt lim) i st;
  1272 
  1273 
  1273 
  1274 
  1274 val (depth_limit, setup_depth_limit) =
       
  1275   Attrib.config_int @{binding blast_depth_limit} (K 20);
       
  1276 
       
  1277 fun blast_tac ctxt i st =
  1275 fun blast_tac ctxt i st =
  1278   let
  1276   let
  1279     val start = Timing.start ();
  1277     val start = Timing.start ();
  1280     val lim = Config.get ctxt depth_limit;
  1278     val lim = Config.get ctxt depth_limit;
  1281   in
  1279   in
  1303 
  1301 
  1304 (** method setup **)
  1302 (** method setup **)
  1305 
  1303 
  1306 val setup =
  1304 val setup =
  1307   setup_depth_limit #>
  1305   setup_depth_limit #>
       
  1306   setup_trace #>
       
  1307   setup_stats #>
  1308   Method.setup @{binding blast}
  1308   Method.setup @{binding blast}
  1309     (Scan.lift (Scan.option Parse.nat) --| Method.sections Classical.cla_modifiers >>
  1309     (Scan.lift (Scan.option Parse.nat) --| Method.sections Classical.cla_modifiers >>
  1310       (fn NONE => SIMPLE_METHOD' o blast_tac
  1310       (fn NONE => SIMPLE_METHOD' o blast_tac
  1311         | SOME lim => (fn ctxt => SIMPLE_METHOD' (depth_tac ctxt lim))))
  1311         | SOME lim => (fn ctxt => SIMPLE_METHOD' (depth_tac ctxt lim))))
  1312     "classical tableau prover";
  1312     "classical tableau prover";