sultana@47715
|
1 |
open TPTP_Syntax
|
sultana@47715
|
2 |
|
sultana@47715
|
3 |
exception UNRECOGNISED_SYMBOL of string * string
|
sultana@47715
|
4 |
|
sultana@47715
|
5 |
exception UNRECOGNISED_ROLE of string
|
sultana@47715
|
6 |
fun classify_role role =
|
sultana@47715
|
7 |
case role of
|
sultana@47715
|
8 |
"axiom" => Role_Axiom
|
sultana@47715
|
9 |
| "hypothesis" => Role_Hypothesis
|
sultana@47715
|
10 |
| "definition" => Role_Definition
|
sultana@47715
|
11 |
| "assumption" => Role_Assumption
|
sultana@47715
|
12 |
| "lemma" => Role_Lemma
|
sultana@47715
|
13 |
| "theorem" => Role_Theorem
|
sultana@47715
|
14 |
| "conjecture" => Role_Conjecture
|
sultana@47715
|
15 |
| "negated_conjecture" => Role_Negated_Conjecture
|
sultana@47715
|
16 |
| "plain" => Role_Plain
|
sultana@47715
|
17 |
| "fi_domain" => Role_Fi_Domain
|
sultana@47715
|
18 |
| "fi_functors" => Role_Fi_Functors
|
sultana@47715
|
19 |
| "fi_predicates" => Role_Fi_Predicates
|
sultana@47715
|
20 |
| "type" => Role_Type
|
sultana@47715
|
21 |
| "unknown" => Role_Unknown
|
sultana@47715
|
22 |
| thing => raise (UNRECOGNISED_ROLE thing)
|
sultana@47715
|
23 |
|
sultana@48215
|
24 |
fun extract_quant_info (Quant (quantifier, vars, tptp_formula)) =
|
sultana@48215
|
25 |
(quantifier, vars, tptp_formula)
|
sultana@48215
|
26 |
|
sultana@47715
|
27 |
%%
|
sultana@47715
|
28 |
%name TPTP
|
sultana@47715
|
29 |
%term AMPERSAND | AT_SIGN | CARET | COLON | COMMA | EQUALS | EXCLAMATION
|
sultana@48215
|
30 |
| LET | ARROW | FI | IFF | IMPLIES | INCLUDE
|
sultana@47715
|
31 |
| LAMBDA | LBRKT | LPAREN | MAP_TO | MMINUS | NAND
|
sultana@47715
|
32 |
| NEQUALS | XOR | NOR | PERIOD | PPLUS | QUESTION | RBRKT | RPAREN
|
sultana@47715
|
33 |
| TILDE | TOK_FALSE | TOK_I | TOK_O | TOK_INT | TOK_REAL | TOK_RAT | TOK_TRUE
|
sultana@47715
|
34 |
| TOK_TYPE | VLINE | EOF | DTHF | DFOF | DCNF | DFOT | DTFF | REAL of string
|
sultana@47715
|
35 |
| RATIONAL of string | SIGNED_INTEGER of string | UNSIGNED_INTEGER of string
|
sultana@47715
|
36 |
| DOT_DECIMAL of string | SINGLE_QUOTED of string | UPPER_WORD of string
|
sultana@47715
|
37 |
| LOWER_WORD of string | COMMENT of string
|
sultana@47715
|
38 |
| DISTINCT_OBJECT of string
|
sultana@47715
|
39 |
| DUD | INDEF_CHOICE | DEFIN_CHOICE
|
sultana@47715
|
40 |
| OPERATOR_FORALL | OPERATOR_EXISTS
|
sultana@47715
|
41 |
| PLUS | TIMES | GENTZEN_ARROW | DEP_SUM | DEP_PROD
|
sultana@48216
|
42 |
| DOLLAR_WORD of string | DOLLAR_DOLLAR_WORD of string
|
sultana@47715
|
43 |
| SUBTYPE | LET_TERM
|
sultana@47715
|
44 |
| THF | TFF | FOF | CNF
|
sultana@47715
|
45 |
| ITE_F | ITE_T
|
sultana@48215
|
46 |
| LET_TF | LET_FF | LET_FT | LET_TT
|
sultana@48215
|
47 |
|
sultana@47715
|
48 |
%nonterm
|
sultana@47715
|
49 |
annotations of annotation option
|
sultana@47715
|
50 |
| name of string
|
sultana@47715
|
51 |
| name_list of string list
|
sultana@47715
|
52 |
| formula_selection of string list
|
sultana@47715
|
53 |
| optional_info of general_term list
|
sultana@47715
|
54 |
| general_list of general_list | general_terms of general_term list
|
sultana@47715
|
55 |
| general_term of general_term
|
sultana@47715
|
56 |
|
sultana@47715
|
57 |
| atomic_word of string
|
sultana@47715
|
58 |
| general_data of general_data | variable_ of string
|
sultana@47715
|
59 |
| number of number_kind * string | formula_data of general_data
|
sultana@47715
|
60 |
| integer of string
|
sultana@47715
|
61 |
| identifier of string
|
sultana@47715
|
62 |
| general_function of general_data | useful_info of general_list
|
sultana@47715
|
63 |
| file_name of string
|
sultana@47715
|
64 |
| functor_ of symbol
|
sultana@47715
|
65 |
| term of tptp_term
|
sultana@47715
|
66 |
| arguments of tptp_term list
|
sultana@47715
|
67 |
| defined_functor of symbol
|
sultana@47715
|
68 |
| system_functor of symbol
|
sultana@47715
|
69 |
| system_constant of symbol
|
sultana@47715
|
70 |
| system_term of symbol * tptp_term list
|
sultana@47715
|
71 |
| defined_constant of symbol
|
sultana@47715
|
72 |
| defined_plain_term of symbol * tptp_term list
|
sultana@47715
|
73 |
| defined_atomic_term of tptp_term
|
sultana@47715
|
74 |
| defined_atom of tptp_term
|
sultana@47715
|
75 |
| defined_term of tptp_term
|
sultana@47715
|
76 |
| constant of symbol
|
sultana@47715
|
77 |
| plain_term of symbol * tptp_term list
|
sultana@47715
|
78 |
| function_term of tptp_term
|
sultana@47715
|
79 |
| conditional_term of tptp_term
|
sultana@47715
|
80 |
| system_atomic_formula of tptp_formula
|
sultana@47715
|
81 |
| infix_equality of symbol
|
sultana@47715
|
82 |
| infix_inequality of symbol
|
sultana@47715
|
83 |
| defined_infix_pred of symbol
|
sultana@47715
|
84 |
| defined_infix_formula of tptp_formula
|
sultana@47715
|
85 |
| defined_prop of string
|
sultana@47715
|
86 |
| defined_pred of string
|
sultana@47715
|
87 |
| defined_plain_formula of tptp_formula
|
sultana@47715
|
88 |
| defined_atomic_formula of tptp_formula
|
sultana@47715
|
89 |
| plain_atomic_formula of tptp_formula
|
sultana@47715
|
90 |
| atomic_formula of tptp_formula
|
sultana@47715
|
91 |
| unary_connective of symbol
|
sultana@47715
|
92 |
|
sultana@47715
|
93 |
| defined_type of tptp_base_type
|
sultana@47715
|
94 |
| system_type of string
|
sultana@47715
|
95 |
| assoc_connective of symbol
|
sultana@47715
|
96 |
| binary_connective of symbol
|
sultana@47715
|
97 |
| fol_quantifier of quantifier
|
sultana@47715
|
98 |
| thf_unary_connective of symbol
|
sultana@47715
|
99 |
| thf_pair_connective of symbol
|
sultana@47715
|
100 |
| thf_quantifier of quantifier
|
sultana@47715
|
101 |
| fol_infix_unary of tptp_formula
|
sultana@47715
|
102 |
| thf_conn_term of symbol
|
sultana@47715
|
103 |
| literal of tptp_formula
|
sultana@47715
|
104 |
| disjunction of tptp_formula
|
sultana@47715
|
105 |
| cnf_formula of tptp_formula
|
sultana@47715
|
106 |
| fof_tuple_list of tptp_formula list
|
sultana@47715
|
107 |
| fof_tuple of tptp_formula list
|
sultana@47715
|
108 |
| fof_sequent of tptp_formula
|
sultana@47715
|
109 |
| fof_unary_formula of tptp_formula
|
sultana@47715
|
110 |
| fof_variable_list of string list
|
sultana@47715
|
111 |
| fof_quantified_formula of tptp_formula
|
sultana@47715
|
112 |
| fof_unitary_formula of tptp_formula
|
sultana@47715
|
113 |
| fof_and_formula of tptp_formula
|
sultana@47715
|
114 |
| fof_or_formula of tptp_formula
|
sultana@47715
|
115 |
| fof_binary_assoc of tptp_formula
|
sultana@47715
|
116 |
| fof_binary_nonassoc of tptp_formula
|
sultana@47715
|
117 |
| fof_binary_formula of tptp_formula
|
sultana@47715
|
118 |
| fof_logic_formula of tptp_formula
|
sultana@47715
|
119 |
| fof_formula of tptp_formula
|
sultana@47715
|
120 |
| tff_tuple of tptp_formula list
|
sultana@47715
|
121 |
| tff_tuple_list of tptp_formula list
|
sultana@47715
|
122 |
| tff_sequent of tptp_formula
|
sultana@47715
|
123 |
| tff_conditional of tptp_formula
|
sultana@47715
|
124 |
| tff_xprod_type of tptp_type
|
sultana@47715
|
125 |
| tff_mapping_type of tptp_type
|
sultana@47715
|
126 |
| tff_atomic_type of tptp_type
|
sultana@47715
|
127 |
| tff_unitary_type of tptp_type
|
sultana@47715
|
128 |
| tff_top_level_type of tptp_type
|
sultana@47715
|
129 |
| tff_untyped_atom of symbol * tptp_type option
|
sultana@47715
|
130 |
| tff_typed_atom of symbol * tptp_type option
|
sultana@47715
|
131 |
| tff_unary_formula of tptp_formula
|
sultana@47715
|
132 |
| tff_typed_variable of string * tptp_type option
|
sultana@47715
|
133 |
| tff_variable of string * tptp_type option
|
sultana@47715
|
134 |
| tff_variable_list of (string * tptp_type option) list
|
sultana@47715
|
135 |
| tff_quantified_formula of tptp_formula
|
sultana@47715
|
136 |
| tff_unitary_formula of tptp_formula
|
sultana@47715
|
137 |
| tff_and_formula of tptp_formula
|
sultana@47715
|
138 |
| tff_or_formula of tptp_formula
|
sultana@47715
|
139 |
| tff_binary_assoc of tptp_formula
|
sultana@47715
|
140 |
| tff_binary_nonassoc of tptp_formula
|
sultana@47715
|
141 |
| tff_binary_formula of tptp_formula
|
sultana@47715
|
142 |
| tff_logic_formula of tptp_formula
|
sultana@47715
|
143 |
| tff_formula of tptp_formula
|
sultana@47715
|
144 |
|
sultana@47715
|
145 |
| thf_tuple of tptp_formula list
|
sultana@47715
|
146 |
| thf_tuple_list of tptp_formula list
|
sultana@47715
|
147 |
| thf_sequent of tptp_formula
|
sultana@47715
|
148 |
| thf_conditional of tptp_formula
|
sultana@47715
|
149 |
| thf_let of tptp_formula
|
sultana@47715
|
150 |
| thf_atom of tptp_formula
|
sultana@47715
|
151 |
| thf_union_type of tptp_type
|
sultana@47715
|
152 |
| thf_xprod_type of tptp_type
|
sultana@47715
|
153 |
| thf_mapping_type of tptp_type
|
sultana@47715
|
154 |
| thf_binary_type of tptp_type
|
sultana@47715
|
155 |
| thf_unitary_type of tptp_type
|
sultana@47715
|
156 |
| thf_top_level_type of tptp_type
|
sultana@47715
|
157 |
| thf_subtype of tptp_type
|
sultana@47715
|
158 |
| thf_typeable_formula of tptp_formula
|
sultana@47715
|
159 |
| thf_type_formula of tptp_formula * tptp_type
|
sultana@47715
|
160 |
| thf_unary_formula of tptp_formula
|
sultana@47715
|
161 |
| thf_typed_variable of string * tptp_type option
|
sultana@47715
|
162 |
| thf_variable of string * tptp_type option
|
sultana@47715
|
163 |
| thf_variable_list of (string * tptp_type option) list
|
sultana@47715
|
164 |
| thf_quantified_formula of tptp_formula
|
sultana@47715
|
165 |
| thf_unitary_formula of tptp_formula
|
sultana@47715
|
166 |
| thf_apply_formula of tptp_formula
|
sultana@47715
|
167 |
| thf_and_formula of tptp_formula
|
sultana@47715
|
168 |
| thf_or_formula of tptp_formula
|
sultana@47715
|
169 |
| thf_binary_tuple of tptp_formula
|
sultana@47715
|
170 |
| thf_binary_pair of tptp_formula
|
sultana@47715
|
171 |
| thf_binary_formula of tptp_formula
|
sultana@47715
|
172 |
| thf_logic_formula of tptp_formula
|
sultana@47715
|
173 |
| thf_formula of tptp_formula
|
sultana@47715
|
174 |
| formula_role of role
|
sultana@47715
|
175 |
|
sultana@47715
|
176 |
| cnf_annotated of tptp_line
|
sultana@47715
|
177 |
| fof_annotated of tptp_line
|
sultana@47715
|
178 |
| tff_annotated of tptp_line
|
sultana@47715
|
179 |
| thf_annotated of tptp_line
|
sultana@47715
|
180 |
| annotated_formula of tptp_line
|
sultana@47715
|
181 |
| include_ of tptp_line
|
sultana@47715
|
182 |
| tptp_input of tptp_line
|
sultana@47715
|
183 |
| tptp_file of tptp_problem
|
sultana@47715
|
184 |
| tptp of tptp_problem
|
sultana@47715
|
185 |
|
sultana@48215
|
186 |
| thf_let_defn of tptp_let list
|
sultana@48215
|
187 |
| tff_let of tptp_formula
|
sultana@48215
|
188 |
| tff_let_term_defn of tptp_let list
|
sultana@48215
|
189 |
| tff_let_formula_defn of tptp_let list
|
sultana@48215
|
190 |
| tff_quantified_type of tptp_type
|
sultana@48215
|
191 |
| tff_monotype of tptp_type
|
sultana@48215
|
192 |
| tff_type_arguments of tptp_type list
|
sultana@48215
|
193 |
| let_term of tptp_term
|
sultana@48216
|
194 |
| atomic_defined_word of string
|
sultana@48216
|
195 |
| atomic_system_word of string
|
sultana@48215
|
196 |
|
sultana@47715
|
197 |
%pos int
|
sultana@47715
|
198 |
%eop EOF
|
sultana@47715
|
199 |
%noshift EOF
|
sultana@48440
|
200 |
%arg (this_file_name) : string
|
sultana@47715
|
201 |
|
sultana@47715
|
202 |
%nonassoc LET
|
sultana@47715
|
203 |
%nonassoc RPAREN
|
sultana@47715
|
204 |
%nonassoc DUD
|
sultana@47715
|
205 |
%right COMMA
|
sultana@47715
|
206 |
%left COLON
|
sultana@47715
|
207 |
|
sultana@47715
|
208 |
%left AT_SIGN
|
sultana@47715
|
209 |
%nonassoc IFF XOR
|
sultana@48215
|
210 |
%right IMPLIES FI
|
sultana@47715
|
211 |
%nonassoc EQUALS NEQUALS
|
sultana@47715
|
212 |
%right VLINE NOR
|
sultana@47715
|
213 |
%left AMPERSAND NAND
|
sultana@47715
|
214 |
%right ARROW
|
sultana@47715
|
215 |
%left PLUS
|
sultana@47715
|
216 |
%left TIMES
|
sultana@47715
|
217 |
|
sultana@47715
|
218 |
%right OPERATOR_FORALL OPERATOR_EXISTS
|
sultana@47715
|
219 |
|
sultana@47715
|
220 |
%nonassoc EXCLAMATION QUESTION LAMBDA CARET
|
sultana@47715
|
221 |
%nonassoc TILDE
|
sultana@47715
|
222 |
%pure
|
sultana@47715
|
223 |
%start tptp
|
sultana@47715
|
224 |
%verbose
|
sultana@47715
|
225 |
%%
|
sultana@47715
|
226 |
|
sultana@47715
|
227 |
(* Title: HOL/TPTP/TPTP_Parser/tptp.yacc
|
sultana@47715
|
228 |
Author: Nik Sultana, Cambridge University Computer Laboratory
|
sultana@47715
|
229 |
|
sultana@47715
|
230 |
Parser for TPTP languages. Latest version of the language spec can
|
sultana@47715
|
231 |
be obtained from http://www.cs.miami.edu/~tptp/TPTP/SyntaxBNF.html
|
sultana@48215
|
232 |
This implements version 5.3.0.
|
sultana@47715
|
233 |
*)
|
sultana@47715
|
234 |
|
sultana@48215
|
235 |
tptp : tptp_file (( tptp_file ))
|
sultana@48215
|
236 |
|
sultana@48215
|
237 |
tptp_file : tptp_input tptp_file (( tptp_input :: tptp_file ))
|
sultana@48215
|
238 |
| COMMENT tptp_file (( tptp_file ))
|
sultana@48215
|
239 |
| (( [] ))
|
sultana@48215
|
240 |
|
sultana@48215
|
241 |
tptp_input : annotated_formula (( annotated_formula ))
|
sultana@48215
|
242 |
| include_ (( include_ ))
|
sultana@48215
|
243 |
|
sultana@48215
|
244 |
annotated_formula : thf_annotated (( thf_annotated ))
|
sultana@48215
|
245 |
| tff_annotated (( tff_annotated ))
|
sultana@48215
|
246 |
| fof_annotated (( fof_annotated ))
|
sultana@48215
|
247 |
| cnf_annotated (( cnf_annotated ))
|
sultana@48215
|
248 |
|
sultana@48215
|
249 |
thf_annotated : THF LPAREN name COMMA formula_role COMMA thf_formula annotations RPAREN PERIOD ((
|
sultana@48440
|
250 |
Annotated_Formula ((this_file_name, THFleft + 1, THFright + 1),
|
sultana@48215
|
251 |
THF, name, formula_role, thf_formula, annotations)
|
sultana@48215
|
252 |
))
|
sultana@48215
|
253 |
|
sultana@48215
|
254 |
tff_annotated : TFF LPAREN name COMMA formula_role COMMA tff_formula annotations RPAREN PERIOD ((
|
sultana@48440
|
255 |
Annotated_Formula ((this_file_name, TFFleft + 1, TFFright + 1),
|
sultana@48215
|
256 |
TFF, name, formula_role, tff_formula, annotations)
|
sultana@48215
|
257 |
))
|
sultana@48215
|
258 |
|
sultana@48215
|
259 |
fof_annotated : FOF LPAREN name COMMA formula_role COMMA fof_formula annotations RPAREN PERIOD ((
|
sultana@48440
|
260 |
Annotated_Formula ((this_file_name, FOFleft + 1, FOFright + 1),
|
sultana@48215
|
261 |
FOF, name, formula_role, fof_formula, annotations)
|
sultana@48215
|
262 |
))
|
sultana@48215
|
263 |
|
sultana@48215
|
264 |
cnf_annotated : CNF LPAREN name COMMA formula_role COMMA cnf_formula annotations RPAREN PERIOD ((
|
sultana@48440
|
265 |
Annotated_Formula ((this_file_name, CNFleft + 1, CNFright + 1),
|
sultana@48215
|
266 |
CNF, name, formula_role, cnf_formula, annotations)
|
sultana@48215
|
267 |
))
|
sultana@48215
|
268 |
|
sultana@47715
|
269 |
annotations : COMMA general_term optional_info (( SOME (general_term, optional_info) ))
|
sultana@47715
|
270 |
| (( NONE ))
|
sultana@47715
|
271 |
|
sultana@48215
|
272 |
formula_role : LOWER_WORD (( classify_role LOWER_WORD ))
|
sultana@47715
|
273 |
|
sultana@47715
|
274 |
|
sultana@48215
|
275 |
(* THF formulas *)
|
sultana@47715
|
276 |
|
sultana@48215
|
277 |
thf_formula : thf_logic_formula (( thf_logic_formula ))
|
sultana@48215
|
278 |
| thf_sequent (( thf_sequent ))
|
sultana@47715
|
279 |
|
sultana@48215
|
280 |
thf_logic_formula : thf_binary_formula (( thf_binary_formula ))
|
sultana@48215
|
281 |
| thf_unitary_formula (( thf_unitary_formula ))
|
sultana@48215
|
282 |
| thf_type_formula (( THF_typing thf_type_formula ))
|
sultana@48218
|
283 |
| thf_subtype (( Type_fmla thf_subtype ))
|
sultana@47715
|
284 |
|
sultana@48215
|
285 |
thf_binary_formula : thf_binary_pair (( thf_binary_pair ))
|
sultana@48215
|
286 |
| thf_binary_tuple (( thf_binary_tuple ))
|
sultana@48218
|
287 |
| thf_binary_type (( Type_fmla thf_binary_type ))
|
sultana@47715
|
288 |
|
sultana@48215
|
289 |
thf_binary_pair : thf_unitary_formula thf_pair_connective thf_unitary_formula ((
|
sultana@48215
|
290 |
Fmla (thf_pair_connective, [thf_unitary_formula1, thf_unitary_formula2])
|
sultana@48215
|
291 |
))
|
sultana@47715
|
292 |
|
sultana@48215
|
293 |
thf_binary_tuple : thf_or_formula (( thf_or_formula ))
|
sultana@48215
|
294 |
| thf_and_formula (( thf_and_formula ))
|
sultana@48215
|
295 |
| thf_apply_formula (( thf_apply_formula ))
|
sultana@47715
|
296 |
|
sultana@48215
|
297 |
thf_or_formula : thf_unitary_formula VLINE thf_unitary_formula (( Fmla (Interpreted_Logic Or, [thf_unitary_formula1, thf_unitary_formula2]) ))
|
sultana@48215
|
298 |
| thf_or_formula VLINE thf_unitary_formula (( Fmla (Interpreted_Logic Or, [thf_or_formula, thf_unitary_formula]) ))
|
sultana@47715
|
299 |
|
sultana@48215
|
300 |
thf_and_formula : thf_unitary_formula AMPERSAND thf_unitary_formula (( Fmla (Interpreted_Logic And, [thf_unitary_formula1, thf_unitary_formula2]) ))
|
sultana@48215
|
301 |
| thf_and_formula AMPERSAND thf_unitary_formula (( Fmla (Interpreted_Logic And, [thf_and_formula, thf_unitary_formula]) ))
|
sultana@47715
|
302 |
|
sultana@48215
|
303 |
thf_apply_formula : thf_unitary_formula AT_SIGN thf_unitary_formula (( Fmla (Interpreted_ExtraLogic Apply, [thf_unitary_formula1, thf_unitary_formula2]) ))
|
sultana@48215
|
304 |
| thf_apply_formula AT_SIGN thf_unitary_formula (( Fmla (Interpreted_ExtraLogic Apply, [thf_apply_formula, thf_unitary_formula]) ))
|
sultana@47715
|
305 |
|
sultana@48215
|
306 |
thf_unitary_formula : thf_quantified_formula (( thf_quantified_formula ))
|
sultana@48215
|
307 |
| thf_unary_formula (( thf_unary_formula ))
|
sultana@48215
|
308 |
| thf_atom (( thf_atom ))
|
sultana@48215
|
309 |
| thf_conditional (( thf_conditional ))
|
sultana@48215
|
310 |
| thf_let (( thf_let ))
|
sultana@48215
|
311 |
| LPAREN thf_logic_formula RPAREN (( thf_logic_formula ))
|
sultana@47715
|
312 |
|
sultana@48215
|
313 |
thf_quantified_formula : thf_quantifier LBRKT thf_variable_list RBRKT COLON thf_unitary_formula ((
|
sultana@48215
|
314 |
Quant (thf_quantifier, thf_variable_list, thf_unitary_formula)
|
sultana@48215
|
315 |
))
|
sultana@48215
|
316 |
|
sultana@48215
|
317 |
thf_variable_list : thf_variable (( [thf_variable] ))
|
sultana@48215
|
318 |
| thf_variable COMMA thf_variable_list (( thf_variable :: thf_variable_list ))
|
sultana@48215
|
319 |
|
sultana@48215
|
320 |
thf_variable : thf_typed_variable (( thf_typed_variable ))
|
sultana@48215
|
321 |
| variable_ (( (variable_, NONE) ))
|
sultana@48215
|
322 |
|
sultana@48215
|
323 |
thf_typed_variable : variable_ COLON thf_top_level_type (( (variable_, SOME thf_top_level_type) ))
|
sultana@48215
|
324 |
|
sultana@48215
|
325 |
thf_unary_formula : thf_unary_connective LPAREN thf_logic_formula RPAREN ((
|
sultana@48215
|
326 |
Fmla (thf_unary_connective, [thf_logic_formula])
|
sultana@48215
|
327 |
))
|
sultana@48215
|
328 |
|
sultana@48215
|
329 |
thf_atom : term (( Atom (THF_Atom_term term) ))
|
sultana@48215
|
330 |
| thf_conn_term (( Atom (THF_Atom_conn_term thf_conn_term) ))
|
sultana@48215
|
331 |
|
sultana@48215
|
332 |
thf_conditional : ITE_F LPAREN thf_logic_formula COMMA thf_logic_formula COMMA thf_logic_formula RPAREN ((
|
sultana@48215
|
333 |
Conditional (thf_logic_formula1, thf_logic_formula2, thf_logic_formula3)
|
sultana@48215
|
334 |
))
|
sultana@48215
|
335 |
|
sultana@48215
|
336 |
thf_let : LET_TF LPAREN thf_let_defn COMMA thf_formula RPAREN ((
|
sultana@48215
|
337 |
Let (thf_let_defn, thf_formula)
|
sultana@48215
|
338 |
))
|
sultana@48215
|
339 |
|
sultana@48215
|
340 |
(*FIXME here could check that fmla is of right form (TPTP BNF L130-134)*)
|
sultana@48215
|
341 |
thf_let_defn : thf_quantified_formula ((
|
sultana@48215
|
342 |
let
|
sultana@48215
|
343 |
val (_, vars, fmla) = extract_quant_info thf_quantified_formula
|
sultana@48215
|
344 |
in [Let_fmla (hd vars, fmla)]
|
sultana@48215
|
345 |
end
|
sultana@48215
|
346 |
))
|
sultana@48215
|
347 |
|
sultana@48215
|
348 |
thf_type_formula : thf_typeable_formula COLON thf_top_level_type (( (thf_typeable_formula, thf_top_level_type) ))
|
sultana@48215
|
349 |
|
sultana@48215
|
350 |
thf_typeable_formula : thf_atom (( thf_atom ))
|
sultana@48215
|
351 |
| LPAREN thf_logic_formula RPAREN (( thf_logic_formula ))
|
sultana@48215
|
352 |
|
sultana@48215
|
353 |
thf_subtype : constant SUBTYPE constant (( Subtype(constant1, constant2) ))
|
sultana@48215
|
354 |
|
sultana@48215
|
355 |
thf_top_level_type : thf_logic_formula (( Fmla_type thf_logic_formula ))
|
sultana@48215
|
356 |
|
sultana@48215
|
357 |
thf_unitary_type : thf_unitary_formula (( Fmla_type thf_unitary_formula ))
|
sultana@48215
|
358 |
|
sultana@48215
|
359 |
thf_binary_type : thf_mapping_type (( thf_mapping_type ))
|
sultana@48215
|
360 |
| thf_xprod_type (( thf_xprod_type ))
|
sultana@48215
|
361 |
| thf_union_type (( thf_union_type ))
|
sultana@48215
|
362 |
|
sultana@48215
|
363 |
thf_mapping_type : thf_unitary_type ARROW thf_unitary_type (( Fn_type(thf_unitary_type1, thf_unitary_type2) ))
|
sultana@48215
|
364 |
| thf_unitary_type ARROW thf_mapping_type (( Fn_type(thf_unitary_type, thf_mapping_type) ))
|
sultana@48215
|
365 |
|
sultana@48215
|
366 |
thf_xprod_type : thf_unitary_type TIMES thf_unitary_type (( Prod_type(thf_unitary_type1, thf_unitary_type2) ))
|
sultana@48215
|
367 |
| thf_xprod_type TIMES thf_unitary_type (( Prod_type(thf_xprod_type, thf_unitary_type) ))
|
sultana@48215
|
368 |
|
sultana@48215
|
369 |
thf_union_type : thf_unitary_type PLUS thf_unitary_type (( Sum_type(thf_unitary_type1, thf_unitary_type2) ))
|
sultana@48215
|
370 |
| thf_union_type PLUS thf_unitary_type (( Sum_type(thf_union_type, thf_unitary_type) ))
|
sultana@48215
|
371 |
|
sultana@48215
|
372 |
thf_sequent : thf_tuple GENTZEN_ARROW thf_tuple (( Sequent(thf_tuple1, thf_tuple2) ))
|
sultana@48215
|
373 |
| LPAREN thf_sequent RPAREN (( thf_sequent ))
|
sultana@48215
|
374 |
|
sultana@48215
|
375 |
thf_tuple : LBRKT RBRKT (( [] ))
|
sultana@48215
|
376 |
| LBRKT thf_tuple_list RBRKT (( thf_tuple_list ))
|
sultana@48215
|
377 |
|
sultana@48215
|
378 |
thf_tuple_list : thf_logic_formula (( [thf_logic_formula] ))
|
sultana@48215
|
379 |
| thf_logic_formula COMMA thf_tuple_list (( thf_logic_formula :: thf_tuple_list ))
|
sultana@48215
|
380 |
|
sultana@48215
|
381 |
|
sultana@48215
|
382 |
(* TFF Formulas *)
|
sultana@48215
|
383 |
|
sultana@48215
|
384 |
tff_formula : tff_logic_formula (( tff_logic_formula ))
|
sultana@48215
|
385 |
| tff_typed_atom (( Atom (TFF_Typed_Atom tff_typed_atom) ))
|
sultana@48215
|
386 |
| tff_sequent (( tff_sequent ))
|
sultana@48215
|
387 |
|
sultana@48215
|
388 |
tff_logic_formula : tff_binary_formula (( tff_binary_formula ))
|
sultana@48215
|
389 |
| tff_unitary_formula (( tff_unitary_formula ))
|
sultana@48215
|
390 |
|
sultana@48215
|
391 |
tff_binary_formula : tff_binary_nonassoc (( tff_binary_nonassoc ))
|
sultana@48215
|
392 |
| tff_binary_assoc (( tff_binary_assoc ))
|
sultana@48215
|
393 |
|
sultana@48215
|
394 |
tff_binary_nonassoc : tff_unitary_formula binary_connective tff_unitary_formula (( Fmla (binary_connective, [tff_unitary_formula1, tff_unitary_formula2]) ))
|
sultana@48215
|
395 |
|
sultana@48215
|
396 |
tff_binary_assoc : tff_or_formula (( tff_or_formula ))
|
sultana@48215
|
397 |
| tff_and_formula (( tff_and_formula ))
|
sultana@48215
|
398 |
|
sultana@48215
|
399 |
tff_or_formula : tff_unitary_formula VLINE tff_unitary_formula (( Fmla (Interpreted_Logic Or, [tff_unitary_formula1, tff_unitary_formula2]) ))
|
sultana@48215
|
400 |
| tff_or_formula VLINE tff_unitary_formula (( Fmla (Interpreted_Logic Or, [tff_or_formula, tff_unitary_formula]) ))
|
sultana@48215
|
401 |
|
sultana@48215
|
402 |
tff_and_formula : tff_unitary_formula AMPERSAND tff_unitary_formula (( Fmla (Interpreted_Logic And, [tff_unitary_formula1, tff_unitary_formula2]) ))
|
sultana@48215
|
403 |
| tff_and_formula AMPERSAND tff_unitary_formula (( Fmla (Interpreted_Logic And, [tff_and_formula, tff_unitary_formula]) ))
|
sultana@48215
|
404 |
|
sultana@48215
|
405 |
tff_unitary_formula : tff_quantified_formula (( tff_quantified_formula ))
|
sultana@48215
|
406 |
| tff_unary_formula (( tff_unary_formula ))
|
sultana@48215
|
407 |
| atomic_formula (( atomic_formula ))
|
sultana@48215
|
408 |
| tff_conditional (( tff_conditional ))
|
sultana@48215
|
409 |
| tff_let (( tff_let ))
|
sultana@48215
|
410 |
| LPAREN tff_logic_formula RPAREN (( tff_logic_formula ))
|
sultana@48215
|
411 |
|
sultana@48215
|
412 |
tff_quantified_formula : fol_quantifier LBRKT tff_variable_list RBRKT COLON tff_unitary_formula ((
|
sultana@48215
|
413 |
Quant (fol_quantifier, tff_variable_list, tff_unitary_formula)
|
sultana@48215
|
414 |
))
|
sultana@48215
|
415 |
|
sultana@48215
|
416 |
tff_variable_list : tff_variable (( [tff_variable] ))
|
sultana@48215
|
417 |
| tff_variable COMMA tff_variable_list (( tff_variable :: tff_variable_list ))
|
sultana@48215
|
418 |
|
sultana@48215
|
419 |
tff_variable : tff_typed_variable (( tff_typed_variable ))
|
sultana@48215
|
420 |
| variable_ (( (variable_, NONE) ))
|
sultana@48215
|
421 |
|
sultana@48215
|
422 |
tff_typed_variable : variable_ COLON tff_atomic_type (( (variable_, SOME tff_atomic_type) ))
|
sultana@48215
|
423 |
|
sultana@48215
|
424 |
tff_unary_formula : unary_connective tff_unitary_formula (( Fmla (unary_connective, [tff_unitary_formula]) ))
|
sultana@48215
|
425 |
| fol_infix_unary (( fol_infix_unary ))
|
sultana@48215
|
426 |
|
sultana@48215
|
427 |
tff_conditional : ITE_F LPAREN tff_logic_formula COMMA tff_logic_formula COMMA tff_logic_formula RPAREN ((
|
sultana@48215
|
428 |
Conditional (tff_logic_formula1, tff_logic_formula2, tff_logic_formula3)
|
sultana@48215
|
429 |
))
|
sultana@48215
|
430 |
|
sultana@48215
|
431 |
tff_let : LET_TF LPAREN tff_let_term_defn COMMA tff_formula RPAREN ((Let (tff_let_term_defn, tff_formula) ))
|
sultana@48215
|
432 |
| LET_FF LPAREN tff_let_formula_defn COMMA tff_formula RPAREN (( Let (tff_let_formula_defn, tff_formula) ))
|
sultana@48215
|
433 |
|
sultana@48215
|
434 |
(*FIXME here could check that fmla is of right form (TPTP BNF L210-214)*)
|
sultana@48215
|
435 |
(*FIXME why "term" if using "Let_fmla"?*)
|
sultana@48215
|
436 |
tff_let_term_defn : tff_quantified_formula ((
|
sultana@48215
|
437 |
let
|
sultana@48215
|
438 |
val (_, vars, fmla) = extract_quant_info tff_quantified_formula
|
sultana@48215
|
439 |
in [Let_fmla (hd vars, fmla)]
|
sultana@48215
|
440 |
end
|
sultana@48215
|
441 |
))
|
sultana@48215
|
442 |
|
sultana@48215
|
443 |
(*FIXME here could check that fmla is of right form (TPTP BNF L215-217)*)
|
sultana@48215
|
444 |
tff_let_formula_defn : tff_quantified_formula ((
|
sultana@48215
|
445 |
let
|
sultana@48215
|
446 |
val (_, vars, fmla) = extract_quant_info tff_quantified_formula
|
sultana@48215
|
447 |
in [Let_fmla (hd vars, fmla)]
|
sultana@48215
|
448 |
end
|
sultana@48215
|
449 |
))
|
sultana@48215
|
450 |
|
sultana@48215
|
451 |
tff_sequent : tff_tuple GENTZEN_ARROW tff_tuple (( Sequent (tff_tuple1, tff_tuple2) ))
|
sultana@48215
|
452 |
| LPAREN tff_sequent RPAREN (( tff_sequent ))
|
sultana@48215
|
453 |
|
sultana@48215
|
454 |
tff_tuple : LBRKT RBRKT (( [] ))
|
sultana@48215
|
455 |
| LBRKT tff_tuple_list RBRKT (( tff_tuple_list ))
|
sultana@48215
|
456 |
|
sultana@48215
|
457 |
tff_tuple_list : tff_logic_formula COMMA tff_tuple_list (( tff_logic_formula :: tff_tuple_list ))
|
sultana@48215
|
458 |
| tff_logic_formula (( [tff_logic_formula] ))
|
sultana@48215
|
459 |
|
sultana@48215
|
460 |
tff_typed_atom : tff_untyped_atom COLON tff_top_level_type (( (fst tff_untyped_atom, SOME tff_top_level_type) ))
|
sultana@48215
|
461 |
| LPAREN tff_typed_atom RPAREN (( tff_typed_atom ))
|
sultana@48215
|
462 |
|
sultana@48215
|
463 |
tff_untyped_atom : functor_ (( (functor_, NONE) ))
|
sultana@48215
|
464 |
| system_functor (( (system_functor, NONE) ))
|
sultana@48215
|
465 |
|
sultana@48215
|
466 |
tff_top_level_type : tff_atomic_type (( tff_atomic_type ))
|
sultana@48215
|
467 |
| tff_mapping_type (( tff_mapping_type ))
|
sultana@48215
|
468 |
| tff_quantified_type (( tff_quantified_type ))
|
sultana@48215
|
469 |
|
sultana@48215
|
470 |
tff_quantified_type : DEP_PROD LBRKT tff_variable_list RBRKT COLON tff_monotype ((
|
sultana@48218
|
471 |
Fmla_type (Quant (Dep_Prod, tff_variable_list, Type_fmla tff_monotype))
|
sultana@48215
|
472 |
))
|
sultana@48215
|
473 |
| LPAREN tff_quantified_type RPAREN (( tff_quantified_type ))
|
sultana@48215
|
474 |
|
sultana@48215
|
475 |
tff_monotype : tff_atomic_type (( tff_atomic_type ))
|
sultana@48215
|
476 |
| LPAREN tff_mapping_type RPAREN (( tff_mapping_type ))
|
sultana@48215
|
477 |
|
sultana@48215
|
478 |
tff_unitary_type : tff_atomic_type (( tff_atomic_type ))
|
sultana@48215
|
479 |
| LPAREN tff_xprod_type RPAREN (( tff_xprod_type ))
|
sultana@48215
|
480 |
|
sultana@48215
|
481 |
tff_atomic_type : atomic_word (( Atom_type atomic_word ))
|
sultana@48215
|
482 |
| defined_type (( Defined_type defined_type ))
|
sultana@48218
|
483 |
| atomic_word LPAREN tff_type_arguments RPAREN (( Fmla_type (Fmla (Uninterpreted atomic_word, (map Type_fmla tff_type_arguments))) ))
|
sultana@48215
|
484 |
| variable_ (( Fmla_type (Pred (Interpreted_ExtraLogic Apply, [Term_Var variable_])) ))
|
sultana@48215
|
485 |
|
sultana@48215
|
486 |
tff_type_arguments : tff_atomic_type (( [tff_atomic_type] ))
|
sultana@48215
|
487 |
| tff_atomic_type COMMA tff_type_arguments (( tff_atomic_type :: tff_type_arguments ))
|
sultana@48215
|
488 |
|
sultana@48215
|
489 |
tff_mapping_type : tff_unitary_type ARROW tff_atomic_type (( Fn_type(tff_unitary_type, tff_atomic_type) ))
|
sultana@48215
|
490 |
| LPAREN tff_mapping_type RPAREN (( tff_mapping_type ))
|
sultana@48215
|
491 |
|
sultana@48215
|
492 |
tff_xprod_type : tff_atomic_type TIMES tff_atomic_type (( Prod_type(tff_atomic_type1, tff_atomic_type2) ))
|
sultana@48215
|
493 |
| tff_xprod_type TIMES tff_atomic_type (( Prod_type(tff_xprod_type, tff_atomic_type) ))
|
sultana@48215
|
494 |
| LPAREN tff_xprod_type RPAREN (( tff_xprod_type ))
|
sultana@48215
|
495 |
|
sultana@48215
|
496 |
|
sultana@48215
|
497 |
(* FOF Formulas *)
|
sultana@48215
|
498 |
|
sultana@48215
|
499 |
fof_formula : fof_logic_formula (( fof_logic_formula ))
|
sultana@48215
|
500 |
| fof_sequent (( fof_sequent ))
|
sultana@48215
|
501 |
|
sultana@48215
|
502 |
fof_logic_formula : fof_binary_formula (( fof_binary_formula ))
|
sultana@48215
|
503 |
| fof_unitary_formula (( fof_unitary_formula ))
|
sultana@48215
|
504 |
|
sultana@48215
|
505 |
fof_binary_formula : fof_binary_nonassoc (( fof_binary_nonassoc ))
|
sultana@48215
|
506 |
| fof_binary_assoc (( fof_binary_assoc ))
|
sultana@48215
|
507 |
|
sultana@48215
|
508 |
fof_binary_nonassoc : fof_unitary_formula binary_connective fof_unitary_formula ((
|
sultana@48215
|
509 |
Fmla (binary_connective, [fof_unitary_formula1, fof_unitary_formula2] )
|
sultana@48215
|
510 |
))
|
sultana@48215
|
511 |
|
sultana@48215
|
512 |
fof_binary_assoc : fof_or_formula (( fof_or_formula ))
|
sultana@48215
|
513 |
| fof_and_formula (( fof_and_formula ))
|
sultana@48215
|
514 |
|
sultana@48215
|
515 |
fof_or_formula : fof_unitary_formula VLINE fof_unitary_formula (( Fmla (Interpreted_Logic Or, [fof_unitary_formula1, fof_unitary_formula2]) ))
|
sultana@48215
|
516 |
| fof_or_formula VLINE fof_unitary_formula (( Fmla (Interpreted_Logic Or, [fof_or_formula, fof_unitary_formula]) ))
|
sultana@48215
|
517 |
|
sultana@48215
|
518 |
fof_and_formula : fof_unitary_formula AMPERSAND fof_unitary_formula (( Fmla (Interpreted_Logic And, [fof_unitary_formula1, fof_unitary_formula2]) ))
|
sultana@48215
|
519 |
| fof_and_formula AMPERSAND fof_unitary_formula (( Fmla (Interpreted_Logic And, [fof_and_formula, fof_unitary_formula]) ))
|
sultana@48215
|
520 |
|
sultana@48215
|
521 |
fof_unitary_formula : fof_quantified_formula (( fof_quantified_formula ))
|
sultana@48215
|
522 |
| fof_unary_formula (( fof_unary_formula ))
|
sultana@48215
|
523 |
| atomic_formula (( atomic_formula ))
|
sultana@48215
|
524 |
| LPAREN fof_logic_formula RPAREN (( fof_logic_formula ))
|
sultana@48215
|
525 |
|
sultana@48215
|
526 |
fof_quantified_formula : fol_quantifier LBRKT fof_variable_list RBRKT COLON fof_unitary_formula ((
|
sultana@48215
|
527 |
Quant (fol_quantifier, map (fn v => (v, NONE)) fof_variable_list, fof_unitary_formula)
|
sultana@48215
|
528 |
))
|
sultana@48215
|
529 |
|
sultana@48215
|
530 |
fof_variable_list : variable_ (( [variable_] ))
|
sultana@48215
|
531 |
| variable_ COMMA fof_variable_list (( variable_ :: fof_variable_list ))
|
sultana@48215
|
532 |
|
sultana@48215
|
533 |
fof_unary_formula : unary_connective fof_unitary_formula (( Fmla (unary_connective, [fof_unitary_formula]) ))
|
sultana@48215
|
534 |
| fol_infix_unary (( fol_infix_unary ))
|
sultana@48215
|
535 |
|
sultana@48215
|
536 |
fof_sequent : fof_tuple GENTZEN_ARROW fof_tuple (( Sequent (fof_tuple1, fof_tuple2) ))
|
sultana@48215
|
537 |
| LPAREN fof_sequent RPAREN (( fof_sequent ))
|
sultana@48215
|
538 |
|
sultana@48215
|
539 |
fof_tuple : LBRKT RBRKT (( [] ))
|
sultana@48215
|
540 |
| LBRKT fof_tuple_list RBRKT (( fof_tuple_list ))
|
sultana@48215
|
541 |
|
sultana@48215
|
542 |
fof_tuple_list : fof_logic_formula (( [fof_logic_formula] ))
|
sultana@48215
|
543 |
| fof_logic_formula COMMA fof_tuple_list (( fof_logic_formula :: fof_tuple_list ))
|
sultana@48215
|
544 |
|
sultana@48215
|
545 |
|
sultana@48215
|
546 |
(* CNF Formulas *)
|
sultana@48215
|
547 |
|
sultana@48215
|
548 |
cnf_formula : LPAREN disjunction RPAREN (( disjunction ))
|
sultana@48215
|
549 |
| disjunction (( disjunction ))
|
sultana@48215
|
550 |
|
sultana@48215
|
551 |
disjunction : literal (( literal ))
|
sultana@48215
|
552 |
| disjunction VLINE literal (( Fmla (Interpreted_Logic Or, [disjunction, literal]) ))
|
sultana@48215
|
553 |
|
sultana@48215
|
554 |
literal : atomic_formula (( atomic_formula ))
|
sultana@48215
|
555 |
| TILDE atomic_formula (( Fmla (Interpreted_Logic Not, [atomic_formula]) ))
|
sultana@48215
|
556 |
| fol_infix_unary (( fol_infix_unary ))
|
sultana@48215
|
557 |
|
sultana@48215
|
558 |
|
sultana@48215
|
559 |
(* Special Formulas *)
|
sultana@48215
|
560 |
|
sultana@48215
|
561 |
thf_conn_term : thf_pair_connective (( thf_pair_connective ))
|
sultana@48215
|
562 |
| assoc_connective (( assoc_connective ))
|
sultana@48215
|
563 |
| thf_unary_connective (( thf_unary_connective ))
|
sultana@48215
|
564 |
|
sultana@48215
|
565 |
fol_infix_unary : term infix_inequality term (( Pred (infix_inequality, [term1, term2]) ))
|
sultana@48215
|
566 |
|
sultana@48215
|
567 |
|
sultana@48215
|
568 |
(* Connectives - THF *)
|
sultana@48215
|
569 |
|
sultana@48215
|
570 |
thf_quantifier : fol_quantifier (( fol_quantifier ))
|
sultana@48215
|
571 |
| CARET (( Lambda ))
|
sultana@48215
|
572 |
| DEP_PROD (( Dep_Prod ))
|
sultana@48215
|
573 |
| DEP_SUM (( Dep_Sum ))
|
sultana@48215
|
574 |
| INDEF_CHOICE (( Epsilon ))
|
sultana@48215
|
575 |
| DEFIN_CHOICE (( Iota ))
|
sultana@48215
|
576 |
|
sultana@48215
|
577 |
thf_pair_connective : infix_equality (( infix_equality ))
|
sultana@48215
|
578 |
| infix_inequality (( infix_inequality ))
|
sultana@48215
|
579 |
| binary_connective (( binary_connective ))
|
sultana@48215
|
580 |
|
sultana@48215
|
581 |
thf_unary_connective : unary_connective (( unary_connective ))
|
sultana@48215
|
582 |
| OPERATOR_FORALL (( Interpreted_Logic Op_Forall ))
|
sultana@48215
|
583 |
| OPERATOR_EXISTS (( Interpreted_Logic Op_Exists ))
|
sultana@48215
|
584 |
|
sultana@48215
|
585 |
|
sultana@48215
|
586 |
(* Connectives - THF and TFF
|
sultana@48215
|
587 |
instead of subtype_sign use token SUBTYPE
|
sultana@48215
|
588 |
*)
|
sultana@48215
|
589 |
|
sultana@48215
|
590 |
|
sultana@48215
|
591 |
(* Connectives - FOF *)
|
sultana@48215
|
592 |
|
sultana@48215
|
593 |
fol_quantifier : EXCLAMATION (( Forall ))
|
sultana@48215
|
594 |
| QUESTION (( Exists ))
|
sultana@48215
|
595 |
|
sultana@48215
|
596 |
binary_connective : IFF (( Interpreted_Logic Iff ))
|
sultana@48215
|
597 |
| IMPLIES (( Interpreted_Logic If ))
|
sultana@48215
|
598 |
| FI (( Interpreted_Logic Fi ))
|
sultana@48215
|
599 |
| XOR (( Interpreted_Logic Xor ))
|
sultana@48215
|
600 |
| NOR (( Interpreted_Logic Nor ))
|
sultana@48215
|
601 |
| NAND (( Interpreted_Logic Nand ))
|
sultana@48215
|
602 |
|
sultana@48215
|
603 |
assoc_connective : VLINE (( Interpreted_Logic Or ))
|
sultana@48215
|
604 |
| AMPERSAND (( Interpreted_Logic And ))
|
sultana@48215
|
605 |
|
sultana@48215
|
606 |
unary_connective : TILDE (( Interpreted_Logic Not ))
|
sultana@48215
|
607 |
|
sultana@48215
|
608 |
|
sultana@48215
|
609 |
(* The sequent arrow
|
sultana@48215
|
610 |
use token GENTZEN_ARROW
|
sultana@48215
|
611 |
*)
|
sultana@48215
|
612 |
|
sultana@48215
|
613 |
|
sultana@48215
|
614 |
(* Types for THF and TFF *)
|
sultana@48215
|
615 |
|
sultana@48216
|
616 |
defined_type : atomic_defined_word ((
|
sultana@48216
|
617 |
case atomic_defined_word of
|
sultana@48215
|
618 |
"$oType" => Type_Bool
|
sultana@48215
|
619 |
| "$o" => Type_Bool
|
sultana@48215
|
620 |
| "$iType" => Type_Ind
|
sultana@48215
|
621 |
| "$i" => Type_Ind
|
sultana@48215
|
622 |
| "$tType" => Type_Type
|
sultana@48215
|
623 |
| "$real" => Type_Real
|
sultana@48215
|
624 |
| "$rat" => Type_Rat
|
sultana@48215
|
625 |
| "$int" => Type_Int
|
sultana@48215
|
626 |
| thing => raise UNRECOGNISED_SYMBOL ("defined_type", thing)
|
sultana@48215
|
627 |
))
|
sultana@47715
|
628 |
|
sultana@48216
|
629 |
system_type : atomic_system_word (( atomic_system_word ))
|
sultana@47715
|
630 |
|
sultana@48215
|
631 |
|
sultana@48215
|
632 |
(* First-order atoms *)
|
sultana@48215
|
633 |
|
sultana@48215
|
634 |
atomic_formula : plain_atomic_formula (( plain_atomic_formula ))
|
sultana@48215
|
635 |
| defined_atomic_formula (( defined_atomic_formula ))
|
sultana@48215
|
636 |
| system_atomic_formula (( system_atomic_formula ))
|
sultana@48215
|
637 |
|
sultana@48215
|
638 |
plain_atomic_formula : plain_term (( Pred plain_term ))
|
sultana@48215
|
639 |
|
sultana@48215
|
640 |
defined_atomic_formula : defined_plain_formula (( defined_plain_formula ))
|
sultana@48215
|
641 |
| defined_infix_formula (( defined_infix_formula ))
|
sultana@48215
|
642 |
|
sultana@48215
|
643 |
defined_plain_formula : defined_plain_term (( Pred defined_plain_term ))
|
sultana@48215
|
644 |
|
sultana@48215
|
645 |
(*FIXME not used*)
|
sultana@48216
|
646 |
defined_prop : atomic_defined_word ((
|
sultana@48216
|
647 |
case atomic_defined_word of
|
sultana@48215
|
648 |
"$true" => "$true"
|
sultana@48215
|
649 |
| "$false" => "$false"
|
sultana@48215
|
650 |
| thing => raise UNRECOGNISED_SYMBOL ("defined_prop", thing)
|
sultana@47715
|
651 |
))
|
sultana@47715
|
652 |
|
sultana@48215
|
653 |
(*FIXME not used*)
|
sultana@48216
|
654 |
defined_pred : atomic_defined_word ((
|
sultana@48216
|
655 |
case atomic_defined_word of
|
sultana@48215
|
656 |
"$distinct" => "$distinct"
|
sultana@48215
|
657 |
| "$ite_f" => "$ite_f"
|
sultana@48215
|
658 |
| "$less" => "$less"
|
sultana@48215
|
659 |
| "$lesseq" => "$lesseq"
|
sultana@48215
|
660 |
| "$greater" => "$greater"
|
sultana@48215
|
661 |
| "$greatereq" => "$greatereq"
|
sultana@48215
|
662 |
| "$is_int" => "$is_int"
|
sultana@48215
|
663 |
| "$is_rat" => "$is_rat"
|
sultana@48215
|
664 |
| thing => raise UNRECOGNISED_SYMBOL ("defined_pred", thing)
|
sultana@48215
|
665 |
))
|
sultana@48215
|
666 |
|
sultana@48215
|
667 |
defined_infix_formula : term defined_infix_pred term ((Pred (defined_infix_pred, [term1, term2])))
|
sultana@48215
|
668 |
|
sultana@48215
|
669 |
defined_infix_pred : infix_equality (( infix_equality ))
|
sultana@48215
|
670 |
|
sultana@48215
|
671 |
infix_equality : EQUALS (( Interpreted_Logic Equals ))
|
sultana@48215
|
672 |
|
sultana@48215
|
673 |
infix_inequality : NEQUALS (( Interpreted_Logic NEquals ))
|
sultana@48215
|
674 |
|
sultana@48215
|
675 |
system_atomic_formula : system_term (( Pred system_term ))
|
sultana@48215
|
676 |
|
sultana@48215
|
677 |
|
sultana@48215
|
678 |
(* First-order terms *)
|
sultana@48215
|
679 |
|
sultana@48215
|
680 |
term : function_term (( function_term ))
|
sultana@48215
|
681 |
| variable_ (( Term_Var variable_ ))
|
sultana@48215
|
682 |
| conditional_term (( conditional_term ))
|
sultana@48215
|
683 |
| let_term (( let_term ))
|
sultana@48215
|
684 |
|
sultana@48215
|
685 |
function_term : plain_term (( Term_Func plain_term ))
|
sultana@48215
|
686 |
| defined_term (( defined_term ))
|
sultana@48215
|
687 |
| system_term (( Term_Func system_term ))
|
sultana@48215
|
688 |
|
sultana@48215
|
689 |
plain_term : constant (( (constant, []) ))
|
sultana@48215
|
690 |
| functor_ LPAREN arguments RPAREN (( (functor_, arguments) ))
|
sultana@48215
|
691 |
|
sultana@48215
|
692 |
constant : functor_ (( functor_ ))
|
sultana@48215
|
693 |
|
sultana@47715
|
694 |
functor_ : atomic_word (( Uninterpreted atomic_word ))
|
sultana@47715
|
695 |
|
sultana@48215
|
696 |
defined_term : defined_atom (( defined_atom ))
|
sultana@48215
|
697 |
| defined_atomic_term (( defined_atomic_term ))
|
sultana@47715
|
698 |
|
sultana@48215
|
699 |
defined_atom : number (( Term_Num number ))
|
sultana@48215
|
700 |
| DISTINCT_OBJECT (( Term_Distinct_Object DISTINCT_OBJECT ))
|
sultana@47715
|
701 |
|
sultana@48215
|
702 |
defined_atomic_term : defined_plain_term (( Term_Func defined_plain_term ))
|
sultana@48215
|
703 |
|
sultana@48215
|
704 |
defined_plain_term : defined_constant (( (defined_constant, []) ))
|
sultana@48215
|
705 |
| defined_functor LPAREN arguments RPAREN (( (defined_functor, arguments) ))
|
sultana@48215
|
706 |
|
sultana@48215
|
707 |
defined_constant : defined_functor (( defined_functor ))
|
sultana@48215
|
708 |
|
sultana@48216
|
709 |
(*FIXME would be nicer to split these up*)
|
sultana@48216
|
710 |
defined_functor : atomic_defined_word ((
|
sultana@48216
|
711 |
case atomic_defined_word of
|
sultana@48215
|
712 |
"$uminus" => Interpreted_ExtraLogic UMinus
|
sultana@48215
|
713 |
| "$sum" => Interpreted_ExtraLogic Sum
|
sultana@47715
|
714 |
| "$difference" => Interpreted_ExtraLogic Difference
|
sultana@47715
|
715 |
| "$product" => Interpreted_ExtraLogic Product
|
sultana@47715
|
716 |
| "$quotient" => Interpreted_ExtraLogic Quotient
|
sultana@47715
|
717 |
| "$quotient_e" => Interpreted_ExtraLogic Quotient_E
|
sultana@47715
|
718 |
| "$quotient_t" => Interpreted_ExtraLogic Quotient_T
|
sultana@47715
|
719 |
| "$quotient_f" => Interpreted_ExtraLogic Quotient_F
|
sultana@47715
|
720 |
| "$remainder_e" => Interpreted_ExtraLogic Remainder_E
|
sultana@47715
|
721 |
| "$remainder_t" => Interpreted_ExtraLogic Remainder_T
|
sultana@47715
|
722 |
| "$remainder_f" => Interpreted_ExtraLogic Remainder_F
|
sultana@47715
|
723 |
| "$floor" => Interpreted_ExtraLogic Floor
|
sultana@47715
|
724 |
| "$ceiling" => Interpreted_ExtraLogic Ceiling
|
sultana@47715
|
725 |
| "$truncate" => Interpreted_ExtraLogic Truncate
|
sultana@47715
|
726 |
| "$round" => Interpreted_ExtraLogic Round
|
sultana@47715
|
727 |
| "$to_int" => Interpreted_ExtraLogic To_Int
|
sultana@47715
|
728 |
| "$to_rat" => Interpreted_ExtraLogic To_Rat
|
sultana@47715
|
729 |
| "$to_real" => Interpreted_ExtraLogic To_Real
|
sultana@47715
|
730 |
|
sultana@47715
|
731 |
| "$i" => TypeSymbol Type_Ind
|
sultana@47715
|
732 |
| "$o" => TypeSymbol Type_Bool
|
sultana@47715
|
733 |
| "$iType" => TypeSymbol Type_Ind
|
sultana@47715
|
734 |
| "$oType" => TypeSymbol Type_Bool
|
sultana@47715
|
735 |
| "$int" => TypeSymbol Type_Int
|
sultana@47715
|
736 |
| "$real" => TypeSymbol Type_Real
|
sultana@47715
|
737 |
| "$rat" => TypeSymbol Type_Rat
|
sultana@47715
|
738 |
| "$tType" => TypeSymbol Type_Type
|
sultana@47715
|
739 |
|
sultana@47715
|
740 |
| "$true" => Interpreted_Logic True
|
sultana@47715
|
741 |
| "$false" => Interpreted_Logic False
|
sultana@47715
|
742 |
|
sultana@47715
|
743 |
| "$less" => Interpreted_ExtraLogic Less
|
sultana@47715
|
744 |
| "$lesseq" => Interpreted_ExtraLogic LessEq
|
sultana@47715
|
745 |
| "$greatereq" => Interpreted_ExtraLogic GreaterEq
|
sultana@47715
|
746 |
| "$greater" => Interpreted_ExtraLogic Greater
|
sultana@47715
|
747 |
| "$evaleq" => Interpreted_ExtraLogic EvalEq
|
sultana@47715
|
748 |
|
sultana@47715
|
749 |
| "$is_int" => Interpreted_ExtraLogic Is_Int
|
sultana@47715
|
750 |
| "$is_rat" => Interpreted_ExtraLogic Is_Rat
|
sultana@47715
|
751 |
|
sultana@48215
|
752 |
| "$distinct" => Interpreted_ExtraLogic Distinct
|
sultana@48215
|
753 |
|
sultana@47715
|
754 |
| thing => raise UNRECOGNISED_SYMBOL ("defined_functor", thing)
|
sultana@47715
|
755 |
))
|
sultana@47715
|
756 |
|
sultana@48215
|
757 |
system_term : system_constant (( (system_constant, []) ))
|
sultana@48215
|
758 |
| system_functor LPAREN arguments RPAREN (( (system_functor, arguments) ))
|
sultana@47715
|
759 |
|
sultana@48215
|
760 |
system_constant : system_functor (( system_functor ))
|
sultana@48215
|
761 |
|
sultana@48216
|
762 |
system_functor : atomic_system_word (( System atomic_system_word ))
|
sultana@48215
|
763 |
|
sultana@48215
|
764 |
variable_ : UPPER_WORD (( UPPER_WORD ))
|
sultana@48215
|
765 |
|
sultana@48215
|
766 |
arguments : term (( [term] ))
|
sultana@48215
|
767 |
| term COMMA arguments (( term :: arguments ))
|
sultana@47715
|
768 |
|
sultana@47715
|
769 |
conditional_term : ITE_T LPAREN tff_logic_formula COMMA term COMMA term RPAREN ((
|
sultana@47715
|
770 |
Term_Conditional (tff_logic_formula, term1, term2)
|
sultana@47715
|
771 |
))
|
sultana@47715
|
772 |
|
sultana@47715
|
773 |
|
sultana@48215
|
774 |
let_term : LET_FT LPAREN tff_let_formula_defn COMMA term RPAREN ((Term_Let (tff_let_formula_defn, term) ))
|
sultana@48215
|
775 |
| LET_TT LPAREN tff_let_term_defn COMMA term RPAREN ((Term_Let (tff_let_term_defn, term) ))
|
sultana@47715
|
776 |
|
sultana@47715
|
777 |
|
sultana@48215
|
778 |
(* Formula sources
|
sultana@48215
|
779 |
Don't currently use following non-terminals:
|
sultana@48215
|
780 |
source, sources, dag_source, inference_record, inference_rule, parent_list,
|
sultana@48215
|
781 |
parent_info, parent_details, internal_source, intro_type, external_source,
|
sultana@48215
|
782 |
file_source, file_info, theory, theory_name, creator_source, creator_name.
|
sultana@48215
|
783 |
*)
|
sultana@47715
|
784 |
|
sultana@47715
|
785 |
|
sultana@48215
|
786 |
(* Useful info fields *)
|
sultana@47715
|
787 |
|
sultana@48215
|
788 |
optional_info : COMMA useful_info (( useful_info ))
|
sultana@48215
|
789 |
| (( [] ))
|
sultana@47715
|
790 |
|
sultana@48215
|
791 |
useful_info : general_list (( general_list ))
|
sultana@47715
|
792 |
|
sultana@47715
|
793 |
include_ : INCLUDE LPAREN file_name formula_selection RPAREN PERIOD ((
|
sultana@48440
|
794 |
Include ((this_file_name, INCLUDEleft + 1, INCLUDEright + 1),
|
sultana@48440
|
795 |
file_name, formula_selection)
|
sultana@47715
|
796 |
))
|
sultana@47715
|
797 |
|
sultana@47715
|
798 |
formula_selection : COMMA LBRKT name_list RBRKT (( name_list ))
|
sultana@47715
|
799 |
| (( [] ))
|
sultana@47715
|
800 |
|
sultana@47715
|
801 |
name_list : name COMMA name_list (( name :: name_list ))
|
sultana@47715
|
802 |
| name (( [name] ))
|
sultana@47715
|
803 |
|
sultana@48215
|
804 |
|
sultana@48215
|
805 |
(* Non-logical data *)
|
sultana@48215
|
806 |
|
sultana@48215
|
807 |
general_term : general_data (( General_Data general_data ))
|
sultana@48215
|
808 |
| general_data COLON general_term (( General_Term (general_data, general_term) ))
|
sultana@48215
|
809 |
| general_list (( General_List general_list ))
|
sultana@48215
|
810 |
|
sultana@48215
|
811 |
general_data : atomic_word (( Atomic_Word atomic_word ))
|
sultana@48215
|
812 |
| general_function (( general_function ))
|
sultana@48215
|
813 |
| variable_ (( V variable_ ))
|
sultana@48215
|
814 |
| number (( Number number ))
|
sultana@48215
|
815 |
| DISTINCT_OBJECT (( Distinct_Object DISTINCT_OBJECT ))
|
sultana@48215
|
816 |
| formula_data (( formula_data ))
|
sultana@48215
|
817 |
|
sultana@48215
|
818 |
general_function: atomic_word LPAREN general_terms RPAREN (( Application (atomic_word, general_terms) ))
|
sultana@48215
|
819 |
|
sultana@48215
|
820 |
formula_data : DTHF LPAREN thf_formula RPAREN (( Formula_Data (THF, thf_formula) ))
|
sultana@48215
|
821 |
| DTFF LPAREN tff_formula RPAREN (( Formula_Data (TFF, tff_formula) ))
|
sultana@48215
|
822 |
| DFOF LPAREN fof_formula RPAREN (( Formula_Data (FOF, fof_formula) ))
|
sultana@48215
|
823 |
| DCNF LPAREN cnf_formula RPAREN (( Formula_Data (CNF, cnf_formula) ))
|
sultana@48215
|
824 |
| DFOT LPAREN term RPAREN (( Term_Data term ))
|
sultana@48215
|
825 |
|
sultana@48215
|
826 |
general_list : LBRKT general_terms RBRKT (( general_terms ))
|
sultana@48215
|
827 |
| LBRKT RBRKT (( [] ))
|
sultana@48215
|
828 |
|
sultana@48215
|
829 |
general_terms : general_term COMMA general_terms (( general_term :: general_terms ))
|
sultana@48215
|
830 |
| general_term (( [general_term] ))
|
sultana@48215
|
831 |
|
sultana@48215
|
832 |
|
sultana@48215
|
833 |
(* General purpose *)
|
sultana@48215
|
834 |
|
sultana@47715
|
835 |
name : atomic_word (( atomic_word ))
|
sultana@47715
|
836 |
| integer (( integer ))
|
sultana@47715
|
837 |
|
sultana@48215
|
838 |
atomic_word : LOWER_WORD (( LOWER_WORD ))
|
sultana@48215
|
839 |
| SINGLE_QUOTED (( SINGLE_QUOTED ))
|
sultana@48215
|
840 |
| THF (( "thf" ))
|
sultana@48215
|
841 |
| TFF (( "tff" ))
|
sultana@48215
|
842 |
| FOF (( "fof" ))
|
sultana@48215
|
843 |
| CNF (( "cnf" ))
|
sultana@48215
|
844 |
| INCLUDE (( "include" ))
|
sultana@47715
|
845 |
|
sultana@48216
|
846 |
atomic_defined_word : DOLLAR_WORD (( DOLLAR_WORD ))
|
sultana@48216
|
847 |
|
sultana@48216
|
848 |
atomic_system_word : DOLLAR_DOLLAR_WORD (( DOLLAR_DOLLAR_WORD ))
|
sultana@47715
|
849 |
|
sultana@48215
|
850 |
integer: UNSIGNED_INTEGER (( UNSIGNED_INTEGER ))
|
sultana@48215
|
851 |
| SIGNED_INTEGER (( SIGNED_INTEGER ))
|
sultana@48215
|
852 |
|
sultana@48215
|
853 |
number : integer (( (Int_num, integer) ))
|
sultana@48215
|
854 |
| REAL (( (Real_num, REAL) ))
|
sultana@48215
|
855 |
| RATIONAL (( (Rat_num, RATIONAL) ))
|
sultana@48215
|
856 |
|
sultana@48215
|
857 |
file_name : SINGLE_QUOTED (( SINGLE_QUOTED ))
|