src/HOL/Hilbert_Choice.thy
 changeset 14760 a08e916f4946 parent 14399 dc677b35e54f child 14872 3f2144aebd76
1.1 --- a/src/HOL/Hilbert_Choice.thy	Wed May 19 11:24:54 2004 +0200
1.2 +++ b/src/HOL/Hilbert_Choice.thy	Wed May 19 11:29:47 2004 +0200
1.3 @@ -1,13 +1,13 @@
1.4  (*  Title:      HOL/Hilbert_Choice.thy
1.5 -    ID:         \$Id\$
1.6 +    ID: \$Id\$
1.7      Author:     Lawrence C Paulson
1.8      Copyright   2001  University of Cambridge
1.9  *)
1.11 -header {* Hilbert's epsilon-operator and everything to do with the Axiom of Choice *}
1.12 +header {* Hilbert's Epsilon-Operator and the Axiom of Choice *}
1.14  theory Hilbert_Choice = NatArith
1.15 -files ("Hilbert_Choice_lemmas.ML") ("meson_lemmas.ML") ("Tools/meson.ML") ("Tools/specification_package.ML"):
1.16 +files ("Tools/meson.ML") ("Tools/specification_package.ML"):
1.19  subsection {* Hilbert's epsilon *}
1.20 @@ -40,26 +40,217 @@
1.21    "inv(f :: 'a => 'b) == %y. SOME x. f x = y"
1.23    Inv :: "'a set => ('a => 'b) => ('b => 'a)"
1.24 -  "Inv A f == %x. SOME y. y : A & f y = x"
1.25 +  "Inv A f == %x. SOME y. y \<in> A & f y = x"
1.26 +
1.27 +
1.28 +subsection {*Hilbert's Epsilon-operator*}
1.29 +
1.30 +text{*Easier to apply than @{text someI} if the witness comes from an
1.31 +existential formula*}
1.32 +lemma someI_ex [elim?]: "\<exists>x. P x ==> P (SOME x. P x)"
1.33 +apply (erule exE)
1.34 +apply (erule someI)
1.35 +done
1.36 +
1.37 +text{*Easier to apply than @{text someI} because the conclusion has only one
1.38 +occurrence of @{term P}.*}
1.39 +lemma someI2: "[| P a;  !!x. P x ==> Q x |] ==> Q (SOME x. P x)"
1.40 +by (blast intro: someI)
1.41 +
1.42 +text{*Easier to apply than @{text someI2} if the witness comes from an
1.43 +existential formula*}
1.44 +lemma someI2_ex: "[| \<exists>a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)"
1.45 +by (blast intro: someI2)
1.46 +
1.47 +lemma some_equality [intro]:
1.48 +     "[| P a;  !!x. P x ==> x=a |] ==> (SOME x. P x) = a"
1.49 +by (blast intro: someI2)
1.50 +
1.51 +lemma some1_equality: "[| EX!x. P x; P a |] ==> (SOME x. P x) = a"
1.52 +by (blast intro: some_equality)
1.53 +
1.54 +lemma some_eq_ex: "P (SOME x. P x) =  (\<exists>x. P x)"
1.55 +by (blast intro: someI)
1.56 +
1.57 +lemma some_eq_trivial [simp]: "(SOME y. y=x) = x"
1.58 +apply (rule some_equality)
1.59 +apply (rule refl, assumption)
1.60 +done
1.61 +
1.62 +lemma some_sym_eq_trivial [simp]: "(SOME y. x=y) = x"
1.63 +apply (rule some_equality)
1.64 +apply (rule refl)
1.65 +apply (erule sym)
1.66 +done
1.67 +
1.68 +
1.69 +subsection{*Axiom of Choice, Proved Using the Description Operator*}
1.70 +
1.71 +text{*Used in @{text "Tools/meson.ML"}*}
1.72 +lemma choice: "\<forall>x. \<exists>y. Q x y ==> \<exists>f. \<forall>x. Q x (f x)"
1.73 +by (fast elim: someI)
1.74 +
1.75 +lemma bchoice: "\<forall>x\<in>S. \<exists>y. Q x y ==> \<exists>f. \<forall>x\<in>S. Q x (f x)"
1.76 +by (fast elim: someI)
1.77 +
1.78 +
1.79 +subsection {*Function Inverse*}
1.80 +
1.81 +lemma inv_id [simp]: "inv id = id"
1.82 +by (simp add: inv_def id_def)
1.83 +
1.84 +text{*A one-to-one function has an inverse.*}
1.85 +lemma inv_f_f [simp]: "inj f ==> inv f (f x) = x"
1.86 +by (simp add: inv_def inj_eq)
1.87 +
1.88 +lemma inv_f_eq: "[| inj f;  f x = y |] ==> inv f y = x"
1.89 +apply (erule subst)
1.90 +apply (erule inv_f_f)
1.91 +done
1.92 +
1.93 +lemma inj_imp_inv_eq: "[| inj f; \<forall>x. f(g x) = x |] ==> inv f = g"
1.94 +by (blast intro: ext inv_f_eq)
1.95 +
1.96 +text{*But is it useful?*}
1.97 +lemma inj_transfer:
1.98 +  assumes injf: "inj f" and minor: "!!y. y \<in> range(f) ==> P(inv f y)"
1.99 +  shows "P x"
1.100 +proof -
1.101 +  have "f x \<in> range f" by auto
1.102 +  hence "P(inv f (f x))" by (rule minor)
1.103 +  thus "P x" by (simp add: inv_f_f [OF injf])
1.104 +qed
1.107 -use "Hilbert_Choice_lemmas.ML"
1.108 -declare someI_ex [elim?];
1.109 +lemma inj_iff: "(inj f) = (inv f o f = id)"
1.110 +apply (simp add: o_def expand_fun_eq)
1.111 +apply (blast intro: inj_on_inverseI inv_f_f)
1.112 +done
1.114 +lemma inj_imp_surj_inv: "inj f ==> surj (inv f)"
1.115 +by (blast intro: surjI inv_f_f)
1.117 +lemma f_inv_f: "y \<in> range(f) ==> f(inv f y) = y"
1.119 +apply (fast intro: someI)
1.120 +done
1.122 +lemma surj_f_inv_f: "surj f ==> f(inv f y) = y"
1.123 +by (simp add: f_inv_f surj_range)
1.125 +lemma inv_injective:
1.126 +  assumes eq: "inv f x = inv f y"
1.127 +      and x: "x: range f"
1.128 +      and y: "y: range f"
1.129 +  shows "x=y"
1.130 +proof -
1.131 +  have "f (inv f x) = f (inv f y)" using eq by simp
1.132 +  thus ?thesis by (simp add: f_inv_f x y)
1.133 +qed
1.135 +lemma inj_on_inv: "A <= range(f) ==> inj_on (inv f) A"
1.136 +by (fast intro: inj_onI elim: inv_injective injD)
1.138 +lemma surj_imp_inj_inv: "surj f ==> inj (inv f)"
1.139 +by (simp add: inj_on_inv surj_range)
1.141 +lemma surj_iff: "(surj f) = (f o inv f = id)"
1.142 +apply (simp add: o_def expand_fun_eq)
1.143 +apply (blast intro: surjI surj_f_inv_f)
1.144 +done
1.146 +lemma surj_imp_inv_eq: "[| surj f; \<forall>x. g(f x) = x |] ==> inv f = g"
1.147 +apply (rule ext)
1.148 +apply (drule_tac x = "inv f x" in spec)
1.150 +done
1.152 +lemma bij_imp_bij_inv: "bij f ==> bij (inv f)"
1.153 +by (simp add: bij_def inj_imp_surj_inv surj_imp_inj_inv)
1.155 -lemma Inv_mem: "[| f ` A = B;  x \<in> B |] ==> Inv A f x \<in> A"
1.156 -apply (unfold Inv_def)
1.157 +lemma inv_equality: "[| !!x. g (f x) = x;  !!y. f (g y) = y |] ==> inv f = g"
1.158 +apply (rule ext)
1.159 +apply (auto simp add: inv_def)
1.160 +done
1.162 +lemma inv_inv_eq: "bij f ==> inv (inv f) = f"
1.163 +apply (rule inv_equality)
1.164 +apply (auto simp add: bij_def surj_f_inv_f)
1.165 +done
1.167 +(** bij(inv f) implies little about f.  Consider f::bool=>bool such that
1.168 +    f(True)=f(False)=True.  Then it's consistent with axiom someI that
1.169 +    inv f could be any function at all, including the identity function.
1.170 +    If inv f=id then inv f is a bijection, but inj f, surj(f) and
1.171 +    inv(inv f)=f all fail.
1.172 +**)
1.174 +lemma o_inv_distrib: "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f"
1.175 +apply (rule inv_equality)
1.176 +apply (auto simp add: bij_def surj_f_inv_f)
1.177 +done
1.180 +lemma image_surj_f_inv_f: "surj f ==> f ` (inv f ` A) = A"
1.181 +by (simp add: image_eq_UN surj_f_inv_f)
1.183 +lemma image_inv_f_f: "inj f ==> (inv f) ` (f ` A) = A"
1.186 +lemma inv_image_comp: "inj f ==> inv f ` (f`X) = X"
1.187 +by (auto simp add: image_def)
1.189 +lemma bij_image_Collect_eq: "bij f ==> f ` Collect P = {y. P (inv f y)}"
1.190 +apply auto
1.191 +apply (force simp add: bij_is_inj)
1.192 +apply (blast intro: bij_is_surj [THEN surj_f_inv_f, symmetric])
1.193 +done
1.195 +lemma bij_vimage_eq_inv_image: "bij f ==> f -` A = inv f ` A"
1.196 +apply (auto simp add: bij_is_surj [THEN surj_f_inv_f])
1.197 +apply (blast intro: bij_is_inj [THEN inv_f_f, symmetric])
1.198 +done
1.201 +subsection {*Inverse of a PI-function (restricted domain)*}
1.203 +lemma Inv_f_f: "[| inj_on f A;  x \<in> A |] ==> Inv A f (f x) = x"
1.204 +apply (simp add: Inv_def inj_on_def)
1.205 +apply (blast intro: someI2)
1.206 +done
1.208 +lemma f_Inv_f: "y \<in> f`A  ==> f (Inv A f y) = y"
1.210  apply (fast intro: someI2)
1.211  done
1.213 -lemma Inv_f_eq:
1.214 -  "[| inj_on f A; f x = y; x : A |] ==> Inv A f y = x"
1.215 +lemma Inv_injective:
1.216 +  assumes eq: "Inv A f x = Inv A f y"
1.217 +      and x: "x: f`A"
1.218 +      and y: "y: f`A"
1.219 +  shows "x=y"
1.220 +proof -
1.221 +  have "f (Inv A f x) = f (Inv A f y)" using eq by simp
1.222 +  thus ?thesis by (simp add: f_Inv_f x y)
1.223 +qed
1.225 +lemma inj_on_Inv: "B <= f`A ==> inj_on (Inv A f) B"
1.226 +apply (rule inj_onI)
1.227 +apply (blast intro: inj_onI dest: Inv_injective injD)
1.228 +done
1.230 +lemma Inv_mem: "[| f ` A = B;  x \<in> B |] ==> Inv A f x \<in> A"
1.232 +apply (fast intro: someI2)
1.233 +done
1.235 +lemma Inv_f_eq: "[| inj_on f A; f x = y; x \<in> A |] ==> Inv A f y = x"
1.236    apply (erule subst)
1.237 -  apply (erule Inv_f_f)
1.238 -  apply assumption
1.239 +  apply (erule Inv_f_f, assumption)
1.240    done
1.242  lemma Inv_comp:
1.243 -  "[| inj_on f (g ` A); inj_on g A; x : f ` g ` A |] ==>
1.244 +  "[| inj_on f (g ` A); inj_on g A; x \<in> f ` g ` A |] ==>
1.245    Inv A (f o g) x = (Inv A g o Inv (g ` A) f) x"
1.246    apply simp
1.247    apply (rule Inv_f_eq)
1.248 @@ -68,8 +259,42 @@
1.250    done
1.253 +subsection {*Other Consequences of Hilbert's Epsilon*}
1.255 +text {*Hilbert's Epsilon and the @{term split} Operator*}
1.257 +text{*Looping simprule*}
1.258 +lemma split_paired_Eps: "(SOME x. P x) = (SOME (a,b). P(a,b))"
1.261 +lemma Eps_split: "Eps (split P) = (SOME xy. P (fst xy) (snd xy))"
1.264 +lemma Eps_split_eq [simp]: "(@(x',y'). x = x' & y = y') = (x,y)"
1.265 +by blast
1.268 +text{*A relation is wellfounded iff it has no infinite descending chain*}
1.269 +lemma wf_iff_no_infinite_down_chain:
1.270 +  "wf r = (~(\<exists>f. \<forall>i. (f(Suc i),f i) \<in> r))"
1.271 +apply (simp only: wf_eq_minimal)
1.272 +apply (rule iffI)
1.273 + apply (rule notI)
1.274 + apply (erule exE)
1.275 + apply (erule_tac x = "{w. \<exists>i. w=f i}" in allE, blast)
1.276 +apply (erule contrapos_np, simp, clarify)
1.277 +apply (subgoal_tac "\<forall>n. nat_rec x (%i y. @z. z:Q & (z,y) :r) n \<in> Q")
1.278 + apply (rule_tac x = "nat_rec x (%i y. @z. z:Q & (z,y) :r)" in exI)
1.279 + apply (rule allI, simp)
1.280 + apply (rule someI2_ex, blast, blast)
1.281 +apply (rule allI)
1.282 +apply (induct_tac "n", simp_all)
1.283 +apply (rule someI2_ex, blast+)
1.284 +done
1.286 +text{*A dynamically-scoped fact for TFL *}
1.287  lemma tfl_some: "\<forall>P x. P x --> P (Eps P)"
1.288 -  -- {* dynamically-scoped fact for TFL *}
1.289    by (blast intro: someI)
1.292 @@ -77,7 +302,7 @@
1.294  constdefs
1.295    LeastM :: "['a => 'b::ord, 'a => bool] => 'a"
1.296 -  "LeastM m P == SOME x. P x & (ALL y. P y --> m x <= m y)"
1.297 +  "LeastM m P == SOME x. P x & (\<forall>y. P y --> m x <= m y)"
1.299  syntax
1.300    "_LeastM" :: "[pttrn, 'a => 'b::ord, bool] => 'a"    ("LEAST _ WRT _. _" [0, 4, 10] 10)
1.301 @@ -88,7 +313,7 @@
1.302    "P x ==> (!!y. P y ==> m x <= m y)
1.303      ==> (!!x. P x ==> \<forall>y. P y --> m x \<le> m y ==> Q x)
1.304      ==> Q (LeastM m P)"
1.305 -  apply (unfold LeastM_def)
1.306 +  apply (simp add: LeastM_def)
1.307    apply (rule someI2_ex, blast, blast)
1.308    done
1.310 @@ -100,22 +325,22 @@
1.311    done
1.313  lemma wf_linord_ex_has_least:
1.314 -  "wf r ==> ALL x y. ((x,y):r^+) = ((y,x)~:r^*) ==> P k
1.315 -    ==> EX x. P x & (!y. P y --> (m x,m y):r^*)"
1.316 +  "wf r ==> \<forall>x y. ((x,y):r^+) = ((y,x)~:r^*) ==> P k
1.317 +    ==> \<exists>x. P x & (!y. P y --> (m x,m y):r^*)"
1.318    apply (drule wf_trancl [THEN wf_eq_minimal [THEN iffD1]])
1.319    apply (drule_tac x = "m`Collect P" in spec, force)
1.320    done
1.322  lemma ex_has_least_nat:
1.323 -    "P k ==> EX x. P x & (ALL y. P y --> m x <= (m y::nat))"
1.324 +    "P k ==> \<exists>x. P x & (\<forall>y. P y --> m x <= (m y::nat))"
1.325    apply (simp only: pred_nat_trancl_eq_le [symmetric])
1.326    apply (rule wf_pred_nat [THEN wf_linord_ex_has_least])
1.327     apply (simp add: less_eq not_le_iff_less pred_nat_trancl_eq_le, assumption)
1.328    done
1.330  lemma LeastM_nat_lemma:
1.331 -    "P k ==> P (LeastM m P) & (ALL y. P y --> m (LeastM m P) <= (m y::nat))"
1.332 -  apply (unfold LeastM_def)
1.333 +    "P k ==> P (LeastM m P) & (\<forall>y. P y --> m (LeastM m P) <= (m y::nat))"
1.334 +  apply (simp add: LeastM_def)
1.335    apply (rule someI_ex)
1.336    apply (erule ex_has_least_nat)
1.337    done
1.338 @@ -130,7 +355,7 @@
1.340  constdefs
1.341    GreatestM :: "['a => 'b::ord, 'a => bool] => 'a"
1.342 -  "GreatestM m P == SOME x. P x & (ALL y. P y --> m y <= m x)"
1.343 +  "GreatestM m P == SOME x. P x & (\<forall>y. P y --> m y <= m x)"
1.345    Greatest :: "('a::ord => bool) => 'a"    (binder "GREATEST " 10)
1.346    "Greatest == GreatestM (%x. x)"
1.347 @@ -146,7 +371,7 @@
1.348    "P x ==> (!!y. P y ==> m y <= m x)
1.349      ==> (!!x. P x ==> \<forall>y. P y --> m y \<le> m x ==> Q x)
1.350      ==> Q (GreatestM m P)"
1.351 -  apply (unfold GreatestM_def)
1.352 +  apply (simp add: GreatestM_def)
1.353    apply (rule someI2_ex, blast, blast)
1.354    done
1.356 @@ -159,29 +384,29 @@
1.358  lemma Greatest_equality:
1.359    "P (k::'a::order) ==> (!!x. P x ==> x <= k) ==> (GREATEST x. P x) = k"
1.360 -  apply (unfold Greatest_def)
1.361 +  apply (simp add: Greatest_def)
1.362    apply (erule GreatestM_equality, blast)
1.363    done
1.365  lemma ex_has_greatest_nat_lemma:
1.366 -  "P k ==> ALL x. P x --> (EX y. P y & ~ ((m y::nat) <= m x))
1.367 -    ==> EX y. P y & ~ (m y < m k + n)"
1.368 +  "P k ==> \<forall>x. P x --> (\<exists>y. P y & ~ ((m y::nat) <= m x))
1.369 +    ==> \<exists>y. P y & ~ (m y < m k + n)"
1.370    apply (induct_tac n, force)
1.371    apply (force simp add: le_Suc_eq)
1.372    done
1.374  lemma ex_has_greatest_nat:
1.375 -  "P k ==> ALL y. P y --> m y < b
1.376 -    ==> EX x. P x & (ALL y. P y --> (m y::nat) <= m x)"
1.377 +  "P k ==> \<forall>y. P y --> m y < b
1.378 +    ==> \<exists>x. P x & (\<forall>y. P y --> (m y::nat) <= m x)"
1.379    apply (rule ccontr)
1.380    apply (cut_tac P = P and n = "b - m k" in ex_has_greatest_nat_lemma)
1.381      apply (subgoal_tac [3] "m k <= b", auto)
1.382    done
1.384  lemma GreatestM_nat_lemma:
1.385 -  "P k ==> ALL y. P y --> m y < b
1.386 -    ==> P (GreatestM m P) & (ALL y. P y --> (m y::nat) <= m (GreatestM m P))"
1.387 -  apply (unfold GreatestM_def)
1.388 +  "P k ==> \<forall>y. P y --> m y < b
1.389 +    ==> P (GreatestM m P) & (\<forall>y. P y --> (m y::nat) <= m (GreatestM m P))"
1.390 +  apply (simp add: GreatestM_def)
1.391    apply (rule someI_ex)
1.392    apply (erule ex_has_greatest_nat, assumption)
1.393    done
1.394 @@ -189,7 +414,7 @@
1.395  lemmas GreatestM_natI = GreatestM_nat_lemma [THEN conjunct1, standard]
1.397  lemma GreatestM_nat_le:
1.398 -  "P x ==> ALL y. P y --> m y < b
1.399 +  "P x ==> \<forall>y. P y --> m y < b
1.400      ==> (m x::nat) <= m (GreatestM m P)"
1.401    apply (blast dest: GreatestM_nat_lemma [THEN conjunct2, THEN spec])
1.402    done
1.403 @@ -197,14 +422,14 @@
1.405  text {* \medskip Specialization to @{text GREATEST}. *}
1.407 -lemma GreatestI: "P (k::nat) ==> ALL y. P y --> y < b ==> P (GREATEST x. P x)"
1.408 -  apply (unfold Greatest_def)
1.409 +lemma GreatestI: "P (k::nat) ==> \<forall>y. P y --> y < b ==> P (GREATEST x. P x)"
1.410 +  apply (simp add: Greatest_def)
1.411    apply (rule GreatestM_natI, auto)
1.412    done
1.414  lemma Greatest_le:
1.415 -    "P x ==> ALL y. P y --> y < b ==> (x::nat) <= (GREATEST x. P x)"
1.416 -  apply (unfold Greatest_def)
1.417 +    "P x ==> \<forall>y. P y --> y < b ==> (x::nat) <= (GREATEST x. P x)"
1.418 +  apply (simp add: Greatest_def)
1.419    apply (rule GreatestM_nat_le, auto)
1.420    done
1.422 @@ -218,8 +443,8 @@
1.423  lemma meson_not_conjD: "~(P&Q) ==> ~P | ~Q"
1.424    and meson_not_disjD: "~(P|Q) ==> ~P & ~Q"
1.425    and meson_not_notD: "~~P ==> P"
1.426 -  and meson_not_allD: "!!P. ~(ALL x. P(x)) ==> EX x. ~P(x)"
1.427 -  and meson_not_exD: "!!P. ~(EX x. P(x)) ==> ALL x. ~P(x)"
1.428 +  and meson_not_allD: "!!P. ~(\<forall>x. P(x)) ==> \<exists>x. ~P(x)"
1.429 +  and meson_not_exD: "!!P. ~(\<exists>x. P(x)) ==> \<forall>x. ~P(x)"
1.430    by fast+
1.432  text {* Removal of @{text "-->"} and @{text "<->"} (positive and
1.433 @@ -237,18 +462,18 @@
1.435  text {* Conjunction *}
1.437 -lemma meson_conj_exD1: "!!P Q. (EX x. P(x)) & Q ==> EX x. P(x) & Q"
1.438 -  and meson_conj_exD2: "!!P Q. P & (EX x. Q(x)) ==> EX x. P & Q(x)"
1.439 +lemma meson_conj_exD1: "!!P Q. (\<exists>x. P(x)) & Q ==> \<exists>x. P(x) & Q"
1.440 +  and meson_conj_exD2: "!!P Q. P & (\<exists>x. Q(x)) ==> \<exists>x. P & Q(x)"
1.441    by fast+
1.444  text {* Disjunction *}
1.446 -lemma meson_disj_exD: "!!P Q. (EX x. P(x)) | (EX x. Q(x)) ==> EX x. P(x) | Q(x)"
1.447 +lemma meson_disj_exD: "!!P Q. (\<exists>x. P(x)) | (\<exists>x. Q(x)) ==> \<exists>x. P(x) | Q(x)"
1.448    -- {* DO NOT USE with forall-Skolemization: makes fewer schematic variables!! *}
1.449    -- {* With ex-Skolemization, makes fewer Skolem constants *}
1.450 -  and meson_disj_exD1: "!!P Q. (EX x. P(x)) | Q ==> EX x. P(x) | Q"
1.451 -  and meson_disj_exD2: "!!P Q. P | (EX x. Q(x)) ==> EX x. P | Q(x)"
1.452 +  and meson_disj_exD1: "!!P Q. (\<exists>x. P(x)) | Q ==> \<exists>x. P(x) | Q"
1.453 +  and meson_disj_exD2: "!!P Q. P | (\<exists>x. Q(x)) ==> \<exists>x. P | Q(x)"
1.454    by fast+
1.457 @@ -262,7 +487,133 @@
1.458    and meson_disj_FalseD2: "P|False ==> P"
1.459    by fast+
1.461 -use "meson_lemmas.ML"
1.463 +subsection{*Lemmas for Meson, the Model Elimination Procedure*}
1.466 +text{* Generation of contrapositives *}
1.468 +text{*Inserts negated disjunct after removing the negation; P is a literal.
1.469 +  Model elimination requires assuming the negation of every attempted subgoal,
1.470 +  hence the negated disjuncts.*}
1.471 +lemma make_neg_rule: "~P|Q ==> ((~P==>P) ==> Q)"
1.472 +by blast
1.474 +text{*Version for Plaisted's "Postive refinement" of the Meson procedure*}
1.475 +lemma make_refined_neg_rule: "~P|Q ==> (P ==> Q)"
1.476 +by blast
1.478 +text{*@{term P} should be a literal*}
1.479 +lemma make_pos_rule: "P|Q ==> ((P==>~P) ==> Q)"
1.480 +by blast
1.482 +text{*Versions of @{text make_neg_rule} and @{text make_pos_rule} that don't
1.483 +insert new assumptions, for ordinary resolution.*}
1.485 +lemmas make_neg_rule' = make_refined_neg_rule
1.487 +lemma make_pos_rule': "[|P|Q; ~P|] ==> Q"
1.488 +by blast
1.490 +text{* Generation of a goal clause -- put away the final literal *}
1.492 +lemma make_neg_goal: "~P ==> ((~P==>P) ==> False)"
1.493 +by blast
1.495 +lemma make_pos_goal: "P ==> ((P==>~P) ==> False)"
1.496 +by blast
1.499 +subsubsection{* Lemmas for Forward Proof*}
1.501 +text{*There is a similarity to congruence rules*}
1.503 +(*NOTE: could handle conjunctions (faster?) by
1.504 +    nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
1.505 +lemma conj_forward: "[| P'&Q';  P' ==> P;  Q' ==> Q |] ==> P&Q"
1.506 +by blast
1.508 +lemma disj_forward: "[| P'|Q';  P' ==> P;  Q' ==> Q |] ==> P|Q"
1.509 +by blast
1.511 +(*Version of @{text disj_forward} for removal of duplicate literals*)
1.512 +lemma disj_forward2:
1.513 +    "[| P'|Q';  P' ==> P;  [| Q'; P==>False |] ==> Q |] ==> P|Q"
1.514 +apply blast
1.515 +done
1.517 +lemma all_forward: "[| \<forall>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<forall>x. P(x)"
1.518 +by blast
1.520 +lemma ex_forward: "[| \<exists>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<exists>x. P(x)"
1.521 +by blast
1.523 +ML
1.524 +{*
1.525 +val inv_def = thm "inv_def";
1.526 +val Inv_def = thm "Inv_def";
1.528 +val someI = thm "someI";
1.529 +val someI_ex = thm "someI_ex";
1.530 +val someI2 = thm "someI2";
1.531 +val someI2_ex = thm "someI2_ex";
1.532 +val some_equality = thm "some_equality";
1.533 +val some1_equality = thm "some1_equality";
1.534 +val some_eq_ex = thm "some_eq_ex";
1.535 +val some_eq_trivial = thm "some_eq_trivial";
1.536 +val some_sym_eq_trivial = thm "some_sym_eq_trivial";
1.537 +val choice = thm "choice";
1.538 +val bchoice = thm "bchoice";
1.539 +val inv_id = thm "inv_id";
1.540 +val inv_f_f = thm "inv_f_f";
1.541 +val inv_f_eq = thm "inv_f_eq";
1.542 +val inj_imp_inv_eq = thm "inj_imp_inv_eq";
1.543 +val inj_transfer = thm "inj_transfer";
1.544 +val inj_iff = thm "inj_iff";
1.545 +val inj_imp_surj_inv = thm "inj_imp_surj_inv";
1.546 +val f_inv_f = thm "f_inv_f";
1.547 +val surj_f_inv_f = thm "surj_f_inv_f";
1.548 +val inv_injective = thm "inv_injective";
1.549 +val inj_on_inv = thm "inj_on_inv";
1.550 +val surj_imp_inj_inv = thm "surj_imp_inj_inv";
1.551 +val surj_iff = thm "surj_iff";
1.552 +val surj_imp_inv_eq = thm "surj_imp_inv_eq";
1.553 +val bij_imp_bij_inv = thm "bij_imp_bij_inv";
1.554 +val inv_equality = thm "inv_equality";
1.555 +val inv_inv_eq = thm "inv_inv_eq";
1.556 +val o_inv_distrib = thm "o_inv_distrib";
1.557 +val image_surj_f_inv_f = thm "image_surj_f_inv_f";
1.558 +val image_inv_f_f = thm "image_inv_f_f";
1.559 +val inv_image_comp = thm "inv_image_comp";
1.560 +val bij_image_Collect_eq = thm "bij_image_Collect_eq";
1.561 +val bij_vimage_eq_inv_image = thm "bij_vimage_eq_inv_image";
1.562 +val Inv_f_f = thm "Inv_f_f";
1.563 +val f_Inv_f = thm "f_Inv_f";
1.564 +val Inv_injective = thm "Inv_injective";
1.565 +val inj_on_Inv = thm "inj_on_Inv";
1.566 +val split_paired_Eps = thm "split_paired_Eps";
1.567 +val Eps_split = thm "Eps_split";
1.568 +val Eps_split_eq = thm "Eps_split_eq";
1.569 +val wf_iff_no_infinite_down_chain = thm "wf_iff_no_infinite_down_chain";
1.570 +val Inv_mem = thm "Inv_mem";
1.571 +val Inv_f_eq = thm "Inv_f_eq";
1.572 +val Inv_comp = thm "Inv_comp";
1.573 +val tfl_some = thm "tfl_some";
1.574 +val make_neg_rule = thm "make_neg_rule";
1.575 +val make_refined_neg_rule = thm "make_refined_neg_rule";
1.576 +val make_pos_rule = thm "make_pos_rule";
1.577 +val make_neg_rule' = thm "make_neg_rule'";
1.578 +val make_pos_rule' = thm "make_pos_rule'";
1.579 +val make_neg_goal = thm "make_neg_goal";
1.580 +val make_pos_goal = thm "make_pos_goal";
1.581 +val conj_forward = thm "conj_forward";
1.582 +val disj_forward = thm "disj_forward";
1.583 +val disj_forward2 = thm "disj_forward2";
1.584 +val all_forward = thm "all_forward";
1.585 +val ex_forward = thm "ex_forward";
1.586 +*}
1.589  use "Tools/meson.ML"
1.590  setup meson_setup