Native modular multiplier generation #
All shifted partial products, balanced carry-save gates and the final adder are generated from unary width. The output is the full existing circuit code, including unused fallback gates.
Main results #
Cslib.Circuits.Boolean.Modular.multiplyCode_eq_code: exact code agreement.Cslib.Circuits.Boolean.Modular.computableInPolyTime_multiply: uniform native generation.
Raw generation agrees gate-for-gate with the total typed modular multiplier.
theorem Cslib.Circuits.Boolean.Modular.computableInPolyTime_multiply :
Turing.MultiTapeTM.ComputableInPolyTime (fun (w : ℕ) => (multiply w).code) Turing.MultiTapeTM.encUnary encCode
Generation is native polynomial-time in unary width, charging the complete binary code.