Scalar mathematical theory

Order and domains

Domains are predicates on Scalar, not types: assumptions such as \(x > 0\) or \(x \in \mathbb Z\) change what is known about a symbol without changing its type. This page defines the order of the extended reals and the domain predicates, and proves the literal laws on which the profile's literal kind rests.

The order

Definition O-1 (extended reals). \(\mathrm{ext}(x)\) holds when \(x\) is real, \(D(1) = \infty\), or \(D(-1) = -\infty\). The order \(<\) is that of the extended real line on extended reals and false elsewhere (axiom G5), and \(x \le y\) is \(x < y\), or \(x = y\) with \(x\) an extended real.

Proposition O-1. \(<\) is a strict total order on the extended reals; for every \(x\), \(\neg(x < x)\); and \(x < y\) implies \(\mathrm{ext}(x)\) and \(\mathrm{ext}(y)\). In particular \(C_\infty\), \(I\), and the directed infinities other than \(\pm\infty\) are comparable to nothing, and \(x \le x\) fails for them.

Proof. G4 supplies totality on the reals. G5 puts every real strictly between the two infinities, orders the infinities, and supplies global transitivity and irreflexivity. An additional reverse comparison would produce a cycle and hence a self-comparison, contradicting irreflexivity. The domain and nonstrict-order clauses are the remaining clauses of G5. \(\square\)

Consequences for assumptions. An assumption \(x > 10\) makes \(x\) real or \(+\infty\); with the session's default hypothesis \(\mathrm{finite}(x)\) it makes \(x\) real, which is what linear arithmetic needs. In particular, \(\infty > 10\) holds, but \(\mathrm{real}(\infty)\) does not.

Definition X-P1 (the order of the extended reals). Let \(\bar{\mathbb R} = \mathbb R \sqcup \{D_1, D_{-1}\}\), ordered as the extended real line. On the carrier \(\hat S\) (Definition X-1), define

\[ x < y \iff x, y \in \bar{\mathbb R} \text{ and } x < y \text{ in } \bar{\mathbb R}, \qquad \mathrm{real}(x) \iff x \in \mathbb R. \]

Then \(<\) is a total predicate on \(\hat S\), false whenever an argument is not an extended real. Axiom G5 states this order in the profile (Definition O-1). The alternative, defining \(<\) only on finite reals, would make \(x > 10\) imply finiteness directly but would exclude comparisons with infinite operands. Theorem X-8 holds for either, since both restrict on \(\mathbb R\) to the usual order.

Domain predicates

Definition O-2. As conservative definitions (the kernel's Theorem M-5):

Predicate Definition
\(\mathbb N_0(x)\) \(\forall P.\; P(0) \to (\forall y.\, P(y) \to P(y + 1)) \to P(x)\)
\(\mathrm{integer}(x)\) \(\mathbb N_0(x) \lor \mathbb N_0(-x)\)
\(\mathrm{natural}(x)\) \(\mathbb N_0(x)\)
\(\mathrm{rational}(x)\) \(\exists p\, q.\; \mathrm{integer}(p) \land \mathrm{integer}(q) \land q \ne 0 \land x = p \cdot q^{-1}\)
\(\mathrm{positive}(x)\), \(\mathrm{negative}(x)\) \(0 < x\), \(x < 0\)
\(\mathrm{nonnegative}(x)\) \(0 \le x\)
\(\mathrm{ext}(x)\) Definition O-1

\(\mathbb N_0\) is the least predicate containing \(0\) and closed under adding \(1\); its definition gives induction directly. Note that \(\mathrm{positive}(\infty)\) holds by the extended-real order.

Theorem O-2 (properties of the integers).

  1. Every integer is real.
  2. \(\mathbb N_0(n)\) implies \(0 \le n\), and \(n = 0\) or \(1 \le n\).
  3. \(\mathbb N_0(n)\) and \(n \ne 0\) imply \(\mathbb N_0(n - 1)\).
  4. The integers contain \(0\) and are closed under \(n \mapsto n + 1\), \(n \mapsto n - 1\), and \(n \mapsto -n\).
  5. Discreteness: no integer lies strictly between \(0\) and \(1\); more generally, for integers \(m < n\), \(m + 1 \le n\).
  6. The integers are closed under addition and multiplication.

Proof. First exclude non-finite integers. G1 and the negation table of G6a show that a non-finite \(x\) has non-finite \(-x\); neither can satisfy \(\mathbb N_0\), since the induction predicate \(P(y):=\mathrm{real}(y)\) contains \(0\) and is closed under \(+1\) by G3. For finite \(x\), the field laws give \(-(-x)=x\), so reality of \(-x\) implies reality of \(x\). This proves (1). The remaining statements follow by induction from the definition of \(\mathbb N_0\) and the ordered-field laws on reals. (2): \(P(y) := 0 \le y \land (y = 0 \lor 1 \le y)\); if it holds of \(y\) then \(y + 1 \ge 1 > 0\). (3): \(P(y) := y = 0 \lor \mathbb N_0(y - 1)\); it holds of \(y + 1\) because \((y + 1) - 1 = y\) and \(\mathbb N_0(y)\) holds along the induction (strengthen \(P\) to \(P(y) \land \mathbb N_0(y)\)). (4): from (3) and the definition of \(\mathrm{integer}\), with \(-0 = 0\). (5): if \(0 < n < 1\) with \(n\) an integer, then either \(\mathbb N_0(n)\), contradicting (2), or \(\mathbb N_0(-n)\), giving \(-n \ge 0\), contradicting \(n > 0\); the general case applies this to \(n - m\), an integer by (4) and (6). (6): induction on the second argument, using (4). \(\square\)

The literal kind's laws

Definition O-3 (the binding). The profile's literal kind binds EXACT_RATIONAL to Scalar with domain \(D = \mathrm{real}\), ZERO and ONE to \(0\) and \(1\), ADD, MUL, NEG, INV, POW to \(+\), \(\cdot\), \(-\), \({}^{-1}\), pow, EXPONENT to \(\mathrm{integer}\), and LT, LE to \(<\), \(\le\).

Theorem O-3 (the literal laws are theorems). Every literal law of the kernel's Definition C-5 that this binding requires (R1–R7, O1–O7, F1–F2, E1–E4, P1–P4, each guarded by \(D = \mathrm{real}\)) is derivable from G1 to G6 and Definition O-2.

Proof. R1–R5 and F1 are the closure clauses of G3. R6, R7, and F2 are G2 restricted to reals. O1–O7 are G4. E1–E3 are Theorem O-2(4); E4 is O-2(1). P1 and P3 are the corresponding G6a clauses. For P2, split \(0\le n\) into \(0<n\) and \(n=0\): the positive case is G6a's recurrence, and the zero case uses \(x^1=x\), \(x^0=1\), and the multiplicative unit.

For P4, a positive integer is in \(\mathbb N_0\): its negative cannot be natural, since natural values are nonnegative. For finite nonzero \(x\), G2 makes \(x^{-1}\) finite and nonzero. Induction on \(n\in\mathbb N_0\) proves that \(x^n\) and \((x^{-1})^n\) are finite and their product is \(1\). At zero both powers are \(1\); the successor step uses P2 twice, finite closure, ACU multiplication, and \(x x^{-1}=1\). Consequently \((x^{-1})^n=(x^n)^{-1}\) by uniqueness of the inverse in the finite field. Combining this with G6a's \(x^{-n}=(x^{-1})^n\) gives P4. The integer-domain premises use the classification and table facts identified in Theorem O-2's proof; labels retain those dependencies (domain lemmas). \(\square\)

So the literal kind is justified by theorems, not axioms: its laws are Proven declarations cited by the LiteralKind declaration (K1.3), and by the kernel's Theorem C-11 the rational literals denote \(\mathbb Q \subset \mathbb R\) in every model.

Proposition O-4 (domains of literals). For every rational literal \(\underline q\): \(\mathrm{real}(\underline q)\), \(\mathrm{finite}(\underline q)\), and \(\mathrm{rational}(\underline q)\) are theorems; \(\mathrm{integer}(\underline q)\) is a theorem when \(q \in \mathbb Z\), and \(\neg\,\mathrm{integer}(\underline q)\) when \(q \notin \mathbb Z\).

Proof. The first three follow the construction of \(\underline q\) from \(0\), \(1\), sums, negatives, and an inverse (the kernel's Lemma C-12a gives the derivation), with the closure laws. For \(q = n \in \mathbb Z\), Theorem O-2(4). For \(q \notin \mathbb Z\), let \(m = \lfloor q \rfloor\): then \(m < q < m + 1\), and an integer \(q\) would contradict discreteness (Theorem O-2(5)) applied to \(q - m\), which lies strictly between \(0\) and \(1\). \(\square\)

This is the discreteness law: \(\mathrm{integer}(1/2) = \mathsf{False}\) follows from the definition of the integers, not from the ordered-field laws, which cannot give it. These statements are lemmas of the checked library, proved once per literal by a derived rule rather than evaluated by conversion: the kernel evaluates only the operations a literal kind binds.

Functions on the real domain

Non-integer powers, roots, logarithms, and the trigonometric and hyperbolic functions have branch cuts. Their principal branches and their values on the cuts and at infinities are defined on the pages on powers and roots, the exponential and logarithm, and elementary functions. Those pages also give, for each function, the laws that hold on the finite reals of its real domain, since engines that reason over the reals rely on them; MetiTarski's bounds are such laws, once guarded. Besides the principal roots, the profile provides the real roots \(\mathrm{surd}(x, n)\), real on all finite reals for odd \(n\) (Theorem W-7), because MetiTarski's cbrt and nthrt are real roots.

judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub