(* This file is a part of IsarMathLib - a library of formalized mathematics for Isabelle/Isar. Copyright (C) 2005, 2006 Slawomir Kolodynski This program is free software; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *) section ‹Ordered rings› theory OrderedRing_ZF imports Ring_ZF OrderedGroup_ZF_1 begin text‹In this theory file we consider ordered rings.› subsection‹Definition and notation› text‹This section defines ordered rings and sets up appriopriate notation.› text‹We define ordered ring as a commutative ring with linear order that is preserved by translations and such that the set of nonnegative elements is closed under multiplication. Note that this definition does not guarantee that there are no zero divisors in the ring.› definition "IsAnOrdRing(R,A,M,r) ≡ ( IsAring(R,A,M) ∧ (M {is commutative on} R) ∧ r⊆R×R ∧ IsLinOrder(R,r) ∧ (∀a b. ∀ c∈R. ⟨ a,b⟩ ∈ r ⟶ ⟨A`⟨ a,c⟩,A`⟨ b,c⟩⟩ ∈ r) ∧ (Nonnegative(R,A,r) {is closed under} M))" text‹The next context (locale) defines notation used for ordered rings. We do that by extending the notation defined in the ‹ring0› locale and adding some assumptions to make sure we are talking about ordered rings in this context.› locale ring1 = ring0 + assumes mult_commut: "M {is commutative on} R" fixes r assumes ordincl: "r ⊆ R×R" assumes linord: "IsLinOrder(R,r)" fixes lesseq (infix "\<lsq>" 68) defines lesseq_def [simp]: "a \<lsq> b ≡ ⟨ a,b⟩ ∈ r" fixes sless (infix "\<ls>" 68) defines sless_def [simp]: "a \<ls> b ≡ a\<lsq>b ∧ a≠b" assumes ordgroup: "∀a b. ∀ c∈R. a\<lsq>b ⟶ a\<ra>c \<lsq> b\<ra>c" assumes pos_mult_closed: "Nonnegative(R,A,r) {is closed under} M" fixes abs ("¦ _ ¦") defines abs_def [simp]: "¦a¦ ≡ AbsoluteValue(R,A,r)`(a)" fixes positiveset ("R⇩_{+}") defines positiveset_def [simp]: "R⇩_{+}≡ PositiveSet(R,A,r)" text‹The next lemma assures us that we are talking about ordered rings in the ‹ring1› context.› lemma (in ring1) OrdRing_ZF_1_L1: shows "IsAnOrdRing(R,A,M,r)" using ring0_def ringAssum mult_commut ordincl linord ordgroup pos_mult_closed IsAnOrdRing_def by simp text‹We can use theorems proven in the ‹ring1› context whenever we talk about an ordered ring.› lemma OrdRing_ZF_1_L2: assumes "IsAnOrdRing(R,A,M,r)" shows "ring1(R,A,M,r)" using assms IsAnOrdRing_def ring1_axioms.intro ring0_def ring1_def by simp text‹In the ‹ring1› context $a\leq b$ implies that $a,b$ are elements of the ring.› lemma (in ring1) OrdRing_ZF_1_L3: assumes "a\<lsq>b" shows "a∈R" "b∈R" using assms ordincl by auto text‹Ordered ring is an ordered group, hence we can use theorems proven in the ‹group3› context.› lemma (in ring1) OrdRing_ZF_1_L4: shows "IsAnOrdGroup(R,A,r)" "r {is total on} R" "A {is commutative on} R" "group3(R,A,r)" proof - { fix a b g assume A1: "g∈R" and A2: "a\<lsq>b" with ordgroup have "a\<ra>g \<lsq> b\<ra>g" by simp moreover from ringAssum A1 A2 have "a\<ra>g = g\<ra>a" "b\<ra>g = g\<ra>b" using OrdRing_ZF_1_L3 IsAring_def IsCommutative_def by auto ultimately have "a\<ra>g \<lsq> b\<ra>g" "g\<ra>a \<lsq> g\<ra>b" by auto } hence "∀g∈R. ∀a b. a\<lsq>b ⟶ a\<ra>g \<lsq> b\<ra>g ∧ g\<ra>a \<lsq> g\<ra>b" by simp with ringAssum ordincl linord show "IsAnOrdGroup(R,A,r)" "group3(R,A,r)" "r {is total on} R" "A {is commutative on} R" using IsAring_def Order_ZF_1_L2 IsAnOrdGroup_def group3_def IsLinOrder_def by auto qed text‹The order relation in rings is transitive.› lemma (in ring1) ring_ord_transitive: assumes A1: "a\<lsq>b" "b\<lsq>c" shows "a\<lsq>c" proof - from A1 have "group3(R,A,r)" "⟨a,b⟩ ∈ r" "⟨b,c⟩ ∈ r" using OrdRing_ZF_1_L4 by auto then have "⟨a,c⟩ ∈ r" by (rule group3.Group_order_transitive) then show "a\<lsq>c" by simp qed text‹Transitivity for the strict order: if $a<b$ and $b\leq c$, then $a<c$. Property of ordered groups.› lemma (in ring1) ring_strict_ord_trans: assumes A1: "a\<ls>b" and A2: "b\<lsq>c" shows "a\<ls>c" proof - from A1 A2 have "group3(R,A,r)" "⟨a,b⟩ ∈ r ∧ a≠b" "⟨b,c⟩ ∈ r" using OrdRing_ZF_1_L4 by auto then have "⟨a,c⟩ ∈ r ∧ a≠c" by (rule group3.OrderedGroup_ZF_1_L4A) then show "a\<ls>c" by simp qed text‹Another version of transitivity for the strict order: if $a\leq b$ and $b<c$, then $a<c$. Property of ordered groups.› lemma (in ring1) ring_strict_ord_transit: assumes A1: "a\<lsq>b" and A2: "b\<ls>c" shows "a\<ls>c" proof - from A1 A2 have "group3(R,A,r)" "⟨a,b⟩ ∈ r" "⟨b,c⟩ ∈ r ∧ b≠c" using OrdRing_ZF_1_L4 by auto then have "⟨a,c⟩ ∈ r ∧ a≠c" by (rule group3.group_strict_ord_transit) then show "a\<ls>c" by simp qed text‹The next lemma shows what happens when one element of an ordered ring is not greater or equal than another.› lemma (in ring1) OrdRing_ZF_1_L4A: assumes A1: "a∈R" "b∈R" and A2: "¬(a\<lsq>b)" shows "b \<lsq> a" "(\<rm>a) \<lsq> (\<rm>b)" "a≠b" proof - from A1 A2 have I: "group3(R,A,r)" "r {is total on} R" "a ∈ R" "b ∈ R" "⟨a, b⟩ ∉ r" using OrdRing_ZF_1_L4 by auto then have "⟨b,a⟩ ∈ r" by (rule group3.OrderedGroup_ZF_1_L8) then show "b \<lsq> a" by simp from I have "⟨GroupInv(R,A)`(a),GroupInv(R,A)`(b)⟩ ∈ r" by (rule group3.OrderedGroup_ZF_1_L8) then show "(\<rm>a) \<lsq> (\<rm>b)" by simp from I show "a≠b" by (rule group3.OrderedGroup_ZF_1_L8) qed text‹A special case of ‹OrdRing_ZF_1_L4A› when one of the constants is $0$. This is useful for many proofs by cases.› corollary (in ring1) ord_ring_split2: assumes A1: "a∈R" shows "a\<lsq>𝟬 ∨ (𝟬\<lsq>a ∧ a≠𝟬)" proof - { from A1 have I: "a∈R" "𝟬∈R" using Ring_ZF_1_L2 by auto moreover assume A2: "¬(a\<lsq>𝟬)" ultimately have "𝟬\<lsq>a" by (rule OrdRing_ZF_1_L4A) moreover from I A2 have "a≠𝟬" by (rule OrdRing_ZF_1_L4A) ultimately have "𝟬\<lsq>a ∧ a≠𝟬" by simp} then show ?thesis by auto qed text‹Taking minus on both sides reverses an inequality.› lemma (in ring1) OrdRing_ZF_1_L4B: assumes "a\<lsq>b" shows "(\<rm>b) \<lsq> (\<rm>a)" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L5 by simp text‹The next lemma just expands the condition that requires the set of nonnegative elements to be closed with respect to multiplication. These are properties of totally ordered groups.› lemma (in ring1) OrdRing_ZF_1_L5: assumes "𝟬\<lsq>a" "𝟬\<lsq>b" shows "𝟬 \<lsq> a⋅b" using pos_mult_closed assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L2 IsOpClosed_def by simp text‹Double nonnegative is nonnegative.› lemma (in ring1) OrdRing_ZF_1_L5A: assumes A1: "𝟬\<lsq>a" shows "𝟬\<lsq>𝟮⋅a" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L5G OrdRing_ZF_1_L3 Ring_ZF_1_L3 by simp text‹A sufficient (somewhat redundant) condition for a structure to be an ordered ring. It says that a commutative ring that is a totally ordered group with respect to the additive operation such that set of nonnegative elements is closed under multiplication, is an ordered ring.› lemma OrdRing_ZF_1_L6: assumes "IsAring(R,A,M)" "M {is commutative on} R" "Nonnegative(R,A,r) {is closed under} M" "IsAnOrdGroup(R,A,r)" "r {is total on} R" shows "IsAnOrdRing(R,A,M,r)" using assms IsAnOrdGroup_def Order_ZF_1_L3 IsAnOrdRing_def by simp text‹ $a\leq b$ iff $a-b\leq 0$. This is a fact from ‹OrderedGroup.thy›, where it is stated in multiplicative notation.› lemma (in ring1) OrdRing_ZF_1_L7: assumes "a∈R" "b∈R" shows "a\<lsq>b ⟷ a\<rs>b \<lsq> 𝟬" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L9 by simp text‹Negative times positive is negative.› lemma (in ring1) OrdRing_ZF_1_L8: assumes A1: "a\<lsq>𝟬" and A2: "𝟬\<lsq>b" shows "a⋅b \<lsq> 𝟬" proof - from A1 A2 have T1: "a∈R" "b∈R" "a⋅b ∈ R" using OrdRing_ZF_1_L3 Ring_ZF_1_L4 by auto from A1 A2 have "𝟬\<lsq>(\<rm>a)⋅b" using OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L5A OrdRing_ZF_1_L5 by simp with T1 show "a⋅b \<lsq> 𝟬" using Ring_ZF_1_L7 OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L5AA by simp qed text‹We can multiply both sides of an inequality by a nonnegative ring element. This property is sometimes (not here) used to define ordered rings.› lemma (in ring1) OrdRing_ZF_1_L9: assumes A1: "a\<lsq>b" and A2: "𝟬\<lsq>c" shows "a⋅c \<lsq> b⋅c" "c⋅a \<lsq> c⋅b" proof - from A1 A2 have T1: "a∈R" "b∈R" "c∈R" "a⋅c ∈ R" "b⋅c ∈ R" using OrdRing_ZF_1_L3 Ring_ZF_1_L4 by auto with A1 A2 have "(a\<rs>b)⋅c \<lsq> 𝟬" using OrdRing_ZF_1_L7 OrdRing_ZF_1_L8 by simp with T1 show "a⋅c \<lsq> b⋅c" using Ring_ZF_1_L8 OrdRing_ZF_1_L7 by simp with mult_commut T1 show "c⋅a \<lsq> c⋅b" using IsCommutative_def by simp qed text‹A special case of ‹OrdRing_ZF_1_L9›: we can multiply an inequality by a positive ring element.› lemma (in ring1) OrdRing_ZF_1_L9A: assumes A1: "a\<lsq>b" and A2: "c∈R⇩_{+}" shows "a⋅c \<lsq> b⋅c" "c⋅a \<lsq> c⋅b" proof - from A2 have "𝟬 \<lsq> c" using PositiveSet_def by simp with A1 show "a⋅c \<lsq> b⋅c" "c⋅a \<lsq> c⋅b" using OrdRing_ZF_1_L9 by auto qed text‹A square is nonnegative.› lemma (in ring1) OrdRing_ZF_1_L10: assumes A1: "a∈R" shows "𝟬\<lsq>(a⇧^{2})" proof - { assume "𝟬\<lsq>a" then have "𝟬\<lsq>(a⇧^{2})" using OrdRing_ZF_1_L5 by simp} moreover { assume "¬(𝟬\<lsq>a)" with A1 have "𝟬\<lsq>((\<rm>a)⇧^{2})" using OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L8A OrdRing_ZF_1_L5 by simp with A1 have "𝟬\<lsq>(a⇧^{2})" using Ring_ZF_1_L14 by simp } ultimately show ?thesis by blast qed text‹$1$ is nonnegative.› corollary (in ring1) ordring_one_is_nonneg: shows "𝟬 \<lsq> 𝟭" proof - have "𝟬 \<lsq> (𝟭⇧^{2})" using Ring_ZF_1_L2 OrdRing_ZF_1_L10 by simp then show "𝟬 \<lsq> 𝟭" using Ring_ZF_1_L2 Ring_ZF_1_L3 by simp qed text‹In nontrivial rings one is positive.› lemma (in ring1) ordring_one_is_pos: assumes "𝟬≠𝟭" shows "𝟭 ∈ R⇩_{+}" using assms Ring_ZF_1_L2 ordring_one_is_nonneg PositiveSet_def by auto text‹Nonnegative is not negative. Property of ordered groups.› lemma (in ring1) OrdRing_ZF_1_L11: assumes "𝟬\<lsq>a" shows "¬(a\<lsq>𝟬 ∧ a≠𝟬)" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L5AB by simp text‹A negative element cannot be a square.› lemma (in ring1) OrdRing_ZF_1_L12: assumes A1: "a\<lsq>𝟬" "a≠𝟬" shows "¬(∃b∈R. a = (b⇧^{2}))" proof - { assume "∃b∈R. a = (b⇧^{2})" with A1 have False using OrdRing_ZF_1_L10 OrdRing_ZF_1_L11 by auto } then show ?thesis by auto qed text‹If $a\leq b$, then $0\leq b-a$.› lemma (in ring1) OrdRing_ZF_1_L13: assumes "a\<lsq>b" shows "𝟬 \<lsq> b\<rs>a" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L9D by simp text‹If $a<b$, then $0 < b-a$.› lemma (in ring1) OrdRing_ZF_1_L14: assumes "a\<lsq>b" "a≠b" shows "𝟬 \<lsq> b\<rs>a" "𝟬 ≠ b\<rs>a" "b\<rs>a ∈ R⇩_{+}" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L9E by auto text‹If the difference is nonnegative, then $a\leq b$.› lemma (in ring1) OrdRing_ZF_1_L15: assumes "a∈R" "b∈R" and "𝟬 \<lsq> b\<rs>a" shows "a\<lsq>b" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L9F by simp text‹A nonnegative number is does not decrease when multiplied by a number greater or equal $1$.› lemma (in ring1) OrdRing_ZF_1_L16: assumes A1: "𝟬\<lsq>a" and A2: "𝟭\<lsq>b" shows "a\<lsq>a⋅b" proof - from A1 A2 have T: "a∈R" "b∈R" "a⋅b ∈ R" using OrdRing_ZF_1_L3 Ring_ZF_1_L4 by auto from A1 A2 have "𝟬 \<lsq> a⋅(b\<rs>𝟭)" using OrdRing_ZF_1_L13 OrdRing_ZF_1_L5 by simp with T show "a\<lsq>a⋅b" using Ring_ZF_1_L8 Ring_ZF_1_L2 Ring_ZF_1_L3 OrdRing_ZF_1_L15 by simp qed text‹We can multiply the right hand side of an inequality between nonnegative ring elements by an element greater or equal $1$.› lemma (in ring1) OrdRing_ZF_1_L17: assumes A1: "𝟬\<lsq>a" and A2: "a\<lsq>b" and A3: "𝟭\<lsq>c" shows "a\<lsq>b⋅c" proof - from A1 A2 have "𝟬\<lsq>b" by (rule ring_ord_transitive) with A3 have "b\<lsq>b⋅c" using OrdRing_ZF_1_L16 by simp with A2 show "a\<lsq>b⋅c" by (rule ring_ord_transitive) qed text‹Strict order is preserved by translations.› lemma (in ring1) ring_strict_ord_trans_inv: assumes "a\<ls>b" and "c∈R" shows "a\<ra>c \<ls> b\<ra>c" "c\<ra>a \<ls> c\<ra>b" using assms OrdRing_ZF_1_L4 group3.group_strict_ord_transl_inv by auto text‹We can put an element on the other side of a strict inequality, changing its sign.› lemma (in ring1) OrdRing_ZF_1_L18: assumes "a∈R" "b∈R" and "a\<rs>b \<ls> c" shows "a \<ls> c\<ra>b" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L12B by simp text‹We can add the sides of two inequalities, the first of them strict, and we get a strict inequality. Property of ordered groups.› lemma (in ring1) OrdRing_ZF_1_L19: assumes "a\<ls>b" and "c\<lsq>d" shows "a\<ra>c \<ls> b\<ra>d" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L12C by simp text‹We can add the sides of two inequalities, the second of them strict and we get a strict inequality. Property of ordered groups.› lemma (in ring1) OrdRing_ZF_1_L20: assumes "a\<lsq>b" and "c\<ls>d" shows "a\<ra>c \<ls> b\<ra>d" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L12D by simp subsection‹Absolute value for ordered rings› text‹Absolute value is defined for ordered groups as a function that is the identity on the nonnegative set and the negative of the element (the inverse in the multiplicative notation) on the rest. In this section we consider properties of absolute value related to multiplication in ordered rings.› text‹Absolute value of a product is the product of absolute values: the case when both elements of the ring are nonnegative.› lemma (in ring1) OrdRing_ZF_2_L1: assumes "𝟬\<lsq>a" "𝟬\<lsq>b" shows "¦a⋅b¦ = ¦a¦⋅¦b¦" using assms OrdRing_ZF_1_L5 OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L2 group3.OrderedGroup_ZF_3_L2 by simp text‹The absolue value of an element and its negative are the same.› lemma (in ring1) OrdRing_ZF_2_L2: assumes "a∈R" shows "¦\<rm>a¦ = ¦a¦" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_3_L7A by simp text‹The next lemma states that $|a\cdot (-b)| = |(-a)\cdot b| = |(-a)\cdot (-b)| = |a\cdot b|$.› lemma (in ring1) OrdRing_ZF_2_L3: assumes "a∈R" "b∈R" shows "¦(\<rm>a)⋅b¦ = ¦a⋅b¦" "¦a⋅(\<rm>b)¦ = ¦a⋅b¦" "¦(\<rm>a)⋅(\<rm>b)¦ = ¦a⋅b¦" using assms Ring_ZF_1_L4 Ring_ZF_1_L7 Ring_ZF_1_L7A OrdRing_ZF_2_L2 by auto text‹This lemma allows to prove theorems for the case of positive and negative elements of the ring separately.› lemma (in ring1) OrdRing_ZF_2_L4: assumes "a∈R" and "¬(𝟬\<lsq>a)" shows "𝟬 \<lsq> (\<rm>a)" "𝟬≠a" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L8A by auto text‹Absolute value of a product is the product of absolute values.› lemma (in ring1) OrdRing_ZF_2_L5: assumes A1: "a∈R" "b∈R" shows "¦a⋅b¦ = ¦a¦⋅¦b¦" proof - { assume A2: "𝟬\<lsq>a" have "¦a⋅b¦ = ¦a¦⋅¦b¦" proof - { assume "𝟬\<lsq>b" with A2 have "¦a⋅b¦ = ¦a¦⋅¦b¦" using OrdRing_ZF_2_L1 by simp } moreover { assume "¬(𝟬\<lsq>b)" with A1 A2 have "¦a⋅(\<rm>b)¦ = ¦a¦⋅¦\<rm>b¦" using OrdRing_ZF_2_L4 OrdRing_ZF_2_L1 by simp with A1 have "¦a⋅b¦ = ¦a¦⋅¦b¦" using OrdRing_ZF_2_L2 OrdRing_ZF_2_L3 by simp } ultimately show ?thesis by blast qed } moreover { assume "¬(𝟬\<lsq>a)" with A1 have A3: "𝟬 \<lsq> (\<rm>a)" using OrdRing_ZF_2_L4 by simp have "¦a⋅b¦ = ¦a¦⋅¦b¦" proof - { assume "𝟬\<lsq>b" with A3 have "¦(\<rm>a)⋅b¦ = ¦\<rm>a¦⋅¦b¦" using OrdRing_ZF_2_L1 by simp with A1 have "¦a⋅b¦ = ¦a¦⋅¦b¦" using OrdRing_ZF_2_L2 OrdRing_ZF_2_L3 by simp } moreover { assume "¬(𝟬\<lsq>b)" with A1 A3 have "¦(\<rm>a)⋅(\<rm>b)¦ = ¦\<rm>a¦⋅¦\<rm>b¦" using OrdRing_ZF_2_L4 OrdRing_ZF_2_L1 by simp with A1 have "¦a⋅b¦ = ¦a¦⋅¦b¦" using OrdRing_ZF_2_L2 OrdRing_ZF_2_L3 by simp } ultimately show ?thesis by blast qed } ultimately show ?thesis by blast qed text‹Triangle inequality. Property of linearly ordered abelian groups.› lemma (in ring1) ord_ring_triangle_ineq: assumes "a∈R" "b∈R" shows "¦a\<ra>b¦ \<lsq> ¦a¦\<ra>¦b¦" using assms OrdRing_ZF_1_L4 group3.OrdGroup_triangle_ineq by simp text‹If $a\leq c$ and $b\leq c$, then $a+b\leq 2\cdot c$.› lemma (in ring1) OrdRing_ZF_2_L6: assumes "a\<lsq>c" "b\<lsq>c" shows "a\<ra>b \<lsq> 𝟮⋅c" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L5B OrdRing_ZF_1_L3 Ring_ZF_1_L3 by simp subsection‹Positivity in ordered rings› text‹This section is about properties of the set of positive elements ‹R⇩_{+}›.› text‹The set of positive elements is closed under ring addition. This is a property of ordered groups, we just reference a theorem from ‹OrderedGroup_ZF› theory in the proof.› lemma (in ring1) OrdRing_ZF_3_L1: shows "R⇩_{+}{is closed under} A" using OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L13 by simp text‹Every element of a ring can be either in the postitive set, equal to zero or its opposite (the additive inverse) is in the positive set. This is a property of ordered groups, we just reference a theorem from ‹OrderedGroup_ZF› theory.› lemma (in ring1) OrdRing_ZF_3_L2: assumes "a∈R" shows "Exactly_1_of_3_holds (a=𝟬, a∈R⇩_{+}, (\<rm>a) ∈ R⇩_{+})" using assms OrdRing_ZF_1_L4 group3.OrdGroup_decomp by simp text‹If a ring element $a\neq 0$, and it is not positive, then $-a$ is positive.› lemma (in ring1) OrdRing_ZF_3_L2A: assumes "a∈R" "a≠𝟬" "a ∉ R⇩_{+}" shows "(\<rm>a) ∈ R⇩_{+}" using assms OrdRing_ZF_1_L4 group3.OrdGroup_cases by simp text‹‹R⇩_{+}› is closed under multiplication iff the ring has no zero divisors.› lemma (in ring1) OrdRing_ZF_3_L3: shows "(R⇩_{+}{is closed under} M)⟷ HasNoZeroDivs(R,A,M)" proof assume A1: "HasNoZeroDivs(R,A,M)" { fix a b assume "a∈R⇩_{+}" "b∈R⇩_{+}" then have "𝟬\<lsq>a" "a≠𝟬" "𝟬\<lsq>b" "b≠𝟬" using PositiveSet_def by auto with A1 have "a⋅b ∈ R⇩_{+}" using OrdRing_ZF_1_L5 Ring_ZF_1_L2 OrdRing_ZF_1_L3 Ring_ZF_1_L12 OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L2A by simp } then show "R⇩_{+}{is closed under} M" using IsOpClosed_def by simp next assume A2: "R⇩_{+}{is closed under} M" { fix a b assume A3: "a∈R" "b∈R" and "a≠𝟬" "b≠𝟬" with A2 have "¦a⋅b¦ ∈ R⇩_{+}" using OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_3_L12 IsOpClosed_def OrdRing_ZF_2_L5 by simp with A3 have "a⋅b ≠ 𝟬" using PositiveSet_def Ring_ZF_1_L4 OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_3_L2A by auto } then show "HasNoZeroDivs(R,A,M)" using HasNoZeroDivs_def by auto qed text‹Another (in addition to ‹OrdRing_ZF_1_L6› sufficient condition that defines order in an ordered ring starting from the positive set.› theorem (in ring0) ring_ord_by_positive_set: assumes A1: "M {is commutative on} R" and A2: "P⊆R" "P {is closed under} A" "𝟬 ∉ P" and A3: "∀a∈R. a≠𝟬 ⟶ (a∈P) Xor ((\<rm>a) ∈ P)" and A4: "P {is closed under} M" and A5: "r = OrderFromPosSet(R,A,P)" shows "IsAnOrdGroup(R,A,r)" "IsAnOrdRing(R,A,M,r)" "r {is total on} R" "PositiveSet(R,A,r) = P" "Nonnegative(R,A,r) = P ∪ {𝟬}" "HasNoZeroDivs(R,A,M)" proof - from A2 A3 A5 show I: "IsAnOrdGroup(R,A,r)" "r {is total on} R" and II: "PositiveSet(R,A,r) = P" and III: "Nonnegative(R,A,r) = P ∪ {𝟬}" using Ring_ZF_1_L1 group0.Group_ord_by_positive_set by auto from A2 A4 III have "Nonnegative(R,A,r) {is closed under} M" using Ring_ZF_1_L16 by simp with ringAssum A1 I show "IsAnOrdRing(R,A,M,r)" using OrdRing_ZF_1_L6 by simp with A4 II show "HasNoZeroDivs(R,A,M)" using OrdRing_ZF_1_L2 ring1.OrdRing_ZF_3_L3 by auto qed text‹Nontrivial ordered rings are infinite. More precisely we assume that the neutral element of the additive operation is not equal to the multiplicative neutral element and show that the the set of positive elements of the ring is not a finite subset of the ring and the ring is not a finite subset of itself.› theorem (in ring1) ord_ring_infinite: assumes "𝟬≠𝟭" shows "R⇩_{+}∉ Fin(R)" "R ∉ Fin(R)" using assms Ring_ZF_1_L17 OrdRing_ZF_1_L4 group3.Linord_group_infinite by auto text‹If every element of a nontrivial ordered ring can be dominated by an element from $B$, then we $B$ is not bounded and not finite.› lemma (in ring1) OrdRing_ZF_3_L4: assumes "𝟬≠𝟭" and "∀a∈R. ∃b∈B. a\<lsq>b" shows "¬IsBoundedAbove(B,r)" "B ∉ Fin(R)" using assms Ring_ZF_1_L17 OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_2_L2A by auto text‹If $m$ is greater or equal the multiplicative unit, then the set $\{m\cdot n: n\in R\}$ is infinite (unless the ring is trivial).› lemma (in ring1) OrdRing_ZF_3_L5: assumes A1: "𝟬≠𝟭" and A2: "𝟭\<lsq>m" shows "{m⋅x. x∈R⇩_{+}} ∉ Fin(R)" "{m⋅x. x∈R} ∉ Fin(R)" "{(\<rm>m)⋅x. x∈R} ∉ Fin(R)" proof - from A2 have T: "m∈R" using OrdRing_ZF_1_L3 by simp from A2 have "𝟬\<lsq>𝟭" "𝟭\<lsq>m" using ordring_one_is_nonneg by auto then have I: "𝟬\<lsq>m" by (rule ring_ord_transitive) let ?B = "{m⋅x. x∈R⇩_{+}}" { fix a assume A3: "a∈R" then have "a\<lsq>𝟬 ∨ (𝟬\<lsq>a ∧ a≠𝟬)" using ord_ring_split2 by simp moreover { assume A4: "a\<lsq>𝟬" from A1 have "m⋅𝟭 ∈ ?B" using ordring_one_is_pos by auto with T have "m∈?B" using Ring_ZF_1_L3 by simp moreover from A4 I have "a\<lsq>m" by (rule ring_ord_transitive) ultimately have "∃b∈?B. a\<lsq>b" by blast } moreover { assume A4: "𝟬\<lsq>a ∧ a≠𝟬" with A3 have "m⋅a ∈ ?B" using PositiveSet_def by auto moreover from A2 A4 have "𝟭⋅a \<lsq> m⋅a" using OrdRing_ZF_1_L9 by simp with A3 have "a \<lsq> m⋅a" using Ring_ZF_1_L3 by simp ultimately have "∃b∈?B. a\<lsq>b" by auto } ultimately have "∃b∈?B. a\<lsq>b" by auto } then have "∀a∈R. ∃b∈?B. a\<lsq>b" by simp with A1 show "?B ∉ Fin(R)" using OrdRing_ZF_3_L4 by simp moreover have "?B ⊆ {m⋅x. x∈R}" using PositiveSet_def by auto ultimately show "{m⋅x. x∈R} ∉ Fin(R)" using Fin_subset by auto with T show "{(\<rm>m)⋅x. x∈R} ∉ Fin(R)" using Ring_ZF_1_L18 by simp qed text‹If $m$ is less or equal than the negative of multiplicative unit, then the set $\{m\cdot n: n\in R\}$ is infinite (unless the ring is trivial).› lemma (in ring1) OrdRing_ZF_3_L6: assumes A1: "𝟬≠𝟭" and A2: "m \<lsq> \<rm>𝟭" shows "{m⋅x. x∈R} ∉ Fin(R)" proof - from A2 have "(\<rm>(\<rm>𝟭)) \<lsq> \<rm>m" using OrdRing_ZF_1_L4B by simp with A1 have "{(\<rm>m)⋅x. x∈R} ∉ Fin(R)" using Ring_ZF_1_L2 Ring_ZF_1_L3 OrdRing_ZF_3_L5 by simp with A2 show "{m⋅x. x∈R} ∉ Fin(R)" using OrdRing_ZF_1_L3 Ring_ZF_1_L18 by simp qed text‹All elements greater or equal than an element of ‹R⇩_{+}› belong to ‹R⇩_{+}›. Property of ordered groups.› lemma (in ring1) OrdRing_ZF_3_L7: assumes A1: "a ∈ R⇩_{+}" and A2: "a\<lsq>b" shows "b ∈ R⇩_{+}" proof - from A1 A2 have "group3(R,A,r)" "a ∈ PositiveSet(R,A,r)" "⟨a,b⟩ ∈ r" using OrdRing_ZF_1_L4 by auto then have "b ∈ PositiveSet(R,A,r)" by (rule group3.OrderedGroup_ZF_1_L19) then show "b ∈ R⇩_{+}" by simp qed text‹A special case of ‹OrdRing_ZF_3_L7›: a ring element greater or equal than $1$ is positive.› corollary (in ring1) OrdRing_ZF_3_L8: assumes A1: "𝟬≠𝟭" and A2: "𝟭\<lsq>a" shows "a ∈ R⇩_{+}" proof - from A1 A2 have "𝟭 ∈ R⇩_{+}" "𝟭\<lsq>a" using ordring_one_is_pos by auto then show "a ∈ R⇩_{+}" by (rule OrdRing_ZF_3_L7) qed text‹Adding a positive element to $a$ strictly increases $a$. Property of ordered groups.› lemma (in ring1) OrdRing_ZF_3_L9: assumes A1: "a∈R" "b∈R⇩_{+}" shows "a \<lsq> a\<ra>b" "a ≠ a\<ra>b" using assms OrdRing_ZF_1_L4 group3.OrderedGroup_ZF_1_L22 by auto text‹A special case of ‹ OrdRing_ZF_3_L9›: in nontrivial rings adding one to $a$ increases $a$.› corollary (in ring1) OrdRing_ZF_3_L10: assumes A1: "𝟬≠𝟭" and A2: "a∈R" shows "a \<lsq> a\<ra>𝟭" "a ≠ a\<ra>𝟭" using assms ordring_one_is_pos OrdRing_ZF_3_L9 by auto text‹If $a$ is not greater than $b$, then it is strictly less than $b+1$.› lemma (in ring1) OrdRing_ZF_3_L11: assumes A1: "𝟬≠𝟭" and A2: "a\<lsq>b" shows "a\<ls> b\<ra>𝟭" proof - from A1 A2 have I: "b \<ls> b\<ra>𝟭" using OrdRing_ZF_1_L3 OrdRing_ZF_3_L10 by auto with A2 show "a\<ls> b\<ra>𝟭" by (rule ring_strict_ord_transit) qed text‹For any ring element $a$ the greater of $a$ and $1$ is a positive element that is greater or equal than $m$. If we add $1$ to it we get a positive element that is strictly greater than $m$. This holds in nontrivial rings.› lemma (in ring1) OrdRing_ZF_3_L12: assumes A1: "𝟬≠𝟭" and A2: "a∈R" shows "a \<lsq> GreaterOf(r,𝟭,a)" "GreaterOf(r,𝟭,a) ∈ R⇩_{+}" "GreaterOf(r,𝟭,a) \<ra> 𝟭 ∈ R⇩_{+}" "a \<lsq> GreaterOf(r,𝟭,a) \<ra> 𝟭" "a ≠ GreaterOf(r,𝟭,a) \<ra> 𝟭" proof - from linord have "r {is total on} R" using IsLinOrder_def by simp moreover from A2 have "𝟭 ∈ R" "a∈R" using Ring_ZF_1_L2 by auto ultimately have "𝟭 \<lsq> GreaterOf(r,𝟭,a)" and I: "a \<lsq> GreaterOf(r,𝟭,a)" using Order_ZF_3_L2 by auto with A1 show "a \<lsq> GreaterOf(r,𝟭,a)" and "GreaterOf(r,𝟭,a) ∈ R⇩_{+}" using OrdRing_ZF_3_L8 by auto with A1 show "GreaterOf(r,𝟭,a) \<ra> 𝟭 ∈ R⇩_{+}" using ordring_one_is_pos OrdRing_ZF_3_L1 IsOpClosed_def by simp from A1 I show "a \<lsq> GreaterOf(r,𝟭,a) \<ra> 𝟭" "a ≠ GreaterOf(r,𝟭,a) \<ra> 𝟭" using OrdRing_ZF_3_L11 by auto qed text‹We can multiply strict inequality by a positive element.› lemma (in ring1) OrdRing_ZF_3_L13: assumes A1: "HasNoZeroDivs(R,A,M)" and A2: "a\<ls>b" and A3: "c∈R⇩_{+}" shows "a⋅c \<ls> b⋅c" "c⋅a \<ls> c⋅b" proof - from A2 A3 have T: "a∈R" "b∈R" "c∈R" "c≠𝟬" using OrdRing_ZF_1_L3 PositiveSet_def by auto from A2 A3 have "a⋅c \<lsq> b⋅c" using OrdRing_ZF_1_L9A by simp moreover from A1 A2 T have "a⋅c ≠ b⋅c" using Ring_ZF_1_L12A by auto ultimately show "a⋅c \<ls> b⋅c" by simp moreover from mult_commut T have "a⋅c = c⋅a" and "b⋅c = c⋅b" using IsCommutative_def by auto ultimately show "c⋅a \<ls> c⋅b" by simp qed text‹A sufficient condition for an element to be in the set of positive ring elements.› lemma (in ring1) OrdRing_ZF_3_L14: assumes "𝟬\<lsq>a" and "a≠𝟬" shows "a ∈ R⇩_{+}" using assms OrdRing_ZF_1_L3 PositiveSet_def by auto text‹If a ring has no zero divisors, the square of a nonzero element is positive.› lemma (in ring1) OrdRing_ZF_3_L15: assumes "HasNoZeroDivs(R,A,M)" and "a∈R" "a≠𝟬" shows "𝟬 \<lsq> a⇧^{2}" "a⇧^{2}≠ 𝟬" "a⇧^{2}∈ R⇩_{+}" using assms OrdRing_ZF_1_L10 Ring_ZF_1_L12 OrdRing_ZF_3_L14 by auto text‹In rings with no zero divisors we can (strictly) increase a positive element by multiplying it by an element that is greater than $1$.› lemma (in ring1) OrdRing_ZF_3_L16: assumes "HasNoZeroDivs(R,A,M)" and "a ∈ R⇩_{+}" and "𝟭\<lsq>b" "𝟭≠b" shows "a\<lsq>a⋅b" "a ≠ a⋅b" using assms PositiveSet_def OrdRing_ZF_1_L16 OrdRing_ZF_1_L3 Ring_ZF_1_L12C by auto text‹If the right hand side of an inequality is positive we can multiply it by a number that is greater than one.› lemma (in ring1) OrdRing_ZF_3_L17: assumes A1: "HasNoZeroDivs(R,A,M)" and A2: "b∈R⇩_{+}" and A3: "a\<lsq>b" and A4: "𝟭\<ls>c" shows "a\<ls>b⋅c" proof - from A1 A2 A4 have "b \<ls> b⋅c" using OrdRing_ZF_3_L16 by auto with A3 show "a\<ls>b⋅c" by (rule ring_strict_ord_transit) qed text‹We can multiply a right hand side of an inequality between positive numbers by a number that is greater than one.› lemma (in ring1) OrdRing_ZF_3_L18: assumes A1: "HasNoZeroDivs(R,A,M)" and A2: "a ∈ R⇩_{+}" and A3: "a\<lsq>b" and A4: "𝟭\<ls>c" shows "a\<ls>b⋅c" proof - from A2 A3 have "b ∈ R⇩_{+}" using OrdRing_ZF_3_L7 by blast with A1 A3 A4 show "a\<ls>b⋅c" using OrdRing_ZF_3_L17 by simp qed text‹In ordered rings with no zero divisors if at least one of $a,b$ is not zero, then $0 < a^2+b^2$, in particular $a^2+b^2\neq 0$.› lemma (in ring1) OrdRing_ZF_3_L19: assumes A1: "HasNoZeroDivs(R,A,M)" and A2: "a∈R" "b∈R" and A3: "a ≠ 𝟬 ∨ b ≠ 𝟬" shows "𝟬 \<ls> a⇧^{2}\<ra> b⇧^{2}" proof - { assume "a ≠ 𝟬" with A1 A2 have "𝟬 \<lsq> a⇧^{2}" "a⇧^{2}≠ 𝟬" using OrdRing_ZF_3_L15 by auto then have "𝟬 \<ls> a⇧^{2}" by auto moreover from A2 have "𝟬 \<lsq> b⇧^{2}" using OrdRing_ZF_1_L10 by simp ultimately have "𝟬 \<ra> 𝟬 \<ls> a⇧^{2}\<ra> b⇧^{2}" using OrdRing_ZF_1_L19 by simp then have "𝟬 \<ls> a⇧^{2}\<ra> b⇧^{2}" using Ring_ZF_1_L2 Ring_ZF_1_L3 by simp } moreover { assume A4: "a = 𝟬" then have "a⇧^{2}\<ra> b⇧^{2}= 𝟬 \<ra> b⇧^{2}" using Ring_ZF_1_L2 Ring_ZF_1_L6 by simp also from A2 have "… = b⇧^{2}" using Ring_ZF_1_L4 Ring_ZF_1_L3 by simp finally have "a⇧^{2}\<ra> b⇧^{2}= b⇧^{2}" by simp moreover from A3 A4 have "b ≠ 𝟬" by simp with A1 A2 have "𝟬 \<lsq> b⇧^{2}" and "b⇧^{2}≠ 𝟬" using OrdRing_ZF_3_L15 by auto hence "𝟬 \<ls> b⇧^{2}" by auto ultimately have "𝟬 \<ls> a⇧^{2}\<ra> b⇧^{2}" by simp } ultimately show "𝟬 \<ls> a⇧^{2}\<ra> b⇧^{2}" by auto qed end