Homotopy Type Theory decimal numbers > history (Rev #6)

Contents

Idea

The decimal numbers as familiar from school mathematics.

Definition

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 March 12, 2022 at 02:42:25 by Anonymous?. See the history of this page for a list of all contributions to it.