Native generation of carry-save reductions #
The generator preserves the complete half-split reducer, its zero fallback and the final adder. Input counts and references are binary, word widths unary, and all supplied leaf code is charged.
Main results #
Cslib.Circuits.Boolean.sumPairsCode_eq_code: exact reduction and final-adder code.Cslib.Circuits.Boolean.computableInPolyTime_sumPairsCode: uniform native generation.
Exact carry-save representation of the original leaf.
theorem Cslib.Circuits.Boolean.computableInPolyTime_pairWithZeroCode {α : Type} {enc : α ↪ List Bool} {n w : α → ℕ} {C : α → List (Op × List ℕ) × List ℕ} (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) (hw : Turing.MultiTapeTM.ComputableInPolyTime w enc Turing.MultiTapeTM.encUnary) (hC : Turing.MultiTapeTM.ComputableInPolyTime C enc encCode) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => pairWithZeroCode (n a) (w a) (C a)) enc encCode
Pair generation charges all supplied leaf code.
theorem Cslib.Circuits.Boolean.computableInPolyTime_sumPairsCode {α : Type} {enc : α ↪ List Bool} {n w : α → ℕ} {cs : α → List (List (Op × List ℕ) × List ℕ)} (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encNat) (hw : Turing.MultiTapeTM.ComputableInPolyTime w enc Turing.MultiTapeTM.encUnary) (hcs : Turing.MultiTapeTM.ComputableInPolyTime cs enc (Turing.MultiTapeTM.encList encCode)) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => sumPairsCode (n a) (w a) (cs a)) enc encCode
The native generator charges the complete leaf list and both reduction stages.