# HG changeset patch # User paulson # Date 1534259140 -3600 # Node ID 345ce5f262eafe85216a9c93f92d46fb895988b2 # Parent 64fb127e33f785f201b9c6cc3c893eca539301c5 Zorn's lemma for relations defined by predicates diff -r 64fb127e33f7 -r 345ce5f262ea src/HOL/Cardinals/Wellorder_Extension.thy --- a/src/HOL/Cardinals/Wellorder_Extension.thy Sun Aug 12 14:31:46 2018 +0200 +++ b/src/HOL/Cardinals/Wellorder_Extension.thy Tue Aug 14 16:05:40 2018 +0100 @@ -110,7 +110,8 @@ using mono_Chains [OF I_init] and \R \ Chains I\ by (simp (no_asm) add: I_def del: Field_Union) (metis Chains_wo) } - then have 1: "\R\Chains I. \u\Field I. \r\R. (r, u) \ I" by (subst FI) blast + then have 1: "\u\Field I. \r\R. (r, u) \ I" if "R\Chains I" for R + using that by (subst FI) blast txt \Zorn's Lemma yields a maximal wellorder m.\ from Zorns_po_lemma [OF 0 1] obtain m :: "('a \ 'a) set" where "Well_order m" and "downset_on (Field m) p" and "extension_on (Field m) m p" and diff -r 64fb127e33f7 -r 345ce5f262ea src/HOL/Nonstandard_Analysis/Free_Ultrafilter.thy --- a/src/HOL/Nonstandard_Analysis/Free_Ultrafilter.thy Sun Aug 12 14:31:46 2018 +0200 +++ b/src/HOL/Nonstandard_Analysis/Free_Ultrafilter.thy Tue Aug 14 16:05:40 2018 +0100 @@ -118,32 +118,26 @@ show "Partial_order ?R" by (auto simp: partial_order_on_def preorder_on_def antisym_def refl_on_def trans_def Field_def bot_unique) - show "\C\Chains ?R. \u\Field ?R. \a\C. (a, u) \ ?R" - proof (safe intro!: bexI del: notI) - fix c x - assume c: "c \ Chains ?R" - - have Inf_c: "Inf c \ bot" "Inf c \ F" if "c \ {}" + show "\u\Field ?R. \a\C. (a, u) \ ?R" if C: "C \ Chains ?R" for C + proof (simp, intro exI conjI ballI) + have Inf_C: "Inf C \ bot" "Inf C \ F" if "C \ {}" proof - - from c that have "Inf c = bot \ (\x\c. x = bot)" + from C that have "Inf C = bot \ (\x\C. x = bot)" unfolding trivial_limit_def by (intro eventually_Inf_base) (auto simp: Chains_def) - with c show "Inf c \ bot" + with C show "Inf C \ bot" by (simp add: bot_notin_R) - from that obtain x where "x \ c" by auto - with c show "Inf c \ F" + from that obtain x where "x \ C" by auto + with C show "Inf C \ F" by (auto intro!: Inf_lower2[of x] simp: Chains_def) qed - then have [simp]: "inf F (Inf c) = (if c = {} then F else Inf c)" - using c by (auto simp add: inf_absorb2) - - from c show "inf F (Inf c) \ bot" - by (simp add: F Inf_c) - from c show "inf F (Inf c) \ Field ?R" - by (simp add: Chains_def Inf_c F) - - assume "x \ c" - with c show "inf F (Inf c) \ x" "x \ F" - by (auto intro: Inf_lower simp: Chains_def) + then have [simp]: "inf F (Inf C) = (if C = {} then F else Inf C)" + using C by (auto simp add: inf_absorb2) + from C show "inf F (Inf C) \ bot" + by (simp add: F Inf_C) + from C show "inf F (Inf C) \ F" + by (simp add: Chains_def Inf_C F) + with C show "inf F (Inf C) \ x" "x \ F" if "x \ C" for x + using that by (auto intro: Inf_lower simp: Chains_def) qed qed then obtain U where U: "U \ ?A" "?B U" .. diff -r 64fb127e33f7 -r 345ce5f262ea src/HOL/Order_Relation.thy --- a/src/HOL/Order_Relation.thy Sun Aug 12 14:31:46 2018 +0200 +++ b/src/HOL/Order_Relation.thy Tue Aug 14 16:05:40 2018 +0100 @@ -25,6 +25,9 @@ preorder_on_def partial_order_on_def linear_order_on_def strict_linear_order_on_def well_order_on_def +lemma partial_order_onD: + assumes "partial_order_on A r" shows "refl_on A r" and "trans r" and "antisym r" + using assms unfolding partial_order_on_def preorder_on_def by auto lemma preorder_on_empty[simp]: "preorder_on {} {}" by (simp add: preorder_on_def trans_def) @@ -133,6 +136,34 @@ with \d \ a\ show "a \ Field (r - Id)" unfolding Field_def by blast qed +subsection\Relations given by a predicate and the field\ + +definition relation_of :: "('a \ 'a \ bool) \ 'a set \ ('a \ 'a) set" + where "relation_of P A \ { (a, b) \ A \ A. P a b }" + +lemma Field_relation_of: + assumes "refl_on A (relation_of P A)" shows "Field (relation_of P A) = A" + using assms unfolding refl_on_def Field_def by auto + +lemma partial_order_on_relation_ofI: + assumes refl: "\a. a \ A \ P a a" + and trans: "\a b c. \ a \ A; b \ A; c \ A \ \ P a b \ P b c \ P a c" + and antisym: "\a b. \ a \ A; b \ A \ \ P a b \ P b a \ a = b" + shows "partial_order_on A (relation_of P A)" +proof - + from refl have "refl_on A (relation_of P A)" + unfolding refl_on_def relation_of_def by auto + moreover have "trans (relation_of P A)" and "antisym (relation_of P A)" + unfolding relation_of_def + by (auto intro: transI dest: trans, auto intro: antisymI dest: antisym) + ultimately show ?thesis + unfolding partial_order_on_def preorder_on_def by simp +qed + +lemma Partial_order_relation_ofI: + assumes "partial_order_on A (relation_of P A)" shows "Partial_order (relation_of P A)" + using Field_relation_of assms partial_order_on_def preorder_on_def by fastforce + subsection \Orders on a type\ diff -r 64fb127e33f7 -r 345ce5f262ea src/HOL/Zorn.thy --- a/src/HOL/Zorn.thy Sun Aug 12 14:31:46 2018 +0200 +++ b/src/HOL/Zorn.thy Tue Aug 14 16:05:40 2018 +0100 @@ -491,7 +491,7 @@ lemma Zorns_po_lemma: assumes po: "Partial_order r" - and u: "\C\Chains r. \u\Field r. \a\C. (a, u) \ r" + and u: "\C. C \ Chains r \ \u\Field r. \a\C. (a, u) \ r" shows "\m\Field r. \a\Field r. (m, a) \ r \ a = m" proof - have "Preorder r" @@ -513,7 +513,8 @@ using \Preorder r\ and \a \ Field r\ and \b \ Field r\ by (simp add:subset_Image1_Image1_iff) qed - with u obtain u where uA: "u \ Field r" "\a\?A. (a, u) \ r" by auto + then obtain u where uA: "u \ Field r" "\a\?A. (a, u) \ r" + by (auto simp: dest: u) have "?P u" proof auto fix a B assume aB: "B \ C" "a \ B" @@ -539,6 +540,22 @@ using \m \ Field r\ by blast qed +lemma predicate_Zorn: + assumes po: "partial_order_on A (relation_of P A)" + and ch: "\C. C \ Chains (relation_of P A) \ \u \ A. \a \ C. P a u" + shows "\m \ A. \a \ A. P m a \ a = m" +proof - + have "a \ A" if "C \ Chains (relation_of P A)" and "a \ C" for C a + using that unfolding Chains_def relation_of_def by auto + moreover have "(a, u) \ relation_of P A" if "a \ A" and "u \ A" and "P a u" for a u + unfolding relation_of_def using that by auto + ultimately have "\m\A. \a\A. (m, a) \ relation_of P A \ a = m" + using Zorns_po_lemma[OF Partial_order_relation_ofI[OF po], rule_format] ch + unfolding Field_relation_of[OF partial_order_onD(1)[OF po]] by blast + then show ?thesis + by (auto simp: relation_of_def) +qed + subsection \The Well Ordering Theorem\ @@ -701,8 +718,8 @@ using mono_Chains [OF I_init] Chains_wo[of R] and \R \ Chains I\ unfolding I_def by blast qed - then have 1: "\R \ Chains I. \u\Field I. \r\R. (r, u) \ I" - by (subst FI) blast + then have 1: "\u\Field I. \r\R. (r, u) \ I" if "R \ Chains I" for R + using that by (subst FI) blast \ \Zorn's Lemma yields a maximal well-order \m\:\ then obtain m :: "'a rel" where "Well_order m"