Pair-type-generic states and potential bookkeeping for gate elimination #
Shared state representation, pair/partner accounting, spread and affine helpers, and potential
bookkeeping shared by the 3.5n (AffineDisperser) and 4n (AffineDisperser4n) gate
elimination developments.
A configuration Config supplies:
- the carrier type
Pairwith endpointsfstandsnd(ℕ × ℕfor3.5n,ZeroPairfor4n); - the degree weight
weight : ℕ → ℕbounded byweightBoundand the potential coefficients(cs, cq, ca); - the pointwise locus predicate
locus(Truefor3.5n,Z(P)for4n) and the parameter-map affinity invariantphiOK(PairTamepreservation for3.5n, global affinity for4n).
Main definitions #
Cslib.Circuits.Boolean.AffineDisperserCore.Config: configuration of pair representation, weights, potential coefficients, and state invariants.Cslib.Circuits.Boolean.AffineDisperserCore.State: generic gate-elimination state extendingSemiCircuit.Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid,Step,Preparation: validity, steps, and preparatory operations.Cslib.Circuits.Boolean.AffineDisperserCore.State.Paired,unpaired,m,q,a,s,W,wt,IsPartner,pairsAvoid,pairsMeeting: pair and potential accounting.
Main results #
Cslib.Circuits.Boolean.AffineDisperserCore.State.W_add_le: comparing potentials name by name.Cslib.Circuits.Boolean.AffineDisperserCore.State.Valid.card_pairsMeeting_le,card_pairsMeeting_singleton,card_pairsMeeting_insert,card_sdiff_image: pair counting.
Configuration of pair representation, degree weights, potential coefficients, and invariants
shared by gate-elimination developments (3.5n and 4n).
- Pair : Type
Carrier type of parameter pairs.
First parameter of a pair.
Second parameter of a pair.
- decEq : DecidableEq self.Pair
Decidable equality on pairs.
- cs : ℕ
- cq : ℕ
- ca : ℕ
Degree weight of an unpaired parameter.
Monotonicity of
weight.Unused parameters have weight
0.- weightBound : ℕ
Upper bound on
weight k. Every degree weight is at most
weightBound.Admissibility predicate on assignments relative to
pairs.- locus_congr {P : Finset self.Pair} {val val' : ℕ → Bool} : (∀ pr ∈ P, val (self.fst pr) = val' (self.fst pr) ∧ val (self.snd pr) = val' (self.snd pr)) → self.locus P val → self.locus P val'
Admissibility depends only on coordinates occurring in
pairs. Parameter-map affinity invariant parameterized by
n, pairs, andphi.
Synthesize DecidableEq on cfg.Pair from cfg.decEq.
Decidability of Config.Contains.
A generic state of gate elimination for a Boolean function on n bits.
The pairs of parameters of the state.
The parameter map, as a function of all internal values.
Decidability of State.Paired.
Validity of a gate-elimination state S for a Boolean function f.
- wf : S.WellFormed
The semi-circuit is well formed.
- pair_mem (pr : cfg.Pair) : pr ∈ S.pairs → cfg.fst pr ∈ S.params ∧ cfg.snd pr ∈ S.params ∧ cfg.fst pr ≠ cfg.snd pr
Pairs consist of two distinct parameters.
- pairs_disjoint (pr : cfg.Pair) : pr ∈ S.pairs → ∀ pr' ∈ S.pairs, pr ≠ pr' → cfg.fst pr ≠ cfg.fst pr' ∧ cfg.fst pr ≠ cfg.snd pr' ∧ cfg.snd pr ≠ cfg.fst pr' ∧ cfg.snd pr ≠ cfg.snd pr'
Distinct pairs are disjoint.
The parameter map depends only on the parameters.
The parameter map satisfies
cfg.phiOK.The parameter map is injective on the parameters.
Every consistent admissible assignment outputs
fat its image.
Spreading bits over a finite set of names and affinity helpers #
Spreading a k-bit string over F defines an affine family of assignments.
The identity map on an additive group is affine.
Updating an affine family at one name by an affine function keeps it affine.
A constant plus a sum of coordinates of an affine family is affine.
Adding a fixed offset assignment preserves affinity of a family.
Admissibility of an assignment is preserved when two assignments agree on S.params.
Choosing one representative rep pr from every pair leaves a other parameters.
Helper deriving out_not_affine from false_of_fix.
Bookkeeping for the potential #
The weight S.wt x of any name x is at most cfg.weightBound.
Potentials compare name by name: if every name of a common set loses loss x and gains at
most gain x in weight, the sums of losses and gains bound the change of potential.
A step of gate elimination from S to S': S' is valid, m + s decreases,
Δa ∈ {0, -1, -2}, and ΔW ≤ cfg.ca * Δa, written without subtraction.
A preparatory operation of gate elimination from S to S': S' is valid, with the same
m, s and q as S and no larger potential.
- valid : S'.Valid f
The new state is valid.
The number of parameters is kept.
The size is kept.
The number of pairs is kept.
The potential does not increase.
A preparatory operation followed by a step is a step.
Pairs and partners #
Decidability of State.IsPartner.
If pr ∈ S.pairs contains p and r with p ≠ r, then r is the partner of p.
Any name contained in a pair of a valid state is a parameter.
A pair containing w is unique.
The partner relation State.IsPartner is symmetric.
In a valid state, a parameter is distinct from its partner.
A paired parameter outside F is in a pair meeting F exactly when its partner is in
F.
The parameters of a valid state are at least as many as its pairs.
At most |F| pairs meet a set F of parameters.
The number of pairs meeting {w} is 1 if w is paired and 0 otherwise.
Adding to F a parameter that is not the partner of a member of F adds its pair, if
any.