The scalar profile¶
A semantic profile gives the symbols their meaning: a carrier, constants,
axioms, and a library of lemmas. The first profile, scalar,
specifies extended-complex arithmetic explicitly
(architecture note, section 17.2). The scalar carrier theory page
gives the full operation tables and proves the laws stated here.
The carrier¶
One type, Scalar, whose values are:
| Value | Meaning |
|---|---|
| finite complex numbers | the ordinary values |
DirectedInfinity(θ), for unit complex θ |
∞, −∞, I·∞, … |
ComplexInfinity |
infinity in no particular direction, as 1/0 |
Indeterminate |
no value, as 0/0 |
Every arithmetic and elementary operation is total on Scalar, with
declared conventions for the special values:
1/0 = ComplexInfinity 0/0 = Indeterminate 0·∞ = Indeterminate
∞ − ∞ = Indeterminate Indeterminate absorbs every operation
These conventions are axioms of the profile. Before its ACU declarations
are admitted, the profile must show that + and · remain associative and
commutative with units 0 and 1 on all special values, by case analysis
over their finitely many classes.
The carrier is classical. Splitting it into finite and special values is
a case distinction that needs excluded middle: in constructive type theory,
"every partial element is defined or undefined" is equivalent to excluded
middle (Escardó and Knapp, CSL 2017). Read constructively, Indeterminate
plays the role of the undefined partial element, and "Indeterminate absorbs
every operation" is the strictness of the lifting monad. A constructive
profile would need a different carrier.
Definedness and generic answers¶
finite(t) holds when t is a finite complex number. A generic
simplification is a theorem guarded by finiteness:
finite(x) ∧ x ≠ 0 ⇒ x/x = 1
finite(x) ⇒ x − x = 0
finite(x) ⇒ 0·x = 0
In the default generic mode, the CAS returns a conditional result whose extra guard consists only of such finiteness and nonzero conditions, accepts it, and shows the guard when asked. In strict mode, every guard needs evidence from the context.
A session assumes its symbols finite by default. That is a hypothesis of the context, not an axiom, so a request can drop it.
Strict equality¶
The strict equality of the CAS is the kernel's equality on Scalar: two
expressions are equal when they have the same value, special values
included. Congruence therefore comes for free (EqApply), and this profile
needs no separate relation for equality. Relations that are not equality
(bounds, refinements, inclusions) remain separate relations with their own
laws.
Domains are predicates¶
"Real", "integer", and "positive" are predicates on Scalar, not types:
real(x) integer(x) positive(x) x ∈ [a, b]
Together with finiteness, a real inequality such as x > 0 implies
real(x). < also relates the infinities ±∞ (∞ > 10 holds) and is
false whenever an argument is not an extended real; the profile's axiom G5
states it (order and domains, Definition
X-P1).
Assumptions can therefore change what is known about a symbol without
changing its type, which static types could not do.
Symbols¶
A CAS user symbol is an opaque constant of type Scalar, declared in a
session theory that extends the profile. Its properties come from the
context's assumptions.
Literals¶
The profile binds the kernel's exact rational literal kind to Scalar,
with 0, 1, +, ·, negation, inverse, <, and equality, on the
domain "finite and real". It cites the theorems that the finite reals form
an ordered field, so the literal arithmetic adds no axiom:
every rational literal is a finite real number of the carrier, and 2 + 3,
(1/2)·2, and 2 < 3 evaluate inside the kernel.