Skip to content

Fix lex orderings in pulse decreases clauses + examples#575

Merged
gebner merged 3 commits intomainfrom
_nik_while_decreases_examples
Feb 28, 2026
Merged

Fix lex orderings in pulse decreases clauses + examples#575
gebner merged 3 commits intomainfrom
_nik_while_decreases_examples

Conversation

@nikswamy
Copy link
Copy Markdown
Contributor

@nikswamy nikswamy commented Feb 27, 2026

Fixes #576

@nikswamy nikswamy changed the title add decreases clauses to some examples to get a feel for it Fix lex orderings in pulse decreases clauses + examples Feb 27, 2026
@gebner
Copy link
Copy Markdown
Contributor

gebner commented Feb 27, 2026

Ah, so the %[] is a bespoke feature of the decreases syntax then. I had kinda hoped it would be a type with a theorem stating %[a;b] << %[c;d] <==> (a << c \/ (a == c /\ b << d)).

LGTM, the typing is entirely missing but that doesn't really matter since we're going to remove it anyhow.

FYI, we renamed Tm_NuWhile to Tm_While yesterday and that's why you're seeing merge conflicts.

Change meas field in Tm_NuWhile from 'option term' to 'list term' to support
lexicographic decreases clauses like 'decreases %[(!x); (!y)]'.

For multi-element measures, build nested tuple values (Mktuple2) and a
lexicographic comparison formula: a << d \/ (a == d /\ b << e).

The desugarer now detects LexList AST nodes in while decreases clauses
and extracts individual terms into the list representation.

Remove [@@expect_failure] from the lex function in WhileDecreases.fst.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nikswamy
Copy link
Copy Markdown
Contributor Author

I'm at least getting it to remove the assumes ...

Resolve conflicts keeping our lex decreases changes (list term for meas,
dec_formula parameter, build_tuple_info) while adopting main's renaming
of NuWhile -> While.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nikswamy nikswamy force-pushed the _nik_while_decreases_examples branch from d83424c to 8ba25d0 Compare February 27, 2026 23:34
@gebner gebner merged commit 1f1c90c into main Feb 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lexicographic ordering in while loop decreases clause doesn't seem to work

2 participants