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

Add a replace action #226

Closed
wants to merge 4 commits into from
Closed

Conversation

oflatt
Copy link
Member

@oflatt oflatt commented Sep 6, 2023

When writing rules where one row in a table subsumes another, it's often hard to write the rules. This PR adds a prototype for a replace action to solve this problem.

In particular, the only way to do it right now is to use delete. However, if the two rows are actually the same, the problem is that we never saturate.
Stupid example that runs forever:
https://egraphs-good.github.io/egglog/?program=XQAAgACeAAAAAAAAAAAFYJzIYToE-74urWhpV-IA_[…]IY2FIeFaKKvnanDvE9ubGR2gphrxqDRu1WAeyBGxkXMQP_-wXIAA%253D

This PR fixes this problem by adding a replace action, allowing for one row to replace another (and does nothing when they are the same).

@oflatt oflatt requested a review from a team as a code owner September 6, 2023 23:46
@oflatt oflatt requested review from ajpal and removed request for a team September 6, 2023 23:46
@oflatt
Copy link
Member Author

oflatt commented Sep 8, 2023

Maybe we should get rid of delete in favor of replace?

@yihozhang
Copy link
Collaborator

Since replace desugars to a set in actions, do you need to also duplicate it in query to make semi-naive sound?

@oflatt
Copy link
Member Author

oflatt commented Sep 8, 2023

Since replace desugars to a set in actions, do you need to also duplicate it in query to make semi-naive sound?

Yes, great catch! Fixed.

@oflatt
Copy link
Member Author

oflatt commented Sep 10, 2023

To be clear, we shouldn't merge this yet- still playing around with it.

@mwillsey mwillsey marked this pull request as draft September 10, 2023 01:23
@mwillsey
Copy link
Member

Let’s keep not-ready prs as drafts, it helps reduce notification noise a bit

@oflatt
Copy link
Member Author

oflatt commented Sep 12, 2023

No longer necessary for terms- could still be a good idea but closing for now.

@oflatt oflatt closed this Sep 12, 2023
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