egglog 2.0.0

egglog is a language that combines the benefits of equality saturation and datalog. It can be used for analysis, optimization, and synthesis of programs. It is the successor to the popular rust library egg.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(datatype Base (X))
(datatype Tree (Leaf Base) (Leaf2 Base) (C1 Tree Tree) (C2 Tree Tree))

(function f (i64) Tree :merge (C2 (C1 old new) (C2 old new)))

;; egglog does not guarantee order of merges, so we need commutativity to 
;; check that it worked
(rewrite (C2 a b) (C2 b a))
(rewrite (C1 a b) (C1 b a))

(set (f 0) (Leaf (X)))
(run 1)
(check (= (f 0) (Leaf (X))))
(set (f 0) (Leaf2 (X)))
(run 1)

(check (= (f 0) (C2 (C1 (Leaf (X)) (Leaf2 (X))) (C2 (Leaf (X)) (Leaf2 (X))))))