Skip to content

About

A loop-plus-verifier agent framework with a pluggable generator. Verifies candidate answers for closed-form and witness math problems and refuses false positives. Bring your own generator (Ollama example included).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

loopverify

A loop-plus-verifier agent framework with a pluggable generator. The three parts of a generate-and-verify agent are a generator (proposes candidates), a verifier (checks them), and a controller (loops between them). loopverify ships the verifier and the controller as a disciplined harness, and a pluggable generator interface so you can drop in any candidate source — an LLM (a worked Ollama example is included), a hand-written heuristic, a search, or a hosted API.

The genuinely scarce, valuable part is verification that refuses false positives; the solving/enumeration tools already exist and are widely used. loopverify packages the disciplined-verification half and makes it work across many classes of problem, behind one harness — then lets you plug a generator in front to form a complete agent.

The idea

A loop proposes candidate answers; a checker keeps only what passes. That pattern is well known (PSLQ constant-recognition in mpmath/PARI/Sage, AlphaEvolve, proof-search agents). The hard, under-served part is not the loop — it is refusing the false positive: a candidate that passes a check it should not have, and a false negative: a null reported as if it proved nonexistence. This framework enforces a discipline that handles both, for any verifier.

One harness, pluggable verifiers, many problem classes

                 ┌───────────────────────────────────────┐
                 │  harness — enforces the discipline      │
                 │  propose → check → INDEPENDENT confirm   │
                 │  pre-registered acceptance · honest      │
                 │  nulls (budget vs exhaustion) ·          │
                 │  CANDIDATE ≠ SOLVED · sha256 manifests   │
                 └──────────────┬────────────────────────┘
                                │  Adapter protocol
        ┌───────────────────────┴───────────────────────┐
        │                                               │
   PSLQ adapter                              Witness adapter (generic)
   closed-form / integer relation            construction vs. exact predicate
        │                                               │
   Class A: problems 1–5                     Class B: problems 6–10
   thermal boson, Airy a₆/a₇,                sum of three cubes, Hadamard,
   Boyd entries, T₃, spinor                  kissing, Ramsey, magic square

Adding a new problem class means writing one adapter (or, for a witness problem, just a predicate). The harness's guarantees apply unchanged.

As a complete agent (pluggable generator)

The harness runs the full three-part loop when you give it a generator:

python -m loopverify agent      # generator -> verifier -> controller, three generators

The demo runs the SAME disciplined harness with three interchangeable generators:

generator needs a model? result on x^3+y^3+z^3 = 29
EnumeratorGenerator no CANDIDATE (found & confirmed)
CallableGenerator (heuristic) no CANDIDATE (found & confirmed)
OllamaWitnessGenerator (local LLM) yes (else honest null) model-dependent

Where the difficulty lives — read before expecting an LLM to solve anything. The generator is the scarce, insight-bound half. Verifying is cheap; proposing the right basis or construction is hard. A small local model over a hard problem will mostly produce candidates the verifier honestly rejects — an honest null, not a solve. That is the framework working as intended: it refuses to let a weak generator manufacture a false positive. Swap in a stronger generator to move the needle; the discipline layer does not change.

Using the Ollama example

Nothing is bundled — Ollama runs on your machine:

# 1. install Ollama:   https://ollama.com/download
# 2. pull a model:     ollama pull llama3.1
# 3. it serves at      http://localhost:11434
python -m loopverify agent

If Ollama is not running, the Ollama generator yields no candidates and the harness records an honest null — it does not crash or fabricate.

Plugging in your own generator

See GENERATORS.md for a full, copy-pasteable guide covering all four generator types — a hand-written heuristic, a custom Generator subclass, a hosted model API (Claude/GPT), and the local-Ollama example — with the exact interface and the candidate shapes for both problem classes. In short: implement Generator.propose(problem, n) -> iterator of candidates (or wrap a function with CallableGenerator), yield candidates in the shape the problem's verifier expects, and yield nothing when your generator can't help — the harness records an honest null rather than fabricating anything.

Coverage of the ten candidate problems

# problem class / verifier lane status
1 thermal boson J_B A · PSLQ digit match pending input (integral)
2 higher Airy moments a₆,a₇ A · certificate battery pending input (pipeline)
3 Boyd Mahler-measure entries A · m(P) vs L′(E,0) pending input (targets)
4 T₃ cube torsion constant A · PSLQ + bridge identity runnable (MISS, worked example)
5 spinor norm constant A · PSLQ digit match runnable (CANDIDATE, control)
6 sum of three cubes = 114 B · x³+y³+z³=n runnable (bounded → budget MISS)
7 Hadamard matrix order 668 B · H·Hᵀ=mI verifier ready; needs generator
8 kissing number dim 11 B · pairwise angle ≥ 60° verifier ready; needs generator
9 R(5,5) lower bound on K₄₃ B · no monochromatic K₅ runnable (structured → MISS)
10 magic square of squares B · 3×3 distinct squares runnable (bounded → MISS)

The honest split (as the notes anticipated): the verifiers are ready and exact for all ten; the scarce half is the generator. Class-A lanes 4–5 are winnable at this scale (the loop is cheap, insight is the bottleneck); class-B lanes 6–10 are compute-bound searches whose bounded runs return honest nulls, with the generator flagged where a real search (lattice/SAT/optimization) is required.

It generalizes — demonstrated, not claimed

python -m loopverify demo runs the same harness over five verifier kinds:

problem verifier outcome
spinor norm constant PSLQ (integer relation) CANDIDATE
x³+y³+z³ = 29 witness (arithmetic) CANDIDATE
order-2 Hadamard witness (matrix identity) CANDIDATE
exact 2-D kissing witness (inner products) CANDIDATE
R(3,3) > 5 coloring witness (clique-free) CANDIDATE

Five verification shapes, one discipline. Each is a positive control: the predicate accepts a genuine witness and the harness independently confirms it.

The discipline (identical for every adapter)

  • check → confirm. A candidate is CANDIDATE only if it passes a discovery check and survives an independent re-confirmation. For PSLQ that means re-deriving the relation at higher precision and demanding the same coefficients (re-measuring is not enough — a fit keeps a small residual; only re-derivation exposes it). For a witness it means re-running the exact predicate from scratch.
  • Pass-then-fail = F8. A candidate that passes then fails confirmation is logged as a fit, not a solve.
  • Honest nulls. A MISS records why it stopped — generator exhausted vs candidate budget reached — so a null is never mistaken for a proof of nonexistence.
  • CANDIDATE ≠ SOLVED. Promotion needs separate, externally-supplied corroboration (a proof, a second method), recorded explicitly. One green light is never enough.
  • Every finding — pass or fail — is written under runs/<lane>/ with a MANIFEST.sha256.

Worked example: T₃ — a caught false positive

t3_cube_torsion is wired with certified definitions of the open constant H = A* − 2B*. At ~35 digits PSLQ returns a "relation" with large coefficients — the F8 trap. The gate re-derives at 80 digits, it does not reproduce, and the result is an honest MISS. (An earlier gate that re-measured instead of re-deriving wrongly called this a candidate — the exact failure this framework prevents. Fixed, tested, shipped as the worked example.)

python -m loopverify list                 # all ten lanes, both classes, + status
python -m loopverify run t3_cube_torsion  # class-A live lane (MISS)
python -m loopverify run all              # every lane, honest summary
python -m loopverify demo                 # one harness, five verifier kinds
python tests/test_verifier.py             # the discipline as executable tests

What this is, and is not

  • Is: a reusable, verifier-agnostic discipline layer with two working adapter classes covering closed-form recognition and witness/construction problems, so passes are trustworthy and nulls are honest.
  • Is not: a general solver. The generator (proposing good candidates) is the scarce, insight-bound half and is left to the adapter/user. A null means "not found under these settings," never "impossible."
  • Complements mpmath pslq/identify, PARI lindep/algdep, Sage, Mathematica — those find; this disciplines the check and makes the result auditable.

Install

pip install -e .        # or: pip install mpmath and run from source

Python ≥ 3.9, mpmath.

License

Apache-2.0. © 2026 Shannon Bohle / Archivopedia LLC. See the LICENSE file for the full text.

About

A loop-plus-verifier agent framework with a pluggable generator. Verifies candidate answers for closed-form and witness math problems and refuses false positives. Bring your own generator (Ollama example included).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages