conversion of Hilbert_Choice to Isar script
authorpaulson
Wed May 19 11:29:47 2004 +0200 (2004-05-19)
changeset 14760a08e916f4946
parent 14759 c90bed2d5bdf
child 14761 28b5eb4a867f
conversion of Hilbert_Choice to Isar script
src/HOL/Hilbert_Choice.thy
src/HOL/Hilbert_Choice_lemmas.ML
src/HOL/IsaMakefile
src/HOL/meson_lemmas.ML
     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.10  
    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.13  
    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.17  
    1.18  
    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.22  
    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.105  
   1.106  
   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.113 +
   1.114 +lemma inj_imp_surj_inv: "inj f ==> surj (inv f)"
   1.115 +by (blast intro: surjI inv_f_f)
   1.116 +
   1.117 +lemma f_inv_f: "y \<in> range(f) ==> f(inv f y) = y"
   1.118 +apply (simp add: inv_def)
   1.119 +apply (fast intro: someI)
   1.120 +done
   1.121 +
   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.124 +
   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.134 +
   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.137 +
   1.138 +lemma surj_imp_inj_inv: "surj f ==> inj (inv f)"
   1.139 +by (simp add: inj_on_inv surj_range)
   1.140 +
   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.145 +
   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.149 +apply (simp add: surj_f_inv_f)
   1.150 +done
   1.151 +
   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.154  
   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.161 +
   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.166 +
   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.173 +
   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.178 +
   1.179 +
   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.182 +
   1.183 +lemma image_inv_f_f: "inj f ==> (inv f) ` (f ` A) = A"
   1.184 +by (simp add: image_eq_UN)
   1.185 +
   1.186 +lemma inv_image_comp: "inj f ==> inv f ` (f`X) = X"
   1.187 +by (auto simp add: image_def)
   1.188 +
   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.194 +
   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.199 +
   1.200 +
   1.201 +subsection {*Inverse of a PI-function (restricted domain)*}
   1.202 +
   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.207 +
   1.208 +lemma f_Inv_f: "y \<in> f`A  ==> f (Inv A f y) = y"
   1.209 +apply (simp add: Inv_def)
   1.210  apply (fast intro: someI2)
   1.211  done
   1.212  
   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.224 +
   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.229 +
   1.230 +lemma Inv_mem: "[| f ` A = B;  x \<in> B |] ==> Inv A f x \<in> A"
   1.231 +apply (simp add: Inv_def)
   1.232 +apply (fast intro: someI2)
   1.233 +done
   1.234 +
   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.241  
   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.249    apply (simp add: Inv_mem)
   1.250    done
   1.251  
   1.252 +
   1.253 +subsection {*Other Consequences of Hilbert's Epsilon*}
   1.254 +
   1.255 +text {*Hilbert's Epsilon and the @{term split} Operator*}
   1.256 +
   1.257 +text{*Looping simprule*}
   1.258 +lemma split_paired_Eps: "(SOME x. P x) = (SOME (a,b). P(a,b))"
   1.259 +by (simp add: split_Pair_apply)
   1.260 +
   1.261 +lemma Eps_split: "Eps (split P) = (SOME xy. P (fst xy) (snd xy))"
   1.262 +by (simp add: split_def)
   1.263 +
   1.264 +lemma Eps_split_eq [simp]: "(@(x',y'). x = x' & y = y') = (x,y)"
   1.265 +by blast
   1.266 +
   1.267 +
   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.285 +
   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.290  
   1.291  
   1.292 @@ -77,7 +302,7 @@
   1.293  
   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.298  
   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.309  
   1.310 @@ -100,22 +325,22 @@
   1.311    done
   1.312  
   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.321  
   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.329  
   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.339  
   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.344  
   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.355  
   1.356 @@ -159,29 +384,29 @@
   1.357  
   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.364  
   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.373  
   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.383  
   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.396  
   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.404  
   1.405  text {* \medskip Specialization to @{text GREATEST}. *}
   1.406  
   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.413  
   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.421  
   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.431  
   1.432  text {* Removal of @{text "-->"} and @{text "<->"} (positive and
   1.433 @@ -237,18 +462,18 @@
   1.434  
   1.435  text {* Conjunction *}
   1.436  
   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.442  
   1.443  
   1.444  text {* Disjunction *}
   1.445  
   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.455  
   1.456  
   1.457 @@ -262,7 +487,133 @@
   1.458    and meson_disj_FalseD2: "P|False ==> P"
   1.459    by fast+
   1.460  
   1.461 -use "meson_lemmas.ML"
   1.462 +
   1.463 +subsection{*Lemmas for Meson, the Model Elimination Procedure*}
   1.464 +
   1.465 +
   1.466 +text{* Generation of contrapositives *}
   1.467 +
   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.473 +
   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.477 +
   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.481 +
   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.484 +
   1.485 +lemmas make_neg_rule' = make_refined_neg_rule
   1.486 +
   1.487 +lemma make_pos_rule': "[|P|Q; ~P|] ==> Q"
   1.488 +by blast
   1.489 +
   1.490 +text{* Generation of a goal clause -- put away the final literal *}
   1.491 +
   1.492 +lemma make_neg_goal: "~P ==> ((~P==>P) ==> False)"
   1.493 +by blast
   1.494 +
   1.495 +lemma make_pos_goal: "P ==> ((P==>~P) ==> False)"
   1.496 +by blast
   1.497 +
   1.498 +
   1.499 +subsubsection{* Lemmas for Forward Proof*}
   1.500 +
   1.501 +text{*There is a similarity to congruence rules*}
   1.502 +
   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.507 +
   1.508 +lemma disj_forward: "[| P'|Q';  P' ==> P;  Q' ==> Q |] ==> P|Q"
   1.509 +by blast
   1.510 +
   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.516 +
   1.517 +lemma all_forward: "[| \<forall>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<forall>x. P(x)"
   1.518 +by blast
   1.519 +
   1.520 +lemma ex_forward: "[| \<exists>x. P'(x);  !!x. P'(x) ==> P(x) |] ==> \<exists>x. P(x)"
   1.521 +by blast
   1.522 +
   1.523 +ML
   1.524 +{*
   1.525 +val inv_def = thm "inv_def";
   1.526 +val Inv_def = thm "Inv_def";
   1.527 +
   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.587 +
   1.588 +
   1.589  use "Tools/meson.ML"
   1.590  setup meson_setup
   1.591  
     2.1 --- a/src/HOL/Hilbert_Choice_lemmas.ML	Wed May 19 11:24:54 2004 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,281 +0,0 @@
     2.4 -(*  Title:      HOL/Hilbert_Choice_lemmas
     2.5 -    ID: $Id$
     2.6 -    Author:     Lawrence C Paulson
     2.7 -    Copyright   2001  University of Cambridge
     2.8 -
     2.9 -Lemmas for Hilbert's epsilon-operator and the Axiom of Choice
    2.10 -*)
    2.11 -
    2.12 -
    2.13 -(* ML bindings *)
    2.14 -val someI = thm "someI";
    2.15 -
    2.16 -section "SOME: Hilbert's Epsilon-operator";
    2.17 -
    2.18 -(*Easier to apply than someI if witness ?a comes from an EX-formula*)
    2.19 -Goal "EX x. P x ==> P (SOME x. P x)";
    2.20 -by (etac exE 1);
    2.21 -by (etac someI 1);
    2.22 -qed "someI_ex";
    2.23 -
    2.24 -(*Easier to apply than someI: conclusion has only one occurrence of P*)
    2.25 -val prems = Goal "[| P a;  !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
    2.26 -by (resolve_tac prems 1);
    2.27 -by (rtac someI 1);
    2.28 -by (resolve_tac prems 1) ;
    2.29 -qed "someI2";
    2.30 -
    2.31 -(*Easier to apply than someI2 if witness ?a comes from an EX-formula*)
    2.32 -val [major,minor] = Goal "[| EX a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
    2.33 -by (rtac (major RS exE) 1);
    2.34 -by (etac someI2 1 THEN etac minor 1);
    2.35 -qed "someI2_ex";
    2.36 -
    2.37 -val prems = Goal "[| P a;  !!x. P x ==> x=a |] ==> (SOME x. P x) = a";
    2.38 -by (rtac someI2 1);
    2.39 -by (REPEAT (ares_tac prems 1)) ;
    2.40 -qed "some_equality";
    2.41 -AddIs [some_equality];
    2.42 -
    2.43 -Goal "[| EX!x. P x; P a |] ==> (SOME x. P x) = a";
    2.44 -by (rtac some_equality 1);
    2.45 -by  (atac 1);
    2.46 -by (etac ex1E 1);
    2.47 -by (etac all_dupE 1);
    2.48 -by (dtac mp 1);
    2.49 -by  (atac 1);
    2.50 -by (etac ssubst 1);
    2.51 -by (etac allE 1);
    2.52 -by (etac mp 1);
    2.53 -by (atac 1);
    2.54 -qed "some1_equality";
    2.55 -
    2.56 -Goal "P (SOME x. P x) =  (EX x. P x)";
    2.57 -by (rtac iffI 1);
    2.58 -by (etac exI 1);
    2.59 -by (etac exE 1);
    2.60 -by (etac someI 1);
    2.61 -qed "some_eq_ex";
    2.62 -
    2.63 -Goal "(SOME y. y=x) = x";
    2.64 -by (rtac some_equality 1);
    2.65 -by (rtac refl 1);
    2.66 -by (atac 1);
    2.67 -qed "some_eq_trivial";
    2.68 -
    2.69 -Goal "(SOME y. x=y) = x";
    2.70 -by (rtac some_equality 1);
    2.71 -by (rtac refl 1);
    2.72 -by (etac sym 1);
    2.73 -qed "some_sym_eq_trivial";
    2.74 -Addsimps [some_eq_trivial, some_sym_eq_trivial];
    2.75 -
    2.76 -
    2.77 -(** "Axiom" of Choice, proved using the description operator **)
    2.78 -
    2.79 -(*Used in Tools/meson.ML*)
    2.80 -Goal "ALL x. EX y. Q x y ==> EX f. ALL x. Q x (f x)";
    2.81 -by (fast_tac (claset() addEs [someI]) 1);
    2.82 -qed "choice";
    2.83 -
    2.84 -Goal "ALL x:S. EX y. Q x y ==> EX f. ALL x:S. Q x (f x)";
    2.85 -by (fast_tac (claset() addEs [someI]) 1);
    2.86 -qed "bchoice";
    2.87 -
    2.88 -
    2.89 -section "Function Inverse";
    2.90 -
    2.91 -val inv_def = thm "inv_def";
    2.92 -val Inv_def = thm "Inv_def";
    2.93 -
    2.94 -Goal "inv id = id";
    2.95 -by (simp_tac (simpset() addsimps [inv_def,id_def]) 1);
    2.96 -qed "inv_id";
    2.97 -Addsimps [inv_id];
    2.98 -
    2.99 -(*A one-to-one function has an inverse.*)
   2.100 -Goalw [inv_def] "inj(f) ==> inv f (f x) = x";
   2.101 -by (asm_simp_tac (simpset() addsimps [inj_eq]) 1); 
   2.102 -qed "inv_f_f";
   2.103 -Addsimps [inv_f_f];
   2.104 -
   2.105 -Goal "[| inj(f);  f x = y |] ==> inv f y = x";
   2.106 -by (etac subst 1);
   2.107 -by (etac inv_f_f 1);
   2.108 -qed "inv_f_eq";
   2.109 -
   2.110 -Goal "[| inj f; ALL x. f(g x) = x |] ==> inv f = g";
   2.111 -by (blast_tac (claset() addIs [ext, inv_f_eq]) 1); 
   2.112 -qed "inj_imp_inv_eq";
   2.113 -
   2.114 -(* Useful??? *)
   2.115 -val [oneone,minor] = Goal
   2.116 -    "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)";
   2.117 -by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1);
   2.118 -by (rtac (rangeI RS minor) 1);
   2.119 -qed "inj_transfer";
   2.120 -
   2.121 -Goal "(inj f) = (inv f o f = id)";
   2.122 -by (asm_simp_tac (simpset() addsimps [o_def, expand_fun_eq]) 1);
   2.123 -by (blast_tac (claset() addIs [inj_inverseI, inv_f_f]) 1);
   2.124 -qed "inj_iff";
   2.125 -
   2.126 -Goal "inj f ==> surj (inv f)";
   2.127 -by (blast_tac (claset() addIs [surjI, inv_f_f]) 1);
   2.128 -qed "inj_imp_surj_inv";
   2.129 -
   2.130 -Goalw [inv_def] "y : range(f) ==> f(inv f y) = y";
   2.131 -by (fast_tac (claset() addIs [someI]) 1);
   2.132 -qed "f_inv_f";
   2.133 -
   2.134 -Goal "surj f ==> f(inv f y) = y";
   2.135 -by (asm_simp_tac (simpset() addsimps [f_inv_f, surj_range]) 1);
   2.136 -qed "surj_f_inv_f";
   2.137 -
   2.138 -Goal "[| inv f x = inv f y;  x: range(f);  y: range(f) |] ==> x=y";
   2.139 -by (rtac (arg_cong RS box_equals) 1);
   2.140 -by (REPEAT (ares_tac [f_inv_f] 1));
   2.141 -qed "inv_injective";
   2.142 -
   2.143 -Goal "A <= range(f) ==> inj_on (inv f) A";
   2.144 -by (fast_tac (claset() addIs [inj_onI] 
   2.145 -                       addEs [inv_injective, injD]) 1);
   2.146 -qed "inj_on_inv";
   2.147 -
   2.148 -Goal "surj f ==> inj (inv f)";
   2.149 -by (asm_simp_tac (simpset() addsimps [inj_on_inv, surj_range]) 1);
   2.150 -qed "surj_imp_inj_inv";
   2.151 -
   2.152 -Goal "(surj f) = (f o inv f = id)";
   2.153 -by (asm_simp_tac (simpset() addsimps [o_def, expand_fun_eq]) 1);
   2.154 -by (blast_tac (claset() addIs [surjI, surj_f_inv_f]) 1);
   2.155 -qed "surj_iff";
   2.156 -
   2.157 -Goal "[| surj f; ALL x. g(f x) = x |] ==> inv f = g";
   2.158 -by (rtac ext 1);
   2.159 -by (dres_inst_tac [("x","inv f x")] spec 1); 
   2.160 -by (asm_full_simp_tac (simpset() addsimps [surj_f_inv_f]) 1); 
   2.161 -qed "surj_imp_inv_eq";
   2.162 -
   2.163 -Goalw [bij_def] "bij f ==> bij (inv f)";
   2.164 -by (asm_simp_tac (simpset() addsimps [inj_imp_surj_inv, surj_imp_inj_inv]) 1);
   2.165 -qed "bij_imp_bij_inv";
   2.166 -
   2.167 -val prems = 
   2.168 -Goalw [inv_def] "[| !! x. g (f x) = x;  !! y. f (g y) = y |] ==> inv f = g";
   2.169 -by (rtac ext 1);
   2.170 -by (auto_tac (claset(), simpset() addsimps prems));
   2.171 -qed "inv_equality";
   2.172 -
   2.173 -Goalw [bij_def] "bij f ==> inv (inv f) = f";
   2.174 -by (rtac inv_equality 1);
   2.175 -by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f]));
   2.176 -qed "inv_inv_eq";
   2.177 -
   2.178 -(** bij(inv f) implies little about f.  Consider f::bool=>bool such that
   2.179 -    f(True)=f(False)=True.  Then it's consistent with axiom someI that
   2.180 -    inv(f) could be any function at all, including the identity function.
   2.181 -    If inv(f)=id then inv(f) is a bijection, but inj(f), surj(f) and
   2.182 -    inv(inv(f))=f all fail.
   2.183 -**)
   2.184 -
   2.185 -Goalw [bij_def] "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f";
   2.186 -by (rtac (inv_equality) 1);
   2.187 -by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f]));
   2.188 -qed "o_inv_distrib";
   2.189 -
   2.190 -
   2.191 -Goal "surj f ==> f ` (inv f ` A) = A";
   2.192 -by (asm_simp_tac (simpset() addsimps [image_eq_UN, surj_f_inv_f]) 1);
   2.193 -qed "image_surj_f_inv_f";
   2.194 -
   2.195 -Goal "inj f ==> (inv f) ` (f ` A) = A";
   2.196 -by (asm_simp_tac (simpset() addsimps [image_eq_UN]) 1);
   2.197 -qed "image_inv_f_f";
   2.198 -
   2.199 -Goalw [image_def] "inj(f) ==> inv(f)`(f`X) = X";
   2.200 -by Auto_tac;
   2.201 -qed "inv_image_comp";
   2.202 -
   2.203 -Goal "bij f ==> f ` Collect P = {y. P (inv f y)}";
   2.204 -by Auto_tac;
   2.205 -by (force_tac (claset(), simpset() addsimps [bij_is_inj]) 1);
   2.206 -by (blast_tac (claset() addIs [bij_is_surj RS surj_f_inv_f RS sym]) 1);
   2.207 -qed "bij_image_Collect_eq";
   2.208 -
   2.209 -Goal "bij f ==> f -` A = inv f ` A";
   2.210 -by Safe_tac;
   2.211 -by (asm_simp_tac (simpset() addsimps [bij_is_surj RS surj_f_inv_f]) 2);
   2.212 -by (blast_tac (claset() addIs [bij_is_inj RS inv_f_f RS sym]) 1);
   2.213 -qed "bij_vimage_eq_inv_image";
   2.214 -
   2.215 -
   2.216 -section "Inverse of a PI-function (restricted domain)";
   2.217 -
   2.218 -Goal "[| inj_on f A;  x : A |] ==> Inv A f (f x) = x";
   2.219 -by (asm_full_simp_tac (simpset() addsimps [Inv_def, inj_on_def]) 1);
   2.220 -by (blast_tac (claset() addIs [someI2]) 1); 
   2.221 -qed "Inv_f_f";
   2.222 -
   2.223 -Goal "y : f`A  ==> f (Inv A f y) = y";
   2.224 -by (asm_simp_tac (simpset() addsimps [Inv_def]) 1);
   2.225 -by (fast_tac (claset() addIs [someI2]) 1);
   2.226 -qed "f_Inv_f";
   2.227 -
   2.228 -Goal "[| Inv A f x = Inv A f y;  x : f`A;  y : f`A |] ==> x=y";
   2.229 -by (rtac (arg_cong RS box_equals) 1);
   2.230 -by (REPEAT (ares_tac [f_Inv_f] 1));
   2.231 -qed "Inv_injective";
   2.232 -
   2.233 -Goal "B <= f`A ==> inj_on (Inv A f) B";
   2.234 -by (rtac inj_onI 1);
   2.235 -by (blast_tac (claset() addIs [inj_onI] addDs [Inv_injective, injD]) 1);
   2.236 -qed "inj_on_Inv";
   2.237 -
   2.238 -
   2.239 -
   2.240 -section "split and SOME";
   2.241 -
   2.242 -(*Can't be added to simpset: loops!*)
   2.243 -Goal "(SOME x. P x) = (SOME (a,b). P(a,b))";
   2.244 -by (simp_tac (simpset() addsimps [split_Pair_apply]) 1);
   2.245 -qed "split_paired_Eps";
   2.246 -
   2.247 -Goalw [split_def] "Eps (split P) = (SOME xy. P (fst xy) (snd xy))";
   2.248 -by (rtac refl 1);
   2.249 -qed "Eps_split";
   2.250 -
   2.251 -Goal "(@(x',y'). x = x' & y = y') = (x,y)";
   2.252 -by (Blast_tac 1);
   2.253 -qed "Eps_split_eq";
   2.254 -Addsimps [Eps_split_eq];
   2.255 -
   2.256 -
   2.257 -section "A relation is wellfounded iff it has no infinite descending chain";
   2.258 -
   2.259 -Goalw [wf_eq_minimal RS eq_reflection]
   2.260 -  "wf r = (~(EX f. ALL i. (f(Suc i),f i) : r))";
   2.261 -by (rtac iffI 1);
   2.262 - by (rtac notI 1);
   2.263 - by (etac exE 1);
   2.264 - by (eres_inst_tac [("x","{w. EX i. w=f i}")] allE 1);
   2.265 - by (Blast_tac 1);
   2.266 -by (etac contrapos_np 1);
   2.267 -by (Asm_full_simp_tac 1);
   2.268 -by (Clarify_tac 1);
   2.269 -by (subgoal_tac "ALL n. nat_rec x (%i y. @z. z:Q & (z,y):r) n : Q" 1);
   2.270 - by (res_inst_tac[("x","nat_rec x (%i y. @z. z:Q & (z,y):r)")]exI 1);
   2.271 - by (rtac allI 1);
   2.272 - by (Simp_tac 1);
   2.273 - by (rtac someI2_ex 1);
   2.274 -  by (Blast_tac 1);
   2.275 - by (Blast_tac 1);
   2.276 -by (rtac allI 1);
   2.277 -by (induct_tac "n" 1);
   2.278 - by (Asm_simp_tac 1);
   2.279 -by (Simp_tac 1);
   2.280 -by (rtac someI2_ex 1);
   2.281 - by (Blast_tac 1);
   2.282 -by (Blast_tac 1);
   2.283 -qed "wf_iff_no_infinite_down_chain";
   2.284 -
     3.1 --- a/src/HOL/IsaMakefile	Wed May 19 11:24:54 2004 +0200
     3.2 +++ b/src/HOL/IsaMakefile	Wed May 19 11:29:47 2004 +0200
     3.3 @@ -82,8 +82,7 @@
     3.4    $(SRC)/TFL/usyntax.ML $(SRC)/TFL/utils.ML \
     3.5    Datatype.thy Datatype_Universe.ML Datatype_Universe.thy \
     3.6    Divides.thy Extraction.thy Finite_Set.ML Finite_Set.thy \
     3.7 -  Fun.thy Gfp.ML Gfp.thy \
     3.8 -  Hilbert_Choice.thy Hilbert_Choice_lemmas.ML HOL.ML \
     3.9 +  Fun.thy Gfp.ML Gfp.thy Hilbert_Choice.thy HOL.ML \
    3.10    HOL.thy HOL_lemmas.ML Inductive.thy Infinite_Set.thy Integ/Bin.thy \
    3.11    Integ/cooper_dec.ML Integ/cooper_proof.ML \
    3.12    Integ/Equiv.thy Integ/IntArith.thy Integ/IntDef.thy \
    3.13 @@ -114,7 +113,7 @@
    3.14    Transitive_Closure.thy Transitive_Closure.ML Typedef.thy \
    3.15    Wellfounded_Recursion.ML Wellfounded_Recursion.thy Wellfounded_Relations.ML \
    3.16    Wellfounded_Relations.thy arith_data.ML blastdata.ML cladata.ML \
    3.17 -  document/root.tex hologic.ML meson_lemmas.ML simpdata.ML thy_syntax.ML
    3.18 +  document/root.tex hologic.ML simpdata.ML thy_syntax.ML
    3.19  	@$(ISATOOL) usedir -b -g true $(HOL_PROOF_OBJECTS) $(OUT)/Pure HOL
    3.20  
    3.21  
     4.1 --- a/src/HOL/meson_lemmas.ML	Wed May 19 11:24:54 2004 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,95 +0,0 @@
     4.4 -(*  Title:      HOL/meson_lemmas.ML
     4.5 -    ID:         $Id$
     4.6 -    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4.7 -    Copyright   1992  University of Cambridge
     4.8 -
     4.9 -Lemmas for Meson.
    4.10 -*)
    4.11 -
    4.12 -(* Generation of contrapositives *)
    4.13 -
    4.14 -(*Inserts negated disjunct after removing the negation; P is a literal.
    4.15 -  Model elimination requires assuming the negation of every attempted subgoal,
    4.16 -  hence the negated disjuncts.*)
    4.17 -val [major,minor] = Goal "~P|Q ==> ((~P==>P) ==> Q)";
    4.18 -by (rtac (major RS disjE) 1);
    4.19 -by (rtac notE 1);
    4.20 -by (etac minor 2);
    4.21 -by (ALLGOALS assume_tac);
    4.22 -qed "make_neg_rule";
    4.23 -
    4.24 -(*For Plaisted's "Postive refinement" of the MESON procedure*)
    4.25 -Goal "~P|Q ==> (P ==> Q)";
    4.26 -by (Blast_tac 1);
    4.27 -qed "make_refined_neg_rule";
    4.28 -
    4.29 -(*P should be a literal*)
    4.30 -val [major,minor] = Goal "P|Q ==> ((P==>~P) ==> Q)";
    4.31 -by (rtac (major RS disjE) 1);
    4.32 -by (rtac notE 1);
    4.33 -by (etac minor 1);
    4.34 -by (ALLGOALS assume_tac);
    4.35 -qed "make_pos_rule";
    4.36 -
    4.37 -(** Versions of make_neg_rule and make_pos_rule that don't insert new 
    4.38 -    assumptions, for ordinary resolution. **)
    4.39 -
    4.40 -val make_neg_rule' = make_refined_neg_rule;
    4.41 -
    4.42 -Goal "[|P|Q; ~P|] ==> Q";
    4.43 -by (Blast_tac 1);
    4.44 -qed "make_pos_rule'";
    4.45 -
    4.46 -(* Generation of a goal clause -- put away the final literal *)
    4.47 -
    4.48 -val [major,minor] = Goal "~P ==> ((~P==>P) ==> False)";
    4.49 -by (rtac notE 1);
    4.50 -by (rtac minor 2);
    4.51 -by (ALLGOALS (rtac major));
    4.52 -qed "make_neg_goal";
    4.53 -
    4.54 -val [major,minor] = Goal "P ==> ((P==>~P) ==> False)";
    4.55 -by (rtac notE 1);
    4.56 -by (rtac minor 1);
    4.57 -by (ALLGOALS (rtac major));
    4.58 -qed "make_pos_goal";
    4.59 -
    4.60 -
    4.61 -(* Lemmas for forward proof (like congruence rules) *)
    4.62 -
    4.63 -(*NOTE: could handle conjunctions (faster?) by
    4.64 -    nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
    4.65 -val major::prems = Goal
    4.66 -    "[| P'&Q';  P' ==> P;  Q' ==> Q |] ==> P&Q";
    4.67 -by (rtac (major RS conjE) 1);
    4.68 -by (rtac conjI 1);
    4.69 -by (ALLGOALS (eresolve_tac prems));
    4.70 -qed "conj_forward";
    4.71 -
    4.72 -val major::prems = Goal
    4.73 -    "[| P'|Q';  P' ==> P;  Q' ==> Q |] ==> P|Q";
    4.74 -by (rtac (major RS disjE) 1);
    4.75 -by (ALLGOALS (dresolve_tac prems));
    4.76 -by (ALLGOALS (eresolve_tac [disjI1,disjI2]));
    4.77 -qed "disj_forward";
    4.78 -
    4.79 -(*Version for removal of duplicate literals*)
    4.80 -val major::prems = Goal
    4.81 -    "[| P'|Q';  P' ==> P;  [| Q'; P==>False |] ==> Q |] ==> P|Q";
    4.82 -by (cut_facts_tac [major] 1);
    4.83 -by (blast_tac (claset() addIs prems) 1);
    4.84 -qed "disj_forward2";
    4.85 -
    4.86 -val major::prems = Goal
    4.87 -    "[| ALL x. P'(x);  !!x. P'(x) ==> P(x) |] ==> ALL x. P(x)";
    4.88 -by (rtac allI 1);
    4.89 -by (resolve_tac prems 1);
    4.90 -by (rtac (major RS spec) 1);
    4.91 -qed "all_forward";
    4.92 -
    4.93 -val major::prems = Goal
    4.94 -    "[| EX x. P'(x);  !!x. P'(x) ==> P(x) |] ==> EX x. P(x)";
    4.95 -by (rtac (major RS exE) 1);
    4.96 -by (rtac exI 1);
    4.97 -by (eresolve_tac prems 1);
    4.98 -qed "ex_forward";