src/HOL/Tools/SMT/smt_solver.ML
changeset 75029 dc6769b86fd6
parent 74817 1fd8705503b4
child 75063 7ff39293e265
equal deleted inserted replaced
75028:b49329185b82 75029:dc6769b86fd6
    19      class: Proof.context -> SMT_Util.class,
    19      class: Proof.context -> SMT_Util.class,
    20      avail: unit -> bool,
    20      avail: unit -> bool,
    21      command: unit -> string list,
    21      command: unit -> string list,
    22      options: Proof.context -> string list,
    22      options: Proof.context -> string list,
    23      smt_options: (string * string) list,
    23      smt_options: (string * string) list,
    24      default_max_relevant: int,
    24      good_slices: (int * string) list,
    25      outcome: string -> string list -> outcome * string list,
    25      outcome: string -> string list -> outcome * string list,
    26      parse_proof: (Proof.context -> SMT_Translate.replay_data ->
    26      parse_proof: (Proof.context -> SMT_Translate.replay_data ->
    27        ((string * ATP_Problem_Generate.stature) * thm) list -> term list -> term -> string list ->
    27        ((string * ATP_Problem_Generate.stature) * thm) list -> term list -> term -> string list ->
    28        parsed_proof) option,
    28        parsed_proof) option,
    29      replay: (Proof.context -> SMT_Translate.replay_data -> string list -> thm) option}
    29      replay: (Proof.context -> SMT_Translate.replay_data -> string list -> thm) option}
    30 
    30 
    31   (*registry*)
    31   (*registry*)
    32   val add_solver: solver_config -> theory -> theory
    32   val add_solver: solver_config -> theory -> theory
    33   val default_max_relevant: Proof.context -> string -> int
    33   val good_slices: Proof.context -> string -> (int * string) list
    34 
    34 
    35   (*filter*)
    35   (*filter*)
    36   val smt_filter: Proof.context -> thm -> ((string * ATP_Problem_Generate.stature) * thm) list ->
    36   val smt_filter: Proof.context -> thm -> ((string * ATP_Problem_Generate.stature) * thm) list ->
    37     int -> Time.time -> parsed_proof
    37     int -> Time.time -> parsed_proof
    38 
    38 
   153    class: Proof.context -> SMT_Util.class,
   153    class: Proof.context -> SMT_Util.class,
   154    avail: unit -> bool,
   154    avail: unit -> bool,
   155    command: unit -> string list,
   155    command: unit -> string list,
   156    options: Proof.context -> string list,
   156    options: Proof.context -> string list,
   157    smt_options: (string * string) list,
   157    smt_options: (string * string) list,
   158    default_max_relevant: int,
   158    good_slices: (int * string) list,
   159    outcome: string -> string list -> outcome * string list,
   159    outcome: string -> string list -> outcome * string list,
   160    parse_proof: (Proof.context -> SMT_Translate.replay_data ->
   160    parse_proof: (Proof.context -> SMT_Translate.replay_data ->
   161      ((string * ATP_Problem_Generate.stature) * thm) list -> term list -> term -> string list ->
   161      ((string * ATP_Problem_Generate.stature) * thm) list -> term list -> term -> string list ->
   162      parsed_proof) option,
   162      parsed_proof) option,
   163    replay: (Proof.context -> SMT_Translate.replay_data -> string list -> thm) option}
   163    replay: (Proof.context -> SMT_Translate.replay_data -> string list -> thm) option}
   178 (* registry *)
   178 (* registry *)
   179 
   179 
   180 type solver_info = {
   180 type solver_info = {
   181   command: unit -> string list,
   181   command: unit -> string list,
   182   smt_options: (string * string) list,
   182   smt_options: (string * string) list,
   183   default_max_relevant: int,
   183   good_slices: (int * string) list,
   184   parse_proof: Proof.context -> SMT_Translate.replay_data ->
   184   parse_proof: Proof.context -> SMT_Translate.replay_data ->
   185     ((string * ATP_Problem_Generate.stature) * thm) list -> term list -> term -> string list ->
   185     ((string * ATP_Problem_Generate.stature) * thm) list -> term list -> term -> string list ->
   186     parsed_proof,
   186     parsed_proof,
   187   replay: Proof.context -> SMT_Translate.replay_data -> string list -> thm}
   187   replay: Proof.context -> SMT_Translate.replay_data -> string list -> thm}
   188 
   188 
   218     | (result, _) => raise SMT_Failure.SMT (SMT_Failure.Counterexample (result = Sat)))
   218     | (result, _) => raise SMT_Failure.SMT (SMT_Failure.Counterexample (result = Sat)))
   219 
   219 
   220   val cfalse = Thm.cterm_of \<^context> \<^prop>\<open>False\<close>
   220   val cfalse = Thm.cterm_of \<^context> \<^prop>\<open>False\<close>
   221 in
   221 in
   222 
   222 
   223 fun add_solver ({name, class, avail, command, options, smt_options, default_max_relevant, outcome,
   223 fun add_solver ({name, class, avail, command, options, smt_options, good_slices, outcome,
   224     parse_proof = parse_proof0, replay = replay0} : solver_config) =
   224     parse_proof = parse_proof0, replay = replay0} : solver_config) =
   225   let
   225   let
   226     fun solver oracle = {
   226     fun solver oracle = {
   227       command = command,
   227       command = command,
   228       smt_options = smt_options,
   228       smt_options = smt_options,
   229       default_max_relevant = default_max_relevant,
   229       good_slices = good_slices,
   230       parse_proof = parse_proof (outcome name) parse_proof0,
   230       parse_proof = parse_proof (outcome name) parse_proof0,
   231       replay = replay (outcome name) replay0 oracle}
   231       replay = replay (outcome name) replay0 oracle}
   232 
   232 
   233     val info = {name = name, class = class, avail = avail, options = options}
   233     val info = {name = name, class = class, avail = avail, options = options}
   234   in
   234   in
   243 
   243 
   244 fun name_and_info_of ctxt =
   244 fun name_and_info_of ctxt =
   245   let val name = SMT_Config.solver_of ctxt
   245   let val name = SMT_Config.solver_of ctxt
   246   in (name, get_info ctxt name) end
   246   in (name, get_info ctxt name) end
   247 
   247 
   248 val default_max_relevant = #default_max_relevant oo get_info
   248 val good_slices = #good_slices oo get_info
   249 
   249 
   250 fun apply_solver_and_replay ctxt thms0 =
   250 fun apply_solver_and_replay ctxt thms0 =
   251   let
   251   let
   252     val thms = map (check_topsort ctxt) thms0
   252     val thms = map (check_topsort ctxt) thms0
   253     val (name, {command, smt_options, replay, ...}) = name_and_info_of ctxt
   253     val (name, {command, smt_options, replay, ...}) = name_and_info_of ctxt