MindFormal v1.0.0One Mind

MindFormal.Tools.A695LogicPaper.RippleArithmetic

theorem MindFormal.A695LogicPaper.BooleanArithmetic.run_preserves (gs : List Instruction) (mem : Memory) (i : ℕ) (h : ∀ g ∈ gs, g.2.2 ≠ i) :
run gs mem i = mem i
theorem MindFormal.A695LogicPaper.BooleanArithmetic.emitFullAdder_destinations (base : ℕ) (input : Fin 3 → ℕ) (g : Instruction) (hg : g ∈ emitFullAdder base input) :
base ≤ g.2.2
theorem MindFormal.A695LogicPaper.BooleanArithmetic.emitFullAdder_preserves (base : ℕ) (input : Fin 3 → ℕ) (mem : Memory) (i : ℕ) (hi : i < base) :
run (emitFullAdder base input) mem i = mem i
Instances For
    def MindFormal.A695LogicPaper.BooleanArithmetic.ripple (b base : ℕ) :
    (Fin b → ℕ) → (Fin b → ℕ) → ℕ → Adder b
    Equations
    Instances For
      theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_count (b base : ℕ) (x y : Fin b → ℕ) (carry : ℕ) :
      (ripple b base x y carry).code.length = 17 * b
      theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_destinations (b base : ℕ) (x y : Fin b → ℕ) (carry : ℕ) (g : Instruction) (hg : g ∈ (ripple b base x y carry).code) :
      base ≤ g.2.2
      theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_preserves (b base : ℕ) (x y : Fin b → ℕ) (carry : ℕ) (mem : Memory) (i : ℕ) (hi : i < base) :
      run (ripple b base x y carry).code mem i = mem i
      theorem MindFormal.A695LogicPaper.BooleanArithmetic.ripple_correct (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)) + 2 ^ b * (result (ripple b base x y carry).carry).toNat = ((wordValue fun (i : Fin b) => mem (x i)) + wordValue fun (i : Fin b) => mem (y i)) + (mem carry).toNat

      The width-b addition is a literal concatenation of b seventeen-gate full adders. The final carry is retained; no overflow is silently discarded.