Issue #3021: a loop inside an if branch loses its facts after the join: `fn scan(b: ref…

Open and answer this issue on GitHub.

ready, bugs, queued · opened 2026-12-01 · updated 2026-12-01 · 0 comments

Filed by the driver from the Found: of the run of issue-2817 (#2817) (owner, 2026-11-06).

Found

a loop inside an if branch loses its facts after the join: fn scan(b: ref Bytes) -> i64 { let n = b.len(); let mut cut = 0; if n > 5 { while cut < 3 { cut += 1 } }; assert(cut <= 3); return cut } with nikaia check --asserts gives “refused, not proved: nothing before it shows it”, should be proved as without the if (“proved through the loop that changes cut, with the invariant cut >= 0 && cut < 4”); suspected prover_scope.nika forget (line 253) drops the branch’s LoopRecord when the join forgets cut, and prover_join_arms carries no loop fact past the join (check: trace scope.loops at prover_join_arms); this blocks benches/brc/fast.nika scan (run calls at lines 174, 178)

To build

Done when

The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the probe already passes on develop and a test pins it, naming the commit that fixed it; or the issue is closed as by design, naming the function or ADR.


Generated by Claude Code

Back to Open Issues