--- a/src/HOL/Hilbert_Choice.thy Wed May 19 11:24:54 2004 +0200
+++ b/src/HOL/Hilbert_Choice.thy Wed May 19 11:29:47 2004 +0200
@@ -1,13 +1,13 @@
(* Title: HOL/Hilbert_Choice.thy
- ID: $Id$
+ ID: $Id$
Author: Lawrence C Paulson
Copyright 2001 University of Cambridge
*)
-header {* Hilbert's epsilon-operator and everything to do with the Axiom of Choice *}
+header {* Hilbert's Epsilon-Operator and the Axiom of Choice *}
theory Hilbert_Choice = NatArith
-files ("Hilbert_Choice_lemmas.ML") ("meson_lemmas.ML") ("Tools/meson.ML") ("Tools/specification_package.ML"):
+files ("Tools/meson.ML") ("Tools/specification_package.ML"):
subsection {* Hilbert's epsilon *}
@@ -40,26 +40,217 @@
"inv(f :: 'a => 'b) == %y. SOME x. f x = y"
Inv :: "'a set => ('a => 'b) => ('b => 'a)"
- "Inv A f == %x. SOME y. y : A & f y = x"
+ "Inv A f == %x. SOME y. y \<in> A & f y = x"
+
+
+subsection {*Hilbert's Epsilon-operator*}
+
+text{*Easier to apply than @{text someI} if the witness comes from an
+existential formula*}
+lemma someI_ex [elim?]: "\<exists>x. P x ==> P (SOME x. P x)"
+apply (erule exE)
+apply (erule someI)
+done
+
+text{*Easier to apply than @{text someI} because the conclusion has only one
+occurrence of @{term P}.*}
+lemma someI2: "[| P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)"
+by (blast intro: someI)
+
+text{*Easier to apply than @{text someI2} if the witness comes from an
+existential formula*}
+lemma someI2_ex: "[| \<exists>a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)"
+by (blast intro: someI2)
+
+lemma some_equality [intro]:
+ "[| P a; !!x. P x ==> x=a |] ==> (SOME x. P x) = a"
+by (blast intro: someI2)
+
+lemma some1_equality: "[| EX!x. P x; P a |] ==> (SOME x. P x) = a"
+by (blast intro: some_equality)
+
+lemma some_eq_ex: "P (SOME x. P x) = (\<exists>x. P x)"
+by (blast intro: someI)
+
+lemma some_eq_trivial [simp]: "(SOME y. y=x) = x"
+apply (rule some_equality)
+apply (rule refl, assumption)
+done
+
+lemma some_sym_eq_trivial [simp]: "(SOME y. x=y) = x"
+apply (rule some_equality)
+apply (rule refl)
+apply (erule sym)
+done
+
+
+subsection{*Axiom of Choice, Proved Using the Description Operator*}
+
+text{*Used in @{text "Tools/meson.ML"}*}
+lemma choice: "\<forall>x. \<exists>y. Q x y ==> \<exists>f. \<forall>x. Q x (f x)"
+by (fast elim: someI)
+
+lemma bchoice: "\<forall>x\<in>S. \<exists>y. Q x y ==> \<exists>f. \<forall>x\<in>S. Q x (f x)"
+by (fast elim: someI)
+
+
+subsection {*Function Inverse*}
+
+lemma inv_id [simp]: "inv id = id"
+by (simp add: inv_def id_def)
+
+text{*A one-to-one function has an inverse.*}
+lemma inv_f_f [simp]: "inj f ==> inv f (f x) = x"
+by (simp add: inv_def inj_eq)
+
+lemma inv_f_eq: "[| inj f; f x = y |] ==> inv f y = x"
+apply (erule subst)
+apply (erule inv_f_f)
+done
+
+lemma inj_imp_inv_eq: "[| inj f; \<forall>x. f(g x) = x |] ==> inv f = g"
+by (blast intro: ext inv_f_eq)
+
+text{*But is it useful?*}
+lemma inj_transfer:
+ assumes injf: "inj f" and minor: "!!y. y \<in> range(f) ==> P(inv f y)"
+ shows "P x"
+proof -
+ have "f x \<in> range f" by auto
+ hence "P(inv f (f x))" by (rule minor)
+ thus "P x" by (simp add: inv_f_f [OF injf])
+qed
-use "Hilbert_Choice_lemmas.ML"
-declare someI_ex [elim?];
+lemma inj_iff: "(inj f) = (inv f o f = id)"
+apply (simp add: o_def expand_fun_eq)
+apply (blast intro: inj_on_inverseI inv_f_f)
+done
+
+lemma inj_imp_surj_inv: "inj f ==> surj (inv f)"
+by (blast intro: surjI inv_f_f)
+
+lemma f_inv_f: "y \<in> range(f) ==> f(inv f y) = y"
+apply (simp add: inv_def)
+apply (fast intro: someI)
+done
+
+lemma surj_f_inv_f: "surj f ==> f(inv f y) = y"
+by (simp add: f_inv_f surj_range)
+
+lemma inv_injective:
+ assumes eq: "inv f x = inv f y"
+ and x: "x: range f"
+ and y: "y: range f"
+ shows "x=y"
+proof -
+ have "f (inv f x) = f (inv f y)" using eq by simp
+ thus ?thesis by (simp add: f_inv_f x y)
+qed
+
+lemma inj_on_inv: "A <= range(f) ==> inj_on (inv f) A"
+by (fast intro: inj_onI elim: inv_injective injD)
+
+lemma surj_imp_inj_inv: "surj f ==> inj (inv f)"
+by (simp add: inj_on_inv surj_range)
+
+lemma surj_iff: "(surj f) = (f o inv f = id)"
+apply (simp add: o_def expand_fun_eq)
+apply (blast intro: surjI surj_f_inv_f)
+done
+
+lemma surj_imp_inv_eq: "[| surj f; \<forall>x. g(f x) = x |] ==> inv f = g"
+apply (rule ext)
+apply (drule_tac x = "inv f x" in spec)
+apply (simp add: surj_f_inv_f)
+done
+
+lemma bij_imp_bij_inv: "bij f ==> bij (inv f)"
+by (simp add: bij_def inj_imp_surj_inv surj_imp_inj_inv)
-lemma Inv_mem: "[| f ` A = B; x \<in> B |] ==> Inv A f x \<in> A"
-apply (unfold Inv_def)
+lemma inv_equality: "[| !!x. g (f x) = x; !!y. f (g y) = y |] ==> inv f = g"
+apply (rule ext)
+apply (auto simp add: inv_def)
+done
+
+lemma inv_inv_eq: "bij f ==> inv (inv f) = f"
+apply (rule inv_equality)
+apply (auto simp add: bij_def surj_f_inv_f)
+done
+
+(** bij(inv f) implies little about f. Consider f::bool=>bool such that
+ f(True)=f(False)=True. Then it's consistent with axiom someI that
+ inv f could be any function at all, including the identity function.
+ If inv f=id then inv f is a bijection, but inj f, surj(f) and
+ inv(inv f)=f all fail.
+**)
+
+lemma o_inv_distrib: "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f"
+apply (rule inv_equality)
+apply (auto simp add: bij_def surj_f_inv_f)
+done
+
+
+lemma image_surj_f_inv_f: "surj f ==> f ` (inv f ` A) = A"
+by (simp add: image_eq_UN surj_f_inv_f)
+
+lemma image_inv_f_f: "inj f ==> (inv f) ` (f ` A) = A"
+by (simp add: image_eq_UN)
+
+lemma inv_image_comp: "inj f ==> inv f ` (f`X) = X"
+by (auto simp add: image_def)
+
+lemma bij_image_Collect_eq: "bij f ==> f ` Collect P = {y. P (inv f y)}"
+apply auto
+apply (force simp add: bij_is_inj)
+apply (blast intro: bij_is_surj [THEN surj_f_inv_f, symmetric])
+done
+
+lemma bij_vimage_eq_inv_image: "bij f ==> f -` A = inv f ` A"
+apply (auto simp add: bij_is_surj [THEN surj_f_inv_f])
+apply (blast intro: bij_is_inj [THEN inv_f_f, symmetric])
+done
+
+
+subsection {*Inverse of a PI-function (restricted domain)*}
+
+lemma Inv_f_f: "[| inj_on f A; x \<in> A |] ==> Inv A f (f x) = x"
+apply (simp add: Inv_def inj_on_def)
+apply (blast intro: someI2)
+done
+
+lemma f_Inv_f: "y \<in> f`A ==> f (Inv A f y) = y"
+apply (simp add: Inv_def)
apply (fast intro: someI2)
done
-lemma Inv_f_eq:
- "[| inj_on f A; f x = y; x : A |] ==> Inv A f y = x"
+lemma Inv_injective:
+ assumes eq: "Inv A f x = Inv A f y"
+ and x: "x: f`A"
+ and y: "y: f`A"
+ shows "x=y"
+proof -
+ have "f (Inv A f x) = f (Inv A f y)" using eq by simp
+ thus ?thesis by (simp add: f_Inv_f x y)
+qed
+
+lemma inj_on_Inv: "B <= f`A ==> inj_on (Inv A f) B"
+apply (rule inj_onI)
+apply (blast intro: inj_onI dest: Inv_injective injD)
+done
+
+lemma Inv_mem: "[| f ` A = B; x \<in> B |] ==> Inv A f x \<in> A"
+apply (simp add: Inv_def)
+apply (fast intro: someI2)
+done
+
+lemma Inv_f_eq: "[| inj_on f A; f x = y; x \<in> A |] ==> Inv A f y = x"
apply (erule subst)
- apply (erule Inv_f_f)
- apply assumption
+ apply (erule Inv_f_f, assumption)
done
lemma Inv_comp:
- "[| inj_on f (g ` A); inj_on g A; x : f ` g ` A |] ==>
+ "[| inj_on f (g ` A); inj_on g A; x \<in> f ` g ` A |] ==>
Inv A (f o g) x = (Inv A g o Inv (g ` A) f) x"
apply simp
apply (rule Inv_f_eq)
@@ -68,8 +259,42 @@
apply (simp add: Inv_mem)
done
+
+subsection {*Other Consequences of Hilbert's Epsilon*}
+
+text {*Hilbert's Epsilon and the @{term split} Operator*}
+
+text{*Looping simprule*}
+lemma split_paired_Eps: "(SOME x. P x) = (SOME (a,b). P(a,b))"
+by (simp add: split_Pair_apply)
+
+lemma Eps_split: "Eps (split P) = (SOME xy. P (fst xy) (snd xy))"
+by (simp add: split_def)
+
+lemma Eps_split_eq [simp]: "(@(x',y'). x = x' & y = y') = (x,y)"
+by blast
+
+
+text{*A relation is wellfounded iff it has no infinite descending chain*}
+lemma wf_iff_no_infinite_down_chain:
+ "wf r = (~(\<exists>f. \<forall>i. (f(Suc i),f i) \<in> r))"
+apply (simp only: wf_eq_minimal)
+apply (rule iffI)
+ apply (rule notI)
+ apply (erule exE)
+ apply (erule_tac x = "{w. \<exists>i. w=f i}" in allE, blast)
+apply (erule contrapos_np, simp, clarify)
+apply (subgoal_tac "\<forall>n. nat_rec x (%i y. @z. z:Q & (z,y) :r) n \<in> Q")
+ apply (rule_tac x = "nat_rec x (%i y. @z. z:Q & (z,y) :r)" in exI)
+ apply (rule allI, simp)
+ apply (rule someI2_ex, blast, blast)
+apply (rule allI)
+apply (induct_tac "n", simp_all)
+apply (rule someI2_ex, blast+)
+done
+
+text{*A dynamically-scoped fact for TFL *}
lemma tfl_some: "\<forall>P x. P x --> P (Eps P)"
- -- {* dynamically-scoped fact for TFL *}
by (blast intro: someI)
@@ -77,7 +302,7 @@
constdefs
LeastM :: "['a => 'b::ord, 'a => bool] => 'a"
- "LeastM m P == SOME x. P x & (ALL y. P y --> m x <= m y)"
+ "LeastM m P == SOME x. P x & (\<forall>y. P y --> m x <= m y)"
syntax
"_LeastM" :: "[pttrn, 'a => 'b::ord, bool] => 'a" ("LEAST _ WRT _. _" [0, 4, 10] 10)
@@ -88,7 +313,7 @@
"P x ==> (!!y. P y ==> m x <= m y)
==> (!!x. P x ==> \<forall>y. P y --> m x \<le> m y ==> Q x)
==> Q (LeastM m P)"
- apply (unfold LeastM_def)
+ apply (simp add: LeastM_def)
apply (rule someI2_ex, blast, blast)
done
@@ -100,22 +325,22 @@
done
lemma wf_linord_ex_has_least:
- "wf r ==> ALL x y. ((x,y):r^+) = ((y,x)~:r^*) ==> P k
- ==> EX x. P x & (!y. P y --> (m x,m y):r^*)"
+ "wf r ==> \<forall>x y. ((x,y):r^+) = ((y,x)~:r^*) ==> P k
+ ==> \<exists>x. P x & (!y. P y --> (m x,m y):r^*)"
apply (drule wf_trancl [THEN wf_eq_minimal [THEN iffD1]])
apply (drule_tac x = "m`Collect P" in spec, force)
done
lemma ex_has_least_nat:
- "P k ==> EX x. P x & (ALL y. P y --> m x <= (m y::nat))"
+ "P k ==> \<exists>x. P x & (\<forall>y. P y --> m x <= (m y::nat))"
apply (simp only: pred_nat_trancl_eq_le [symmetric])
apply (rule wf_pred_nat [THEN wf_linord_ex_has_least])
apply (simp add: less_eq not_le_iff_less pred_nat_trancl_eq_le, assumption)
done
lemma LeastM_nat_lemma:
- "P k ==> P (LeastM m P) & (ALL y. P y --> m (LeastM m P) <= (m y::nat))"
- apply (unfold LeastM_def)
+ "P k ==> P (LeastM m P) & (\<forall>y. P y --> m (LeastM m P) <= (m y::nat))"
+ apply (simp add: LeastM_def)
apply (rule someI_ex)
apply (erule ex_has_least_nat)
done
@@ -130,7 +355,7 @@
constdefs
GreatestM :: "['a => 'b::ord, 'a => bool] => 'a"
- "GreatestM m P == SOME x. P x & (ALL y. P y --> m y <= m x)"
+ "GreatestM m P == SOME x. P x & (\<forall>y. P y --> m y <= m x)"
Greatest :: "('a::ord => bool) => 'a" (binder "GREATEST " 10)
"Greatest == GreatestM (%x. x)"
@@ -146,7 +371,7 @@
"P x ==> (!!y. P y ==> m y <= m x)
==> (!!x. P x ==> \<forall>y. P y --> m y \<le> m x ==> Q x)
==> Q (GreatestM m P)"
- apply (unfold GreatestM_def)
+ apply (simp add: GreatestM_def)
apply (rule someI2_ex, blast, blast)
done
@@ -159,29 +384,29 @@
lemma Greatest_equality:
"P (k::'a::order) ==> (!!x. P x ==> x <= k) ==> (GREATEST x. P x) = k"
- apply (unfold Greatest_def)
+ apply (simp add: Greatest_def)
apply (erule GreatestM_equality, blast)
done
lemma ex_has_greatest_nat_lemma:
- "P k ==> ALL x. P x --> (EX y. P y & ~ ((m y::nat) <= m x))
- ==> EX y. P y & ~ (m y < m k + n)"
+ "P k ==> \<forall>x. P x --> (\<exists>y. P y & ~ ((m y::nat) <= m x))
+ ==> \<exists>y. P y & ~ (m y < m k + n)"
apply (induct_tac n, force)
apply (force simp add: le_Suc_eq)
done
lemma ex_has_greatest_nat:
- "P k ==> ALL y. P y --> m y < b
- ==> EX x. P x & (ALL y. P y --> (m y::nat) <= m x)"
+ "P k ==> \<forall>y. P y --> m y < b
+ ==> \<exists>x. P x & (\<forall>y. P y --> (m y::nat) <= m x)"
apply (rule ccontr)
apply (cut_tac P = P and n = "b - m k" in ex_has_greatest_nat_lemma)
apply (subgoal_tac [3] "m k <= b", auto)
done
lemma GreatestM_nat_lemma:
- "P k ==> ALL y. P y --> m y < b
- ==> P (GreatestM m P) & (ALL y. P y --> (m y::nat) <= m (GreatestM m P))"
- apply (unfold GreatestM_def)
+ "P k ==> \<forall>y. P y --> m y < b
+ ==> P (GreatestM m P) & (\<forall>y. P y --> (m y::nat) <= m (GreatestM m P))"
+ apply (simp add: GreatestM_def)
apply (rule someI_ex)
apply (erule ex_has_greatest_nat, assumption)
done
@@ -189,7 +414,7 @@
lemmas GreatestM_natI = GreatestM_nat_lemma [THEN conjunct1, standard]
lemma GreatestM_nat_le:
- "P x ==> ALL y. P y --> m y < b
+ "P x ==> \<forall>y. P y --> m y < b
==> (m x::nat) <= m (GreatestM m P)"
apply (blast dest: GreatestM_nat_lemma [THEN conjunct2, THEN spec])
done
@@ -197,14 +422,14 @@
text {* \medskip Specialization to @{text GREATEST}. *}
-lemma GreatestI: "P (k::nat) ==> ALL y. P y --> y < b ==> P (GREATEST x. P x)"
- apply (unfold Greatest_def)
+lemma GreatestI: "P (k::nat) ==> \<forall>y. P y --> y < b ==> P (GREATEST x. P x)"
+ apply (simp add: Greatest_def)
apply (rule GreatestM_natI, auto)
done
lemma Greatest_le:
- "P x ==> ALL y. P y --> y < b ==> (x::nat) <= (GREATEST x. P x)"
- apply (unfold Greatest_def)
+ "P x ==> \<forall>y. P y --> y < b ==> (x::nat) <= (GREATEST x. P x)"
+ apply (simp add: Greatest_def)
apply (rule GreatestM_nat_le, auto)
done
@@ -218,8 +443,8 @@
lemma meson_not_conjD: "~(P&Q) ==> ~P | ~Q"
and meson_not_disjD: "~(P|Q) ==> ~P & ~Q"
and meson_not_notD: "~~P ==> P"
- and meson_not_allD: "!!P. ~(ALL x. P(x)) ==> EX x. ~P(x)"
- and meson_not_exD: "!!P. ~(EX x. P(x)) ==> ALL x. ~P(x)"
+ and meson_not_allD: "!!P. ~(\<forall>x. P(x)) ==> \<exists>x. ~P(x)"
+ and meson_not_exD: "!!P. ~(\<exists>x. P(x)) ==> \<forall>x. ~P(x)"
by fast+
text {* Removal of @{text "-->"} and @{text "<->"} (positive and
@@ -237,18 +462,18 @@
text {* Conjunction *}
-lemma meson_conj_exD1: "!!P Q. (EX x. P(x)) & Q ==> EX x. P(x) & Q"
- and meson_conj_exD2: "!!P Q. P & (EX x. Q(x)) ==> EX x. P & Q(x)"
+lemma meson_conj_exD1: "!!P Q. (\<exists>x. P(x)) & Q ==> \<exists>x. P(x) & Q"
+ and meson_conj_exD2: "!!P Q. P & (\<exists>x. Q(x)) ==> \<exists>x. P & Q(x)"
by fast+
text {* Disjunction *}
-lemma meson_disj_exD: "!!P Q. (EX x. P(x)) | (EX x. Q(x)) ==> EX x. P(x) | Q(x)"
+lemma meson_disj_exD: "!!P Q. (\<exists>x. P(x)) | (\<exists>x. Q(x)) ==> \<exists>x. P(x) | Q(x)"
-- {* DO NOT USE with forall-Skolemization: makes fewer schematic variables!! *}
-- {* With ex-Skolemization, makes fewer Skolem constants *}
- and meson_disj_exD1: "!!P Q. (EX x. P(x)) | Q ==> EX x. P(x) | Q"
- and meson_disj_exD2: "!!P Q. P | (EX x. Q(x)) ==> EX x. P | Q(x)"
+ and meson_disj_exD1: "!!P Q. (\<exists>x. P(x)) | Q ==> \<exists>x. P(x) | Q"
+ and meson_disj_exD2: "!!P Q. P | (\<exists>x. Q(x)) ==> \<exists>x. P | Q(x)"
by fast+
@@ -262,7 +487,133 @@
and meson_disj_FalseD2: "P|False ==> P"
by fast+
-use "meson_lemmas.ML"
+
+subsection{*Lemmas for Meson, the Model Elimination Procedure*}
+
+
+text{* Generation of contrapositives *}
+
+text{*Inserts negated disjunct after removing the negation; P is a literal.
+ Model elimination requires assuming the negation of every attempted subgoal,
+ hence the negated disjuncts.*}
+lemma make_neg_rule: "~P|Q ==> ((~P==>P) ==> Q)"
+by blast
+
+text{*Version for Plaisted's "Postive refinement" of the Meson procedure*}
+lemma make_refined_neg_rule: "~P|Q ==> (P ==> Q)"
+by blast
+
+text{*@{term P} should be a literal*}
+lemma make_pos_rule: "P|Q ==> ((P==>~P) ==> Q)"
+by blast
+
+text{*Versions of @{text make_neg_rule} and @{text make_pos_rule} that don't
+insert new assumptions, for ordinary resolution.*}
+
+lemmas make_neg_rule' = make_refined_neg_rule
+
+lemma make_pos_rule': "[|P|Q; ~P|] ==> Q"
+by blast
+
+text{* Generation of a goal clause -- put away the final literal *}
+
+lemma make_neg_goal: "~P ==> ((~P==>P) ==> False)"
+by blast
+
+lemma make_pos_goal: "P ==> ((P==>~P) ==> False)"
+by blast
+
+
+subsubsection{* Lemmas for Forward Proof*}
+
+text{*There is a similarity to congruence rules*}
+
+(*NOTE: could handle conjunctions (faster?) by
+ nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
+lemma conj_forward: "[| P'&Q'; P' ==> P; Q' ==> Q |] ==> P&Q"
+by blast
+
+lemma disj_forward: "[| P'|Q'; P' ==> P; Q' ==> Q |] ==> P|Q"
+by blast
+
+(*Version of @{text disj_forward} for removal of duplicate literals*)
+lemma disj_forward2:
+ "[| P'|Q'; P' ==> P; [| Q'; P==>False |] ==> Q |] ==> P|Q"
+apply blast
+done
+
+lemma all_forward: "[| \<forall>x. P'(x); !!x. P'(x) ==> P(x) |] ==> \<forall>x. P(x)"
+by blast
+
+lemma ex_forward: "[| \<exists>x. P'(x); !!x. P'(x) ==> P(x) |] ==> \<exists>x. P(x)"
+by blast
+
+ML
+{*
+val inv_def = thm "inv_def";
+val Inv_def = thm "Inv_def";
+
+val someI = thm "someI";
+val someI_ex = thm "someI_ex";
+val someI2 = thm "someI2";
+val someI2_ex = thm "someI2_ex";
+val some_equality = thm "some_equality";
+val some1_equality = thm "some1_equality";
+val some_eq_ex = thm "some_eq_ex";
+val some_eq_trivial = thm "some_eq_trivial";
+val some_sym_eq_trivial = thm "some_sym_eq_trivial";
+val choice = thm "choice";
+val bchoice = thm "bchoice";
+val inv_id = thm "inv_id";
+val inv_f_f = thm "inv_f_f";
+val inv_f_eq = thm "inv_f_eq";
+val inj_imp_inv_eq = thm "inj_imp_inv_eq";
+val inj_transfer = thm "inj_transfer";
+val inj_iff = thm "inj_iff";
+val inj_imp_surj_inv = thm "inj_imp_surj_inv";
+val f_inv_f = thm "f_inv_f";
+val surj_f_inv_f = thm "surj_f_inv_f";
+val inv_injective = thm "inv_injective";
+val inj_on_inv = thm "inj_on_inv";
+val surj_imp_inj_inv = thm "surj_imp_inj_inv";
+val surj_iff = thm "surj_iff";
+val surj_imp_inv_eq = thm "surj_imp_inv_eq";
+val bij_imp_bij_inv = thm "bij_imp_bij_inv";
+val inv_equality = thm "inv_equality";
+val inv_inv_eq = thm "inv_inv_eq";
+val o_inv_distrib = thm "o_inv_distrib";
+val image_surj_f_inv_f = thm "image_surj_f_inv_f";
+val image_inv_f_f = thm "image_inv_f_f";
+val inv_image_comp = thm "inv_image_comp";
+val bij_image_Collect_eq = thm "bij_image_Collect_eq";
+val bij_vimage_eq_inv_image = thm "bij_vimage_eq_inv_image";
+val Inv_f_f = thm "Inv_f_f";
+val f_Inv_f = thm "f_Inv_f";
+val Inv_injective = thm "Inv_injective";
+val inj_on_Inv = thm "inj_on_Inv";
+val split_paired_Eps = thm "split_paired_Eps";
+val Eps_split = thm "Eps_split";
+val Eps_split_eq = thm "Eps_split_eq";
+val wf_iff_no_infinite_down_chain = thm "wf_iff_no_infinite_down_chain";
+val Inv_mem = thm "Inv_mem";
+val Inv_f_eq = thm "Inv_f_eq";
+val Inv_comp = thm "Inv_comp";
+val tfl_some = thm "tfl_some";
+val make_neg_rule = thm "make_neg_rule";
+val make_refined_neg_rule = thm "make_refined_neg_rule";
+val make_pos_rule = thm "make_pos_rule";
+val make_neg_rule' = thm "make_neg_rule'";
+val make_pos_rule' = thm "make_pos_rule'";
+val make_neg_goal = thm "make_neg_goal";
+val make_pos_goal = thm "make_pos_goal";
+val conj_forward = thm "conj_forward";
+val disj_forward = thm "disj_forward";
+val disj_forward2 = thm "disj_forward2";
+val all_forward = thm "all_forward";
+val ex_forward = thm "ex_forward";
+*}
+
+
use "Tools/meson.ML"
setup meson_setup
--- a/src/HOL/Hilbert_Choice_lemmas.ML Wed May 19 11:24:54 2004 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-(* Title: HOL/Hilbert_Choice_lemmas
- ID: $Id$
- Author: Lawrence C Paulson
- Copyright 2001 University of Cambridge
-
-Lemmas for Hilbert's epsilon-operator and the Axiom of Choice
-*)
-
-
-(* ML bindings *)
-val someI = thm "someI";
-
-section "SOME: Hilbert's Epsilon-operator";
-
-(*Easier to apply than someI if witness ?a comes from an EX-formula*)
-Goal "EX x. P x ==> P (SOME x. P x)";
-by (etac exE 1);
-by (etac someI 1);
-qed "someI_ex";
-
-(*Easier to apply than someI: conclusion has only one occurrence of P*)
-val prems = Goal "[| P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
-by (resolve_tac prems 1);
-by (rtac someI 1);
-by (resolve_tac prems 1) ;
-qed "someI2";
-
-(*Easier to apply than someI2 if witness ?a comes from an EX-formula*)
-val [major,minor] = Goal "[| EX a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)";
-by (rtac (major RS exE) 1);
-by (etac someI2 1 THEN etac minor 1);
-qed "someI2_ex";
-
-val prems = Goal "[| P a; !!x. P x ==> x=a |] ==> (SOME x. P x) = a";
-by (rtac someI2 1);
-by (REPEAT (ares_tac prems 1)) ;
-qed "some_equality";
-AddIs [some_equality];
-
-Goal "[| EX!x. P x; P a |] ==> (SOME x. P x) = a";
-by (rtac some_equality 1);
-by (atac 1);
-by (etac ex1E 1);
-by (etac all_dupE 1);
-by (dtac mp 1);
-by (atac 1);
-by (etac ssubst 1);
-by (etac allE 1);
-by (etac mp 1);
-by (atac 1);
-qed "some1_equality";
-
-Goal "P (SOME x. P x) = (EX x. P x)";
-by (rtac iffI 1);
-by (etac exI 1);
-by (etac exE 1);
-by (etac someI 1);
-qed "some_eq_ex";
-
-Goal "(SOME y. y=x) = x";
-by (rtac some_equality 1);
-by (rtac refl 1);
-by (atac 1);
-qed "some_eq_trivial";
-
-Goal "(SOME y. x=y) = x";
-by (rtac some_equality 1);
-by (rtac refl 1);
-by (etac sym 1);
-qed "some_sym_eq_trivial";
-Addsimps [some_eq_trivial, some_sym_eq_trivial];
-
-
-(** "Axiom" of Choice, proved using the description operator **)
-
-(*Used in Tools/meson.ML*)
-Goal "ALL x. EX y. Q x y ==> EX f. ALL x. Q x (f x)";
-by (fast_tac (claset() addEs [someI]) 1);
-qed "choice";
-
-Goal "ALL x:S. EX y. Q x y ==> EX f. ALL x:S. Q x (f x)";
-by (fast_tac (claset() addEs [someI]) 1);
-qed "bchoice";
-
-
-section "Function Inverse";
-
-val inv_def = thm "inv_def";
-val Inv_def = thm "Inv_def";
-
-Goal "inv id = id";
-by (simp_tac (simpset() addsimps [inv_def,id_def]) 1);
-qed "inv_id";
-Addsimps [inv_id];
-
-(*A one-to-one function has an inverse.*)
-Goalw [inv_def] "inj(f) ==> inv f (f x) = x";
-by (asm_simp_tac (simpset() addsimps [inj_eq]) 1);
-qed "inv_f_f";
-Addsimps [inv_f_f];
-
-Goal "[| inj(f); f x = y |] ==> inv f y = x";
-by (etac subst 1);
-by (etac inv_f_f 1);
-qed "inv_f_eq";
-
-Goal "[| inj f; ALL x. f(g x) = x |] ==> inv f = g";
-by (blast_tac (claset() addIs [ext, inv_f_eq]) 1);
-qed "inj_imp_inv_eq";
-
-(* Useful??? *)
-val [oneone,minor] = Goal
- "[| inj(f); !!y. y: range(f) ==> P(inv f y) |] ==> P(x)";
-by (res_inst_tac [("t", "x")] (oneone RS (inv_f_f RS subst)) 1);
-by (rtac (rangeI RS minor) 1);
-qed "inj_transfer";
-
-Goal "(inj f) = (inv f o f = id)";
-by (asm_simp_tac (simpset() addsimps [o_def, expand_fun_eq]) 1);
-by (blast_tac (claset() addIs [inj_inverseI, inv_f_f]) 1);
-qed "inj_iff";
-
-Goal "inj f ==> surj (inv f)";
-by (blast_tac (claset() addIs [surjI, inv_f_f]) 1);
-qed "inj_imp_surj_inv";
-
-Goalw [inv_def] "y : range(f) ==> f(inv f y) = y";
-by (fast_tac (claset() addIs [someI]) 1);
-qed "f_inv_f";
-
-Goal "surj f ==> f(inv f y) = y";
-by (asm_simp_tac (simpset() addsimps [f_inv_f, surj_range]) 1);
-qed "surj_f_inv_f";
-
-Goal "[| inv f x = inv f y; x: range(f); y: range(f) |] ==> x=y";
-by (rtac (arg_cong RS box_equals) 1);
-by (REPEAT (ares_tac [f_inv_f] 1));
-qed "inv_injective";
-
-Goal "A <= range(f) ==> inj_on (inv f) A";
-by (fast_tac (claset() addIs [inj_onI]
- addEs [inv_injective, injD]) 1);
-qed "inj_on_inv";
-
-Goal "surj f ==> inj (inv f)";
-by (asm_simp_tac (simpset() addsimps [inj_on_inv, surj_range]) 1);
-qed "surj_imp_inj_inv";
-
-Goal "(surj f) = (f o inv f = id)";
-by (asm_simp_tac (simpset() addsimps [o_def, expand_fun_eq]) 1);
-by (blast_tac (claset() addIs [surjI, surj_f_inv_f]) 1);
-qed "surj_iff";
-
-Goal "[| surj f; ALL x. g(f x) = x |] ==> inv f = g";
-by (rtac ext 1);
-by (dres_inst_tac [("x","inv f x")] spec 1);
-by (asm_full_simp_tac (simpset() addsimps [surj_f_inv_f]) 1);
-qed "surj_imp_inv_eq";
-
-Goalw [bij_def] "bij f ==> bij (inv f)";
-by (asm_simp_tac (simpset() addsimps [inj_imp_surj_inv, surj_imp_inj_inv]) 1);
-qed "bij_imp_bij_inv";
-
-val prems =
-Goalw [inv_def] "[| !! x. g (f x) = x; !! y. f (g y) = y |] ==> inv f = g";
-by (rtac ext 1);
-by (auto_tac (claset(), simpset() addsimps prems));
-qed "inv_equality";
-
-Goalw [bij_def] "bij f ==> inv (inv f) = f";
-by (rtac inv_equality 1);
-by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f]));
-qed "inv_inv_eq";
-
-(** bij(inv f) implies little about f. Consider f::bool=>bool such that
- f(True)=f(False)=True. Then it's consistent with axiom someI that
- inv(f) could be any function at all, including the identity function.
- If inv(f)=id then inv(f) is a bijection, but inj(f), surj(f) and
- inv(inv(f))=f all fail.
-**)
-
-Goalw [bij_def] "[| bij f; bij g |] ==> inv (f o g) = inv g o inv f";
-by (rtac (inv_equality) 1);
-by (auto_tac (claset(), simpset() addsimps [surj_f_inv_f]));
-qed "o_inv_distrib";
-
-
-Goal "surj f ==> f ` (inv f ` A) = A";
-by (asm_simp_tac (simpset() addsimps [image_eq_UN, surj_f_inv_f]) 1);
-qed "image_surj_f_inv_f";
-
-Goal "inj f ==> (inv f) ` (f ` A) = A";
-by (asm_simp_tac (simpset() addsimps [image_eq_UN]) 1);
-qed "image_inv_f_f";
-
-Goalw [image_def] "inj(f) ==> inv(f)`(f`X) = X";
-by Auto_tac;
-qed "inv_image_comp";
-
-Goal "bij f ==> f ` Collect P = {y. P (inv f y)}";
-by Auto_tac;
-by (force_tac (claset(), simpset() addsimps [bij_is_inj]) 1);
-by (blast_tac (claset() addIs [bij_is_surj RS surj_f_inv_f RS sym]) 1);
-qed "bij_image_Collect_eq";
-
-Goal "bij f ==> f -` A = inv f ` A";
-by Safe_tac;
-by (asm_simp_tac (simpset() addsimps [bij_is_surj RS surj_f_inv_f]) 2);
-by (blast_tac (claset() addIs [bij_is_inj RS inv_f_f RS sym]) 1);
-qed "bij_vimage_eq_inv_image";
-
-
-section "Inverse of a PI-function (restricted domain)";
-
-Goal "[| inj_on f A; x : A |] ==> Inv A f (f x) = x";
-by (asm_full_simp_tac (simpset() addsimps [Inv_def, inj_on_def]) 1);
-by (blast_tac (claset() addIs [someI2]) 1);
-qed "Inv_f_f";
-
-Goal "y : f`A ==> f (Inv A f y) = y";
-by (asm_simp_tac (simpset() addsimps [Inv_def]) 1);
-by (fast_tac (claset() addIs [someI2]) 1);
-qed "f_Inv_f";
-
-Goal "[| Inv A f x = Inv A f y; x : f`A; y : f`A |] ==> x=y";
-by (rtac (arg_cong RS box_equals) 1);
-by (REPEAT (ares_tac [f_Inv_f] 1));
-qed "Inv_injective";
-
-Goal "B <= f`A ==> inj_on (Inv A f) B";
-by (rtac inj_onI 1);
-by (blast_tac (claset() addIs [inj_onI] addDs [Inv_injective, injD]) 1);
-qed "inj_on_Inv";
-
-
-
-section "split and SOME";
-
-(*Can't be added to simpset: loops!*)
-Goal "(SOME x. P x) = (SOME (a,b). P(a,b))";
-by (simp_tac (simpset() addsimps [split_Pair_apply]) 1);
-qed "split_paired_Eps";
-
-Goalw [split_def] "Eps (split P) = (SOME xy. P (fst xy) (snd xy))";
-by (rtac refl 1);
-qed "Eps_split";
-
-Goal "(@(x',y'). x = x' & y = y') = (x,y)";
-by (Blast_tac 1);
-qed "Eps_split_eq";
-Addsimps [Eps_split_eq];
-
-
-section "A relation is wellfounded iff it has no infinite descending chain";
-
-Goalw [wf_eq_minimal RS eq_reflection]
- "wf r = (~(EX f. ALL i. (f(Suc i),f i) : r))";
-by (rtac iffI 1);
- by (rtac notI 1);
- by (etac exE 1);
- by (eres_inst_tac [("x","{w. EX i. w=f i}")] allE 1);
- by (Blast_tac 1);
-by (etac contrapos_np 1);
-by (Asm_full_simp_tac 1);
-by (Clarify_tac 1);
-by (subgoal_tac "ALL n. nat_rec x (%i y. @z. z:Q & (z,y):r) n : Q" 1);
- by (res_inst_tac[("x","nat_rec x (%i y. @z. z:Q & (z,y):r)")]exI 1);
- by (rtac allI 1);
- by (Simp_tac 1);
- by (rtac someI2_ex 1);
- by (Blast_tac 1);
- by (Blast_tac 1);
-by (rtac allI 1);
-by (induct_tac "n" 1);
- by (Asm_simp_tac 1);
-by (Simp_tac 1);
-by (rtac someI2_ex 1);
- by (Blast_tac 1);
-by (Blast_tac 1);
-qed "wf_iff_no_infinite_down_chain";
-
--- a/src/HOL/IsaMakefile Wed May 19 11:24:54 2004 +0200
+++ b/src/HOL/IsaMakefile Wed May 19 11:29:47 2004 +0200
@@ -82,8 +82,7 @@
$(SRC)/TFL/usyntax.ML $(SRC)/TFL/utils.ML \
Datatype.thy Datatype_Universe.ML Datatype_Universe.thy \
Divides.thy Extraction.thy Finite_Set.ML Finite_Set.thy \
- Fun.thy Gfp.ML Gfp.thy \
- Hilbert_Choice.thy Hilbert_Choice_lemmas.ML HOL.ML \
+ Fun.thy Gfp.ML Gfp.thy Hilbert_Choice.thy HOL.ML \
HOL.thy HOL_lemmas.ML Inductive.thy Infinite_Set.thy Integ/Bin.thy \
Integ/cooper_dec.ML Integ/cooper_proof.ML \
Integ/Equiv.thy Integ/IntArith.thy Integ/IntDef.thy \
@@ -114,7 +113,7 @@
Transitive_Closure.thy Transitive_Closure.ML Typedef.thy \
Wellfounded_Recursion.ML Wellfounded_Recursion.thy Wellfounded_Relations.ML \
Wellfounded_Relations.thy arith_data.ML blastdata.ML cladata.ML \
- document/root.tex hologic.ML meson_lemmas.ML simpdata.ML thy_syntax.ML
+ document/root.tex hologic.ML simpdata.ML thy_syntax.ML
@$(ISATOOL) usedir -b -g true $(HOL_PROOF_OBJECTS) $(OUT)/Pure HOL
--- a/src/HOL/meson_lemmas.ML Wed May 19 11:24:54 2004 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-(* Title: HOL/meson_lemmas.ML
- ID: $Id$
- Author: Lawrence C Paulson, Cambridge University Computer Laboratory
- Copyright 1992 University of Cambridge
-
-Lemmas for Meson.
-*)
-
-(* Generation of contrapositives *)
-
-(*Inserts negated disjunct after removing the negation; P is a literal.
- Model elimination requires assuming the negation of every attempted subgoal,
- hence the negated disjuncts.*)
-val [major,minor] = Goal "~P|Q ==> ((~P==>P) ==> Q)";
-by (rtac (major RS disjE) 1);
-by (rtac notE 1);
-by (etac minor 2);
-by (ALLGOALS assume_tac);
-qed "make_neg_rule";
-
-(*For Plaisted's "Postive refinement" of the MESON procedure*)
-Goal "~P|Q ==> (P ==> Q)";
-by (Blast_tac 1);
-qed "make_refined_neg_rule";
-
-(*P should be a literal*)
-val [major,minor] = Goal "P|Q ==> ((P==>~P) ==> Q)";
-by (rtac (major RS disjE) 1);
-by (rtac notE 1);
-by (etac minor 1);
-by (ALLGOALS assume_tac);
-qed "make_pos_rule";
-
-(** Versions of make_neg_rule and make_pos_rule that don't insert new
- assumptions, for ordinary resolution. **)
-
-val make_neg_rule' = make_refined_neg_rule;
-
-Goal "[|P|Q; ~P|] ==> Q";
-by (Blast_tac 1);
-qed "make_pos_rule'";
-
-(* Generation of a goal clause -- put away the final literal *)
-
-val [major,minor] = Goal "~P ==> ((~P==>P) ==> False)";
-by (rtac notE 1);
-by (rtac minor 2);
-by (ALLGOALS (rtac major));
-qed "make_neg_goal";
-
-val [major,minor] = Goal "P ==> ((P==>~P) ==> False)";
-by (rtac notE 1);
-by (rtac minor 1);
-by (ALLGOALS (rtac major));
-qed "make_pos_goal";
-
-
-(* Lemmas for forward proof (like congruence rules) *)
-
-(*NOTE: could handle conjunctions (faster?) by
- nf(th RS conjunct2) RS (nf(th RS conjunct1) RS conjI) *)
-val major::prems = Goal
- "[| P'&Q'; P' ==> P; Q' ==> Q |] ==> P&Q";
-by (rtac (major RS conjE) 1);
-by (rtac conjI 1);
-by (ALLGOALS (eresolve_tac prems));
-qed "conj_forward";
-
-val major::prems = Goal
- "[| P'|Q'; P' ==> P; Q' ==> Q |] ==> P|Q";
-by (rtac (major RS disjE) 1);
-by (ALLGOALS (dresolve_tac prems));
-by (ALLGOALS (eresolve_tac [disjI1,disjI2]));
-qed "disj_forward";
-
-(*Version for removal of duplicate literals*)
-val major::prems = Goal
- "[| P'|Q'; P' ==> P; [| Q'; P==>False |] ==> Q |] ==> P|Q";
-by (cut_facts_tac [major] 1);
-by (blast_tac (claset() addIs prems) 1);
-qed "disj_forward2";
-
-val major::prems = Goal
- "[| ALL x. P'(x); !!x. P'(x) ==> P(x) |] ==> ALL x. P(x)";
-by (rtac allI 1);
-by (resolve_tac prems 1);
-by (rtac (major RS spec) 1);
-qed "all_forward";
-
-val major::prems = Goal
- "[| EX x. P'(x); !!x. P'(x) ==> P(x) |] ==> EX x. P(x)";
-by (rtac (major RS exE) 1);
-by (rtac exI 1);
-by (eresolve_tac prems 1);
-qed "ex_forward";