Documentation

CslibFrontier.Computability.LogSpaceDerandomization.CorrectionAtom

Correction atoms with an incoming gate #

A correction atom represents an entry Q (G x y / f) · g₀(y) of a correction matrix as the conditional mean of a bounded table, like the dense atoms of CslibFrontier.Computability.LogSpaceDerandomization.StochasticAtom. Its table also has few nonzero entries in each column. That bound is what lets later error estimates sum over the sources of a column. This is idea 6 in issue #474, following the OpenAI preprint [OpenAI2026LogSpace, Sections 5.3 and 5.5].

The incoming gate. A draw is a pair (s, t) of independent seeds: s for the start channel X, which retains sources, and t for the terminal channel (rank channel Y, usage channel Yt). The auxiliary score of a source x' at column y is I (G x' y / f, rank_K {G x' w / f : Y t w}) (Matrix.auxScore). The incoming gate of column y is τ (rank_{K_c} {aux x' y : X s x'}) (Matrix.incomingGate) [OpenAI2026LogSpace, (5.12)]. The atom is 1{Yt t y} · Q (G x y / f) · R · T_y / c(q_y) · g₀(y) (Matrix.correctionAtom), where R is the row gate of x, T_y the incoming gate, c(q) = max (1/2) (min 1 q), and q_y the conditional mean of the preparatory value h (G x y / f) · R · T_y given X(x) and Yt(y) (Matrix.correctionPrep, Matrix.correctionNormalizer) [OpenAI2026LogSpace, (5.13), (5.14)].

The identity [OpenAI2026LogSpace, Lemma 5.3]. The conditional mean of the atom is exactly Q (G x y / f) · g₀(y) (Matrix.expect_correctionAtom). The row gate fails on at most a quarter of the conditioning draws, by Matrix.card_filter_rowGate_lt_one_mul_le. The auxiliary score can exceed the gate's threshold only on a fixed set D of sources, and the incoming gate fails only if K_c members of D are retained (Matrix.card_filter_incomingGate_lt_one_mul_le). When g₀(y) ≠ 0, the hypothesis p · #D ≤ B (the preprint's column bound (5.2)) makes this rare too. When g₀(y) = 0 both sides vanish and no bound on D is needed. Both gates are then full on half of the draws, and the normalization principle (Finset.expect_mul_div_clip_eq) applies. The failure bounds use no independence between gates.

The incoming cap [OpenAI2026LogSpace, (5.18), Lemma 5.6]. If I = 1 wherever Q and ρ are both nonzero, and τ vanishes from g ≤ 1 on, then on every draw a column has fewer than K_c retained sources with a nonzero atom (Matrix.card_filter_correctionAtom_col_ne_zero_lt). K_c such sources would all have score one, which closes the incoming gate (Matrix.incomingGate_eq_zero). Rows have fewer than K nonzero atoms, as for dense atoms (Matrix.card_filter_correctionAtom_row_ne_zero_lt).

Main definitions #

Main results #

References #

theorem Finset.card_filter_le_card_filter_mul_le {V : Type u_1} {ι : Type u_2} (X : ι → V → Prop) [(s : ι) → (v : V) → Decidable (X s v)] (S : Finset ι) (D : Finset V) (x : V) {p : ℝ} (hp : 0 ≤ p) (hpair : ∀ w ∈ D, w ≠ x → ↑{s ∈ S | X s w}.card ≤ p * ↑S.card) (K : ℕ) :
↑{s ∈ S | K ≤ {w ∈ D | X s w}.card}.card * ↑K ≤ ↑S.card * (1 + p * ↑D.card)

Few draws retain many members of a sparse set (Markov's inequality). Let every member w ≠ x of D be retained on at most a p fraction of the draws in S. Then at most a (1 + p #D) / K fraction of the draws retain K > 0 members of D. The vertex x itself contributes at most one per draw.

noncomputable def Matrix.auxScore {V : Type u_1} (I : ℝ → ℝ → ℝ) (K : ℕ) (f : ℝ) (G : Matrix V V ℝ) (T : Finset V) (x y : V) :

The auxiliary score of the entry (x, y) for the retained set T of the rank channel: I (G x y / f, rank_K {G x w / f : w ∈ T}) [OpenAI2026LogSpace, (5.5)].

noncomputable def Matrix.incomingGate {V : Type u_1} (I : ℝ → ℝ → ℝ) (τ : ℝ → ℝ) (K Kc : ℕ) (f : ℝ) (G : Matrix V V ℝ) (S T : Finset V) (y : V) :

The incoming gate of column y: τ (rank_{K_c} {auxScore x y : x ∈ S}) over the retained set S of sources [OpenAI2026LogSpace, (5.12)].

noncomputable def Matrix.correctionPrep {V : Type u_1} (I : ℝ → ℝ → ℝ) (τ : ℝ → ℝ) (K Kc : ℕ) (f : ℝ) (G : Matrix V V ℝ) (h ρ : ℝ → ℝ) (S T : Finset V) (x y : V) :

The preparatory value of a correction atom: h (G x y / f) · R · T_y, with the row gate R and the incoming gate T_y [OpenAI2026LogSpace, (5.13)].

noncomputable def Matrix.correctionNormalizer {V : Type u_1} [Fintype V] (I : ℝ → ℝ → ℝ) (τ : ℝ → ℝ) (K Kc : ℕ) (f : ℝ) (G : Matrix V V ℝ) {ι : Type u_4} {κ : Type u_5} [Fintype ι] [Fintype κ] (X : ι → V → Prop) (Y Yt : κ → V → Prop) [(s : ι) → (v : V) → Decidable (X s v)] [(t : κ) → (v : V) → Decidable (Y t v)] [(t : κ) → (v : V) → Decidable (Yt t v)] (h ρ : ℝ → ℝ) (x y : V) :

The normalizer q_y of a correction atom: the mean of the preparatory value over the draws that retain x in the start channel and y in the usage channel [OpenAI2026LogSpace, (5.13)].

noncomputable def Matrix.correctionAtom {V : Type u_1} [Fintype V] (I : ℝ → ℝ → ℝ) (τ : ℝ → ℝ) (K Kc : ℕ) (f : ℝ) (G : Matrix V V ℝ) {ι : Type u_4} {κ : Type u_5} [Fintype ι] [Fintype κ] (X : ι → V → Prop) (Y Yt : κ → V → Prop) [(s : ι) → (v : V) → Decidable (X s v)] [(t : κ) → (v : V) → Decidable (Y t v)] [(t : κ) → (v : V) → Decidable (Yt t v)] (Q h ρ : ℝ → ℝ) (g₀ : V → ℝ) (d : ι × κ) (x y : V) :

The correction atom at (x, y) on the draw d = (s, t): 1{Yt t y} · Q (G x y / f) · R · T_y / c(q_y) · g₀(y) [OpenAI2026LogSpace, (5.14)].

theorem Matrix.incomingGate_eq_zero {V : Type u_1} {I : ℝ → ℝ → ℝ} {τ : ℝ → ℝ} {K Kc : ℕ} {f : ℝ} {G : Matrix V V ℝ} {S T : Finset V} {y : V} (hKc : 0 < Kc) {g : ℝ} (hg : g ≤ 1) (hτ : ∀ (r : ℝ), g ≤ r → τ r = 0) (hcard : Kc ≤ {x ∈ S | 1 ≤ auxScore I K f G T x y}.card) :
incomingGate I τ K Kc f G S T y = 0

The incoming cap [OpenAI2026LogSpace, Lemma 5.6]: if τ vanishes from g ≤ 1 on and at least K_c > 0 retained sources have auxiliary score at least one at column y, the incoming gate of y is closed.

theorem Matrix.card_filter_incomingGate_lt_one_mul_le {V : Type u_1} {ι : Type u_2} [Fintype V] {I : ℝ → ℝ → ℝ} {τ : ℝ → ℝ} {K Kc : ℕ} {f : ℝ} {G : Matrix V V ℝ} (X : ι → V → Prop) [(s : ι) → (v : V) → Decidable (X s v)] (S : Finset ι) (T : Finset V) (x y : V) (hKc : 0 < Kc) {τ₀ : ℝ} (hτ₀ : 0 ≤ τ₀) (hττ : ∀ r ≤ τ₀, τ r = 1) {e : ℝ} (hI : ∀ (v r : ℝ), v ≤ e → I v r = 0) {p : ℝ} (hp : 0 ≤ p) (hpair : ∀ (w : V), e < G w y / f → w ≠ x → ↑{s ∈ S | X s w}.card ≤ p * ↑S.card) :
↑{s ∈ S | incomingGate I τ K Kc f G {w : V | X s w} T y < 1}.card * ↑Kc ≤ ↑S.card * (1 + p * ↑{w : V | e < G w y / f}.card)

The incoming gate rarely fails [OpenAI2026LogSpace, proof of Lemma 5.3]. Let τ be one through τ₀ ≥ 0 and I vanish when its first argument is at most e, so a score above τ₀ needs a source in D = {x' | e < G x' y / f}. If every member w ≠ x of D is retained on at most a p fraction of the draws in S, then for every terminal set T the incoming gate is below one on at most a (1 + p #D) / K_c fraction of S.

theorem Matrix.abs_correctionAtom_le {V : Type u_1} {ι : Type u_2} {κ : Type u_3} [Fintype V] {I : ℝ → ℝ → ℝ} {τ : ℝ → ℝ} {K Kc : ℕ} {f : ℝ} {G : Matrix V V ℝ} [Fintype ι] [Fintype κ] {X : ι → V → Prop} {Y Yt : κ → V → Prop} [(s : ι) → (v : V) → Decidable (X s v)] [(t : κ) → (v : V) → Decidable (Y t v)] [(t : κ) → (v : V) → Decidable (Yt t v)] {Q h ρ : ℝ → ℝ} {g₀ : V → ℝ} (hρ0 : ∀ (r : ℝ), 0 ≤ ρ r) (hρ1 : ∀ (r : ℝ), ρ r ≤ 1) (hτ0 : ∀ (r : ℝ), 0 ≤ τ r) (hτ1 : ∀ (r : ℝ), τ r ≤ 1) (d : ι × κ) (x y : V) :
|correctionAtom I τ K Kc f G X Y Yt Q h ρ g₀ d x y| ≤ 2 * |Q (G x y / f)| * |g₀ y|

The correction atom is bounded: |F(x, y)| ≤ 2 |Q (G x y / f)| |g₀(y)| on every draw, when the row and incoming gate functions take values in [0, 1].

theorem Matrix.card_filter_correctionAtom_row_ne_zero_lt {V : Type u_1} {ι : Type u_2} {κ : Type u_3} [Fintype V] {I : ℝ → ℝ → ℝ} {τ : ℝ → ℝ} {K Kc : ℕ} {f : ℝ} {G : Matrix V V ℝ} [Fintype ι] [Fintype κ] {X : ι → V → Prop} {Y Yt : κ → V → Prop} [(s : ι) → (v : V) → Decidable (X s v)] [(t : κ) → (v : V) → Decidable (Y t v)] [(t : κ) → (v : V) → Decidable (Yt t v)] {Q h ρ : ℝ → ℝ} {g₀ : V → ℝ} (hK : 0 < K) {e g : ℝ} (he : 0 ≤ e) (hQ : ∀ v ≤ e, Q v = 0) (hg : g ≤ e) (hρ : ∀ (r : ℝ), g ≤ r → ρ r = 0) (d : ι × κ) (x : V) :
{y ∈ {w : V | Y d.2 w} | correctionAtom I τ K Kc f G X Y Yt Q h ρ g₀ d x y ≠ 0}.card < K

Row support [OpenAI2026LogSpace, Lemma 5.6]: if Q vanishes through e ≥ 0 and ρ vanishes from g ≤ e on, then on every draw fewer than K > 0 correction atoms of a row are nonzero among the vertices the rank channel retains.

theorem Matrix.card_filter_correctionAtom_col_ne_zero_lt {V : Type u_1} {ι : Type u_2} {κ : Type u_3} [Fintype V] {I : ℝ → ℝ → ℝ} {τ : ℝ → ℝ} {K Kc : ℕ} {f : ℝ} {G : Matrix V V ℝ} [Fintype ι] [Fintype κ] {X : ι → V → Prop} {Y Yt : κ → V → Prop} [(s : ι) → (v : V) → Decidable (X s v)] [(t : κ) → (v : V) → Decidable (Y t v)] [(t : κ) → (v : V) → Decidable (Yt t v)] {Q h ρ : ℝ → ℝ} {g₀ : V → ℝ} (hKc : 0 < Kc) (hIQ : ∀ (v r : ℝ), Q v ≠ 0 → ρ r ≠ 0 → I v r = 1) {g : ℝ} (hg : g ≤ 1) (hτ : ∀ (r : ℝ), g ≤ r → τ r = 0) (d : ι × κ) (y : V) :
{x ∈ {w : V | X d.1 w} | correctionAtom I τ K Kc f G X Y Yt Q h ρ g₀ d x y ≠ 0}.card < Kc

Column support: the incoming cap [OpenAI2026LogSpace, (5.18), Lemma 5.6]. Suppose the auxiliary score is one wherever Q and ρ are both nonzero, and τ vanishes from g ≤ 1 on. Then on every draw fewer than K_c > 0 retained sources have a nonzero atom in column y: K_c of them would close the incoming gate, which makes the whole column zero.

theorem Matrix.expect_correctionAtom {V : Type u_1} {ι : Type u_2} {κ : Type u_3} [Fintype V] {I : ℝ → ℝ → ℝ} {τ : ℝ → ℝ} {K Kc : ℕ} {f : ℝ} {G : Matrix V V ℝ} [Fintype ι] [Fintype κ] {X : ι → V → Prop} {Y Yt : κ → V → Prop} [(s : ι) → (v : V) → Decidable (X s v)] [(t : κ) → (v : V) → Decidable (Y t v)] [(t : κ) → (v : V) → Decidable (Yt t v)] {Q h ρ : ℝ → ℝ} {g₀ : V → ℝ} {x y : V} (hSx : {s : ι | X s x}.Nonempty) (hSy : {t : κ | Yt t y}.Nonempty) (hQh : ∀ (v : ℝ), Q v ≠ 0 → h v = 1) (hρ0 : ∀ (r : ℝ), 0 ≤ ρ r) (hρ1 : ∀ (r : ℝ), ρ r ≤ 1) {η : ℝ} (hη : 0 < η) (hρη : ∀ r ≤ η, ρ r = 1) (hτ0 : ∀ (r : ℝ), 0 ≤ τ r) (hτ1 : ∀ (r : ℝ), τ r ≤ 1) {τ₀ : ℝ} (hτ₀ : 0 ≤ τ₀) (hττ : ∀ r ≤ τ₀, τ r = 1) {e : ℝ} (hI : ∀ (v r : ℝ), v ≤ e → I v r = 0) (hf : 0 < f) (hG0 : ∀ (w : V), 0 ≤ G x w) {M : ℝ} (hGM : ∑ w : V, G x w ≤ M) {c : ℝ} (hc : 0 ≤ c) (hK : 4 * (1 + c * M / η) ≤ ↑K) (hpairY : ∀ (w : V), w ≠ y → ↑{t : κ | Yt t y ∧ Y t w}.card ≤ c * f * ↑{t : κ | Yt t y}.card) {p : ℝ} (hp : 0 ≤ p) (hpairX : ∀ (w : V), w ≠ x → ↑{s : ι | X s x ∧ X s w}.card ≤ p * ↑{s : ι | X s x}.card) {B : ℝ} (hB : g₀ y ≠ 0 → p * ↑{w : V | e < G w y / f}.card ≤ B) (hKc : 4 * (1 + B) ≤ ↑Kc) :
(({s : ι | X s x} ×ˢ {t : κ | Yt t y}).expect fun (d : ι × κ) => correctionAtom I τ K Kc f G X Y Yt Q h ρ g₀ d x y) = Q (G x y / f) * g₀ y

The correction atom identity, including zero multipliers [OpenAI2026LogSpace, Lemma 5.3]. Let h = 1 wherever Q ≠ 0; let ρ, τ ∈ [0, 1], with ρ one through η > 0 and τ one through τ₀ ≥ 0; and let I vanish when its first argument is at most e. Let row x of G ≥ 0 have mass at most M. Suppose the draws retaining x in X and y in Yt are nonempty, and two pair bounds hold. Every w ≠ y is retained by Y on at most a c f fraction of the draws with Yt(y). Every w ≠ x is retained by X on at most a p fraction of the draws with X(x). If g₀(y) ≠ 0, let the sources that can score satisfy p · #{w | e < G w y / f} ≤ B. Then, for K ≥ 4 (1 + c M / η) and K_c ≥ 4 (1 + B), the conditional mean of the atom is exactly Q (G x y / f) · g₀(y).

theorem Matrix.correctionAtom_nonneg {V : Type u_1} {ι : Type u_2} {κ : Type u_3} [Fintype V] {K Kc : ℕ} {f : ℝ} [Fintype ι] [Fintype κ] {I : ℝ → ℝ → ℝ} {τ Q h ρ : ℝ → ℝ} {X : ι → V → Prop} {Z Zt : κ → V → Prop} [(s : ι) → (x : V) → Decidable (X s x)] [(t : κ) → (z : V) → Decidable (Z t z)] [(t : κ) → (z : V) → Decidable (Zt t z)] {G : Matrix V V ℝ} {g₀ : V → ℝ} (hQ0 : ∀ (v : ℝ), 0 ≤ Q v) (hρ0 : ∀ (r : ℝ), 0 ≤ ρ r) (hτ0 : ∀ (r : ℝ), 0 ≤ τ r) (hg₀ : ∀ (z : V), 0 ≤ g₀ z) (d : ι × κ) (x z : V) :
0 ≤ correctionAtom I τ K Kc f G X Z Zt Q h ρ g₀ d x z

Nonnegative cutoff and gate values give a nonnegative atom.