src/HOL/Tools/res_atp.ML
changeset 19722 e7a5b54248bc
parent 19718 e709f643c578
child 19744 73aab222fecb
equal deleted inserted replaced
19721:515f660c0ccb 19722:e7a5b54248bc
    14   val problem_name: string ref
    14   val problem_name: string ref
    15   val time_limit: int ref
    15   val time_limit: int ref
    16    
    16    
    17   datatype mode = Auto | Fol | Hol
    17   datatype mode = Auto | Fol | Hol
    18   val linkup_logic_mode : mode ref
    18   val linkup_logic_mode : mode ref
    19   val write_subgoal_file: mode -> Proof.context -> thm list -> thm list -> int -> string
    19   val write_subgoal_file: bool -> mode -> Proof.context -> thm list -> thm list -> int -> string
    20   val vampire_time: int ref
    20   val vampire_time: int ref
    21   val eprover_time: int ref
    21   val eprover_time: int ref
       
    22   val spass_time: int ref
    22   val run_vampire: int -> unit
    23   val run_vampire: int -> unit
    23   val run_eprover: int -> unit
    24   val run_eprover: int -> unit
       
    25   val run_spass: int -> unit
    24   val vampireLimit: unit -> int
    26   val vampireLimit: unit -> int
    25   val eproverLimit: unit -> int
    27   val eproverLimit: unit -> int
       
    28   val spassLimit: unit -> int
    26   val atp_method: (ProofContext.context -> thm list -> int -> Tactical.tactic) ->
    29   val atp_method: (ProofContext.context -> thm list -> int -> Tactical.tactic) ->
    27 		  Method.src -> ProofContext.context -> Method.method
    30 		  Method.src -> ProofContext.context -> Method.method
    28   val cond_rm_tmp: string -> unit
    31   val cond_rm_tmp: string -> unit
    29   val keep_atp_input: bool ref
    32   val keep_atp_input: bool ref
    30   val fol_keep_types: bool ref
    33   val fol_keep_types: bool ref
    84 
    87 
    85 
    88 
    86 (*** ATP methods ***)
    89 (*** ATP methods ***)
    87 val vampire_time = ref 60;
    90 val vampire_time = ref 60;
    88 val eprover_time = ref 60;
    91 val eprover_time = ref 60;
       
    92 val spass_time = ref 60;
       
    93 
    89 fun run_vampire time =  
    94 fun run_vampire time =  
    90     if (time >0) then vampire_time:= time
    95     if (time >0) then vampire_time:= time
    91     else vampire_time:=60;
    96     else vampire_time:=60;
    92 
    97 
    93 fun run_eprover time = 
    98 fun run_eprover time = 
    94     if (time > 0) then eprover_time:= time
    99     if (time > 0) then eprover_time:= time
    95     else eprover_time:=60;
   100     else eprover_time:=60;
    96 
   101 
       
   102 fun run_spass time = 
       
   103     if (time > 0) then spass_time:=time
       
   104     else spass_time:=60;
       
   105 
       
   106 
    97 fun vampireLimit () = !vampire_time;
   107 fun vampireLimit () = !vampire_time;
    98 fun eproverLimit () = !eprover_time;
   108 fun eproverLimit () = !eprover_time;
       
   109 fun spassLimit () = !spass_time;
    99 
   110 
   100 val keep_atp_input = ref false;
   111 val keep_atp_input = ref false;
   101 val fol_keep_types = ResClause.keep_types;
   112 val fol_keep_types = ResClause.keep_types;
   102 val hol_full_types = ResHolClause.full_types;
   113 val hol_full_types = ResHolClause.full_types;
   103 val hol_partial_types = ResHolClause.partial_types;
   114 val hol_partial_types = ResHolClause.partial_types;
   295     if is_fol_logic logic 
   306     if is_fol_logic logic 
   296     then ResClause.dfg_write_file goals filename (axioms, classrels, arities)
   307     then ResClause.dfg_write_file goals filename (axioms, classrels, arities)
   297     else ResHolClause.dfg_write_file goals filename (axioms, classrels, arities);
   308     else ResHolClause.dfg_write_file goals filename (axioms, classrels, arities);
   298 
   309 
   299 
   310 
   300 fun write_subgoal_file mode ctxt conjectures user_thms n =
   311 fun write_subgoal_file dfg mode ctxt conjectures user_thms n =
   301     let val conj_cls = make_clauses conjectures 
   312     let val conj_cls = make_clauses conjectures 
   302 	val hyp_cls = cnf_hyps_thms ctxt
   313 	val hyp_cls = cnf_hyps_thms ctxt
   303 	val goal_cls = conj_cls@hyp_cls
   314 	val goal_cls = conj_cls@hyp_cls
   304 	val user_rules = map ResAxioms.pairname user_thms
   315 	val user_rules = map ResAxioms.pairname user_thms
   305 	val axclauses_as_thms = ResClasimp.get_clasimp_atp_lemmas ctxt (map prop_of goal_cls) user_rules (!include_claset,!include_simpset,!include_atpset) (!run_relevance_filter)  
   316 	val axclauses_as_thms = ResClasimp.get_clasimp_atp_lemmas ctxt (map prop_of goal_cls) user_rules (!include_claset,!include_simpset,!include_atpset) (!run_relevance_filter)  
   308 				    | Fol => FOL
   319 				    | Fol => FOL
   309 				    | Hol => HOL
   320 				    | Hol => HOL
   310 	val keep_types = if is_fol_logic prob_logic then !fol_keep_types else is_typed_hol ()
   321 	val keep_types = if is_fol_logic prob_logic then !fol_keep_types else is_typed_hol ()
   311 	val classrel_clauses = if keep_types then ResClause.classrel_clauses_thy thy else []
   322 	val classrel_clauses = if keep_types then ResClause.classrel_clauses_thy thy else []
   312 	val arity_clauses = if keep_types then ResClause.arity_clause_thy thy else []
   323 	val arity_clauses = if keep_types then ResClause.arity_clause_thy thy else []
   313         val writer = if !prover = "spass" then dfg_writer else tptp_writer 
   324         val writer = if dfg then dfg_writer else tptp_writer 
   314 	val file = atp_input_file()
   325 	val file = atp_input_file()
   315     in
   326     in
   316 	(writer prob_logic goal_cls file (axclauses_as_thms,classrel_clauses,arity_clauses);
   327 	(writer prob_logic goal_cls file (axclauses_as_thms,classrel_clauses,arity_clauses);
   317 	 warning ("Writing to " ^ file);
   328 	 warning ("Writing to " ^ file);
   318 	 file)
   329 	 file)