author | wenzelm |
Mon, 24 Mar 2014 12:00:17 +0100 | |
changeset 56265 | 785569927666 |
parent 55594 | eb291b215c73 |
child 56281 | 03c3d1a7c3b8 |
permissions | -rw-r--r-- |
46844 | 1 |
(* Title: HOL/TPTP/TPTP_Parser/tptp_syntax.ML |
2 |
Author: Nik Sultana, Cambridge University Computer Laboratory |
|
3 |
||
4 |
TPTP abstract syntax and parser-related definitions. |
|
5 |
*) |
|
6 |
||
7 |
signature TPTP_SYNTAX = |
|
8 |
sig |
|
9 |
exception TPTP_SYNTAX of string |
|
10 |
val debug: ('a -> unit) -> 'a -> unit |
|
11 |
||
12 |
(*Note that in THF "^ [X] : ^ [Y] : f @ g" should parse |
|
13 |
as "(^ [X] : (^ [Y] : f)) @ g" |
|
14 |
*) |
|
15 |
||
16 |
datatype number_kind = Int_num | Real_num | Rat_num |
|
17 |
||
18 |
datatype status_value = |
|
19 |
Suc | Unp | Sap | Esa | Sat | Fsa |
|
20 |
| Thm | Eqv | Tac | Wec | Eth | Tau |
|
21 |
| Wtc | Wth | Cax | Sca | Tca | Wca |
|
22 |
| Cup | Csp | Ecs | Csa | Cth | Ceq |
|
23 |
| Unc | Wcc | Ect | Fun | Uns | Wuc |
|
24 |
| Wct | Scc | Uca | Noc |
|
25 |
||
26 |
type name = string |
|
27 |
type atomic_word = string |
|
28 |
type inference_rule = atomic_word |
|
29 |
type file_info = name option |
|
30 |
type single_quoted = string |
|
31 |
type file_name = single_quoted |
|
32 |
type creator_name = atomic_word |
|
33 |
type variable = string |
|
34 |
type upper_word = string |
|
35 |
||
36 |
datatype language = FOF | CNF | TFF | THF | FOT | TFF_with_arithmetic |
|
37 |
and role = |
|
38 |
Role_Axiom | Role_Hypothesis | Role_Definition | Role_Assumption | |
|
39 |
Role_Lemma | Role_Theorem | Role_Conjecture | Role_Negated_Conjecture | |
|
40 |
Role_Plain | Role_Fi_Domain | Role_Fi_Functors | Role_Fi_Predicates | |
|
41 |
Role_Type | Role_Unknown |
|
42 |
||
43 |
and general_data = (*Bind of variable * formula_data*) |
|
44 |
Atomic_Word of string |
|
45 |
| Application of string * general_term list (*general_function*) |
|
46 |
| V of upper_word (*variable*) |
|
47 |
| Number of number_kind * string |
|
48 |
| Distinct_Object of string |
|
49 |
| (*formula_data*) Formula_Data of language * tptp_formula (* $thf(<thf_formula>) *) |
|
50 |
| (*formula_data*) Term_Data of tptp_term |
|
51 |
||
52 |
and interpreted_symbol = |
|
53 |
UMinus | Sum | Difference | Product | Quotient | Quotient_E | |
|
54 |
Quotient_T | Quotient_F | Remainder_E | Remainder_T | Remainder_F | |
|
55 |
Floor | Ceiling | Truncate | Round | To_Int | To_Rat | To_Real | |
|
47360 | 56 |
(*FIXME these should be in defined_pred, but that's not being used in TPTP*) |
46844 | 57 |
Less | LessEq | Greater | GreaterEq | EvalEq | Is_Int | Is_Rat | |
47360 | 58 |
Distinct | Apply |
46844 | 59 |
|
60 |
and logic_symbol = Equals | NEquals | Or | And | Iff | If | Fi | Xor | |
|
61 |
Nor | Nand | Not | Op_Forall | Op_Exists | |
|
47360 | 62 |
(*FIXME these should be in defined_pred, but that's not being used in TPTP*) |
46844 | 63 |
True | False |
64 |
||
65 |
and quantifier = (*interpreted binders*) |
|
66 |
Forall | Exists | Epsilon | Iota | Lambda | Dep_Prod | Dep_Sum |
|
67 |
||
68 |
and tptp_base_type = |
|
69 |
Type_Ind | Type_Bool | Type_Type | Type_Int | Type_Rat | Type_Real |
|
70 |
||
71 |
and symbol = |
|
72 |
Uninterpreted of string |
|
73 |
| Interpreted_ExtraLogic of interpreted_symbol |
|
74 |
| Interpreted_Logic of logic_symbol |
|
75 |
| TypeSymbol of tptp_base_type |
|
76 |
| System of string |
|
77 |
||
78 |
and general_term = |
|
79 |
General_Data of general_data (*general_data*) |
|
80 |
| General_Term of general_data * general_term (*general_data : general_term*) |
|
81 |
| General_List of general_term list |
|
82 |
||
83 |
and tptp_term = |
|
84 |
Term_Func of symbol * tptp_term list |
|
85 |
| Term_Var of string |
|
86 |
| Term_Conditional of tptp_formula * tptp_term * tptp_term |
|
87 |
| Term_Num of number_kind * string |
|
88 |
| Term_Distinct_Object of string |
|
53394 | 89 |
| Term_Let of tptp_let * tptp_term |
46844 | 90 |
|
91 |
and tptp_atom = |
|
92 |
TFF_Typed_Atom of symbol * tptp_type option (*only TFF*) |
|
93 |
| THF_Atom_term of tptp_term (*from here on, only THF*) |
|
94 |
| THF_Atom_conn_term of symbol |
|
95 |
||
96 |
and tptp_formula = |
|
97 |
Pred of symbol * tptp_term list |
|
98 |
| Fmla of symbol * tptp_formula list |
|
99 |
| Sequent of tptp_formula list * tptp_formula list |
|
100 |
| Quant of quantifier * (string * tptp_type option) list * tptp_formula |
|
101 |
| Conditional of tptp_formula * tptp_formula * tptp_formula |
|
53394 | 102 |
| Let of tptp_let * tptp_formula |
46844 | 103 |
| Atom of tptp_atom |
47360 | 104 |
| Type_fmla of tptp_type |
46844 | 105 |
| THF_typing of tptp_formula * tptp_type (*only THF*) |
106 |
||
107 |
and tptp_let = |
|
53394 | 108 |
Let_fmla of (string * tptp_type option) list * tptp_formula |
109 |
| Let_term of (string * tptp_type option) list * tptp_term |
|
46844 | 110 |
|
111 |
and tptp_type = |
|
112 |
Prod_type of tptp_type * tptp_type |
|
113 |
| Fn_type of tptp_type * tptp_type |
|
114 |
| Atom_type of string |
|
115 |
| Defined_type of tptp_base_type |
|
116 |
| Sum_type of tptp_type * tptp_type (*only THF*) |
|
47357
15e579392a68
refactored tptp yacc to bring close to official spec;
sultana
parents:
46844
diff
changeset
|
117 |
| Fmla_type of tptp_formula |
46844 | 118 |
| Subtype of symbol * symbol (*only THF*) |
119 |
||
120 |
type general_list = general_term list |
|
121 |
type parent_details = general_list |
|
122 |
type useful_info = general_term list |
|
123 |
type info = useful_info |
|
124 |
||
125 |
type annotation = general_term * general_term list |
|
126 |
||
127 |
exception DEQUOTE of string |
|
128 |
||
129 |
type position = string * int * int |
|
130 |
||
131 |
datatype tptp_line = |
|
47360 | 132 |
Annotated_Formula of position * language * string * role * |
133 |
tptp_formula * annotation option |
|
47569
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
134 |
| Include of position * string * string list |
46844 | 135 |
|
136 |
type tptp_problem = tptp_line list |
|
137 |
||
138 |
val dequote : single_quoted -> single_quoted |
|
139 |
||
140 |
val role_to_string : role -> string |
|
141 |
||
142 |
val status_to_string : status_value -> string |
|
143 |
||
144 |
val nameof_tff_atom_type : tptp_type -> string |
|
145 |
||
47569
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
146 |
val pos_of_line : tptp_line -> position |
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
147 |
|
46844 | 148 |
(*Returns the list of all files included in a directory and its |
149 |
subdirectories. This is only used for testing the parser/interpreter against |
|
150 |
all THF problems.*) |
|
151 |
val get_file_list : Path.T -> Path.T list |
|
152 |
||
53385 | 153 |
val read_status : string -> status_value |
46844 | 154 |
val string_of_tptp_term : tptp_term -> string |
47692
3d76c81b5ed2
improved non-interpretation of constants and numbers;
sultana
parents:
47569
diff
changeset
|
155 |
val string_of_interpreted_symbol : interpreted_symbol -> string |
46844 | 156 |
val string_of_tptp_formula : tptp_formula -> string |
157 |
||
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
158 |
val latex_of_tptp_formula : tptp_formula -> string |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
159 |
|
46844 | 160 |
end |
161 |
||
162 |
||
163 |
structure TPTP_Syntax : TPTP_SYNTAX = |
|
164 |
struct |
|
165 |
||
166 |
exception TPTP_SYNTAX of string |
|
167 |
||
168 |
datatype number_kind = Int_num | Real_num | Rat_num |
|
169 |
||
170 |
datatype status_value = |
|
171 |
Suc | Unp | Sap | Esa | Sat | Fsa |
|
172 |
| Thm | Eqv | Tac | Wec | Eth | Tau |
|
173 |
| Wtc | Wth | Cax | Sca | Tca | Wca |
|
174 |
| Cup | Csp | Ecs | Csa | Cth | Ceq |
|
175 |
| Unc | Wcc | Ect | Fun | Uns | Wuc |
|
176 |
| Wct | Scc | Uca | Noc |
|
177 |
||
178 |
type name = string |
|
179 |
type atomic_word = string |
|
180 |
type inference_rule = atomic_word |
|
181 |
type file_info = name option |
|
182 |
type single_quoted = string |
|
183 |
type file_name = single_quoted |
|
184 |
type creator_name = atomic_word |
|
185 |
type variable = string |
|
186 |
type upper_word = string |
|
187 |
||
188 |
datatype language = FOF | CNF | TFF | THF | FOT | TFF_with_arithmetic |
|
189 |
and role = |
|
190 |
Role_Axiom | Role_Hypothesis | Role_Definition | Role_Assumption | |
|
191 |
Role_Lemma | Role_Theorem | Role_Conjecture | Role_Negated_Conjecture | |
|
192 |
Role_Plain | Role_Fi_Domain | Role_Fi_Functors | Role_Fi_Predicates | |
|
193 |
Role_Type | Role_Unknown |
|
194 |
and general_data = (*Bind of variable * formula_data*) |
|
195 |
Atomic_Word of string |
|
196 |
| Application of string * (general_term list) |
|
197 |
| V of upper_word (*variable*) |
|
198 |
| Number of number_kind * string |
|
199 |
| Distinct_Object of string |
|
200 |
| (*formula_data*) Formula_Data of language * tptp_formula (* $thf(<thf_formula>) *) |
|
201 |
| (*formula_data*) Term_Data of tptp_term |
|
202 |
||
203 |
and interpreted_symbol = |
|
204 |
UMinus | Sum | Difference | Product | Quotient | Quotient_E | |
|
205 |
Quotient_T | Quotient_F | Remainder_E | Remainder_T | Remainder_F | |
|
206 |
Floor | Ceiling | Truncate | Round | To_Int | To_Rat | To_Real | |
|
207 |
Less | LessEq | Greater | GreaterEq | EvalEq | Is_Int | Is_Rat | |
|
47357
15e579392a68
refactored tptp yacc to bring close to official spec;
sultana
parents:
46844
diff
changeset
|
208 |
Distinct | |
47360 | 209 |
Apply |
46844 | 210 |
|
211 |
and logic_symbol = Equals | NEquals | Or | And | Iff | If | Fi | Xor | |
|
212 |
Nor | Nand | Not | Op_Forall | Op_Exists | |
|
213 |
True | False |
|
214 |
||
215 |
and quantifier = (*interpreted binders*) |
|
216 |
Forall | Exists | Epsilon | Iota | Lambda | Dep_Prod | Dep_Sum |
|
217 |
||
218 |
and tptp_base_type = |
|
219 |
Type_Ind | Type_Bool | Type_Type | Type_Int | Type_Rat | Type_Real |
|
220 |
||
221 |
and symbol = |
|
222 |
Uninterpreted of string |
|
223 |
| Interpreted_ExtraLogic of interpreted_symbol |
|
224 |
| Interpreted_Logic of logic_symbol |
|
225 |
| TypeSymbol of tptp_base_type |
|
226 |
| System of string |
|
227 |
||
228 |
and general_term = |
|
229 |
General_Data of general_data (*general_data*) |
|
230 |
| General_Term of general_data * general_term (*general_data : general_term*) |
|
231 |
| General_List of general_term list |
|
232 |
||
233 |
and tptp_term = |
|
234 |
Term_Func of symbol * tptp_term list |
|
235 |
| Term_Var of string |
|
236 |
| Term_Conditional of tptp_formula * tptp_term * tptp_term |
|
237 |
| Term_Num of number_kind * string |
|
238 |
| Term_Distinct_Object of string |
|
53394 | 239 |
| Term_Let of tptp_let * tptp_term |
46844 | 240 |
|
241 |
and tptp_atom = |
|
242 |
TFF_Typed_Atom of symbol * tptp_type option (*only TFF*) |
|
243 |
| THF_Atom_term of tptp_term (*from here on, only THF*) |
|
244 |
| THF_Atom_conn_term of symbol |
|
245 |
||
246 |
and tptp_formula = |
|
247 |
Pred of symbol * tptp_term list |
|
248 |
| Fmla of symbol * tptp_formula list |
|
249 |
| Sequent of tptp_formula list * tptp_formula list |
|
250 |
| Quant of quantifier * (string * tptp_type option) list * tptp_formula |
|
251 |
| Conditional of tptp_formula * tptp_formula * tptp_formula |
|
53394 | 252 |
| Let of tptp_let * tptp_formula |
46844 | 253 |
| Atom of tptp_atom |
47360 | 254 |
| Type_fmla of tptp_type |
46844 | 255 |
| THF_typing of tptp_formula * tptp_type |
256 |
||
257 |
and tptp_let = |
|
53394 | 258 |
Let_fmla of (string * tptp_type option) list * tptp_formula |
259 |
| Let_term of (string * tptp_type option) list * tptp_term |
|
46844 | 260 |
|
261 |
and tptp_type = |
|
262 |
Prod_type of tptp_type * tptp_type |
|
263 |
| Fn_type of tptp_type * tptp_type |
|
264 |
| Atom_type of string |
|
265 |
| Defined_type of tptp_base_type |
|
47360 | 266 |
| Sum_type of tptp_type * tptp_type |
267 |
| Fmla_type of tptp_formula |
|
268 |
| Subtype of symbol * symbol |
|
46844 | 269 |
|
270 |
type general_list = general_term list |
|
271 |
type parent_details = general_list |
|
272 |
type useful_info = general_term list |
|
273 |
type info = useful_info |
|
274 |
||
275 |
(*type annotation = (source * info option)*) |
|
276 |
type annotation = general_term * general_term list |
|
277 |
||
278 |
exception DEQUOTE of string |
|
279 |
||
280 |
type position = string * int * int |
|
281 |
||
282 |
datatype tptp_line = |
|
283 |
Annotated_Formula of position * language * string * role * tptp_formula * annotation option |
|
47569
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
284 |
| Include of position * string * string list |
46844 | 285 |
|
286 |
type tptp_problem = tptp_line list |
|
287 |
||
56265
785569927666
discontinued Toplevel.debug in favour of system option "exception_trace";
wenzelm
parents:
55594
diff
changeset
|
288 |
fun debug f x = if Options.default_bool @{option exception_trace} then (f x; ()) else () |
46844 | 289 |
|
290 |
fun nameof_tff_atom_type (Atom_type str) = str |
|
291 |
| nameof_tff_atom_type _ = raise TPTP_SYNTAX "nameof_tff_atom_type called on non-atom type" |
|
292 |
||
47569
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
293 |
fun pos_of_line tptp_line = |
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
294 |
case tptp_line of |
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
295 |
Annotated_Formula (position, _, _, _, _, _) => position |
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
296 |
| Include (position, _, _) => position |
fce9d97a3258
exceptions related to interpreting tptp problems now mention the relevant position in the tptp file;
sultana
parents:
47454
diff
changeset
|
297 |
|
46844 | 298 |
(*Used for debugging. Returns all files contained within a directory or its |
53390 | 299 |
subdirectories. Follows symbolic links, filters away directories. |
300 |
Files are ordered by size*) |
|
46844 | 301 |
fun get_file_list path = |
302 |
let |
|
53390 | 303 |
fun get_file_list' acc paths = |
304 |
case paths of |
|
305 |
[] => acc |
|
306 |
| (f :: fs) => |
|
307 |
let |
|
308 |
(*NOTE needed since no File.is_link and File.read_link*) |
|
309 |
val f_str = Path.implode f |
|
310 |
in |
|
311 |
if File.is_dir f then |
|
312 |
let |
|
313 |
val contents = |
|
314 |
File.read_dir f |
|
315 |
|> map |
|
316 |
(Path.explode |
|
317 |
#> Path.append f) |
|
318 |
in |
|
319 |
get_file_list' acc (fs @ contents) |
|
320 |
end |
|
321 |
else if OS.FileSys.isLink f_str then |
|
322 |
(*follow links -- NOTE this breaks if links are relative paths*) |
|
323 |
get_file_list' acc (Path.explode (OS.FileSys.readLink f_str) :: fs) |
|
324 |
else |
|
325 |
get_file_list' ((f, OS.FileSys.fileSize f_str) :: acc) fs |
|
326 |
end |
|
46844 | 327 |
in |
53390 | 328 |
get_file_list' [] [path] |
329 |
|> sort (fn ((_, n1), (_, n2)) => Int.compare (n1, n2)) |
|
330 |
|> map fst |
|
46844 | 331 |
end |
332 |
||
333 |
fun role_to_string role = |
|
334 |
case role of |
|
335 |
Role_Axiom => "axiom" |
|
336 |
| Role_Hypothesis => "hypothesis" |
|
337 |
| Role_Definition => "definition" |
|
338 |
| Role_Assumption => "assumption" |
|
339 |
| Role_Lemma => "lemma" |
|
340 |
| Role_Theorem => "theorem" |
|
341 |
| Role_Conjecture => "conjecture" |
|
342 |
| Role_Negated_Conjecture => "negated_conjecture" |
|
343 |
| Role_Plain => "plain" |
|
344 |
| Role_Fi_Domain => "fi_domain" |
|
345 |
| Role_Fi_Functors => "fi_functors" |
|
346 |
| Role_Fi_Predicates => "fi_predicates" |
|
347 |
| Role_Type => "type" |
|
348 |
| Role_Unknown => "unknown" |
|
349 |
||
350 |
(*accepts a string "'abc'" and returns "abc"*) |
|
351 |
fun dequote str : single_quoted = |
|
352 |
if str = "" then |
|
353 |
raise (DEQUOTE "empty string") |
|
354 |
else |
|
355 |
(unprefix "'" str |
|
356 |
|> unsuffix "'" |
|
357 |
handle (Fail str) => |
|
358 |
if str = "unprefix" then |
|
359 |
raise DEQUOTE ("string doesn't open with quote:" ^ str) |
|
360 |
else if str = "unsuffix" then |
|
361 |
raise DEQUOTE ("string doesn't close with quote:" ^ str) |
|
362 |
else raise Fail str) |
|
363 |
||
53385 | 364 |
exception UNRECOGNISED_STATUS of string |
365 |
fun read_status status = |
|
366 |
case status of |
|
367 |
"suc" => Suc | "unp" => Unp |
|
368 |
| "sap" => Sap | "esa" => Esa |
|
369 |
| "sat" => Sat | "fsa" => Fsa |
|
370 |
| "thm" => Thm | "wuc" => Wuc |
|
371 |
| "eqv" => Eqv | "tac" => Tac |
|
372 |
| "wec" => Wec | "eth" => Eth |
|
373 |
| "tau" => Tau | "wtc" => Wtc |
|
374 |
| "wth" => Wth | "cax" => Cax |
|
375 |
| "sca" => Sca | "tca" => Tca |
|
376 |
| "wca" => Wca | "cup" => Cup |
|
377 |
| "csp" => Csp | "ecs" => Ecs |
|
378 |
| "csa" => Csa | "cth" => Cth |
|
379 |
| "ceq" => Ceq | "unc" => Unc |
|
380 |
| "wcc" => Wcc | "ect" => Ect |
|
381 |
| "fun" => Fun | "uns" => Uns |
|
382 |
| "wct" => Wct | "scc" => Scc |
|
383 |
| "uca" => Uca | "noc" => Noc |
|
384 |
| thing => raise (UNRECOGNISED_STATUS thing) |
|
46844 | 385 |
|
386 |
(* Printing parsed TPTP formulas *) |
|
387 |
(*FIXME this is not pretty-printing, just printing*) |
|
388 |
||
389 |
fun status_to_string status_value = |
|
390 |
case status_value of |
|
47454 | 391 |
Suc => "suc" | Unp => "unp" |
46844 | 392 |
| Sap => "sap" | Esa => "esa" |
393 |
| Sat => "sat" | Fsa => "fsa" |
|
394 |
| Thm => "thm" | Wuc => "wuc" |
|
47454 | 395 |
| Eqv => "eqv" | Tac => "tac" |
396 |
| Wec => "wec" | Eth => "eth" |
|
397 |
| Tau => "tau" | Wtc => "wtc" |
|
398 |
| Wth => "wth" | Cax => "cax" |
|
399 |
| Sca => "sca" | Tca => "tca" |
|
400 |
| Wca => "wca" | Cup => "cup" |
|
401 |
| Csp => "csp" | Ecs => "ecs" |
|
402 |
| Csa => "csa" | Cth => "cth" |
|
403 |
| Ceq => "ceq" | Unc => "unc" |
|
404 |
| Wcc => "wcc" | Ect => "ect" |
|
405 |
| Fun => "fun" | Uns => "uns" |
|
406 |
| Wct => "wct" | Scc => "scc" |
|
407 |
| Uca => "uca" | Noc => "noc" |
|
46844 | 408 |
|
409 |
fun string_of_tptp_term x = |
|
410 |
case x of |
|
411 |
Term_Func (symbol, tptp_term_list) => |
|
412 |
"(" ^ string_of_symbol symbol ^ " " ^ |
|
47426 | 413 |
space_implode " " (map string_of_tptp_term tptp_term_list) ^ ")" |
46844 | 414 |
| Term_Var str => str |
415 |
| Term_Conditional (tptp_formula, tptp_term1, tptp_term2) => "" (*FIXME*) |
|
416 |
| Term_Num (_, str) => str |
|
417 |
| Term_Distinct_Object str => str |
|
418 |
||
419 |
and string_of_symbol (Uninterpreted str) = str |
|
420 |
| string_of_symbol (Interpreted_ExtraLogic interpreted_symbol) = string_of_interpreted_symbol interpreted_symbol |
|
421 |
| string_of_symbol (Interpreted_Logic logic_symbol) = string_of_logic_symbol logic_symbol |
|
422 |
| string_of_symbol (TypeSymbol tptp_base_type) = string_of_tptp_base_type tptp_base_type |
|
423 |
| string_of_symbol (System str) = str |
|
424 |
||
425 |
and string_of_tptp_base_type Type_Ind = "$i" |
|
426 |
| string_of_tptp_base_type Type_Bool = "$o" |
|
427 |
| string_of_tptp_base_type Type_Type = "$tType" |
|
428 |
| string_of_tptp_base_type Type_Int = "$int" |
|
429 |
| string_of_tptp_base_type Type_Rat = "$rat" |
|
430 |
| string_of_tptp_base_type Type_Real = "$real" |
|
431 |
||
432 |
and string_of_interpreted_symbol x = |
|
433 |
case x of |
|
434 |
UMinus => "$uminus" |
|
435 |
| Sum => "$sum" |
|
436 |
| Difference => "$difference" |
|
437 |
| Product => "$product" |
|
438 |
| Quotient => "$quotient" |
|
439 |
| Quotient_E => "$quotient_e" |
|
440 |
| Quotient_T => "$quotient_t" |
|
441 |
| Quotient_F => "$quotient_f" |
|
442 |
| Remainder_E => "$remainder_e" |
|
443 |
| Remainder_T => "$remainder_t" |
|
444 |
| Remainder_F => "$remainder_f" |
|
445 |
| Floor => "$floor" |
|
446 |
| Ceiling => "$ceiling" |
|
447 |
| Truncate => "$truncate" |
|
448 |
| Round => "$round" |
|
449 |
| To_Int => "$to_int" |
|
450 |
| To_Rat => "$to_rat" |
|
451 |
| To_Real => "$to_real" |
|
452 |
| Less => "$less" |
|
453 |
| LessEq => "$lesseq" |
|
454 |
| Greater => "$greater" |
|
455 |
| GreaterEq => "$greatereq" |
|
456 |
| EvalEq => "$evaleq" |
|
457 |
| Is_Int => "$is_int" |
|
458 |
| Is_Rat => "$is_rat" |
|
47692
3d76c81b5ed2
improved non-interpretation of constants and numbers;
sultana
parents:
47569
diff
changeset
|
459 |
| Distinct => "$distinct" |
46844 | 460 |
| Apply => "@" |
461 |
||
462 |
and string_of_logic_symbol Equals = "=" |
|
463 |
| string_of_logic_symbol NEquals = "!=" |
|
464 |
| string_of_logic_symbol Or = "|" |
|
465 |
| string_of_logic_symbol And = "&" |
|
466 |
| string_of_logic_symbol Iff = "<=>" |
|
467 |
| string_of_logic_symbol If = "=>" |
|
468 |
| string_of_logic_symbol Fi = "<=" |
|
469 |
| string_of_logic_symbol Xor = "<~>" |
|
470 |
| string_of_logic_symbol Nor = "~|" |
|
471 |
| string_of_logic_symbol Nand = "~&" |
|
472 |
| string_of_logic_symbol Not = "~" |
|
473 |
| string_of_logic_symbol Op_Forall = "!!" |
|
474 |
| string_of_logic_symbol Op_Exists = "??" |
|
475 |
| string_of_logic_symbol True = "$true" |
|
476 |
| string_of_logic_symbol False = "$false" |
|
477 |
||
478 |
and string_of_quantifier Forall = "!" |
|
479 |
| string_of_quantifier Exists = "?" |
|
480 |
| string_of_quantifier Epsilon = "@+" |
|
481 |
| string_of_quantifier Iota = "@-" |
|
482 |
| string_of_quantifier Lambda = "^" |
|
483 |
| string_of_quantifier Dep_Prod = "!>" |
|
484 |
| string_of_quantifier Dep_Sum = "?*" |
|
485 |
||
486 |
and string_of_tptp_atom (TFF_Typed_Atom (symbol, tptp_type_option)) = |
|
487 |
(case tptp_type_option of |
|
488 |
NONE => string_of_symbol symbol |
|
489 |
| SOME tptp_type => |
|
490 |
string_of_symbol symbol ^ " : " ^ string_of_tptp_type tptp_type) |
|
491 |
| string_of_tptp_atom (THF_Atom_term tptp_term) = string_of_tptp_term tptp_term |
|
492 |
| string_of_tptp_atom (THF_Atom_conn_term symbol) = string_of_symbol symbol |
|
493 |
||
494 |
and string_of_tptp_formula (Pred (symbol, tptp_term_list)) = |
|
495 |
"(" ^ string_of_symbol symbol ^ |
|
47426 | 496 |
space_implode " " (map string_of_tptp_term tptp_term_list) ^ ")" |
46844 | 497 |
| string_of_tptp_formula (Fmla (symbol, tptp_formula_list)) = |
498 |
"(" ^ |
|
499 |
string_of_symbol symbol ^ |
|
47426 | 500 |
space_implode " " (map string_of_tptp_formula tptp_formula_list) ^ ")" |
46844 | 501 |
| string_of_tptp_formula (Sequent (tptp_formula_list1, tptp_formula_list2)) = "" (*FIXME*) |
502 |
| string_of_tptp_formula (Quant (quantifier, varlist, tptp_formula)) = |
|
503 |
string_of_quantifier quantifier ^ "[" ^ |
|
47426 | 504 |
space_implode ", " (map (fn (n, ty) => |
46844 | 505 |
case ty of |
506 |
NONE => n |
|
507 |
| SOME ty => n ^ " : " ^ string_of_tptp_type ty) varlist) ^ "] : (" ^ |
|
508 |
string_of_tptp_formula tptp_formula ^ ")" |
|
509 |
| string_of_tptp_formula (Conditional _) = "" (*FIXME*) |
|
510 |
| string_of_tptp_formula (Let _) = "" (*FIXME*) |
|
511 |
| string_of_tptp_formula (Atom tptp_atom) = string_of_tptp_atom tptp_atom |
|
47360 | 512 |
| string_of_tptp_formula (Type_fmla tptp_type) = string_of_tptp_type tptp_type |
46844 | 513 |
| string_of_tptp_formula (THF_typing (tptp_formula, tptp_type)) = |
514 |
string_of_tptp_formula tptp_formula ^ " : " ^ string_of_tptp_type tptp_type |
|
515 |
||
516 |
and string_of_tptp_type (Prod_type (tptp_type1, tptp_type2)) = |
|
517 |
string_of_tptp_type tptp_type1 ^ " * " ^ string_of_tptp_type tptp_type2 |
|
518 |
| string_of_tptp_type (Fn_type (tptp_type1, tptp_type2)) = |
|
519 |
string_of_tptp_type tptp_type1 ^ " > " ^ string_of_tptp_type tptp_type2 |
|
520 |
| string_of_tptp_type (Atom_type str) = str |
|
521 |
| string_of_tptp_type (Defined_type tptp_base_type) = |
|
522 |
string_of_tptp_base_type tptp_base_type |
|
523 |
| string_of_tptp_type (Sum_type (tptp_type1, tptp_type2)) = "" |
|
524 |
| string_of_tptp_type (Fmla_type tptp_formula) = string_of_tptp_formula tptp_formula |
|
525 |
| string_of_tptp_type (Subtype (symbol1, symbol2)) = |
|
526 |
string_of_symbol symbol1 ^ " << " ^ string_of_symbol symbol2 |
|
527 |
||
55594 | 528 |
(*FIXME formatting details haven't been fully worked out -- don't use this function for anything serious in its current form!*) |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
529 |
(*TODO Add subscripting*) |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
530 |
(*infix symbols, including \subset, \cup, \cap*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
531 |
fun latex_of_tptp_term x = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
532 |
case x of |
55594 | 533 |
Term_Func (Interpreted_Logic Equals, [tptp_t1, tptp_t2]) => |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
534 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " = " ^ latex_of_tptp_term tptp_t2 ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
535 |
| Term_Func (Interpreted_Logic NEquals, [tptp_t1, tptp_t2]) => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
536 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\neq " ^ latex_of_tptp_term tptp_t2 ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
537 |
| Term_Func (Interpreted_Logic Or, [tptp_t1, tptp_t2]) => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
538 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\vee " ^ latex_of_tptp_term tptp_t2 ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
539 |
| Term_Func (Interpreted_Logic And, [tptp_t1, tptp_t2]) => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
540 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\wedge " ^ latex_of_tptp_term tptp_t2 ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
541 |
| Term_Func (Interpreted_Logic Iff, [tptp_t1, tptp_t2]) => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
542 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\longleftrightarrow " ^ latex_of_tptp_term tptp_t2 ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
543 |
| Term_Func (Interpreted_Logic If, [tptp_t1, tptp_t2]) => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
544 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\longrightarrow " ^ latex_of_tptp_term tptp_t2 ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
545 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
546 |
| Term_Func (symbol, tptp_term_list) => |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
547 |
(*"(" ^*) latex_of_symbol symbol ^ "\\\\, " ^ |
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
548 |
space_implode "\\\\, " (map latex_of_tptp_term tptp_term_list) (*^ ")"*) |
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
549 |
| Term_Var str => "\\\\mathrm{" ^ str ^ "}" |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
550 |
| Term_Conditional (tptp_formula, tptp_term1, tptp_term2) => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
551 |
| Term_Num (_, str) => str |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
552 |
| Term_Distinct_Object str => str (*FIXME*) |
55594 | 553 |
|
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
554 |
and latex_of_symbol (Uninterpreted str) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
555 |
if str = "emptyset" then "\\\\emptyset" |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
556 |
else "\\\\mathrm{" ^ str ^ "}" |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
557 |
| latex_of_symbol (Interpreted_ExtraLogic interpreted_symbol) = latex_of_interpreted_symbol interpreted_symbol |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
558 |
| latex_of_symbol (Interpreted_Logic logic_symbol) = latex_of_logic_symbol logic_symbol |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
559 |
| latex_of_symbol (TypeSymbol tptp_base_type) = latex_of_tptp_base_type tptp_base_type |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
560 |
| latex_of_symbol (System str) = "\\\\mathrm{" ^ str ^ "}" |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
561 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
562 |
and latex_of_tptp_base_type Type_Ind = "\\\\iota " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
563 |
| latex_of_tptp_base_type Type_Bool = "o" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
564 |
| latex_of_tptp_base_type Type_Type = "\\\\mathcal{T} " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
565 |
| latex_of_tptp_base_type Type_Int = "\\\\mathsf{int} " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
566 |
| latex_of_tptp_base_type Type_Rat = "\\\\mathsf{rat} " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
567 |
| latex_of_tptp_base_type Type_Real = "\\\\mathsf{real} " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
568 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
569 |
and latex_of_interpreted_symbol x = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
570 |
case x of |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
571 |
UMinus => "-" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
572 |
| Sum => "-" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
573 |
| Difference => "-" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
574 |
| Product => "*" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
575 |
| Quotient => "/" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
576 |
| Quotient_E => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
577 |
| Quotient_T => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
578 |
| Quotient_F => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
579 |
| Remainder_E => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
580 |
| Remainder_T => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
581 |
| Remainder_F => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
582 |
| Floor => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
583 |
| Ceiling => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
584 |
| Truncate => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
585 |
| Round => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
586 |
| To_Int => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
587 |
| To_Rat => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
588 |
| To_Real => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
589 |
| Less => "<" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
590 |
| LessEq => "\\\\leq " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
591 |
| Greater => ">" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
592 |
| GreaterEq => "\\\\geq " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
593 |
| EvalEq => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
594 |
| Is_Int => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
595 |
| Is_Rat => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
596 |
| Distinct => "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
597 |
| Apply => "\\\\;" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
598 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
599 |
and latex_of_logic_symbol Equals = "=" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
600 |
| latex_of_logic_symbol NEquals = "\\\\neq " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
601 |
| latex_of_logic_symbol Or = "\\\\vee " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
602 |
| latex_of_logic_symbol And = "\\\\wedge " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
603 |
| latex_of_logic_symbol Iff = "\\\\longleftrightarrow " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
604 |
| latex_of_logic_symbol If = "\\\\longrightarrow " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
605 |
| latex_of_logic_symbol Fi = "\\\\longleftarrow " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
606 |
| latex_of_logic_symbol Xor = "\\\\oplus " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
607 |
| latex_of_logic_symbol Nor = "\\\\not\\\\vee " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
608 |
| latex_of_logic_symbol Nand = "\\\\not\\\\wedge " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
609 |
| latex_of_logic_symbol Not = "\\\\neg " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
610 |
| latex_of_logic_symbol Op_Forall = "\\\\forall " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
611 |
| latex_of_logic_symbol Op_Exists = "\\\\exists " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
612 |
| latex_of_logic_symbol True = "\\\\mathsf{true} " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
613 |
| latex_of_logic_symbol False = "\\\\mathsf{false} " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
614 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
615 |
and latex_of_quantifier Forall = "\\\\forall " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
616 |
| latex_of_quantifier Exists = "\\\\exists " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
617 |
| latex_of_quantifier Epsilon = "\\\\varepsilon " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
618 |
| latex_of_quantifier Iota = "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
619 |
| latex_of_quantifier Lambda = "\\\\lambda " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
620 |
| latex_of_quantifier Dep_Prod = "\\\\Pi " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
621 |
| latex_of_quantifier Dep_Sum = "\\\\Sigma " |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
622 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
623 |
and latex_of_tptp_atom (TFF_Typed_Atom (symbol, tptp_type_option)) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
624 |
(case tptp_type_option of |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
625 |
NONE => latex_of_symbol symbol |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
626 |
| SOME tptp_type => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
627 |
latex_of_symbol symbol ^ " : " ^ latex_of_tptp_type tptp_type) |
55594 | 628 |
| latex_of_tptp_atom (THF_Atom_term tptp_term) = latex_of_tptp_term tptp_term |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
629 |
| latex_of_tptp_atom (THF_Atom_conn_term symbol) = latex_of_symbol symbol |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
630 |
|
55594 | 631 |
and latex_of_tptp_formula (Pred (Interpreted_Logic Equals, [tptp_t1, tptp_t2])) = |
632 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " = " ^ latex_of_tptp_term tptp_t2 ^ ")" |
|
633 |
| latex_of_tptp_formula (Pred (Interpreted_Logic NEquals, [tptp_t1, tptp_t2])) = |
|
634 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\neq " ^ latex_of_tptp_term tptp_t2 ^ ")" |
|
635 |
| latex_of_tptp_formula (Pred (Interpreted_Logic Or, [tptp_t1, tptp_t2])) = |
|
636 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\vee " ^ latex_of_tptp_term tptp_t2 ^ ")" |
|
637 |
| latex_of_tptp_formula (Pred (Interpreted_Logic And, [tptp_t1, tptp_t2])) = |
|
638 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\wedge " ^ latex_of_tptp_term tptp_t2 ^ ")" |
|
639 |
| latex_of_tptp_formula (Pred (Interpreted_Logic Iff, [tptp_t1, tptp_t2])) = |
|
640 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\longleftrightarrow " ^ latex_of_tptp_term tptp_t2 ^ ")" |
|
641 |
| latex_of_tptp_formula (Pred (Interpreted_Logic If, [tptp_t1, tptp_t2])) = |
|
642 |
"(" ^ latex_of_tptp_term tptp_t1 ^ " \\\\longrightarrow " ^ latex_of_tptp_term tptp_t2 ^ ")" |
|
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
643 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
644 |
| latex_of_tptp_formula (x as (Pred (symbol, tptp_term_list))) = |
55594 | 645 |
latex_of_symbol symbol ^ |
646 |
space_implode "\\\\, " (map latex_of_tptp_term tptp_term_list) |
|
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
647 |
|
55594 | 648 |
| latex_of_tptp_formula (Fmla (Interpreted_ExtraLogic Apply, [Fmla (Interpreted_ExtraLogic Apply, [Atom (THF_Atom_term (Term_Func (Uninterpreted "union", []))), tptp_f1]), tptp_f2])) = |
649 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\cup " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
650 |
||
651 |
| latex_of_tptp_formula (Fmla (Interpreted_ExtraLogic Apply, [Fmla (Interpreted_ExtraLogic Apply, [Atom (THF_Atom_term (Term_Func (Uninterpreted "subset", []))), tptp_f1]), tptp_f2])) = |
|
652 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\subset " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
653 |
|
55594 | 654 |
| latex_of_tptp_formula (Fmla (Interpreted_Logic Equals, [tptp_f1, tptp_f2])) = |
655 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " = " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
656 |
| latex_of_tptp_formula (Fmla (Interpreted_Logic NEquals, [tptp_f1, tptp_f2])) = |
|
657 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\neq " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
658 |
| latex_of_tptp_formula (Fmla (Interpreted_Logic Or, [tptp_f1, tptp_f2])) = |
|
659 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\vee " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
660 |
| latex_of_tptp_formula (Fmla (Interpreted_Logic And, [tptp_f1, tptp_f2])) = |
|
661 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\wedge " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
662 |
| latex_of_tptp_formula (Fmla (Interpreted_Logic Iff, [tptp_f1, tptp_f2])) = |
|
663 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\longleftrightarrow " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
664 |
| latex_of_tptp_formula (Fmla (Interpreted_Logic If, [tptp_f1, tptp_f2])) = |
|
665 |
"(" ^ latex_of_tptp_formula tptp_f1 ^ " \\\\longrightarrow " ^ latex_of_tptp_formula tptp_f2 ^ ")" |
|
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
666 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
667 |
| latex_of_tptp_formula (x as (Fmla (symbol, tptp_formula_list))) = |
55594 | 668 |
latex_of_symbol symbol ^ |
669 |
space_implode "\\\\, " (map latex_of_tptp_formula tptp_formula_list) |
|
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
670 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
671 |
| latex_of_tptp_formula (Sequent (tptp_formula_list1, tptp_formula_list2)) = "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
672 |
| latex_of_tptp_formula (Quant (quantifier, varlist, tptp_formula)) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
673 |
latex_of_quantifier quantifier ^ |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
674 |
space_implode ", " (map (fn (n, ty) => |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
675 |
case ty of |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
676 |
NONE => "\\\\mathrm{" ^ n ^ "}" |
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
677 |
| SOME ty => "\\\\mathrm{" ^ n ^ "} : " ^ latex_of_tptp_type ty) varlist) ^ ". (" ^ |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
678 |
latex_of_tptp_formula tptp_formula ^ ")" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
679 |
| latex_of_tptp_formula (Conditional _) = "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
680 |
| latex_of_tptp_formula (Let _) = "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
681 |
| latex_of_tptp_formula (Atom tptp_atom) = latex_of_tptp_atom tptp_atom |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
682 |
| latex_of_tptp_formula (Type_fmla tptp_type) = latex_of_tptp_type tptp_type |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
683 |
| latex_of_tptp_formula (THF_typing (tptp_formula, tptp_type)) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
684 |
latex_of_tptp_formula tptp_formula ^ " : " ^ latex_of_tptp_type tptp_type |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
685 |
|
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
686 |
and latex_of_tptp_type (Prod_type (tptp_type1, tptp_type2)) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
687 |
latex_of_tptp_type tptp_type1 ^ " \\\\times " ^ latex_of_tptp_type tptp_type2 |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
688 |
| latex_of_tptp_type (Fn_type (tptp_type1, tptp_type2)) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
689 |
latex_of_tptp_type tptp_type1 ^ " \\\\to " ^ latex_of_tptp_type tptp_type2 |
55588
3740fb5ec307
improved latex output: spacing between terms, and encoding terms in mathrm;
sultana
parents:
55587
diff
changeset
|
690 |
| latex_of_tptp_type (Atom_type str) = "\\\\mathrm{" ^ str ^ "}" |
55587
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
691 |
| latex_of_tptp_type (Defined_type tptp_base_type) = |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
692 |
latex_of_tptp_base_type tptp_base_type |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
693 |
| latex_of_tptp_type (Sum_type (tptp_type1, tptp_type2)) = "" |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
694 |
| latex_of_tptp_type (Fmla_type tptp_formula) = latex_of_tptp_formula tptp_formula |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
695 |
| latex_of_tptp_type (Subtype (symbol1, symbol2)) = "" (*FIXME*) |
5d3db2c626e3
experimenting with improving DOT output, and embedding LaTeX code for formulas (rather than only giving the clause number);
sultana
parents:
53394
diff
changeset
|
696 |
|
46844 | 697 |
end |