Documentation

LeanPool.BrillNoetherGraphs.Utilities.Foundations.ChunkedLookup

Size-tagged lookup for certificate tables #

def List.lookupChunks {α : Type u_1} (chunks : List (ℕ × List α)) (index : ℕ) (fallback : α) :
α

Look up a global index by skipping size-tagged blocks of an existing list table.

Equations
Instances For
    theorem List.lookupChunks_eq_getD_flatMap {α : Type u_1} (chunks : List (ℕ × List α)) (hSizes : ∀ (chunk : ℕ × List α), chunk ∈ chunks → chunk.fst = chunk.snd.length) (index : ℕ) (fallback : α) :
    chunks.lookupChunks index fallback = (flatMap Prod.snd chunks).getD index fallback

    Correct size tags make block lookup agree with lookup in the concatenated table.