# HG changeset patch # User blanchet # Date 1389949369 -3600 # Node ID 258fa7b5a621ba2816751a00be0adf27abb8ea8a # Parent 1ac0a0194428852b9462360e71e81ebcb48998e4 folded 'Order_Relation_More_FP' into 'Order_Relation' diff -r 1ac0a0194428 -r 258fa7b5a621 src/HOL/Cardinals/Order_Relation_More.thy --- a/src/HOL/Cardinals/Order_Relation_More.thy Fri Jan 17 09:52:19 2014 +0100 +++ b/src/HOL/Cardinals/Order_Relation_More.thy Fri Jan 17 10:02:49 2014 +0100 @@ -8,7 +8,7 @@ header {* Basics on Order-Like Relations *} theory Order_Relation_More -imports Order_Relation_More_FP Main +imports Main begin diff -r 1ac0a0194428 -r 258fa7b5a621 src/HOL/Cardinals/Order_Relation_More_FP.thy --- a/src/HOL/Cardinals/Order_Relation_More_FP.thy Fri Jan 17 09:52:19 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -(* Title: HOL/Cardinals/Order_Relation_More_FP.thy - Author: Andrei Popescu, TU Muenchen - Copyright 2012 - -Basics on order-like relations (FP). -*) - -header {* Basics on Order-Like Relations (FP) *} - -theory Order_Relation_More_FP -imports Order_Relation -begin - - -text{* In this section, we develop basic concepts and results pertaining -to order-like relations, i.e., to reflexive and/or transitive and/or symmetric and/or -total relations. The development is placed on top of the definitions -from the theory @{text "Order_Relation"}. We also -further define upper and lower bounds operators. *} - - -subsection {* Auxiliaries *} - - -lemma refl_on_domain: -"\refl_on A r; (a,b) : r\ \ a \ A \ b \ A" -by(auto simp add: refl_on_def) - - -corollary well_order_on_domain: -"\well_order_on A r; (a,b) \ r\ \ a \ A \ b \ A" -by (auto simp add: refl_on_domain order_on_defs) - - -lemma well_order_on_Field: -"well_order_on A r \ A = Field r" -by(auto simp add: refl_on_def Field_def order_on_defs) - - -lemma well_order_on_Well_order: -"well_order_on A r \ A = Field r \ Well_order r" -using well_order_on_Field by auto - - -lemma Total_subset_Id: -assumes TOT: "Total r" and SUB: "r \ Id" -shows "r = {} \ (\a. r = {(a,a)})" -proof- - {assume "r \ {}" - then obtain a b where 1: "(a,b) \ r" by fast - hence "a = b" using SUB by blast - hence 2: "(a,a) \ r" using 1 by simp - {fix c d assume "(c,d) \ r" - hence "{a,c,d} \ Field r" using 1 unfolding Field_def by blast - hence "((a,c) \ r \ (c,a) \ r \ a = c) \ - ((a,d) \ r \ (d,a) \ r \ a = d)" - using TOT unfolding total_on_def by blast - hence "a = c \ a = d" using SUB by blast - } - hence "r \ {(a,a)}" by auto - with 2 have "\a. r = {(a,a)}" by blast - } - thus ?thesis by blast -qed - - -lemma Linear_order_in_diff_Id: -assumes LI: "Linear_order r" and - IN1: "a \ Field r" and IN2: "b \ Field r" -shows "((a,b) \ r) = ((b,a) \ r - Id)" -using assms unfolding order_on_defs total_on_def antisym_def Id_def refl_on_def by force - - -subsection {* The upper and lower bounds operators *} - - -text{* Here we define upper (``above") and lower (``below") bounds operators. -We think of @{text "r"} as a {\em non-strict} relation. The suffix ``S" -at the names of some operators indicates that the bounds are strict -- e.g., -@{text "underS a"} is the set of all strict lower bounds of @{text "a"} (w.r.t. @{text "r"}). -Capitalization of the first letter in the name reminds that the operator acts on sets, rather -than on individual elements. *} - -definition under::"'a rel \ 'a \ 'a set" -where "under r a \ {b. (b,a) \ r}" - -definition underS::"'a rel \ 'a \ 'a set" -where "underS r a \ {b. b \ a \ (b,a) \ r}" - -definition Under::"'a rel \ 'a set \ 'a set" -where "Under r A \ {b \ Field r. \a \ A. (b,a) \ r}" - -definition UnderS::"'a rel \ 'a set \ 'a set" -where "UnderS r A \ {b \ Field r. \a \ A. b \ a \ (b,a) \ r}" - -definition above::"'a rel \ 'a \ 'a set" -where "above r a \ {b. (a,b) \ r}" - -definition aboveS::"'a rel \ 'a \ 'a set" -where "aboveS r a \ {b. b \ a \ (a,b) \ r}" - -definition Above::"'a rel \ 'a set \ 'a set" -where "Above r A \ {b \ Field r. \a \ A. (a,b) \ r}" - -definition AboveS::"'a rel \ 'a set \ 'a set" -where "AboveS r A \ {b \ Field r. \a \ A. b \ a \ (a,b) \ r}" - -text{* Note: In the definitions of @{text "Above[S]"} and @{text "Under[S]"}, - we bounded comprehension by @{text "Field r"} in order to properly cover - the case of @{text "A"} being empty. *} - -lemma underS_subset_under: "underS r a \ under r a" -by(auto simp add: underS_def under_def) - - -lemma underS_notIn: "a \ underS r a" -by(simp add: underS_def) - - -lemma Refl_under_in: "\Refl r; a \ Field r\ \ a \ under r a" -by(simp add: refl_on_def under_def) - - -lemma AboveS_disjoint: "A Int (AboveS r A) = {}" -by(auto simp add: AboveS_def) - -lemma in_AboveS_underS: "a \ Field r \ a \ AboveS r (underS r a)" -by(auto simp add: AboveS_def underS_def) - -lemma Refl_under_underS: - assumes "Refl r" "a \ Field r" - shows "under r a = underS r a \ {a}" -unfolding under_def underS_def -using assms refl_on_def[of _ r] by fastforce - -lemma underS_empty: "a \ Field r \ underS r a = {}" -by (auto simp: Field_def underS_def) - -lemma under_Field: "under r a \ Field r" -by(unfold under_def Field_def, auto) - -lemma underS_Field: "underS r a \ Field r" -by(unfold underS_def Field_def, auto) - -lemma underS_Field2: -"a \ Field r \ underS r a < Field r" -using underS_notIn underS_Field by fast - -lemma underS_Field3: -"Field r \ {} \ underS r a < Field r" -by(cases "a \ Field r", simp add: underS_Field2, auto simp add: underS_empty) - -lemma AboveS_Field: "AboveS r A \ Field r" -by(unfold AboveS_def Field_def, auto) - -lemma under_incr: - assumes TRANS: "trans r" and REL: "(a,b) \ r" - shows "under r a \ under r b" -proof(unfold under_def, auto) - fix x assume "(x,a) \ r" - with REL TRANS trans_def[of r] - show "(x,b) \ r" by blast -qed - -lemma underS_incr: -assumes TRANS: "trans r" and ANTISYM: "antisym r" and - REL: "(a,b) \ r" -shows "underS r a \ underS r b" -proof(unfold underS_def, auto) - assume *: "b \ a" and **: "(b,a) \ r" - with ANTISYM antisym_def[of r] REL - show False by blast -next - fix x assume "x \ a" "(x,a) \ r" - with REL TRANS trans_def[of r] - show "(x,b) \ r" by blast -qed - -lemma underS_incl_iff: -assumes LO: "Linear_order r" and - INa: "a \ Field r" and INb: "b \ Field r" -shows "(underS r a \ underS r b) = ((a,b) \ r)" -proof - assume "(a,b) \ r" - thus "underS r a \ underS r b" using LO - by (simp add: order_on_defs underS_incr) -next - assume *: "underS r a \ underS r b" - {assume "a = b" - hence "(a,b) \ r" using assms - by (simp add: order_on_defs refl_on_def) - } - moreover - {assume "a \ b \ (b,a) \ r" - hence "b \ underS r a" unfolding underS_def by blast - hence "b \ underS r b" using * by blast - hence False by (simp add: underS_notIn) - } - ultimately - show "(a,b) \ r" using assms - order_on_defs[of "Field r" r] total_on_def[of "Field r" r] by blast -qed - -end diff -r 1ac0a0194428 -r 258fa7b5a621 src/HOL/Cardinals/README.txt --- a/src/HOL/Cardinals/README.txt Fri Jan 17 09:52:19 2014 +0100 +++ b/src/HOL/Cardinals/README.txt Fri Jan 17 10:02:49 2014 +0100 @@ -167,7 +167,7 @@ - In subsection "Other facts": -- Does the lemma "atLeastLessThan_injective" already exist anywhere? -Theory Order_Relation_More (and Order_Relation_More_FP): +Theory Order_Relation_More (and Order_Relation): - In subsection "Auxiliaries": -- Recall the lemmas "order_on_defs", "Field_def", "Domain_def", "Range_def", "converse_def". -- Recall that "refl_on r A" forces r to not be defined outside A. diff -r 1ac0a0194428 -r 258fa7b5a621 src/HOL/Cardinals/Wellfounded_More_FP.thy --- a/src/HOL/Cardinals/Wellfounded_More_FP.thy Fri Jan 17 09:52:19 2014 +0100 +++ b/src/HOL/Cardinals/Wellfounded_More_FP.thy Fri Jan 17 10:02:49 2014 +0100 @@ -8,7 +8,7 @@ header {* More on Well-Founded Relations (FP) *} theory Wellfounded_More_FP -imports Wfrec Order_Relation_More_FP +imports Wfrec Order_Relation begin diff -r 1ac0a0194428 -r 258fa7b5a621 src/HOL/Cardinals/Wellorder_Relation_FP.thy --- a/src/HOL/Cardinals/Wellorder_Relation_FP.thy Fri Jan 17 09:52:19 2014 +0100 +++ b/src/HOL/Cardinals/Wellorder_Relation_FP.thy Fri Jan 17 10:02:49 2014 +0100 @@ -28,14 +28,14 @@ (* context wo_rel *) -abbreviation under where "under \ Order_Relation_More_FP.under r" -abbreviation underS where "underS \ Order_Relation_More_FP.underS r" -abbreviation Under where "Under \ Order_Relation_More_FP.Under r" -abbreviation UnderS where "UnderS \ Order_Relation_More_FP.UnderS r" -abbreviation above where "above \ Order_Relation_More_FP.above r" -abbreviation aboveS where "aboveS \ Order_Relation_More_FP.aboveS r" -abbreviation Above where "Above \ Order_Relation_More_FP.Above r" -abbreviation AboveS where "AboveS \ Order_Relation_More_FP.AboveS r" +abbreviation under where "under \ Order_Relation.under r" +abbreviation underS where "underS \ Order_Relation.underS r" +abbreviation Under where "Under \ Order_Relation.Under r" +abbreviation UnderS where "UnderS \ Order_Relation.UnderS r" +abbreviation above where "above \ Order_Relation.above r" +abbreviation aboveS where "aboveS \ Order_Relation.aboveS r" +abbreviation Above where "Above \ Order_Relation.Above r" +abbreviation AboveS where "AboveS \ Order_Relation.AboveS r" subsection {* Auxiliaries *} diff -r 1ac0a0194428 -r 258fa7b5a621 src/HOL/Order_Relation.thy --- a/src/HOL/Order_Relation.thy Fri Jan 17 09:52:19 2014 +0100 +++ b/src/HOL/Order_Relation.thy Fri Jan 17 10:02:49 2014 +0100 @@ -1,5 +1,6 @@ (* Title: HOL/Order_Relation.thy Author: Tobias Nipkow + Author: Andrei Popescu, TU Muenchen *) header {* Orders as Relations *} @@ -122,4 +123,184 @@ abbreviation "well_order \ well_order_on UNIV" + +subsection {* Order-like relations *} + +text{* In this subsection, we develop basic concepts and results pertaining +to order-like relations, i.e., to reflexive and/or transitive and/or symmetric and/or +total relations. We also further define upper and lower bounds operators. *} + + +subsubsection {* Auxiliaries *} + +lemma refl_on_domain: +"\refl_on A r; (a,b) : r\ \ a \ A \ b \ A" +by(auto simp add: refl_on_def) + +corollary well_order_on_domain: +"\well_order_on A r; (a,b) \ r\ \ a \ A \ b \ A" +by (auto simp add: refl_on_domain order_on_defs) + +lemma well_order_on_Field: +"well_order_on A r \ A = Field r" +by(auto simp add: refl_on_def Field_def order_on_defs) + +lemma well_order_on_Well_order: +"well_order_on A r \ A = Field r \ Well_order r" +using well_order_on_Field by auto + +lemma Total_subset_Id: +assumes TOT: "Total r" and SUB: "r \ Id" +shows "r = {} \ (\a. r = {(a,a)})" +proof- + {assume "r \ {}" + then obtain a b where 1: "(a,b) \ r" by fast + hence "a = b" using SUB by blast + hence 2: "(a,a) \ r" using 1 by simp + {fix c d assume "(c,d) \ r" + hence "{a,c,d} \ Field r" using 1 unfolding Field_def by blast + hence "((a,c) \ r \ (c,a) \ r \ a = c) \ + ((a,d) \ r \ (d,a) \ r \ a = d)" + using TOT unfolding total_on_def by blast + hence "a = c \ a = d" using SUB by blast + } + hence "r \ {(a,a)}" by auto + with 2 have "\a. r = {(a,a)}" by blast + } + thus ?thesis by blast +qed + +lemma Linear_order_in_diff_Id: +assumes LI: "Linear_order r" and + IN1: "a \ Field r" and IN2: "b \ Field r" +shows "((a,b) \ r) = ((b,a) \ r - Id)" +using assms unfolding order_on_defs total_on_def antisym_def Id_def refl_on_def by force + + +subsubsection {* The upper and lower bounds operators *} + +text{* Here we define upper (``above") and lower (``below") bounds operators. +We think of @{text "r"} as a {\em non-strict} relation. The suffix ``S" +at the names of some operators indicates that the bounds are strict -- e.g., +@{text "underS a"} is the set of all strict lower bounds of @{text "a"} (w.r.t. @{text "r"}). +Capitalization of the first letter in the name reminds that the operator acts on sets, rather +than on individual elements. *} + +definition under::"'a rel \ 'a \ 'a set" +where "under r a \ {b. (b,a) \ r}" + +definition underS::"'a rel \ 'a \ 'a set" +where "underS r a \ {b. b \ a \ (b,a) \ r}" + +definition Under::"'a rel \ 'a set \ 'a set" +where "Under r A \ {b \ Field r. \a \ A. (b,a) \ r}" + +definition UnderS::"'a rel \ 'a set \ 'a set" +where "UnderS r A \ {b \ Field r. \a \ A. b \ a \ (b,a) \ r}" + +definition above::"'a rel \ 'a \ 'a set" +where "above r a \ {b. (a,b) \ r}" + +definition aboveS::"'a rel \ 'a \ 'a set" +where "aboveS r a \ {b. b \ a \ (a,b) \ r}" + +definition Above::"'a rel \ 'a set \ 'a set" +where "Above r A \ {b \ Field r. \a \ A. (a,b) \ r}" + +definition AboveS::"'a rel \ 'a set \ 'a set" +where "AboveS r A \ {b \ Field r. \a \ A. b \ a \ (a,b) \ r}" + +text{* Note: In the definitions of @{text "Above[S]"} and @{text "Under[S]"}, + we bounded comprehension by @{text "Field r"} in order to properly cover + the case of @{text "A"} being empty. *} + +lemma underS_subset_under: "underS r a \ under r a" +by(auto simp add: underS_def under_def) + +lemma underS_notIn: "a \ underS r a" +by(simp add: underS_def) + +lemma Refl_under_in: "\Refl r; a \ Field r\ \ a \ under r a" +by(simp add: refl_on_def under_def) + +lemma AboveS_disjoint: "A Int (AboveS r A) = {}" +by(auto simp add: AboveS_def) + +lemma in_AboveS_underS: "a \ Field r \ a \ AboveS r (underS r a)" +by(auto simp add: AboveS_def underS_def) + +lemma Refl_under_underS: + assumes "Refl r" "a \ Field r" + shows "under r a = underS r a \ {a}" +unfolding under_def underS_def +using assms refl_on_def[of _ r] by fastforce + +lemma underS_empty: "a \ Field r \ underS r a = {}" +by (auto simp: Field_def underS_def) + +lemma under_Field: "under r a \ Field r" +by(unfold under_def Field_def, auto) + +lemma underS_Field: "underS r a \ Field r" +by(unfold underS_def Field_def, auto) + +lemma underS_Field2: +"a \ Field r \ underS r a < Field r" +using underS_notIn underS_Field by fast + +lemma underS_Field3: +"Field r \ {} \ underS r a < Field r" +by(cases "a \ Field r", simp add: underS_Field2, auto simp add: underS_empty) + +lemma AboveS_Field: "AboveS r A \ Field r" +by(unfold AboveS_def Field_def, auto) + +lemma under_incr: + assumes TRANS: "trans r" and REL: "(a,b) \ r" + shows "under r a \ under r b" +proof(unfold under_def, auto) + fix x assume "(x,a) \ r" + with REL TRANS trans_def[of r] + show "(x,b) \ r" by blast +qed + +lemma underS_incr: +assumes TRANS: "trans r" and ANTISYM: "antisym r" and + REL: "(a,b) \ r" +shows "underS r a \ underS r b" +proof(unfold underS_def, auto) + assume *: "b \ a" and **: "(b,a) \ r" + with ANTISYM antisym_def[of r] REL + show False by blast +next + fix x assume "x \ a" "(x,a) \ r" + with REL TRANS trans_def[of r] + show "(x,b) \ r" by blast +qed + +lemma underS_incl_iff: +assumes LO: "Linear_order r" and + INa: "a \ Field r" and INb: "b \ Field r" +shows "(underS r a \ underS r b) = ((a,b) \ r)" +proof + assume "(a,b) \ r" + thus "underS r a \ underS r b" using LO + by (simp add: order_on_defs underS_incr) +next + assume *: "underS r a \ underS r b" + {assume "a = b" + hence "(a,b) \ r" using assms + by (simp add: order_on_defs refl_on_def) + } + moreover + {assume "a \ b \ (b,a) \ r" + hence "b \ underS r a" unfolding underS_def by blast + hence "b \ underS r b" using * by blast + hence False by (simp add: underS_notIn) + } + ultimately + show "(a,b) \ r" using assms + order_on_defs[of "Field r" r] total_on_def[of "Field r" r] by blast +qed + end