The goal of the Real_ZF series of theory files is to provide a contruction of the set of real numbers. There are several ways to construct real numbers. Most common start from the rational numbers and use Dedekind cuts or Cauchy sequences. Real_ZF_x.thy series formalizes an alternative approach that constructs real numbers directly from the group of integers. Our formalization is mostly based on \cite{Arthan2004}. Different variants of this contruction are also described in \cite{Campo2003} and \cite{Street2003}. I recommend to read these papers, but for the impatient here is a short description: we take a set of maps \(s : Z\rightarrow Z\) such that the set \(\{s(m+n)-s(m)-s(n)\}_{n,m \in Z}\) is finite (\(Z\) means the integers here). We call these maps slopes. Slopes form a group with the natural addition \((s+r)(n) = s(n)+r(n)\). The maps such that the set \(s(Z)\) is finite (finite range functions) form a subgroup of slopes. The additive group of real numbers is defined as the quotient group of slopes by the (sub)group of finite range functions. The multiplication is defined as the projection of the composition of slopes into the resulting quotient (coset) space.
This section contains the construction of the ring of real numbers as classes of slopes - integer almost homomorphisms. The real definitions are in Group_ZF_2 theory, here we just specialize the definitions of almost homomorphisms, their equivalence and operations to the additive group of integers from the general case of abelian groups considered in Group_ZF_2.
The set of slopes is defined as the set of almost homomorphisms on the additive group of integers.
definition
\( Slopes \equiv \text{AlmostHoms}(int,IntegerAddition) \)
The first operation on slopes (pointwise addition) is a special case of the first operation on almost homomorphisms.
definition
\( SlopeOp1 \equiv \text{AlHomOp1}(int,IntegerAddition) \)
The second operation on slopes (composition) is a special case of the second operation on almost homomorphisms.
definition
\( SlopeOp2 \equiv \text{AlHomOp2}(int,IntegerAddition) \)
Bounded integer maps are functions from integers to integers that have finite range. They play a role of zero in the set of real numbers we are constructing.
definition
\( BoundedIntMaps \equiv \text{FinRangeFunctions}(int,int) \)
Bounded integer maps form a normal subgroup of slopes. The equivalence relation on slopes is the (group) quotient relation defined by this subgroup.
definition
\( SlopeEquivalenceRel \equiv \text{QuotientGroupRel}(Slopes,SlopeOp1,BoundedIntMaps) \)
The set of real numbers is the set of equivalence classes of slopes.
definition
\( RealNumbers \equiv Slopes//SlopeEquivalenceRel \)
The addition on real numbers is defined as the projection of pointwise addition of slopes on the quotient. This means that the additive group of real numbers is the quotient group: the group of slopes (with pointwise addition) defined by the normal subgroup of bounded integer maps.
definition
\( RealAddition \equiv \text{ProjFun2}(Slopes,SlopeEquivalenceRel,SlopeOp1) \)
Multiplication is defined as the projection of composition of slopes on the quotient. The fact that it works is probably the most surprising part of the construction.
definition
\( RealMultiplication \equiv \text{ProjFun2}(Slopes,SlopeEquivalenceRel,SlopeOp2) \)
We first show that we can use theorems proven in some proof contexts (locales). The locale group1 requires assumption that we deal with an abelian group. The next lemma allows to use all theorems proven in the context called group1.
lemma Real_ZF_1_L1:
shows \( group1(int,IntegerAddition) \) using group1_axioms.intro, group1_def, Int_ZF_1_T2Real numbers form a ring. This is a special case of the theorem proven in Ring_ZF_1.thy, where we show the same in general for almost homomorphisms rather than slopes.
theorem Real_ZF_1_T1:
shows \( \text{IsAring}(RealNumbers,RealAddition,RealMultiplication) \)proofWe can use theorems proven in group0 and group1 contexts applied to the group of real numbers.
lemma Real_ZF_1_L2:
shows \( group0(RealNumbers,RealAddition) \), \( RealAddition \text{ is commutative on } RealNumbers \), \( group1(RealNumbers,RealAddition) \)proofLet's define some notation.
locale real0
defines \( \mathbb{R} \equiv RealNumbers \)
defines \( a + b \equiv RealAddition\langle a,b\rangle \)
defines \( - a \equiv \text{GroupInv}(\mathbb{R} ,RealAddition)(a) \)
defines \( a - b \equiv a + ( - b) \)
defines \( a\cdot b \equiv RealMultiplication\langle a,b\rangle \)
defines \( 0 \equiv \text{ TheNeutralElement}(RealNumbers,RealAddition) \)
defines \( 1 \equiv \text{ TheNeutralElement}(RealNumbers,RealMultiplication) \)
defines \( 2 \equiv 1 + 1 \)
defines \( \mathbb{R} _0 \equiv \mathbb{R} -\{ 0 \} \)
defines \( a^{-1} \equiv \text{GroupInv}(\mathbb{R} _0,\text{restrict}(RealMultiplication,\mathbb{R} _0\times \mathbb{R} _0))(a) \)
In real0 context all theorems proven in the ring0, context are valid.
lemma (in real0) Real_ZF_1_L3:
shows \( ring0(\mathbb{R} ,RealAddition,RealMultiplication) \) using Real_ZF_1_T1, ring0_def, Ring_ZF_1_L1Lets try out our notation to see that zero and one are real numbers.
lemma (in real0) Real_ZF_1_L4:
shows \( 0 \in \mathbb{R} \), \( 1 \in \mathbb{R} \) using Real_ZF_1_L3, Ring_ZF_1_L2The lemma below lists some properties that require one real number to state.
lemma (in real0) Real_ZF_1_L5:
assumes A1: \( a\in \mathbb{R} \)
shows \( ( - a) \in \mathbb{R} \), \( ( - ( - a)) = a \), \( a + 0 = a \), \( 0 + a = a \), \( a\cdot 1 = a \), \( 1 \cdot a = a \), \( a - a = 0 \), \( a - 0 = a \) using assms, Real_ZF_1_L3, Ring_ZF_1_L3The lemma below lists some properties that require two real numbers to state.
lemma (in real0) Real_ZF_1_L6:
assumes \( a\in \mathbb{R} \), \( b\in \mathbb{R} \)
shows \( a + b \in \mathbb{R} \), \( a - b \in \mathbb{R} \), \( a\cdot b \in \mathbb{R} \), \( a + b = b + a \), \( ( - a)\cdot b = - (a\cdot b) \), \( a\cdot ( - b) = - (a\cdot b) \) using assms, Real_ZF_1_L3, Ring_ZF_1_L4, Ring_ZF_1_L7Multiplication of reals is associative.
lemma (in real0) Real_ZF_1_L6A:
assumes \( a\in \mathbb{R} \), \( b\in \mathbb{R} \), \( c\in \mathbb{R} \)
shows \( a\cdot (b\cdot c) = (a\cdot b)\cdot c \) using assms, Real_ZF_1_L3, Ring_ZF_1_L11Addition is distributive with respect to multiplication.
lemma (in real0) Real_ZF_1_L7:
assumes \( a\in \mathbb{R} \), \( b\in \mathbb{R} \), \( c\in \mathbb{R} \)
shows \( a\cdot (b + c) = a\cdot b + a\cdot c \), \( (b + c)\cdot a = b\cdot a + c\cdot a \), \( a\cdot (b - c) = a\cdot b - a\cdot c \), \( (b - c)\cdot a = b\cdot a - c\cdot a \) using assms, Real_ZF_1_L3, ring_oper_distr, Ring_ZF_1_L8A simple rearrangement with four real numbers.
lemma (in real0) Real_ZF_1_L7A:
assumes \( a\in \mathbb{R} \), \( b\in \mathbb{R} \), \( c\in \mathbb{R} \), \( d\in \mathbb{R} \)
shows \( a - b + (c - d) = a + c - b - d \) using assms, Real_ZF_1_L2, group0_4_L8ARealAddition is defined as the projection of the first operation on slopes (that is, slope addition) on the quotient (slopes divided by the "almost equal" relation. The next lemma plays with definitions to show that this is the same as the operation induced on the appriopriate quotient group. The names AH, Op1 and FR are used in group1 context to denote almost homomorphisms, the first operation on AH and finite range functions resp.
lemma Real_ZF_1_L8:
assumes \( AH = \text{AlmostHoms}(int,IntegerAddition) \) and \( Op1 = \text{AlHomOp1}(int,IntegerAddition) \) and \( FR = \text{FinRangeFunctions}(int,int) \)
shows \( RealAddition = \text{QuotientGroupOp}(AH,Op1,FR) \) using assms, RealAddition_def, SlopeEquivalenceRel_def, QuotientGroupOp_def, Slopes_def, SlopeOp1_def, BoundedIntMaps_defThe symbol \( 0 \) in the real0 context is defined as the neutral element of real addition. The next lemma shows that this is the same as the neutral element of the appriopriate quotient group.
lemma (in real0) Real_ZF_1_L9:
assumes \( AH = \text{AlmostHoms}(int,IntegerAddition) \) and \( Op1 = \text{AlHomOp1}(int,IntegerAddition) \) and \( FR = \text{FinRangeFunctions}(int,int) \) and \( r = \text{QuotientGroupRel}(AH,Op1,FR) \)
shows \( \text{ TheNeutralElement}(AH//r, \text{QuotientGroupOp}(AH,Op1,FR)) = 0 \), \( SlopeEquivalenceRel = r \) using assms, Slopes_def, Real_ZF_1_L8, RealNumbers_def, SlopeEquivalenceRel_def, SlopeOp1_def, BoundedIntMaps_defZero is the class of any finite range function.
lemma (in real0) Real_ZF_1_L10:
assumes A1: \( s \in Slopes \)
shows \( SlopeEquivalenceRel\{s\} = 0 \longleftrightarrow s \in BoundedIntMaps \)proofWe will need a couple of results from Group_ZF_3.thy The first two that state that the definition of addition and multiplication of real numbers are consistent, that is the result does not depend on the choice of the slopes representing the numbers. The second one implies that what we call SlopeEquivalenceRel is actually an equivalence relation on the set of slopes. We also show that the neutral element of the multiplicative operation on reals (in short number \(1\)) is the class of the identity function on integers.
lemma Real_ZF_1_L11:
shows \( \text{Congruent2}(SlopeEquivalenceRel,SlopeOp1) \), \( \text{Congruent2}(SlopeEquivalenceRel,SlopeOp2) \), \( SlopeEquivalenceRel \subseteq Slopes \times Slopes \), \( \text{equiv}(Slopes, SlopeEquivalenceRel) \), \( SlopeEquivalenceRel\{id(int)\} = \) \( \text{ TheNeutralElement}(RealNumbers,RealMultiplication) \), \( BoundedIntMaps \subseteq Slopes \)proofA one-side implication of the equivalence from Real_ZF_1_L10: the class of a bounded integer map is the real zero.
lemma (in real0) Real_ZF_1_L11A:
assumes \( s \in BoundedIntMaps \)
shows \( SlopeEquivalenceRel\{s\} = 0 \) using assms, Real_ZF_1_L11, Real_ZF_1_L10The next lemma is rephrases the result from Group_ZF_3.thy that says that the negative (the group inverse with respect to real addition) of the class of a slope is the class of that slope composed with the integer additive group inverse. The result and proof is not very readable as we use mostly generic set theory notation with long names here. Real_ZF_1.thy contains the same statement written in a more readable notation: \([-s] = -[s]\).
lemma (in real0) Real_ZF_1_L12:
assumes A1: \( s \in Slopes \) and Dr: \( r = \text{QuotientGroupRel}(Slopes,SlopeOp1,BoundedIntMaps) \)
shows \( r\{ \text{GroupInv}(int,IntegerAddition)\circ s\} = - (r\{s\}) \)proofTwo classes are equal iff the slopes that represent them are almost equal.
lemma Real_ZF_1_L13:
assumes \( s \in Slopes \), \( p \in Slopes \) and \( r = SlopeEquivalenceRel \)
shows \( r\{s\} = r\{p\} \longleftrightarrow \langle s,p\rangle \in r \) using assms, Real_ZF_1_L11, eq_equiv_class, equiv_class_eqIdentity function on integers is a slope. This lemma concludes the easy part of the construction that follows from the fact that slope equivalence classes form a ring. It is easy to see that multiplication of classes of almost homomorphisms is not commutative in general. The remaining properties of real numbers, like commutativity of multiplication and the existence of multiplicative inverses have to be proven using properties of the group of integers, rather that in general setting of abelian groups. This is done in the Real_ZF_1 theory.
lemma Real_ZF_1_L14:
shows \( id(int) \in Slopes \)proofassumes \( R = \text{QuotientGroupRel}(AH,Op1,FR) \) and \( A = \text{ProjFun2}(AH,R,Op1) \), \( M = \text{ProjFun2}(AH,R,Op2) \)
shows \( \text{IsAring}(AH//R,A,M) \)assumes \( a\in R \)
shows \( ( - a) \in R \), \( ( - ( - a)) = a \), \( a + 0 = a \), \( 0 + a = a \), \( a\cdot 1 = a \), \( 1 \cdot a = a \), \( a - a = 0 \), \( a - 0 = a \), \( 2 \cdot a = a + a \), \( ( - a) + a = 0 \)assumes \( a\in R \), \( b\in R \)
shows \( a + b \in R \), \( a - b \in R \), \( a\cdot b \in R \), \( a + b = b + a \)assumes \( a\in R \), \( b\in R \)
shows \( ( - a)\cdot b = - (a\cdot b) \), \( a\cdot ( - b) = - (a\cdot b) \), \( ( - a)\cdot b = a\cdot ( - b) \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a + b + c = a + (b + c) \), \( a\cdot b\cdot c = a\cdot (b\cdot c) \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a\cdot (b + c) = a\cdot b + a\cdot c \), \( (b + c)\cdot a = b\cdot a + c\cdot a \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a\cdot (b - c) = a\cdot b - a\cdot c \), \( (b - c)\cdot a = b\cdot a - c\cdot a \)assumes \( P \text{ is commutative on } G \) and \( a\in G \), \( b\in G \), \( c\in G \), \( d\in G \)
shows \( a\cdot b^{-1}\cdot (c\cdot d^{-1}) = a\cdot c\cdot (b^{-1}\cdot d^{-1}) \), \( a\cdot b^{-1}\cdot (c\cdot d^{-1}) = a\cdot c\cdot b^{-1}\cdot d^{-1} \)assumes \( AH = \text{AlmostHoms}(int,IntegerAddition) \) and \( Op1 = \text{AlHomOp1}(int,IntegerAddition) \) and \( FR = \text{FinRangeFunctions}(int,int) \)
shows \( RealAddition = \text{QuotientGroupOp}(AH,Op1,FR) \)assumes \( s \in AH \) and \( r = \text{QuotientGroupRel}(AH,Op1,FR) \) and \( \text{ TheNeutralElement}(AH//r, \text{QuotientGroupOp}(AH,Op1,FR)) = e \)
shows \( r\{s\} = e \longleftrightarrow s \in FR \)assumes \( AH = \text{AlmostHoms}(int,IntegerAddition) \) and \( Op1 = \text{AlHomOp1}(int,IntegerAddition) \) and \( FR = \text{FinRangeFunctions}(int,int) \) and \( r = \text{QuotientGroupRel}(AH,Op1,FR) \)
shows \( \text{ TheNeutralElement}(AH//r, \text{QuotientGroupOp}(AH,Op1,FR)) = 0 \), \( SlopeEquivalenceRel = r \)assumes \( R = \text{QuotientGroupRel}(AH,Op1,FR) \)
shows \( \text{IsAmonoid}(AH//R, \text{ProjFun2}(AH,R,Op2)) \), \( R\{id(G)\} = \text{ TheNeutralElement}(AH//R, \text{ProjFun2}(AH,R,Op2)) \)assumes \( s \in Slopes \)
shows \( SlopeEquivalenceRel\{s\} = 0 \longleftrightarrow s \in BoundedIntMaps \)assumes \( s \in AH \) and \( r = \text{QuotientGroupRel}(AH,Op1,FR) \) and \( F = \text{ProjFun2}(AH,r,Op1) \)
shows \( r\{\sim s\} = \text{GroupInv}(AH//r,F)(r\{s\}) \)