Introducing free variables with rewrite rules (e.g. tuning parameters) #147
Replies: 2 comments 3 replies
-
|
Hmm. This is tricky. You could try to use the e-class id (or some other data of from the substitution) to generate a kinda deterministic name for the new variable. |
Beta Was this translation helpful? Give feedback.
-
|
Here's what we (actually just @oflatt) did in our attempt at eggifying (scrambling?) our series expansion algorithm. Think about what the tunable parameter depends on, on your left-hand side. I have no idea in your example, but let's assume the choice of and it turns into this: Obviously do this with code, you'll go crazy doing this replacement by hand. If you're doing extraction, you can give this function a cost of 1 no matter its arguments, so it is functionally a constant. This will unify and deduplicate correctly, I think. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I would like to define rewrite rules that introduce free variables on their right-hand-side. In particular, I would like to introduce tunable parameters like
min the following rule, wheren.tis the type of an array ofnelements of typet:How would one do this efficiently in
egg? If we create a fresh variable on every rule application, we will create many equivalent tuning parameters, and overload the e-graph. This is also a problem for bound variables, but for those it is possible to use DeBruijn indices to mitigate the problem. What is a reasonable solution for free variables?Beta Was this translation helpful? Give feedback.
All reactions