Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General recursion in Pulse #51

Open
nikswamy opened this issue Aug 1, 2023 · 2 comments
Open

General recursion in Pulse #51

nikswamy opened this issue Aug 1, 2023 · 2 comments
Labels
pulse Issues related to the Pulse separation logic DSL

Comments

@nikswamy
Copy link
Collaborator

nikswamy commented Aug 1, 2023

  • Add support for Dv and general recursion in FStar.Reflection.Typing
  • Add a typing rule for Pulse recursion targeting the Dv rule in reflection typing.
@mtzguido
Copy link
Member

mtzguido commented Aug 3, 2023

For Dv recursion, without any termination check, one possibility is having a rule like:

G, f : (a -> Dv b), x:a |- e : Dv b
------------------------------------ [Rec]
G |- (let rec f x = e in f) : a -> Dv b

i.e. the simple 1-argument Dv recursion rule, and use that to get n-ary recursion like this:

G, f : (a -> b -> c -> Dv d), x:a, y:b, z:c |- e : Dv d
-------------------------------------------------------------------- [Lam]
G, f : (a -> b -> c -> Dv d), x:a |- (fun y z -> e) : b -> c -> Dv d
-------------------------------------------------------------------- [Rec]
G |- (let rec f x = fun y z -> e) : a -> Dv (b -> c -> Dv d)

And then use eta expansion to turn this into a a -> b -> c -> Dv d.

@tahina-pro tahina-pro added the pulse Issues related to the Pulse separation logic DSL label Sep 25, 2023
@nikswamy
Copy link
Collaborator Author

@mtzguido has added support for general recursion in stt as well as recursion with termination checking for stt_ghost. We also have support for extraction of recursive definitions.

The approach involves introducing a Pulse definition with an additional argument for the recursively bound name and then relying on a regular F* definition to tie that knot. The code that actually ties the knot is admitted currently, but our most recent discussions around this is to expose for stt a pair of coercions as_dv (s:stt a p q) : unit -> Dv (stt' a p q) and from_dv: (unit -> Dv (stt' a p q) -> stt a p q for an abstract type stt'. This should allow us to tie the knot in the general recursion case without needing to prove termination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pulse Issues related to the Pulse separation logic DSL
Projects
None yet
Development

No branches or pull requests

3 participants