src/HOL/Tools/SMT/smt_systems.ML
changeset 72458 b44e894796d5
parent 70327 c04d4951a155
child 72478 b452242dce36
equal deleted inserted replaced
72457:2c7f0ef8323a 72458:b44e894796d5
   118   name = "verit",
   118   name = "verit",
   119   class = select_class,
   119   class = select_class,
   120   avail = make_avail "VERIT",
   120   avail = make_avail "VERIT",
   121   command = make_command "VERIT",
   121   command = make_command "VERIT",
   122   options = (fn ctxt => [
   122   options = (fn ctxt => [
   123     "--proof-version=2",
   123     "--proof-with-sharing",
       
   124     "--proof-define-skolems",
   124     "--proof-prune",
   125     "--proof-prune",
   125     "--proof-merge",
   126     "--proof-merge",
   126     "--disable-print-success",
   127     "--disable-print-success",
   127     "--disable-banner",
   128     "--disable-banner",
   128     "--max-time=" ^ string_of_int (Real.ceil (Config.get ctxt SMT_Config.timeout))]),
   129     "--max-time=" ^ string_of_int (1000 * Real.ceil (Config.get ctxt SMT_Config.timeout))] @
       
   130     Verit_Proof.veriT_current_strategy (Context.Proof ctxt)),
   129   smt_options = [(":produce-proofs", "true")],
   131   smt_options = [(":produce-proofs", "true")],
   130   default_max_relevant = 200 (* FUDGE *),
   132   default_max_relevant = 200 (* FUDGE *),
   131   outcome = on_first_non_unsupported_line (outcome_of "unsat" "sat" "unknown" "timeout"),
   133   outcome = on_first_non_unsupported_line (outcome_of "unsat" "sat" "unknown" "timeout"),
   132   parse_proof = SOME (K VeriT_Proof_Parse.parse_proof),
   134   parse_proof = SOME (K VeriT_Proof_Parse.parse_proof),
   133   replay = SOME Verit_Replay.replay }
   135   replay = SOME Verit_Replay.replay }
   162   parse_proof = SOME Z3_Replay.parse_proof,
   164   parse_proof = SOME Z3_Replay.parse_proof,
   163   replay = SOME Z3_Replay.replay }
   165   replay = SOME Z3_Replay.replay }
   164 
   166 
   165 end
   167 end
   166 
   168 
       
   169 (* smt tactic *)
       
   170 val parse_smt_options =
       
   171   Scan.optional
       
   172     (Args.parens (Args.name -- Scan.option (\<^keyword>\<open>,\<close> |-- Args.name)) >> apfst SOME)
       
   173     (NONE, NONE)
       
   174 
       
   175 fun smt_method ((solver, stgy), thms) ctxt facts =
       
   176   let
       
   177     val default_solver = SMT_Config.solver_of ctxt
       
   178     val solver = the_default default_solver solver
       
   179     val _ = 
       
   180       if solver = "z3" andalso stgy <> NONE
       
   181       then warning ("No strategy is available for z3. Ignoring " ^ quote (the stgy)) 
       
   182       else ()
       
   183     val ctxt =
       
   184       ctxt
       
   185       |> (if stgy <> NONE then Context.proof_map (Verit_Proof.select_veriT_stgy (the stgy)) else I)
       
   186       |> Context.Proof
       
   187       |> SMT_Config.select_solver solver
       
   188       |> Context.proof_of
       
   189   in
       
   190     HEADGOAL (SOLVED' (SMT_Solver.smt_tac ctxt (thms @ facts)))
       
   191   end
       
   192 
       
   193 val _ =
       
   194   Theory.setup
       
   195     (Method.setup \<^binding>\<open>smt\<close>
       
   196       (Scan.lift parse_smt_options -- Attrib.thms >> (METHOD oo smt_method))
       
   197       "Call to the SMT solvers veriT or z3")
   167 
   198 
   168 (* overall setup *)
   199 (* overall setup *)
   169 
   200 
   170 val _ = Theory.setup (
   201 val _ = Theory.setup (
   171   SMT_Solver.add_solver cvc3 #>
   202   SMT_Solver.add_solver cvc3 #>