Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 3 additions & 11 deletions docs/reference/egglog-translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)),
Expand Down
7 changes: 4 additions & 3 deletions docs/reference/python-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
Loading