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

Conditions in explanations #350

Open
adrianleh opened this issue Mar 3, 2025 · 7 comments
Open

Conditions in explanations #350

adrianleh opened this issue Mar 3, 2025 · 7 comments

Comments

@adrianleh
Copy link

Hi,

I'm currently using explanations on a set of rewrites, of which some are conditional. However, when I get the proof explanation all rewrite steps to rewrite my terms are listed, except the ones that fulfilled the conditions of conditional rewrites. Is it possible to force a condition to include the explanation of the existence of the matched enode into the explanation?

@adrianleh adrianleh changed the title Conditoins in explanations Conditions in explanations Mar 3, 2025
@oflatt
Copy link
Member

oflatt commented Mar 4, 2025

Unfortunately, egg's explanations system does not support conditional rewrites. We are actively trying to add such support to egglog, but it's turning out to be a tough problem.

If it's possible to change the encoding to include the condition as part of the term, that might be a work around with some effort. You could also include in the term some hints that let whatever you're using with the result reconstruct the proof. Hope this helps.

@adrianleh
Copy link
Author

Thanks for the feedback. Could you elaborate a bit on the problem here. In my understanding it seems to me that typically conditions prove the existence of an enode or the equality of two enodes, which the checker could handle? Also is there an updated date on the egglog proof engine?

@oflatt
Copy link
Member

oflatt commented Mar 6, 2025

Egg's current proof generation algorithm and format doesn't support multiple preconditions- it was built with the assumption of matching a single term.

No solid date on the egglog proof engine, but we are focusing more on it now.

@adrianleh
Copy link
Author

I noticed that but it's quite easy to hack in multiple preconditions by creating custom AndConditions that take multiple conditions and ensure they are all met

@oflatt
Copy link
Member

oflatt commented Mar 6, 2025

That sounds like a great hack, lmk how it goes

@adrianleh
Copy link
Author

adrianleh commented Mar 6, 2025 via email

@oflatt
Copy link
Member

oflatt commented Mar 6, 2025

Sure, open a PR and I'll take a look. Happy to take a look at your code, if we change egg we'd want to consider carefully. I'd like to see how it interacts with the various proof formats and what kinds of conditions are supported.

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

No branches or pull requests

2 participants