Documentation

CslibFrontier.Computability.Circuit.Boolean.AffineDisperserCore.Reduction

Reductions and potential accounting for gate elimination #

Shared reduction abstraction and potential-change accounting for the 3.5n (AffineDisperser) and 4n (AffineDisperser4n) gate-elimination developments.

A reduction State.Reduction f S S' F D T from S to S' restricts the parameters in F, drops all pairs meeting F, and deletes the gates and equations in D, ensuring that only deletions of constraints in T can reroute to a remaining parameter and that non-deleted deletable constraints remain deletable.

Main definitions #

Main results #

Deletable constraints #

A deletable constraint: a gate with a constant argument or two equal arguments, or an equation with at most two terms.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.deletable_fixConst_child {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {p : ℕ} (P : Finset cfg.Pair) (b : Bool) {N : ℕ ⊕ ℕ} (hN : N ∈ S.children p) :

The children of a parameter fixed to a constant are deletable.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.deletable_deleteGate_child {cfg : Config} {n : ℕ} {S : State cfg n} {J K : ℕ} (c : Bool) (hK : K ∈ S.gates) (hKJ : K ≠ J) (hr : (S.gate K).Reads J) :

After deleting the gate J rerouted to a constant, the gates reading J are deletable.

Reductions #

A reduction from S to S': the parameters of F are restricted, the pairs meeting F are dropped, and the constraints of D are deleted. The children of a remaining parameter lose the deleted constraints and gain none, unless a deletion of a constraint of T that was one of its children reroutes to it; and the other constraints stay deletable.

The empty reduction from a valid state S to itself.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.trans {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S₁ S₂ : State cfg n} {F₁ F₂ : Finset ℕ} {D₁ D₂ T₁ T₂ : List (ℕ ⊕ ℕ)} (h₁ : Reduction f S S₁ F₁ D₁ T₁) (h₂ : Reduction f S₁ S₂ F₂ D₂ T₂) :
Reduction f S S₂ (F₁ ∪ F₂) (D₁ ++ D₂) (T₁ ++ T₂)

Reductions compose.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.trans_delete {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} {S₁ S₂ : State cfg n} {D₂ T₂ : List (ℕ ⊕ ℕ)} (h₁ : Reduction f S S₁ F D T) (h₂ : Reduction f S₁ S₂ ∅ D₂ T₂) :
Reduction f S S₂ F (D ++ D₂) (T ++ T₂)

A reduction followed by a reduction restricting nothing.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.mono {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) {T' : List (ℕ ⊕ ℕ)} (hT : ∀ N ∈ T, N ∈ T') :
Reduction f S S' F D T'

A reduction may record more deletions as possibly rerouting to parameters.

Accounting #

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.m_add {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) :
S'.m + F.card = S.m

A reduction restricting F decreases the number of parameters m by |F|.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.s_add {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) :
S'.s + D.length = S.s

A reduction deleting D decreases the size s by |D|.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.q_add {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) :
S'.q + (S.pairsMeeting F).card = S.q

A reduction restricting F decreases the number of pairs q by the number of pairs meeting F.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.a_add {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) (hS : S.Valid f) :
S'.a + F.card = S.a + (S.pairsMeeting F).card

Under a reduction restricting F, S'.a + |F| = S.a + (S.pairsMeeting F).card.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.mem_unpaired_iff {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) (hS : S.Valid f) {u : ℕ} :
u ∈ S'.unpaired ↔ u ∈ S.params ∧ u ∉ F ∧ (¬S.Paired u ∨ ∃ x ∈ F, S.IsPartner x u)

The unpaired parameters after a reduction: the unpaired parameters outside F and the partners of members of F.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.wt_eq_zero {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) (hS : S.Valid f) {u : ℕ} (hu : u ∉ S.unpaired) (hpart : ∀ x ∈ F, ¬S.IsPartner x u) :
S'.wt u = 0

A paired parameter that is not the partner of a member of F stays paired.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.wt_le_weight {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) {u : ℕ} (hT : ∀ N ∈ T, N ∉ S.children u) :
S'.wt u ≤ cfg.weight (S.children u \ D.toFinset).card

A parameter that no deletion of T reroutes to keeps at most its children outside D.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.children_subset {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) {u : ℕ} (hu : u ∈ S'.params) (hT : ∀ N ∈ T, N ∉ S.children u) :
S'.children u ⊆ S.children u \ D.toFinset

A parameter that no deletion of T reroutes to keeps at most its children outside D.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.wt_eq_zero_of_subset {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) {u : ℕ} (hsub : S.children u ⊆ D.toFinset) (hT : ∀ N ∈ T, N ∉ S.children u) :
S'.wt u = 0

A parameter all of whose children are deleted, and that no deletion reroutes to, becomes unused.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.W_le {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) (loss gain : ℕ → ℕ) (hpt : ∀ u ∈ S.params \ F, S'.wt u + loss u ≤ S.wt u + gain u) :
S'.W + cfg.cs * D.length + cfg.cq * (S.pairsMeeting F).card + ∑ u ∈ F, S.wt u + ∑ u ∈ S.params \ F, loss u ≤ S.W + ∑ u ∈ S.params \ F, gain u

The potential of a reduction. If every parameter outside F gains at most gain and loses at least loss in weight, then W' + cfg.cs * |D| + cfg.cq * k + ∑_{x ∈ F} wt(x) + ∑ loss ≤ W + ∑ gain, where k is the number of pairs meeting F.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Reduction.step {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S S' : State cfg n} {F : Finset ℕ} {D T : List (ℕ ⊕ ℕ)} (h : Reduction f S S' F D T) (hS : S.Valid f) (hF : F.card ≤ (S.pairsMeeting F).card + 2) (hne : 0 < F.card + D.length) (hW : S'.W + cfg.ca * F.card ≤ S.W + cfg.ca * (S.pairsMeeting F).card) :
Step f S S'

A reduction restricting at most k + 2 parameters (so Δa ≥ -2), and at least one parameter or constraint, with W' + cfg.ca * |F| ≤ W + cfg.ca * k, is a step of gate elimination.

Generic restriction reduction #

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.reduction_restrict_of {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {x : ℕ} (hx : x ∈ S.params) {ℓ : SemiCircuit.Lit} (hℓ : ∀ (y : ℕ), ℓ.Reads y → y ∈ S.params ∧ y ≠ x ∧ S.children x ⊆ S.children y) (hphi : cfg.phiOK (S.pairsAvoid x) (S.restrict x ℓ (S.pairsAvoid x)).phi) (hlocus : ∀ (val : ℕ → Bool), (S.restrict x ℓ (S.pairsAvoid x)).Locus val → S.Locus (Function.update val x (ℓ.eval val))) :
Reduction f S (S.restrict x ℓ (S.pairsAvoid x)) {x} [] []

Generic reduction for restricting a parameter x to a constant or to a literal of a remaining parameter y having at least x's children, given cfg.phiOK and locus preservation.

Deletions #

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.reduction_deleteGate {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {J : ℕ} {ℓ : SemiCircuit.Lit} (h : S.DeleteGateLocusOK J ℓ) {T : List (ℕ ⊕ ℕ)} (hT : ∀ (t : ℕ), ℓ.Reads t → Sum.inl J ∈ T) :
Reduction f S (S.deleteGate J ℓ) ∅ [Sum.inl J] T

Deleting a gate is a reduction; it may reroute only to the parameter read by the literal.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.reduction_deleteConst {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {J : ℕ} {c : Bool} (hJ : J ∈ S.gates) (hc : ∀ (val : ℕ → Bool), S.EqnsHold val → S.Locus val → (S.gate J).eval val = c) :

Deleting a gate that is constant on admissible equation solutions is a reduction rerouting nothing.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.reduction_deleteEqn {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {e v : ℕ} {ℓ : SemiCircuit.Lit} (h : S.DeleteEqnOK e v ℓ) {T : List (ℕ ⊕ ℕ)} (hT : ∀ (t : ℕ), ℓ.Reads t → Sum.inr e ∈ T) :
Reduction f S (S.deleteEqn e v ℓ) ∅ [Sum.inr e] T

Deleting an equation v = ℓ is a reduction; it may reroute only to the parameter read by the literal.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.terms_eq_empty_of_subset {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {e : ℕ} (he : e ∈ S.eqns) (hsub : (S.eqn e).terms ⊆ S.params) :
(S.eqn e).terms = ∅

In a valid state, an equation whose terms are all parameters has no terms.

The deletion of a constraint used by Valid.reduction_deleteConstraint. A gate is rerouted to its literal Gate.lit. An equation containing an auxiliary variable is deleted as v = U + rhs, where v is its least auxiliary variable and U its least other term, or as v = rhs if it has no other term. An equation without auxiliary variables is dropped.

@[simp]

Deleting a constraint removes no parameter.

@[simp]

Deleting a constraint keeps the pairs.

Deleting a constraint adds no gate.

A deletable constraint of a valid state is deleted by the reduction S.deleteConstraint N.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.exists_reduction_delete {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) {N : ℕ ⊕ ℕ} (hN : S.Deletable N) :
∃ (S' : State cfg n), Reduction f S S' ∅ [N] [N]

A deletable constraint of a valid state is deleted by a reduction.

theorem Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.exists_reduction_deleteAll {cfg : Config} {n : ℕ} {f : BooleanFunction n} {S : State cfg n} (hS : S.Valid f) (l : List (ℕ ⊕ ℕ)) (hl : l.Nodup) (hdel : ∀ N ∈ l, S.Deletable N) :
∃ (S' : State cfg n), Reduction f S S' ∅ l l

Distinct deletable constraints of a valid state are deleted by a reduction.