20 val presimplify: Proof.context -> thm -> thm |
20 val presimplify: Proof.context -> thm -> thm |
21 val make_nnf: Proof.context -> thm -> thm |
21 val make_nnf: Proof.context -> thm -> thm |
22 val choice_theorems : theory -> thm list |
22 val choice_theorems : theory -> thm list |
23 val skolemize_with_choice_theorems : Proof.context -> thm list -> thm -> thm |
23 val skolemize_with_choice_theorems : Proof.context -> thm list -> thm -> thm |
24 val skolemize : Proof.context -> thm -> thm |
24 val skolemize : Proof.context -> thm -> thm |
25 val cong_extensionalize_thm : theory -> thm -> thm |
25 val cong_extensionalize_thm : Proof.context -> thm -> thm |
26 val abs_extensionalize_conv : Proof.context -> conv |
26 val abs_extensionalize_conv : Proof.context -> conv |
27 val abs_extensionalize_thm : Proof.context -> thm -> thm |
27 val abs_extensionalize_thm : Proof.context -> thm -> thm |
28 val make_clauses_unsorted: Proof.context -> thm list -> thm list |
28 val make_clauses_unsorted: Proof.context -> thm list -> thm list |
29 val make_clauses: Proof.context -> thm list -> thm list |
29 val make_clauses: Proof.context -> thm list -> thm list |
30 val make_horns: thm list -> thm list |
30 val make_horns: thm list -> thm list |
172 workaround is to instantiate "?P := (%c. ... c ... c ... c ...)" manually. *) |
172 workaround is to instantiate "?P := (%c. ... c ... c ... c ...)" manually. *) |
173 fun quant_resolve_tac ctxt th i st = |
173 fun quant_resolve_tac ctxt th i st = |
174 case (Thm.concl_of st, Thm.prop_of th) of |
174 case (Thm.concl_of st, Thm.prop_of th) of |
175 (@{const Trueprop} $ (Var _ $ (c as Free _)), @{const Trueprop} $ _) => |
175 (@{const Trueprop} $ (Var _ $ (c as Free _)), @{const Trueprop} $ _) => |
176 let |
176 let |
177 val cc = Thm.global_cterm_of (Thm.theory_of_thm th) c |
177 val cc = Thm.cterm_of ctxt c |
178 val ct = Thm.dest_arg (Thm.cprop_of th) |
178 val ct = Thm.dest_arg (Thm.cprop_of th) |
179 in resolve_tac ctxt [th] i (Drule.instantiate' [] [SOME (Thm.lambda cc ct)] st) end |
179 in resolve_tac ctxt [th] i (Drule.instantiate' [] [SOME (Thm.lambda cc ct)] st) end |
180 | _ => resolve_tac ctxt [th] i st |
180 | _ => resolve_tac ctxt [th] i st |
181 |
181 |
182 (*Permits forward proof from rules that discharge assumptions. The supplied proof state st, |
182 (*Permits forward proof from rules that discharge assumptions. The supplied proof state st, |
620 Term.add_vars (Thm.prop_of @{thm ext_cong_neq}) [] |
620 Term.add_vars (Thm.prop_of @{thm ext_cong_neq}) [] |
621 |> filter (fn ((s, _), _) => s = "F") |
621 |> filter (fn ((s, _), _) => s = "F") |
622 |> the_single |> Var |
622 |> the_single |> Var |
623 |
623 |
624 (* Strengthens "f g ~= f h" to "f g ~= f h & (EX x. g x ~= h x)". *) |
624 (* Strengthens "f g ~= f h" to "f g ~= f h & (EX x. g x ~= h x)". *) |
625 fun cong_extensionalize_thm thy th = |
625 fun cong_extensionalize_thm ctxt th = |
626 (case Thm.concl_of th of |
626 (case Thm.concl_of th of |
627 @{const Trueprop} $ (@{const Not} |
627 @{const Trueprop} $ (@{const Not} |
628 $ (Const (@{const_name HOL.eq}, Type (_, [T, _])) |
628 $ (Const (@{const_name HOL.eq}, Type (_, [T, _])) |
629 $ (t as _ $ _) $ (u as _ $ _))) => |
629 $ (t as _ $ _) $ (u as _ $ _))) => |
630 (case get_F_pattern T t u of |
630 (case get_F_pattern T t u of |
631 SOME p => |
631 SOME p => |
632 let val inst = [apply2 (Thm.global_cterm_of thy) (F_ext_cong_neq, p)] in |
632 let val inst = [apply2 (Thm.cterm_of ctxt) (F_ext_cong_neq, p)] in |
633 th RS cterm_instantiate inst ext_cong_neq |
633 th RS cterm_instantiate inst ext_cong_neq |
634 end |
634 end |
635 | NONE => th) |
635 | NONE => th) |
636 | _ => th) |
636 | _ => th) |
637 |
637 |
649 |
649 |
650 val abs_extensionalize_thm = Conv.fconv_rule o abs_extensionalize_conv |
650 val abs_extensionalize_thm = Conv.fconv_rule o abs_extensionalize_conv |
651 |
651 |
652 fun try_skolemize_etc ctxt th = |
652 fun try_skolemize_etc ctxt th = |
653 let |
653 let |
654 val thy = Proof_Context.theory_of ctxt |
654 val th = th |> cong_extensionalize_thm ctxt |
655 val th = th |> cong_extensionalize_thm thy |
|
656 in |
655 in |
657 [th] |
656 [th] |
658 (* Extensionalize lambdas in "th", because that makes sense and that's what |
657 (* Extensionalize lambdas in "th", because that makes sense and that's what |
659 Sledgehammer does, but also keep an unextensionalized version of "th" for |
658 Sledgehammer does, but also keep an unextensionalized version of "th" for |
660 backward compatibility. *) |
659 backward compatibility. *) |