Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.TimeLayer

Time layers and terminal rewards #

Matrix.timeLayer T P places a copy of P between each pair of consecutive clock layers 0, …, T. All other entries vanish, including the final rows. The lexicographic order makes this matrix strictly upper triangular, even when P itself has cycles or absorbing states. The reward e is paid only at time T. Its potential at (i,x) is exactly (P ^ (T - i) *ᵥ e) x, which solves the actual clocked linear system. Nonnegative substochastic P and rewards in [0,1] give a potential in [0,1] at every clocked state.

This is the matrix construction in [OpenAI2026LogSpace, Lemma 2.1], using the terminal-reward convention of its proof. It does not enumerate configurations or assert a resource bound for accessing the matrix. The machine and local-count specialization is in Classes.LogSpace.Randomized.TimeLayer.

Main definitions #

Main results #

References #

def Matrix.timeLayer {V : Type u_1} {R : Type u_2} [Zero R] (T : ℕ) (P : Matrix V V R) :
Matrix (Lex (Fin (T + 1) × V)) (Lex (Fin (T + 1) × V)) R

Place P between consecutive clock layers, with no outgoing edge from the last layer.

def Matrix.timeLayerReward {V : Type u_1} {R : Type u_2} [Zero R] (T : ℕ) (e : V → R) :
Lex (Fin (T + 1) × V) → R

Pay the original reward only at the final clock layer.

def Matrix.timeLayerPotential {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [Semiring R] (T : ℕ) (P : Matrix V V R) (e : V → R) :
Lex (Fin (T + 1) × V) → R

The value at a clocked state after its actual remaining number of transitions.

theorem Matrix.card_timeLayer {V : Type u_1} [Fintype V] (T : ℕ) :
Fintype.card (Lex (Fin (T + 1) × V)) = (T + 1) * Fintype.card V

Clocking multiplies the number of states by exactly T + 1.

theorem Matrix.timeLayer_isStrictUpperTriangular {V : Type u_1} {R : Type u_2} [LT V] [Zero R] (T : ℕ) (P : Matrix V V R) :

The clock alone supplies strict forwardness; no acyclicity of P is needed.

theorem Matrix.timeLayer_last {V : Type u_1} {R : Type u_2} [Zero R] (T : ℕ) (P : Matrix V V R) (x : V) (b : Lex (Fin (T + 1) × V)) :

Every terminal row is zero, including when the horizon is zero.

theorem Matrix.timeLayer_mulVec {V : Type u_1} {R : Type u_2} [Fintype V] [Semiring R] (T : ℕ) (P : Matrix V V R) (v : Lex (Fin (T + 1) × V) → R) (i : Fin (T + 1)) (x : V) :
(timeLayer T P).mulVec v (toLex (i, x)) = if h : ↑i < T then P.mulVec (fun (y : V) => v (toLex (⟨↑i + 1, ⋯⟩, y))) x else 0

A clocked row applies P to the next slice; at the horizon it vanishes.

theorem Matrix.timeLayer_nonneg {V : Type u_1} {R : Type u_2} [Zero R] [Preorder R] {P : Matrix V V R} (hP : ∀ (x y : V), 0 ≤ P x y) (T : ℕ) (a b : Lex (Fin (T + 1) × V)) :
0 ≤ timeLayer T P a b

Nonnegative entries remain nonnegative after clocking.

theorem Matrix.timeLayer_mulVec_one_le {V : Type u_1} {R : Type u_2} [Fintype V] [Semiring R] [PartialOrder R] [IsOrderedRing R] {P : Matrix V V R} (hP : P.mulVec 1 ≤ 1) (T : ℕ) :
(timeLayer T P).mulVec 1 ≤ 1

Clocking preserves the substochastic row bound, with zero terminal rows.

theorem Matrix.pow_mulVec_mem_Icc {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [Semiring R] [PartialOrder R] [IsOrderedRing R] {P : Matrix V V R} {e : V → R} (hP0 : ∀ (x y : V), 0 ≤ P x y) (hP1 : P.mulVec 1 ≤ 1) (he : e ∈ Set.Icc 0 1) (t : ℕ) :
(P ^ t).mulVec e ∈ Set.Icc 0 1

A substochastic matrix preserves [0,1] under every finite power.

theorem Matrix.timeLayerPotential_mem_Icc {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [Semiring R] [PartialOrder R] [IsOrderedRing R] {P : Matrix V V R} {e : V → R} (hP0 : ∀ (x y : V), 0 ≤ P x y) (hP1 : P.mulVec 1 ≤ 1) (he : e ∈ Set.Icc 0 1) (T : ℕ) :

The actual remaining-time potential lies in [0,1] at every clocked state.

theorem Matrix.timeLayerPotential_zero {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [Semiring R] (T : ℕ) (P : Matrix V V R) (e : V → R) (x : V) :
timeLayerPotential T P e (toLex (0, x)) = (P ^ T).mulVec e x

At clock zero, the potential is the original T-step terminal expectation.

theorem Matrix.one_sub_timeLayer_mulVec {V : Type u_1} {R : Type u_2} [Fintype V] [DecidableEq V] [Ring R] (T : ℕ) (P : Matrix V V R) (e : V → R) :

The clocked potential solves the actual linear system, with reward only at final time.

theorem Matrix.det_one_sub_timeLayer {V : Type u_1} {R : Type u_2} [Fintype V] [LinearOrder V] [CommRing R] (T : ℕ) (P : Matrix V V R) :
(1 - timeLayer T P).det = 1

The clocked linear system has determinant one over any commutative ring.

theorem Matrix.inv_one_sub_timeLayer_mulVec {V : Type u_1} {R : Type u_2} [Fintype V] [LinearOrder V] [CommRing R] (T : ℕ) (P : Matrix V V R) (e : V → R) :

The inverse expression equals the explicitly constructed remaining-time potential.