Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.Chunks

Native query-chunk descriptors #

For one computed query class, the program writes consecutive triples (residue, pair pointer, pair count). It computes the last chunk's shorter length and advances over the actual two-word coordinate representation. The input query list is preserved.

This adapts the chunk loop in the pinned Theorem 17 chunk builder.

Main definitions #

Main results #

@[reducible, inline]

Query pair array base.

@[reducible, inline]

Descriptor output base.

@[reducible, inline]

Actual number of query pairs.

@[reducible, inline]

Positive maximum pairs per chunk.

@[reducible, inline]

Class residue.

@[reducible, inline]

Consumed pair count.

@[reducible, inline]

Number of written chunks.

@[reducible, inline]

Constant one.

@[reducible, inline]

Number of words per descriptor.

@[reducible, inline]

Current chunk length.

@[reducible, inline]

Output address.

@[reducible, inline]

Current pair pointer.

Compute a nonempty chunk, write its descriptor and advance both counters.

Initialize all loop state with charged instructions.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.Chunks.exec {w : ℕ} (x : WordRAM.Data 14) (hcap : 0 < x.regs capacity) (hfit : WordRAM.Fits w (x.regs dst + 3 * x.regs total + 3)) (hquery : WordRAM.Fits w (x.regs queries + 2 * x.regs total)) :
∃ (y : WordRAM.Data 14), WordRAM.ExecWithin w program x y (17 * x.regs total + 7) ∧ y.regs count = x.regs total ⌈/⌉ x.regs capacity ∧ (∀ (i : Fin 14), ↑i < 5 → y.regs i = x.regs i) ∧ (∀ k < y.regs count, y.mem (x.regs dst + 3 * k) = x.regs residue ∧ y.mem (x.regs dst + 3 * k + 1) = x.regs queries + 2 * (k * x.regs capacity) ∧ y.mem (x.regs dst + 3 * k + 2) = min (x.regs capacity) (x.regs total - k * x.regs capacity)) ∧ ∀ (a : ℕ), ¬(x.regs dst ≤ a ∧ a < x.regs dst + 3 * y.regs count) → y.mem a = x.mem a

Write the exact nonempty chunks of one class. Descriptor k names the query slice beginning at pair k * capacity, with its final length truncated to the class size. All other memory is preserved, so placing the query array outside the descriptor block preserves its coordinates. The final halt is excluded from the 17 total + 7 bound.