133 Isa_Reflexive_or_Trivial | |
133 Isa_Reflexive_or_Trivial | |
134 Isa_Lambda_Lifted | |
134 Isa_Lambda_Lifted | |
135 Isa_Raw of thm |
135 Isa_Raw of thm |
136 |
136 |
137 val proxy_defs = map (fst o snd o snd) proxy_table |
137 val proxy_defs = map (fst o snd o snd) proxy_table |
138 val prepare_helper = |
138 fun prepare_helper ctxt = |
139 Meson.make_meta_clause #> rewrite_rule (map safe_mk_meta_eq proxy_defs) |
139 Meson.make_meta_clause #> rewrite_rule ctxt (map safe_mk_meta_eq proxy_defs) |
140 |
140 |
141 fun metis_term_of_atp type_enc (ATerm ((s, []), tms)) = |
141 fun metis_term_of_atp type_enc (ATerm ((s, []), tms)) = |
142 if is_tptp_variable s then |
142 if is_tptp_variable s then |
143 Metis_Term.Var (Metis_Name.fromString s) |
143 Metis_Term.Var (Metis_Name.fromString s) |
144 else |
144 else |
158 (false, metis_atom_of_atp type_enc phi) |
158 (false, metis_atom_of_atp type_enc phi) |
159 | metis_literal_of_atp type_enc phi = (true, metis_atom_of_atp type_enc phi) |
159 | metis_literal_of_atp type_enc phi = (true, metis_atom_of_atp type_enc phi) |
160 fun metis_literals_of_atp type_enc (AConn (AOr, phis)) = |
160 fun metis_literals_of_atp type_enc (AConn (AOr, phis)) = |
161 maps (metis_literals_of_atp type_enc) phis |
161 maps (metis_literals_of_atp type_enc) phis |
162 | metis_literals_of_atp type_enc phi = [metis_literal_of_atp type_enc phi] |
162 | metis_literals_of_atp type_enc phi = [metis_literal_of_atp type_enc phi] |
163 fun metis_axiom_of_atp type_enc clauses (Formula ((ident, _), _, phi, _, _)) = |
163 fun metis_axiom_of_atp ctxt type_enc clauses (Formula ((ident, _), _, phi, _, _)) = |
164 let |
164 let |
165 fun some isa = |
165 fun some isa = |
166 SOME (phi |> metis_literals_of_atp type_enc |
166 SOME (phi |> metis_literals_of_atp type_enc |
167 |> Metis_LiteralSet.fromList |
167 |> Metis_LiteralSet.fromList |
168 |> Metis_Thm.axiom, isa) |
168 |> Metis_Thm.axiom, isa) |
176 space_explode "_" ident) of |
176 space_explode "_" ident) of |
177 (needs_fairly_sound, _ :: const :: j :: _) => |
177 (needs_fairly_sound, _ :: const :: j :: _) => |
178 nth (AList.lookup (op =) helper_table (const, needs_fairly_sound) |
178 nth (AList.lookup (op =) helper_table (const, needs_fairly_sound) |
179 |> the) |
179 |> the) |
180 (the (Int.fromString j) - 1) |
180 (the (Int.fromString j) - 1) |
181 |> snd |> prepare_helper |
181 |> snd |> prepare_helper ctxt |
182 |> Isa_Raw |> some |
182 |> Isa_Raw |> some |
183 | _ => raise Fail ("malformed helper identifier " ^ quote ident) |
183 | _ => raise Fail ("malformed helper identifier " ^ quote ident) |
184 else case try (unprefix fact_prefix) ident of |
184 else case try (unprefix fact_prefix) ident of |
185 SOME s => |
185 SOME s => |
186 let val s = s |> space_explode "_" |> tl |> space_implode "_" |
186 let val s = s |> space_explode "_" |> tl |> space_implode "_" |
194 else |
194 else |
195 raise Fail ("malformed fact identifier " ^ quote ident) |
195 raise Fail ("malformed fact identifier " ^ quote ident) |
196 end |
196 end |
197 | NONE => TrueI |> Isa_Raw |> some |
197 | NONE => TrueI |> Isa_Raw |> some |
198 end |
198 end |
199 | metis_axiom_of_atp _ _ _ = raise Fail "not CNF -- expected formula" |
199 | metis_axiom_of_atp _ _ _ _ = raise Fail "not CNF -- expected formula" |
200 |
200 |
201 fun eliminate_lam_wrappers (Const (@{const_name Metis.lambda}, _) $ t) = |
201 fun eliminate_lam_wrappers (Const (@{const_name Metis.lambda}, _) $ t) = |
202 eliminate_lam_wrappers t |
202 eliminate_lam_wrappers t |
203 | eliminate_lam_wrappers (t $ u) = |
203 | eliminate_lam_wrappers (t $ u) = |
204 eliminate_lam_wrappers t $ eliminate_lam_wrappers u |
204 eliminate_lam_wrappers t $ eliminate_lam_wrappers u |
247 cat_lines (lines_of_atp_problem CNF atp_problem)) |
247 cat_lines (lines_of_atp_problem CNF atp_problem)) |
248 *) |
248 *) |
249 (* "rev" is for compatibility with existing proof scripts. *) |
249 (* "rev" is for compatibility with existing proof scripts. *) |
250 val axioms = |
250 val axioms = |
251 atp_problem |
251 atp_problem |
252 |> maps (map_filter (metis_axiom_of_atp type_enc clauses) o snd) |> rev |
252 |> maps (map_filter (metis_axiom_of_atp ctxt type_enc clauses) o snd) |> rev |
253 fun ord_info () = atp_problem_term_order_info atp_problem |
253 fun ord_info () = atp_problem_term_order_info atp_problem |
254 in (sym_tab, axioms, ord_info, (lifted, old_skolems)) end |
254 in (sym_tab, axioms, ord_info, (lifted, old_skolems)) end |
255 |
255 |
256 end; |
256 end; |