Pulse tests: do not define KRML_HOME for CI; add divergent or decreases clauses#750
Merged
Merged
Conversation
F* PR 4358 splits Pulse's `stt` into terminating `stt` (`fn`) and
possibly-divergent `stt_div` (`divergent fn`). A measure-free `while`
loop is now divergent, so a plain `fn` containing one fails with
Error 228 ("Cannot compose computations in this divergent block").
Fix the affected pulse extraction tests:
- Genuinely non-terminating loops are marked `divergent fn`:
InlineLoopCond.test and .test_ok (immutable condition, empty body)
and Break.break_continue_and_return (a `continue` path that never
advances the counter).
- Terminating loops get a `decreases` measure to stay plain `fn`:
Inline.tst, Break.simple_break, Break.find_zero_with_break and
Goto.find_zero (adding a bound invariant to Inline.tst as needed).
Extraction is unaffected (stt_div extracts like stt), so the expected
C output is unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ec80b304-3585-492b-9f51-c0c9f8b9358f
KRML_EXE for CI; add divergent or decreases clausesKRML_HOME for CI; add divergent or decreases clauses
protz
approved these changes
Jul 22, 2026
Member
Author
|
Thanks Jonathan! |
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.
Summary
This branch tracks two recent F* changes so that KaRaMeL's Pulse test suite
(
build-and-test-pulse) keeps building and passing against F*master:KRML_HOMEtoKRML_EXE.sttinto aterminating
stt(surface keywordfn) and a possibly-divergentstt_div(surface keyword
divergent fn).Changes
1. CI: do not use
KRML_HOME(follows FStarLang/FStar#4349).github/workflows/ci.yml— thetest-pulsejob no longer needsKRML_HOME. The currenttest/pulse/Makefileuses the proper Karamel executable forKRML_EXE.2.
test/pulse: adapt to the Pulsestt/stt_divsplit (follows FStarLang/FStar#4358)Root cause. After #4358, a
whileloop (orfn rec) with nodecreasesmeasure is a divergent (
stt_div) computation. A plainfnmust beterminating (
stt), so it can no longer contain a measure-free loop and nowfails with:
This broke
Inline.fst,InlineLoopCond.fst,Goto.fstandBreak.fst.Fix. Following the same conventions F* used to migrate its own Pulse
libraries and examples in #4358:
divergent fn.decreasesmeasure (placed after theinvariant/ensuresclauses) so they stay plain terminatingfns.InlineLoopCond.test,InlineLoopCond.test_okdivergent fnBreak.break_continue_and_returncontinuepath never advances the counterdivergent fnBreak.simple_breakdecreases (if !k then 1 else 0)Break.find_zero_with_breakszdecreases (SizeT.v sz - SizeT.v (!i))Goto.find_zeroszdecreases (SizeT.v sz - SizeT.v (!i))Inline.tstuu__kpure (v (!i) <= v uu__k)+decreases (v uu__k - v (!i))Testing
make -kj$(nproc) test-pulse(the exact CI target) passes from a clean state:all
CHECK,EXTRACT,KRMLandDIFFsteps succeed.Extraction is unaffected —
stt_divextracts likestt— so the generated Cis unchanged and no
*.expected.cfiles needed updating.Notes
.github/workflows/ci.ymlandtest/pulse/.