Enumeration by bounded weight: shrinking the search space from $2^n$ to $\sum_{k\le w}\binom nk$ #
(scaling, and the size of the certificate)
A lower-bound certificate can be built from a full-space enumeration
(Finset.univ : Finset (Vec n)): coverage then comes for free from Finset.mem_univ, but
the cost is $2^n$. In measurements $n \le 9$ runs in seconds while $n = 15$ takes over
three minutes, so that route stalls around $n \approx 12$.
This module takes a different route: enumerate only the vectors of weight $\le w$. A lower bound only has to exclude operators of weight $< d$, so $w = d - 1$ suffices, and
- the candidate space drops from $2^n$ to $\sum_{k \le w}\binom nk$ (for fixed $d$, a polynomial of degree $d-1$ in $n$)
- for $n = 15$ and $d = 3$: $2^{15} = 32768 \to \binom{15}{\le 2} = 121$ (a factor of 270).
The price is that coverage of the enumeration is no longer free: the main theorem of
this module, mem_lightVecs, is exactly that coverage lemma, and length_lightVecs gives
the exact count. Together they state the complexity characterisation, namely that the
reduced size of a distance-decision certificate is exactly $\sum_{k<d}\binom nk$.
Construction #
The enumeration and the weight are defined by the same recursion, so coverage can be proved by structural induction:
wtRec : the last coordinate counts 1 when nonzero and 0 when zero, recursing on the prefix
lightVecs (n+1) (w+1) = (lightVecs n (w+1)).map (pad a zero at the last position)
++ (lightVecs n w).map (pad a one at the last position)
lightVecs is exact and without repetition: its length is
$\sum_{k\le w}\binom nk$.
Main results #
mem_lightVecs: coverage; every vector of weight $\le w$ occurs in the enumeration.wtRec_eq_hammingNorm:wtRecagrees with the standardhammingNorm(the bridge to the public interface).length_lightVecs: the exact count; the length of the enumeration is $\sum_{k \le w}\binom nk$.
Padding the last coordinate #
"Pad the last coordinate": the first n coordinates take u and the n+1-st takes
b.
Deliberately written as an explicit if branch rather than Fin.snoc, for the same
reason as Fin.append: an if branch reduces coordinate by coordinate in the kernel, so
by decide can compute with it.
Equations
- QECCertificates.snocV u b i = if h : ↑i < n then u ⟨↑i, h⟩ else b
Instances For
A zero vector padded with a zero at the last position is still the zero vector.
Recursive weight and enumeration #
Recursive weight: a definition isomorphic to lightVecs, so that the coverage
proof can proceed by structural induction.
The last coordinate counts 1 when nonzero and 0 when zero, with recursion on the prefix
this agrees with hammingNorm (wtRec_eq_hammingNorm).
Equations
- QECCertificates.wtRec 0 x_2 = 0
- QECCertificates.wtRec n.succ v = (QECCertificates.wtRec n fun (i : Fin n) => v i.castSucc) + if v (Fin.last n) = 0 then 0 else 1
Instances For
All vectors of weight $\le w$ (a computable enumeration, exact and without repetition).
Recursion: the vectors of $n+1$ coordinates split into two classes according to their last coordinate. Those whose last coordinate is zero come from padding the vectors of $n$ coordinates of weight $\le w+1$ with a zero, and those whose last coordinate is 1 come from padding the vectors of $n$ coordinates of weight $\le w$ with a one.
Equations
- One or more equations did not get rendered due to their size.
- QECCertificates.lightVecs 0 x✝ = [0]
- QECCertificates.lightVecs n.succ 0 = [0]
Instances For
Weight zero means the zero vector #
Coverage #
Coverage: every vector of weight $\le w$ occurs in lightVecs n w.
The proof follows the recursive structure of lightVecs by looking at the last
coordinate. If the last coordinate is nonzero then the weight of the prefix must be
$\le w$; if it is zero then the prefix need only have weight $\le w+1$. Each case lands in
the corresponding half of the enumeration.
Bridge to the standard weight #
Soundness: lightVecs contains only vectors of weight $\le w$, the other half of
the coverage statement mem_lightVecs.
With both halves, the claim that the candidate set is empty is closed in both directions: coverage says nothing is missed, soundness says everything that is left really is light.
wtRec is the size of the support (agreeing with support and hammingNorm).
wtRec agrees with the standard hammingNorm (the bridge to the public
interface).
The exact count (size of the certificate) #
The exact length of the enumeration: lightVecs n w has exactly
$\sum_{k \le w}\binom nk$ elements.
This is the concrete content of the size of a distance-decision certificate: since a lower bound only has to exclude operators of weight $< d$, taking $w = d-1$ makes the candidate space exactly $\sum_{k<d}\binom nk$, a polynomial of degree $d-1$ in $n$ rather than the $2^n$ of the full space.