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
;; EXPECT: ok
;; TYPES: machine
;; `:when ((= x g))` against a let-bound global: the guard resolves to the O(1) e-class
;; equality check, so the rewrite fires only for the argument that is in the global's class.
(datatype E (V i64) (Add E E) (Mul E E))
(let zero (V 0))

(rewrite (Add x y) (Mul x y) :when ((= x zero)))

(let a (Add (V 0) (V 5)))
(let b (Add (V 1) (V 5)))
(run 3)
(check (= a (Mul (V 0) (V 5))))
(check (!= b (Mul (V 1) (V 5))))