Comparing standard and native De Morgan gate costs #
Constants and identities are free in standardCost, while native complexity
counts every internal gate. A contextual translation shares two constant
gates across the whole circuit and removes identities. Its native size is
exactly the original standard cost plus two.
theorem
Algebraic.DeMorgan.complexity_le_standardCost_add_two
{n : ℕ}
(circuit : Circuit signature n 1)
{function : ScalarFunction Bool n}
(computes : circuit.ComputesWith interpretation fun (input : Fin n → Bool) (x : Fin 1) => function input)
:
Any standard-cost circuit yields a native upper bound with only two extra gates.