Documentation

Complexitylib.Algebraic.LowerBound.GateElimination.Xor

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
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.

      • inputCount : ℕ

        Number of inputs.

      • phase : Bool

        Whether the parity output is flipped.

      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
          Instances For
            theorem Algebraic.GateElimination.Xor.target_essentialAt (state : State) (selected : Fin state.inputCount) :
            EssentialAt (fun (input : Fin state.inputCount → Bool) => target state input 0) selected

            Every coordinate is essential to phased parity.

            theorem Algebraic.GateElimination.Xor.target_ne_of_selected_ne (state : State) (selected : Fin state.inputCount) (left right : Fin state.inputCount → Bool) (agree : ∀ (input : Fin state.inputCount), input ≠ selected → left input = right input) (different : left selected ≠ right selected) :
            target state left 0 ≠ target state right 0

            Flipping one coordinate flips phased parity, regardless of the other inputs.

            @[simp]
            theorem Algebraic.GateElimination.Xor.target_false (n : ℕ) :
            target { inputCount := n, phase := false } = parityTarget n

            Package a parity state as a gate-elimination problem.

            Equations
            Instances For
              def Algebraic.GateElimination.Xor.restriction (n : ℕ) (phase value : Bool) (selected : Fin (n + 1)) :
              (problem { inputCount := n + 1, phase := phase }).Restriction (problem { inputCount := n, phase := value + phase })

              Fixing one parity input removes that input and adds its value to the phase.

              Equations
              Instances For

                The well-founded rank of a parity problem.

                Equations
                Instances For

                  The Schnorr-style lower-bound expression proved by the framework.

                  Equations
                  Instances For
                    structure Algebraic.GateElimination.Xor.ThreeGateStep {σ : Signature} (operationCost : OperationCost σ) (interpretation : Interpretation σ Bool) (n : ℕ) (phase : Bool) (circuit : Circuit σ (n + 1) 1) :
                    Type u_1

                    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.

                    Instances For
                      structure Algebraic.GateElimination.Xor.ThreeGateEliminator {σ : Signature} (operationCost : OperationCost σ) (interpretation : Interpretation σ Bool) :
                      Type u_1

                      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
                        def Algebraic.GateElimination.Xor.framework {σ : Signature} {operationCost : OperationCost σ} {interpretation : Interpretation σ Bool} (eliminator : ThreeGateEliminator operationCost interpretation) :
                        OptimalFramework operationCost interpretation 1

                        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
                          theorem Algebraic.GateElimination.Xor.lowerBound {σ : Signature} {operationCost : OperationCost σ} {interpretation : Interpretation σ Bool} (eliminator : ThreeGateEliminator operationCost interpretation) (state : State) (circuit : Circuit σ state.inputCount 1) (computes : circuit.ComputesWith interpretation (target state)) :
                          3 * (state.inputCount - 1) ≤ circuit.cost operationCost

                          Every basis admitting the local three-gate elimination has XOR cost at least 3 * (n - 1).

                          theorem Algebraic.GateElimination.Xor.parity_lowerBound {σ : Signature} {operationCost : OperationCost σ} {interpretation : Interpretation σ Bool} (eliminator : ThreeGateEliminator operationCost interpretation) {n : ℕ} (circuit : Circuit σ n 1) (computes : circuit.ComputesWith interpretation (parityTarget n)) :
                          3 * (n - 1) ≤ circuit.cost operationCost

                          Unflipped XOR specialization of lowerBound.