Issue #2573: The solver keeps a local result cache, a lemma store and per-query measurements under target/nikaia/ (ADR-270 D15)

Open and answer this issue on GitHub.

ready · opened 2026-11-21 · updated 2026-11-21 · 0 comments

Part of #1319 After #1319

What it is

The local caches and measurements of ADR-270 D15: a result cache, a lemma store and per-query measurements under target/nikaia/. They only speed the search; they are not committed and never read by a --locked build, since what a build uses is nikaia.proofs (D4, D19-D22, built: proofs_answers.nika, proofs_book.nika, --locked). The lemma store offers lemmas to the next query of the same batch, so it needs the batch entry sv_check_batch that #1319 builds. ADR-270 D8 step 4. The solver’s files are packages/logic/src/sv_*.nika (moved there in 4a48f306a).

To build

  1. Result cache (D15): the D19 key maps to the answer and its evidence, kept under target/nikaia/solver-cache/. Every hit is re-checked (D20), and an entry that does not check counts as missing. --locked (D22) never opens it. Test: a .nika test in tests/compiler/tests/ that solves, hits, corrupts one entry, and shows it searched again.
  2. Lemma store (D15): lemmas learned in one query, each with its proof step, are offered to the next query of the same batch and kept under target/nikaia/. A lemma enters a query only through its proof step, so a wrong lemma is a rejected certificate, not a wrong answer. Test: a .nika test where a second query of a batch uses a lemma of the first, and a lemma with a changed step is rejected.
  3. Measurements per query (D15): the D14 features, work counts and the engine that answered, appended per run under target/nikaia/solver-measure/. This is the input of scripts/solver.nika tune. Test: a .nika test that runs a batch and reads one line per query back.

Done when

The result cache, the lemma store and the measurements exist under target/nikaia/, each shown by its test, and a --locked build opens none of them; the commit of the last item carries Fixes #THIS.

Files

packages/logic/src/sv_*.nika, scripts/solver.nika, new tests in tests/compiler/tests/solver_*.nika. No new Rust (CLAUDE.md). Not changed: tests/compiler/nikaia.contracts, nikaia.derived.

Split from #1319 by Claude Code

Back to Open Issues