Documentation

CslibFrontier.Algorithms.WordRAM.ThreeSum.Host.Slow

A finite exhaustive native Exact Triangle callee #

This reference implementation enumerates the actual triples, loads all three encoded matrix weights, and compares the sums of their positive and negative magnitudes. No solver instruction, host execution premise or precomputed verdict occurs in its code. It is library code because its certification witnesses that Host.Callee can be satisfied by a concrete finite program.

Main definitions #

This exhaustive native implementation and its certification are original.

@[reducible, inline]

Raw number of vertices per part.

@[reducible, inline]

AB matrix pointer.

@[reducible, inline]

BC matrix pointer.

@[reducible, inline]

AC matrix pointer.

@[reducible, inline]

The free-pointer argument is overwritten by zero after entry.

@[reducible, inline]

Raw Boolean return value.

@[reducible, inline]

Next flattened triple.

@[reducible, inline]

Number of cells per matrix.

@[reducible, inline]

Number of triples.

@[reducible, inline]

Loop increment.

@[reducible, inline]

Sign-and-magnitude radix.

@[reducible, inline]

First vertex index.

@[reducible, inline]

Second vertex index.

@[reducible, inline]

Third vertex index.

@[reducible, inline]

Actual matrix-load address.

The three actual loaded edge words.

@[reducible, inline]

Sum of positive magnitudes.

@[reducible, inline]

Sum of negative magnitudes.

@[reducible, inline]

Magnitude of the current encoded edge.

@[reducible, inline]

Sign bit of the current encoded edge.

@[reducible, inline]

Flattened second and third vertex indices.

Add one encoded edge to its positive or negative magnitude sum.

Compute three indices and load the three corresponding matrix cells.

Retain a found zero-weight triangle and advance to the next triple.

Initialize every scratch value used before the first triple.

Exhaust all t³ triples using native division/remainder and actual matrix loads.

theorem Cslib.Algorithms.WordRAM.ThreeSum.Host.Slow.exec_at {w t F abp bcp acp free : ℕ} (A B C : Fin t → Fin t → ℤ) (x : WordRAM.Data 24) (ht : x.regs side = t) (hab : x.regs ab = abp) (hbc : x.regs bc = bcp) (hac : x.regs ac = acp) (hAB : abp + t * t ≤ free) (hBC : bcp + t * t ≤ free) (hAC : acp + t * t ≤ free) (hfit : WordRAM.Fits w (free + t * (t * t) + 6 * F + 10)) (hmA : ∀ (i j : Fin t), x.mem (abp + ↑i * t + ↑j) = WordRAM.Signed.encode (A i j)) (hmB : ∀ (i j : Fin t), x.mem (bcp + ↑i * t + ↑j) = WordRAM.Signed.encode (B i j)) (hmC : ∀ (i j : Fin t), x.mem (acp + ↑i * t + ↑j) = WordRAM.Signed.encode (C i j)) (hA : ∀ (i j : Fin t), |A i j| ≤ ↑F) (hB : ∀ (i j : Fin t), |B i j| ≤ ↑F) (hC : ∀ (i j : Fin t), |C i j| ≤ ↑F) :
∃ (y : WordRAM.Data 24), WordRAM.ExecWithin w program x y (39 * (t * (t * t)) + 9) ∧ y.regs out ≤ 1 ∧ (y.regs out = 1 ↔ ExactTriangle.HasZeroTriangle A B C) ∧ y.mem = x.mem

Execute the real exhaustive block from arbitrary old registers and memory. Source spans may alias: each only needs to end below the supplied address bound. Every memory cell survives, including dirty scratch. Empty input returns zero through the actual zero-iteration loop.

Actual finite cubic-time solver used to inhabit the complete host's callee contract. It preserves all memory, works on arbitrary signed matrices, and never reads physical width.