Skip to content

About

Ordinal Arithmetic: An Ordinal-First Metalanguage Approach to Definable Arithmetic Truth

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Ordinatics

First five minutes

For the implemented mathematics, begin with ordinary and natural ordinal arithmetic, then typed, bounded satisfaction and the Lean 4 declarations. The represented ordinal domain is strictly below omega**omega; bounded evaluation does not decide arbitrary arithmetic truth. Hypermath uses its transfinite declarations in Layer 3, while Grounded Hypercalculi explores a separate ordinal-calculus pathway.

For the complete series, use the foundations reader's map. It is a navigation guide, not a shared proof or endorsement.

Exact ordinal arithmetic, symbolic value operations, and bounded typed satisfaction for Python.

Companion to Ordinal Arithmetic: An Ordinal-First Metalanguage Approach to Definable Arithmetic Truth by Tyler Roost. The editable LaTeX source and reading copy are included.

Ordinatics implements the computable parts of the paper using exact integers and SymPy expressions. Ordinary ordinal operations and commutative polynomial operations have separate methods. The semantic evaluator handles explicit bounded quantifiers; it does not decide arbitrary arithmetic truth or construct the paper's full infinite truth sets.

Install

Python 3.10 or newer is required. Install directly from GitHub:

python -m pip install "ordinatics[scientific] @ git+https://github.com/TimeLordRaps/ordinatics.git"

Or from a checkout of this repository:

python -m pip install .
python -m pip install '.[scientific]'

The distribution name is ordinatics. See release instructions for package-index publication status and reproducible build commands.

Ordinary and natural ordinal arithmetic

from ordinatics import OMEGA, Ordinal

assert 1 + OMEGA == OMEGA
assert OMEGA + 1 > OMEGA
assert 2 * OMEGA == OMEGA
assert OMEGA * 2 == OMEGA + OMEGA

# Natural operations are commutative polynomial operations.
assert OMEGA.natural_add(1) == OMEGA + 1
assert OMEGA.natural_mul(2) == OMEGA * 2

# Coefficients are exact, ordered from the constant term upwards.
alpha = Ordinal((3, 2, 1))  # omega**2 + omega*2 + 3
assert alpha == OMEGA**2 + OMEGA*2 + 3

The supported domain is all ordinals strictly below omega**omega, represented by finite polynomial coefficient tuples. No floating-point representation of infinity is used. Raising an ordinal to a finite nonnegative integer power stays inside this domain.

SymPy, exact wrap, and numerical libraries

import sympy as sp
from ordinatics import OMEGA, X, Ordinal, PoleError, wrap

p = (OMEGA**2 + OMEGA*2 + 3).to_sympy()
assert p == X**2 + 2*X + 3
assert Ordinal.from_sympy(p) == OMEGA**2 + OMEGA*2 + 3
assert wrap(p) == sp.Rational(9, 4)
assert wrap(1 / X) == -2

# A cancelled removable singularity is allowed; an actual pole is not.
assert wrap((X**2 - sp.Rational(1, 4)) / (X + sp.Rational(1, 2))) == -1
try:
    wrap(1 / (2*X + 1))
except PoleError:
    pass
else:
    raise AssertionError("an actual pole must be rejected")

Wrap specializes a rational function at X = -1/2 after exact cancellation. It returns an exact rational or raises PoleError. This is a polynomial/value operation, not a homomorphism of ordinary ordinal addition. Strings, floats, and expressions outside the declared rational-function domain are rejected.

The result of to_sympy() is an ordinary SymPy expression. Use SymPy differentiation, integration, matrices, solvers, and lambdify directly. For NumPy arrays and SciPy algorithms, choose an explicit numerical evaluation point:

import numpy as np
from scipy.integrate import quad

f = sp.lambdify(X, p, modules="numpy")
values = f(np.array([0.0, 1.0, 2.0]))
integral, error_estimate = quad(f, 0.0, 1.0)
assert np.allclose(values, [3.0, 6.0, 11.0])
assert abs(integral - 13/3) < 1e-10

These are numerical computations on a polynomial image, not numerical ordinal arithmetic. SymPy also supports lambdify(..., modules="mpmath") for arbitrary-precision numerical work. See interoperability.

Ordinal calculus and dynamics

Ordinal difference operators, normal functions, fixed-point derivative enumerators, the Veblen hierarchy, and ordinal dynamical systems provide computable calculus on ordinals below omega**omega:

from ordinatics import (
    OMEGA, ONE, ZERO, Ordinal,
    Delta, delta, NormalFunction, derivative, least_fixed_point,
    veblen, VeblenHierarchy, VeblenTerm,
    OrdinalDynamicalSystem, orbit, find_attractor, find_fixed_point,
)

# Ordinal left subtraction: beta - alpha is unique gamma such that alpha + gamma == beta
assert OMEGA - 1 == OMEGA
assert (OMEGA + 3) - OMEGA == 3

# Difference operator: Delta F(alpha) = F(alpha + 1) - F(alpha)
f_double = lambda a: 2 * a
assert delta(f_double, 0) == 2
assert delta(f_double, OMEGA) == 2

# Normal ordinal functions and derivatives (fixed point enumerators)
f = NormalFunction.add_left(1)  # F(alpha) = 1 + alpha
assert f.is_normal()
df = f.derivative()             # F'(alpha) enumerates fixed points of F
assert df(0) == OMEGA           # Least fixed point is omega
assert df(1) == OMEGA + 1
assert f(df(0)) == df(0)

# Least fixed point search via transfinite stage ascent
assert least_fixed_point(lambda a: OMEGA + a, start=0) == OMEGA**2

# Veblen hierarchy: phi_0(beta) = omega**beta
assert veblen(0, 2) == OMEGA**2

# Transfinite levels (epsilon_0, zeta_0) via symbolic Veblen terms
e0 = veblen(1, 0, symbolic=True)
z0 = veblen(2, 0, symbolic=True)
assert str(e0) == "ε_0"
assert e0 < z0 and e0 > OMEGA**100

# Ordinal dynamical systems: orbits and attractors
sys = OrdinalDynamicalSystem(lambda x: 1 + x)
orb = sys.orbit(initial_state=0, max_stage=OMEGA + 2)
assert orb.stages[OMEGA] == OMEGA
attractor = sys.find_attractor(0)
assert attractor.is_fixed_point and attractor.states == (OMEGA,)

Typed, bounded satisfaction

from ordinatics import Add, Eq, Nat, Truth, ZERO, ONE, evaluate, rank

sentence = Eq(Add(Nat(1), Nat(1)), Nat(2))
assert evaluate(sentence)
quoted = Truth(ZERO, sentence)
assert rank(quoted) == ONE
assert evaluate(quoted, stage=ONE)

Truth-level labels are exact ordinals. A quotation at level beta must contain a closed formula of rank at most beta; its use requires a language stage of at least beta + 1. Invalid syntax, open quotations, insufficient stages, and exhausted evaluation budgets raise distinct exceptions. Unsupported or unevaluated claims are never silently returned as False.

See semantics for the exclusive bounds on quantifiers, the step budget, and the distinction between this executable fragment and the paper's mathematical construction.

Transfinite declarations in Lean 4

lean4/ holds a small Lean 4 library, Ordinatics, that carries the ordinal declarations this repository licenses, as against the computations the Python package performs. It is not part of the Python distribution and is shipped in neither the wheel nor the sdist.

Ordinatics.Transfinite is a structure over an abstract forming substrate: a carrier of forms, a ground, a forming operation, three tier relations, a derives relation, two path endpoints, and a deriver. It bundles three data fields (limit, succ, apply) with five clauses.

clause what it says
limitNotFinite no finite chain from ground simulates the limit
limitDerives some path runs from ground to the limit
succExtends a form's successor continues from it and differs from it
limitIsLimit the limit is the least upper bound of the finite chain, not merely an upper bound
deriverAtLimit the deriver sits at the limit

Read the table by column rather than by row and one field is missing from it. limit is named by three clauses and succ by one; apply is named by none. Transfinite.apply_is_free proves what follows: given any instance, every function whatever is the application of an instance with the same limit and the same successor, so nothing stated about apply alone follows from the structure. Transfinite.withApply rebuilds an instance around a new application, and it elaborates only because every proof field still typechecks after the swap — the kernel checks the absence rather than a reader checking the list. The same move at succ does not elaborate.

Any theory that supplies the substrate can assume one instance of the structure instead of restating the clauses over its own terms. hypermath does that: its L3 layer assumes a single instance and recovers its previous ordinal names as projections of it, which replaces seven assumptions with one.

Ordinatics.Satisfiable exhibits two models, so instantiating the structure is a consistent assumption rather than an empty one. TwoChainModel is two disjoint forming chains with the deriver at the head of the second; it satisfies the declared clauses and nothing beyond them, and in it limitIsLimit holds vacuously, because the finite chain has no common upper bound in that carrier.

A clause discharged because nothing satisfies its hypothesis is weak evidence, and limitIsLimit is the strongest of the four laws, so ReachableLimitModel follows: the same carrier with the limit genuinely above the whole finite chain. There the antecedent is witnessed and the clause has to be proved. Together the two say the laws are satisfiable, and stay satisfiable when the least-upper-bound clause is doing work.

Ordinatics.Independence answers a different question: whether the deriver's position could have been derived instead of declared. Laws is the four substrate laws with the deriver removed, and Transfinite.toLaws shows that is all of the deriver-free content — the laws never mention the deriver. At the two-chain substrate deriver_position_not_derivable then exhibits all three of: the laws hold, the structure is inhabited with the deriver named as the limit, and it is not inhabited with the deriver named as ground. One substrate, indifferent laws, two namings that disagree. So no proof of the position from the laws exists, and deriverAtLimit adds content rather than recording a consequence. That is what downstream theories are buying when they assume it.

only_apply_is_unconstrained sorts the three data fields at the same substrate: every function is some instance's apply, id is the successor of no instance, and ground is the limit of none. The sorting follows the count of clauses naming each symbol and not anything about what the symbols mean, which makes the count worth running first. A field no clause mentions cannot be constrained by the clauses, and there is nothing to look for; deriverAtLimit does mention the deriver, and settling that one took a model and a second naming.

None of this says anything about any particular substrate. Both models are built over Nat × Bool. A theory that instantiates Transfinite over its own carrier is making a genuine assumption about that carrier, which these results do not discharge.

Build the library and read what its claims rest on:

cd lean4
lake build
lake env lean Probe.lean

Probe.lean prints the axiom dependencies of every claim-bearing declaration. The model constructions reach propext and Quot.sound through Nat and Prod; nothing reaches Classical.choice, and nothing in the library is admitted. CI fails if that report changes shape, including if a line disappears.

Development

python -m pip install '.[dev,scientific]'
python -m pytest -vv -s --durations=10 --timeout=60
python -m ruff check src tests examples scripts
python -m build
python -m twine check dist/*

The version 0.1 interface is experimental. See API reference, mathematical scope, and change history. The repository uses the Apache 2.0 license.

About

Ordinal Arithmetic: An Ordinal-First Metalanguage Approach to Definable Arithmetic Truth

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages