# HG changeset patch # User huffman # Date 1269850021 25200 # Node ID a5e7574d8214aa92308551134de90d2f2a9fd1ec # Parent 9cdbc5ffc15c481501c4f241dd554db12dfbd0c0# Parent 7ddc33baf959c44d0693e4231230d7148eb659bb merged diff -r 7ddc33baf959 -r a5e7574d8214 src/HOL/Lattices.thy --- a/src/HOL/Lattices.thy Mon Mar 29 09:06:34 2010 +0200 +++ b/src/HOL/Lattices.thy Mon Mar 29 01:07:01 2010 -0700 @@ -90,10 +90,10 @@ by (rule order_trans) auto lemma le_infI: "x \ a \ x \ b \ x \ a \ b" - by (blast intro: inf_greatest) + by (rule inf_greatest) (* FIXME: duplicate lemma *) lemma le_infE: "x \ a \ b \ (x \ a \ x \ b \ P) \ P" - by (blast intro: order_trans le_infI1 le_infI2) + by (blast intro: order_trans inf_le1 inf_le2) lemma le_inf_iff [simp]: "x \ y \ z \ x \ y \ x \ z" @@ -103,6 +103,9 @@ "x \ y \ x \ y = x" by (auto intro: le_infI1 antisym dest: eq_iff [THEN iffD1]) +lemma inf_mono: "a \ c \ b \ d \ a \ b \ c \ d" + by (fast intro: inf_greatest le_infI1 le_infI2) + lemma mono_inf: fixes f :: "'a \ 'b\semilattice_inf" shows "mono f \ f (A \ B) \ f A \ f B" @@ -123,11 +126,11 @@ lemma le_supI: "a \ x \ b \ x \ a \ b \ x" - by (blast intro: sup_least) + by (rule sup_least) (* FIXME: duplicate lemma *) lemma le_supE: "a \ b \ x \ (a \ x \ b \ x \ P) \ P" - by (blast intro: le_supI1 le_supI2 order_trans) + by (blast intro: order_trans sup_ge1 sup_ge2) lemma le_sup_iff [simp]: "x \ y \ z \ x \ z \ y \ z" @@ -137,6 +140,9 @@ "x \ y \ x \ y = y" by (auto intro: le_supI2 antisym dest: eq_iff [THEN iffD1]) +lemma sup_mono: "a \ c \ b \ d \ a \ b \ c \ d" + by (fast intro: sup_least le_supI1 le_supI2) + lemma mono_sup: fixes f :: "'a \ 'b\semilattice_sup" shows "mono f \ f A \ f B \ f (A \ B)" @@ -345,6 +351,12 @@ by (rule distrib_lattice.intro, rule dual_lattice) (unfold_locales, fact inf_sup_distrib1) +lemmas sup_inf_distrib = + sup_inf_distrib1 sup_inf_distrib2 + +lemmas inf_sup_distrib = + inf_sup_distrib1 inf_sup_distrib2 + lemmas distrib = sup_inf_distrib1 sup_inf_distrib2 inf_sup_distrib1 inf_sup_distrib2 @@ -393,39 +405,13 @@ "x \ \ = x" by (rule sup_absorb1) simp -lemma inf_eq_top_eq1: - assumes "A \ B = \" - shows "A = \" -proof (cases "B = \") - case True with assms show ?thesis by simp -next - case False with top_greatest have "B \ \" by (auto intro: neq_le_trans) - then have "A \ B \ \" by (rule less_infI2) - with assms show ?thesis by simp -qed - -lemma inf_eq_top_eq2: - assumes "A \ B = \" - shows "B = \" - by (rule inf_eq_top_eq1, unfold inf_commute [of B]) (fact assms) +lemma inf_eq_top_iff [simp]: + "x \ y = \ \ x = \ \ y = \" + by (simp add: eq_iff) -lemma sup_eq_bot_eq1: - assumes "A \ B = \" - shows "A = \" -proof - - interpret dual: bounded_lattice "op \" "op >" "op \" "op \" \ \ - by (rule dual_bounded_lattice) - from dual.inf_eq_top_eq1 assms show ?thesis . -qed - -lemma sup_eq_bot_eq2: - assumes "A \ B = \" - shows "B = \" -proof - - interpret dual: bounded_lattice "op \" "op >" "op \" "op \" \ \ - by (rule dual_bounded_lattice) - from dual.inf_eq_top_eq2 assms show ?thesis . -qed +lemma sup_eq_bot_iff [simp]: + "x \ y = \ \ x = \ \ y = \" + by (simp add: eq_iff) end @@ -472,10 +458,7 @@ "- x = - y \ x = y" proof assume "- x = - y" - then have "- x \ y = \" - and "- x \ y = \" - by (simp_all add: compl_inf_bot compl_sup_top) - then have "- (- x) = y" by (rule compl_unique) + then have "- (- x) = - (- y)" by (rule arg_cong) then show "x = y" by simp next assume "x = y" @@ -499,18 +482,14 @@ lemma compl_inf [simp]: "- (x \ y) = - x \ - y" proof (rule compl_unique) - have "(x \ y) \ (- x \ - y) = ((x \ y) \ - x) \ ((x \ y) \ - y)" - by (rule inf_sup_distrib1) - also have "... = (y \ (x \ - x)) \ (x \ (y \ - y))" - by (simp only: inf_commute inf_assoc inf_left_commute) - finally show "(x \ y) \ (- x \ - y) = \" + have "(x \ y) \ (- x \ - y) = (y \ (x \ - x)) \ (x \ (y \ - y))" + by (simp only: inf_sup_distrib inf_aci) + then show "(x \ y) \ (- x \ - y) = \" by (simp add: inf_compl_bot) next - have "(x \ y) \ (- x \ - y) = (x \ (- x \ - y)) \ (y \ (- x \ - y))" - by (rule sup_inf_distrib2) - also have "... = (- y \ (x \ - x)) \ (- x \ (y \ - y))" - by (simp only: sup_commute sup_assoc sup_left_commute) - finally show "(x \ y) \ (- x \ - y) = \" + have "(x \ y) \ (- x \ - y) = (- y \ (x \ - x)) \ (- x \ (y \ - y))" + by (simp only: sup_inf_distrib sup_aci) + then show "(x \ y) \ (- x \ - y) = \" by (simp add: sup_compl_top) qed @@ -522,6 +501,21 @@ then show ?thesis by simp qed +lemma compl_mono: + "x \ y \ - y \ - x" +proof - + assume "x \ y" + then have "x \ y = y" by (simp only: le_iff_sup) + then have "- (x \ y) = - y" by simp + then have "- x \ - y = - y" by simp + then have "- y \ - x = - y" by (simp only: inf_commute) + then show "- y \ - x" by (simp only: le_iff_inf) +qed + +lemma compl_le_compl_iff: (* TODO: declare [simp] ? *) + "- x \ - y \ y \ x" +by (auto dest: compl_mono) + end @@ -550,7 +544,7 @@ have leI: "\x y z. x \ z \ y \ z \ x \ y \ z" by (blast intro: least) show "x \ y \ x \ y" by (rule leI) simp_all qed - + subsection {* @{const min}/@{const max} on linear orders as special case of @{const inf}/@{const sup} *} diff -r 7ddc33baf959 -r a5e7574d8214 src/HOL/Predicate.thy --- a/src/HOL/Predicate.thy Mon Mar 29 09:06:34 2010 +0200 +++ b/src/HOL/Predicate.thy Mon Mar 29 01:07:01 2010 -0700 @@ -516,7 +516,7 @@ lemma is_empty_sup: "is_empty (A \ B) \ is_empty A \ is_empty B" - by (auto simp add: is_empty_def intro: sup_eq_bot_eq1 sup_eq_bot_eq2) + by (auto simp add: is_empty_def) definition singleton :: "(unit => 'a) \ 'a pred \ 'a" where "singleton dfault A = (if \!x. eval A x then THE x. eval A x else dfault ())" diff -r 7ddc33baf959 -r a5e7574d8214 src/HOL/Set.thy --- a/src/HOL/Set.thy Mon Mar 29 09:06:34 2010 +0200 +++ b/src/HOL/Set.thy Mon Mar 29 01:07:01 2010 -0700 @@ -507,7 +507,6 @@ apply (rule Collect_mem_eq) done -(* Due to Brian Huffman *) lemma expand_set_eq: "(A = B) = (ALL x. (x:A) = (x:B))" by(auto intro:set_ext) @@ -1002,25 +1001,25 @@ text {* \medskip Finite Union -- the least upper bound of two sets. *} lemma Un_upper1: "A \ A \ B" - by blast + by (fact sup_ge1) lemma Un_upper2: "B \ A \ B" - by blast + by (fact sup_ge2) lemma Un_least: "A \ C ==> B \ C ==> A \ B \ C" - by blast + by (fact sup_least) text {* \medskip Finite Intersection -- the greatest lower bound of two sets. *} lemma Int_lower1: "A \ B \ A" - by blast + by (fact inf_le1) lemma Int_lower2: "A \ B \ B" - by blast + by (fact inf_le2) lemma Int_greatest: "C \ A ==> C \ B ==> C \ A \ B" - by blast + by (fact inf_greatest) text {* \medskip Set difference. *} @@ -1166,34 +1165,34 @@ text {* \medskip @{text Int} *} lemma Int_absorb [simp]: "A \ A = A" - by blast + by (fact inf_idem) lemma Int_left_absorb: "A \ (A \ B) = A \ B" - by blast + by (fact inf_left_idem) lemma Int_commute: "A \ B = B \ A" - by blast + by (fact inf_commute) lemma Int_left_commute: "A \ (B \ C) = B \ (A \ C)" - by blast + by (fact inf_left_commute) lemma Int_assoc: "(A \ B) \ C = A \ (B \ C)" - by blast + by (fact inf_assoc) lemmas Int_ac = Int_assoc Int_left_absorb Int_commute Int_left_commute -- {* Intersection is an AC-operator *} lemma Int_absorb1: "B \ A ==> A \ B = B" - by blast + by (fact inf_absorb2) lemma Int_absorb2: "A \ B ==> A \ B = A" - by blast + by (fact inf_absorb1) lemma Int_empty_left [simp]: "{} \ B = {}" - by blast + by (fact inf_bot_left) lemma Int_empty_right [simp]: "A \ {} = {}" - by blast + by (fact inf_bot_right) lemma disjoint_eq_subset_Compl: "(A \ B = {}) = (A \ -B)" by blast @@ -1202,22 +1201,22 @@ by blast lemma Int_UNIV_left [simp]: "UNIV \ B = B" - by blast + by (fact inf_top_left) lemma Int_UNIV_right [simp]: "A \ UNIV = A" - by blast + by (fact inf_top_right) lemma Int_Un_distrib: "A \ (B \ C) = (A \ B) \ (A \ C)" - by blast + by (fact inf_sup_distrib1) lemma Int_Un_distrib2: "(B \ C) \ A = (B \ A) \ (C \ A)" - by blast + by (fact inf_sup_distrib2) lemma Int_UNIV [simp,no_atp]: "(A \ B = UNIV) = (A = UNIV & B = UNIV)" - by blast + by (fact inf_eq_top_iff) lemma Int_subset_iff [simp]: "(C \ A \ B) = (C \ A & C \ B)" - by blast + by (fact le_inf_iff) lemma Int_Collect: "(x \ A \ {x. P x}) = (x \ A & P x)" by blast @@ -1226,40 +1225,40 @@ text {* \medskip @{text Un}. *} lemma Un_absorb [simp]: "A \ A = A" - by blast + by (fact sup_idem) lemma Un_left_absorb: "A \ (A \ B) = A \ B" - by blast + by (fact sup_left_idem) lemma Un_commute: "A \ B = B \ A" - by blast + by (fact sup_commute) lemma Un_left_commute: "A \ (B \ C) = B \ (A \ C)" - by blast + by (fact sup_left_commute) lemma Un_assoc: "(A \ B) \ C = A \ (B \ C)" - by blast + by (fact sup_assoc) lemmas Un_ac = Un_assoc Un_left_absorb Un_commute Un_left_commute -- {* Union is an AC-operator *} lemma Un_absorb1: "A \ B ==> A \ B = B" - by blast + by (fact sup_absorb2) lemma Un_absorb2: "B \ A ==> A \ B = A" - by blast + by (fact sup_absorb1) lemma Un_empty_left [simp]: "{} \ B = B" - by blast + by (fact sup_bot_left) lemma Un_empty_right [simp]: "A \ {} = A" - by blast + by (fact sup_bot_right) lemma Un_UNIV_left [simp]: "UNIV \ B = UNIV" - by blast + by (fact sup_top_left) lemma Un_UNIV_right [simp]: "A \ UNIV = UNIV" - by blast + by (fact sup_top_right) lemma Un_insert_left [simp]: "(insert a B) \ C = insert a (B \ C)" by blast @@ -1292,23 +1291,23 @@ by auto lemma Un_Int_distrib: "A \ (B \ C) = (A \ B) \ (A \ C)" - by blast + by (fact sup_inf_distrib1) lemma Un_Int_distrib2: "(B \ C) \ A = (B \ A) \ (C \ A)" - by blast + by (fact sup_inf_distrib2) lemma Un_Int_crazy: "(A \ B) \ (B \ C) \ (C \ A) = (A \ B) \ (B \ C) \ (C \ A)" by blast lemma subset_Un_eq: "(A \ B) = (A \ B = B)" - by blast + by (fact le_iff_sup) lemma Un_empty [iff]: "(A \ B = {}) = (A = {} & B = {})" - by blast + by (fact sup_eq_bot_iff) lemma Un_subset_iff [simp]: "(A \ B \ C) = (A \ C & B \ C)" - by blast + by (fact le_sup_iff) lemma Un_Diff_Int: "(A - B) \ (A \ B) = A" by blast @@ -1320,25 +1319,25 @@ text {* \medskip Set complement *} lemma Compl_disjoint [simp]: "A \ -A = {}" - by blast + by (fact inf_compl_bot) lemma Compl_disjoint2 [simp]: "-A \ A = {}" - by blast + by (fact compl_inf_bot) lemma Compl_partition: "A \ -A = UNIV" - by blast + by (fact sup_compl_top) lemma Compl_partition2: "-A \ A = UNIV" - by blast + by (fact compl_sup_top) lemma double_complement [simp]: "- (-A) = (A::'a set)" - by blast + by (fact double_compl) lemma Compl_Un [simp]: "-(A \ B) = (-A) \ (-B)" - by blast + by (fact compl_sup) lemma Compl_Int [simp]: "-(A \ B) = (-A) \ (-B)" - by blast + by (fact compl_inf) lemma subset_Compl_self_eq: "(A \ -A) = (A = {})" by blast @@ -1348,16 +1347,16 @@ by blast lemma Compl_UNIV_eq [simp]: "-UNIV = {}" - by blast + by (fact compl_top_eq) lemma Compl_empty_eq [simp]: "-{} = UNIV" - by blast + by (fact compl_bot_eq) lemma Compl_subset_Compl_iff [iff]: "(-A \ -B) = (B \ A)" - by blast + by (fact compl_le_compl_iff) lemma Compl_eq_Compl_iff [iff]: "(-A = -B) = (A = (B::'a set))" - by blast + by (fact compl_eq_compl_iff) text {* \medskip Bounded quantifiers. @@ -1531,16 +1530,16 @@ by blast lemma Un_mono: "A \ C ==> B \ D ==> A \ B \ C \ D" - by blast + by (fact sup_mono) lemma Int_mono: "A \ C ==> B \ D ==> A \ B \ C \ D" - by blast + by (fact inf_mono) lemma Diff_mono: "A \ C ==> D \ B ==> A - B \ C - D" by blast lemma Compl_anti_mono: "A \ B ==> -B \ -A" - by blast + by (fact compl_mono) text {* \medskip Monotonicity of implications. *} diff -r 7ddc33baf959 -r a5e7574d8214 src/HOL/SupInf.thy --- a/src/HOL/SupInf.thy Mon Mar 29 09:06:34 2010 +0200 +++ b/src/HOL/SupInf.thy Mon Mar 29 01:07:01 2010 -0700 @@ -106,10 +106,10 @@ proof (cases "Sup X \ a") case True thus ?thesis - apply (simp add: max_def) + apply (simp add: max_def) apply (rule Sup_eq_maximum) - apply (metis insertCI) - apply (metis Sup_upper insertE le_iff_sup real_le_linear real_le_trans sup_absorb1 z) + apply (rule insertI1) + apply (metis Sup_upper [OF _ z] insertE real_le_linear real_le_trans) done next case False @@ -177,7 +177,7 @@ fixes S :: "real set" assumes fS: "finite S" and Se: "S \ {}" shows "a \ Sup S \ (\ x \ S. a \ x)" -by (metis Max_ge Se Sup_finite_Max Sup_finite_in fS le_iff_sup real_le_trans) +by (metis Max_ge Se Sup_finite_Max Sup_finite_in fS real_le_trans) lemma Sup_finite_gt_iff: fixes S :: "real set" @@ -331,8 +331,8 @@ have "Inf (insert a X) \ Inf X" apply (rule Inf_greatest) apply (metis empty_psubset_nonempty psubset_eq x) - apply (rule Inf_lower_EX) - apply (blast intro: elim:) + apply (rule Inf_lower_EX) + apply (erule insertI2) apply (metis insert_iff real_le_linear real_le_refl real_le_trans z) done moreover