Documentation

CslibFrontier.Algorithms.WordRAM.ThreeSum.Host.Prepare

Preparing the native Convolution-3SUM host #

The host reads the standard length header and computes a polynomial magnitude bound using the existing native parameter program. It then computes the matrix side and consecutive matrix addresses. The parameter program's additional computations are included in the instruction count.

This directly adapts the setup of Anthropic's pinned c3Body. The complete reduction must also fill every instance and invoke a concrete certified solver.

Main definitions #

Main results #

References #

@[reducible, inline]

Input length.

@[reducible, inline]

Polynomial magnitude bound.

@[reducible, inline]

Input base address.

@[reducible, inline]

AB matrix base address.

@[reducible, inline]

BC matrix base address.

@[reducible, inline]

AC matrix base address.

@[reducible, inline]

Solver workspace starts after the three matrices.

@[reducible, inline]

Number of vertices per part.

@[reducible, inline]

Current instance number.

@[reducible, inline]

Number of instances.

@[reducible, inline]

Accumulated Boolean verdict.

@[reducible, inline]

Constant one.

@[reducible, inline]

Unsigned filler magnitude.

@[reducible, inline]

Signed-encoded positive filler.

@[reducible, inline]

Number of entries per matrix.

@[reducible, inline]

Square-root argument.

@[reducible, inline]

Square-root output.

Register embedding for the existing parameter routine.

Register embedding for successive squares.

@[reducible, inline]

The mathematical side length used by the reduction.

Runtime source and caller-owned matrix workspace retained throughout the instance loop.

@[reducible, inline]

Standalone layout: input starts after header zero and matrices immediately follow it.

@[reducible, inline]

Input-length output of the parameter bank.

@[reducible, inline]

Magnitude output of the parameter bank.

Copy the two needed parameter outputs and initialize constants.

Consecutive output blocks and the two loop counters.

All initialization consists of actual native subprograms and charged register operations.

theorem Cslib.Algorithms.WordRAM.ThreeSum.Host.exec_layout_at {w N U src : ℕ} (x : WordRAM.Data 64) (hN : x.regs len = N) (hU : x.regs upper = U) (hb : x.regs base = src) (ho : x.regs one = 1) (hr : x.regs sqrtRoot = N.sqrt) (hsize : WordRAM.Fits w (N + src + 3 * (sideLength N * sideLength N))) (hfill : WordRAM.Fits w (4 * U + 2)) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin w layout x y 12 ∧ ParametersAt N U src (N + src) y ∧ y.regs inst = 0 ∧ y.regs found = 0 ∧ y.mem = x.mem

Existing layout code also supports arbitrary source placement.

theorem Cslib.Algorithms.WordRAM.ThreeSum.Host.exec_prepare {w : ℕ} (κ : ℕ) (x : WordRAM.Data 64) (hbudget : WordRAM.Fits w (ChanHe.Parameters.Math.budget (x.mem 0) ((x.mem 0 + 2) ^ κ))) (hsize : WordRAM.Fits w (x.mem 0 + 1 + 3 * (sideLength (x.mem 0) * sideLength (x.mem 0)))) (hfill : WordRAM.Fits w (4 * (x.mem 0 + 2) ^ κ + 2)) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin w (prepare κ) x y (ChanHe.Parameters.time κ (x.mem 0) ((x.mem 0 + 2) ^ κ) + 5 * (x.mem 0).sqrt + 24) ∧ Parameters (x.mem 0) ((x.mem 0 + 2) ^ κ) y ∧ y.regs inst = 0 ∧ y.regs found = 0 ∧ y.mem = x.mem

Exact initialization from the ordinary length header. The existing parameter program computes U = (N+2)^κ; its entire execution is charged, including the unused extra parameters. The additional fit premises cover matrix addresses and the encoded filler, and are independent of any solver execution contract.