Skip to content

Local rewrites#710

Merged
facundominguez merged 19 commits into
ucsd-progsys:developfrom
AlecsFerra:develop
Oct 16, 2024
Merged

Local rewrites#710
facundominguez merged 19 commits into
ucsd-progsys:developfrom
AlecsFerra:develop

Conversation

@AlecsFerra

@AlecsFerra AlecsFerra commented Oct 11, 2024

Copy link
Copy Markdown
Contributor

Following the discussion on #705 the local rewrites features is implemented standalone.

This PR implements proposal 1 of #2371/liquid-haskell

Depends on #2384/liquid-haskell

WIP: at the moment we don't read the local rewrites from horn files.

@facundominguez facundominguez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is looking simple enough to me.

Some tests would be needed.

Also, the PR description says this is not implemented for the fq format, but it looks like it is.

Comment thread src/Language/Fixpoint/Solver/PLE.hs Outdated
| deANFed <- deANF ctx e0
, dropECst deANFed /= dropECst e0
= do
return (Just $ eApps deANFed es, expand)

@facundominguez facundominguez Oct 14, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We would need an example of an expression that requires to inline anf bindings to unfold function calls in order to motivate this case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The issue is that I don't have a small example but the SKI example without lemmas doesn't pass without unfolding ANFs

@facundominguez facundominguez Oct 14, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That sounds like we will need to do some debugging to explain why deANF is needed then.

@AlecsFerra AlecsFerra Oct 14, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suspect that is some bug in the code that does the deANFing because I suppose that ANF expressions shouldn't reach the evaluation loop, also the only other place where is called is in some code that does the REST rewrites

@facundominguez facundominguez Oct 14, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, REST does need to remove anf bindings, and that use I think I understand.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I contributed a fix for (3) in #711

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SKIDC and the proposal are still passing? I would expect yes since it's a value

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Your tests continue to pass with it.

@facundominguez facundominguez Oct 15, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I contributed another implementation that calls deANF only once per fork in the trie. It is passing all the tests as well. 2b8411e

In addition, it also explains the situations we have identified so far where ANF bindings interfere with PLE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah looks way better

@AlecsFerra

Copy link
Copy Markdown
Contributor Author

Also, the PR description says this is not implemented for the fq format, but it looks like it is.

Forgot to update the comment

@AlecsFerra AlecsFerra marked this pull request as ready for review October 15, 2024 09:43
@nikivazou

Copy link
Copy Markdown
Member

There is a parser correct? If so, can you also add a small .fq file to see how it works?

Comment thread src/Language/Fixpoint/Solver/PLE.hs Outdated
Comment thread src/Language/Fixpoint/Solver/PLE.hs Outdated
@AlecsFerra

Copy link
Copy Markdown
Contributor Author

There is a parser correct? If so, can you also add a small .fq file to see how it works?

Done

Comment thread src/Language/Fixpoint/Types/Environments.hs Outdated

@facundominguez facundominguez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Any last changes before merging @AlecsFerra?

@AlecsFerra

Copy link
Copy Markdown
Contributor Author

I think we can merge it

@facundominguez

Copy link
Copy Markdown
Collaborator
  1. The above issues can happen with any let bindings in the code, not only ANF bindings.

From the open discussion above, this is the only standing question, but I think it would be fine to handle it in some other PR.

@facundominguez facundominguez merged commit d1acfdc into ucsd-progsys:develop Oct 16, 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.

3 participants