author | paulson |
Fri, 03 Feb 2006 17:08:03 +0100 | |
changeset 18920 | 7635e0060cd4 |
parent 18863 | a113b6839df1 |
child 19160 | c1b3aa0a6827 |
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; |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
13 |
|
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
14 |
(* use them to set and find type levels of HOL clauses *) |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
15 |
val hol_full_types = ResHolClause.full_types; |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
16 |
val hol_partial_types = ResHolClause.partial_types; |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
17 |
val hol_const_types_only = ResHolClause.const_types_only; |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
18 |
val hol_no_types = ResHolClause.no_types; |
18748 | 19 |
fun hol_typ_level () = ResHolClause.find_typ_level (); |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
20 |
|
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
21 |
fun is_typed_hol () = |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
22 |
let val tp_level = hol_typ_level() |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
23 |
in |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
24 |
not (tp_level = ResHolClause.T_NONE) |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
25 |
end; |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
26 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
27 |
val include_combS = ResHolClause.include_combS; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
28 |
val include_min_comb = ResHolClause.include_min_comb; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
29 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
30 |
|
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
|
31 |
|
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
|
32 |
(*******************************************************) |
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
|
33 |
(* 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
|
34 |
(*******************************************************) |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
35 |
fun full_typed_comb () = |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
36 |
if !ResHolClause.include_combS then |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
37 |
(ResAtp.helper_path "E_HOME" "additionals/full_comb_inclS" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
38 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/full_comb_inclS") |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
39 |
else |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
40 |
(ResAtp.helper_path "E_HOME" "additionals/full_comb_noS" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
41 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/full_comb_noS"); |
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
|
42 |
|
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
43 |
fun partial_typed_comb () = |
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
44 |
if !ResHolClause.include_combS then |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
45 |
(ResAtp.helper_path "E_HOME" "additionals/par_comb_inclS" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
46 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/par_comb_inclS") |
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
47 |
else |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
48 |
(ResAtp.helper_path "E_HOME" "additionals/par_comb_noS" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
49 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/par_comb_noS"); |
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
50 |
|
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
51 |
fun const_typed_comb () = |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
52 |
if !ResHolClause.include_combS then |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
53 |
(ResAtp.helper_path "E_HOME" "additionals/const_comb_inclS" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
54 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/const_comb_inclS") |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
55 |
else |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
56 |
(ResAtp.helper_path "E_HOME" "additionals/const_comb_noS" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
57 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/const_comb_noS"); |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
58 |
|
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
59 |
fun untyped_comb () = |
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
60 |
if !ResHolClause.include_combS then |
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
61 |
(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
|
62 |
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
|
63 |
else |
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
64 |
(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
|
65 |
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
|
66 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
67 |
|
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
68 |
fun full_typed_HOL_helper1 () = |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
69 |
ResAtp.helper_path "E_HOME" "additionals/full_helper1" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
70 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/full_helper1"; |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
71 |
|
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
72 |
fun partial_typed_HOL_helper1 () = |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
73 |
ResAtp.helper_path "E_HOME" "additionals/par_helper1" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
74 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/par_helper1"; |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
75 |
|
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
76 |
fun const_typed_HOL_helper1 () = |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
77 |
ResAtp.helper_path "E_HOME" "additionals/const_helper1" |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
78 |
handle _ => ResAtp.helper_path "VAMPIRE_HOME" "additionals/const_helper1"; |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
79 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
80 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
81 |
fun untyped_HOL_helper1 () = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
82 |
ResAtp.helper_path "E_HOME" "additionals/u_helper1" |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
83 |
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
|
84 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
85 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
86 |
fun HOL_helper1 () = |
18748 | 87 |
let val tp_level = !ResHolClause.typ_level |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
88 |
in |
18748 | 89 |
case tp_level of ResHolClause.T_PARTIAL => (warning "Partial type helper"; partial_typed_HOL_helper1 ()) |
90 |
| ResHolClause.T_FULL => (warning "Full type helper"; full_typed_HOL_helper1 ()) |
|
91 |
| ResHolClause.T_CONST => (warning "Const type helper"; const_typed_HOL_helper1 ()) |
|
92 |
| ResHolClause.T_NONE => (warning "Untyped helper"; untyped_HOL_helper1 ()) |
|
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
93 |
end; |
18273
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 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
96 |
fun HOL_comb () = |
18748 | 97 |
let val tp_level = !ResHolClause.typ_level |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
98 |
in |
18748 | 99 |
case tp_level of ResHolClause.T_FULL => (warning "Full type comb"; full_typed_comb ()) |
100 |
| ResHolClause.T_PARTIAL => (warning "Partial type comb"; partial_typed_comb ()) |
|
101 |
| ResHolClause.T_CONST => (warning "Const type comb"; const_typed_comb ()) |
|
102 |
| ResHolClause.T_NONE => (warning "Untyped comb"; untyped_comb ()) |
|
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
103 |
end; |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
104 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
105 |
|
18401 | 106 |
fun atp_input_file file = |
107 |
let val file' = !ResAtp.problem_name ^ "_" ^ file |
|
108 |
in |
|
109 |
if !ResAtp.destdir = "" then File.platform_path (File.tmp_path (Path.basic file')) |
|
110 |
else if File.exists (File.unpack_platform_path (!ResAtp.destdir)) |
|
111 |
then !ResAtp.destdir ^ "/" ^ file' |
|
112 |
else error ("No such directory: " ^ !ResAtp.destdir) |
|
113 |
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
|
114 |
|
18401 | 115 |
fun claset_file () = atp_input_file "claset"; |
116 |
fun simpset_file () = atp_input_file "simp"; |
|
117 |
fun local_lemma_file () = atp_input_file "locallemmas"; |
|
118 |
fun hyps_file () = atp_input_file "hyps"; |
|
119 |
fun prob_file _ = atp_input_file ""; |
|
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
|
120 |
|
18401 | 121 |
fun types_sorts_file () = atp_input_file "typesorts"; |
122 |
||
123 |
||
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
|
124 |
|
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
|
125 |
(*******************************************************) |
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
|
126 |
(* 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
|
127 |
(* 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
|
128 |
(* 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
|
129 |
(* 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
|
130 |
(*******************************************************) |
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
|
131 |
|
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
|
132 |
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
|
133 |
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
|
134 |
|
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
|
135 |
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
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
|
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
|
142 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
143 |
(******************************************************************) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
144 |
(* 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
|
145 |
(******************************************************************) |
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 |
datatype logic = FOL | HOL | HOLC | HOLCS; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
148 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
149 |
fun string_of_logic FOL = "FOL" |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
150 |
| string_of_logic HOL = "HOL" |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
151 |
| string_of_logic HOLC = "HOLC" |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
152 |
| string_of_logic HOLCS = "HOLCS"; |
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 |
(*HOLCS will not occur here*) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
155 |
fun upgrade_lg HOLC _ = HOLC |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
156 |
| upgrade_lg HOL HOLC = HOLC |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
157 |
| upgrade_lg HOL _ = HOL |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
158 |
| upgrade_lg FOL lg = lg; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
159 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
160 |
(* check types *) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
161 |
fun has_bool (Type("bool",_)) = true |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
162 |
| has_bool (Type(_, Ts)) = exists has_bool Ts |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
163 |
| has_bool _ = false; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
164 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
165 |
fun has_bool_arg tp = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
166 |
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
|
167 |
in |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
168 |
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
|
169 |
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
|
170 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
171 |
fun is_fn_tp (Type("fun",_)) = true |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
172 |
| 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
|
173 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
174 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
175 |
exception FN_LG of term; |
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 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
|
178 |
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
|
179 |
| 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
|
180 |
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
|
181 |
| 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
|
182 |
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
|
183 |
else (lg,t ins seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
184 |
| 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
|
185 |
| fn_lg f _ = raise FN_LG(f); |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
186 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
187 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
188 |
fun term_lg [] (lg,seen) = (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
189 |
| term_lg (tm::tms) (FOL,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
190 |
let val (f,args) = strip_comb tm |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
191 |
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
|
192 |
else fn_lg f (FOL,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
193 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
194 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
195 |
term_lg (args@tms) (lg',seen') |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
196 |
end |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
197 |
| term_lg _ (lg,seen) = (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
198 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
199 |
exception PRED_LG of term; |
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 |
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
|
202 |
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
|
203 |
| 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
|
204 |
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
|
205 |
| 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
|
206 |
| pred_lg P _ = raise PRED_LG(P); |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
207 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
208 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
209 |
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
|
210 |
| lit_lg P (lg,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
211 |
let val (pred,args) = strip_comb P |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
212 |
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
|
213 |
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
|
214 |
in |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
215 |
term_lg args (lg',seen') |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
216 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
217 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
218 |
fun lits_lg [] (lg,seen) = (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
219 |
| lits_lg (lit::lits) (FOL,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
220 |
lits_lg lits (lit_lg lit (FOL,seen)) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
221 |
| lits_lg lits (lg,seen) = (lg,seen); |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
222 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
223 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
224 |
fun logic_of_clause tm (lg,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
225 |
let val tm' = HOLogic.dest_Trueprop tm |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
226 |
val disjs = HOLogic.dest_disj tm' |
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 |
lits_lg disjs (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
229 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
230 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
231 |
fun lits_lg [] (lg,seen) = (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
232 |
| lits_lg (lit::lits) (FOL,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
233 |
lits_lg lits (lit_lg lit (FOL,seen)) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
234 |
| lits_lg lits (lg,seen) = (lg,seen); |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
235 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
236 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
237 |
fun logic_of_clause tm (lg,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
238 |
let val tm' = HOLogic.dest_Trueprop tm |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
239 |
val disjs = HOLogic.dest_disj tm' |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
240 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
241 |
lits_lg disjs (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
242 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
243 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
244 |
fun logic_of_clauses [] (lg,seen) = (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
245 |
| logic_of_clauses (cls::clss) (FOL,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
246 |
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
|
247 |
| 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
|
248 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
249 |
fun logic_of_nclauses [] (lg,seen) = (lg,seen) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
250 |
| logic_of_nclauses (cls::clss) (FOL,seen) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
251 |
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
|
252 |
| logic_of_nclauses clss (lg,seen) = (lg,seen); |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
253 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
254 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
255 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
256 |
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
|
257 |
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
|
258 |
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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
263 |
lg5 |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
264 |
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
|
265 |
|
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
|
266 |
|
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
|
267 |
|
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
|
268 |
(***************************************************************) |
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
|
269 |
(* 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
|
270 |
(* 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
|
271 |
(***************************************************************) |
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
|
272 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
273 |
(**** CNF rules and hypothesis ****) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
val errs = err3 @ err2 @ err1 |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
281 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
282 |
(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
|
283 |
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
|
284 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
285 |
fun cnf_hyps_thms ctxt = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
286 |
let val ths = ProofContext.prems_of ctxt |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
287 |
in |
18508 | 288 |
ResClause.union_all (map ResAxioms.skolem_thm ths) |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
289 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
290 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
291 |
(**** clausification ****) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
292 |
fun cls_axiom_fol _ _ [] = [] |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
293 |
| cls_axiom_fol name i (tm::tms) = |
18920 | 294 |
case ResClause.make_axiom_clause tm (name,i) of |
295 |
SOME cls => cls :: cls_axiom_fol name (i+1) tms |
|
296 |
| NONE => cls_axiom_fol name i tms; |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
297 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
298 |
fun cls_axiom_hol _ _ [] = [] |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
299 |
| cls_axiom_hol name i (tm::tms) = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
300 |
(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
|
301 |
|
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
|
302 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
303 |
fun filtered_tptp_axiom_fol name clss = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
304 |
(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
|
305 |
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
|
306 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
307 |
fun filtered_tptp_axiom_hol name clss = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
308 |
(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
|
309 |
handle _ => ([],[name]); |
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
310 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
311 |
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
|
312 |
| 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
|
313 |
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
|
314 |
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
|
315 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
316 |
case clsstrs of [] => (nclss1,err_name_list @ err1) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
317 |
| _ => (clsstrs::nclss1,err1) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
318 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
319 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
320 |
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
|
321 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
322 |
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
|
323 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
324 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
325 |
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
|
326 |
let val out = TextIO.openOut file |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
327 |
val (clss,errs) = tptp_ax_fn rules |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
328 |
val clss' = ResClause.union_all clss |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
329 |
in |
18863 | 330 |
ResClause.writeln_strs out clss'; |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
331 |
TextIO.closeOut out; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
332 |
([file],errs) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
333 |
end; |
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
334 |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
335 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
336 |
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
|
337 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
338 |
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
|
339 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
340 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
341 |
fun filtered_tptp_conjectures_fol terms = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
342 |
let val clss = ResClause.make_conjecture_clauses terms |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
343 |
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
|
344 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
345 |
ListPair.unzip (map ResClause.clause2tptp clss') |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
346 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
347 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
348 |
fun filtered_tptp_conjectures_hol terms = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
349 |
let val clss = ResHolClause.make_conjecture_clauses terms |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
350 |
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
|
351 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
352 |
ListPair.unzip (map ResHolClause.clause2tptp clss') |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
353 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
354 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
355 |
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
|
356 |
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
|
357 |
val tfree_lits = ResClause.union_all tfree_litss |
18863 | 358 |
val tfree_clss = map ResClause.tptp_tfree_clause tfree_lits |
18401 | 359 |
val hypsfile = hyps_file () |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
360 |
val out = TextIO.openOut(hypsfile) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
361 |
in |
18863 | 362 |
ResClause.writeln_strs out (tfree_clss @ tptp_h_clss); |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
363 |
TextIO.closeOut out; warning hypsfile; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
364 |
([hypsfile],tfree_lits) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
365 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
366 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
367 |
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
|
368 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
369 |
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
|
370 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
371 |
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
|
372 |
let val (tptp_c_clss,tfree_litss) = filt_conj_fn conj_cls |
18863 | 373 |
val tfree_clss = map ResClause.tptp_tfree_clause ((ResClause.union_all tfree_litss) \\ tfrees) |
18401 | 374 |
val probfile = prob_file 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
|
375 |
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
|
376 |
in |
18863 | 377 |
ResClause.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
|
378 |
TextIO.closeOut out; |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
379 |
warning probfile; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
380 |
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
|
381 |
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
|
382 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
383 |
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
|
384 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
385 |
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
|
386 |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
387 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
388 |
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
|
389 |
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
|
390 |
in |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
391 |
[probfile] |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
392 |
end |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
393 |
| 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
|
394 |
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
|
395 |
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
|
396 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
397 |
(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
|
398 |
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
|
399 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
400 |
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
|
401 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
402 |
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
|
403 |
|
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
|
404 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
405 |
(**** types and sorts ****) |
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
406 |
fun tptp_types_sorts thy = |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
407 |
let val classrel_clauses = ResClause.classrel_clauses_thy thy |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
408 |
val arity_clauses = ResClause.arity_clause_thy thy |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
409 |
val classrel_cls = map ResClause.tptp_classrelClause classrel_clauses |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
410 |
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
|
411 |
fun write_ts () = |
18401 | 412 |
let val tsfile = types_sorts_file () |
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
413 |
val out = TextIO.openOut(tsfile) |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
414 |
in |
18863 | 415 |
ResClause.writeln_strs out (classrel_cls @ arity_cls); |
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
416 |
TextIO.closeOut out; |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
417 |
[tsfile] |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
418 |
end |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
419 |
in |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
420 |
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
|
421 |
else |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
422 |
write_ts () |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
423 |
end; |
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
424 |
|
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
425 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
426 |
(******* write to files ******) |
18001
6ca14bec7cd5
Added new functions to handle HOL goals and lemmas.
mengj
parents:
17939
diff
changeset
|
427 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
428 |
datatype mode = Auto | Fol | Hol; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
429 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
430 |
fun write_out_g logic atp_ax_fn atp_conj_fn (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
18401 | 431 |
let val (files1,err1) = if (null claR) then ([],[]) else (atp_ax_fn claR (claset_file())) |
432 |
val (files2,err2) = if (null simpR) then ([],[]) else (atp_ax_fn simpR (simpset_file ())) |
|
433 |
val (files3,err3) = if (null userR) then ([],[]) else (atp_ax_fn userR (local_lemma_file ())) |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
434 |
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
|
435 |
val errs = err1 @ err2 @ err3 @ err |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
436 |
val logic' = if !include_combS then HOLCS |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
437 |
else |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
438 |
if !include_min_comb then HOLC else logic |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
439 |
val _ = warning ("Problems are " ^ (string_of_logic logic')) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
440 |
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
|
441 |
val helpers = case logic' of FOL => [] |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
442 |
| HOL => [HOL_helper1 ()] |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
443 |
| _ => [HOL_helper1(),HOL_comb()] (*HOLC or HOLCS*) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
444 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
445 |
(helpers,files4 @ files1 @ files2 @ files3) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
446 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
447 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
448 |
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
|
449 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
450 |
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
|
451 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
452 |
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
|
453 |
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
|
454 |
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
|
455 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
456 |
(helpers,files@ts_file) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
457 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
458 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
459 |
fun write_out_hol_ts ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
460 |
let val ts_file = if (is_typed_hol()) then tptp_types_sorts (ProofContext.theory_of ctxt) else [] |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
461 |
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
|
462 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
463 |
(helpers,files@ts_file) |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
464 |
end; |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
465 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
466 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
467 |
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
|
468 |
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
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
| Fol => FOL |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
473 |
| Hol => HOL |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
474 |
in |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
475 |
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
|
476 |
| _ => 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
|
477 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
478 |
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
|
479 |
|
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
|
480 |
|
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
|
481 |
(***************************************************************) |
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
|
482 |
(* 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
|
483 |
(***************************************************************) |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
484 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
485 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
486 |
fun atp_meth' tac ths ctxt = |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
487 |
Method.SIMPLE_METHOD' HEADGOAL |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
488 |
(tac ctxt ths); |
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
489 |
|
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
490 |
fun atp_meth tac ths ctxt = |
18357
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
491 |
let val thy = ProofContext.theory_of ctxt |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
492 |
val _ = ResClause.init thy |
c5030cdbf8da
Added more functions for new type embedding of HOL clauses.
mengj
parents:
18273
diff
changeset
|
493 |
val _ = ResHolClause.init thy |
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
|
494 |
in |
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
495 |
atp_meth' tac ths ctxt |
18197
082a2bd6f655
-- added combinator reduction axioms (typed and untyped) for HOL goals.
mengj
parents:
18141
diff
changeset
|
496 |
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
|
497 |
|
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
|
498 |
|
18273
e15a825da262
Added in four control flags for HOL and FOL translations.
mengj
parents:
18197
diff
changeset
|
499 |
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
|
500 |
|
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
|
501 |
|
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
|
502 |
(*************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
|
503 |
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
|
504 |
| 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
|
505 |
(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
|
506 |
|
17939
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
507 |
fun cond_rm_tmp files = |
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
508 |
if !keep_atp_input then warning "ATP input kept..." |
18401 | 509 |
else if !ResAtp.destdir <> "" then warning ("ATP input kept in directory " ^ (!ResAtp.destdir)) |
17939
3925ab7b8a18
Merged theory ResAtpOracle.thy into ResAtpMethods.thy
mengj
parents:
17907
diff
changeset
|
510 |
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
|
511 |
|
17907 | 512 |
end |