Documentation

CslibFrontier.Computability.LogSpaceDerandomization.CorrectionHierarchy

Corrections, copies and reward transport for transition matrices #

Let C be the transition matrix of a finite Markov chain that may stop (its rows sum to at most one), and let e be a reward collected when it stops. The expected reward p from each state solves (1 - C) p = e; when C is nilpotent, p = (1 - C)⁻¹ e. For the time-layered configuration graph of a randomized machine, p is the vector of acceptance probabilities.

This file develops the exact algebra of a hierarchy that shrinks the entries of C while keeping p recoverable, following the OpenAI preprint (2026-09-23), Section 4, idea 2 and the deterministic part of idea 4 in issue #474 [OAI26e]. The estimates that choose the corrections and the copies (factorial truncation, detectors) are not part of this file.

Strictly upper triangular matrices (Matrix.IsStrictUpperTriangular) and the bounds for nonnegative matrices acting on vectors (Matrix.mulVec_nonneg, Matrix.mulVec_le_one) are general and live in CslibFrontier.Foundations.LinearAlgebra.Matrix.StrictUpperTriangular and CslibFrontier.Foundations.LinearAlgebra.Matrix.NonnegMulVec.

Main definitions #

Main results #

References #

theorem one_add_mul_one_sub_eq_one_sub {R : Type u_1} [Ring R] (c e : R) :
(1 + e) * (1 - c) = 1 - (c - e + e * c)

The correction factorization. In any ring, correcting c by e to c - e + e * c factors 1 - (c - e + e * c) as (1 + e) * (1 - c) [OpenAI2026LogSpace, Section 4].

theorem Matrix.one_sub_correction_mulVec {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [Ring R] (C E : Matrix V V R) (p : V → R) :
(1 - (C - E + E * C)).mulVec p = (1 + E).mulVec ((1 - C).mulVec p)

Corrections preserve the expected reward. Correcting C to C - E + E * C turns the equation (1 - C) p = e into (1 - D) p = (1 + E) e for the same p: the weight removed from the transitions reappears in the reward [OpenAI2026LogSpace, Section 4].

theorem Matrix.inv_one_sub_correction_mulVec {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [CommRing R] {C E : Matrix V V R} (hE : IsUnit (1 + E).det) (e : V → R) :
(1 - (C - E + E * C))⁻¹.mulVec (e + E.mulVec e) = (1 - C)⁻¹.mulVec e

The corrected inverse. When 1 + E is invertible, the expected reward (1 - C)⁻¹ e of C equals the expected reward of the corrected matrix C - E + E * C with the corrected reward e + E e.

theorem Matrix.IsStrictUpperTriangular.inv_one_sub_correction_mulVec {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [LinearOrder V] [CommRing R] {C E : Matrix V V R} (hE : E.IsStrictUpperTriangular) (e : V → R) :
(1 - (C - E + E * C))⁻¹.mulVec (e + E.mulVec e) = (1 - C)⁻¹.mulVec e

The corrected inverse for a strictly upper triangular correction.

theorem Matrix.correction_mulVec_one {V : Type u_1} {R : Type u_2} [Fintype V] [Ring R] (C E : Matrix V V R) :
(C - E + E * C).mulVec 1 = C.mulVec 1 - E.mulVec (1 - C.mulVec 1)

The row sums of a corrected matrix: (C - E + E C) 1 = C 1 - E (1 - C 1).

theorem Matrix.correction_mulVec_one_le {V : Type u_1} {R : Type u_2} [Fintype V] [Ring R] [PartialOrder R] [IsOrderedRing R] {C E : Matrix V V R} (hE : ∀ (i j : V), 0 ≤ E i j) (hC : C.mulVec 1 ≤ 1) :
(C - E + E * C).mulVec 1 ≤ C.mulVec 1

Corrections do not increase row sums. If E ≥ 0 and the rows of C sum to at most one, then each row of C - E + E C sums to at most the corresponding row of C. This says nothing about the signs of the entries of C - E + E C; their nonnegativity depends on how E is chosen [OpenAI2026LogSpace, Lemma 4.4].

def Matrix.copySplit {V : Type u_1} {ι : Type u_2} {R : Type u_3} [Mul R] (r : ι → V → R) (s : V → V → ι → R) (D : Matrix V V R) :
Matrix (V × ι) (V × ι) R

A copy step. Each vertex x gets copies (x, i) with row weights r i x, and the entry D x y is split among the copies (y, j) of its target in proportions s x y j. In the preprint the proportions depend only on the size of D x y, and the copies beyond a primary one are activated only at targets where the correction was suppressed [OpenAI2026LogSpace, Section 4.4].

def Matrix.copyWeight {V : Type u_1} {ι : Type u_2} {R : Type u_3} [DecidableEq V] [Zero R] (r : ι → V → R) :
Matrix (V × ι) V R

The copy projection from copies to their parents, weighted by r: the copy (x, i) maps to x with weight r i x.

@[simp]
theorem Matrix.copyWeight_mulVec {V : Type u_1} {ι : Type u_2} {R : Type u_3} [Fintype V] [DecidableEq V] [NonUnitalNonAssocSemiring R] (r : ι → V → R) (v : V → R) (a : V × ι) :
(copyWeight r).mulVec v a = r a.2 a.1 * v a.1
theorem Matrix.copyWeight_apply_of_eq_one {V : Type u_1} {ι : Type u_2} {R : Type u_3} [DecidableEq V] [Semiring R] {r : ι → V → R} {x : V} {i : ι} (h : r i x = 1) (w : V) :
copyWeight r (x, i) w = if w = x then 1 else 0

A copy with weight one projects to its parent exactly.

theorem Matrix.copySplit_mul_copyWeight {V : Type u_1} {ι : Type u_2} {R : Type u_3} [Fintype V] [DecidableEq V] [Fintype ι] [Semiring R] {r : ι → V → R} {s : V → V → ι → R} {D : Matrix V V R} (hs : ∀ (x y : V), D x y ≠ 0 → ∑ j : ι, s x y j * r j y = 1) :

Copies intertwine with their projection. If, on every nonzero entry D x y, the proportions s x y j weighted by r j y sum to one, then splitting D into copies and projecting back agrees with projecting first: copySplit r s D * copyWeight r = copyWeight r * D [OpenAI2026LogSpace, Proposition 4.5].

theorem Matrix.copySplit_nonneg {V : Type u_1} {ι : Type u_2} {R : Type u_3} [Semiring R] [PartialOrder R] [IsOrderedRing R] {r : ι → V → R} {s : V → V → ι → R} {D : Matrix V V R} (hr : ∀ (i : ι) (x : V), 0 ≤ r i x) (hs : ∀ (x y : V) (j : ι), 0 ≤ s x y j) (hD : ∀ (x y : V), 0 ≤ D x y) (a b : V × ι) :
0 ≤ copySplit r s D a b
theorem Matrix.copySplit_isStrictUpperTriangular {V : Type u_1} {ι : Type u_2} {R : Type u_3} [LT V] [LT ι] [MulZeroClass R] {r : ι → V → R} {s : V → V → ι → R} {D : Matrix V V R} (hD : D.IsStrictUpperTriangular) :

Copies stay strictly upper triangular for the lexicographic order on the copies: (x, i) comes before (y, j) when x < y, or x = y and i < j. Indexed by Lex (V × ι), which is linearly ordered when V and ι are, a copy step of a strictly upper triangular matrix can be corrected and copied again. Only the order of the parents matters: an entry from (x, i) to (y, j) vanishes unless x < y.

theorem Matrix.copySplit_mulVec_one_le {V : Type u_1} {ι : Type u_2} {R : Type u_3} [Fintype V] [Fintype ι] [Semiring R] [PartialOrder R] [IsOrderedRing R] {r : ι → V → R} {s : V → V → ι → R} {D : Matrix V V R} (hr0 : ∀ (i : ι) (x : V), 0 ≤ r i x) (hr1 : ∀ (i : ι) (x : V), r i x ≤ 1) (hs1 : ∀ (x y : V), ∑ j : ι, s x y j ≤ 1) (hD0 : ∀ (x y : V), 0 ≤ D x y) (hD1 : D.mulVec 1 ≤ 1) :
(copySplit r s D).mulVec 1 ≤ 1

Copies keep row sums at most one when the weights lie in [0, 1], D is nonnegative with row sums at most one, and the proportions of each entry sum to at most one. Together with Matrix.copySplit_nonneg this makes the copy step substochastic.

def Matrix.copyProjection {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} [Semiring R] (P : (l : ℕ) → Matrix (V (l + 1)) (V l) R) (l : ℕ) :
Matrix (V l) (V 0) R

The cumulative projection of a sequence of stages with projections P l : Matrix (V (l + 1)) (V l) R: the product P (l - 1) * ⋯ * P 0, from stage l to stage 0.

def Matrix.rewardTransport {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} [Semiring R] (P : (l : ℕ) → Matrix (V (l + 1)) (V l) R) (E : (l : ℕ) → Matrix (V l) (V l) R) (l : ℕ) :
Matrix (V l) (V 0) R

The transported reward matrix of a sequence of stages with projections P l and corrections E l: B (l + 1) = P l * (1 + E l) * B l, starting from B 0 = 1. Applied to the initial reward e, it gives the stage-l reward B l e.

theorem Matrix.mul_copyProjection {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {C E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] (h : ∀ (l : ℕ), C (l + 1) * P l = P l * (C l - E l + E l * C l)) (l : ℕ) :
C l * copyProjection P l = copyProjection P l - rewardTransport P E l * (1 - C 0)

The reward transport identity. If each stage's transition matrix intertwines with the corrected matrix of the previous stage, C (l + 1) * P l = P l * (C l - E l + E l * C l), then C l * Pc l = Pc l - B l * (1 - C 0) for the cumulative projection Pc and the transported reward matrix B [OpenAI2026LogSpace, Proposition 4.7].

theorem Matrix.rewardTransport_mulVec {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {C E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] (h : ∀ (l : ℕ), C (l + 1) * P l = P l * (C l - E l + E l * C l)) {p e : V 0 → R} (hp : (1 - C 0).mulVec p = e) (l : ℕ) :

The transported reward. If p solves (1 - C 0) p = e, the stage-l reward is B l e = Pc l p - C l (Pc l p): the projected solution minus what the remaining transitions still carry [OpenAI2026LogSpace, Proposition 4.7].

theorem Matrix.rewardTransport_succ_mulVec {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Semiring R] (e : V 0 → R) (l : ℕ) :
(rewardTransport P E (l + 1)).mulVec e = (P l).mulVec ((rewardTransport P E l).mulVec e + (E l).mulVec ((rewardTransport P E l).mulVec e))

The stage rewards are updated by adding the correction's contribution and projecting: W (l + 1) = P l (W l + E l W l).

theorem Matrix.copyProjection_mulVec_primary {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Semiring R] {z : (l : ℕ) → V l} (hz : ∀ (l : ℕ) (w : V l), P l (z (l + 1)) w = if w = z l then 1 else 0) (p : V 0 → R) (l : ℕ) :
(copyProjection P l).mulVec p (z l) = p (z 0)

Along primary copies z l, whose rows of P l are unit vectors, the cumulative projection reads off the original coordinate.

theorem Matrix.copyProjection_nonneg {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (l : ℕ) (i : V l) (j : V 0) :
theorem Matrix.copyProjection_mulVec_one_le {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hP1 : ∀ (l : ℕ), (P l).mulVec 1 ≤ 1) (l : ℕ) :

The cumulative projection of substochastic projections is substochastic.

theorem Matrix.rewardTransport_nonneg {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hE : ∀ (l : ℕ) (i j : V l), 0 ≤ E l i j) (l : ℕ) (i : V l) (j : V 0) :
0 ≤ rewardTransport P E l i j
theorem Matrix.rewardTransport_mulVec_nonneg {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hE : ∀ (l : ℕ) (i j : V l), 0 ≤ E l i j) {e : V 0 → R} (he : 0 ≤ e) (l : ℕ) :

The stage rewards are nonnegative when the projections, the corrections and the initial reward are [OpenAI2026LogSpace, Proposition 4.7].

theorem Matrix.rewardTransport_mulVec_le {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {C E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hP1 : ∀ (l : ℕ), (P l).mulVec 1 ≤ 1) (hC : ∀ (l : ℕ) (i j : V l), 0 ≤ C l i j) (hstep : ∀ (l : ℕ), C (l + 1) * P l = P l * (C l - E l + E l * C l)) {p e : V 0 → R} (hp : (1 - C 0).mulVec p = e) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (l : ℕ) :

The stage rewards are bounded by the projected solution, hence by one. For the lower bound see Matrix.rewardTransport_mulVec_nonneg.

theorem Matrix.sub_rewardTransport_mulVec_mem_Icc {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {C E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hP1 : ∀ (l : ℕ), (P l).mulVec 1 ≤ 1) (hC : ∀ (l : ℕ) (i j : V l), 0 ≤ C l i j) (hstep : ∀ (l : ℕ), C (l + 1) * P l = P l * (C l - E l + E l * C l)) {p e : V 0 → R} (hp : (1 - C 0).mulVec p = e) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {z : (l : ℕ) → V l} (hz : ∀ (l : ℕ) (w : V l), P l (z (l + 1)) w = if w = z l then 1 else 0) (l : ℕ) :
p (z 0) - (rewardTransport P E l).mulVec e (z l) ∈ Set.Icc 0 (∑ y : V l, C l (z l) y)

The stage error. Along primary copies z l, the stage-l reward underestimates the solution at z 0 by at most the row sum of C l at z l [OpenAI2026LogSpace, Proposition 4.7].

theorem Matrix.sub_rewardTransport_mulVec_le_card_mul {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {C E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Ring R] [PartialOrder R] [IsOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hP1 : ∀ (l : ℕ), (P l).mulVec 1 ≤ 1) (hC : ∀ (l : ℕ) (i j : V l), 0 ≤ C l i j) (hstep : ∀ (l : ℕ), C (l + 1) * P l = P l * (C l - E l + E l * C l)) {p e : V 0 → R} (hp : (1 - C 0).mulVec p = e) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {z : (l : ℕ) → V l} (hz : ∀ (l : ℕ) (w : V l), P l (z (l + 1)) w = if w = z l then 1 else 0) (l : ℕ) {ε : R} (hε : ∀ (x y : V l), C l x y ≤ ε) {A : Finset (V l)} (hA : ∀ (x y : V l), C l x y ≠ 0 → y ∈ A) :
p (z 0) - (rewardTransport P E l).mulVec e (z l) ≤ A.card • ε

The stage error, by counting. If the entries of C l are at most ε and its nonzero columns lie in A, the stage-l reward along primary copies underestimates the solution by at most |A| ε.

theorem Matrix.sub_rewardTransport_mulVec_le_pow {V : ℕ → Type u_1} [(l : ℕ) → Fintype (V l)] [(l : ℕ) → DecidableEq (V l)] {R : Type u_2} {C E : (l : ℕ) → Matrix (V l) (V l) R} {P : (l : ℕ) → Matrix (V (l + 1)) (V l) R} [Field R] [LinearOrder R] [IsStrictOrderedRing R] (hP : ∀ (l : ℕ) (i : V (l + 1)) (j : V l), 0 ≤ P l i j) (hP1 : ∀ (l : ℕ), (P l).mulVec 1 ≤ 1) (hC : ∀ (l : ℕ) (i j : V l), 0 ≤ C l i j) (hstep : ∀ (l : ℕ), C (l + 1) * P l = P l * (C l - E l + E l * C l)) {p e : V 0 → R} (hp : (1 - C 0).mulVec p = e) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {z : (l : ℕ) → V l} (hz : ∀ (l : ℕ) (w : V l), P l (z (l + 1)) w = if w = z l then 1 else 0) {c n : ℕ} (hε : ∀ (l : ℕ) (x y : V l), C l x y ≤ (2 ^ (c + 1))⁻¹ ^ l) (A : (l : ℕ) → Finset (V l)) (hA : ∀ (l : ℕ) (x y : V l), C l x y ≠ 0 → y ∈ A l) (hAn : ∀ (l : ℕ), (A l).card ≤ 2 ^ l * n) (l : ℕ) :
0 ≤ p (z 0) - (rewardTransport P E l).mulVec e (z l) ∧ p (z 0) - (rewardTransport P E l).mulVec e (z l) ≤ ↑n * (2 ^ c)⁻¹ ^ l

The stage bound. If the entries of C l are at most (2 ^ (c + 1))⁻¹ ^ l and its nonzero columns lie in a set of at most 2 ^ l * n vertices, then along primary copies 0 ≤ p (z 0) - W l (z l) ≤ n * (2 ^ c)⁻¹ ^ l. With n the number of vertices of stage 0, this is the preprint's bound |V₀| 2 ^ (-(H - 1) l) for H = c + 1 [OpenAI2026LogSpace, Proposition 4.7].