Repository navigation
[AUTOMATED] Print a rotated counted loop's != latch as the ordering test its guard checks (looptest) - #1906
Merged
Conversation
…d checks (looptest proven) A rotated `for (i = 0; i < n; i++)` tests `i != n` at the bottom behind `if (n > 0)`; the two are not the same test, so looptest kept the guarded do-while. When the latch compares a carried value that steps by a constant s with an invariant bound, the value starts strictly on the near side of the bound, and the bound is the start plus an exact multiple of s (s == 1, an element pointer &x[n] with s the element size, or x + n*c with a power-of-two s dividing c), the value meets the bound and never passes it: `!=` and `<` (`>` counting down) agree on every value the top test sees and no step wraps. The latch then prints as the ordering test, provided its entry test equals the guard (which is dropped) or a dominating condition, and both operands print with types of one ordering class (signed, unsigned or pointer, from the declaration after signedness rounding). The condition normal form learns that element pointers compare as their indices and that an extended value compares with a constant at its own width. New stage test kuna-looptest-order; kuna-looptest's count now expects `while (i < n)`. [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
The stage corpus count moves by one for kuna-looptest-order, the phase catalog fixture and docs/options.md carry the looptest summary's new sentence, and the stages baseline gains the eight LOOPTEST-ORDER assertions and renames LOOPTEST #3, #7 and #8 for count's new top test. [AUTOMATED] Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
mahaloz
added a commit
to sjkim1127/kuna
that referenced
this pull request
Nov 23, 2026
Resolve the stage-corpus count (884 on main after Noelo-Lab#1906, +1 here = 885) and synthesize docs/baseline-stages.json from both sides (main 5187 + 5 = 5192). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
mahaloz
added a commit
that referenced
this pull request
Nov 23, 2026
The stage corpus file count is 885 with #1906's stage file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A rotated
for (i = 0; i < n; i++)testsi != nat the bottom behind anif (n > 0)guard. Those are not the same test (a negativenpassesi != n), solooptestkept such loops as guarded do-whiles:Before:
After:
xthat steps by a constantswith an invariant boundb,xstarts strictly on the near side ofb, andb - x_entryis an exact multiple ofs, thenxmeetsband never passes it. Sox != bandx < b(x > bwhen counting down) agree on every value the top test sees, and no step can wrap. The loop then prints the ordering test, and the guard must equal its entry testx_entry < b. This is part oflooptest proven; there is no new option or value.&x[n]with the element size as the step (C pointer arithmetic), and forx + n * cwith a power-of-two step dividingc. Bounds such asa + (n - 1) + 1in 32 bits fail the guard check (atn == 0they are far pasta) and stay do-while loops, as does a step of 2 against an arbitraryn.signednessrounding) as signed integers, as unsigned integers, or as pointers. A constant bound must lie in[0, 2^31).p < &p[n]is0 < n,&p[16] != &p[32]is true) and that a zero- or sign-extended value compares with a constant at its own width.Tests: new stage test
kuna-looptest-ordercovers a count down to zero, a byte walk to&p[n]with a signedn, and two loops that must stay do-while (an odd step and the(n - 1) + 1end pointer).kuna-looptestnow expectswhile (i < n)for itscountfunction. Unit tests cover the new normal-form rules and the exact-multiple check. 0/675 datatest assertions move.On the decbench O2 corpus 74 more functions match the source's control flow exactly (gained 74, lost 0); O0 is unchanged.
Model:
anthropic/claude-opus-5-5🤖 Generated with Claude Code
https://claude.ai/code/session_013BBaWVABMswm9QwjnywGWU