Documentation

CslibFrontier.Computability.Circuit.Boolean.Zhegalkin.SectionPairing

Internal horizontal-section column-pairing combinatorics #

Internal partition of row-section active columns into consecutive pairs and odd leftover columns (activeRows, pairedCols, oddCols, sectionPeers) shared by BlockCols, AdditiveBound, StageParts, StageStep, and UpperBound; never re-exported through Zhegalkin.

Main definitions #

Main results #

theorem Cslib.Circuits.div_lt_ceilDiv {j m p : ℕ} (hj : j < m) (hp : 0 < p) :
j / p < m ⌈/⌉ p
def Cslib.Circuits.blockIndices (k width q : ℕ) :

Block q of width width in Fin k.

theorem Cslib.Circuits.sum_card_blockIndices (k width : ℕ) (hw : 0 < width) :
∑ q ∈ Finset.range (k ⌈/⌉ width), (blockIndices k width q).card = k
theorem Cslib.Circuits.card_blockIndices_le (k width q : ℕ) (hw : 0 < width) :
(blockIndices k width q).card ≤ width
@[reducible, inline]

Horizontal section index and peer row pair (u, (r₁, r₂)).

@[reducible, inline]

Horizontal section index u of a section-peer tuple.

@[reducible, inline]

First row index r₁ of a section-peer tuple.

@[reducible, inline]

Second row index r₂ of a section-peer tuple.

def Cslib.Circuits.activeRows {Col : Type u_1} {m : ℕ} (hasCol : Fin m → Col → Bool) (p u : ℕ) (c : Col) :

Rows in horizontal section u that have true in column c.

def Cslib.Circuits.pairedCols {Col : Type u_1} [Fintype Col] {m : ℕ} (hasCol : Fin m → Col → Bool) (p u : ℕ) (r₁ r₂ : Fin m) :
Finset Col

Columns in which rows r₁ < r₂ of section u form one of the consecutive pairs of 1s.

def Cslib.Circuits.oddCols {Col : Type u_1} [Fintype Col] {m : ℕ} (hasCol : Fin m → Col → Bool) (p : ℕ) (r : Fin m) :
Finset Col

Columns in which row r is the unique unpaired leftover 1 in its section r.1 / p.

theorem Cslib.Circuits.mem_pairedCols_imp {Col : Type u_1} [Fintype Col] {m : ℕ} {hasCol : Fin m → Col → Bool} {p u : ℕ} {r₁ r₂ : Fin m} {c : Col} (hc : c ∈ pairedCols hasCol p u r₁ r₂) :
r₁ < r₂ ∧ ↑r₁ / p = u ∧ ↑r₂ / p = u ∧ hasCol r₁ c = true ∧ hasCol r₂ c = true
theorem Cslib.Circuits.mem_oddCols_imp {Col : Type u_1} [Fintype Col] {m : ℕ} {hasCol : Fin m → Col → Bool} {p : ℕ} {r : Fin m} {c : Col} (hc : c ∈ oddCols hasCol p r) :
hasCol r c = true
def Cslib.Circuits.sectionPeers {m : ℕ} (p : ℕ) (r : Fin m) :

Other rows in the same horizontal section of height p as row r.

theorem Cslib.Circuits.card_sectionPeers_le {m p : ℕ} (hp : 0 < p) (r : Fin m) :
theorem Cslib.Circuits.sum_filter_hasCol_eq {Col : Type u_1} [Fintype Col] {m : ℕ} {G : Type u_2} [AddCommMonoid G] (hasCol : Fin m → Col → Bool) (p : ℕ) (val : Col → G) (r : Fin m) :
∑ c : Col with hasCol r c = true, val c = ∑ r' ∈ sectionPeers p r, ∑ c ∈ pairedCols hasCol p (↑r / p) (min r r') (max r r'), val c + ∑ c ∈ oddCols hasCol p r, val c

Every row's active columns partition into its paired columns with peers in the same section and its odd-leftover columns. This holds in any additive commutative monoid, without cancellation.

theorem Cslib.Circuits.two_mul_sum_card_pairedCols_le {Col : Type u_1} [Fintype Col] {m : ℕ} (hasCol : Fin m → Col → Bool) {p : ℕ} (hp : 0 < p) :
2 * ∑ u ∈ Finset.range (m ⌈/⌉ p), ∑ pair : Fin m × Fin m, (pairedCols hasCol p u pair.1 pair.2).card ≤ ∑ r : Fin m, {c : Col | hasCol r c = true}.card

Twice the total number of paired columns across all sections is at most the weight of hasCol.

theorem Cslib.Circuits.sum_card_oddCols_le {Col : Type u_1} [Fintype Col] {m : ℕ} (hasCol : Fin m → Col → Bool) {p : ℕ} (hp : 0 < p) :
∑ r : Fin m, (oddCols hasCol p r).card ≤ m ⌈/⌉ p * Fintype.card Col

The total number of odd-leftover columns across all rows is at most (m ⌈/⌉ p) * |Col|.