Documentation

Complexity.Algorithms.WordRAM.ThreeSum.Frontend.Arrays

Native frontend array and descriptor execution #

Main results #

The compact scan contract is composed with every array setup and descriptor store.

Local arithmetic budget covers array addresses, native labels and loop setup.

Instances For

    The hypotheses of a concrete compact scan, before choosing its bit coordinates and mode.

    Instances For

      Parameters changed by split/mode setup.

      Instances For

        A mode/bit setup preserves every actual scan precondition.

        theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.Arrays.pick_exec {w U Λ j : ℕ} (x : WordRAM.Data 48) (rs : List (ℕ × ℕ)) (h : ScanReady w rs x) (hU : x.regs Select.magnitude = U) (hΛ : x.regs digits = Λ) (hs : x.regs splits = 2 * Λ ^ 2) (ht : x.regs triple = j / 3) (hslot : x.regs slot = j % 3) (hjfit : WordRAM.Fits w j) :
        ∃ (y : WordRAM.Data 48), WordRAM.ExecWithin w pick x y (43 * rs.length + 20) ∧ WordRAM.Block.HoldsList (x.regs Scan.dst) (Math.array U Λ rs j) y.mem ∧ y.regs Scan.out = (Math.array U Λ rs j).length ∧ WordRAM.Modifies { base := x.regs Scan.dst, length := rs.length + 1 }.footprint x.mem y.mem

        Select exactly the array named by one physical slot. Every split/multiplicity setup is executed; the width and label budget are scalar runtime values, independent of code size.

        theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.Arrays.body_exec {w U Λ j : ℕ} (x : WordRAM.Data 48) (rs : List (ℕ × ℕ)) (hready : ScanReady w rs (x.set Scan.dst (x.regs heap))) (hU : x.regs Select.magnitude = U) (hΛ : x.regs digits = Λ) (hs : x.regs splits = 2 * Λ ^ 2) (hj : x.regs current = j) (hcap : rs.length + 1 ≤ x.regs capacity) (hbefore : x.regs descriptors + 2 * j + 2 ≤ x.regs heap) (ha : WordRAM.Fits w (x.regs descriptors + 2 * j + 2)) (hh : WordRAM.Fits w (x.regs heap + x.regs capacity)) (hi : WordRAM.Fits w (j + 1)) :
        ∃ (y : WordRAM.Data 48), WordRAM.ExecWithin w body x y (43 * rs.length + 30) ∧ y.regs current = j + 1 ∧ y.regs heap = x.regs heap + x.regs capacity ∧ y.mem (x.regs descriptors + 2 * j) = (Math.array U Λ rs j).length ∧ y.mem (x.regs descriptors + 2 * j + 1) = x.regs heap ∧ WordRAM.Block.HoldsList (x.regs heap) (Math.array U Λ rs j) y.mem ∧ ∀ (a : ℕ), a < x.regs heap ∨ x.regs heap + x.regs capacity ≤ a → a ≠ x.regs descriptors + 2 * j → a ≠ x.regs descriptors + 2 * j + 1 → y.mem a = x.mem a

        One complete array, its exact descriptor words, allocation advance and local frame.