src/Provers/blast.ML
changeset 69593 3dda49e08b9d
parent 63280 d2d26ff708d7
child 79171 377260b2824d
equal deleted inserted replaced
69592:a80d8ec6c998 69593:3dda49e08b9d
    74 
    74 
    75 structure Classical = Data.Classical;
    75 structure Classical = Data.Classical;
    76 
    76 
    77 (* options *)
    77 (* options *)
    78 
    78 
    79 val depth_limit = Attrib.setup_config_int @{binding blast_depth_limit} (K 20);
    79 val depth_limit = Attrib.setup_config_int \<^binding>\<open>blast_depth_limit\<close> (K 20);
    80 val (trace, _) = Attrib.config_bool @{binding blast_trace} (K false);
    80 val (trace, _) = Attrib.config_bool \<^binding>\<open>blast_trace\<close> (K false);
    81 val (stats, _) = Attrib.config_bool @{binding blast_stats} (K false);
    81 val (stats, _) = Attrib.config_bool \<^binding>\<open>blast_stats\<close> (K false);
    82 
    82 
    83 
    83 
    84 datatype term =
    84 datatype term =
    85     Const  of string * term list  (*typargs constant--as a term!*)
    85     Const  of string * term list  (*typargs constant--as a term!*)
    86   | Skolem of string * term option Unsynchronized.ref list
    86   | Skolem of string * term option Unsynchronized.ref list
   416       fun revert() = List.app (fn v => v:=NONE) (!updated)
   416       fun revert() = List.app (fn v => v:=NONE) (!updated)
   417   in  inst t; revert  end;
   417   in  inst t; revert  end;
   418 
   418 
   419 
   419 
   420 (* A1==>...An==>B  goes to  [A1,...,An], where B is not an implication *)
   420 (* A1==>...An==>B  goes to  [A1,...,An], where B is not an implication *)
   421 fun strip_imp_prems (Const (@{const_name Pure.imp}, _) $ A $ B) =
   421 fun strip_imp_prems (Const (\<^const_name>\<open>Pure.imp\<close>, _) $ A $ B) =
   422       strip_Trueprop A :: strip_imp_prems B
   422       strip_Trueprop A :: strip_imp_prems B
   423   | strip_imp_prems _ = [];
   423   | strip_imp_prems _ = [];
   424 
   424 
   425 (* A1==>...An==>B  goes to B, where B is not an implication *)
   425 (* A1==>...An==>B  goes to B, where B is not an implication *)
   426 fun strip_imp_concl (Const (@{const_name Pure.imp}, _) $ A $ B) = strip_imp_concl B
   426 fun strip_imp_concl (Const (\<^const_name>\<open>Pure.imp\<close>, _) $ A $ B) = strip_imp_concl B
   427   | strip_imp_concl A = strip_Trueprop A;
   427   | strip_imp_concl A = strip_Trueprop A;
   428 
   428 
   429 
   429 
   430 
   430 
   431 (*** Conversion of Elimination Rules to Tableau Operations ***)
   431 (*** Conversion of Elimination Rules to Tableau Operations ***)
   441         Const (c, _) $ Var (Unsynchronized.ref (SOME (Const ("*False*", _)))) =>
   441         Const (c, _) $ Var (Unsynchronized.ref (SOME (Const ("*False*", _)))) =>
   442           if c = "*Goal*" orelse c = Data.not_name then Ps
   442           if c = "*Goal*" orelse c = Data.not_name then Ps
   443           else P :: delete_concl Ps
   443           else P :: delete_concl Ps
   444       | _ => P :: delete_concl Ps);
   444       | _ => P :: delete_concl Ps);
   445 
   445 
   446 fun skoPrem state vars (Const (@{const_name Pure.all}, _) $ Abs (_, P)) =
   446 fun skoPrem state vars (Const (\<^const_name>\<open>Pure.all\<close>, _) $ Abs (_, P)) =
   447         skoPrem state vars (subst_bound (Skolem (gensym state "S", vars), P))
   447         skoPrem state vars (subst_bound (Skolem (gensym state "S", vars), P))
   448   | skoPrem _ _ P = P;
   448   | skoPrem _ _ P = P;
   449 
   449 
   450 fun convertPrem t =
   450 fun convertPrem t =
   451     delete_concl (mkGoal (strip_imp_concl t) :: strip_imp_prems t);
   451     delete_concl (mkGoal (strip_imp_concl t) :: strip_imp_prems t);
  1186 (*** Conversion & Skolemization of the Isabelle proof state ***)
  1186 (*** Conversion & Skolemization of the Isabelle proof state ***)
  1187 
  1187 
  1188 (*Make a list of all the parameters in a subgoal, even if nested*)
  1188 (*Make a list of all the parameters in a subgoal, even if nested*)
  1189 local open Term
  1189 local open Term
  1190 in
  1190 in
  1191 fun discard_foralls (Const(@{const_name Pure.all},_)$Abs(a,T,t)) = discard_foralls t
  1191 fun discard_foralls (Const(\<^const_name>\<open>Pure.all\<close>,_)$Abs(a,T,t)) = discard_foralls t
  1192   | discard_foralls t = t;
  1192   | discard_foralls t = t;
  1193 end;
  1193 end;
  1194 
  1194 
  1195 (*List of variables not appearing as arguments to the given parameter*)
  1195 (*List of variables not appearing as arguments to the given parameter*)
  1196 fun getVars []                  i = []
  1196 fun getVars []                  i = []
  1309 
  1309 
  1310 (** method setup **)
  1310 (** method setup **)
  1311 
  1311 
  1312 val _ =
  1312 val _ =
  1313   Theory.setup
  1313   Theory.setup
  1314     (Method.setup @{binding blast}
  1314     (Method.setup \<^binding>\<open>blast\<close>
  1315       (Scan.lift (Scan.option Parse.nat) --| Method.sections Classical.cla_modifiers >>
  1315       (Scan.lift (Scan.option Parse.nat) --| Method.sections Classical.cla_modifiers >>
  1316         (fn NONE => SIMPLE_METHOD' o blast_tac
  1316         (fn NONE => SIMPLE_METHOD' o blast_tac
  1317           | SOME lim => (fn ctxt => SIMPLE_METHOD' (depth_tac ctxt lim))))
  1317           | SOME lim => (fn ctxt => SIMPLE_METHOD' (depth_tac ctxt lim))))
  1318       "classical tableau prover");
  1318       "classical tableau prover");
  1319 
  1319