| author | wenzelm |
| Wed, 09 Nov 2011 15:18:39 +0100 | |
| changeset 45424 | 01d75cf04497 |
| parent 45304 | e6901aa86a9e |
| child 45828 | 3b8606fba2dd |
| permissions | -rw-r--r-- |
| 38047 | 1 |
(* Title: HOL/Tools/ATP/atp_problem.ML |
| 38027 | 2 |
Author: Jia Meng, Cambridge University Computer Laboratory and NICTA |
|
37509
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
3 |
Author: Jasmin Blanchette, TU Muenchen |
|
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
4 |
|
| 39452 | 5 |
Abstract representation of ATP problems and TPTP syntax. |
|
37509
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
6 |
*) |
|
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
7 |
|
|
38019
e207a64e1e0b
complete renaming of "Sledgehammer_TPTP_Format" to "ATP_Problem"
blanchet
parents:
38018
diff
changeset
|
8 |
signature ATP_PROBLEM = |
|
37509
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
9 |
sig |
|
43676
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
10 |
datatype ('a, 'b) ho_term =
|
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
11 |
ATerm of 'a * ('a, 'b) ho_term list |
|
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
12 |
AAbs of ('a * 'b) * ('a, 'b) ho_term
|
| 37992 | 13 |
datatype quantifier = AForall | AExists |
| 43163 | 14 |
datatype connective = ANot | AAnd | AOr | AImplies | AIff |
|
42531
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
15 |
datatype ('a, 'b, 'c) formula =
|
|
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
16 |
AQuant of quantifier * ('a * 'b option) list * ('a, 'b, 'c) formula |
|
|
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
17 |
AConn of connective * ('a, 'b, 'c) formula list |
|
|
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
18 |
AAtom of 'c |
|
37994
b04307085a09
make TPTP generator accept full first-order formulas
blanchet
parents:
37993
diff
changeset
|
19 |
|
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
20 |
datatype 'a ho_type = |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
21 |
AType of 'a * 'a ho_type list | |
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
22 |
AFun of 'a ho_type * 'a ho_type | |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
23 |
ATyAbs of 'a list * 'a ho_type |
| 42963 | 24 |
|
| 44754 | 25 |
datatype tptp_polymorphism = TPTP_Monomorphic | TPTP_Polymorphic |
26 |
datatype tptp_explicitness = TPTP_Implicit | TPTP_Explicit |
|
|
44589
0a1dfc6365e9
first step towards polymorphic TFF + changed defaults for Vampire
blanchet
parents:
44501
diff
changeset
|
27 |
datatype thf_flavor = THF_Without_Choice | THF_With_Choice |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
28 |
datatype dfg_flavor = DFG_Unsorted | DFG_Sorted |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
29 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
30 |
datatype atp_format = |
|
44235
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
31 |
CNF | |
|
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
32 |
CNF_UEQ | |
|
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
33 |
FOF | |
| 44754 | 34 |
TFF of tptp_polymorphism * tptp_explicitness | |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
35 |
THF of tptp_polymorphism * tptp_explicitness * thf_flavor | |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
36 |
DFG of dfg_flavor |
|
44235
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
37 |
|
|
42525
7a506b0b644f
distinguish FOF and TFF (typed first-order) in ATP abstract syntax tree
blanchet
parents:
42449
diff
changeset
|
38 |
datatype formula_kind = Axiom | Definition | Lemma | Hypothesis | Conjecture |
|
42527
6a9458524f01
reintroduced constructor for formulas, and automatically detect which logic to use (TFF or FOF) to avoid clutter
blanchet
parents:
42526
diff
changeset
|
39 |
datatype 'a problem_line = |
| 42963 | 40 |
Decl of string * 'a * 'a ho_type | |
| 44402 | 41 |
Formula of string * formula_kind |
42 |
* ('a, 'a ho_type, ('a, 'a ho_type) ho_term) formula
|
|
43 |
* (string, string ho_type) ho_term option |
|
44 |
* (string, string ho_type) ho_term option |
|
|
38017
3ad3e3ca2451
move Sledgehammer-specific code out of "Sledgehammer_TPTP_Format"
blanchet
parents:
38014
diff
changeset
|
45 |
type 'a problem = (string * 'a problem_line list) list |
| 37992 | 46 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
47 |
val isabelle_info_prefix : string |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
48 |
val isabelle_info : atp_format -> string -> (string, 'a) ho_term option |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
49 |
val introN : string |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
50 |
val elimN : string |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
51 |
val simpN : string |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
52 |
val tptp_cnf : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
53 |
val tptp_fof : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
54 |
val tptp_tff : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
55 |
val tptp_thf : string |
| 42967 | 56 |
val tptp_has_type : string |
|
42962
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
57 |
val tptp_type_of_types : string |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
58 |
val tptp_bool_type : string |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
59 |
val tptp_individual_type : string |
| 42963 | 60 |
val tptp_fun_type : string |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
61 |
val tptp_product_type : string |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
62 |
val tptp_forall : string |
| 43678 | 63 |
val tptp_ho_forall : string |
| 44650 | 64 |
val tptp_pi_binder : string |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
65 |
val tptp_exists : string |
| 43678 | 66 |
val tptp_ho_exists : string |
| 44495 | 67 |
val tptp_choice : string |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
68 |
val tptp_not : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
69 |
val tptp_and : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
70 |
val tptp_or : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
71 |
val tptp_implies : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
72 |
val tptp_if : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
73 |
val tptp_iff : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
74 |
val tptp_not_iff : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
75 |
val tptp_app : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
76 |
val tptp_not_infix : string |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
77 |
val tptp_equal : string |
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
78 |
val tptp_old_equal : string |
|
42966
4e2d6c1e5392
more work on parsing LEO-II proofs without lambdas
blanchet
parents:
42963
diff
changeset
|
79 |
val tptp_false : string |
|
4e2d6c1e5392
more work on parsing LEO-II proofs without lambdas
blanchet
parents:
42963
diff
changeset
|
80 |
val tptp_true : string |
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
81 |
val tptp_empty_list : string |
|
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
82 |
val is_tptp_equal : string -> bool |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
83 |
val is_built_in_tptp_symbol : string -> bool |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
84 |
val is_tptp_variable : string -> bool |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
85 |
val is_tptp_user_symbol : string -> bool |
|
44595
444d111bde7d
generate properly typed TFF1 (PFF) problems in the presence of type class predicates
blanchet
parents:
44594
diff
changeset
|
86 |
val atype_of_types : (string * string) ho_type |
|
444d111bde7d
generate properly typed TFF1 (PFF) problems in the presence of type class predicates
blanchet
parents:
44594
diff
changeset
|
87 |
val bool_atype : (string * string) ho_type |
|
444d111bde7d
generate properly typed TFF1 (PFF) problems in the presence of type class predicates
blanchet
parents:
44594
diff
changeset
|
88 |
val individual_atype : (string * string) ho_type |
| 42942 | 89 |
val mk_anot : ('a, 'b, 'c) formula -> ('a, 'b, 'c) formula
|
90 |
val mk_aconn : |
|
91 |
connective -> ('a, 'b, 'c) formula -> ('a, 'b, 'c) formula
|
|
92 |
-> ('a, 'b, 'c) formula
|
|
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
93 |
val aconn_fold : |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
94 |
bool option -> (bool option -> 'a -> 'b -> 'b) -> connective * 'a list |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
95 |
-> 'b -> 'b |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
96 |
val aconn_map : |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
97 |
bool option -> (bool option -> 'a -> ('b, 'c, 'd) formula)
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
98 |
-> connective * 'a list -> ('b, 'c, 'd) formula
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
99 |
val formula_fold : |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
100 |
bool option -> (bool option -> 'c -> 'd -> 'd) -> ('a, 'b, 'c) formula
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
101 |
-> 'd -> 'd |
|
42944
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
102 |
val formula_map : ('c -> 'd) -> ('a, 'b, 'c) formula -> ('a, 'b, 'd) formula
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
103 |
val is_format_higher_order : atp_format -> bool |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
104 |
val is_format_typed : atp_format -> bool |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
105 |
val lines_for_atp_problem : atp_format -> string problem -> string list |
|
43092
93ec303e1917
more work on new metis that exploits the powerful new type encodings
blanchet
parents:
43085
diff
changeset
|
106 |
val ensure_cnf_problem : |
|
93ec303e1917
more work on new metis that exploits the powerful new type encodings
blanchet
parents:
43085
diff
changeset
|
107 |
(string * string) problem -> (string * string) problem |
| 42939 | 108 |
val filter_cnf_ueq_problem : |
109 |
(string * string) problem -> (string * string) problem |
|
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
110 |
val declare_undeclared_syms_in_atp_problem : |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
111 |
string -> string -> (string * string) problem -> (string * string) problem |
| 39452 | 112 |
val nice_atp_problem : |
|
38017
3ad3e3ca2451
move Sledgehammer-specific code out of "Sledgehammer_TPTP_Format"
blanchet
parents:
38014
diff
changeset
|
113 |
bool -> ('a * (string * string) problem_line list) list
|
|
3ad3e3ca2451
move Sledgehammer-specific code out of "Sledgehammer_TPTP_Format"
blanchet
parents:
38014
diff
changeset
|
114 |
-> ('a * string problem_line list) list
|
|
3ad3e3ca2451
move Sledgehammer-specific code out of "Sledgehammer_TPTP_Format"
blanchet
parents:
38014
diff
changeset
|
115 |
* (string Symtab.table * string Symtab.table) option |
|
37509
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
116 |
end; |
|
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
117 |
|
|
38019
e207a64e1e0b
complete renaming of "Sledgehammer_TPTP_Format" to "ATP_Problem"
blanchet
parents:
38018
diff
changeset
|
118 |
structure ATP_Problem : ATP_PROBLEM = |
|
37509
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
119 |
struct |
|
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
120 |
|
|
43085
0a2f5b86bdd7
first step in sharing more code between ATP and Metis translation
blanchet
parents:
43000
diff
changeset
|
121 |
open ATP_Util |
|
0a2f5b86bdd7
first step in sharing more code between ATP and Metis translation
blanchet
parents:
43000
diff
changeset
|
122 |
|
|
0a2f5b86bdd7
first step in sharing more code between ATP and Metis translation
blanchet
parents:
43000
diff
changeset
|
123 |
|
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
124 |
(** ATP problem **) |
|
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
125 |
|
|
43676
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
126 |
datatype ('a, 'b) ho_term =
|
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
127 |
ATerm of 'a * ('a, 'b) ho_term list |
|
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
128 |
AAbs of ('a * 'b) * ('a, 'b) ho_term
|
|
37961
6a48c85a211a
first step in using "fof" rather than "cnf" in TPTP problems
blanchet
parents:
37931
diff
changeset
|
129 |
datatype quantifier = AForall | AExists |
| 43163 | 130 |
datatype connective = ANot | AAnd | AOr | AImplies | AIff |
|
42531
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
131 |
datatype ('a, 'b, 'c) formula =
|
|
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
132 |
AQuant of quantifier * ('a * 'b option) list * ('a, 'b, 'c) formula |
|
|
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
133 |
AConn of connective * ('a, 'b, 'c) formula list |
|
|
a462dbaa584f
added more rudimentary type support to Sledgehammer's ATP encoding
blanchet
parents:
42530
diff
changeset
|
134 |
AAtom of 'c |
|
37961
6a48c85a211a
first step in using "fof" rather than "cnf" in TPTP problems
blanchet
parents:
37931
diff
changeset
|
135 |
|
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
136 |
datatype 'a ho_type = |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
137 |
AType of 'a * 'a ho_type list | |
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
138 |
AFun of 'a ho_type * 'a ho_type | |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
139 |
ATyAbs of 'a list * 'a ho_type |
| 42963 | 140 |
|
| 44754 | 141 |
datatype tptp_polymorphism = TPTP_Monomorphic | TPTP_Polymorphic |
142 |
datatype tptp_explicitness = TPTP_Implicit | TPTP_Explicit |
|
|
44589
0a1dfc6365e9
first step towards polymorphic TFF + changed defaults for Vampire
blanchet
parents:
44501
diff
changeset
|
143 |
datatype thf_flavor = THF_Without_Choice | THF_With_Choice |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
144 |
datatype dfg_flavor = DFG_Unsorted | DFG_Sorted |
| 44499 | 145 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
146 |
datatype atp_format = |
|
44235
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
147 |
CNF | |
|
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
148 |
CNF_UEQ | |
|
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
149 |
FOF | |
| 44754 | 150 |
TFF of tptp_polymorphism * tptp_explicitness | |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
151 |
THF of tptp_polymorphism * tptp_explicitness * thf_flavor | |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
152 |
DFG of dfg_flavor |
|
44235
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
153 |
|
|
42525
7a506b0b644f
distinguish FOF and TFF (typed first-order) in ATP abstract syntax tree
blanchet
parents:
42449
diff
changeset
|
154 |
datatype formula_kind = Axiom | Definition | Lemma | Hypothesis | Conjecture |
|
42527
6a9458524f01
reintroduced constructor for formulas, and automatically detect which logic to use (TFF or FOF) to avoid clutter
blanchet
parents:
42526
diff
changeset
|
155 |
datatype 'a problem_line = |
| 42963 | 156 |
Decl of string * 'a * 'a ho_type | |
|
43676
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
157 |
Formula of string * formula_kind * ('a, 'a ho_type, ('a, 'a ho_type) ho_term) formula
|
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
158 |
* (string, string ho_type) ho_term option * (string, string ho_type) ho_term option |
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
159 |
type 'a problem = (string * 'a problem_line list) list |
|
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
160 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
161 |
val isabelle_info_prefix = "isabelle_" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
162 |
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
163 |
(* Currently, only newer versions of SPASS, with sorted DFG format support, can |
|
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
164 |
process Isabelle metainformation. *) |
|
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
165 |
fun isabelle_info (DFG DFG_Sorted) s = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
166 |
SOME (ATerm ("[]", [ATerm (isabelle_info_prefix ^ s, [])]))
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
167 |
| isabelle_info _ _ = NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
168 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
169 |
val introN = "intro" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
170 |
val elimN = "elim" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
171 |
val simpN = "simp" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
172 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
173 |
fun is_isabelle_info suffix (SOME (ATerm ("[]", [ATerm (s, [])]))) =
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
174 |
s = isabelle_info_prefix ^ suffix |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
175 |
| is_isabelle_info _ _ = false |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
176 |
|
| 42722 | 177 |
(* official TPTP syntax *) |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
178 |
val tptp_cnf = "cnf" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
179 |
val tptp_fof = "fof" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
180 |
val tptp_tff = "tff" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
181 |
val tptp_thf = "thf" |
| 42967 | 182 |
val tptp_has_type = ":" |
|
42962
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
183 |
val tptp_type_of_types = "$tType" |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
184 |
val tptp_bool_type = "$o" |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
185 |
val tptp_individual_type = "$i" |
| 42963 | 186 |
val tptp_fun_type = ">" |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
187 |
val tptp_product_type = "*" |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
188 |
val tptp_forall = "!" |
| 43678 | 189 |
val tptp_ho_forall = "!!" |
| 44650 | 190 |
val tptp_pi_binder = "!>" |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
191 |
val tptp_exists = "?" |
| 43678 | 192 |
val tptp_ho_exists = "??" |
| 44495 | 193 |
val tptp_choice = "@+" |
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
194 |
val tptp_not = "~" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
195 |
val tptp_and = "&" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
196 |
val tptp_or = "|" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
197 |
val tptp_implies = "=>" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
198 |
val tptp_if = "<=" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
199 |
val tptp_iff = "<=>" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
200 |
val tptp_not_iff = "<~>" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
201 |
val tptp_app = "@" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
202 |
val tptp_not_infix = "!" |
|
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
203 |
val tptp_equal = "=" |
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
204 |
val tptp_old_equal = "equal" |
|
42966
4e2d6c1e5392
more work on parsing LEO-II proofs without lambdas
blanchet
parents:
42963
diff
changeset
|
205 |
val tptp_false = "$false" |
|
4e2d6c1e5392
more work on parsing LEO-II proofs without lambdas
blanchet
parents:
42963
diff
changeset
|
206 |
val tptp_true = "$true" |
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
207 |
val tptp_empty_list = "[]" |
| 42722 | 208 |
|
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
209 |
fun is_tptp_equal s = (s = tptp_equal orelse s = tptp_old_equal) |
|
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
210 |
fun is_built_in_tptp_symbol s = |
|
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
211 |
s = tptp_old_equal orelse not (Char.isAlpha (String.sub (s, 0))) |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
212 |
fun is_tptp_variable s = Char.isUpper (String.sub (s, 0)) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
213 |
val is_tptp_user_symbol = not o (is_tptp_variable orf is_built_in_tptp_symbol) |
| 42939 | 214 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
215 |
val atype_of_types = AType (`I tptp_type_of_types, []) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
216 |
val bool_atype = AType (`I tptp_bool_type, []) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
217 |
val individual_atype = AType (`I tptp_individual_type, []) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
218 |
|
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
219 |
fun raw_polarities_of_conn ANot = (SOME false, NONE) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
220 |
| raw_polarities_of_conn AAnd = (SOME true, SOME true) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
221 |
| raw_polarities_of_conn AOr = (SOME true, SOME true) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
222 |
| raw_polarities_of_conn AImplies = (SOME false, SOME true) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
223 |
| raw_polarities_of_conn AIff = (NONE, NONE) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
224 |
fun polarities_of_conn NONE = K (NONE, NONE) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
225 |
| polarities_of_conn (SOME pos) = |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
226 |
raw_polarities_of_conn #> not pos ? pairself (Option.map not) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
227 |
|
| 42942 | 228 |
fun mk_anot (AConn (ANot, [phi])) = phi |
229 |
| mk_anot phi = AConn (ANot, [phi]) |
|
230 |
fun mk_aconn c phi1 phi2 = AConn (c, [phi1, phi2]) |
|
231 |
||
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
232 |
fun aconn_fold pos f (ANot, [phi]) = f (Option.map not pos) phi |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
233 |
| aconn_fold pos f (AImplies, [phi1, phi2]) = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
234 |
f (Option.map not pos) phi1 #> f pos phi2 |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
235 |
| aconn_fold pos f (AAnd, phis) = fold (f pos) phis |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
236 |
| aconn_fold pos f (AOr, phis) = fold (f pos) phis |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
237 |
| aconn_fold _ f (_, phis) = fold (f NONE) phis |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
238 |
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
239 |
fun aconn_map pos f (ANot, [phi]) = AConn (ANot, [f (Option.map not pos) phi]) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
240 |
| aconn_map pos f (AImplies, [phi1, phi2]) = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
241 |
AConn (AImplies, [f (Option.map not pos) phi1, f pos phi2]) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
242 |
| aconn_map pos f (AAnd, phis) = AConn (AAnd, map (f pos) phis) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
243 |
| aconn_map pos f (AOr, phis) = AConn (AOr, map (f pos) phis) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
244 |
| aconn_map _ f (c, phis) = AConn (c, map (f NONE) phis) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
245 |
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
246 |
fun formula_fold pos f = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
247 |
let |
| 44501 | 248 |
fun fld pos (AQuant (_, _, phi)) = fld pos phi |
249 |
| fld pos (AConn conn) = aconn_fold pos fld conn |
|
250 |
| fld pos (AAtom tm) = f pos tm |
|
251 |
in fld pos end |
|
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
252 |
|
|
42944
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
253 |
fun formula_map f (AQuant (q, xs, phi)) = AQuant (q, xs, formula_map f phi) |
|
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
254 |
| formula_map f (AConn (c, phis)) = AConn (c, map (formula_map f) phis) |
|
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
255 |
| formula_map f (AAtom tm) = AAtom (f tm) |
|
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
256 |
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
257 |
fun is_format_higher_order (THF _) = true |
|
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
258 |
| is_format_higher_order _ = false |
| 44499 | 259 |
fun is_format_typed (TFF _) = true |
| 44754 | 260 |
| is_format_typed (THF _) = true |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
261 |
| is_format_typed (DFG DFG_Sorted) = true |
|
44235
85e9dad3c187
distinguish THF syntax with and without choice (Satallax vs. LEO-II)
blanchet
parents:
43987
diff
changeset
|
262 |
| is_format_typed _ = false |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
263 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
264 |
fun tptp_string_for_kind Axiom = "axiom" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
265 |
| tptp_string_for_kind Definition = "definition" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
266 |
| tptp_string_for_kind Lemma = "lemma" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
267 |
| tptp_string_for_kind Hypothesis = "hypothesis" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
268 |
| tptp_string_for_kind Conjecture = "conjecture" |
|
38631
979a0b37f981
prefer TPTP "conjecture" tag to "hypothesis" on ATPs where this is possible;
blanchet
parents:
38613
diff
changeset
|
269 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
270 |
fun tptp_string_for_app format func args = |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
271 |
if is_format_higher_order format then |
| 44787 | 272 |
"(" ^ space_implode (" " ^ tptp_app ^ " ") (func :: args) ^ ")"
|
273 |
else |
|
274 |
func ^ "(" ^ commas args ^ ")"
|
|
275 |
||
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
276 |
fun flatten_type (ATyAbs (tys, ty)) = ATyAbs (tys, flatten_type ty) |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
277 |
| flatten_type (ty as AFun (ty1 as AType _, ty2)) = |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
278 |
(case flatten_type ty2 of |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
279 |
AFun (ty' as AType (s, tys), ty) => |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
280 |
AFun (AType (tptp_product_type, |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
281 |
ty1 :: (if s = tptp_product_type then tys else [ty'])), ty) |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
282 |
| _ => ty) |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
283 |
| flatten_type (ty as AType _) = ty |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
284 |
| flatten_type _ = |
| 42963 | 285 |
raise Fail "unexpected higher-order type in first-order format" |
286 |
||
| 44787 | 287 |
fun str_for_type format ty = |
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
288 |
let |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
289 |
val dfg = (format = DFG DFG_Sorted) |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
290 |
fun str _ (AType (s, [])) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
291 |
if dfg andalso s = tptp_individual_type then "Top" else s |
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
292 |
| str _ (AType (s, tys)) = |
| 44787 | 293 |
let val ss = tys |> map (str false) in |
294 |
if s = tptp_product_type then |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
295 |
ss |> space_implode |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
296 |
(if dfg then ", " else " " ^ tptp_product_type ^ " ") |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
297 |
|> (not dfg andalso length ss > 1) ? enclose "(" ")"
|
| 44787 | 298 |
else |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
299 |
tptp_string_for_app format s ss |
| 44787 | 300 |
end |
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
301 |
| str rhs (AFun (ty1, ty2)) = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
302 |
(str false ty1 |> dfg ? enclose "(" ")") ^ " " ^
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
303 |
(if dfg then "" else tptp_fun_type ^ " ") ^ str true ty2 |
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
304 |
|> not rhs ? enclose "(" ")"
|
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
305 |
| str _ (ATyAbs (ss, ty)) = |
| 44650 | 306 |
tptp_pi_binder ^ "[" ^ |
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
307 |
commas (map (suffix (" " ^ tptp_has_type ^ " " ^ tptp_type_of_types))
|
| 44739 | 308 |
ss) ^ "]: " ^ str false ty |
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
309 |
in str true ty end |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
310 |
|
| 44787 | 311 |
fun string_for_type (format as THF _) ty = str_for_type format ty |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
312 |
| string_for_type format ty = str_for_type format (flatten_type ty) |
| 42963 | 313 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
314 |
fun tptp_string_for_quantifier AForall = tptp_forall |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
315 |
| tptp_string_for_quantifier AExists = tptp_exists |
| 42963 | 316 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
317 |
fun tptp_string_for_connective ANot = tptp_not |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
318 |
| tptp_string_for_connective AAnd = tptp_and |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
319 |
| tptp_string_for_connective AOr = tptp_or |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
320 |
| tptp_string_for_connective AImplies = tptp_implies |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
321 |
| tptp_string_for_connective AIff = tptp_iff |
| 42963 | 322 |
|
|
42962
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
323 |
fun string_for_bound_var format (s, ty) = |
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
324 |
s ^ |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
325 |
(if is_format_typed format then |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
326 |
" " ^ tptp_has_type ^ " " ^ |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
327 |
(ty |> the_default (AType (tptp_individual_type, [])) |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
328 |
|> string_for_type format) |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
329 |
else |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
330 |
"") |
| 42963 | 331 |
|
| 44754 | 332 |
fun is_format_with_choice (THF (_, _, THF_With_Choice)) = true |
333 |
| is_format_with_choice _ = false |
|
334 |
||
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
335 |
fun tptp_string_for_term _ (ATerm (s, [])) = s |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
336 |
| tptp_string_for_term format (ATerm (s, ts)) = |
| 44787 | 337 |
(if s = tptp_empty_list then |
338 |
(* used for lists in the optional "source" field of a derivation *) |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
339 |
"[" ^ commas (map (tptp_string_for_term format) ts) ^ "]" |
| 44787 | 340 |
else if is_tptp_equal s then |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
341 |
space_implode (" " ^ tptp_equal ^ " ")
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
342 |
(map (tptp_string_for_term format) ts) |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
343 |
|> is_format_higher_order format ? enclose "(" ")"
|
| 44787 | 344 |
else case (s = tptp_ho_forall orelse s = tptp_ho_exists, |
345 |
s = tptp_choice andalso is_format_with_choice format, ts) of |
|
346 |
(true, _, [AAbs ((s', ty), tm)]) => |
|
347 |
(* Use syntactic sugar "!" and "?" instead of "!!" and "??" whenever |
|
348 |
possible, to work around LEO-II 1.2.8 parser limitation. *) |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
349 |
tptp_string_for_formula format |
| 44787 | 350 |
(AQuant (if s = tptp_ho_forall then AForall else AExists, |
351 |
[(s', SOME ty)], AAtom tm)) |
|
352 |
| (_, true, [AAbs ((s', ty), tm)]) => |
|
353 |
(* There is code in "ATP_Translate" to ensure that "Eps" is always |
|
354 |
applied to an abstraction. *) |
|
355 |
tptp_choice ^ "[" ^ s' ^ " : " ^ string_for_type format ty ^ "]: " ^ |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
356 |
tptp_string_for_term format tm ^ "" |
| 44787 | 357 |
|> enclose "(" ")"
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
358 |
| _ => tptp_string_for_app format s (map (tptp_string_for_term format) ts)) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
359 |
| tptp_string_for_term (format as THF _) (AAbs ((s, ty), tm)) = |
| 44739 | 360 |
"(^[" ^ s ^ " : " ^ string_for_type format ty ^ "]: " ^ |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
361 |
tptp_string_for_term format tm ^ ")" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
362 |
| tptp_string_for_term _ _ = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
363 |
raise Fail "unexpected term in first-order format" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
364 |
and tptp_string_for_formula format (AQuant (q, xs, phi)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
365 |
tptp_string_for_quantifier q ^ |
| 44739 | 366 |
"[" ^ commas (map (string_for_bound_var format) xs) ^ "]: " ^ |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
367 |
tptp_string_for_formula format phi |
|
42974
347d5197896e
ensure that the argument of logical negation is enclosed in parentheses in THF mode
blanchet
parents:
42968
diff
changeset
|
368 |
|> enclose "(" ")"
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
369 |
| tptp_string_for_formula format |
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
370 |
(AConn (ANot, [AAtom (ATerm ("=" (* tptp_equal *), ts))])) =
|
|
42968
74415622d293
more work on parsing LEO-II proofs and extracting uses of extensionality
blanchet
parents:
42967
diff
changeset
|
371 |
space_implode (" " ^ tptp_not_infix ^ tptp_equal ^ " ")
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
372 |
(map (tptp_string_for_term format) ts) |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
373 |
|> is_format_higher_order format ? enclose "(" ")"
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
374 |
| tptp_string_for_formula format (AConn (c, [phi])) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
375 |
tptp_string_for_connective c ^ " " ^ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
376 |
(tptp_string_for_formula format phi |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
377 |
|> is_format_higher_order format ? enclose "(" ")")
|
|
42974
347d5197896e
ensure that the argument of logical negation is enclosed in parentheses in THF mode
blanchet
parents:
42968
diff
changeset
|
378 |
|> enclose "(" ")"
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
379 |
| tptp_string_for_formula format (AConn (c, phis)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
380 |
space_implode (" " ^ tptp_string_for_connective c ^ " ")
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
381 |
(map (tptp_string_for_formula format) phis) |
|
42974
347d5197896e
ensure that the argument of logical negation is enclosed in parentheses in THF mode
blanchet
parents:
42968
diff
changeset
|
382 |
|> enclose "(" ")"
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
383 |
| tptp_string_for_formula format (AAtom tm) = tptp_string_for_term format tm |
|
37961
6a48c85a211a
first step in using "fof" rather than "cnf" in TPTP problems
blanchet
parents:
37931
diff
changeset
|
384 |
|
| 43692 | 385 |
fun the_source (SOME source) = source |
386 |
| the_source NONE = |
|
387 |
ATerm ("inference",
|
|
388 |
ATerm ("isabelle", []) :: replicate 2 (ATerm ("[]", [])))
|
|
| 42639 | 389 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
390 |
fun tptp_string_for_format CNF = tptp_cnf |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
391 |
| tptp_string_for_format CNF_UEQ = tptp_cnf |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
392 |
| tptp_string_for_format FOF = tptp_fof |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
393 |
| tptp_string_for_format (TFF _) = tptp_tff |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
394 |
| tptp_string_for_format (THF _) = tptp_thf |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
395 |
| tptp_string_for_format (DFG _) = raise Fail "non-TPTP format" |
|
42962
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
396 |
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
397 |
fun tptp_string_for_problem_line format (Decl (ident, sym, ty)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
398 |
tptp_string_for_format format ^ "(" ^ ident ^ ", type,\n " ^ sym ^
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
399 |
" : " ^ string_for_type format ty ^ ").\n" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
400 |
| tptp_string_for_problem_line format |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
401 |
(Formula (ident, kind, phi, source, info)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
402 |
tptp_string_for_format format ^ "(" ^ ident ^ ", " ^
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
403 |
tptp_string_for_kind kind ^ ",\n (" ^
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
404 |
tptp_string_for_formula format phi ^ ")" ^ |
| 42939 | 405 |
(case (source, info) of |
|
42709
e7af132d48fe
allow each prover to specify its own formula kind for symbols occurring in the conjecture
blanchet
parents:
42659
diff
changeset
|
406 |
(NONE, NONE) => "" |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
407 |
| (SOME tm, NONE) => ", " ^ tptp_string_for_term format tm |
|
42709
e7af132d48fe
allow each prover to specify its own formula kind for symbols occurring in the conjecture
blanchet
parents:
42659
diff
changeset
|
408 |
| (_, SOME tm) => |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
409 |
", " ^ tptp_string_for_term format (the_source source) ^ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
410 |
", " ^ tptp_string_for_term format tm) ^ ").\n" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
411 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
412 |
fun tptp_lines format = |
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
413 |
maps (fn (_, []) => [] |
|
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
414 |
| (heading, lines) => |
| 41491 | 415 |
"\n% " ^ heading ^ " (" ^ string_of_int (length lines) ^ ")\n" ::
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
416 |
map (tptp_string_for_problem_line format) lines) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
417 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
418 |
fun arity_of_type (AFun (_, ty)) = 1 + arity_of_type ty |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
419 |
| arity_of_type _ = 0 |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
420 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
421 |
fun binder_atypes (AFun (ty1, ty2)) = ty1 :: binder_atypes ty2 |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
422 |
| binder_atypes _ = [] |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
423 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
424 |
fun is_function_type (AFun (_, ty)) = is_function_type ty |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
425 |
| is_function_type (AType (s, _)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
426 |
s <> tptp_type_of_types andalso s <> tptp_bool_type |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
427 |
| is_function_type _ = false |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
428 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
429 |
fun is_predicate_type (AFun (_, ty)) = is_predicate_type ty |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
430 |
| is_predicate_type (AType (s, _)) = (s = tptp_bool_type) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
431 |
| is_predicate_type _ = false |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
432 |
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
433 |
fun dfg_string_for_formula flavor info = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
434 |
let |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
435 |
fun str_for_term simp (ATerm (s, tms)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
436 |
(if is_tptp_equal s then "equal" |> simp ? suffix ":lr" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
437 |
else if s = tptp_true then "true" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
438 |
else if s = tptp_false then "false" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
439 |
else s) ^ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
440 |
(if null tms then "" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
441 |
else "(" ^ commas (map (str_for_term false) tms) ^ ")")
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
442 |
| str_for_term _ _ = raise Fail "unexpected term in first-order format" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
443 |
fun str_for_quant AForall = "forall" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
444 |
| str_for_quant AExists = "exists" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
445 |
fun str_for_conn _ ANot = "not" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
446 |
| str_for_conn _ AAnd = "and" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
447 |
| str_for_conn _ AOr = "or" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
448 |
| str_for_conn _ AImplies = "implies" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
449 |
| str_for_conn simp AIff = "equiv" |> simp ? suffix ":lr" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
450 |
fun str_for_formula simp (AQuant (q, xs, phi)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
451 |
str_for_quant q ^ "(" ^ "[" ^
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
452 |
commas (map (string_for_bound_var (DFG flavor)) xs) ^ "], " ^ |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
453 |
str_for_formula simp phi ^ ")" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
454 |
| str_for_formula simp (AConn (c, phis)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
455 |
str_for_conn simp c ^ "(" ^
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
456 |
commas (map (str_for_formula false) phis) ^ ")" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
457 |
| str_for_formula simp (AAtom tm) = str_for_term simp tm |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
458 |
in str_for_formula (is_isabelle_info simpN info) end |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
459 |
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
460 |
fun dfg_lines flavor problem = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
461 |
let |
|
45304
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
462 |
val sorted = (flavor = DFG_Sorted) |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
463 |
val format = DFG flavor |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
464 |
fun ary sym ty = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
465 |
"(" ^ sym ^ ", " ^ string_of_int (arity_of_type ty) ^ ")"
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
466 |
fun fun_typ sym ty = |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
467 |
"function(" ^ sym ^ ", " ^ string_for_type format ty ^ ")."
|
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
468 |
fun pred_typ sym ty = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
469 |
"predicate(" ^
|
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
470 |
commas (sym :: map (string_for_type format) (binder_atypes ty)) ^ ")." |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
471 |
fun formula pred (Formula (ident, kind, phi, _, info)) = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
472 |
if pred kind then |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
473 |
SOME ("formula(" ^ dfg_string_for_formula flavor info phi ^ ", " ^
|
|
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
474 |
ident ^ ").") |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
475 |
else |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
476 |
NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
477 |
| formula _ _ = NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
478 |
fun filt f = problem |> map (map_filter f o snd) |> flat |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
479 |
val func_aries = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
480 |
filt (fn Decl (_, sym, ty) => |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
481 |
if is_function_type ty then SOME (ary sym ty) else NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
482 |
| _ => NONE) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
483 |
|> commas |> enclose "functions [" "]." |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
484 |
val pred_aries = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
485 |
filt (fn Decl (_, sym, ty) => |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
486 |
if is_predicate_type ty then SOME (ary sym ty) else NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
487 |
| _ => NONE) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
488 |
|> commas |> enclose "predicates [" "]." |
|
45304
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
489 |
fun sorts () = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
490 |
filt (fn Decl (_, sym, AType (s, [])) => |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
491 |
if s = tptp_type_of_types then SOME sym else NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
492 |
| _ => NONE) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
493 |
|> commas |> enclose "sorts [" "]." |
|
45304
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
494 |
val syms = [func_aries, pred_aries] @ (if sorted then [sorts ()] else []) |
|
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
495 |
fun func_sigs () = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
496 |
filt (fn Decl (_, sym, ty) => |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
497 |
if is_function_type ty then SOME (fun_typ sym ty) else NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
498 |
| _ => NONE) |
|
45304
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
499 |
fun pred_sigs () = |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
500 |
filt (fn Decl (_, sym, ty) => |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
501 |
if is_predicate_type ty then SOME (pred_typ sym ty) else NONE |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
502 |
| _ => NONE) |
|
45304
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
503 |
val decls = if sorted then func_sigs () @ pred_sigs () else [] |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
504 |
val axioms = filt (formula (curry (op <>) Conjecture)) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
505 |
val conjs = filt (formula (curry (op =) Conjecture)) |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
506 |
fun list_of _ [] = [] |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
507 |
| list_of heading ss = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
508 |
"list_of_" ^ heading ^ ".\n" :: map (suffix "\n") ss @ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
509 |
["end_of_list.\n\n"] |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
510 |
in |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
511 |
"\nbegin_problem(isabelle).\n\n" :: |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
512 |
list_of "descriptions" |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
513 |
["name({**}).", "author({**}).", "status(unknown).",
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
514 |
"description({**})."] @
|
|
45304
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
515 |
list_of "symbols" syms @ |
|
e6901aa86a9e
always use DFG format to talk to SPASS -- since that's what we'll need to use anyway to benefit from sorts and other extensions
blanchet
parents:
45303
diff
changeset
|
516 |
list_of "declarations" decls @ |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
517 |
list_of "formulae(axioms)" axioms @ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
518 |
list_of "formulae(conjectures)" conjs @ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
519 |
["end_problem.\n"] |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
520 |
end |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
521 |
|
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
522 |
fun lines_for_atp_problem format problem = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
523 |
"% This file was generated by Isabelle (most likely Sledgehammer)\n\ |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
524 |
\% " ^ timestamp () ^ "\n" :: |
|
45303
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
525 |
(case format of |
|
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
526 |
DFG flavor => dfg_lines flavor |
|
bd03b08161ac
added DFG unsorted support (like in the old days)
blanchet
parents:
45301
diff
changeset
|
527 |
| _ => tptp_lines format) problem |
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
528 |
|
| 42939 | 529 |
|
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
530 |
(** CNF (Metis) and CNF UEQ (Waldmeister) **) |
| 42939 | 531 |
|
532 |
fun is_problem_line_negated (Formula (_, _, AConn (ANot, _), _, _)) = true |
|
533 |
| is_problem_line_negated _ = false |
|
534 |
||
|
43193
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
535 |
fun is_problem_line_cnf_ueq (Formula (_, _, AAtom (ATerm ((s, _), _)), _, _)) = |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
536 |
is_tptp_equal s |
| 42939 | 537 |
| is_problem_line_cnf_ueq _ = false |
538 |
||
|
42944
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
539 |
fun open_conjecture_term (ATerm ((s, s'), tms)) = |
|
43676
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
540 |
ATerm (if is_tptp_variable s then (s |> Name.desymbolize false, s') |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
541 |
else (s, s'), tms |> map open_conjecture_term) |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
542 |
| open_conjecture_term _ = raise Fail "unexpected higher-order term" |
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
543 |
fun open_formula conj = |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
544 |
let |
|
43193
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
545 |
(* We are conveniently assuming that all bound variable names are |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
546 |
distinct, which should be the case for the formulas we generate. *) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
547 |
fun opn (pos as SOME true) (AQuant (AForall, _, phi)) = opn pos phi |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
548 |
| opn (pos as SOME false) (AQuant (AExists, _, phi)) = opn pos phi |
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
549 |
| opn pos (AConn (ANot, [phi])) = mk_anot (opn (Option.map not pos) phi) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
550 |
| opn pos (AConn (c, [phi1, phi2])) = |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
551 |
let val (pos1, pos2) = polarities_of_conn pos c in |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
552 |
AConn (c, [opn pos1 phi1, opn pos2 phi2]) |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
553 |
end |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
554 |
| opn _ (AAtom t) = AAtom (t |> conj ? open_conjecture_term) |
|
43422
dcbedaf6f80c
added missing case in pattern matching -- solves Waldmeister "Match" exceptions that have been plaguing some users
blanchet
parents:
43295
diff
changeset
|
555 |
| opn _ phi = phi |
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
556 |
in opn (SOME (not conj)) end |
|
42944
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
557 |
fun open_formula_line (Formula (ident, kind, phi, source, info)) = |
|
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
558 |
Formula (ident, kind, open_formula (kind = Conjecture) phi, source, info) |
|
9e620869a576
improved Waldmeister support -- even run it by default on unit equational goals
blanchet
parents:
42942
diff
changeset
|
559 |
| open_formula_line line = line |
| 42939 | 560 |
|
561 |
fun negate_conjecture_line (Formula (ident, Conjecture, phi, source, info)) = |
|
| 42942 | 562 |
Formula (ident, Hypothesis, mk_anot phi, source, info) |
| 42939 | 563 |
| negate_conjecture_line line = line |
564 |
||
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
565 |
exception CLAUSIFY of unit |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
566 |
|
|
43126
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
567 |
(* This "clausification" only expands syntactic sugar, such as "phi => psi" to |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
568 |
"~ phi | psi" and "phi <=> psi" to "~ phi | psi" and "~ psi | phi". We don't |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
569 |
attempt to distribute conjunctions over disjunctions. *) |
|
43193
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
570 |
fun clausify_formula pos (phi as AAtom _) = [phi |> not pos ? mk_anot] |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
571 |
| clausify_formula pos (AConn (ANot, [phi])) = clausify_formula (not pos) phi |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
572 |
| clausify_formula true (AConn (AOr, [phi1, phi2])) = |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
573 |
(phi1, phi2) |> pairself (clausify_formula true) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
574 |
|> uncurry (map_product (mk_aconn AOr)) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
575 |
| clausify_formula false (AConn (AAnd, [phi1, phi2])) = |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
576 |
(phi1, phi2) |> pairself (clausify_formula false) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
577 |
|> uncurry (map_product (mk_aconn AOr)) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
578 |
| clausify_formula true (AConn (AImplies, [phi1, phi2])) = |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
579 |
clausify_formula true (AConn (AOr, [mk_anot phi1, phi2])) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
580 |
| clausify_formula true (AConn (AIff, phis)) = |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
581 |
clausify_formula true (AConn (AImplies, phis)) @ |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
582 |
clausify_formula true (AConn (AImplies, rev phis)) |
|
e11bd628f1a5
improved ATP clausifier so it can deal with "x => (y <=> z)"
blanchet
parents:
43163
diff
changeset
|
583 |
| clausify_formula _ _ = raise CLAUSIFY () |
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
584 |
|
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
585 |
fun clausify_formula_line (Formula (ident, kind, phi, source, info)) = |
|
43126
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
586 |
let |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
587 |
val (n, phis) = phi |> try (clausify_formula true) |> these |> `length |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
588 |
in |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
589 |
map2 (fn phi => fn j => |
|
43295
30aaab778416
pass Metis facts and negated conjecture as facts, with (almost) correctly set localities, so that the correct encoding is used for nonmonotonic occurrences of infinite types
blanchet
parents:
43224
diff
changeset
|
590 |
Formula (ident ^ replicate_string (j - 1) "x", kind, phi, source, |
|
30aaab778416
pass Metis facts and negated conjecture as facts, with (almost) correctly set localities, so that the correct encoding is used for nonmonotonic occurrences of infinite types
blanchet
parents:
43224
diff
changeset
|
591 |
info)) |
|
43126
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
592 |
phis (1 upto n) |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
593 |
end |
|
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
594 |
| clausify_formula_line _ = [] |
|
43098
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
595 |
|
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
596 |
fun ensure_cnf_problem_line line = |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
597 |
line |> open_formula_line |> negate_conjecture_line |> clausify_formula_line |
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
598 |
|
|
e88e974c4846
proper handling of type variable classes in new Metis
blanchet
parents:
43092
diff
changeset
|
599 |
fun ensure_cnf_problem problem = |
|
43126
a7db0afd5200
clausify "<=>" (needed for some type information)
blanchet
parents:
43098
diff
changeset
|
600 |
problem |> map (apsnd (maps ensure_cnf_problem_line)) |
|
43092
93ec303e1917
more work on new metis that exploits the powerful new type encodings
blanchet
parents:
43085
diff
changeset
|
601 |
|
|
42962
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
602 |
fun filter_cnf_ueq_problem problem = |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
603 |
problem |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
604 |
|> map (apsnd (map open_formula_line |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
605 |
#> filter is_problem_line_cnf_ueq |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
606 |
#> map negate_conjecture_line)) |
|
3b50fdeb6cfc
started adding support for THF output (but no lambdas)
blanchet
parents:
42961
diff
changeset
|
607 |
|> (fn problem => |
| 42939 | 608 |
let |
|
43824
0234156d3fbe
don't generate Waldmeister problems with only a conjecture, since it makes it crash sometimes
blanchet
parents:
43692
diff
changeset
|
609 |
val lines = problem |> maps snd |
|
0234156d3fbe
don't generate Waldmeister problems with only a conjecture, since it makes it crash sometimes
blanchet
parents:
43692
diff
changeset
|
610 |
val conjs = lines |> filter is_problem_line_negated |
|
0234156d3fbe
don't generate Waldmeister problems with only a conjecture, since it makes it crash sometimes
blanchet
parents:
43692
diff
changeset
|
611 |
in if length conjs = 1 andalso conjs <> lines then problem else [] end) |
|
38017
3ad3e3ca2451
move Sledgehammer-specific code out of "Sledgehammer_TPTP_Format"
blanchet
parents:
38014
diff
changeset
|
612 |
|
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
613 |
|
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
614 |
(** Symbol declarations **) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
615 |
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
616 |
(* TFF allows implicit declarations of types, function symbols, and predicate |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
617 |
symbols (with "$i" as the type of individuals), but some provers (e.g., |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
618 |
SNARK) require explicit declarations. The situation is similar for THF. *) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
619 |
fun default_type pred_sym = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
620 |
let |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
621 |
fun typ 0 = if pred_sym then bool_atype else individual_atype |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
622 |
| typ ary = AFun (individual_atype, typ (ary - 1)) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
623 |
in typ end |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
624 |
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
625 |
fun add_declared_syms_in_problem_line (Decl (_, sym, _)) = insert (op =) sym |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
626 |
| add_declared_syms_in_problem_line _ = I |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
627 |
fun declared_syms_in_problem problem = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
628 |
fold (fold add_declared_syms_in_problem_line o snd) problem [] |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
629 |
|
| 44620 | 630 |
fun nary_type_constr_type n = |
631 |
funpow n (curry AFun atype_of_types) atype_of_types |
|
632 |
||
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
633 |
fun undeclared_syms_in_problem declared problem = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
634 |
let |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
635 |
fun do_sym name ty = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
636 |
if member (op =) declared name then I else AList.default (op =) (name, ty) |
| 44620 | 637 |
fun do_type (AType (name as (s, _), tys)) = |
638 |
is_tptp_user_symbol s |
|
639 |
? do_sym name (fn _ => nary_type_constr_type (length tys)) |
|
640 |
#> fold do_type tys |
|
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
641 |
| do_type (AFun (ty1, ty2)) = do_type ty1 #> do_type ty2 |
| 44620 | 642 |
| do_type (ATyAbs (_, ty)) = do_type ty |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
643 |
fun do_term pred_sym (ATerm (name as (s, _), tms)) = |
|
43676
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
644 |
is_tptp_user_symbol s |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
645 |
? do_sym name (fn _ => default_type pred_sym (length tms)) |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
646 |
#> fold (do_term false) tms |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
647 |
| do_term _ (AAbs ((_, ty), tm)) = do_type ty #> do_term false tm |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
648 |
fun do_formula (AQuant (_, xs, phi)) = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
649 |
fold do_type (map_filter snd xs) #> do_formula phi |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
650 |
| do_formula (AConn (_, phis)) = fold do_formula phis |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
651 |
| do_formula (AAtom tm) = do_term true tm |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
652 |
fun do_problem_line (Decl (_, _, ty)) = do_type ty |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
653 |
| do_problem_line (Formula (_, _, phi, _, _)) = do_formula phi |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
654 |
in |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
655 |
fold (fold do_problem_line o snd) problem [] |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
656 |
|> filter_out (is_built_in_tptp_symbol o fst o fst) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
657 |
end |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
658 |
|
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
659 |
fun declare_undeclared_syms_in_atp_problem prefix heading problem = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
660 |
let |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
661 |
fun decl_line (x as (s, _), ty) = Decl (prefix ^ s, x, ty ()) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
662 |
val declared = problem |> declared_syms_in_problem |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
663 |
val decls = |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
664 |
problem |> undeclared_syms_in_problem declared |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
665 |
|> sort_wrt (fst o fst) |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
666 |
|> map decl_line |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
667 |
in (heading, decls) :: problem end |
|
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
668 |
|
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
669 |
(** Nice names **) |
|
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
670 |
|
| 37624 | 671 |
fun empty_name_pool readable_names = |
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
672 |
if readable_names then SOME (Symtab.empty, Symtab.empty) else NONE |
| 37624 | 673 |
|
674 |
fun pool_fold f xs z = pair z #> fold_rev (fn x => uncurry (f x)) xs |
|
675 |
fun pool_map f xs = |
|
676 |
pool_fold (fn x => fn ys => fn pool => f x pool |>> (fn y => y :: ys)) xs [] |
|
677 |
||
|
42227
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
678 |
val no_qualifiers = |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
679 |
let |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
680 |
fun skip [] = [] |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
681 |
| skip (#"." :: cs) = skip cs |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
682 |
| skip (c :: cs) = if Char.isAlphaNum c then skip cs else c :: keep cs |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
683 |
and keep [] = [] |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
684 |
| keep (#"." :: cs) = skip cs |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
685 |
| keep (c :: cs) = c :: keep cs |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
686 |
in String.explode #> rev #> keep #> rev #> String.implode end |
|
662b50b7126f
if "monomorphize" is enabled, mangle the type information in the names by default
blanchet
parents:
41769
diff
changeset
|
687 |
|
|
42761
8ea9c6fa8b53
fixed several bugs in Isar proof reconstruction, in particular w.r.t. mangled types and hAPP
blanchet
parents:
42752
diff
changeset
|
688 |
(* Long names can slow down the ATPs. *) |
|
42724
4d6bcf846759
added "max_mono_instances" option to Sledgehammer and renamed old "monomorphize_limit" option
blanchet
parents:
42722
diff
changeset
|
689 |
val max_readable_name_size = 20 |
|
42567
d012947edd36
shorten readable names -- they can get really long with monomorphization, which actually slows down the ATPs
blanchet
parents:
42543
diff
changeset
|
690 |
|
|
43000
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
691 |
(* "equal" is reserved by some ATPs. "op" is also reserved, to avoid the |
|
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
692 |
unreadable "op_1", "op_2", etc., in the problem files. "eq" is reserved to |
|
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
693 |
ensure that "HOL.eq" is correctly mapped to equality (not clear whether this |
|
bd424c3dde46
cleaner handling of equality and proxies (esp. for THF)
blanchet
parents:
42998
diff
changeset
|
694 |
is still necessary). *) |
|
45301
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
695 |
val spass_reserved_nice_names = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
696 |
["forall", "exists", "le", "ls", "ge", "gs", "plus", "minus", "mult", "fract", |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
697 |
"equal", "true", "false", "or", "and", "not", "implies", "implied", "equiv", |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
698 |
"lr", "def"] |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
699 |
val reserved_nice_names = |
|
866b075aa99b
added sorted DFG output for coming version of SPASS
blanchet
parents:
44787
diff
changeset
|
700 |
[tptp_old_equal, "op", "eq"] @ spass_reserved_nice_names |
| 42939 | 701 |
|
| 37624 | 702 |
fun readable_name full_name s = |
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
703 |
if s = full_name then |
|
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
704 |
s |
|
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
705 |
else |
|
42567
d012947edd36
shorten readable names -- they can get really long with monomorphization, which actually slows down the ATPs
blanchet
parents:
42543
diff
changeset
|
706 |
s |> no_qualifiers |
| 44407 | 707 |
|> perhaps (try (unprefix "'")) |
|
42567
d012947edd36
shorten readable names -- they can get really long with monomorphization, which actually slows down the ATPs
blanchet
parents:
42543
diff
changeset
|
708 |
|> Name.desymbolize (Char.isUpper (String.sub (full_name, 0))) |
|
42583
84b134118616
avoid trailing digits for SNARK (type) names -- grr...
blanchet
parents:
42577
diff
changeset
|
709 |
|> (fn s => |
| 42659 | 710 |
if size s > max_readable_name_size then |
711 |
String.substring (s, 0, max_readable_name_size div 2 - 4) ^ |
|
|
43827
62d64709af3b
added option to control which lambda translation to use (for experiments)
blanchet
parents:
43824
diff
changeset
|
712 |
string_of_int (hash_string full_name) ^ |
| 42659 | 713 |
String.extract (s, size s - max_readable_name_size div 2 + 4, |
714 |
NONE) |
|
|
42583
84b134118616
avoid trailing digits for SNARK (type) names -- grr...
blanchet
parents:
42577
diff
changeset
|
715 |
else |
|
84b134118616
avoid trailing digits for SNARK (type) names -- grr...
blanchet
parents:
42577
diff
changeset
|
716 |
s) |
|
42567
d012947edd36
shorten readable names -- they can get really long with monomorphization, which actually slows down the ATPs
blanchet
parents:
42543
diff
changeset
|
717 |
|> (fn s => if member (op =) reserved_nice_names s then full_name else s) |
| 37624 | 718 |
|
719 |
fun nice_name (full_name, _) NONE = (full_name, NONE) |
|
720 |
| nice_name (full_name, desired_name) (SOME the_pool) = |
|
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
721 |
if is_built_in_tptp_symbol full_name then |
| 39384 | 722 |
(full_name, SOME the_pool) |
723 |
else case Symtab.lookup (fst the_pool) full_name of |
|
| 37624 | 724 |
SOME nice_name => (nice_name, SOME the_pool) |
725 |
| NONE => |
|
726 |
let |
|
727 |
val nice_prefix = readable_name full_name desired_name |
|
728 |
fun add j = |
|
729 |
let |
|
| 42644 | 730 |
val nice_name = |
| 44407 | 731 |
nice_prefix ^ (if j = 0 then "" else string_of_int j) |
| 37624 | 732 |
in |
733 |
case Symtab.lookup (snd the_pool) nice_name of |
|
734 |
SOME full_name' => |
|
735 |
if full_name = full_name' then (nice_name, the_pool) |
|
736 |
else add (j + 1) |
|
737 |
| NONE => |
|
738 |
(nice_name, |
|
739 |
(Symtab.update_new (full_name, nice_name) (fst the_pool), |
|
740 |
Symtab.update_new (nice_name, full_name) (snd the_pool))) |
|
741 |
end |
|
742 |
in add 0 |> apsnd SOME end |
|
743 |
||
|
44593
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
744 |
fun nice_type (AType (name, tys)) = |
|
ccf40af26ae9
implement more of the polymorphic simply typed format TFF(1)
blanchet
parents:
44589
diff
changeset
|
745 |
nice_name name ##>> pool_map nice_type tys #>> AType |
| 42963 | 746 |
| nice_type (AFun (ty1, ty2)) = nice_type ty1 ##>> nice_type ty2 #>> AFun |
|
44594
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
747 |
| nice_type (ATyAbs (names, ty)) = |
|
ae82943481e9
added type abstractions (for declaring polymorphic constants) to TFF syntax
blanchet
parents:
44593
diff
changeset
|
748 |
pool_map nice_name names ##>> nice_type ty #>> ATyAbs |
|
43676
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
749 |
fun nice_term (ATerm (name, ts)) = |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
750 |
nice_name name ##>> pool_map nice_term ts #>> ATerm |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
751 |
| nice_term (AAbs ((name, ty), tm)) = |
|
3b0b448b4d69
add support for lambdas in TPTP THF generator + killed an unsound type encoding (because the monotonicity calculus assumes first-order)
nik
parents:
43422
diff
changeset
|
752 |
nice_name name ##>> nice_type ty ##>> nice_term tm #>> AAbs |
|
37961
6a48c85a211a
first step in using "fof" rather than "cnf" in TPTP problems
blanchet
parents:
37931
diff
changeset
|
753 |
fun nice_formula (AQuant (q, xs, phi)) = |
| 42526 | 754 |
pool_map nice_name (map fst xs) |
755 |
##>> pool_map (fn NONE => pair NONE |
|
| 42963 | 756 |
| SOME ty => nice_type ty #>> SOME) (map snd xs) |
| 42526 | 757 |
##>> nice_formula phi |
758 |
#>> (fn ((ss, ts), phi) => AQuant (q, ss ~~ ts, phi)) |
|
|
37961
6a48c85a211a
first step in using "fof" rather than "cnf" in TPTP problems
blanchet
parents:
37931
diff
changeset
|
759 |
| nice_formula (AConn (c, phis)) = |
|
6a48c85a211a
first step in using "fof" rather than "cnf" in TPTP problems
blanchet
parents:
37931
diff
changeset
|
760 |
pool_map nice_formula phis #>> curry AConn c |
| 38034 | 761 |
| nice_formula (AAtom tm) = nice_term tm #>> AAtom |
| 42963 | 762 |
fun nice_problem_line (Decl (ident, sym, ty)) = |
|
42998
1c80902d0456
fully support all type system encodings in typed formats (TFF, THF)
blanchet
parents:
42994
diff
changeset
|
763 |
nice_name sym ##>> nice_type ty #>> (fn (sym, ty) => Decl (ident, sym, ty)) |
| 42939 | 764 |
| nice_problem_line (Formula (ident, kind, phi, source, info)) = |
765 |
nice_formula phi #>> (fn phi => Formula (ident, kind, phi, source, info)) |
|
| 37931 | 766 |
fun nice_problem problem = |
|
37643
f576af716aa6
rewrote the TPTP problem generation code more or less from scratch;
blanchet
parents:
37642
diff
changeset
|
767 |
pool_map (fn (heading, lines) => |
| 37931 | 768 |
pool_map nice_problem_line lines #>> pair heading) problem |
| 39452 | 769 |
fun nice_atp_problem readable_names problem = |
|
38017
3ad3e3ca2451
move Sledgehammer-specific code out of "Sledgehammer_TPTP_Format"
blanchet
parents:
38014
diff
changeset
|
770 |
nice_problem problem (empty_name_pool readable_names) |
|
37509
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
771 |
|
|
f39464d971c4
factor out TPTP format output into file of its own, to facilitate further changes
blanchet
parents:
diff
changeset
|
772 |
end; |