Real numbers

The real numbers are defined here by axioms which define addition, multiplication, and the completeness property. Here we add some elementary consequences of the axioms such as subtraction.

We import the interfaces we build on, which are logic, set theory, and the real number axioms.  import (PROPOSITIONAL Interface:Classical_propositional_calculus ) import (FIRSTORDER Interface:First-order_logic_with_quantifiability (PROPOSITIONAL) ) import (SETS Interface:Set_theory (PROPOSITIONAL FIRSTORDER) ) import (AXIOMS Interface:Real_number_axioms (PROPOSITIONAL FIRSTORDER SETS) )

var (object a b c d) var (variable x y z) var (formula antecedent) 

Convenience builders
We adopted  and   as axioms. Here are some convenience rules which are direct results.  var (object A B A0 A1 B0 B1) thm (buildAddition ((HA (A0 = A1)) (HB (B0 = B1))) ((A0 + B0) = (A1 + B1)) ( HA       HB        introduceConjunction

A0 A1 B0 B1 AdditionBuilder applyModusPonens ))

thm (buildAdditionLL ((HB (B0 = B1))) ((A + B0) = (A + B1)) ( A EqualityReflexivity HB       buildAddition ))

thm (buildAdditionRR ((HA (A0 = A1))) ((A0 + B) = (A1 + B)) ( HA       B EqualityReflexivity buildAddition ))

thm (buildAdditionLLInConsequent ((HB (antecedent → (B0 = B1))))  (antecedent → ((A + B0) = (A + B1))) ( A EqualityReflexivity antecedent introduceAntecedent

HB

composeConjunction

A A B0 B1 AdditionBuilder applySyllogism ))

thm (buildMultiplication ((HA (A0 = A1)) (HB (B0 = B1))) ((A0 · B0) = (A1 · B1)) ( HA       HB        introduceConjunction

A0 A1 B0 B1 MultiplicationBuilder applyModusPonens ))

thm (buildMultiplicationLL ((HB (B0 = B1))) ((A · B0) = (A · B1)) ( A EqualityReflexivity HB       buildMultiplication ))

thm (buildMultiplicationRR ((HA (A0 = A1))) ((A0 · B) = (A1 · B)) ( HA       B EqualityReflexivity buildMultiplication ))



Addition
There are a few theorems which have different names in Interface:Real numbers than they did in Interface:Real number axioms, but are otherwise unchanged.  thm (RealAdditionCommutativity  (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → ((a + b) = (b + a))) ( a b AdditionCommutativity ))

thm (RealAdditionAssociativity  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) → (((a + b) + c) = (a + (b + c)))) ( a b c AdditionAssociativity ))

thm (RealAdditiveIdentity  ((a ∈ (ℝ)) → ((a + (0)) = a)) ( a AdditiveIdentity )) 

It will be convenient to have additive identity on both sides.  thm (RealAdditiveIdentityRight  ((a ∈ (ℝ)) → ((a + (0)) = a)) ( a AdditiveIdentity ))

thm (RealAdditiveIdentityLeft  ((a ∈ (ℝ)) → (((0) + a) = a)) ( ZeroReal (0) a RealAdditionCommutativity detach1of2

a AdditiveIdentity

applyEqualityTransitivityInConsequent )) 

Builders
We have assumed the basic addition builder as an axiom, so we just want to define some convenience theorems.  var (object b0 b1 a0 a1) thm (AdditionBuilderLL  ((b0 = b1) → ((a + b0) = (a + b1))) ( a EqualityReflexivity a a b0 b1 AdditionBuilder detach1of2 ))

thm (AdditionBuilderRR  ((a0 = a1) → ((a0 + b) = (a1 + b))) ( b EqualityReflexivity a0 a1 b b AdditionBuilder detach2of2 )) 

Additive inverse
We define  to be the unique number   for which.  def ((- a) (⋃ (separate x (ℝ) ((a + (value x)) = (0))))) 

We'll want the definition as an equality.  thm (AdditiveInverse ((a x) (a y) (x y))   ((- a) = (⋃ (separate x (ℝ) ((a + (value x)) = (0))))) ( (value y) (value x) a AdditionBuilderLL (0) buildEqualityRRInConsequent (ℝ) ChangeVariableSeparation buildUnion )) 

That an additive inverse exists is a consequence of the invertibility of addition. We just need to rearrange some things.  thm (RealAdditiveInverseExists ((x a)) ((a ∈ (ℝ)) → (∃ x (((value x) ∈ (ℝ)) ∧ ((a + (value x)) = (0))))) ( ZeroReal (0) a x AdditionInvertibility detach1of2

(0) (a + (value x)) EqualitySymmetry eliminateBiconditionalReverse ((value x) ∈ (ℝ)) conjoinLL x addThereExists applySyllogism )) 

Addition Cancellation
In this section we are going to prove.

 thm (RealAdditionCancellationRightForward-ab   ((((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ∧ ((a + c) = (b + c))) → (a = b)) ( </jh> We start with  and then add   to both sides.  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionLeftElimination

(a + c) (b + c) d AdditionBuilderRR applySyllogism </jh> The next step is to regroup the additions. This is just a matter of applying associativity twice, but needing to assert that all the terms are real is what makes this part of the proof longer.  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent

((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateRightConjunctInConsequent eliminateLeftConjunctInConsequent composeConjunction

((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateLeftConjunctInConsequent eliminateRightConjunctInConsequent composeConjunction

a c d AdditionAssociativity applySyllogism

((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent eliminateLeftConjunctInConsequent

((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateRightConjunctInConsequent eliminateLeftConjunctInConsequent composeConjunction

((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateLeftConjunctInConsequent eliminateRightConjunctInConsequent composeConjunction

b c d AdditionAssociativity applySyllogism

buildEqualityInConsequent

eliminateBiconditionalReverseInConsequent applyModusPonensInConsequent </jh> That gives us. Now we turn each occurrence of  into   via the substitution.  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateLeftConjunctInConsequent eliminateLeftConjunctInConsequent

(c + d) (0) a AdditionBuilderLL (c + d) (0) b AdditionBuilderLL buildEqualityInConsequent eliminateBiconditionalReverseInConsequent applySyllogism

applyModusPonensInConsequent </jh> Now we have  and we just need to turn that into.  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent

a RealAdditiveIdentity applySyllogism

((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) ∧ ((d ∈ (ℝ)) ∧ ((c + d) = (0)))) ((a + c) = (b + c)) ConjunctionRightElimination eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent eliminateLeftConjunctInConsequent

b RealAdditiveIdentity applySyllogism

buildEqualityInConsequent eliminateBiconditionalReverseInConsequent applyModusPonensInConsequent ))

thm (RealAdditionCancellationRightForward ( (x a) (x b) (x c))  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) → (((a + c) = (b + c)) → (a = b))) ( </jh> We start with  ((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionLeftElimination c x RealAdditiveInverseExists applySyllogism </jh> Copying the antecedent inside the quantifier we are ready to apply our lemma.  repeatAntecedentThereExists

a b c (value x) RealAdditionCancellationRightForward-ab export x addThereExists applySyllogism

removeThereExistsInConsequent )) </jh>

We've proved the interesting direction of cancellation, but in line with our usual practice of biconditionalizing theorems which can be biconditionalized, we combine it with the addition builder.  thm (RealAdditionCancellationRight   ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) → (((a + c) = (b + c)) ↔ (a = b))) ( a b c RealAdditionCancellationRightForward

a b c AdditionBuilderRR (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) introduceAntecedent

introduceBiconditionalFromImplicationsInConsequent )) </jh>

Cancelling on the left
Cancelling on the left is an easy consequence, because addition is commutative.  thm (RealAdditionCancellationLeft   ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) → (((a + b) = (a + c)) ↔ (b = c))) ( </jh> First we need  ((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionRightElimination a b RealAdditionCommutativity applySyllogism

((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionRightElimination eliminateRightConjunctInConsequent ((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionLeftElimination composeConjunction a c RealAdditionCommutativity applySyllogism

buildEqualityInConsequent </jh> Then right cancellation is, which finishes the proof.  ((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionRightElimination eliminateLeftConjunctInConsequent ((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionLeftElimination composeConjunction

((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) (c ∈ (ℝ)) ConjunctionRightElimination eliminateRightConjunctInConsequent composeConjunction

b c a RealAdditionCancellationRight applySyllogism

applyBiconditionalTransitivityInConsequent )) </jh>

Proving closure based on uniqueness
Here are some theorems about showing that an operation is closed on a base set. They start from the starting point that the result of the operation is unique. That is,  (where   and   represent the same formula, with   and with , respectively).

We start by showing that. This is basically just a matter of substitution into  and.  var (object baseSet xx yy) var (formula φx φy)

thm (ClosureLemma1Reverse-baseSet ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → ((A = (value x)) → (A ∈ baseSet))) ( (((value x) ∈ baseSet) ∧ φx) (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x)))) ConjunctionRightElimination eliminateRightConjunctInConsequent

A (value x) baseSet MembershipBuilderRR eliminateBiconditionalForwardInConsequent applyComm

applySyllogism ))

thm (ClosureLemma1Reverse-phiy ((y φx) (y x)) ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → ((A = (value x)) → (subst A y φy))) ( </jh> We first transform  to.  (((value x) ∈ baseSet) ∧ φx) (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x)))) ConjunctionRightElimination eliminateLeftConjunctInConsequent

(value y) (value x) EqualitySymmetry eliminateBiconditionalReverse HSUB applySyllogism

φx φy BiconditionalSymmetry eliminateBiconditionalReverse applySyllogism

makeSubstExplicit

eliminateBiconditionalForward applySyllogism </jh> Then we can turn the substitution  into.  A (value x) y φy SubstBuilderReplacement eliminateBiconditionalForwardInConsequent applyComm

applySyllogism ))

thm (ClosureLemma1Reverse ((y φx) (y x)) ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → ((A = (value x)) → ((A ∈ baseSet) ∧ (subst A y φy)))) ( HSUB baseSet A ClosureLemma1Reverse-baseSet

HSUB baseSet A ClosureLemma1Reverse-phiy

composeConjunction

(A = (value x)) (A ∈ baseSet) (subst A y φy) ConjunctionComposition eliminateBiconditionalReverse applySyllogism )) </jh>

The converse of that is. Here we use uniqueness. That is, we take  and specialize   to.  thm (ClosureLemma1Forward ((A y) (baseSet y) (x y)) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → (((A ∈ baseSet) ∧ (subst A y φy)) → (A = (value x)))) ( (((value x) ∈ baseSet) ∧ φx) (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x)))) ConjunctionLeftElimination

A specializeToObjectInConsequent

A y (((value y) ∈ baseSet) ∧ φy) ((value y) = (value x)) SubstImplication eliminateBiconditionalReverse applySyllogism

A y ((value y) ∈ baseSet) φy SubstConjunction (subst A y ((value y) = (value x))) buildImplicationConsequent eliminateBiconditionalReverse applySyllogism </jh> So far we have. The first substitution can be simplified via, which leads to  , and likewise for the third.  (value y) A baseSet MembershipBuilderRR makeSubstExplicit

(subst A y φy) buildConjunctionRR

(value y) A (value x) EqualityBuilderRR makeSubstExplicit

buildImplication

eliminateBiconditionalReverse applySyllogism )) </jh>

Combining the two previous results gives. <jh> thm (ClosureLemma1 ((y φx) (y x) (y A) (y baseSet)) ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → (((A ∈ baseSet) ∧ (subst A y φy)) ↔ (A = (value x)))) ( x baseSet φx y φy A ClosureLemma1Forward

HSUB baseSet A ClosureLemma1Reverse

introduceBiconditionalFromImplicationsInConsequent )) </jh>

Next we want. This follows from the previous result by  and.

<jh> thm (ClosureLemma2 ((y φx) (y x) (y A) (y baseSet)) ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → ((A ∈ (separate y baseSet φy)) ↔ (A ∈ (singleton (value x))))) ( HSUB baseSet A ClosureLemma1

A y baseSet φy Separation A (value x) Singleton buildBiconditional

eliminateBiconditionalForward applySyllogism )) </jh>

We're getting close, because the previous lemma is just extensionality away from, and adding union to both sides gives.

<jh> thm (UnionUnique ((y φx) (y x) (y A) (y baseSet) (z x) (z baseSet) (z φx) (z y) (z φy))  ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → ((⋃ (separate y baseSet φy)) = (value x))) ( HSUB baseSet (value z) ClosureLemma2 z addForAllToConsequent

z (separate y baseSet φy) (singleton (value x)) Extensionality applySyllogism

(separate y baseSet φy) (singleton (value x)) UnionBuilder applySyllogism

(value x) UnionSingleton (⋃ (separate y baseSet φy)) buildEqualityLL eliminateBiconditionalReverse applySyllogism )) </jh>

Here's our main closure theorem: if a predicate holds for exactly one element of a base set, then we can define a member of the base set which obeys the predicate (as the union of the set of all elements in the base set which obey the predicate). <jh> thm (Closure ((y φx) (y x) (y baseSet) (y A))  ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → ((⋃ (separate y baseSet φy)) ∈ baseSet)) ( </jh> First is picking out. <jh> (((value x) ∈ baseSet) ∧ φx) (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x)))) ConjunctionRightElimination eliminateRightConjunctInConsequent

</jh> Next is, which by means of a builder we can transform to. <jh> HSUB baseSet UnionUnique

(⋃ (separate y baseSet φy)) (value x) baseSet MembershipBuilderRR applySyllogism </jh> Combining those two we are done. <jh> eliminateBiconditionalForwardInConsequent applyModusPonensInConsequent )) </jh>

Closure of additive inverse
Here we prove that  is real if   is real. This involves showing that the additive inverse is unique and then applying.

<jh> thm (RealAdditiveInverseClosed-uniq1  (((a ∈ (ℝ)) ∧  (((xx ∈ (ℝ)) ∧ ((a + xx) = (0))) ∧ ((yy ∈ (ℝ)) ∧ ((a + yy) = (0))))) → (yy = xx)) ( </jh> We start with. <jh> (a ∈ (ℝ)) (((xx ∈ (ℝ)) ∧ ((a + xx) = (0))) ∧ ((yy ∈ (ℝ)) ∧ ((a + yy) = (0)))) ConjunctionLeftElimination eliminateLeftConjunctInConsequent eliminateLeftConjunctInConsequent

(a ∈ (ℝ)) (((xx ∈ (ℝ)) ∧ ((a + xx) = (0))) ∧ ((yy ∈ (ℝ)) ∧ ((a + yy) = (0)))) ConjunctionLeftElimination eliminateRightConjunctInConsequent eliminateLeftConjunctInConsequent swapEqualityInConsequent

applyEqualityTransitivityInConsequent </jh> Cancelling the  gives , which is what we need. <jh> (a ∈ (ℝ)) (((xx ∈ (ℝ)) ∧ ((a + xx) = (0))) ∧ ((yy ∈ (ℝ)) ∧ ((a + yy) = (0)))) ConjunctionRightElimination

(a ∈ (ℝ)) (((xx ∈ (ℝ)) ∧ ((a + xx) = (0))) ∧ ((yy ∈ (ℝ)) ∧ ((a + yy) = (0)))) ConjunctionLeftElimination eliminateLeftConjunctInConsequent eliminateRightConjunctInConsequent composeConjunction

(a ∈ (ℝ)) (((xx ∈ (ℝ)) ∧ ((a + xx) = (0))) ∧ ((yy ∈ (ℝ)) ∧ ((a + yy) = (0)))) ConjunctionLeftElimination eliminateRightConjunctInConsequent eliminateRightConjunctInConsequent composeConjunction

a yy xx RealAdditionCancellationLeft applySyllogism

eliminateBiconditionalReverseInConsequent applyModusPonensInConsequent ))

thm (RealAdditiveInverseClosed-uniq2 ((a x) (y a) (y x)) ((a ∈ (ℝ)) → (∃ x ((((value x) ∈ (ℝ)) ∧ ((a + (value x)) = (0))) ∧ (∀ y ((((value y) ∈ (ℝ)) ∧ ((a + (value y)) = (0))) → ((value y) = (value x))))) ) ) ( </jh> We start with. <jh> a x RealAdditiveInverseExists repeatAntecedentThereExists </jh> We'll also need  a bit later. <jh> (a ∈ (ℝ)) (((value x) ∈ (ℝ)) ∧ ((a + (value x)) = (0))) ConjunctionLeftElimination </jh> Setting that aside for a bit, rearranging  a bit gives <jh> a (value x) (value y) RealAdditiveInverseClosed-uniq1

(a ∈ (ℝ)) (((value x) ∈ (ℝ)) ∧ ((a + (value x)) = (0))) (((value y) ∈ (ℝ)) ∧ ((a + (value y)) = (0))) ConjunctionAssociativity swapBiconditional transformAntecedent export

y addForAllToConsequent </jh> Adding a copy of  to the consequent and then adding   to both antecedent and consequent gives us. <jh> composeConjunction

x addThereExists </jh> Combining that with  we are done. <jh> applySyllogism )) </jh>

Proving closure is just a matter of combining  and. <jh> thm (RealAdditiveInverseClosed ( (y a) (y x) (x a))  ((a ∈ (ℝ)) → ((- a) ∈ (ℝ))) ( a x y RealAdditiveInverseClosed-uniq2

(value x) (value y) a AdditionBuilderLL (0) buildEqualityRRInConsequent

(ℝ) Closure x addThereExists

applySyllogism removeThereExistsInConsequent )) </jh>

Here's an alternate name and some rules. <jh> thm (RealAdditiveInverseClosure   ((a ∈ (ℝ)) → ((- a) ∈ (ℝ))) ( a RealAdditiveInverseClosed ))

thm (closeAdditiveInverseInConsequent ((H (antecedent → (a ∈ (ℝ)))))  (antecedent → ((- a) ∈ (ℝ))) ( H       a RealAdditiveInverseClosure applySyllogism )) </jh>

Subtraction
We define  to be.

<jh> def ((− b a) (b + (- a))) </jh>

Closure
Subtraction is closed. <jh> thm (RealSubtractionClosure  (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → ((a − b) ∈ (ℝ))) ( (a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionRightElimination

(a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination b RealAdditiveInverseClosed applySyllogism

composeConjunction

a (- b) RealAdditionClosure applySyllogism ))

thm (RealSubtractionClosed  (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → ((a − b) ∈ (ℝ))) ( a b RealSubtractionClosure )) </jh>
 * 1) synonym: goal is to move to *Closure not *Closed names

Subtraction and additive inverse
Here we prove that. This is just a restatement of our definition of subtraction. Apparently JHilbert does not expand  according to its definition, once on each side of the equality, because we do not need to apply   and various builders to show that the two instances of   are equal. <jh> thm (RealSubtraction  (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → ((a − b) = (a + (- b)))) ( (a + (- b)) EqualityReflexivity ((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) introduceAntecedent )) </jh>

Subtracting a number from itself
In this section we are trying to prove that, or, applying the definition of subtraction,.

The first step is, which we basically proved when we were working on closure. We prove a general-purpose corollary of  (really just a rearrangement), and then apply it to this case. <jh> thm (UnionUnique-x ((y φx) (y x) (y A) (y baseSet)  (z x) (z baseSet) (z φx) (z y) (z φy))  ((HSUB (((value x) = (value y)) → (φx ↔ φy)))) ( ((((value x) ∈ baseSet) ∧ φx) ∧ (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x))))) → (φx ∧ ((⋃ (separate y baseSet φy)) = (value x)))) ( (((value x) ∈ baseSet) ∧ φx) (∀ y ((((value y) ∈ baseSet) ∧ φy) → ((value y) = (value x)))) ConjunctionRightElimination eliminateLeftConjunctInConsequent

HSUB baseSet UnionUnique

composeConjunction ))

thm (RealSubtractionItselfLemma ((x a) (y a) (y x))   ((a ∈ (ℝ)) → (∃ x (((a + (value x)) = (0)) ∧ ((- a) = (value x))))) ( a x y RealAdditiveInverseClosed-uniq2

(value x) (value y) a AdditionBuilderLL (0) buildEqualityRRInConsequent

(ℝ) UnionUnique-x x addThereExists

applySyllogism )) </jh>

Here is  itself. It is just a substitution from. <jh> thm (RealSubtractionItself ( (x a) (y a) (y x))  ((a ∈ (ℝ)) → ((a − a) = (0))) ( a x RealSubtractionItselfLemma </jh> Our substitution is. <jh> (- a) (value x) a AdditionBuilderLL (0) buildEqualityRRInConsequent eliminateBiconditionalForwardInConsequent applyComm import </jh> Then we combine that with the lemma. <jh> x addThereExists applySyllogism </jh> At this point we just need to remove. However, if we just did that now, the automatic expansion of the  definition would created a distinct variable constraint we would be unable to satisfy. Expanding the definition solves this problem. <jh> a y AdditiveInverse a buildAdditionLL (0) buildEqualityRR eliminateBiconditionalReverse x addThereExists applySyllogism

removeThereExistsInConsequent )) </jh>

Differences which are zero
The difference between two numbers is zero if and only if they are equal. <jh> thm (RealZeroDifferenceEquality   (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → (((a − b) = (0)) ↔ (a = b))) ( </jh> We start with. <jh> (a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionRightElimination

(a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination closeAdditiveInverseInConsequent composeConjunction

(a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination composeConjunction

a (- b) b RealAdditionAssociativity applySyllogism

(a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination closeAdditiveInverseInConsequent

(a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination composeConjunction

(- b) b RealAdditionCommutativity applySyllogism

a buildAdditionLLInConsequent

applyEqualityTransitivityInConsequent ((0) + b) buildEqualityRRInConsequent applyBiconditionalTransitivityInConsequent </jh> Next we turn  into zero, <jh> (a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination b RealSubtractionItself applySyllogism

a buildAdditionLLInConsequent ((0) + b) buildEqualityRRInConsequent applyBiconditionalTransitivityInConsequent </jh> and apply additive identity to give. <jh> (a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionRightElimination a RealAdditiveIdentityRight applySyllogism

(a ∈ (ℝ)) (b ∈ (ℝ)) ConjunctionLeftElimination b RealAdditiveIdentityLeft applySyllogism

buildEqualityInConsequent applyBiconditionalTransitivityInConsequent )) </jh>

Multiplication
There are a few theorems which have different names in Interface:Real numbers than they did in Interface:Real number axioms, but are otherwise unchanged.

<jh> thm (RealMultiplicationClosure  (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → ((a · b) ∈ (ℝ))) ( a b MultiplicationClosure ))

thm (RealMultiplicationCommutativity  (((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) → ((a · b) = (b · a))) ( a b MultiplicationCommutativity ))

thm (RealMultiplicationAssociativity  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) → (((a · b) · c) = (a · (b · c)))) ( a b c MultiplicationAssociativity ))

thm (RealDistributivity  ((((a ∈ (ℝ)) ∧ (b ∈ (ℝ))) ∧ (c ∈ (ℝ))) → ((a · (b + c)) = ((a · b) + (a · c)))) ( a b c Distributivity ))

thm (RealMultiplicativeIdentity  ((a ∈ (ℝ)) → ((a · (1)) = a)) ( a MultiplicativeIdentity )) </jh>

Division
We define  to be the unique number   for which. Our notation for this is, which works for non-zero   because the union of a singleton is the singleton's element. If  is zero, the definition can produce anything (in particular, it doesn't need to produce a real number), because we don't expect dividing by zero to yield anything useful.

<jh> def ((/ b a) (⋃ (separate x (ℝ) ((a · (value x)) = b)))) </jh>

Constants
To export to Interface:Real numbers, we need to define various contants, such as  and. Since we have already defined addition and multiplication, we have what we need to define these constants. <jh> def ((2) ((1) + (1))) def ((3) ((2) + (1))) def ((4) ((3) + (1))) def ((5) ((4) + (1))) def ((6) ((5) + (1))) def ((7) ((6) + (1))) def ((8) ((7) + (1))) def ((9) ((8) + (1))) def ((10) ((9) + (1))) def ((11) ((10) + (1))) def ((12) ((11) + (1))) def ((30) ((3) · (10))) def ((45) (((4) · (10)) + (5))) def ((60) ((6) · (10))) def ((90) ((9) · (10))) def ((100) ((10) · (10))) def ((180) ((100) + ((8) · (10)))) def ((360) (((3) · (100)) + (60))) def ((1000) ((100) · (10))) def ((1000000) ((1000) · (1000))) </jh>

All of the above constants are real numbers. Here we prove this for each one. <jh> thm (closeAddition ((HLeft (a ∈ (ℝ))) (HRight (b ∈ (ℝ)))) ((a + b) ∈ (ℝ)) ( HLeft HRight introduceConjunction

a b RealAdditionClosure applyModusPonens ))

thm (closeMultiplication ((HLeft (a ∈ (ℝ))) (HRight (b ∈ (ℝ)))) ((a · b) ∈ (ℝ)) ( HLeft HRight introduceConjunction

a b RealMultiplicationClosure applyModusPonens ))

thm (TwoReal  ((2) ∈ (ℝ)) ( OneReal OneReal closeAddition ))

thm (ThreeReal  ((3) ∈ (ℝ)) ( TwoReal OneReal closeAddition ))

thm (FourReal  ((4) ∈ (ℝ)) (ThreeReal OneReal closeAddition)) thm (FiveReal  ((5) ∈ (ℝ)) (FourReal OneReal closeAddition)) thm (SixReal  ((6) ∈ (ℝ)) (FiveReal OneReal closeAddition)) thm (SevenReal  ((7) ∈ (ℝ)) (SixReal OneReal closeAddition)) thm (EightReal  ((8) ∈ (ℝ)) (SevenReal OneReal closeAddition)) thm (NineReal  ((9) ∈ (ℝ)) (EightReal OneReal closeAddition)) thm (TenReal  ((10) ∈ (ℝ)) (NineReal OneReal closeAddition)) thm (ElevenReal  ((11) ∈ (ℝ)) (TenReal OneReal closeAddition)) thm (TwelveReal  ((12) ∈ (ℝ)) (ElevenReal OneReal closeAddition)) thm (ThirtyReal  ((30) ∈ (ℝ)) (ThreeReal TenReal closeMultiplication)) thm (FortyFiveReal  ((45) ∈ (ℝ)) (FourReal TenReal closeMultiplication FiveReal closeAddition)) thm (SixtyReal  ((60) ∈ (ℝ)) (SixReal TenReal closeMultiplication)) thm (NinetyReal  ((90) ∈ (ℝ)) (NineReal TenReal closeMultiplication)) thm (HundredReal  ((100) ∈ (ℝ)) (TenReal TenReal closeMultiplication)) thm (HundredEightyReal  ((180) ∈ (ℝ)) (HundredReal EightReal TenReal closeMultiplication closeAddition)) thm (ThreeHundredSixtyReal  ((360) ∈ (ℝ)) ( ThreeReal HundredReal closeMultiplication SixReal TenReal closeMultiplication closeAddition )) thm (ThousandReal  ((1000) ∈ (ℝ)) (HundredReal TenReal closeMultiplication)) thm (MillionReal  ((1000000) ∈ (ℝ)) (ThousandReal ThousandReal closeMultiplication)) </jh>

Order
Our axioms define a total (linear) order, so we just need to define the various convenience theorems and other total order notations.

To get to the starting point (Interface:First-order linear order defined via strict inequality), we need to prove a few theorems (there are various ways to state that an order is a total order, and the one there is slightly different than the one at Interface:Real number axioms).

Using Interface:First-order linear order defined via strict inequality is actually kind of awkward here, as it is a first-order theory and we are built on set theory. But partly just as a proof of concept that such things can be done, we translate between the two worlds rather than just duplicating the linear order proofs in a set theory context. We use the  prefix for things which are restricted to real numbers.

<jh> def ((universe) (ℝ)) export (UNIVERSE Interface:Universe (PROPOSITIONAL FIRSTORDER SETS) ) import (RESTRICT Interface:Restricting_all_quantifiers (PROPOSITIONAL FIRSTORDER SETS UNIVERSE) restrict.)

var (restrict.object restrict.x restrict.y restrict.z) def ((restrict.< restrict.x restrict.y) ((restrict.asSet restrict.x) < (restrict.asSet restrict.y))) thm (restrict.LessThanAsymmetry   ((restrict.x restrict.< restrict.y) → (¬ (restrict.y restrict.< restrict.x))) ( restrict.x restrict.InUniverse restrict.y restrict.InUniverse introduceConjunction

(restrict.asSet restrict.x) (restrict.asSet restrict.y) LessThanAsymmetry applyModusPonens ))

var (restrict.object restrict.x0 restrict.x1 restrict.y0 restrict.y1) thm (restrict.LessThanBuilder   (((restrict.x0 restrict.= restrict.x1) ∧ (restrict.y0 restrict.= restrict.y1)) → ((restrict.x0 restrict.< restrict.y0) ↔ (restrict.x1 restrict.< restrict.y1)) ) (       (restrict.asSet restrict.x0) (restrict.asSet restrict.x1) (restrict.asSet restrict.y0) (restrict.asSet restrict.y1) LessThanBuilder ))

thm (restrict.LessThanTransitivity   (((restrict.x restrict.< restrict.y) ∧ (restrict.y restrict.< restrict.z)) → (restrict.x restrict.< restrict.z)) ( restrict.x restrict.InUniverse restrict.y restrict.InUniverse introduceConjunction

restrict.z restrict.InUniverse introduceConjunction

(restrict.asSet restrict.x) (restrict.asSet restrict.y) (restrict.asSet restrict.z) LessThanTransitivity applyModusPonens ))

</jh>

The first substantive order theorem is. The proof is by contradiction: if, then   (by LessThanAsymmetry), which is a contradiction. <jh> thm (restrict.LessThanIrreflexivity  (¬ (restrict.x restrict.< restrict.x)) ( restrict.x restrict.x restrict.LessThanAsymmetry deduceNegationFromContradiction )) </jh>

The other non-trivial theorem is that we need to restate totality a bit. <jh> thm (restrict.LessThanTotality   (((restrict.x restrict.< restrict.y) ∨ (restrict.x restrict.= restrict.y)) ∨ (restrict.y restrict.< restrict.x)) ( restrict.x restrict.InUniverse restrict.y restrict.InUniverse introduceConjunction (restrict.asSet restrict.x) (restrict.asSet restrict.y) LessThanTotalityImplication applyModusPonens

convertToDisjunctionFromImplication groupDisjunctionLeft swap12ofDisjunction3 ))

export (ORDER_DEFINED Interface:First-order_linear_order_defined_via_strict_inequality (PROPOSITIONAL RESTRICT) restrict.)

import (ORDER Interface:First-order_linear_order_from_strict_inequality (PROPOSITIONAL RESTRICT ORDER_DEFINED) restrict.) </jh>

We've defined all the order theorems and notations in the  world; we just need to translate back to the set theory world. <jh> def ((> a b) ((restrict.asRestrictedTerm a) restrict.> (restrict.asRestrictedTerm b))) def ((≤ a b) ((restrict.asRestrictedTerm a) restrict.≤ (restrict.asRestrictedTerm b))) def ((≥ a b) ((restrict.asRestrictedTerm a) restrict.≥ (restrict.asRestrictedTerm b))) </jh>

Square root
We define the square root of  as the unique number   for which. If there is no such unique number (that is, if  is negative), we need not define it to be a real number or anything else in particular.

<jh> def ((√ a) (⋃ (separate x (ℝ) (((value x) · (value x)) = a)))) </jh>

Export
<jh> </jh>
 * 1) export (RESULTS Interface:Real_numbers (PROPOSITIONAL FIRSTORDER SETS) )