| author | desharna | 
| Tue, 01 Dec 2020 15:29:54 +0100 | |
| changeset 72798 | e732c98b02e6 | 
| parent 72518 | 4be6ae020fc4 | 
| child 73975 | 8d93f9ca6518 | 
| permissions | -rw-r--r-- | 
| 55287 | 1  | 
(* Title: HOL/Tools/Sledgehammer/sledgehammer_proof_methods.ML  | 
| 52555 | 2  | 
Author: Jasmin Blanchette, TU Muenchen  | 
3  | 
Author: Steffen Juilf Smolka, TU Muenchen  | 
|
4  | 
||
5  | 
Reconstructors.  | 
|
6  | 
*)  | 
|
7  | 
||
| 55287 | 8  | 
signature SLEDGEHAMMER_PROOF_METHODS =  | 
| 52555 | 9  | 
sig  | 
10  | 
type stature = ATP_Problem_Generate.stature  | 
|
11  | 
||
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
12  | 
datatype SMT_backend =  | 
| 
72798
 
e732c98b02e6
tuned proof preplay to explicitly refer to Z3 backend
 
desharna 
parents: 
72518 
diff
changeset
 | 
13  | 
SMT_Z3 |  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
14  | 
SMT_Verit of string  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
15  | 
|
| 55285 | 16  | 
datatype proof_method =  | 
17  | 
Metis_Method of string option * string option |  | 
|
18  | 
Meson_Method |  | 
|
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
19  | 
SMT_Method of SMT_backend |  | 
| 
56852
 
b38c5b9cf590
added 'satx' to Sledgehammer's portfolio (cf. 'isar_try0')
 
blanchet 
parents: 
56093 
diff
changeset
 | 
20  | 
SATx_Method |  | 
| 
55323
 
253a029335a2
split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
 
blanchet 
parents: 
55315 
diff
changeset
 | 
21  | 
Blast_Method |  | 
| 55285 | 22  | 
Simp_Method |  | 
23  | 
Auto_Method |  | 
|
| 
58092
 
4ae52c60603a
renamed 'skolem' to 'moura' (to suggest Z3-style skolemization); reintroduced 'fastforce' to the mix of tested proof methods
 
blanchet 
parents: 
58075 
diff
changeset
 | 
24  | 
Fastforce_Method |  | 
| 55285 | 25  | 
Force_Method |  | 
| 
58092
 
4ae52c60603a
renamed 'skolem' to 'moura' (to suggest Z3-style skolemization); reintroduced 'fastforce' to the mix of tested proof methods
 
blanchet 
parents: 
58075 
diff
changeset
 | 
26  | 
Moura_Method |  | 
| 
55323
 
253a029335a2
split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
 
blanchet 
parents: 
55315 
diff
changeset
 | 
27  | 
Linarith_Method |  | 
| 
 
253a029335a2
split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
 
blanchet 
parents: 
55315 
diff
changeset
 | 
28  | 
Presburger_Method |  | 
| 55285 | 29  | 
Algebra_Method  | 
| 52555 | 30  | 
|
| 54824 | 31  | 
datatype play_outcome =  | 
32  | 
Played of Time.time |  | 
|
33  | 
Play_Timed_Out of Time.time |  | 
|
| 56093 | 34  | 
Play_Failed  | 
| 52555 | 35  | 
|
| 54824 | 36  | 
type one_line_params =  | 
| 57739 | 37  | 
((string * stature) list * (proof_method * play_outcome)) * string * int * int  | 
| 52555 | 38  | 
|
| 
57287
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
39  | 
val is_proof_method_direct : proof_method -> bool  | 
| 
60252
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
40  | 
val proof_method_distinguishes_chained_and_direct : proof_method -> bool  | 
| 
72401
 
2783779b7dd3
removed obsolete unmaintained experimental prover Pirate
 
blanchet 
parents: 
70586 
diff
changeset
 | 
41  | 
val string_of_proof_method : string list -> proof_method -> string  | 
| 57054 | 42  | 
val tac_of_proof_method : Proof.context -> thm list * thm list -> proof_method -> int -> tactic  | 
| 55211 | 43  | 
val string_of_play_outcome : play_outcome -> string  | 
| 70586 | 44  | 
val play_outcome_ord : play_outcome ord  | 
| 
56985
 
82c83978fbd9
correctly add extra facts to lemmas (cf. conjecture and hypotheses) in Z3 Isar proofs
 
blanchet 
parents: 
56983 
diff
changeset
 | 
45  | 
val one_line_proof_text : Proof.context -> int -> one_line_params -> string  | 
| 54495 | 46  | 
end;  | 
| 52555 | 47  | 
|
| 55287 | 48  | 
structure Sledgehammer_Proof_Methods : SLEDGEHAMMER_PROOF_METHODS =  | 
| 52555 | 49  | 
struct  | 
50  | 
||
| 54828 | 51  | 
open ATP_Util  | 
| 52555 | 52  | 
open ATP_Problem_Generate  | 
| 55211 | 53  | 
open ATP_Proof_Reconstruct  | 
| 52555 | 54  | 
|
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
55  | 
datatype SMT_backend =  | 
| 
72798
 
e732c98b02e6
tuned proof preplay to explicitly refer to Z3 backend
 
desharna 
parents: 
72518 
diff
changeset
 | 
56  | 
SMT_Z3 |  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
57  | 
SMT_Verit of string  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
58  | 
|
| 55285 | 59  | 
datatype proof_method =  | 
60  | 
Metis_Method of string option * string option |  | 
|
61  | 
Meson_Method |  | 
|
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
62  | 
SMT_Method of SMT_backend |  | 
| 
56852
 
b38c5b9cf590
added 'satx' to Sledgehammer's portfolio (cf. 'isar_try0')
 
blanchet 
parents: 
56093 
diff
changeset
 | 
63  | 
SATx_Method |  | 
| 
55323
 
253a029335a2
split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
 
blanchet 
parents: 
55315 
diff
changeset
 | 
64  | 
Blast_Method |  | 
| 55285 | 65  | 
Simp_Method |  | 
66  | 
Auto_Method |  | 
|
| 
58092
 
4ae52c60603a
renamed 'skolem' to 'moura' (to suggest Z3-style skolemization); reintroduced 'fastforce' to the mix of tested proof methods
 
blanchet 
parents: 
58075 
diff
changeset
 | 
67  | 
Fastforce_Method |  | 
| 55285 | 68  | 
Force_Method |  | 
| 
58092
 
4ae52c60603a
renamed 'skolem' to 'moura' (to suggest Z3-style skolemization); reintroduced 'fastforce' to the mix of tested proof methods
 
blanchet 
parents: 
58075 
diff
changeset
 | 
69  | 
Moura_Method |  | 
| 
55323
 
253a029335a2
split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
 
blanchet 
parents: 
55315 
diff
changeset
 | 
70  | 
Linarith_Method |  | 
| 
 
253a029335a2
split 'linarith' and 'presburger' (to avoid annoying warnings + to speed up reconstruction when 'presburger' is needed)
 
blanchet 
parents: 
55315 
diff
changeset
 | 
71  | 
Presburger_Method |  | 
| 55285 | 72  | 
Algebra_Method  | 
| 52555 | 73  | 
|
| 54824 | 74  | 
datatype play_outcome =  | 
75  | 
Played of Time.time |  | 
|
76  | 
Play_Timed_Out of Time.time |  | 
|
| 56093 | 77  | 
Play_Failed  | 
| 52555 | 78  | 
|
| 57739 | 79  | 
type one_line_params =  | 
80  | 
((string * stature) list * (proof_method * play_outcome)) * string * int * int  | 
|
| 55211 | 81  | 
|
| 
57287
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
82  | 
fun is_proof_method_direct (Metis_Method _) = true  | 
| 
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
83  | 
| is_proof_method_direct Meson_Method = true  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
84  | 
| is_proof_method_direct (SMT_Method _) = true  | 
| 
57287
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
85  | 
| is_proof_method_direct Simp_Method = true  | 
| 
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
86  | 
| is_proof_method_direct _ = false  | 
| 
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
87  | 
|
| 
60252
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
88  | 
fun proof_method_distinguishes_chained_and_direct Simp_Method = true  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
89  | 
| proof_method_distinguishes_chained_and_direct _ = false  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
90  | 
|
| 
58499
 
094efe6ac459
don't affect other subgoals with 'auto' in one-liner proofs
 
blanchet 
parents: 
58092 
diff
changeset
 | 
91  | 
fun is_proof_method_multi_goal Auto_Method = true  | 
| 
 
094efe6ac459
don't affect other subgoals with 'auto' in one-liner proofs
 
blanchet 
parents: 
58092 
diff
changeset
 | 
92  | 
| is_proof_method_multi_goal _ = false  | 
| 
 
094efe6ac459
don't affect other subgoals with 'auto' in one-liner proofs
 
blanchet 
parents: 
58092 
diff
changeset
 | 
93  | 
|
| 
56983
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
94  | 
fun maybe_paren s = s |> not (Symbol_Pos.is_identifier s) ? enclose "(" ")"
 | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
95  | 
|
| 
72401
 
2783779b7dd3
removed obsolete unmaintained experimental prover Pirate
 
blanchet 
parents: 
70586 
diff
changeset
 | 
96  | 
fun string_of_proof_method ss meth =  | 
| 
56983
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
97  | 
let  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
98  | 
val meth_s =  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
99  | 
(case meth of  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
100  | 
Metis_Method (NONE, NONE) => "metis"  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
101  | 
| Metis_Method (type_enc_opt, lam_trans_opt) =>  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
102  | 
        "metis (" ^ commas (map_filter I [type_enc_opt, lam_trans_opt]) ^ ")"
 | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
103  | 
| Meson_Method => "meson"  | 
| 
72798
 
e732c98b02e6
tuned proof preplay to explicitly refer to Z3 backend
 
desharna 
parents: 
72518 
diff
changeset
 | 
104  | 
| SMT_Method SMT_Z3 => "smt (z3)"  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
105  | 
| SMT_Method (SMT_Verit strategy) =>  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
106  | 
        "smt (" ^ commas ("verit" :: (if strategy = "default" then [] else [strategy])) ^ ")"
 | 
| 
56983
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
107  | 
| SATx_Method => "satx"  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
108  | 
| Blast_Method => "blast"  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
109  | 
| Simp_Method => if null ss then "simp" else "simp add:"  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
110  | 
| Auto_Method => "auto"  | 
| 
58092
 
4ae52c60603a
renamed 'skolem' to 'moura' (to suggest Z3-style skolemization); reintroduced 'fastforce' to the mix of tested proof methods
 
blanchet 
parents: 
58075 
diff
changeset
 | 
111  | 
| Fastforce_Method => "fastforce"  | 
| 
56983
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
112  | 
| Force_Method => "force"  | 
| 
58092
 
4ae52c60603a
renamed 'skolem' to 'moura' (to suggest Z3-style skolemization); reintroduced 'fastforce' to the mix of tested proof methods
 
blanchet 
parents: 
58075 
diff
changeset
 | 
113  | 
| Moura_Method => "moura"  | 
| 
56983
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
114  | 
| Linarith_Method => "linarith"  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
115  | 
| Presburger_Method => "presburger"  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
116  | 
| Algebra_Method => "algebra")  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
117  | 
in  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
118  | 
maybe_paren (space_implode " " (meth_s :: ss))  | 
| 
 
132142089ea6
use 'simp add:' syntax in Sledgehammer rather than 'using'
 
blanchet 
parents: 
56965 
diff
changeset
 | 
119  | 
end  | 
| 55285 | 120  | 
|
| 57054 | 121  | 
fun tac_of_proof_method ctxt (local_facts, global_facts) meth =  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
122  | 
let  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
123  | 
fun tac_of_metis (type_enc_opt, lam_trans_opt) =  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
124  | 
let  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
125  | 
val ctxt = ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
126  | 
|> Config.put Metis_Tactic.verbose false  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
127  | 
|> Config.put Metis_Tactic.trace false  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
128  | 
in  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
129  | 
SELECT_GOAL (Metis_Tactic.metis_method ((Option.map single type_enc_opt, lam_trans_opt),  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
130  | 
global_facts) ctxt local_facts)  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
131  | 
end  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
132  | 
|
| 
72798
 
e732c98b02e6
tuned proof preplay to explicitly refer to Z3 backend
 
desharna 
parents: 
72518 
diff
changeset
 | 
133  | 
fun tac_of_smt SMT_Z3 = SMT_Solver.smt_tac  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
134  | 
| tac_of_smt (SMT_Verit strategy) = Verit_Proof.verit_tac_stgy strategy  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
135  | 
in  | 
| 55285 | 136  | 
(case meth of  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
137  | 
Metis_Method options => tac_of_metis options  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
138  | 
| SMT_Method backend => tac_of_smt backend ctxt (local_facts @ global_facts)  | 
| 
62219
 
dbac573b27e7
preplaying of 'smt' and 'metis' more in sync with actual method
 
blanchet 
parents: 
61841 
diff
changeset
 | 
139  | 
| _ =>  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
140  | 
Method.insert_tac ctxt local_facts THEN'  | 
| 
62219
 
dbac573b27e7
preplaying of 'smt' and 'metis' more in sync with actual method
 
blanchet 
parents: 
61841 
diff
changeset
 | 
141  | 
(case meth of  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
142  | 
Meson_Method => Meson_Tactic.meson_general_tac ctxt global_facts  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
143  | 
| Simp_Method => Simplifier.asm_full_simp_tac (ctxt addsimps global_facts)  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
144  | 
| _ =>  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
145  | 
Method.insert_tac ctxt global_facts THEN'  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
146  | 
(case meth of  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
147  | 
SATx_Method => SAT.satx_tac ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
148  | 
| Blast_Method => blast_tac ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
149  | 
| Auto_Method => SELECT_GOAL (Clasimp.auto_tac ctxt)  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
150  | 
| Fastforce_Method => Clasimp.fast_force_tac ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
151  | 
| Force_Method => Clasimp.force_tac ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
152  | 
| Moura_Method => moura_tac ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
153  | 
| Linarith_Method => Lin_Arith.tac ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
154  | 
| Presburger_Method => Cooper.tac true [] [] ctxt  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
155  | 
| Algebra_Method => Groebner.algebra_tac [] [] ctxt)))  | 
| 
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
156  | 
end  | 
| 55211 | 157  | 
|
| 54828 | 158  | 
fun string_of_play_outcome (Played time) = string_of_ext_time (false, time)  | 
| 56093 | 159  | 
| string_of_play_outcome (Play_Timed_Out time) =  | 
160  | 
if time = Time.zeroTime then "" else string_of_ext_time (true, time) ^ ", timed out"  | 
|
| 54828 | 161  | 
| string_of_play_outcome Play_Failed = "failed"  | 
162  | 
||
| 55269 | 163  | 
fun play_outcome_ord (Played time1, Played time2) =  | 
| 
59058
 
a78612c67ec0
renamed "pairself" to "apply2", in accordance to @{apply 2};
 
wenzelm 
parents: 
58499 
diff
changeset
 | 
164  | 
int_ord (apply2 Time.toMilliseconds (time1, time2))  | 
| 55269 | 165  | 
| play_outcome_ord (Played _, _) = LESS  | 
166  | 
| play_outcome_ord (_, Played _) = GREATER  | 
|
167  | 
| play_outcome_ord (Play_Timed_Out time1, Play_Timed_Out time2) =  | 
|
| 
59058
 
a78612c67ec0
renamed "pairself" to "apply2", in accordance to @{apply 2};
 
wenzelm 
parents: 
58499 
diff
changeset
 | 
168  | 
int_ord (apply2 Time.toMilliseconds (time1, time2))  | 
| 55269 | 169  | 
| play_outcome_ord (Play_Timed_Out _, _) = LESS  | 
170  | 
| play_outcome_ord (_, Play_Timed_Out _) = GREATER  | 
|
171  | 
| play_outcome_ord (Play_Failed, Play_Failed) = EQUAL  | 
|
172  | 
||
| 55211 | 173  | 
fun apply_on_subgoal _ 1 = "by "  | 
174  | 
| apply_on_subgoal 1 _ = "apply "  | 
|
| 
57287
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
175  | 
| apply_on_subgoal i n = "prefer " ^ string_of_int i ^ " " ^ apply_on_subgoal 1 n  | 
| 55211 | 176  | 
|
| 55285 | 177  | 
(* FIXME *)  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
178  | 
fun proof_method_command meth i n used_chaineds _(*num_chained*) extras =  | 
| 
60252
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
179  | 
let  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
180  | 
val (indirect_ss, direct_ss) =  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
181  | 
if is_proof_method_direct meth then  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
182  | 
([], extras |> proof_method_distinguishes_chained_and_direct meth ? append used_chaineds)  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
183  | 
else  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
184  | 
(extras, [])  | 
| 
 
2c468c062589
improved one-line preplaying (don't rely on 'using x by simp' to mean 'by (simp add: x)' and beware of inaccessible '(local.)this')
 
blanchet 
parents: 
59058 
diff
changeset
 | 
185  | 
in  | 
| 
57287
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
186  | 
(if null indirect_ss then "" else "using " ^ space_implode " " indirect_ss ^ " ") ^  | 
| 
72401
 
2783779b7dd3
removed obsolete unmaintained experimental prover Pirate
 
blanchet 
parents: 
70586 
diff
changeset
 | 
187  | 
apply_on_subgoal i n ^ string_of_proof_method direct_ss meth ^  | 
| 
58499
 
094efe6ac459
don't affect other subgoals with 'auto' in one-liner proofs
 
blanchet 
parents: 
58092 
diff
changeset
 | 
188  | 
(if is_proof_method_multi_goal meth andalso n <> 1 then "[1]" else "")  | 
| 
57287
 
68aa585269ac
given two one-liners, only show the best of the two
 
blanchet 
parents: 
57054 
diff
changeset
 | 
189  | 
end  | 
| 55211 | 190  | 
|
| 56093 | 191  | 
fun try_command_line banner play command =  | 
192  | 
let val s = string_of_play_outcome play in  | 
|
| 63518 | 193  | 
banner ^ ": " ^ Active.sendback_markup_command command ^  | 
| 63692 | 194  | 
    (s |> s <> "" ? enclose " (" ")")
 | 
| 56093 | 195  | 
end  | 
| 52555 | 196  | 
|
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
197  | 
fun one_line_proof_text _ num_chained  | 
| 57739 | 198  | 
((used_facts, (meth, play)), banner, subgoal, subgoal_count) =  | 
| 57777 | 199  | 
let val (chained, extra) = List.partition (fn (_, (sc, _)) => sc = Chained) used_facts in  | 
| 
57735
 
056a55b44ec7
eliminated Sledgehammer's "min" subcommand (and lots of complications in the code)
 
blanchet 
parents: 
57720 
diff
changeset
 | 
200  | 
map fst extra  | 
| 
72518
 
4be6ae020fc4
Added smt (verit) to Sledgehammer's proof preplay.
 
desharna 
parents: 
72401 
diff
changeset
 | 
201  | 
|> proof_method_command meth subgoal subgoal_count (map fst chained) num_chained  | 
| 63692 | 202  | 
|> (if play = Play_Failed then prefix "One-line proof reconstruction failed: "  | 
| 
57735
 
056a55b44ec7
eliminated Sledgehammer's "min" subcommand (and lots of complications in the code)
 
blanchet 
parents: 
57720 
diff
changeset
 | 
203  | 
else try_command_line banner play)  | 
| 55211 | 204  | 
end  | 
| 52555 | 205  | 
|
| 54495 | 206  | 
end;  |