123 (* Main function to start Metis proof and reconstruction *) |
123 (* Main function to start Metis proof and reconstruction *) |
124 fun FOL_SOLVE (type_enc :: fallback_type_encs) lam_trans ctxt cls ths0 = |
124 fun FOL_SOLVE (type_enc :: fallback_type_encs) lam_trans ctxt cls ths0 = |
125 let val thy = Proof_Context.theory_of ctxt |
125 let val thy = Proof_Context.theory_of ctxt |
126 val new_skolemizer = |
126 val new_skolemizer = |
127 Config.get ctxt new_skolemizer orelse null (Meson.choice_theorems thy) |
127 Config.get ctxt new_skolemizer orelse null (Meson.choice_theorems thy) |
128 val do_lams = lam_trans = lam_liftingN ? introduce_lam_wrappers ctxt |
128 val do_lams = |
|
129 (lam_trans = liftingN orelse lam_trans = lam_liftingN) |
|
130 ? introduce_lam_wrappers ctxt |
129 val th_cls_pairs = |
131 val th_cls_pairs = |
130 map2 (fn j => fn th => |
132 map2 (fn j => fn th => |
131 (Thm.get_name_hint th, |
133 (Thm.get_name_hint th, |
132 th |> Drule.eta_contraction_rule |
134 th |> Drule.eta_contraction_rule |
133 |> Meson_Clausify.cnf_axiom ctxt new_skolemizer |
135 |> Meson_Clausify.cnf_axiom ctxt new_skolemizer |
134 (lam_trans = combinatorsN) j |
136 (lam_trans = combsN) j |
135 ||> map do_lams)) |
137 ||> map do_lams)) |
136 (0 upto length ths0 - 1) ths0 |
138 (0 upto length ths0 - 1) ths0 |
137 val ths = maps (snd o snd) th_cls_pairs |
139 val ths = maps (snd o snd) th_cls_pairs |
138 val dischargers = map (fst o snd) th_cls_pairs |
140 val dischargers = map (fst o snd) th_cls_pairs |
139 val cls = cls |> map (Drule.eta_contraction_rule #> do_lams) |
141 val cls = cls |> map (Drule.eta_contraction_rule #> do_lams) |
245 if exists_type type_has_top_sort (prop_of st0) then |
247 if exists_type type_has_top_sort (prop_of st0) then |
246 verbose_warning ctxt "Proof state contains the universal sort {}" |
248 verbose_warning ctxt "Proof state contains the universal sort {}" |
247 else |
249 else |
248 (); |
250 (); |
249 Meson.MESON (preskolem_tac ctxt) |
251 Meson.MESON (preskolem_tac ctxt) |
250 (maps (neg_clausify ctxt (lam_trans = combinatorsN))) tac ctxt i st0 |
252 (maps (neg_clausify ctxt (lam_trans = combsN))) tac ctxt i st0 |
251 end |
253 end |
252 |
254 |
253 fun metis_tac [] = generic_metis_tac partial_type_encs |
255 fun metis_tac [] = generic_metis_tac partial_type_encs |
254 | metis_tac type_encs = generic_metis_tac type_encs |
256 | metis_tac type_encs = generic_metis_tac type_encs |
255 |
257 |
275 HEADGOAL (Method.insert_tac nonschem_facts THEN' |
277 HEADGOAL (Method.insert_tac nonschem_facts THEN' |
276 CHANGED_PROP o generic_metis_tac type_encs lam_trans ctxt |
278 CHANGED_PROP o generic_metis_tac type_encs lam_trans ctxt |
277 (schem_facts @ ths)) |
279 (schem_facts @ ths)) |
278 end |
280 end |
279 |
281 |
280 val metis_lam_transs = [hide_lamsN, lam_liftingN, combinatorsN] |
282 val metis_lam_transs = [hide_lamsN, liftingN, combsN] |
281 |
283 |
282 fun set_opt _ x NONE = SOME x |
284 fun set_opt _ x NONE = SOME x |
283 | set_opt get x (SOME x0) = |
285 | set_opt get x (SOME x0) = |
284 error ("Cannot specify both " ^ quote (get x0) ^ " and " ^ quote (get x) ^ |
286 error ("Cannot specify both " ^ quote (get x0) ^ " and " ^ quote (get x) ^ |
285 ".") |
287 ".") |