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

Removing term from Pulse AST, instead use F* reflection terms and expose a term view to the Pulse checker #30

Merged
merged 24 commits into from
Mar 29, 2024

Conversation

aseemr
Copy link
Contributor

@aseemr aseemr commented Mar 28, 2024

The PR removes the term AST from Pulse syntax and replaces it with the F* reflection term. We were using the Pulse term node for pure F* terms, including vprops (Tm_Emp, Tm_Star, etc.). Instead, the PR uses F* reflection term for such terms.

To help checker code inspect, for example, the vprop structure, the PR introduces a term_view (which is essentially earlier Pulse term), and an inspect function to go from F* reflection term to term_view, that code can match on.

The advantage is that, we get rid of a lot of boiler plate code (ln, freevars, subst, ...) for Pulse terms, instead all those are just corresponding F* reflection functions.

@aseemr aseemr marked this pull request as ready for review March 28, 2024 18:05
) ss l

let eq_tm_unascribe (g:env) (p q:term)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vprop matching is now working on F* reflection terms. In some cases, we do try to match p <: vprop with p in the context. If we just did syntactic matching, the ascriptions come in the way.

To get around this, the function eq_tm_unascribe unascribes and then does eq_tm, it returns an equiv proof for the two terms, by using magic () for the equiv token.

Going forward, we could move it to calling F* Rel (in some restricted config, no delta, no smt etc.), and get the token from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulse.Synatx.Pure contains all the pure syntax utilities, including pure syntax builders, term_view, inspect and pack, etc.

fail_doc pst.pg None msg
| Some pst -> prover pst // a little wasteful?
| hd::unsolved' ->
match inspect_term hd with
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample use of inspect API.

@@ -315,12 +297,8 @@ let compute_term_type (g:env) (t:term)
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In pure checker, we don't need to readback.

@aseemr aseemr merged commit 584c492 into main Mar 29, 2024
1 check passed
@aseemr aseemr mentioned this pull request Apr 9, 2024
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.

1 participant