614 fun skolemize ctxt = |
614 fun skolemize ctxt = |
615 let val thy = Proof_Context.theory_of ctxt in |
615 let val thy = Proof_Context.theory_of ctxt in |
616 skolemize_with_choice_theorems ctxt (choice_theorems thy) |
616 skolemize_with_choice_theorems ctxt (choice_theorems thy) |
617 end |
617 end |
618 |
618 |
619 fun is_Abs (Abs _) = true |
619 (* Removes the lambdas from an equation of the form "t = (%x1 ... xn. u)". It |
620 | is_Abs _ = false |
620 would be desirable to do this symmetrically but there's at least one existing |
621 |
621 proof in "Tarski" that relies on the current behavior. *) |
622 (* Removes the lambdas from an equation of the form "t = (%x. u)". *) |
|
623 fun extensionalize_conv ctxt ct = |
622 fun extensionalize_conv ctxt ct = |
624 case term_of ct of |
623 case term_of ct of |
625 Const (@{const_name HOL.eq}, _) $ t1 $ t2 => |
624 Const (@{const_name HOL.eq}, _) $ _ $ Abs _ => |
626 ct |> (if is_Abs t1 orelse is_Abs t2 then |
625 ct |> (Conv.rewr_conv @{thm fun_eq_iff [THEN eq_reflection]} |
627 Conv.rewr_conv @{thm fun_eq_iff [THEN eq_reflection]} |
626 then_conv extensionalize_conv ctxt) |
628 then_conv extensionalize_conv ctxt |
|
629 else |
|
630 Conv.comb_conv (extensionalize_conv ctxt)) |
|
631 | _ $ _ => Conv.comb_conv (extensionalize_conv ctxt) ct |
627 | _ $ _ => Conv.comb_conv (extensionalize_conv ctxt) ct |
632 | Abs _ => Conv.abs_conv (extensionalize_conv o snd) ctxt ct |
628 | Abs _ => Conv.abs_conv (extensionalize_conv o snd) ctxt ct |
633 | _ => Conv.all_conv ct |
629 | _ => Conv.all_conv ct |
634 |
630 |
635 val extensionalize_theorem = Conv.fconv_rule o extensionalize_conv |
631 val extensionalize_theorem = Conv.fconv_rule o extensionalize_conv |