MindFormal v1.0.0One Mind

MindFormal.Tools.A695LogicPaper.WordArithmetic

theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_sum_bound (b base : ℕ) (x y : Fin b → ℕ) (carry : ℕ) (i : Fin b) :
(ripple b base x y carry).sum i < base + 17 * b
theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_carry_bound (b base : ℕ) (x y : Fin b → ℕ) (carry : ℕ) (hc : carry < base) :
(ripple b base x y carry).carry < base + 17 * b
theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_mod (b base : ℕ) (x y : Fin b → ℕ) (carry : ℕ) (hx : ∀ (i : Fin b), x i < base) (hy : ∀ (i : Fin b), y i < base) (hc : carry < base) (mem : Memory) :
have result := run (ripple b base x y carry).code mem; (wordValue fun (i : Fin b) => result ((ripple b base x y carry).sum i)) = (((wordValue fun (i : Fin b) => mem (x i)) + wordValue fun (i : Fin b) => mem (y i)) + (mem carry).toNat) % 2 ^ b

Modular addition is a consequence of the full retained-carry identity. The extra carry register remains represented and charged.