| author | berghofe |
| Thu, 01 Dec 2005 18:41:44 +0100 | |
| changeset 18320 | ce523820ff75 |
| parent 18273 | e15a825da262 |
| child 18357 | c5030cdbf8da |
| permissions | -rw-r--r-- |
| 17907 | 1 |
(* ID: $Id$ |
2 |
Author: Jia Meng, NICTA |
|
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
3 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
4 |
*) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
5 |
structure ResAtpSetup = |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
6 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
7 |
struct |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
8 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
9 |
val keep_atp_input = ref false; |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
10 |
val debug = ref true; |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
11 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
12 |
val fol_keep_types = ResClause.keep_types; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
13 |
val hol_keep_types = ResHolClause.keep_types; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
14 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
15 |
val include_combS = ResHolClause.include_combS; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
16 |
val include_min_comb = ResHolClause.include_min_comb; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
17 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
18 |
|
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
19 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
20 |
(*******************************************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
21 |
(* set up the output paths *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
22 |
(*******************************************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
23 |
|
|
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
24 |
fun typed_comb () = |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
25 |
if !ResHolClause.include_combS then |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
26 |
(ResAtp.helper_path "E_HOME" "additionals/comb_inclS" |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
27 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/comb_inclS") |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
28 |
else |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
29 |
(ResAtp.helper_path "E_HOME" "additionals/comb_noS" |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
30 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/comb_noS"); |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
31 |
|
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
32 |
fun untyped_comb () = |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
33 |
if !ResHolClause.include_combS then |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
34 |
(ResAtp.helper_path "E_HOME" "additionals/u_comb_inclS" |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
35 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/u_comb_inclS") |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
36 |
else |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
37 |
(ResAtp.helper_path "E_HOME" "additionals/u_comb_noS" |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
38 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/u_comb_noS"); |
|
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
39 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
40 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
41 |
fun typed_HOL_helper1 () = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
42 |
ResAtp.helper_path "E_HOME" "additionals/helper1" |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
43 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/helper1"; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
44 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
45 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
46 |
fun untyped_HOL_helper1 () = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
47 |
ResAtp.helper_path "E_HOME" "additionals/u_helper1" |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
48 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/u_helper1"; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
49 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
50 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
51 |
fun HOL_helper1 () = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
52 |
if !hol_keep_types then typed_HOL_helper1 () else untyped_HOL_helper1 (); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
53 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
54 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
55 |
fun HOL_comb () = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
56 |
if !hol_keep_types then typed_comb() else untyped_comb(); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
57 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
58 |
|
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
59 |
val claset_file = File.tmp_path (Path.basic "claset"); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
60 |
val simpset_file = File.tmp_path (Path.basic "simp"); |
|
18086
051b7f323b4c
Changed the way additional lemmas are passed to ATP methods for proof of a goal: now only list them after the methods' names.
mengj
parents:
18014
diff
changeset
|
61 |
val local_lemma_file = File.tmp_path (Path.basic "locallemmas"); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
62 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
63 |
val prob_file = File.tmp_path (Path.basic "prob"); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
64 |
val hyps_file = File.tmp_path (Path.basic "hyps"); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
65 |
|
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
66 |
val types_sorts_file = File.tmp_path (Path.basic "typsorts"); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
67 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
68 |
(*******************************************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
69 |
(* operations on Isabelle theorems: *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
70 |
(* retrieving from ProofContext, *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
71 |
(* modifying local theorems, *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
72 |
(* CNF *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
73 |
(*******************************************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
74 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
75 |
(* a special version of repeat_RS *) |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
76 |
fun repeat_someI_ex thm = ResAxioms.repeat_RS thm someI_ex; |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
77 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
78 |
val include_simpset = ref false; |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
79 |
val include_claset = ref false; |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
80 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
81 |
val add_simpset = (fn () => include_simpset:=true); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
82 |
val add_claset = (fn () => include_claset:=true); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
83 |
val add_clasimp = (fn () => include_simpset:=true;include_claset:=true); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
84 |
val rm_simpset = (fn () => include_simpset:=false); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
85 |
val rm_claset = (fn () => include_claset:=false); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
86 |
val rm_clasimp = (fn () => include_simpset:=false;include_claset:=false); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
87 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
88 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
89 |
(******************************************************************) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
90 |
(* detect whether a given problem (clauses) is FOL/HOL/HOLC/HOLCS *) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
91 |
(******************************************************************) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
92 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
93 |
datatype logic = FOL | HOL | HOLC | HOLCS; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
94 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
95 |
fun string_of_logic FOL = "FOL" |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
96 |
| string_of_logic HOL = "HOL" |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
97 |
| string_of_logic HOLC = "HOLC" |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
98 |
| string_of_logic HOLCS = "HOLCS"; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
99 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
100 |
(*HOLCS will not occur here*) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
101 |
fun upgrade_lg HOLC _ = HOLC |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
102 |
| upgrade_lg HOL HOLC = HOLC |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
103 |
| upgrade_lg HOL _ = HOL |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
104 |
| upgrade_lg FOL lg = lg; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
105 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
106 |
(* check types *) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
107 |
fun has_bool (Type("bool",_)) = true
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
108 |
| has_bool (Type(_, Ts)) = exists has_bool Ts |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
109 |
| has_bool _ = false; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
110 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
111 |
fun has_bool_arg tp = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
112 |
let val (targs,tr) = strip_type tp |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
113 |
in |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
114 |
exists has_bool targs |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
115 |
end; |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
116 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
117 |
fun is_fn_tp (Type("fun",_)) = true
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
118 |
| is_fn_tp _ = false; |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
119 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
120 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
121 |
exception FN_LG of term; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
122 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
123 |
fun fn_lg (t as Const(f,tp)) (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
124 |
if has_bool tp then (upgrade_lg HOL lg, t ins seen) else (lg, t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
125 |
| fn_lg (t as Free(f,tp)) (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
126 |
if has_bool tp then (upgrade_lg HOL lg, t ins seen) else (lg, t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
127 |
| fn_lg (t as Var(f,tp)) (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
128 |
if is_fn_tp tp orelse has_bool tp then (upgrade_lg HOL lg,t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
129 |
else (lg,t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
130 |
| fn_lg (t as Abs(_,_,_)) (lg,seen) = (upgrade_lg HOLC lg,t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
131 |
| fn_lg f _ = raise FN_LG(f); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
132 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
133 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
134 |
fun term_lg [] (lg,seen) = (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
135 |
| term_lg (tm::tms) (FOL,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
136 |
let val (f,args) = strip_comb tm |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
137 |
val (lg',seen') = if f mem seen then (FOL,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
138 |
else fn_lg f (FOL,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
139 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
140 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
141 |
term_lg (args@tms) (lg',seen') |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
142 |
end |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
143 |
| term_lg _ (lg,seen) = (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
144 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
145 |
exception PRED_LG of term; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
146 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
147 |
fun pred_lg (t as Const(P,tp)) (lg,seen)= |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
148 |
if has_bool_arg tp then (upgrade_lg HOL lg, t ins seen) else (lg,t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
149 |
| pred_lg (t as Free(P,tp)) (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
150 |
if has_bool_arg tp then (upgrade_lg HOL lg, t ins seen) else (lg,t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
151 |
| pred_lg (t as Var(_,_)) (lg,seen) = (upgrade_lg HOL lg, t ins seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
152 |
| pred_lg P _ = raise PRED_LG(P); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
153 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
154 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
155 |
fun lit_lg (Const("Not",_) $ P) (lg,seen) = lit_lg P (lg,seen)
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
156 |
| lit_lg P (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
157 |
let val (pred,args) = strip_comb P |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
158 |
val (lg',seen') = if pred mem seen then (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
159 |
else pred_lg pred (lg,seen) |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
160 |
in |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
161 |
term_lg args (lg',seen') |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
162 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
163 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
164 |
fun lits_lg [] (lg,seen) = (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
165 |
| lits_lg (lit::lits) (FOL,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
166 |
lits_lg lits (lit_lg lit (FOL,seen)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
167 |
| lits_lg lits (lg,seen) = (lg,seen); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
168 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
169 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
170 |
fun logic_of_clause tm (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
171 |
let val tm' = HOLogic.dest_Trueprop tm |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
172 |
val disjs = HOLogic.dest_disj tm' |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
173 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
174 |
lits_lg disjs (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
175 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
176 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
177 |
fun lits_lg [] (lg,seen) = (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
178 |
| lits_lg (lit::lits) (FOL,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
179 |
lits_lg lits (lit_lg lit (FOL,seen)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
180 |
| lits_lg lits (lg,seen) = (lg,seen); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
181 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
182 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
183 |
fun logic_of_clause tm (lg,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
184 |
let val tm' = HOLogic.dest_Trueprop tm |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
185 |
val disjs = HOLogic.dest_disj tm' |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
186 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
187 |
lits_lg disjs (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
188 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
189 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
190 |
fun logic_of_clauses [] (lg,seen) = (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
191 |
| logic_of_clauses (cls::clss) (FOL,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
192 |
logic_of_clauses clss (logic_of_clause cls (FOL,seen)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
193 |
| logic_of_clauses (cls::clss) (lg,seen) = (lg,seen); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
194 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
195 |
fun logic_of_nclauses [] (lg,seen) = (lg,seen) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
196 |
| logic_of_nclauses (cls::clss) (FOL,seen) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
197 |
logic_of_nclauses clss (logic_of_clauses (snd cls) (FOL,seen)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
198 |
| logic_of_nclauses clss (lg,seen) = (lg,seen); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
199 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
200 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
201 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
202 |
fun problem_logic (conj_cls,hyp_cls,userR,claR,simpR) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
203 |
let val (lg1,seen1) = logic_of_clauses conj_cls (FOL,[]) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
204 |
val (lg2,seen2) = logic_of_clauses hyp_cls (lg1,seen1) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
205 |
val (lg3,seen3) = logic_of_nclauses userR (lg2,seen2) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
206 |
val (lg4,seen4) = logic_of_nclauses claR (lg3,seen3) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
207 |
val (lg5,seen5) = logic_of_nclauses simpR (lg4,seen4) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
208 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
209 |
lg5 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
210 |
end; |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
211 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
212 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
213 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
214 |
(***************************************************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
215 |
(* prover-specific output format: *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
216 |
(* TPTP *) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
217 |
(***************************************************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
218 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
219 |
(**** CNF rules and hypothesis ****) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
220 |
fun cnf_rules_tms ctxt ths (include_claset,include_simpset) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
221 |
let val local_claR = if include_claset then ResAxioms.claset_rules_of_ctxt ctxt else [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
222 |
val (local_claR_cls,err1) = ResAxioms.cnf_rules2 local_claR [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
223 |
val local_simpR = if include_simpset then ResAxioms.simpset_rules_of_ctxt ctxt else [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
224 |
val (local_simpR_cls,err2) = ResAxioms.cnf_rules2 local_simpR [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
225 |
val (user_ths_cls,err3) = ResAxioms.cnf_rules2 (map ResAxioms.pairname ths) [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
226 |
val errs = err3 @ err2 @ err1 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
227 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
228 |
(user_ths_cls,local_simpR_cls,local_claR_cls,errs) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
229 |
end; |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
230 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
231 |
fun cnf_hyps_thms ctxt = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
232 |
let val ths = ProofContext.prems_of ctxt |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
233 |
val prems = ResClause.union_all (map ResAxioms.cnf_axiom_aux ths) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
234 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
235 |
prems |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
236 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
237 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
238 |
(**** clausification ****) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
239 |
fun cls_axiom_fol _ _ [] = [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
240 |
| cls_axiom_fol name i (tm::tms) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
241 |
(ResClause.make_axiom_clause tm (name,i)) :: (cls_axiom_fol name (i+1) tms); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
242 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
243 |
fun cls_axiom_hol _ _ [] = [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
244 |
| cls_axiom_hol name i (tm::tms) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
245 |
(ResHolClause.make_axiom_clause tm (name,i)) :: (cls_axiom_hol name (i+1) tms); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
246 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
247 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
248 |
fun filtered_tptp_axiom_fol name clss = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
249 |
(fst(ListPair.unzip (map ResClause.clause2tptp (filter (fn c => not (ResClause.isTaut c)) (cls_axiom_fol name 0 clss)))),[]) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
250 |
handle _ => ([],[name]); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
251 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
252 |
fun filtered_tptp_axiom_hol name clss = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
253 |
(fst(ListPair.unzip (map ResHolClause.clause2tptp (filter (fn c => not (ResHolClause.isTaut c)) (cls_axiom_hol name 0 clss)))),[]) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
254 |
handle _ => ([],[name]); |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
255 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
256 |
fun tptp_axioms_g filt_ax_fn [] err = ([],err) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
257 |
| tptp_axioms_g filt_ax_fn ((name,clss)::nclss) err = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
258 |
let val (nclss1,err1) = tptp_axioms_g filt_ax_fn nclss err |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
259 |
val (clsstrs,err_name_list) = filt_ax_fn name clss |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
260 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
261 |
case clsstrs of [] => (nclss1,err_name_list @ err1) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
262 |
| _ => (clsstrs::nclss1,err1) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
263 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
264 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
265 |
fun tptp_axioms_fol rules = tptp_axioms_g filtered_tptp_axiom_fol rules []; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
266 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
267 |
fun tptp_axioms_hol rules = tptp_axioms_g filtered_tptp_axiom_hol rules []; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
268 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
269 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
270 |
fun atp_axioms_g tptp_ax_fn rules file = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
271 |
let val out = TextIO.openOut file |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
272 |
val (clss,errs) = tptp_ax_fn rules |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
273 |
val clss' = ResClause.union_all clss |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
274 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
275 |
ResAtp.writeln_strs out clss'; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
276 |
TextIO.closeOut out; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
277 |
([file],errs) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
278 |
end; |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
279 |
|
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
280 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
281 |
fun atp_axioms_fol rules file = atp_axioms_g tptp_axioms_fol rules file; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
282 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
283 |
fun atp_axioms_hol rules file = atp_axioms_g tptp_axioms_hol rules file; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
284 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
285 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
286 |
fun filtered_tptp_conjectures_fol terms = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
287 |
let val clss = ResClause.make_conjecture_clauses terms |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
288 |
val clss' = filter (fn c => not (ResClause.isTaut c)) clss |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
289 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
290 |
ListPair.unzip (map ResClause.clause2tptp clss') |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
291 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
292 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
293 |
fun filtered_tptp_conjectures_hol terms = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
294 |
let val clss = ResHolClause.make_conjecture_clauses terms |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
295 |
val clss' = filter (fn c => not (ResHolClause.isTaut c)) clss |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
296 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
297 |
ListPair.unzip (map ResHolClause.clause2tptp clss') |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
298 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
299 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
300 |
fun atp_conjectures_h_g filt_conj_fn hyp_cls = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
301 |
let val (tptp_h_clss,tfree_litss) = filt_conj_fn hyp_cls |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
302 |
val tfree_lits = ResClause.union_all tfree_litss |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
303 |
val tfree_clss = map ResClause.tfree_clause tfree_lits |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
304 |
val hypsfile = File.platform_path hyps_file |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
305 |
val out = TextIO.openOut(hypsfile) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
306 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
307 |
ResAtp.writeln_strs out (tfree_clss @ tptp_h_clss); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
308 |
TextIO.closeOut out; warning hypsfile; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
309 |
([hypsfile],tfree_lits) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
310 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
311 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
312 |
fun atp_conjectures_h_fol hyp_cls = atp_conjectures_h_g filtered_tptp_conjectures_fol hyp_cls; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
313 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
314 |
fun atp_conjectures_h_hol hyp_cls = atp_conjectures_h_g filtered_tptp_conjectures_hol hyp_cls; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
315 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
316 |
fun atp_conjectures_c_g filt_conj_fn conj_cls n tfrees = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
317 |
let val (tptp_c_clss,tfree_litss) = filt_conj_fn conj_cls |
|
17939
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
318 |
val tfree_clss = map ResClause.tfree_clause ((ResClause.union_all tfree_litss) \\ tfrees) |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
319 |
val probfile = File.platform_path prob_file ^ "_" ^ string_of_int n |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
320 |
val out = TextIO.openOut(probfile) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
321 |
in |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
322 |
ResAtp.writeln_strs out (tfree_clss @ tptp_c_clss); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
323 |
TextIO.closeOut out; |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
324 |
warning probfile; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
325 |
probfile |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
326 |
end; |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
327 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
328 |
fun atp_conjectures_c_fol conj_cls n tfrees = atp_conjectures_c_g filtered_tptp_conjectures_fol conj_cls n tfrees; |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
329 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
330 |
fun atp_conjectures_c_hol conj_cls n tfrees = atp_conjectures_c_g filtered_tptp_conjectures_hol conj_cls n tfrees; |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
331 |
|
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
332 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
333 |
fun atp_conjectures_g atp_conj_h_fn atp_conj_c_fn [] conj_cls n = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
334 |
let val probfile = atp_conj_c_fn conj_cls n [] |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
335 |
in |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
336 |
[probfile] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
337 |
end |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
338 |
| atp_conjectures_g atp_conj_h_fn atp_conj_c_fn hyp_cls conj_cls n = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
339 |
let val (hypsfile,tfree_lits) = atp_conj_h_fn hyp_cls |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
340 |
val probfile = atp_conj_c_fn conj_cls n tfree_lits |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
341 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
342 |
(probfile::hypsfile) |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
343 |
end; |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
344 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
345 |
fun atp_conjectures_fol hyp_cls conj_cls n = atp_conjectures_g atp_conjectures_h_fol atp_conjectures_c_fol hyp_cls conj_cls n; |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
346 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
347 |
fun atp_conjectures_hol hyp_cls conj_cls n = atp_conjectures_g atp_conjectures_h_hol atp_conjectures_c_hol hyp_cls conj_cls n; |
|
18086
051b7f323b4c
Changed the way additional lemmas are passed to ATP methods for proof of a goal: now only list them after the methods' names.
mengj
parents:
18014
diff
changeset
|
348 |
|
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
349 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
350 |
(**** types and sorts ****) |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
351 |
fun tptp_types_sorts thy = |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
352 |
let val classrel_clauses = ResClause.classrel_clauses_thy thy |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
353 |
val arity_clauses = ResClause.arity_clause_thy thy |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
354 |
val classrel_cls = map ResClause.tptp_classrelClause classrel_clauses |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
355 |
val arity_cls = map ResClause.tptp_arity_clause arity_clauses |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
356 |
fun write_ts () = |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
357 |
let val tsfile = File.platform_path types_sorts_file |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
358 |
val out = TextIO.openOut(tsfile) |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
359 |
in |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
360 |
ResAtp.writeln_strs out (classrel_cls @ arity_cls); |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
361 |
TextIO.closeOut out; |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
362 |
[tsfile] |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
363 |
end |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
364 |
in |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
365 |
if (List.null arity_cls andalso List.null classrel_cls) then [] |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
366 |
else |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
367 |
write_ts () |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
368 |
end; |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
369 |
|
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
370 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
371 |
(******* write to files ******) |
|
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
372 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
373 |
datatype mode = Auto | Fol | Hol; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
374 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
375 |
fun write_out_g logic atp_ax_fn atp_conj_fn (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
376 |
let val (files1,err1) = if (null claR) then ([],[]) else (atp_ax_fn claR (File.platform_path claset_file)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
377 |
val (files2,err2) = if (null simpR) then ([],[]) else (atp_ax_fn simpR (File.platform_path simpset_file)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
378 |
val (files3,err3) = if (null userR) then ([],[]) else (atp_ax_fn userR (File.platform_path local_lemma_file)) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
379 |
val files4 = atp_conj_fn hyp_cls conj_cls n |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
380 |
val errs = err1 @ err2 @ err3 @ err |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
381 |
val logic' = if !include_combS then HOLCS |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
382 |
else |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
383 |
if !include_min_comb then HOLC else logic |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
384 |
val _ = warning ("Problems are " ^ (string_of_logic logic'))
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
385 |
val _ = if (null errs) then () else warning ("Can't clausify thms: " ^ (ResClause.paren_pack errs))
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
386 |
val helpers = case logic' of FOL => [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
387 |
| HOL => [HOL_helper1 ()] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
388 |
| _ => [HOL_helper1(),HOL_comb()] (*HOLC or HOLCS*) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
389 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
390 |
include_min_comb:=false; (*reset to false*) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
391 |
include_combS:=false; (*reset to false*) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
392 |
(helpers,files4 @ files1 @ files2 @ files3) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
393 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
394 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
395 |
fun write_out_fol (claR,simpR,userR,hyp_cls,conj_cls,n,err) = write_out_g FOL atp_axioms_fol atp_conjectures_fol (claR,simpR,userR,hyp_cls,conj_cls,n,err); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
396 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
397 |
fun write_out_hol (claR,simpR,userR,hyp_cls,conj_cls,n,err) = write_out_g HOL atp_axioms_hol atp_conjectures_hol (claR,simpR,userR,hyp_cls,conj_cls,n,err); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
398 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
399 |
fun write_out_fol_ts ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
400 |
let val ts_file = if (!fol_keep_types) then tptp_types_sorts (ProofContext.theory_of ctxt) else [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
401 |
val (helpers,files) = write_out_fol (claR,simpR,userR,hyp_cls,conj_cls,n,err) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
402 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
403 |
(helpers,files@ts_file) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
404 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
405 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
406 |
fun write_out_hol_ts ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
407 |
let val ts_file = if (!hol_keep_types) then tptp_types_sorts (ProofContext.theory_of ctxt) else [] |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
408 |
val (helpers,files) = write_out_hol (claR,simpR,userR,hyp_cls,conj_cls,n,err) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
409 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
410 |
(helpers,files@ts_file) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
411 |
end; |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
412 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
413 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
414 |
fun prep_atp_input mode ctxt conjectures user_thms n = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
415 |
let val conj_cls = map prop_of (make_clauses conjectures) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
416 |
val (userR,simpR,claR,errs) = cnf_rules_tms ctxt user_thms (!include_claset,!include_simpset) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
417 |
val hyp_cls = map prop_of (cnf_hyps_thms ctxt) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
418 |
val logic = case mode of Auto => problem_logic (conj_cls,hyp_cls,userR,claR,simpR) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
419 |
| Fol => FOL |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
420 |
| Hol => HOL |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
421 |
in |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
422 |
case logic of FOL => write_out_fol_ts ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,errs) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
423 |
| _ => write_out_hol_ts ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,errs) |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
424 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
425 |
end; |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
426 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
427 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
428 |
(***************************************************************) |
|
18086
051b7f323b4c
Changed the way additional lemmas are passed to ATP methods for proof of a goal: now only list them after the methods' names.
mengj
parents:
18014
diff
changeset
|
429 |
(* setup ATPs as Isabelle methods *) |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
430 |
(***************************************************************) |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
431 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
432 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
433 |
fun atp_meth' tac ths ctxt = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
434 |
Method.SIMPLE_METHOD' HEADGOAL |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
435 |
(tac ctxt ths); |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
436 |
|
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
437 |
fun atp_meth tac ths ctxt = |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
438 |
let val _ = ResClause.init (ProofContext.theory_of ctxt) |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
439 |
in |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
440 |
atp_meth' tac ths ctxt |
|
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
441 |
end; |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
442 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
443 |
|
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
444 |
fun atp_method tac = Method.thms_ctxt_args (atp_meth tac); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
445 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
446 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
447 |
(*************Remove tmp files********************************) |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
448 |
fun rm_tmp_files1 [] = () |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
449 |
| rm_tmp_files1 (f::fs) = |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
450 |
(OS.FileSys.remove f; rm_tmp_files1 fs); |
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
451 |
|
|
17939
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
452 |
fun cond_rm_tmp files = |
|
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
453 |
if !keep_atp_input then warning "ATP input kept..." |
|
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
454 |
else (warning "deleting ATP inputs..."; rm_tmp_files1 files); |
|
17905
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
455 |
|
|
1574533861b1
Added files in order to use external ATPs as oracles and invoke these ATPs by calling Isabelle methods (currently "vampire" and "eprover").
mengj
parents:
diff
changeset
|
456 |
|
| 17907 | 457 |
end |