Skip to content

<enumeratio-expression>

Client-backed. A per-ring calculator: it evaluates an expression in a carrier's algebra, reusing the client's evaluateExpression (the same core the explorer's AlgebraEvaluator uses). Type into the box, or set expr up front. The grammar is small and total: integer literals, a/b (rationals), ω (ordinals), (cardinals), i (Gaussian), {…} set literals with /, + − · ( ).

Results print in the pretty Lean-style unicode form (ω, ω·2, ω^2, ). The input is lenient — you can type the plain-ASCII stand-ins w for ω and oo for , since they're hard to key otherwise; a proper notation picker (and LaTeX/KaTeX output, which is unicode-friendly too) is a planned follow-up.

Needs a Db via provideDb() (the docs set it up globally).

Attributes

attributetypemeaning
collectionstringa collection id; its carrier is resolved from the catalog
carrierstringor a carrier directly (wins over collection) — e.g. rational_number
exprstringthe initial expression (also editable in the box)
modulusnumberthe modulus m for ℤ/mℤ (modular_residue), or the ground n for a bounded finset

Emits a composed result event ({ value, error }) and exposes .value — so <enumeratio-assert> can check what it evaluated to.

Usage

Address by collection (its carrier is looked up) or by carrier directly:

html
<enumeratio-expression collection="rational_numbers" expr="1/2 + 1/3"></enumeratio-expression>
<enumeratio-expression carrier="rational_number" expr="2 * (1/2 + 1/3)"></enumeratio-expression>

Try it — edit the expression (ordinals are non-commutative, so 2 + ωω + 2):

Storybook — one carrier per algebra

Each row is the real control wrapped in <enumeratio-assert>, so every demo checks itself. reveal="always" shows the live value beside the .

ℚ — a field. Fractions reduce; unlike denominators add.

 

Ordinals < ω^ω — a non-commutative semiring. Left-absorption vs right-survival:

 

Cardinals — ℵ₀-arithmetic. The 0 annihilator beats ℵ₀:

 

Gaussian integers ℤ[i] — a commutative ring. i² = −1, and the norm (a+bi)(a−bi):

 

ℤ/5ℤ — modular. Pass the modulus as modulus:

finset — the lattice 𝒫([n]). {…} literals, (join) / (meet); binds tighter than :

 

Parsing a singleton element

A bare element literal — no operator — is a valid expression too: the control parses it and renders it back, so it doubles as a notation parser / normalizer. 2/4 reduces to 1/2; w + 2 is a single ordinal; {1,2,3} a single set:

   

The whole battery

Every worked example in the db, live, is on the expression kitchen sink — a page that is itself a full-stack unit-test run.