Documentation

CslibFrontier.Computability.Complexity.FineGrained.LocalMapCounting

Preimage counting and self-reduction for constant-locality Boolean maps #

In [OAI26k] (7ef5c0cc, Appendix C.2, p. 52):

C.2. Inverting Boolean maps with constant output locality. Fix a constant $d$. Consider a Boolean map $G : \{0, 1\}^n \to \{0, 1\}^m$ whose $i$th output bit has the form $$G(\vec{x})_i = g_i(\vec{x}|_{S_i}), \qquad S_i \subseteq [n], \qquad |S_i| \leqslant d.$$ The input description of $G$ lists the sets $S_i$ and the truth tables of the Boolean functions $g_i$. Thus each output inspects only constantly many input bits, although the sets $S_i$ may overlap arbitrarily. Given a target $\vec{b} \in \{0, 1\}^m$, inversion asks for any $\vec{x}$ with $G(\vec{x}) = \vec{b}$.

Corollary C.2. For every fixed $d$ and $n \geqslant 20$, the number $|G^{-1}(\vec{b})|$ can be computed exactly, and a preimage can be found whenever one exists, in deterministic time $$(n + m)^{O_d(1)} 2^{O_d(\rho(n))}$$ and space $(n + m)^{O_d(1)}$.

Notation mapping and deliberate differences from the source #

Main definitions #

Main results #

References #

Local outputs and constant-locality Boolean maps #

@[reducible, inline]

A single output coordinate of a local Boolean map: an ordered list scope of input variable indices and the list accepts of local bit patterns on scope for which the output bit is true.

@[reducible, inline]

A Boolean map $G : \{0, 1\}^n \to \{0, 1\}^m$ represented by its number of declared input variables numVars = n and its list of m local output coordinates.

@[reducible, inline]

Framed encoding of a single local output coordinate.

@[reducible, inline]

Framed encoding of a local map, with the declared variable count in unary and the output coordinates in a framed list.

@[reducible, inline]

Framed encoding of a local map inversion / preimage query (G, target).

@[reducible, inline]

The input variable indices inspected by a local output coordinate.

@[reducible, inline]

The local bit patterns accepted by a local output coordinate.

Evaluate a local output coordinate on a local bit pattern α.

Evaluate a local output coordinate under a global variable assignment σ : ℕ → Bool.

Construct a LocalOutput on scope from any Boolean predicate f : List Bool → Bool by tabulating the accepted patterns in BitString.enumList scope.length.

@[simp]
theorem Cslib.Complexity.LocalOutput.eval_ofFn (scope : List ℕ) (f : List Bool → Bool) (σ : ℕ → Bool) :
(ofFn scope f).eval σ = f (List.map σ scope)

Evaluating ofFn scope f under σ agrees with f (scope.map σ).

Validity of a local output coordinate for locality k and N declared input variables: its scope has length at most k and every variable index lies in < N.

theorem Cslib.Complexity.LocalOutput.valid_eq_true_iff {k N : ℕ} {c : LocalOutput} :
Valid k N c = true ↔ c.1.length ≤ k ∧ ∀ v ∈ c.1, v < N

Characterization of LocalOutput.Valid k N c = true.

@[reducible, inline]

Framed encoding of a CSP relation (accepts, targetBit) for local map inversion.

@[reducible, inline]

Number of declared input variables $n$ of $G : \{0, 1\}^n \to \{0, 1\}^m$.

@[reducible, inline]

List of local output coordinates of $G$.

Number of output bits $m$ of $G : \{0, 1\}^n \to \{0, 1\}^m$.

Evaluate a local map under an assignment σ : ℕ → Bool.

@[simp]

The output list of G.eval σ has length G.numOutputs.

Evaluate a local map on a bitstring x : List Bool (reading false past x.length).

@[simp]

The output list of G.evalBits x has length G.numOutputs.

Validity of a local map for locality bound k: every output coordinate has scope length ≤ k and only inspects input variables < G.numVars.

theorem Cslib.Complexity.LocalMap.valid_eq_true_iff {k : ℕ} {G : LocalMap} :
Valid k G = true ↔ ∀ c ∈ G.2, c.1.length ≤ k ∧ ∀ v ∈ c.1, v < G.1

Characterization of LocalMap.Valid k G = true.

theorem Cslib.Complexity.LocalMap.eval_congr {k : ℕ} {G : LocalMap} (hG : Valid k G = true) {σ τ : ℕ → Bool} (h : ∀ v < G.numVars, σ v = τ v) :
G.eval σ = G.eval τ

Evaluation of a valid local map depends only on variable values below G.numVars.

The number of preimages of target under G in $\{0, 1\}^{G.\mathrm{numVars}}$.

theorem Cslib.Complexity.LocalMap.preimageCount_eq_card_fin (G : LocalMap) (target : List Bool) :
G.preimageCount target = {σ : Fin G.numVars → Bool | (G.eval fun (v : ℕ) => if h : v < G.numVars then σ ⟨v, h⟩ else false) = target}.card

preimageCount is the cardinality of preimages in Fin G.numVars → Bool.

When target.length ≠ G.numOutputs, G.preimageCount target = 0.

CSP relation semantics for local map preimage constraints (accepts, targetBit).

Express the local map preimage equation G(x) = target as a Boolean CSP over relation alphabet List (List Bool) × Bool, emitting one constraint ⟨(c.accepts, target_i), c.scope⟩ per output coordinate.

theorem Cslib.Complexity.LocalMap.eval_toCSP {G : LocalMap} {target : List Bool} (hlen : target.length = G.numOutputs) (σ : ℕ → Bool) :
Logic.PL.CSP.eval cspSem σ (G.toCSP target) = decide (G.eval σ = target)

When target.length = G.numOutputs, (G.toCSP target).eval cspSem σ holds if and only if G.eval σ = target.

theorem Cslib.Complexity.LocalMap.evalBits_eq_iff_eval_toCSP {G : LocalMap} {target : List Bool} (hlen : target.length = G.numOutputs) (x : List Bool) :
G.evalBits x = target ↔ Logic.PL.CSP.eval cspSem (fun (v : ℕ) => x.getD v false) (G.toCSP target) = true

When target.length = G.numOutputs, G.evalBits x = target holds if and only if the assignment fun v => x.getD v false satisfies G.toCSP target.

Exact-multiplicity CSP preimage preservation: When target.length = G.numOutputs, G.preimageCount target equals the declared-variable CSP model count of G.toCSP target on Finset.range G.numVars.

For any k-valid local map G, G.toCSP target satisfies CSP.validDeclaredCSP k G.numVars.

theorem Cslib.Complexity.LocalMap.preimageCount_pos_iff {k : ℕ} {G : LocalMap} (hG : Valid k G = true) (target : List Bool) :
0 < G.preimageCount target ↔ ∃ (x : List Bool), x.length = G.numVars ∧ G.evalBits x = target

A valid k-local map has a positive preimage count for target if and only if there exists an n-bit input x : List Bool with x.length = G.numVars and G.evalBits x = target.

Polynomial-time computability of local map operations #

Section 4: Preimage counting and decision endpoints via CSP.toCNFBounded #

The decision problem of whether a k-local map query (G, target) is k-valid and has at least one preimage in {0, 1}^{G.numVars}.

Guard checking that G is k-valid and target has length G.numOutputs.

Convert a local map query (G, target) into a declared-variable CNF instance DeclaredCNF for width k by compiling G.toCSP target via CSP.toCNFBounded k LocalMap.cspSem when LocalMap.ValidQuery k q holds, and emitting ⟨G.numVars, [[]]⟩ otherwise.

@[simp]

The declared variable count of LocalMap.toDeclaredCNF k q is q.1.numVars.

For k ≤ k', LocalMap.toDeclaredCNF k q always produces a valid declared k'-CNF input.

Evaluating the CNF produced by LocalMap.toDeclaredCNF k q under σ tests whether q.1 is k-valid and q.1.eval σ = q.2.

The declared-variable model count of LocalMap.toDeclaredCNF k q equals q.1.preimageCount q.2 when q.1 is k-valid, and 0 otherwise.

Polynomial-time reduction from LocalMapHasPreimage k to KSAT k.

The number of occurring variables in LocalMap.toKSAT k q is at most q.1.numVars.

Declared-form local map preimage counter (Corollary C.2): For every fixed locality bound k, one native machine computes the exact preimage count G.preimageCount target for every valid k-local map G (and 0 when G is invalid), in time $2^{O_k(\mathrm{interpolationScale}(n))} \cdot \mathrm{poly}(L)$ and polynomial space $\mathrm{poly}(L)$.

Subexponential local map preimage counting (Corollary C.2): For every fixed locality bound k, one native machine computes G.preimageCount target for every valid k-local map G and target target, within time ⌈2 ^ (A * interpolationScale G.numVars)⌉₊ * (L + 1) ^ e and space (L + 1) ^ b.

Subexponential-time preimage existence for constant-locality maps (Corollary C.2): For every fixed locality bound k, LocalMapHasPreimage k is decidable in subexponential time in the number of input variables G.numVars.

Section 5: Prefix self-reduction and preimage finding #

Unit clauses fixing the first u.length input variables 0, ..., u.length - 1 to the bits of u.

@[reducible, inline]

State of the prefix self-reduction loop: the fixed declared-variable CNF instance (N, φ) together with the partial assignment prefix u : List Bool constructed so far.

Build the declared-variable CNF query testing whether u ++ [false] can be extended to a satisfying assignment of st.1.2 on Finset.range st.1.1.

One step of prefix self-reduction parameterized by a declared-variable counter count: append false if u ++ [false] has at least one extension (count (...) != 0), and true otherwise (count (...) == 0).

Canonical mathematical declared-variable counter on Finset.range p.1.

Final verification step of prefix self-reduction: check whether the candidate bitstring st.2 satisfies the formula st.1.2, returning some st.2 if so and none otherwise.

Pair view (numVars, formula) of LocalMap.toDeclaredCNF k q for the tuple-encoded PreimageSearchState self-reduction loop.

Run G.numVars steps of prefix self-reduction with counter count and verify the resulting candidate bitstring.

Canonical mathematical preimage finder for a k-local map G and target target via prefix self-reduction.

theorem Cslib.Complexity.LocalMap.findPreimage_eq_some {k : ℕ} {G : LocalMap} {target x : List Bool} (h : findPreimage k G target = some x) :
Valid k G = true ∧ x.length = G.numVars ∧ G.evalBits x = target

Soundness of findPreimage: Whenever G.findPreimage k target = some x, G is k-valid, x has length G.numVars, and G.evalBits x = target.

theorem Cslib.Complexity.LocalMap.findPreimage_isSome_of_preimageCount_pos {k : ℕ} {G : LocalMap} (hG : Valid k G = true) {target : List Bool} (hpos : 0 < G.preimageCount target) :
(findPreimage k G target).isSome = true

Completeness of findPreimage: For any valid k-local map G and target target with 0 < G.preimageCount target, G.findPreimage k target returns some x for an n-bit preimage x of target.

theorem Cslib.Complexity.LocalMap.findPreimage_isSome_iff {k : ℕ} {G : LocalMap} (hG : Valid k G = true) (target : List Bool) :
(findPreimage k G target).isSome = true ↔ 0 < G.preimageCount target

For a valid k-local map G, G.findPreimage k target returns some x if and only if 0 < G.preimageCount target.

theorem Cslib.Complexity.LocalMap.findPreimage_eq_none_iff {k : ℕ} {G : LocalMap} (hG : Valid k G = true) (target : List Bool) :
findPreimage k G target = none ↔ G.preimageCount target = 0

For a valid k-local map G, G.findPreimage k target returns none if and only if G.preimageCount target = 0.

Declared-form local map preimage finder (Corollary C.2): For every fixed locality bound k, LocalMap.findPreimage k is computed on native multi-tape Turing machines in time $2^{O_k(\mathrm{interpolationScale}(n))} \cdot \mathrm{poly}(L)$ and polynomial space $\mathrm{poly}(L)$.

Subexponential local map preimage finding (Corollary C.2): For every fixed locality bound k, one native machine computes G.findPreimage k target (returning some x with x.length = G.numVars and G.evalBits x = target whenever G is k-valid and a preimage exists, and none otherwise) within time ⌈2 ^ (A * interpolationScale G.numVars)⌉₊ * (L + 1) ^ e and space (L + 1) ^ b.