Skip to content

Conversation

@gebner
Copy link
Contributor

@gebner gebner commented Aug 28, 2025

This PR adds syntax for lambda arguments to combinators:

OR.on_range_weaken f g i j
  fn k { rewrite f k as g k }

Which used to be:

ghost
fn weaken (k:nat { i <= k /\ k < j })
requires f k
ensures g k
{
  rewrite (f k) as (g k)
};
OR.on_range_weaken f g i j weaken

Limitations/notes:

  • Only final arguments are supported. (So no lambdas in record fields.)
  • Only arguments to stt(ghost/atomic) functions are supported. (So no record constructors.)
  • The type of the lambda needs to be inferable from the arguments alone, not the slprops in the contexts. (The matcher is run after declaring the auxiliary functions.)
  • Under the hood this compiles down to a nested auxiliary function like we used to write. We add an extra unit argument to prevent ANF from kicking in.

I've also added a cute generic introduction function for forall/trade/shift/etc.:

intro (forall* l. is_list x l @==> is_list x ([] @ l)) fn _ l {};

@gebner gebner force-pushed the gebner_combs branch 2 times, most recently from 29f70af to b4f9f0e Compare August 28, 2025 20:01
@gebner gebner changed the base branch from gebner_impurespec to main August 28, 2025 20:01
@gebner gebner marked this pull request as ready for review August 28, 2025 20:01
@gebner gebner merged commit 3a96f1a into main Aug 29, 2025
2 checks passed
tahina-pro added a commit to mtzguido/everparse that referenced this pull request Sep 2, 2025
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.

2 participants