>= 0 test (sv_simplex fractional)Open and answer this issue on GitHub.
wip, solver · opened 2026-11-23 · updated 2026-11-23 · 3 comments
Split out of “bounds walk: a method’s found facts through self” (#1667) when its third run was accepted (2026-11-23).
Some functions return either -1 or an index into a list. Examples are sv_simplex’s fractional-style searches (site 884 before sv_simplex moved to packages/logic) and the place lookups. The caller tests r >= 0 and then reads xs[r]. The bounds walk keeps that read checked, because the result fact it can state is one linear range, and “-1 or in 0..<xs.len()” is a disjunction.
result == -1 || (result >= 0 && result < E.len()), derived where every return is either the literal -1 or an index proved in range. After a test r >= 0 (or r != -1) in the caller it narrows to the in-range half. Find the place in ADR-306’s result facts. If a disjunctive fact needs a rule not yet written there, stop and report it (Needs: supervisor decision).tests/compiler/tests/: fn find(xs: Vec[i64], v: i64) -> i64 returning -1 or a loop index, and a caller let r = find(xs, 3); if r >= 0 { xs[r] } is proved.The probe passes under both settings, and the mapped sv_simplex sites print proved, or the report names each site that still does not and why.
Brief queued: issue-2783
agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —
Your work order is issue #2783, 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/2783/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-2783.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-2783, Result: done
Tokens: input 210, cache read 8044291, cache write 132514, output 37830 Cost: 3.63 USD, time 11 min 50 s, turns 105
Result: done
Files: crates/nikaia-std/src/compiler/bounds_walk.nika crates/nikaia-std/src/compiler/emit_core_calls.nika (+ lowered, tests/compiler/tests/a_minus_one_or_a_position_proves_the_read_after_a_test., a_ref_argument_then_one_that_changes_its_root., prove_call_keeps_untouched_fields.)
Commit: b77fdfa3 bounds: a call that only grows a list keeps what held below its length (ADR-391 D2); 552009c9 emit: an argument lent to a ref parameter is bound after a later one that changes its root
Body: 552009c9 fixes an emitter defect the bounds change hit (rustc E0502 on f(&w, w.a.bump()), NK1343 on the old binary), test a_ref_argument_then_one_that_changes_its_root; b77fdfa3: at a call, a length the frame lists in lengths but not in falls is snapshotted and len_after >= len_before is pushed, so facts below it survive; newly proved: sv_simplex self.var_col[v] (split), logic_lia lg_indexed at += 1, sharing Slots::join self.parent[one] = other
Fixes: #2783
Pushed: local b77fdfa3
Tests: new a_minus_one_or_a_position_proves_the_read_after_a_test passes –both-settings and fails on $NIKAIA_OLD (lines 43, 80 checked there); a_ref_argument_then_one_that_changes_its_root passes, NK1343 on old; prove_call_keeps_untouched_fields re-recorded (row read now proved); all 195 tests/.bounds compared against check –bounds, only that one changed; clippy, fmt, pre-push green
Gate: green
Deviation: no new result fact was needed: the -1-or-position result is already bounded by the D23 found bound result < len (-1 < len), so no disjunctive rule was built
Found: none
Needs: none
Changelog: Bounds: a value below a list’s length stays below it past a call whose frame only grows that list, so a -1-or-position search’s result proves the read after r >= 0 across such a call; emit: a ref argument followed by one that changes its root no longer draws E0502
Issue: wrong I7: the probe shape already proved on HEAD through D23’s result < len; sv_simplex’s split read was lost at a mut self call that only grows var_col (frame forgot the length), not for lack of a disjunction
Comment: #2783 sv_simplex mapping: split self.var_col[v] now proved; x.ks[at] (511) and self.big_rows[r].ks[at] (1771) stay checked: at is a position found in cols and read on ks, which needs a cols/ks equal-length invariant, not this result fact; sv_sat propagate/add_lemma results are passed to calls, never indexed
Friction: none
Disk freed: none needed; target/nikaia-project-tests 1.8G, / 9.7G free (75%), no new cache entry over 100 MB
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UVxJDwk9ubq9teP7QCErff
bounding_push(&walk, …, walk.arena.ge(…))). Fixing that meant reverting my bounds diff, fixing the emitter, running a full cycle, committing, reapplying the diff and running the cycle again. Second was disproving the issue’s disjunction hypothesis: the probe already proved on HEAD, so I had to find the real cause, the frame forgetting a grown length.result < len.BoundsChanged and what falls means.bounding_entry_value in bounds_walk.nika.emit_call_hoisted and the check-fact sets in emit_core_calls.nika.--bless does not create a .bounds file.$NIKAIA_OLD, two lower-std/build cycles, test --both-settings on the three tests, bdiff.sh (all 195 .bounds files, about 2 min), fmt, clippy and pre-push. The first cycle, run before the emitter fix, was wasted.tests/*.bounds against check --bounds with one script, and expect lowered std files to flip to proven::*: check that each flip is sound.” That would have saved writing bdiff.sh and the reasoning about it.wrong I7: it assumed a disjunctive rule was missing. D23 already covers -1, and the sv_simplex site was lost at a call that only grows var_col.broke I5: no probe run on HEAD, which would have shown the plain shape already proves.knowledge: Lowering | a call whose first argument is a shared borrow and whose later argument changes the same root drew E0502 until 552009c9.Fact: Ledger and bounds proofs | nikaia test --bless does not create a missing .bounds file; make it with check --bounds tests/NAME.nika in tests/compiler and cut the " - written without..." tail of the first line.Fact: Lowering | a change to the lowering that std's own lowering needs is built and committed before the code using it is lowered (bootstrap order); revert the user, fix, cycle, reapply.Fact: Ledger and bounds proofs | the call frame lives in bounding_by_frame in bounds_walk.nika; since b77fdfa3 (2026-11-23) a length in changed.lengths but not in falls keeps len_after >= len_before.Fact: Ledger and bounds proofs | sv_simplex 511 x.ks[at] and 1771 big_rows[r].ks[at] stay checked (b77fdfa3, 2026-11-23): they need a cols/ks equal-length invariant.Fact: Ledger and bounds proofs | the new test a_minus_one_or_a_position_proves_the_read_after_a_test.bounds reads 6 indexes, 5 proved; 5 operations, 3 proved (b77fdfa3, 2026-11-23).Generated by Claude Code
From the report of the run of issue-2783 (#2783):
sv_simplex mapping: split self.var_col[v] now proved; x.ks[at] (511) and self.big_rows[r].ks[at] (1771) stay checked: at is a position found in cols and read on ks, which needs a cols/ks equal-length invariant, not this result fact; sv_sat propagate/add_lemma results are passed to calls, never indexed
Generated by Claude Code