Homotopy Type Theory decimal numbers > history (Rev #8, changes)

Showing changes from revision #7 to #8: Added | Removed | Changed

Contents

Whenever editing is allowed on the nLab again, this article should be ported over there.

Idea

The decimal numbers as familiar from school mathematics.

Definition

In set theory

The type of decimal numbers, denoted [1/10]\mathbb{Z}[1/10], is defined as the higher inductive type generated by:

Let us define a decimal number algebra to be a set AA with a function ιA ×\iota \in A^{\mathbb{Z} \times \mathbb{N}} with domain the Cartesian product ×\mathbb{Z} \times \mathbb{N} and codomain AA, such that

  • A function ()/10 ():×[1/10](-)/10^{(-)}:\mathbb{Z} \times \mathbb{N} \rightarrow \mathbb{Z}[1/10]. The integer a:a:\mathbb{Z} represents the integer if one ignores the decimal separator in the decimal numeral representation of the decimal number, and the natural number b:b:\mathbb{N} represents the number of digits to the left of the final digit where the decimal separator ought to be placed after in the decimal numeral representation of the decimal number.
  • A dependent product of functions between identities representing that equivalent decimals are equal:
    equivdec: a: b: c: d:(a10 d=c10 b)(a/10 b=c/10 d)equivdec : \prod_{a:\mathbb{Z}} \prod_{b:\mathbb{N}} \prod_{c:\mathbb{Z}} \prod_{d:\mathbb{N}} (a \cdot 10^d = c \cdot 10^b) \to (a/10^b = c/10^d)

    (i.e. 1.00 = 1.000 with decimal numeral representations)

  • A set-truncator
    τ 0: a:[1/10] b:[1/10]isProp(a=b)\tau_0: \prod_{a:\mathbb{Z}[1/10]} \prod_{b:\mathbb{Z}[1/10]} isProp(a=b)
a.b.c.d.(a10 d=c10 b)(ι(a,b)=ι(c,d))\forall a \in \mathbb{Z}. \forall b \in \mathbb{N}. \forall c \in \mathbb{Z}. \forall d \in \mathbb{N}. (a \cdot 10^d = c \cdot 10^b) \implies (\iota(a, b) = \iota(c, d))

A decimal number algebra homomorphism between two decimal number algebras AA and BB is a function fB Af \in B^A such that

a.b.f(ι A(a,b))=ι B(a,b)\forall a \in \mathbb{Z}. \forall b \in \mathbb{N}. f(\iota_A(a, b)) = \iota_B(a, b)

The category of decimal number algebras is the category DNADNA whose objects Ob(DFA)Ob(DFA) are decimal number algebras and whose morphisms Mor(DNA)Mor(DNA) are decimal numbers algebra homomorphisms. The set of decimal numbers, denoted [1/10]\mathbb{Z}[1/10], is defined as the initial object in the category of decimal number algebras.

In homotopy type theory

The type of decimal numbers, denoted [1/10]\mathbb{Z}[1/10], is defined as the higher inductive type generated by:

  • A function ()/10 ():×[1/10](-)/10^{(-)}:\mathbb{Z} \times \mathbb{N} \rightarrow \mathbb{Z}[1/10]. The integer a:a:\mathbb{Z} represents the integer if one ignores the decimal separator in the decimal numeral representation of the decimal number, and the natural number b:b:\mathbb{N} represents the number of digits to the left of the final digit where the decimal separator ought to be placed after in the decimal numeral representation of the decimal number.
  • A dependent product of functions between identities representing that equivalent decimals are equal:
    equivdec: a: b: c: d:(a10 d=c10 b)(a/10 b=c/10 d)equivdec : \prod_{a:\mathbb{Z}} \prod_{b:\mathbb{N}} \prod_{c:\mathbb{Z}} \prod_{d:\mathbb{N}} (a \cdot 10^d = c \cdot 10^b) \to (a/10^b = c/10^d)

    (i.e. 1.00 = 1.000 with decimal numeral representations)

  • A set-truncator
    τ 0: a:[1/10] b:[1/10]isProp(a=b)\tau_0: \prod_{a:\mathbb{Z}[1/10]} \prod_{b:\mathbb{Z}[1/10]} isProp(a=b)

Mathematical structures on the decimal numbers

Ring structure on the decimal numbers

Zero

We define zero 0:[1/10]0:\mathbb{Z}[1/10] to be the following:

00/10 00 \coloneqq 0/10^0

Addition

We define addition ()+():[1/10]×[1/10][1/10](-)+(-):\mathbb{Z}[1/10] \times \mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

a/10 b+c/10 d(a10 d+c10 b)/10 (b+d)a/10^b + c/10^d \coloneqq (a \cdot 10^d + c \cdot 10^b)/10^{(b + d)}

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Negation

We define negation ():[1/10][1/10]-(-):\mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

(a/10 b)(a)/10 b-(a/10^b) \coloneqq (-a)/10^b

for a:a:\mathbb{Z}, b:b:\mathbb{N}.

Subtraction

We define subtraction ()():[1/10]×[1/10][1/10](-)-(-):\mathbb{Z}[1/10] \times \mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

a/10 bc/10 d(a10 dc10 b)/10 (b+d)a/10^b - c/10^d \coloneqq (a \cdot 10^d - c \cdot 10^b)/10^{(b + d)}

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

One

We define one 1:[1/10]1:\mathbb{Z}[1/10] to be the following:

11/10 01 \coloneqq 1/10^0

Multiplication

We define multiplication ()():[1/10]×[1/10][1/10](-)\cdot(-):\mathbb{Z}[1/10] \times \mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

a/10 bc/10 d(ac)/10 (b+d)a/10^b \cdot c/10^d \coloneqq (a \cdot c)/10^{(b + d)}

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Exponentiation

We define exponentiation () ():[1/10]×[1/10](-)^{(-)}:\mathbb{Z}[1/10] \times \mathbb{N} \to \mathbb{Z}[1/10] to be the following:

(a/10 b) n(a n)/10 (bn)(a/10^b)^n \coloneqq (a^n)/10^{(b \cdot n)}

for a:a:\mathbb{Z}, b:b:\mathbb{N}, n:n:\mathbb{N}.

Sign

Positive sign

We define the dependent type is positive, denoted as isPositive(a/10 b)isPositive(a/10^b), to be the following:

isPositive(a/10 b)a>0isPositive(a/10^b) \coloneqq a \gt 0

for a:a:\mathbb{Z}, b:b:\mathbb{N}, dependent types m>nm\gt n indexed by m,n:m, n:\mathbb{Z}.

Negative sign

We define the dependent type is negative, denoted as isNegative(a/10 b)isNegative(a/10^b), to be the following:

isNegative(a/10 b)a<0isNegative(a/10^b) \coloneqq \Vert a \lt 0

for a:a:\mathbb{Z}, b:b:\mathbb{N}, dependent types m>nm\gt n indexed by m,n:m, n:\mathbb{Z}.

Zero sign

We define the dependent type is zero, denoted as isZero(a/10 b)isZero(a/10^b), to be the following:

isZero(a/10 b)a=0isZero(a/10^b) \coloneqq a = 0

for a:a:\mathbb{Z}, b:b:\mathbb{N}.

Non-positive sign

We define the dependent type is non-positive, denoted as isNonPositive(a/10 b)isNonPositive(a/10^b), to be the following:

isNonPositive(a/10 b)isPositive(a/10 b)isNonPositive(a/10^b) \coloneqq isPositive(a/10^b) \to \emptyset

for a:a:\mathbb{Z}, b:b:\mathbb{N}.

Non-negative sign

We define the dependent type is non-negative, denoted as isNonNegative(a/10 b)isNonNegative(a/10^b), to be the following:

isNonNegative(a/10 b)isNegative(a/10 b)isNonNegative(a/10^b) \coloneqq isNegative(a/10^b) \to \emptyset

for a:a:\mathbb{Z}, b:b:\mathbb{N}.

Non-zero sign

We define the dependent type is non-zero, denoted as isNonZero(a/10 b)isNonZero(a/10^b), to be the following:

isNonNegative(a/10 b)isPositive(a/10 b)+isNegative(a/10 b)isNonNegative(a/10^b) \coloneqq \Vert isPositive(a/10^b) + isNegative(a/10^b) \Vert

for a:a:\mathbb{Z}, b:b:\mathbb{N}.

Order structure on the decimal numbers

Less than

We define the dependent type is less than, denoted as a/10 b<c/10 da/10^b \lt c/10^d, to be the following:

a/10 b<c/10 disPositive(c/10 da/10 b)a/10^b \lt c/10^d \coloneqq isPositive(c/10^d - a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Greater than

We define the dependent type is greater than, denoted as a/10 b>c/10 da/10^b \gt c/10^d, to be the following:

a/10 b>c/10 disNegative(c/10 da/10 b)a/10^b \gt c/10^d \coloneqq isNegative(c/10^d - a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Apart from

We define the dependent type is apart from, denoted as a/10 b#c/10 da/10^b # c/10^d, to be the following:

a/10 b#c/10 disNonZero(c/10 da/10 b)a/10^b # c/10^d \coloneqq isNonZero(c/10^d - a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Less than or equal to

We define the dependent type is less than or equal to, denoted as a/10 bc/10 da/10^b \leq c/10^d, to be the following:

a/10 b<c/10 disNonNegative(c/10 da/10 b)a/10^b \lt c/10^d \coloneqq isNonNegative(c/10^d - a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Greater than or equal to

We define the dependent type is greater than or equal to, denoted as a/10 bc/10 da/10^b \geq c/10^d, to be the following:

a/10 bc/10 disNonPositive(c/10 da/10 b)a/10^b \geq c/10^d \coloneqq isNonPositive(c/10^d - a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Pseudolattice structure on the decimal numbers

Ramp

We define the ramp function ramp:[1/10][1/10]ramp:\mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

ramp(a/10 b)ramp(a)/10 bramp(a/10^b) \coloneqq ramp(a)/10^b

for a:a:\mathbb{Z}, b:b:\mathbb{N}, ramp:ramp:\mathbb{Z} \to \mathbb{Z}.

Minimum

We define the minimum min:[1/10]×[1/10][1/10]min:\mathbb{Z}[1/10] \times \mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

min(a/10 b,c/10 d)a/10 bramp(a/10 bc/10 d)min(a/10^b,c/10^d) \coloneqq a/10^b - ramp(a/10^b - c/10^d)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Maximum

We define the maximum max:[1/10]×[1/10][1/10]max:\mathbb{Z}[1/10] \times \mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

max(a/10 b,c/10 d)a/10 b+ramp(c/10 da/10 b)max(a/10^b,c/10^d) \coloneqq a/10^b + ramp(c/10^d - a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}, c:c:\mathbb{Z}, d:d:\mathbb{N}.

Absolute value

We define the absolute value |()|:[1/10][1/10]\vert(-)\vert:\mathbb{Z}[1/10] \to \mathbb{Z}[1/10] to be the following:

|a/10 b|max(a/10 b,a/10 b)\vert a/10^b \vert \coloneqq max(a/10^b, -a/10^b)

for a:a:\mathbb{Z}, b:b:\mathbb{N}.

Properties

TODO: Show that the decimal numbers are a ordered Heyting integral domain with decidable equality, decidable apartness, and decidable linear order, and that the decimal numbers are a Heyting integral subdomain of the rational numbers.

10 is a unit term.

Thus this is true:

sci: a:[1/10](0<a)× b:(1a10 b)×(a10 b<10)sci : \prod_{a:\mathbb{Z}[1/10]} (0 \lt a) \times \sum_{b:\mathbb{Z}} (1 \leq a \cdot 10^b) \times (a \cdot 10^b \lt 10)

this forms the basis of scientific notation.

See also

Revision on May 4, 2022 at 13:41:49 by Anonymous?. See the history of this page for a list of all contributions to it.