semi-persistent-egraph 0.3.0

Semi-persistent equality saturation engine with e-matching, rewrite scheduling, and proof logging
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
;; EXPECT: ok
;; TYPES: machine
;; A concrete literal written inside a rule's left-hand side must match. The rule below
;; is dead unless the `0` in `(Const 0)` compiles to a constraint the matcher can satisfy:
;; before the fix the literal atom compiled to a join with no index lookup, which yields
;; no candidates and aborts the whole query, so the rule never fired.
(datatype Math (Add Math Math) (Const i64) (Var String))
(rewrite (Add a (Const 0)) a)

(let t (Add (Var "p") (Const 0)))
(run 5)
(check (= t (Var "p")))

;; Soundness counterpart: the literal pins the payload, it does not merely reach the `@i64`
;; nodes. A different constant in the same position must not match.
(let u (Add (Var "q") (Const 5)))
(run 5)
(check (!= u (Var "q")))