# HG changeset patch # User haftmann # Date 1310927019 -7200 # Node ID 58be172c6ca4f3ca45f899a9813071d24adfd8b9 # Parent 58a7b3fdc193cab136b1f01c5858ace8873c2084# Parent 9684251c7ec1d5511342d9782b7e77c2c4a68110 merged diff -r 58a7b3fdc193 -r 58be172c6ca4 NEWS --- a/NEWS Sun Jul 17 14:21:19 2011 +0200 +++ b/NEWS Sun Jul 17 20:23:39 2011 +0200 @@ -63,6 +63,11 @@ * Classes bot and top require underlying partial order rather than preorder: uniqueness of bot and top is guaranteed. INCOMPATIBILITY. +* Class 'complete_lattice': generalized a couple of lemmas from sets; +generalized theorems INF_cong and SUP_cong. More consistent names: TBD. + +INCOMPATIBILITY. + * Archimedian_Field.thy: floor now is defined as parameter of a separate type class floor_ceiling. diff -r 58a7b3fdc193 -r 58be172c6ca4 src/HOL/Complete_Lattice.thy --- a/src/HOL/Complete_Lattice.thy Sun Jul 17 14:21:19 2011 +0200 +++ b/src/HOL/Complete_Lattice.thy Sun Jul 17 20:23:39 2011 +0200 @@ -33,7 +33,7 @@ begin lemma dual_complete_lattice: - "class.complete_lattice Sup Inf (op \) (op >) (op \) (op \) \ \" + "class.complete_lattice Sup Inf (op \) (op >) sup inf \ \" by (auto intro!: class.complete_lattice.intro dual_bounded_lattice) (unfold_locales, (fact bot_least top_greatest Sup_upper Sup_least Inf_lower Inf_greatest)+) @@ -109,10 +109,79 @@ qed lemma Sup_upper2: "u \ A \ v \ u \ v \ \A" - using Sup_upper[of u A] by auto + using Sup_upper [of u A] by auto lemma Inf_lower2: "u \ A \ u \ v \ \A \ v" - using Inf_lower[of u A] by auto + using Inf_lower [of u A] by auto + +lemma Inf_less_eq: + assumes "\v. v \ A \ v \ u" + and "A \ {}" + shows "\A \ u" +proof - + from `A \ {}` obtain v where "v \ A" by blast + moreover with assms have "v \ u" by blast + ultimately show ?thesis by (rule Inf_lower2) +qed + +lemma less_eq_Sup: + assumes "\v. v \ A \ u \ v" + and "A \ {}" + shows "u \ \A" +proof - + from `A \ {}` obtain v where "v \ A" by blast + moreover with assms have "u \ v" by blast + ultimately show ?thesis by (rule Sup_upper2) +qed + +lemma Inf_inter_less_eq: "\A \ \B \ \(A \ B)" + by (auto intro: Inf_greatest Inf_lower) + +lemma Sup_inter_greater_eq: "\(A \ B) \ \A \ \B " + by (auto intro: Sup_least Sup_upper) + +lemma Inf_union_distrib: "\(A \ B) = \A \ \B" + by (rule antisym) (auto intro: Inf_greatest Inf_lower le_infI1 le_infI2) + +lemma Sup_union_distrib: "\(A \ B) = \A \ \B" + by (rule antisym) (auto intro: Sup_least Sup_upper le_supI1 le_supI2) + +lemma Inf_top_conv [no_atp]: + "\A = \ \ (\x\A. x = \)" + "\ = \A \ (\x\A. x = \)" +proof - + show "\A = \ \ (\x\A. x = \)" + proof + assume "\x\A. x = \" + then have "A = {} \ A = {\}" by auto + then show "\A = \" by auto + next + assume "\A = \" + show "\x\A. x = \" + proof (rule ccontr) + assume "\ (\x\A. x = \)" + then obtain x where "x \ A" and "x \ \" by blast + then obtain B where "A = insert x B" by blast + with `\A = \` `x \ \` show False by (simp add: Inf_insert) + qed + qed + then show "\ = \A \ (\x\A. x = \)" by auto +qed + +lemma Sup_bot_conv [no_atp]: + "\A = \ \ (\x\A. x = \)" (is ?P) + "\ = \A \ (\x\A. x = \)" (is ?Q) +proof - + interpret dual: complete_lattice Sup Inf "op \" "op >" sup inf \ \ + by (fact dual_complete_lattice) + from dual.Inf_top_conv show ?P and ?Q by simp_all +qed + +lemma Inf_anti_mono: "B \ A \ \A \ \B" + by (auto intro: Inf_greatest Inf_lower) + +lemma Sup_anti_mono: "A \ B \ \A \ \B" + by (auto intro: Sup_least Sup_upper) definition INFI :: "'b set \ ('b \ 'a) \ 'a" where "INFI A f = \ (f ` A)" @@ -152,66 +221,116 @@ context complete_lattice begin -lemma SUP_cong: "(\x. x \ A \ f x = g x) \ SUPR A f = SUPR A g" - by (simp add: SUPR_def cong: image_cong) - -lemma INF_cong: "(\x. x \ A \ f x = g x) \ INFI A f = INFI A g" - by (simp add: INFI_def cong: image_cong) +lemma INF_empty: "(\x\{}. f x) = \" + by (simp add: INFI_def) -lemma le_SUPI: "i \ A \ M i \ (\i\A. M i)" - by (auto simp add: SUPR_def intro: Sup_upper) +lemma INF_insert: "(\x\insert a A. f x) = f a \ INFI A f" + by (simp add: INFI_def Inf_insert) -lemma le_SUPI2: "i \ A \ u \ M i \ u \ (\i\A. M i)" - using le_SUPI[of i A M] by auto - -lemma SUP_leI: "(\i. i \ A \ M i \ u) \ (\i\A. M i) \ u" - by (auto simp add: SUPR_def intro: Sup_least) - -lemma INF_leI: "i \ A \ (\i\A. M i) \ M i" +lemma INF_leI: "i \ A \ (\i\A. f i) \ f i" by (auto simp add: INFI_def intro: Inf_lower) -lemma INF_leI2: "i \ A \ M i \ u \ (\i\A. M i) \ u" - using INF_leI[of i A M] by auto +lemma INF_leI2: "i \ A \ f i \ u \ (\i\A. f i) \ u" + using INF_leI [of i A f] by auto -lemma le_INFI: "(\i. i \ A \ u \ M i) \ u \ (\i\A. M i)" +lemma le_INFI: "(\i. i \ A \ u \ f i) \ u \ (\i\A. f i)" by (auto simp add: INFI_def intro: Inf_greatest) -lemma SUP_le_iff: "(\i\A. M i) \ u \ (\i \ A. M i \ u)" - unfolding SUPR_def by (auto simp add: Sup_le_iff) +lemma le_INF_iff: "u \ (\i\A. f i) \ (\i \ A. u \ f i)" + by (auto simp add: INFI_def le_Inf_iff) -lemma le_INF_iff: "u \ (\i\A. M i) \ (\i \ A. u \ M i)" - unfolding INFI_def by (auto simp add: le_Inf_iff) - -lemma INF_const[simp]: "A \ {} \ (\i\A. M) = M" +lemma INF_const [simp]: "A \ {} \ (\i\A. f) = f" by (auto intro: antisym INF_leI le_INFI) -lemma SUP_const[simp]: "A \ {} \ (\i\A. M) = M" - by (auto intro: antisym SUP_leI le_SUPI) +lemma INF_cong: + "A = B \ (\x. x \ B \ C x = D x) \ (\x\A. C x) = (\x\B. D x)" + by (simp add: INFI_def image_def) lemma INF_mono: "(\m. m \ B \ \n\A. f n \ g m) \ (\n\A. f n) \ (\n\B. g n)" by (force intro!: Inf_mono simp: INFI_def) +lemma INF_subset: "A \ B \ INFI B f \ INFI A f" + by (intro INF_mono) auto + +lemma INF_commute: "(\i\A. \j\B. f i j) = (\j\B. \i\A. f i j)" + by (iprover intro: INF_leI le_INFI order_trans antisym) + +lemma (in complete_lattice) INFI_empty: + "(\x\{}. B x) = \" + by (simp add: INFI_def) + +lemma (in complete_lattice) INFI_absorb: + assumes "k \ I" + shows "A k \ (\i\I. A i) = (\i\I. A i)" +proof - + from assms obtain J where "I = insert k J" by blast + then show ?thesis by (simp add: INF_insert) +qed + +lemma (in complete_lattice) INF_union: + "(\i \ A \ B. M i) = (\i \ A. M i) \ (\i\B. M i)" + by (auto intro!: antisym INF_mono intro: le_infI1 le_infI2 le_INFI INF_leI) + +lemma (in complete_lattice) INF_constant: + "(\y\A. c) = (if A = {} then \ else c)" + by (simp add: INF_empty) + +lemma (in complete_lattice) INF_eq: + "(\x\A. B x) = \({Y. \x\A. Y = B x})" + by (simp add: INFI_def image_def) + +lemma (in complete_lattice) INF_top_conv: + "\ = (\x\A. B x) \ (\x\A. B x = \)" + "(\x\A. B x) = \ \ (\x\A. B x = \)" + by (auto simp add: INFI_def Inf_top_conv) + +lemma (in complete_lattice) INFI_UNIV_range: + "(\x\UNIV. f x) = \range f" + by (simp add: INFI_def) + +lemma (in complete_lattice) INF_bool_eq: + "(\b. A b) = A True \ A False" + by (simp add: UNIV_bool INF_empty INF_insert inf_commute) + +lemma (in complete_lattice) INF_anti_mono: + "B \ A \ (\x. x \ A \ f x \ g x) \ (\x\B. f x) \ (\x\B. g x)" + -- {* The last inclusion is POSITIVE! *} + by (blast intro: INF_mono dest: subsetD) + +lemma SUP_cong: + "A = B \ (\x. x \ B \ C x = D x) \ (\x\A. C x) = (\x\B. D x)" + by (simp add: SUPR_def image_def) + +lemma le_SUPI: "i \ A \ f i \ (\i\A. f i)" + by (auto simp add: SUPR_def intro: Sup_upper) + +lemma le_SUPI2: "i \ A \ u \ f i \ u \ (\i\A. f i)" + using le_SUPI [of i A f] by auto + +lemma SUP_leI: "(\i. i \ A \ f i \ u) \ (\i\A. f i) \ u" + by (auto simp add: SUPR_def intro: Sup_least) + +lemma SUP_le_iff: "(\i\A. f i) \ u \ (\i \ A. f i \ u)" + unfolding SUPR_def by (auto simp add: Sup_le_iff) + +lemma SUP_const [simp]: "A \ {} \ (\i\A. f) = f" + by (auto intro: antisym SUP_leI le_SUPI) + lemma SUP_mono: "(\n. n \ A \ \m\B. f n \ g m) \ (\n\A. f n) \ (\n\B. g n)" by (force intro!: Sup_mono simp: SUPR_def) -lemma INF_subset: "A \ B \ INFI B f \ INFI A f" - by (intro INF_mono) auto - lemma SUP_subset: "A \ B \ SUPR A f \ SUPR B f" by (intro SUP_mono) auto -lemma INF_commute: "(\i\A. \j\B. f i j) = (\j\B. \i\A. f i j)" - by (iprover intro: INF_leI le_INFI order_trans antisym) - lemma SUP_commute: "(\i\A. \j\B. f i j) = (\j\B. \i\A. f i j)" by (iprover intro: SUP_leI le_SUPI order_trans antisym) -lemma INFI_insert: "(\x\insert a A. B x) = B a \ INFI A B" - by (simp add: INFI_def Inf_insert) +lemma SUP_empty: "(\x\{}. f x) = \" + by (simp add: SUPR_def) -lemma SUPR_insert: "(\x\insert a A. B x) = B a \ SUPR A B" +lemma SUP_insert: "(\x\insert a A. f x) = f a \ SUPR A f" by (simp add: SUPR_def Sup_insert) end @@ -221,16 +340,16 @@ shows "\S \ a \ (\x\S. x \ a)" unfolding not_le [symmetric] le_Inf_iff by auto +lemma INF_less_iff: + fixes a :: "'a::{complete_lattice,linorder}" + shows "(\i\A. f i) \ a \ (\x\A. f x \ a)" + unfolding INFI_def Inf_less_iff by auto + lemma less_Sup_iff: fixes a :: "'a\{complete_lattice,linorder}" shows "a \ \S \ (\x\S. a \ x)" unfolding not_le [symmetric] Sup_le_iff by auto -lemma INF_less_iff: - fixes a :: "'a::{complete_lattice,linorder}" - shows "(\i\A. f i) \ a \ (\x\A. f x \ a)" - unfolding INFI_def Inf_less_iff by auto - lemma less_SUP_iff: fixes a :: "'a::{complete_lattice,linorder}" shows "a \ (\i\A. f i) \ (\x\A. a \ f x)" @@ -343,16 +462,6 @@ lemma Inter_lower: "B \ A \ \A \ B" by (fact Inf_lower) -lemma (in complete_lattice) Inf_less_eq: - assumes "\v. v \ A \ v \ u" - and "A \ {}" - shows "\A \ u" -proof - - from `A \ {}` obtain v where "v \ A" by blast - moreover with assms have "v \ u" by blast - ultimately show ?thesis by (rule Inf_lower2) -qed - lemma Inter_subset: "(\X. X \ A \ X \ B) \ A \ {} \ \A \ B" by (fact Inf_less_eq) @@ -372,48 +481,17 @@ lemma Inter_insert [simp]: "\(insert a B) = a \ \B" by (fact Inf_insert) -lemma (in complete_lattice) Inf_inter_less: "\A \ \B \ \(A \ B)" - by (auto intro: Inf_greatest Inf_lower) - lemma Inter_Un_subset: "\A \ \B \ \(A \ B)" - by (fact Inf_inter_less) - -lemma (in complete_lattice) Inf_union_distrib: "\(A \ B) = \A \ \B" - by (rule antisym) (auto intro: Inf_greatest Inf_lower le_infI1 le_infI2) + by (fact Inf_inter_less_eq) lemma Inter_Un_distrib: "\(A \ B) = \A \ \B" by (fact Inf_union_distrib) -lemma (in complete_lattice) Inf_top_conv [no_atp]: - "\A = \ \ (\x\A. x = \)" - "\ = \A \ (\x\A. x = \)" -proof - - show "\A = \ \ (\x\A. x = \)" - proof - assume "\x\A. x = \" - then have "A = {} \ A = {\}" by auto - then show "\A = \" by auto - next - assume "\A = \" - show "\x\A. x = \" - proof (rule ccontr) - assume "\ (\x\A. x = \)" - then obtain x where "x \ A" and "x \ \" by blast - then obtain B where "A = insert x B" by blast - with `\A = \` `x \ \` show False by (simp add: Inf_insert) - qed - qed - then show "\ = \A \ (\x\A. x = \)" by auto -qed - -lemma Inter_UNIV_conv [simp,no_atp]: +lemma Inter_UNIV_conv [simp, no_atp]: "\A = UNIV \ (\x\A. x = UNIV)" "UNIV = \A \ (\x\A. x = UNIV)" by (fact Inf_top_conv)+ -lemma (in complete_lattice) Inf_anti_mono: "B \ A \ \A \ \B" - by (auto intro: Inf_greatest Inf_lower) - lemma Inter_anti_mono: "B \ A \ \A \ \B" by (fact Inf_anti_mono) @@ -474,13 +552,9 @@ -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a\A"}. *} by (unfold INTER_def) blast -lemma (in complete_lattice) INFI_cong: - "A = B \ (\x. x \ B \ C x = D x) \ (\x\A. C x) = (\x\B. D x)" - by (simp add: INFI_def image_def) - lemma INT_cong [cong]: "A = B \ (\x. x \ B \ C x = D x) \ (\x\A. C x) = (\x\B. D x)" - by (fact INFI_cong) + by (fact INF_cong) lemma Collect_ball_eq: "{x. \y\A. P x y} = (\y\A. {x. P x y})" by blast @@ -494,21 +568,9 @@ lemma INT_greatest: "(\x. x \ A \ C \ B x) \ C \ (\x\A. B x)" by (fact le_INFI) -lemma (in complete_lattice) INFI_empty: - "(\x\{}. B x) = \" - by (simp add: INFI_def) - lemma INT_empty [simp]: "(\x\{}. B x) = UNIV" by (fact INFI_empty) -lemma (in complete_lattice) INFI_absorb: - assumes "k \ I" - shows "A k \ (\i\I. A i) = (\i\I. A i)" -proof - - from assms obtain J where "I = insert k J" by blast - then show ?thesis by (simp add: INFI_insert) -qed - lemma INT_absorb: "k \ I \ A k \ (\i\I. A i) = (\i\I. A i)" by (fact INFI_absorb) @@ -516,41 +578,38 @@ by (fact le_INF_iff) lemma INT_insert [simp]: "(\x \ insert a A. B x) = B a \ INTER A B" - by (fact INFI_insert) - --- {* continue generalization from here *} + by (fact INF_insert) lemma INT_Un: "(\i \ A \ B. M i) = (\i \ A. M i) \ (\i\B. M i)" - by blast + by (fact INF_union) lemma INT_insert_distrib: - "u \ A \ (\x\A. insert a (B x)) = insert a (\x\A. B x)" + "u \ A \ (\x\A. insert a (B x)) = insert a (\x\A. B x)" by blast lemma INT_constant [simp]: "(\y\A. c) = (if A = {} then UNIV else c)" - by auto + by (fact INF_constant) lemma INT_eq: "(\x\A. B x) = \({Y. \x\A. Y = B x})" -- {* Look: it has an \emph{existential} quantifier *} - by blast + by (fact INF_eq) lemma INTER_UNIV_conv [simp]: "(UNIV = (\x\A. B x)) = (\x\A. B x = UNIV)" "((\x\A. B x) = UNIV) = (\x\A. B x = UNIV)" - by blast+ + by (fact INF_top_conv)+ + +lemma INT_bool_eq: "(\b. A b) = A True \ A False" + by (fact INF_bool_eq) -lemma INT_bool_eq: "(\b. A b) = (A True \ A False)" - by (auto intro: bool_induct) +lemma INT_anti_mono: + "B \ A \ (\x. x \ A \ f x \ g x) \ (\x\B. f x) \ (\x\B. g x)" + -- {* The last inclusion is POSITIVE! *} + by (fact INF_anti_mono) lemma Pow_INT_eq: "Pow (\x\A. B x) = (\x\A. Pow (B x))" by blast -lemma INT_anti_mono: - "B \ A \ (\x. x \ A \ f x \ g x) \ - (\x\A. f x) \ (\x\A. g x)" - -- {* The last inclusion is POSITIVE! *} - by (blast dest: subsetD) - lemma vimage_INT: "f -` (\x\A. B x) = (\x\A. f -` B x)" by blast diff -r 58a7b3fdc193 -r 58be172c6ca4 src/HOL/Finite_Set.thy --- a/src/HOL/Finite_Set.thy Sun Jul 17 14:21:19 2011 +0200 +++ b/src/HOL/Finite_Set.thy Sun Jul 17 20:23:39 2011 +0200 @@ -477,20 +477,14 @@ lemma finite [simp]: "finite (A \ 'a set)" by (rule subset_UNIV finite_UNIV finite_subset)+ -lemma finite_code [code]: "finite (A \ 'a set) = True" +lemma finite_code [code]: "finite (A \ 'a set) \ True" by simp end -lemma UNIV_unit [no_atp]: - "UNIV = {()}" by auto - instance unit :: finite proof qed (simp add: UNIV_unit) -lemma UNIV_bool [no_atp]: - "UNIV = {False, True}" by auto - instance bool :: finite proof qed (simp add: UNIV_bool) diff -r 58a7b3fdc193 -r 58be172c6ca4 src/HOL/Product_Type.thy --- a/src/HOL/Product_Type.thy Sun Jul 17 14:21:19 2011 +0200 +++ b/src/HOL/Product_Type.thy Sun Jul 17 20:23:39 2011 +0200 @@ -84,9 +84,12 @@ f} rather than by @{term [source] "%u. f ()"}. *} -lemma unit_abs_eta_conv [simp,no_atp]: "(%u::unit. f ()) = f" +lemma unit_abs_eta_conv [simp, no_atp]: "(%u::unit. f ()) = f" by (rule ext) simp +lemma UNIV_unit [no_atp]: + "UNIV = {()}" by auto + instantiation unit :: default begin diff -r 58a7b3fdc193 -r 58be172c6ca4 src/HOL/Set.thy --- a/src/HOL/Set.thy Sun Jul 17 14:21:19 2011 +0200 +++ b/src/HOL/Set.thy Sun Jul 17 20:23:39 2011 +0200 @@ -1487,6 +1487,9 @@ lemma ex_bool_eq: "(\b. P b) \ P True \ P False" by (auto intro: bool_contrapos) +lemma UNIV_bool [no_atp]: "UNIV = {False, True}" + by (auto intro: bool_induct) + text {* \medskip @{text Pow} *} lemma Pow_empty [simp]: "Pow {} = {{}}"