Documentation

Complexity.Logics.FirstOrder.Ordered.Addition

Canonical addition from order and BIT #

A generate/propagate formula defines binary carry in the least-significant-bit-first convention. Comparing all sum bits defines ordinary addition on every canonical universe Fin n, n ≥ 2. The result is nonmodular: an out-of-range sum has no satisfying result in the universe.

This is the PLUS portion of the arithmetic-definability foundation. The Bit Sum Lemma is proved in Ordered.BitSum; native TIMES and full-tuple BIT are constructed in Ordered.Multiplication and Ordered.TupleBit. Numeric-preserving full-tuple composition is supplied in Ordered.FullTuple.Composition.

Main definitions #

Main results #

References #

noncomputable def Cslib.Logic.FO.Ordered.carryFormula (L : FirstOrder.Language) {α : Type u_1} (x y i : (language L).Term α) :

A lower bit generates a carry and every intervening bit propagates it. The two quantifiers range over positions in the canonical universe, with bit zero least significant.

Instances For

    Exact addition, expressed by comparing the result bits with input bits and generated carries. The formula is independent of the universe size and uses only native order, BIT and quantifiers.

    Instances For
      theorem Cslib.Logic.FO.Ordered.realize_addition {L : FirstOrder.Language} {n : ℕ} [Fact (2 ≤ n)] [L.Structure (Fin n)] (v : Fin 3 → Fin n) :
      (addition L).Realize v ↔ ↑(v 0) + ↑(v 1) = ↑(v 2)

      The formula defines ordinary natural-number addition, including out-of-range rejection.

      theorem Cslib.Logic.FO.Ordered.not_realize_addition_of_le {L : FirstOrder.Language} {n : ℕ} [Fact (2 ≤ n)] [L.Structure (Fin n)] (v : Fin 3 → Fin n) (h : n ≤ ↑(v 0) + ↑(v 1)) :

      No element of the universe can represent an out-of-range sum.