diff --git a/docs/changelog.md b/docs/changelog.md index 43c902ee..f75c339f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,10 +4,14 @@ _This project uses semantic versioning_ ## UNRELEASED +- Fix execution of docs [#337](https://github.com/egraphs-good/egglog-python/pull/337) - Emit warnings when functions omitted when visualizing [#336](https://github.com/egraphs-good/egglog-python/pull/336) +- Bump Egglog version [#335](https://github.com/egraphs-good/egglog-python/pull/335) + ## 11.1.0 (2025-08-21) - Allow changing number of threads with env variable [#330](https://github.com/egraphs-good/egglog-python/pull/330) + ## 11.0.0 (2025-08-08) - Change conversion between binary operators to consider converting both types [#320](https://github.com/egraphs-good/egglog-python/pull/320) - Add ability to parse egglog expressions into Python values [#319](https://github.com/egraphs-good/egglog-python/pull/319) diff --git a/docs/reference/egglog-translation.md b/docs/reference/egglog-translation.md index 5976ad66..9ff67f60 100644 --- a/docs/reference/egglog-translation.md +++ b/docs/reference/egglog-translation.md @@ -8,12 +8,6 @@ The high level bindings available at the top module (`egglog`) expose most of th Any EGraph can also be converted to egglog with the `egraph.as_egglog_string` property, as long as it was created with `Egraph(save_egglog_string=True)`. -## Unsupported features - -The currently unsupported features are: - -- `(output ...)`: No examples in the tests, so not sure how this works. - ## Builtin Types The builtin types of Unit, String, Int, Map, and Rational are all exposed as Python classes. @@ -314,7 +308,7 @@ edge = relation("edge", i64, i64) # (rule ((edge x y)) # ((path x y)) :ruleset path) x, y = vars_("x y", i64) -path_ruleset = ruleset(rule(edge(x, y)).then(path(x, y)), name="path") +path_ruleset = ruleset(rule(edge(x, y)).then(path(x, y)), name="path_ruleset") ``` ### Rewrites @@ -358,8 +352,8 @@ egraph.run(5) Facts can be passed after the timeout to only run until those facts are reached: ```{code-cell} python -# egg: (run 10000 :until (fib 10)) -egraph.run(10000, eq(fib(7)).to(i64(13))) +# egg: (run 10000 :until (fib 7)) +egraph.run(10000, fib(7)) ``` Rulesets can be run as well, by calling the `run` method on them: @@ -478,8 +472,6 @@ Multiple items can also be extracted, returning a list of the lowest cost expres a, b, c = vars_("a b c", Math) i, j = vars_("i j", i64) egraph.register( - rewrite(a * b).to(b * a), - rewrite(a + b).to(b + a), rewrite(a * (b * c)).to((a * b) * c), rewrite(a * (b + c)).to((a * b) + (a * c)), rewrite(Math(i) + Math(j)).to(Math(i + j)), diff --git a/docs/reference/python-integration.md b/docs/reference/python-integration.md index 0bb4afeb..f6e4c9f6 100644 --- a/docs/reference/python-integration.md +++ b/docs/reference/python-integration.md @@ -326,6 +326,7 @@ However, there are times in Python when you need the return type of a method to For example, let's say you are implementing a `Bool` expression, but you want to be able to use it in `if` statements in Python. That means it needs to define a `__bool__` methods which returns a Python `bool`, based on evaluating the expression. ```{code-cell} python +egraph = EGraph() class Boolean(Expr): @method(preserve=True) def __bool__(self) -> bool: @@ -334,7 +335,7 @@ class Boolean(Expr): # Run until the e-graph saturates egraph.run(10) # Extract the Python object from the e-graph - value = EGraph().extract(self) + value = egraph.extract(self) if value == TRUE: return True elif value == FALSE: @@ -344,8 +345,8 @@ class Boolean(Expr): def __or__(self, other: Boolean) -> Boolean: ... -TRUE = egraph.constant("TRUE", Boolean) -FALSE = egraph.constant("FALSE", Boolean) +TRUE = constant("TRUE", Boolean) +FALSE = constant("FALSE", Boolean) @egraph.register