-
Notifications
You must be signed in to change notification settings - Fork 63
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
Term utilities #1698
Term utilities #1698
Conversation
applyTypedTerm sc (TypedTerm _tp t1) (TypedTerm _ t2) = | ||
do trm <- scApply sc t1 t2 | ||
ty <- scTypeCheckError sc trm | ||
ct <- scCryptolType sc ty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC scCryptolType
can be a bit weird sometimes due to the lack of an injective mapping from Cryptol types to SAWCore types. I think this might present some unintuitive behavior when (e.g.) the Term
applied is a Cryptol function returning a tuple or record. I don't think this is a blocker, but it might be worth mentioning in the docs for term_apply
or even just as a comment here.
and automatically builds the statement of an equality congruence lemma for that function. The generated statement can then be passed to `prove_extcore` to get a congruence lemma that can be used in proofs.
we can now construct integer and natural number terms directly from SAWCore `Int` values, or `TCNum` values from Cryptol sizes. In addition, there is now a `term_apply` operation which will construct application terms.
This can be used to prove lemmas regarding the one-step unrolling of Cryptol definitions. Also, prove an "inverse eta rule", which is really just states that applying equal functions to an argument yields equal results.
6d93ec7
to
8e6eb32
Compare
Some utilities for constructing SAWCore terms.
The
term_apply
primitive gives a way to combine terms by application, which was missing previously. Thecongruence_for
is a convenience that tries to automatically build the statement of a congruence lemma for a term. This statement can then be proved and applied as a lemma.