Skip to content

Conversation

@adrianleh
Copy link
Contributor

As discussed in #350, adding simple wrapper structures to allow for rewrites to be conditioned on multiple conditions

(cc: @oflatt)


pub fn all<L, N>(
conds: Vec<Arc<dyn Condition<L, N> + Send + Sync>>,
) -> Arc<dyn Condition<L, N> + Send + Sync>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also easily change the return type here into Arc<AndCondition<L,N>> if we wanted to (same for any with OrCondition) by making the base an and of true conditions. Little less efficient but nicer types

@oflatt
Copy link
Member

oflatt commented Mar 10, 2025

How does this interact with explanations? I thought they didn't support conditions at all.
Do you have an example proof?

@adrianleh
Copy link
Contributor Author

They don't interact with proofs directly, however, you mentioned egg does not support multiple pre conditions, so this is being addressed by this PR.

Hackily for proofs, I keep track of all my preconditions (which in my case are all equalities) and then have egg give me proofs for those

@oflatt
Copy link
Member

oflatt commented Mar 14, 2025

Oh I see, I think I misunderstood in the issue thread.
These seem useful enough to merge. What do you think @mwillsey?
We'll want documentation and some small tests before merging.

@mwillsey
Copy link
Member

Sorry for the delay here. Maybe I'm misunderstanding, but can't you already achieve multiple conditions via stacking conditional appliers?

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