Skip to content

Commit d21d13e

Browse files
Fix docs
1 parent 7417239 commit d21d13e

File tree

7 files changed

+34
-15
lines changed

7 files changed

+34
-15
lines changed

docs/explanation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ explanation/compared_to_rust
55
explanation/optional_values
66
explanation/define_and_define
77
explanation/pldi_2023_presentation
8+
explanation/2023_07_presentation
89
```

docs/explanation/2023_07_presentation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10071,7 +10071,7 @@
1007110071
"tags": []
1007210072
},
1007310073
"source": [
10074-
"## A story about Arrays"
10074+
"### A story about Arrays"
1007510075
]
1007610076
},
1007710077
{

docs/reference/egglog-translation.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,17 @@ egraph.extract(fib(1))
469469
Multiple items can also be extracted, returning a list of the lowest cost expressions, with `egraph.extract_multiple`:
470470

471471
```{code-cell} python
472+
a, b, c = vars_("a b c", Math)
473+
i, j = vars_("i j", i64)
474+
egraph.register(
475+
rewrite(a * b).to(b * a),
476+
rewrite(a + b).to(b + a),
477+
rewrite(a * (b * c)).to((a * b) * c),
478+
rewrite(a * (b + c)).to((a * b) + (a * c)),
479+
rewrite(Math(i) + Math(j)).to(Math(i + j)),
480+
rewrite(Math(i) * Math(j)).to(Math(i * j)),
481+
)
482+
472483
# egg:
473484
# (define y (Add (Num 6) (Mul (Num 2) (Var "x")))
474485
# (run 10)
@@ -483,16 +494,6 @@ egraph.extract_multiple(y, 2)
483494
The `(simplify ...)` command in egglog translates to the `egraph.simplify` method, which combines running a schedule and extracting:
484495

485496
```{code-cell}
486-
a, b, c = vars_("a b c", Math)
487-
i, j = vars_("i j", i64)
488-
egraph.register(
489-
rewrite(a * b).to(b * a),
490-
rewrite(a + b).to(b + a),
491-
rewrite(a * (b * c)).to((a * b) * c),
492-
rewrite(a * (b + c)).to((a * b) + (a * c)),
493-
rewrite(Math(i) + Math(j)).to(Math(i + j)),
494-
rewrite(Math(i) * Math(j)).to(Math(i * j)),
495-
)
496497
# egg: (simplify (Mul (Num 6) (Add (Num 2) (Mul (Var "x") (Num 2)))) 20)
497498
egraph.simplify(Math(6) * (Math(2) + Math.var("x") * Math(2)), 20)
498499
```

docs/tutorials.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
```{toctree}
44
tutorials/getting-started
5+
tutorials/array-api
56
```

docs/tutorials/array-api.ipynb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"metadata": {},
5+
"metadata": {
6+
"editable": true,
7+
"slideshow": {
8+
"slide_type": ""
9+
},
10+
"tags": []
11+
},
612
"source": [
713
"# Implenting an Array API to use with Scikit-learn\n",
814
"\n",
@@ -1052,7 +1058,7 @@
10521058
],
10531059
"metadata": {
10541060
"kernelspec": {
1055-
"display_name": "egg-smol-python",
1061+
"display_name": "Python 3 (ipykernel)",
10561062
"language": "python",
10571063
"name": "python3"
10581064
},
@@ -1068,8 +1074,10 @@
10681074
"pygments_lexer": "ipython3",
10691075
"version": "3.10.9"
10701076
},
1071-
"orig_nbformat": 4
1077+
"mystnb": {
1078+
"execution_mode": "off"
1079+
}
10721080
},
10731081
"nbformat": 4,
1074-
"nbformat_minor": 2
1082+
"nbformat_minor": 4
10751083
}

python/egglog/declarations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,9 @@ def pretty(self, mod_decls: ModuleDeclarations, parens=True, **kwargs) -> str:
588588
:param parens: If true, wrap the call in parens if it is a binary or unary method call.
589589
"""
590590
ref, args = self.callable, [a.expr for a in self.args]
591+
# Special case != since it doesn't have a decl
592+
if isinstance(ref, MethodRef) and ref.method_name == "__ne__":
593+
return f"{args[0].pretty(mod_decls, wrap_lit=True)} != {args[1].pretty(mod_decls, wrap_lit=True)}"
591594
defaults = mod_decls.get_function_decl(ref).arg_defaults
592595
if isinstance(ref, FunctionRef):
593596
fn_str = ref.name

python/tests/test_high_level.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,8 @@ def test_f64_negation() -> None:
326326
expr3 = egraph.define("expr3", -(-f64(2.0)))
327327
egraph.check(eq(expr1).to(-expr2))
328328
egraph.check(eq(expr3).to(expr2))
329+
330+
331+
def test_not_equals():
332+
egraph = EGraph()
333+
egraph.check(i64(10) != i64(2))

0 commit comments

Comments
 (0)