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

Make scanl a SAWCore primitive #1511

Merged
merged 8 commits into from
Dec 21, 2021
Merged

Make scanl a SAWCore primitive #1511

merged 8 commits into from
Dec 21, 2021

Conversation

robdockins
Copy link
Contributor

This is in further support of Cryptol->Coq extraction.

One point I'm unsure about. In the definition of scanl for infinite streams, I put in a fairly naive implementation that computes each position independently. This will result in a total loss of sharing. The iterate Cryptol primitive is now defined in terms of scanl, so it will also have this issue. I'm not sure if this is something we should worry about.

@brianhuffman
Copy link
Contributor

The loss of sharing with infinite streams will be a problem, and we should fix that before merging this. Cryptol's iterate is commonly used for things like generating block cipher key schedules, or for stream ciphers. Losing sharing will mean going from linear time to quadrating time for evaluating those, which could make the difference between a proof or concrete evaluation being feasible or not.

more likely for coercions to simplify away.
`ecScanl` as an implemention for the Cryptol `scanl` primitive.
when we can easily tell that the length of the branches are the
same.  This avoids unneccessary coercions.

Fixes #1507
This restores the term sharing behavior of `scanl` and `iterate`
on infinite streams.
it instead of the SAWCore implementation.
This recursively unfolds lets appearing in the goal, as otherwise
the proof automation falls completely over.
@robdockins
Copy link
Contributor Author

@brianhuffman, I think I've fixed the loss of sharing issue now.

Copy link
Contributor

@m-yac m-yac left a comment

Choose a reason for hiding this comment

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

LGTM

@robdockins robdockins merged commit c5c6db3 into master Dec 21, 2021
@mergify mergify bot deleted the coq-primitives branch December 21, 2021 21:50
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.

3 participants