Documentation

Complexity.Computability.Ram.Compiler.Language.Buffer.Ragged.Nested.Ready

Readiness of defaulted nested ragged-array reads #

The real bounds check selects either allocating extraction or the unchanged fallback. In bounds, only the selected row's boundaries and final sentinel are allocated; out of bounds, neither the fallback nor its cells are copied. The mathematical result and old aliases refer to the actual final heap.

Retained boundary cells of a defaulted nested-row read. Even an empty valid row reserves its sentinel; an invalid index reserves nothing.

Equations
Instances For
    theorem Ram.LanguageCompiler.Buffer.Ragged.Nested.getNat_arenaMeasured {w heapLimit cursor : ℕ} (positive : 0 < w) (rows : Array (Array (Array ℕ))) (index : ℕ) (fallback : Array (Array ℕ)) (storage : Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) (defaultView : Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) (heap : Complexity.Language.Heap) (observed : (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.nat).raggedArrayOf.Rel rows storage heap) (defaultObserved : (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.nat).Rel fallback defaultView heap) (rowsFit : rows.size + 1 < 2 ^ w) (innerFit : rows.flatten.size + 1 < 2 ^ w) (payloadFit : rows.flatten.flatten.size < 2 ^ w) (indexFits : index < 2 ^ w) (defaultFits : ValueFits w defaultView) (capacity : cursor + getReserve rows index ≤ heapLimit) :

    Measure the actual natural-row read. All array sizes and the selected index fit the word width; no bound on unread natural payload values is assumed.

    theorem Ram.LanguageCompiler.Buffer.Ragged.Nested.getBool_arenaMeasured {w heapLimit cursor : ℕ} (positive : 0 < w) (rows : Array (Array (Array Bool))) (index : ℕ) (fallback : Array (Array Bool)) (storage : Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) (defaultView : Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) (heap : Complexity.Language.Heap) (observed : (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.bool).raggedArrayOf.Rel rows storage heap) (defaultObserved : (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.bool).Rel fallback defaultView heap) (rowsFit : rows.size + 1 < 2 ^ w) (innerFit : rows.flatten.size + 1 < 2 ^ w) (payloadFit : rows.flatten.flatten.size < 2 ^ w) (indexFits : index < 2 ^ w) (defaultFits : ValueFits w defaultView) (capacity : cursor + getReserve rows index ≤ heapLimit) :

    Measure the actual Boolean-row read. All array sizes and the selected index fit the word width; no bound on unread Boolean payload values is assumed.

    theorem Ram.LanguageCompiler.Buffer.Ragged.Nested.getNat_arenaResources {w : ℕ} (positive : 0 < w) (rows : Array (Array (Array ℕ))) (fallback : Array (Array ℕ)) (heapLimit : ℕ) :
    FunctionArenaResources Complexity.Language.Buffer.Ragged.Nested.program (Complexity.Language.Buffer.Ragged.Nested.program.body Complexity.Language.Buffer.Ragged.Nested.getNatId) (fun (args : (Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) × ℕ × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) => Complexity.Language.Buffer.Ragged.Nested.getNat_args args.1 args.2.1 args.2.2) (fun (args : (Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) × ℕ × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) (heap : Complexity.Language.Heap) => (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.nat).raggedArrayOf.Rel rows args.1 heap ∧ (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.nat).Rel fallback args.2.2 heap) w heapLimit 3 fun (args : (Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) × ℕ × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat) => getReserve rows args.2.1

    Reuse the measured natural-row read as an indexed resource contract. Argument ranges come from the caller; the reserve depends on the selected row, never on the fallback's contents or length.

    theorem Ram.LanguageCompiler.Buffer.Ragged.Nested.getBool_arenaResources {w : ℕ} (positive : 0 < w) (rows : Array (Array (Array Bool))) (fallback : Array (Array Bool)) (heapLimit : ℕ) :
    FunctionArenaResources Complexity.Language.Buffer.Ragged.Nested.program (Complexity.Language.Buffer.Ragged.Nested.program.body Complexity.Language.Buffer.Ragged.Nested.getBoolId) (fun (args : (Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) × ℕ × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) => Complexity.Language.Buffer.Ragged.Nested.getBool_args args.1 args.2.1 args.2.2) (fun (args : (Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) × ℕ × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) (heap : Complexity.Language.Heap) => (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.bool).raggedArrayOf.Rel rows args.1 heap ∧ (Complexity.Language.Representation.raggedArray Complexity.Language.CellTy.bool).Rel fallback args.2.2 heap) w heapLimit 3 fun (args : (Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) × ℕ × Complexity.Language.Buffer Complexity.Language.CellTy.nat × Complexity.Language.Buffer Complexity.Language.CellTy.bool) => getReserve rows args.2.1

    Reuse the measured Boolean-row read as an indexed resource contract. Argument ranges come from the caller; the reserve depends on the selected row, never on the fallback's contents or length.