Scalar workflows¶
The Scalar profile provides a checked extended-complex number system (finite
complex numbers, directed infinities \(\infty \cdot z\), complex infinity
\(\tilde{\infty}\), and \(\mathrm{indet}\)) over Session, together with symbolic
proof engines and a cut-aware numeric filter.
This guide covers selecting a ProfileLevel, budgeting profile construction,
reusing sealed profiles, and combining numeric refutation with symbolic proofs
in Mojo or Python. For runnable examples, see
Lesson 4.2,
Lesson 4.3, and
Lesson 4.4.
Selecting a ProfileLevel¶
Build only up to the level required by your workload; each level extends the preceding one with additional checked theorems:
ProfileLevel |
Contents | Typical budget | Use when |
|---|---|---|---|
FOUNDATION |
Carrier, G1–G7 axioms, 8 foundational definitions and theorems (finite, zero, one, plus, times, neg, inv, infinities) |
10_000_000 (~1 s) |
Prototyping, G1 case splits (class_split), numeric evaluate / decide / refute on rational expressions |
EXACT_ARITHMETIC |
ACU operators (+, *), exact rational literals (scalar.rationals), domain theorems, and literal_facts |
200_000_000 (~1–1.5 min) |
Exact rational folding, ACU reflexivity, literal_facts, and build_scalar_poly (reify / identity) |
POWERS_AND_ROOTS |
Integer and rational powers, roots, and algebraic lemmas required by transfer |
1_000_000_000 (~2.5–3 min) |
Automatic guarded rational-function equalities via transfer |
ELEMENTARY_FUNCTIONS / ALL |
24 elementary functions, 14 off-cut predicates (ScalarAtom.OFFCUT), and 282 formula and infinity theorems |
2_000_000_000+ |
Elementary function identities, branch-cut OFFCUT guards, and build_library |
ProfileLevel.POLYNOMIALS, LIBRARY, NUMERIC, and HOL_MODEL are not valid
arguments to build_scalar; call their dedicated builders (build_scalar_poly,
build_library, evaluate/decide/refute, and build_model) instead.
Opening sessions and reusing sealed profiles¶
Build higher profile levels once and reuse their sealed snapshots:
- Direct profile session:
session(profile, ["x", "y"], work=...)opens a liveSession, declaresxandyof typescalar.Scalar, and provides a defaultbase()frame assumingscalar.finite(x)andscalar.finite(y). - Polynomial or library session: call
Session.open(poly.sealed_snapshot())orSession.open(lib.sealed_snapshot())(supported in Mojo thin client, direct Mojo, and Python). - Persisting a profile: publish
profile.sealed_snapshot()to ajudgment_storeLibraryviachange.add_snapshot(...)so subsequent runs load the checked snapshot instead of rebuilding.
Combining numeric refutation with symbolic proofs¶
- Screen conjectures with
refute(FOUNDATIONorALL): passlhs,rhs, proposedguard, andvariablestorefute(...). Missing pole or branch-cut conditions produceFilterVerdict.REFUTEDwith an exact counterexamplewitness.FilterVerdict.PASSEDis testing evidence only, not a proof. - Construct and test guards (
ScalarAtom,decide,to_guard,is_generic): form F-5 guard atoms (FINITE,NONZERO,REAL,INTEGER,LT,LE,RE,IM,OFFCUT,UNWOUND), evaluate them at exact points withdecide, and translate them to HOL propositions withto_guard. - Derive checked proofs:
- Use
transfer(POWERS_AND_ROOTS) for rational-function equalities to compute the exact generic guard and deriveguard → lhs = rhs. - Use
build_scalar_polywithreify/identity(EXACT_ARITHMETICor higher) for polynomial identities over arbitrary (including opaque) Scalar subexpressions. - Use
literal_facts(EXACT_ARITHMETICor higher) for checked domain steps (real,finite,rational,integer/~integer) of exact rational constants. - Use
class_split(any level) to split into G1's four exhaustive carrier cases (finite,Indeterminate,ComplexInfinity, directed infinity with fixed finite nonzerowitness).
Analytic laws via the HOL model¶
The axiomatic profile does not postulate analytic identities as axioms. For
checked analytic laws (such as \(\sqrt{(-1)^2} = 1\), \(\log(e^z)\) on the
principal strip, inverse trigonometric ranges, and monotonicity of exp and
log), construct the conservative HOL model over
judgment_mathlib:
- Fetch
judgment_mathlib(pixi run fetch-judgment-mathlib) and load its recheckedSnapshotviaLibrary.snapshot(...). - Call
build_model(discharging G1–G7 conservatively with zero scalar axioms), followed bybuild_bridges(26 guarded bridge theorems and 14 counterexamples),build_classes(native commutative monoid instances), andbuild_analysis(105 checked analytic laws).
See the Scalar API reference, Numeric semantics reference, and HOL model and bridges theory.