Skip to content

Commit 84bcb04

Browse files
Merge pull request #20 from metadsl/19-add-docs-on-how-to-translate-between-egglog
Add docs on how to translate between egglog
2 parents c59a1bd + 1c045f4 commit 84bcb04

File tree

8 files changed

+602
-48
lines changed

8 files changed

+602
-48
lines changed

docs/explanation/compared_to_rust.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,21 +141,3 @@ egraph.run(10)
141141
142142
egraph.check(eq(expr1).to(expr2))
143143
```
144-
145-
### Mapping of low level to high level
146-
147-
Here are a number of the low level commands, with how they map to the high levle API:
148-
149-
- `(datatype Math ...)` -> `@egraph.class_` on a Python class. Internally, each method and classmethod are registered as functions, not as `Variant`s of the datatype, but the end result is the same.
150-
- `(set-option enable_proofs 1)` -> Not supported
151-
- `(declare True Bool)` -> As a class variable `True: Bool` or as a constant `True_ = egraph.constant("True", Bool)`. Internally, we don't actually use the `Constant` command but instead map constants to nullary functions which are immediately evaluated. This is how the `Constant` command is desugared in egglog anyways.
152-
- `(define expr1 ...)` -> `expr1 = egraph.define("expr1", ...)` or just `expr1 = ...` if it doesn't need to be added to the e-graph.
153-
- `(sort MyMap (Map i64 String))` -> `MyMap = Map[i64, String]`. We can use the normal Python generic typing syntax. Internally, when this is used in a type definition, we would create a new sort with the name `Map__i64__String`.
154-
- `(function f ...)` -> `@egraph.function` on a Python function with no body.
155-
- `(ruleset x)` -> `x = egraph.ruleset("x")`
156-
- `(rule (f1 f2) (a1 a2))` -> `egraph.register(rule(f1, f2).then(a1, a2))`
157-
- `(run 10 :until f :rulset x)` -> `egraph.run(10, until=f, ruleset=x)`
158-
159-
Facts
160-
161-
Actions

docs/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
```{toctree}
44
changelog
55
reference/high-level
6+
reference/egglog-translation
67
reference/bindings
78
```

0 commit comments

Comments
 (0)