src/HOL/Hilbert_Choice.thy
author nipkow
Wed Aug 18 11:09:40 2004 +0200 (2004-08-18)
changeset 15140 322485b816ac
parent 15131 c69542757a4d
child 15251 bb6f072c8d10
permissions -rw-r--r--
import -> imports
     1 (*  Title:      HOL/Hilbert_Choice.thy
     2     ID: $Id$
     3     Author:     Lawrence C Paulson
     4     Copyright   2001  University of Cambridge
     5 *)
     6 
     7 header {* Hilbert's Epsilon-Operator and the Axiom of Choice *}
     8 
     9 theory Hilbert_Choice
    10 imports NatArith
    11 files ("Tools/meson.ML") ("Tools/specification_package.ML")
    12 begin
    13 
    14 subsection {* Hilbert's epsilon *}
    15 
    16 consts
    17   Eps           :: "('a => bool) => 'a"
    18 
    19 syntax (epsilon)
    20   "_Eps"        :: "[pttrn, bool] => 'a"    ("(3\<some>_./ _)" [0, 10] 10)
    21 syntax (HOL)
    22   "_Eps"        :: "[pttrn, bool] => 'a"    ("(3@ _./ _)" [0, 10] 10)
    23 syntax
    24   "_Eps"        :: "[pttrn, bool] => 'a"    ("(3SOME _./ _)" [0, 10] 10)
    25 translations
    26   "SOME x. P" == "Eps (%x. P)"
    27 
    28 print_translation {*
    29 (* to avoid eta-contraction of body *)
    30 [("Eps", fn [Abs abs] =>
    31      let val (x,t) = atomic_abs_tr' abs
    32      in Syntax.const "_Eps" $ x $ t end)]
    33 *}
    34 
    35 axioms
    36   someI: "P (x::'a) ==> P (SOME x. P x)"
    37 
    38 
    39 constdefs
    40   inv :: "('a => 'b) => ('b => 'a)"
    41   "inv(f :: 'a => 'b) == %y. SOME x. f x = y"
    42 
    43   Inv :: "'a set => ('a => 'b) => ('b => 'a)"
    44   "Inv A f == %x. SOME y. y \<in> A & f y = x"
    45 
    46 
    47 subsection {*Hilbert's Epsilon-operator*}
    48 
    49 text{*Easier to apply than @{text someI} if the witness comes from an
    50 existential formula*}
    51 lemma someI_ex [elim?]: "\<exists>x. P x ==> P (SOME x. P x)"
    52 apply (erule exE)
    53 apply (erule someI)
    54 done
    55 
    56 text{*Easier to apply than @{text someI} because the conclusion has only one
    57 occurrence of @{term P}.*}
    58 lemma someI2: "[| P a;  !!x. P x ==> Q x |] ==> Q (SOME x. P x)"
    59 by (blast intro: someI)
    60 
    61 text{*Easier to apply than @{text someI2} if the witness comes from an
    62 existential formula*}
    63 lemma someI2_ex: "[| \<exists>a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)"
    64 by (blast intro: someI2)
    65 
    66 lemma some_equality [intro]:
    67      "[| P a;  !!x. P x ==> x=a |] ==> (SOME x. P x) = a"
    68 by (blast intro: someI2)
    69 
    70 lemma some1_equality: "[| EX!x. P x; P a |] ==> (SOME x. P x) = a"
    71 by (blast intro: some_equality)
    72 
    73 lemma some_eq_ex: "P (SOME x. P x) =  (\<exists>x. P x)"
    74 by (blast intro: someI)
    75 
    76 lemma some_eq_trivial [simp]: "(SOME y. y=x) = x"
    77 apply (rule some_equality)
    78 apply (rule refl, assumption)
    79 done
    80 
    81 lemma some_sym_eq_trivial [simp]: "(SOME y. x=y) = x"
    82 apply (rule some_equality)
    83 apply (rule refl)
    84 apply (erule sym)
    85 done
    86 
    87 
    88 subsection{*Axiom of Choice, Proved Using the Description Operator*}
    89 
    90 text{*Used in @{text "Tools/meson.ML"}*}
    91 lemma choice: "\<forall>x. \<exists>y. Q x y ==> \<exists>f. \<forall>x. Q x (f x)"
    92 by (fast elim: someI)
    93 
    94 lemma bchoice: "\<forall>x\<in>S. \<exists>y. Q x y ==> \<exists>f. \<forall>x\<in>S. Q x (f x)"
    95 by (fast elim: someI)
    96 
    97 
    98 subsection {*Function Inverse*}
    99 
   100 lemma inv_id [simp]: "inv id = id"
   101 by (simp add: inv_def id_def)
   102 
   103 text{*A one-to-one function has an inverse.*}
   104 lemma inv_f_f [simp]: "inj f ==> inv f (f x) = x"
   105 by (simp add: inv_def inj_eq)
   106 
   107 lemma inv_f_eq: "[| inj f;  f x = y |] ==> inv f y = x"
   108 apply (erule subst)
   109 apply (erule inv_f_f)
   110 done
   111 
   112 lemma inj_imp_inv_eq: "[| inj f; \<forall>x. f(g x) = x |] ==> inv f = g"
   113 by (blast intro: ext inv_f_eq)
   114 
   115 text{*But is it useful?*}
   116 lemma inj_transfer:
   117   assumes injf: "inj f" and minor: "!!y. y \<in> range(f) ==> P(inv f y)"
   118   shows "P x"
   119 proof -
   120   have "f x \<in> range f" by auto
   121   hence "P(inv f (f x))" by (rule minor)
   122   thus "P x" by (simp add: inv_f_f [OF injf])
   123 qed
   124 
   125 
   126 lemma inj_iff: "(inj f) = (inv f o f = id)"
   127 apply (simp add: o_def expand_fun_eq)
   128 apply (blast intro: inj_on_inverseI inv_f_f)
   129 done
   130 
   131 lemma inj_imp_surj_inv: "inj f ==> surj (inv f)"
   132 by (blast intro: surjI inv_f_f)
   133 
   134 lemma f_inv_f: "y \<in> range(f) ==> f(inv f y) = y"
   135 apply (simp add: inv_def)
   136 apply (fast intro: someI)
   137 done
   138 
   139 lemma surj_f_inv_f: "surj f ==> f(inv f y) = y"
   140 by (simp add: f_inv_f surj_range)
   141 
   142 lemma inv_injective:
   143   assumes eq: "inv f x = inv f y"
   144       and x: "x: range f"
   145       and y: "y: range f"
   146   shows "x=y"
   147 proof -
   148   have "f (inv f x) = f (inv f y)" using eq by simp
   149   thus ?thesis by (simp add: f_inv_f x y) 
   150 qed
   151 
   152 lemma inj_on_inv: "A <= range(f) ==> inj_on (inv f) A"
   153 by (fast intro: inj_onI elim: inv_injective injD)
   154 
   155 lemma surj_imp_inj_inv: "surj f ==> inj (inv f)"
   156 by (simp add: inj_on_inv surj_range)
   157 
   158 lemma surj_iff: "(surj f) = (f o inv f = id)"
   159 apply (simp add: o_def expand_fun_eq)
   160 apply (blast intro: surjI surj_f_inv_f)
   161 done
   162 
   163 lemma surj_imp_inv_eq: "[| surj f; \<forall>x. g(f x) = x |] ==> inv f = g"
   164 apply (rule ext)
   165 apply (drule_tac x = "inv f x" in spec)
   166 apply (simp add: surj_f_inv_f)
   167 done
   168 
   169 lemma bij_imp_bij_inv: "bij f ==> bij (inv f)"
   170 by (simp add: bij_def inj_imp_surj_inv surj_imp_inj_inv)
   171 
   172 lemma inv_equality: "[| !!x. g (f x) = x;  !!y. f (g y) = y |] ==> inv f = g"
   173 apply (rule ext)
   174 apply (auto simp add: inv_def)
   175 done
   176 
   177 lemma inv_inv_eq: "bij f ==> inv (inv f) = f"
   178 apply (rule inv_equality)
   179 apply (auto simp add: bij_def surj_f_inv_f)
   180 done
   181 
   182 (** bij(inv f) implies little about f.  Consider f::bool=>bool such that
   183     f(True)=f(False)=True.  Then it's consistent with axiom someI that
   184     inv f could be any function at all, including the identity function.
   185     If inv f=id then inv f is a bijection, but inj f, surj(f) and
   186     inv(inv f)=f all fail.
   187 **)
   188 
   189 lemma o_inv_distrib: "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f"
   190 apply (rule inv_equality)
   191 apply (auto simp add: bij_def surj_f_inv_f)
   192 done
   193 
   194 
   195 lemma image_surj_f_inv_f: "surj f ==> f ` (inv f ` A) = A"
   196 by (simp add: image_eq_UN surj_f_inv_f)
   197 
   198 lemma image_inv_f_f: "inj f ==> (inv f) ` (f ` A) = A"
   199 by (simp add: image_eq_UN)
   200 
   201 lemma inv_image_comp: "inj f ==> inv f ` (f`X) = X"
   202 by (auto simp add: image_def)
   203 
   204 lemma bij_image_Collect_eq: "bij f ==> f ` Collect P = {y. P (inv f y)}"
   205 apply auto
   206 apply (force simp add: bij_is_inj)
   207 apply (blast intro: bij_is_surj [THEN surj_f_inv_f, symmetric])
   208 done
   209 
   210 lemma bij_vimage_eq_inv_image: "bij f ==> f -` A = inv f ` A" 
   211 apply (auto simp add: bij_is_surj [THEN surj_f_inv_f])
   212 apply (blast intro: bij_is_inj [THEN inv_f_f, symmetric])
   213 done
   214 
   215 
   216 subsection {*Inverse of a PI-function (restricted domain)*}
   217 
   218 lemma Inv_f_f: "[| inj_on f A;  x \<in> A |] ==> Inv A f (f x) = x"
   219 apply (simp add: Inv_def inj_on_def)
   220 apply (blast intro: someI2)
   221 done
   222 
   223 lemma f_Inv_f: "y \<in> f`A  ==> f (Inv A f y) = y"
   224 apply (simp add: Inv_def)
   225 apply (fast intro: someI2)
   226 done
   227 
   228 lemma Inv_injective:
   229   assumes eq: "Inv A f x = Inv A f y"
   230       and x: "x: f`A"
   231       and y: "y: f`A"
   232   shows "x=y"
   233 proof -
   234   have "f (Inv A f x) = f (Inv A f y)" using eq by simp
   235   thus ?thesis by (simp add: f_Inv_f x y) 
   236 qed
   237 
   238 lemma inj_on_Inv: "B <= f`A ==> inj_on (Inv A f) B"
   239 apply (rule inj_onI)
   240 apply (blast intro: inj_onI dest: Inv_injective injD)
   241 done
   242 
   243 lemma Inv_mem: "[| f ` A = B;  x \<in> B |] ==> Inv A f x \<in> A"
   244 apply (simp add: Inv_def)
   245 apply (fast intro: someI2)
   246 done
   247 
   248 lemma Inv_f_eq: "[| inj_on f A; f x = y; x \<in> A |] ==> Inv A f y = x"
   249   apply (erule subst)
   250   apply (erule Inv_f_f, assumption)
   251   done
   252 
   253 lemma Inv_comp:
   254   "[| inj_on f (g ` A); inj_on g A; x \<in> f ` g ` A |] ==>
   255   Inv A (f o g) x = (Inv A g o Inv (g ` A) f) x"
   256   apply simp
   257   apply (rule Inv_f_eq)
   258     apply (fast intro: comp_inj_on)
   259    apply (simp add: f_Inv_f Inv_mem)
   260   apply (simp add: Inv_mem)
   261   done
   262 
   263 
   264 subsection {*Other Consequences of Hilbert's Epsilon*}
   265 
   266 text {*Hilbert's Epsilon and the @{term split} Operator*}
   267 
   268 text{*Looping simprule*}
   269 lemma split_paired_Eps: "(SOME x. P x) = (SOME (a,b). P(a,b))"
   270 by (simp add: split_Pair_apply)
   271 
   272 lemma Eps_split: "Eps (split P) = (SOME xy. P (fst xy) (snd xy))"
   273 by (simp add: split_def)
   274 
   275 lemma Eps_split_eq [simp]: "(@(x',y'). x = x' & y = y') = (x,y)"
   276 by blast
   277 
   278 
   279 text{*A relation is wellfounded iff it has no infinite descending chain*}
   280 lemma wf_iff_no_infinite_down_chain:
   281   "wf r = (~(\<exists>f. \<forall>i. (f(Suc i),f i) \<in> r))"
   282 apply (simp only: wf_eq_minimal)
   283 apply (rule iffI)
   284  apply (rule notI)
   285  apply (erule exE)
   286  apply (erule_tac x = "{w. \<exists>i. w=f i}" in allE, blast)
   287 apply (erule contrapos_np, simp, clarify)
   288 apply (subgoal_tac "\<forall>n. nat_rec x (%i y. @z. z:Q & (z,y) :r) n \<in> Q")
   289  apply (rule_tac x = "nat_rec x (%i y. @z. z:Q & (z,y) :r)" in exI)
   290  apply (rule allI, simp)
   291  apply (rule someI2_ex, blast, blast)
   292 apply (rule allI)
   293 apply (induct_tac "n", simp_all)
   294 apply (rule someI2_ex, blast+)
   295 done
   296 
   297 text{*A dynamically-scoped fact for TFL *}
   298 lemma tfl_some: "\<forall>P x. P x --> P (Eps P)"
   299   by (blast intro: someI)
   300 
   301 
   302 subsection {* Least value operator *}
   303 
   304 constdefs
   305   LeastM :: "['a => 'b::ord, 'a => bool] => 'a"
   306   "LeastM m P == SOME x. P x & (\<forall>y. P y --> m x <= m y)"
   307 
   308 syntax
   309   "_LeastM" :: "[pttrn, 'a => 'b::ord, bool] => 'a"    ("LEAST _ WRT _. _" [0, 4, 10] 10)
   310 translations
   311   "LEAST x WRT m. P" == "LeastM m (%x. P)"
   312 
   313 lemma LeastMI2:
   314   "P x ==> (!!y. P y ==> m x <= m y)
   315     ==> (!!x. P x ==> \<forall>y. P y --> m x \<le> m y ==> Q x)
   316     ==> Q (LeastM m P)"
   317   apply (simp add: LeastM_def)
   318   apply (rule someI2_ex, blast, blast)
   319   done
   320 
   321 lemma LeastM_equality:
   322   "P k ==> (!!x. P x ==> m k <= m x)
   323     ==> m (LEAST x WRT m. P x) = (m k::'a::order)"
   324   apply (rule LeastMI2, assumption, blast)
   325   apply (blast intro!: order_antisym)
   326   done
   327 
   328 lemma wf_linord_ex_has_least:
   329   "wf r ==> \<forall>x y. ((x,y):r^+) = ((y,x)~:r^*) ==> P k
   330     ==> \<exists>x. P x & (!y. P y --> (m x,m y):r^*)"
   331   apply (drule wf_trancl [THEN wf_eq_minimal [THEN iffD1]])
   332   apply (drule_tac x = "m`Collect P" in spec, force)
   333   done
   334 
   335 lemma ex_has_least_nat:
   336     "P k ==> \<exists>x. P x & (\<forall>y. P y --> m x <= (m y::nat))"
   337   apply (simp only: pred_nat_trancl_eq_le [symmetric])
   338   apply (rule wf_pred_nat [THEN wf_linord_ex_has_least])
   339    apply (simp add: less_eq not_le_iff_less pred_nat_trancl_eq_le, assumption)
   340   done
   341 
   342 lemma LeastM_nat_lemma:
   343     "P k ==> P (LeastM m P) & (\<forall>y. P y --> m (LeastM m P) <= (m y::nat))"
   344   apply (simp add: LeastM_def)
   345   apply (rule someI_ex)
   346   apply (erule ex_has_least_nat)
   347   done
   348 
   349 lemmas LeastM_natI = LeastM_nat_lemma [THEN conjunct1, standard]
   350 
   351 lemma LeastM_nat_le: "P x ==> m (LeastM m P) <= (m x::nat)"
   352 by (rule LeastM_nat_lemma [THEN conjunct2, THEN spec, THEN mp], assumption, assumption)
   353 
   354 
   355 subsection {* Greatest value operator *}
   356 
   357 constdefs
   358   GreatestM :: "['a => 'b::ord, 'a => bool] => 'a"
   359   "GreatestM m P == SOME x. P x & (\<forall>y. P y --> m y <= m x)"
   360 
   361   Greatest :: "('a::ord => bool) => 'a"    (binder "GREATEST " 10)
   362   "Greatest == GreatestM (%x. x)"
   363 
   364 syntax
   365   "_GreatestM" :: "[pttrn, 'a=>'b::ord, bool] => 'a"
   366       ("GREATEST _ WRT _. _" [0, 4, 10] 10)
   367 
   368 translations
   369   "GREATEST x WRT m. P" == "GreatestM m (%x. P)"
   370 
   371 lemma GreatestMI2:
   372   "P x ==> (!!y. P y ==> m y <= m x)
   373     ==> (!!x. P x ==> \<forall>y. P y --> m y \<le> m x ==> Q x)
   374     ==> Q (GreatestM m P)"
   375   apply (simp add: GreatestM_def)
   376   apply (rule someI2_ex, blast, blast)
   377   done
   378 
   379 lemma GreatestM_equality:
   380  "P k ==> (!!x. P x ==> m x <= m k)
   381     ==> m (GREATEST x WRT m. P x) = (m k::'a::order)"
   382   apply (rule_tac m = m in GreatestMI2, assumption, blast)
   383   apply (blast intro!: order_antisym)
   384   done
   385 
   386 lemma Greatest_equality:
   387   "P (k::'a::order) ==> (!!x. P x ==> x <= k) ==> (GREATEST x. P x) = k"
   388   apply (simp add: Greatest_def)
   389   apply (erule GreatestM_equality, blast)
   390   done
   391 
   392 lemma ex_has_greatest_nat_lemma:
   393   "P k ==> \<forall>x. P x --> (\<exists>y. P y & ~ ((m y::nat) <= m x))
   394     ==> \<exists>y. P y & ~ (m y < m k + n)"
   395   apply (induct_tac n, force)
   396   apply (force simp add: le_Suc_eq)
   397   done
   398 
   399 lemma ex_has_greatest_nat:
   400   "P k ==> \<forall>y. P y --> m y < b
   401     ==> \<exists>x. P x & (\<forall>y. P y --> (m y::nat) <= m x)"
   402   apply (rule ccontr)
   403   apply (cut_tac P = P and n = "b - m k" in ex_has_greatest_nat_lemma)
   404     apply (subgoal_tac [3] "m k <= b", auto)
   405   done
   406 
   407 lemma GreatestM_nat_lemma:
   408   "P k ==> \<forall>y. P y --> m y < b
   409     ==> P (GreatestM m P) & (\<forall>y. P y --> (m y::nat) <= m (GreatestM m P))"
   410   apply (simp add: GreatestM_def)
   411   apply (rule someI_ex)
   412   apply (erule ex_has_greatest_nat, assumption)
   413   done
   414 
   415 lemmas GreatestM_natI = GreatestM_nat_lemma [THEN conjunct1, standard]
   416 
   417 lemma GreatestM_nat_le:
   418   "P x ==> \<forall>y. P y --> m y < b
   419     ==> (m x::nat) <= m (GreatestM m P)"
   420   apply (blast dest: GreatestM_nat_lemma [THEN conjunct2, THEN spec])
   421   done
   422 
   423 
   424 text {* \medskip Specialization to @{text GREATEST}. *}
   425 
   426 lemma GreatestI: "P (k::nat) ==> \<forall>y. P y --> y < b ==> P (GREATEST x. P x)"
   427   apply (simp add: Greatest_def)
   428   apply (rule GreatestM_natI, auto)
   429   done
   430 
   431 lemma Greatest_le:
   432     "P x ==> \<forall>y. P y --> y < b ==> (x::nat) <= (GREATEST x. P x)"
   433   apply (simp add: Greatest_def)
   434   apply (rule GreatestM_nat_le, auto)
   435   done
   436 
   437 
   438 subsection {* The Meson proof procedure *}
   439 
   440 subsubsection {* Negation Normal Form *}
   441 
   442 text {* de Morgan laws *}
   443 
   444 lemma meson_not_conjD: "~(P&Q) ==> ~P | ~Q"
   445   and meson_not_disjD: "~(P|Q) ==> ~P & ~Q"
   446   and meson_not_notD: "~~P ==> P"
   447   and meson_not_allD: "!!P. ~(\<forall>x. P(x)) ==> \<exists>x. ~P(x)"
   448   and meson_not_exD: "!!P. ~(\<exists>x. P(x)) ==> \<forall>x. ~P(x)"
   449   by fast+
   450 
   451 text {* Removal of @{text "-->"} and @{text "<->"} (positive and
   452 negative occurrences) *}
   453 
   454 lemma meson_imp_to_disjD: "P-->Q ==> ~P | Q"
   455   and meson_not_impD: "~(P-->Q) ==> P & ~Q"
   456   and meson_iff_to_disjD: "P=Q ==> (~P | Q) & (~Q | P)"
   457   and meson_not_iffD: "~(P=Q) ==> (P | Q) & (~P | ~Q)"
   458     -- {* Much more efficient than @{prop "(P & ~Q) | (Q & ~P)"} for computing CNF *}
   459   by fast+
   460 
   461 
   462 subsubsection {* Pulling out the existential quantifiers *}
   463 
   464 text {* Conjunction *}
   465 
   466 lemma meson_conj_exD1: "!!P Q. (\<exists>x. P(x)) & Q ==> \<exists>x. P(x) & Q"
   467   and meson_conj_exD2: "!!P Q. P & (\<exists>x. Q(x)) ==> \<exists>x. P & Q(x)"
   468   by fast+
   469 
   470 
   471 text {* Disjunction *}
   472 
   473 lemma meson_disj_exD: "!!P Q. (\<exists>x. P(x)) | (\<exists>x. Q(x)) ==> \<exists>x. P(x) | Q(x)"
   474   -- {* DO NOT USE with forall-Skolemization: makes fewer schematic variables!! *}
   475   -- {* With ex-Skolemization, makes fewer Skolem constants *}
   476   and meson_disj_exD1: "!!P Q. (\<exists>x. P(x)) | Q ==> \<exists>x. P(x) | Q"
   477   and meson_disj_exD2: "!!P Q. P | (\<exists>x. Q(x)) ==> \<exists>x. P | Q(x)"
   478   by fast+
   479 
   480 
   481 subsubsection {* Generating clauses for the Meson Proof Procedure *}
   482 
   483 text {* Disjunctions *}
   484 
   485 lemma meson_disj_assoc: "(P|Q)|R ==> P|(Q|R)"
   486   and meson_disj_comm: "P|Q ==> Q|P"
   487   and meson_disj_FalseD1: "False|P ==> P"
   488   and meson_disj_FalseD2: "P|False ==> P"
   489   by fast+
   490 
   491 
   492 subsection{*Lemmas for Meson, the Model Elimination Procedure*}
   493 
   494 
   495 text{* Generation of contrapositives *}
   496 
   497 text{*Inserts negated disjunct after removing the negation; P is a literal.
   498   Model elimination requires assuming the negation of every attempted subgoal,
   499   hence the negated disjuncts.*}
   500 lemma make_neg_rule: "~P|Q ==> ((~P==>P) ==> Q)"
   501 by blast
   502 
   503 text{*Version for Plaisted's "Postive refinement" of the Meson procedure*}
   504 lemma make_refined_neg_rule: "~P|Q ==> (P ==> Q)"
   505 by blast
   506 
   507 text{*@{term P} should be a literal*}
   508 lemma make_pos_rule: "P|Q ==> ((P==>~P) ==> Q)"
   509 by blast
   510 
   511 text{*Versions of @{text make_neg_rule} and @{text make_pos_rule} that don't
   512 insert new assumptions, for ordinary resolution.*}
   513 
   514 lemmas make_neg_rule' = make_refined_neg_rule
   515 
   516 lemma make_pos_rule': "[|P|Q; ~P|] ==> Q"
   517 by blast
   518 
   519 text{* Generation of a goal clause -- put away the final literal *}
   520 
   521 lemma make_neg_goal: "~P ==> ((~P==>P) ==> False)"
   522 by blast
   523 
   524 lemma make_pos_goal: "P ==> ((P==>~P) ==> False)"
   525 by blast
   526 
   527 
   528 subsubsection{* Lemmas for Forward Proof*}
   529 
   530 text{*There is a similarity to congruence rules*}
   531 
   532 (*NOTE: could handle conjunctions (faster?) by
   533     nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
   534 lemma conj_forward: "[| P'&Q';  P' ==> P;  Q' ==> Q |] ==> P&Q"
   535 by blast
   536 
   537 lemma disj_forward: "[| P'|Q';  P' ==> P;  Q' ==> Q |] ==> P|Q"
   538 by blast
   539 
   540 (*Version of @{text disj_forward} for removal of duplicate literals*)
   541 lemma disj_forward2:
   542     "[| P'|Q';  P' ==> P;  [| Q'; P==>False |] ==> Q |] ==> P|Q"
   543 apply blast 
   544 done
   545 
   546 lemma all_forward: "[| \<forall>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<forall>x. P(x)"
   547 by blast
   548 
   549 lemma ex_forward: "[| \<exists>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<exists>x. P(x)"
   550 by blast
   551 
   552 ML
   553 {*
   554 val inv_def = thm "inv_def";
   555 val Inv_def = thm "Inv_def";
   556 
   557 val someI = thm "someI";
   558 val someI_ex = thm "someI_ex";
   559 val someI2 = thm "someI2";
   560 val someI2_ex = thm "someI2_ex";
   561 val some_equality = thm "some_equality";
   562 val some1_equality = thm "some1_equality";
   563 val some_eq_ex = thm "some_eq_ex";
   564 val some_eq_trivial = thm "some_eq_trivial";
   565 val some_sym_eq_trivial = thm "some_sym_eq_trivial";
   566 val choice = thm "choice";
   567 val bchoice = thm "bchoice";
   568 val inv_id = thm "inv_id";
   569 val inv_f_f = thm "inv_f_f";
   570 val inv_f_eq = thm "inv_f_eq";
   571 val inj_imp_inv_eq = thm "inj_imp_inv_eq";
   572 val inj_transfer = thm "inj_transfer";
   573 val inj_iff = thm "inj_iff";
   574 val inj_imp_surj_inv = thm "inj_imp_surj_inv";
   575 val f_inv_f = thm "f_inv_f";
   576 val surj_f_inv_f = thm "surj_f_inv_f";
   577 val inv_injective = thm "inv_injective";
   578 val inj_on_inv = thm "inj_on_inv";
   579 val surj_imp_inj_inv = thm "surj_imp_inj_inv";
   580 val surj_iff = thm "surj_iff";
   581 val surj_imp_inv_eq = thm "surj_imp_inv_eq";
   582 val bij_imp_bij_inv = thm "bij_imp_bij_inv";
   583 val inv_equality = thm "inv_equality";
   584 val inv_inv_eq = thm "inv_inv_eq";
   585 val o_inv_distrib = thm "o_inv_distrib";
   586 val image_surj_f_inv_f = thm "image_surj_f_inv_f";
   587 val image_inv_f_f = thm "image_inv_f_f";
   588 val inv_image_comp = thm "inv_image_comp";
   589 val bij_image_Collect_eq = thm "bij_image_Collect_eq";
   590 val bij_vimage_eq_inv_image = thm "bij_vimage_eq_inv_image";
   591 val Inv_f_f = thm "Inv_f_f";
   592 val f_Inv_f = thm "f_Inv_f";
   593 val Inv_injective = thm "Inv_injective";
   594 val inj_on_Inv = thm "inj_on_Inv";
   595 val split_paired_Eps = thm "split_paired_Eps";
   596 val Eps_split = thm "Eps_split";
   597 val Eps_split_eq = thm "Eps_split_eq";
   598 val wf_iff_no_infinite_down_chain = thm "wf_iff_no_infinite_down_chain";
   599 val Inv_mem = thm "Inv_mem";
   600 val Inv_f_eq = thm "Inv_f_eq";
   601 val Inv_comp = thm "Inv_comp";
   602 val tfl_some = thm "tfl_some";
   603 val make_neg_rule = thm "make_neg_rule";
   604 val make_refined_neg_rule = thm "make_refined_neg_rule";
   605 val make_pos_rule = thm "make_pos_rule";
   606 val make_neg_rule' = thm "make_neg_rule'";
   607 val make_pos_rule' = thm "make_pos_rule'";
   608 val make_neg_goal = thm "make_neg_goal";
   609 val make_pos_goal = thm "make_pos_goal";
   610 val conj_forward = thm "conj_forward";
   611 val disj_forward = thm "disj_forward";
   612 val disj_forward2 = thm "disj_forward2";
   613 val all_forward = thm "all_forward";
   614 val ex_forward = thm "ex_forward";
   615 *}
   616 
   617 
   618 use "Tools/meson.ML"
   619 setup meson_setup
   620 
   621 use "Tools/specification_package.ML"
   622 
   623 end