Documentation

CslibFrontier.Algorithms.WordRAM.ThreeSum.ChanHe.TraversalConstruct

Charged Chan–He node construction before publication #

The two complete native kernels construct the actual modulus, heavy lists and packed node. This boundary exposes their readback and prefix frame before any output-pointer table store, so catalogue delivery and an in-place solver visitor share the same kernel execution proof.

Main results #

This is an original composition of the existing native kernels. It supplies no runtime advice and makes no claim about a complete traversal, initialized input or solver callback.

Both complete native kernels and every argument instruction, before output publication. The final state retains actual heavy/packed readback and can instead enter a solver callback.

theorem Cslib.Algorithms.WordRAM.ThreeSum.ChanHe.Traversal.construct_exec {w : ℕ} (x : WordRAM.Data 128) (values : Fin 3 → ℕ → ℤ) (hm : 2 ≤ x.regs limit) (hmod : GenericRAM.Signed.Fits w ↑(x.regs limit ^ 2)) (hbudget : WordRAM.Fits (w + 2) (Modulus.budget (WordRAM.Data.comap kernel (modulusState x)))) (hnode : ∀ (M : ℕ), 1 ≤ M → M ≤ x.regs limit ^ 2 → GenericRAM.Signed.Fits w ↑(recordLayout x M).budget) (hN : 2 * x.regs limit ^ 2 ≤ x.regs groups) (hcard : x.regs primeCount = (x.regs limit).primesLE.card) (hbefore : x.regs bitmap + x.regs limit < x.regs heap) (hbitmap : ∀ q ≤ x.regs limit, x.mem (x.regs bitmap + q) = if Nat.Prime q then 1 else 0) (hvalues : ∀ (j : Fin 3), ∀ i < x.regs (arrayLength j), GenericRAM.Signed.Fits w (values j i)) (hbdd : ∀ (j : Fin 3), ∀ i < x.regs (arrayLength j), (values j i).natAbs ≤ x.regs magnitude) (hsrc : ∀ (j : Fin 3), x.regs (arraySource j) + x.regs (arrayLength j) ≤ x.regs heap) (hinput : ∀ (j : Fin 3), ∀ i < x.regs (arrayLength j), x.mem (x.regs (arraySource j) + i) = WordRAM.Signed.encode (values j i)) (hinj : ∀ (j : Fin 3), Set.InjOn (values j) ↑(Finset.range (x.regs (arrayLength j)))) :
∃ (M : ℕ) (u : WordRAM.Data 128) (b : WordRAM.Data 128), WordRAM.ExecWithin (w + 2) construct x b (Modulus.cost (WordRAM.Data.comap kernel (modulusState x)) + 66 * (recordLayout x M).total + 15 * M + 12 * x.regs groups + 253) ∧ (∀ (i : Fin 128), 64 ≤ ↑i → i ≠ selected → u.regs i = x.regs i) ∧ u.regs selected = M ∧ (∀ p < x.regs heap, u.mem p = x.mem p) ∧ NodePacking.Output (recordLayout x M) values u.mem b.mem ∧ (∀ (i : Fin 128), 64 ≤ ↑i → b.regs i = u.regs i) ∧ 1 ≤ M ∧ M ≤ x.regs limit ^ 2 ∧ M = ThreeSum.ChanHe.modulus (x.regs limit).primesLE (x.regs digits) (Finset.image (values 0) (Finset.range (x.regs (arrayLength 0)))) (Finset.image (values 1) (Finset.range (x.regs (arrayLength 1)))) (Finset.image (values 2) (Finset.range (x.regs (arrayLength 2))))

Execute the complete modulus and node builders without publishing a catalogue pointer. Both intermediate states are reached by charged native instructions.