Open and answer this issue on GitHub.
wip, solver · opened 2026-11-22 · updated 2026-11-23 · 3 comments
This was found by the builder run for “bounds walk: shift, xor and heap-index arithmetic form no goal (14 solver sites)” (#1631), report docs/briefs/solver/issue-1631.md.report.md, commit 899735f2.
packages/logic/src/sv_sat.nika:806-809, pick:
let v = self.heap_pop()
... self.value[v] ...
The walk of heap_pop holds the rules index heap … and result heap_pop …, but the walk of pick does not. The trace of line 809 lists no heap rule, not even before the call, so the index into self.value stays checked.
A reduced probe of pick plus heap_pop proves, so the cause is not found yet. Possibly related: the field SvSat.value gets no length activity value rule, but the same field renamed to vvalue does, which proves 3 more sites. The suspect is a bare name value that bounds_frame.nika (the fallback in fields_mark) records as changed beside. A two-file probe did not reproduce it.
check --bounds packages/logic/src/sv_sat.nika --trace 809, then reduce sv_sat.nika step by step until the rule drops out.tests/compiler/tests/ that has a .bounds file.value/vvalue difference has the same cause. If it does not, fix it as its own commit.SvSat.value gets its length activity value rule under its own name.lower-std --bounds loses no site.Brief queued: issue-2777
agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —
Your work order is issue #2777, inlined below with its comments. There is no
brief written around it: plan your own steps from its To build list, build
them in order, commit after each finished step, and end when its Done when
holds (or at the limits of builder.md, reporting what is left). The
facts in your prompt are Core of docs/builder-facts.md; more on a topic:
nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.
Measure the issue against docs/issues.md while you work: what it lacked,
what was wrong in it. That answer goes into the report’s Issue: field.
A finding, a changed plan or a finished item also goes into the issue as a
comment (gh api repos/Nikaia-Foundation/Nikaia/issues/2777/comments -F body=@file,
ending with the Claude Code footer), rule I13.
develop in the main checkout; other agents’ uncommitted files are not yours: never touch or stage them.target/fast/nikaia run scripts/commit.nika -- REPORT (it adds exactly the report’s Files:); the driver pushes.cargo build --profile fast -p nikaia, lower-std and its fixpoint when a tools/*.nika changed, cargo fmt, cargo clippy --all-targets -- -D warnings, nikaia run scripts/pre-push.nika, the tests the issue names and the ones your change touches.CHANGELOG.md, badges and NK codes are the supervisor’s. New tests in Nikaia only: a Rust test file an older issue names is built as a tests/compiler/tests/ program, no Deviation: and no Issue: point (I9, #1671).Body:. Found: is only for what lies outside the area, cannot be fixed this run or needs a decision; the driver files it as an issue.std or the toolchain lacks stops the work, unless an ADR or Part I-III refuses it (name it): Result: blocked, Found: the gap with a probe, Needs: supervisor decision.NIKAIA_CACHE_LIMIT=2G; at the end delete your own clone’s target/ and target/release/nikaia-scratch.suspected, or does not mark (docs/issues.md I7), is a hypothesis: run the check that settles it (nikaia run scripts/where.nika -- NAME, the probe with a trace, callgrind for a cost) before you build on it (owner, 2026-11-16). Shown false: say so in Issue: as wrong I7: <what the check showed> (the driver comments it on the issue) and follow the real cause.Result: partial with what you ruled out, the probe, and the suspected file and function./home/user/Nikaia/docs/briefs/solver/issue-2777.md.report.md)Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.
Result:, Gate: (green or red <check>), Deviation:, Found: and the other fields with nothing to say hold the bare word: done, none. Anything after it reads as content.Result: done only when the issue’s Done when holds; partial with the items left otherwise.Deviation: only for an item of the issue built otherwise than written, or not built. Found: only for a defect outside your area, or one this run cannot fix: one defect per Found: line, with its probe and the output it gives, only the shapes that fail today, and the suspected file and function or cause unknown (#1695); a by-design behaviour is none (#1677). A correct program your own change refuses (a fail-closed check’s false refusal) is no Deviation: but one Found: line per shape, with its probe (#1680). Everything else goes into Body:; how you verified goes into Tests:.Issue: by docs/issues.md, How a run judges its issue: complete, or broke I<n>: ..., rules-gap: ..., wrong I<n>: ..., joined with ;; a point your own commit built gets (built) after its kind (rules-gap (built): ...), and the driver does not file it. complete is the bare word: prose after it (complete; the earlier runs ...) is filed as an improvement issue (#1931); history or a note for your own issue goes into Body: or Comment: #N <text>.done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).Generated by Claude Code
Run: issue-2777, ESCALATE claude exited with code 1
Tokens: input 152, cache read 4845930, cache write 152216, output 42223 Cost: 3.22 USD, time 1 min 48 s, turns 77
(none)
Nothing is committed and there is no report file yet. The run ended before I could read the last background cycle (relower, build, ledger check, logic package tests).
What I found so far, on the working tree:
--asserts run now finds SvSat: activity.len() == value.len().lower-std --bounds --asserts gives 6243 sites with both binaries, 0 lost and 0 gained (3244/4123 indexes, 1572/2435 operations).sv_walk.rs), where reads of row_value, atoms, holds and lit_clauses lost their checks. That is what my change proved there, but the logic tests did not finish running before the run ended.Still open: the cycle 4 results, ledgers.nika --refresh if the check is stale, cargo fmt, pre-push, the two commits (walk order: bounds_proven + bounds_walk; field handed to a function: bounds_frame + bounds_rules), the report and the disk cleanup.
pick before the heap methods whose derived preconditions its rules need. Second, after that was fixed, SvSat.value still had no candidate rule. The reason is that fields_handed falls back to a bare value when sv_simplex hands a local of unknown type to a ref-parameter function. Each check --bounds of sv_sat takes about 2 minutes, and each lower-std cycle 6–11 minutes.derived_order, held.clear() and BoundsBeside.changed live; which FnArg flag marks a mut parameter; that lower-std --bounds writes nothing; and that proved.nika takes only a path relative to the working directory.--bounds/--asserts and the before/after lower-std --bounds. Wasted: one proved.nika call on a scratchpad path, and a site diff whose regex was wrong at first.scripts/proved.nika refuses a path outside the checkout (copy the report under target/ first), and that lower-std --bounds is read-only, so the old binary can run it safely.broke I7: it did not mark the cause of 809 as traced or suspected. The walk order (callers first, so derived preconditions arrive too late for the rules) was found only by moving pick in a copy.rules-gap: it did not say that the missing value rule comes from another file of the package (sv_simplex’s handed fields).| Fact: Ledger and bounds proofs | A rule set a body starts from is fixed before callees later in derived_order add derived preconditions, so a caller’s rules may need those preconditions first. |
| Fact: Ledger and bounds proofs | fields_mark/fields_handed turn a field of a local of unknown type into a bare name in changed, which silently drops every struct’s rule over a field of that name in the whole package. |
| Fact: Core | scripts/proved.nika refuses a report path outside the working directory; copy it under target/ first. |
| Fact: Ledger and bounds proofs | Measure: target/fast/nikaia lower-std --bounds --asserts > target/x/ls.txt, then nikaia run scripts/proved.nika -- target/x/ls.txt. Measured 2026-11-23 on the working tree for #2777 over develop: 3244/4123 indexes, 1572/2435 operations, 6243 sites, about 5.5 minutes per binary. |
| Fact: Ledger and bounds proofs | Key files: bounds_proven.nika (the walk order and the second walk), bounds_frame.nika (FieldsScan, BoundsBeside) and bounds_rules.nika (rules_candidates, rules_holding). |
Generated by Claude Code
Run: issue-2777, Result: done
Tokens: input 190, cache read 6075779, cache write 176546, output 51223 Cost: 3.84 USD, time 5 min 14 s, turns 96
Result: done Files: crates/nikaia-std/src/compiler/bounds_proven.nika crates/nikaia-std/src/compiler/bounds_walk.nika crates/nikaia-std/src/compiler/bounds_frame.nika crates/nikaia-std/src/compiler/bounds_rules.nika crates/nikaia-std/src/compiler/lowered.rs crates/nikaia-std/src/compiler/lowered/bounds_proven.rs crates/nikaia-std/src/compiler/lowered/bounds_walk.rs crates/nikaia-std/src/compiler/lowered/bounds_frame.rs crates/nikaia-std/src/compiler/lowered/bounds_rules.rs crates/nikaia-std/src/compiler/lowered/logic/lowered.rs crates/nikaia-std/src/compiler/lowered/logic/lowered/sv_walk.rs packages/logic/nikaia.contracts packages/logic/nikaia.proofs packages/logic/rod/nikaia.contracts packages/logic/nikaia.proofs.d/1e816674e5fe9436890924c8258429922005f68177a476499096b122d96ecdfd packages/logic/nikaia.proofs.d/2f24f9606f1a7820eca8049900566097b8fa462a35ece93b10b1e3885dfe4383 packages/logic/nikaia.proofs.d/3929b1aae4c5f0730424cb6c328c7b6d76b4a000439e14682399ac536004ba14 packages/logic/nikaia.proofs.d/f999eafe7ec6aa87c35f084c44e9ea8ecaa68d65eb18d5d9cf425d4bde4180a4 tests/compiler/tests/a_caller_walked_before_its_callees_takes_the_rules_their_preconditions_hold.nika tests/compiler/tests/a_caller_walked_before_its_callees_takes_the_rules_their_preconditions_hold.bounds tests/compiler/tests/a_caller_walked_before_its_callees_takes_the_rules_their_preconditions_hold.stdout Commit: bounds walk: a body walked before its callees takes the rules their derived preconditions hold Body: Two causes. (1) Bodies are walked callers first (ADR-391 D1), so pick fixed its SvSat rules before heap_pop/heap_insert/heap_down derived the preconditions those rules need (index heap, result heap_pop): bounds_proven now records each body’s rules (BoundsProven.rules_used, by rules_key) and walks it again once at the end where derived preconditions were added since and the rules that hold now differ; what either walk proved stands. (2) fields_handed recorded a bare field into BoundsBeside.changed when it could not tell the base’s type, so sv_simplex handing had.value to the ref-parameter sv_delta_cmp dropped SvSat activity.len() == value.len(); the pair callee|field now goes into handed and counts as changed only where a package function of that name takes a mut parameter or none is declared. sv_sat 809/810 proved, pick no longer panics (ledgers refreshed), sv_walk gains proved reads. Fixes: #2777 Pushed: local 19b440f993f74cb2ba50007fcb04b46387a582e9 Tests: new test proves line 16, old binary leaves it checked (shown); sv_sat.nika 809 and 810 proved; –asserts finds SvSat activity.len() == value.len(); lower-std –bounds –asserts old vs new 6243 sites, 0 lost, 0 gained (3244/4123 indexes, 1572/2435 operations); logic package tests 54 passed; ledgers –check current after –refresh; pre-push green Gate: green Deviation: one commit for both causes, not two: commit.nika refuses a lowered/ change without lowered.rs, whose digest names the whole set; cause 2 has no tests/compiler test since it needs two files of one package (shown on sv_sat’s –asserts) Found: none Needs: none Changelog: The bounds walk walks a method again when the derived preconditions of its callees, walked after it, make more of its type’s rules hold; and a field handed to a function with no mut parameter no longer drops the rules over fields of that name (#2777) Issue: broke I7: the cause of 809 was not marked traced or suspected; it was the callers-first walk order, plus a second cause in another file (sv_simplex handing fields) for the value rule Owner: none Friction: commit.nika refuses splitting lowered/ files across commits (LOWERED_DIGEST in lowered.rs), so two causes in two bounds_*.nika files cannot be two commits; scripts/proved.nika refuses a report path outside the checkout Disk freed: target/nikaia-project-tests 1.8G kept (11G free of 252G), no new cache entry over 100 MB Reviewed: 2819a4cb47500bca97c6491a5e6a5711dc197ab2cd418fd0e0f78f0a53ba8794 Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDwk9ubq9teP7QCErff
Issue #2777 is fixed and committed locally as 19b440f9: sv_sat.nika lines 809 and 810 are now proved, and lower-std --bounds loses no site.
lower-std after a bounds_*.nika change took 6–12 minutes, and one cycle had to be redone after develop moved under the uncommitted work. My two-commit split cost a refused commit.nika run.derived_order, held.clear() and BoundsBeside.changed are;FnArg.mutable marks a mut parameter;lower-std --bounds writes nothing;proved.nika takes only a path inside the checkout;nikaia.proofs.d/ holds long certificates and is committed with the ledger.--bounds and --asserts; lower-std --bounds --asserts old against new, compared site by site (6243 sites, 0 lost, 0 gained); the logic package tests (54 passed); ledgers.nika --refresh.proved.nika call on a scratchpad path; the first site-diff regex, which was wrong.lowered/ changes go in one commit with lowered.rs, since LOWERED_DIGEST names the whole set. “One commit per cause” only works when the causes share no lowered output.broke I7: the cause of 809 was not marked traced or suspected. It was the callers-first walk order (ADR-391 D1).rules-gap: the missing value rule came from another file of the package (sv_simplex hands had.value to ref-parameter functions), and nothing pointed to the files beside sv_sat.| Fact: Core | scripts/commit.nika refuses a staged lowered/ change without lowered.rs (its LOWERED_DIGEST), so lowered output cannot be split across commits. |
| Fact: Ledger and bounds proofs | A long ledger certificate goes into nikaia.proofs.d/<hash>, which is committed with nikaia.proofs. |
| Fact: Ledger and bounds proofs | When fields_handed cannot tell a local’s type, a field passed to a function by name is now recorded as callee|field in BoundsBeside.handed; only a callee with a mut parameter, or one the package doesn’t declare, drops the rules over that field name. |
| Fact: Ledger and bounds proofs | Measure: target/fast/nikaia lower-std --bounds --asserts > target/x/ls.txt, then nikaia run scripts/proved.nika -- target/x/ls.txt. On 2026-11-23, at 19b440f9: 3244/4123 indexes, 1572/2435 operations, 6243 sites, about 5.5 minutes per run. |
| Fact: Ledger and bounds proofs | bounds_proven.nika now walks a body again where derived preconditions added after it change the rules that hold (BoundsProven.rules_used, bp_rules_changed, 19b440f9). |
Generated by Claude Code