SCM Foundations

Signed Common Meadows (SCM) provide a totalised arithmetic with a single absorptive bottom value (⊥). This library implements SCM semantics for machine learning workflows.

Algebraic Rules

  • Total inverse: every element has an inverse; 0^{-1} = ⊥.
  • Absorption: x + ⊥ = ⊥ and x · ⊥ = ⊥ for all x.
  • Weak sign: s(x) = x/|x| for finite nonzero inputs, 0 at the origin, when the argument is ⊥. For complex values, weak sign projects finite nonzero payloads to the unit circle and returns bottom unchanged; it is not a contract that IEEE +inf / -inf decoded payloads are valid orientation carriers.
  • History-aware sign: when |z| falls below ε_sign, the last valid orientation is kept to prevent oscillation.

Practical Implications

  • Scalar SCM ops (zeroproofml.scm.value, zeroproofml.scm.ops) return SCMValue(⊥) on division-by-zero / domain errors instead of IEEE NaN/Inf.
  • For arrays/tensors, SCM values are represented as a numeric payload + bottom mask. The mask is authoritative; payload values on masked entries are undefined and must be ignored (use strict decoding to map them to NaN if you need an IEEE sentinel).
  • No layer-by-layer “guard mode” is required: singularity handling is pushed to explicit masks and a single decode at the output boundary.
  • Numerical stability is handled by gradient policies and (optionally) projective tuples, rather than ad-hoc forward clamps.

Fracterm Flattening

For rational heads we exploit fracterm flattening: small rational subgraphs are rewritten as P(x) / Q(x) to reduce singularity checks to the final denominator. Depth is capped (L ≤ 5) to avoid polynomial blow-up; with the current FRU bound table that already permits at most a 16 * d degree multiplier on the seed head, where d = max(d_p, d_q). The current implementation supports constants, variables, sparse polynomial numerators/denominators, and shallow expressions composed with +, *, and /; larger or unsupported graphs should be left on the projective path instead of being flattened. The detailed inventory and refusal criteria live in theory/01_fracterm_flattening.md. In practice, training stays on the projective/tuple path and flattening is run after training for audit/export validation rather than inside the per-step optimization loop.

Common-meadow identities such as x/x = 1 + 0/x and 1/(1/x) = x + 0/x explain why naive cancellation fails in strict SCM: canceling them to bare 1 or x erases the bottom at x = 0. Treat those identities as semantic test anchors, not necessarily as the canonical strict normal forms emitted by the simplifier; strict flattening may use any representation that keeps the singular assignment bottom under the required nonzero contract.

Explicit field_rational flattening keeps the ordinary field quotient rule (a/b)/(u/v) = av/(bu). Strict SCM flattening instead keeps the divisor denominator as a bottom-producing factor, so callers must opt in to field_rational only when ordinary field algebra is the intended contract.

Terminology

  • Bottom (⊥): absorptive error element; any operation involving ⊥ yields ⊥.
  • Projective tuple: pair (N, D) representing the same value as N/D with (1, 0) denoting ⊥.
  • Coverage: fraction of predictions that remain finite (non-⊥) under SCM semantics.