Documentation

CslibFrontier.Computability.WordRAM.OutputLowerBound

Output-size lower bounds for native word-RAM runs #

Every changed memory cell costs a store instruction. The statements count changed cells rather than output length alone: returning the initialized input is free apart from the halt. In particular, materializing the all-one n × n matrix from an all-zero input costs at least n² continuing instructions, and returning a nonzero constant list from an all-zero input costs at least its length plus the halt. These are instruction-count bounds in the existing native memory-output model.

Main results #

theorem Cslib.WordRAM.Runs.card_changed_le {B : Basis} {r w n : ℕ} {p : Program B r} {s t : State r} (h : Runs w p s t n) (S : Finset ℕ) (hchange : ∀ a ∈ S, t.data.mem a ≠ s.data.mem a) :
S.card ≤ n

Each distinct cell whose value changes requires its own store instruction.

theorem Cslib.WordRAM.Runs.block_lowerBound {B : Basis} {r w n : ℕ} {p : Program B r} {s t : State r} (h : Runs w p s t n) (b : Block) (hchange : ∀ (i : Fin b.length), t.data.mem (b.base + ↑i) ≠ s.data.mem (b.base + ↑i)) :

A dense output block costs at least one store per changed entry.

theorem Cslib.WordRAM.Data.init_replicate_zero_mem {r m a : ℕ} (ha : 0 < a) :
(init (List.replicate m 0)).mem a = 0

Every positive-address cell of a zero-word input starts at zero, regardless of input length.

theorem Cslib.WordRAM.ExecutesList.replicate_lowerBound {B : Basis} {r w m k n v : ℕ} {p : Program B r} (h : ExecutesList w p (State.init (List.replicate m 0)) (List.replicate k v) n) (hv : v ≠ 0) :
k + 1 ≤ n

Returning a nonzero constant list from a zero-word input must materialize every entry. The output pointer is unrestricted; its entries all lie at positive addresses, so none can reuse the input-length header. The output-length header may require an additional store.

theorem Cslib.WordRAM.ExecutesList.denseMatrix_lowerBound {B : Basis} {r w m n steps : ℕ} {p : Program B r} (h : ExecutesList w p (State.init (List.replicate m 0)) (List.replicate (n * n) 1) steps) :
n * n + 1 ≤ steps

Materializing the row-major all-one n × n matrix from initialized zero data has the quadratic output-size barrier, even if the machine chooses its own output address.