XOR as an instance of gate elimination #
This module specializes the basis-independent gate-elimination framework to Boolean parity. It deliberately isolates the one basis-specific obligation: after fixing one input of an at-least-two-input parity circuit, construct a certified reduction saving at least three charged gates.
Any signature, interpretation, and operation cost satisfying that local
obligation inherits the lower bound 3 * (n - 1). In particular, the De Morgan
theorem can use the cost which charges AND and OR but makes constants and NOT
free. A matching upper bound is outside this module.
XOR of all coordinates, using the Boolean-ring addition on Bool.
Equations
- Algebraic.GateElimination.Xor.parity input = ∑ coordinate : Fin n, input coordinate
Instances For
Unflipped parity as a one-output target.
Equations
Instances For
A parity problem records its number of inputs and an optional output flip.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parity, optionally flipped by state.phase, as a one-output target.
Equations
- Algebraic.GateElimination.Xor.target state input x✝ = Algebraic.GateElimination.Xor.parity input + state.phase
Instances For
Every coordinate is essential to phased parity.
Flipping one coordinate flips phased parity, regardless of the other inputs.
Package a parity state as a gate-elimination problem.
Equations
- Algebraic.GateElimination.Xor.problem state = { inputCount := state.inputCount, target := Algebraic.GateElimination.Xor.target state }
Instances For
Fixing one parity input removes that input and adds its value to the phase.
Equations
- Algebraic.GateElimination.Xor.restriction n phase value selected = { substitution := Algebraic.InputSubstitution.fix selected value, target_eq := ⋯ }
Instances For
The well-founded rank of a parity problem.
Equations
- Algebraic.GateElimination.Xor.rank state = state.inputCount
Instances For
The Schnorr-style lower-bound expression proved by the framework.
Equations
- Algebraic.GateElimination.Xor.bound state = 3 * (state.inputCount - 1)
Instances For
The data produced by one basis-specific XOR elimination.
The residual circuit must agree with the original circuit after fixing
selected to value; the cost certificate must save at least three.
Input fixed by this elimination.
- value : Bool
Boolean value assigned to the selected input.
- reduction : Circuit.Reduction operationCost circuit interpretation (InputSubstitution.fix self.selected self.value)
Semantics- and cost-certified residual circuit.
The reduction removes at least three units of charged cost.
Instances For
The sole basis-specific hypothesis needed for the XOR lower bound.
It is stated for an arbitrary circuit signature and arbitrary weighted cost. The positivity premise says that the residual parity problem still has at least one input, so the source has at least two inputs.
- eliminate (n : ℕ) : 0 < n → (phase : Bool) → (circuit : Circuit σ (n + 1) 1) → circuit.ComputesWith interpretation (target { inputCount := n + 1, phase := phase }) → Circuit.CostSizeMinimal operationCost circuit interpretation (target { inputCount := n + 1, phase := phase }) → ThreeGateStep operationCost interpretation n phase circuit
Produce a three-unit reduction for every minimum-cost non-base circuit.
Instances For
Turn a local three-gate XOR eliminator into the generic framework.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Every basis admitting the local three-gate elimination has XOR cost at least
3 * (n - 1).
Unflipped XOR specialization of lowerBound.