egraphs-good / egglog

egraphs + datalog!
https://egraphs-good.github.io/egglog/
MIT License
459 stars 54 forks source link

Removing :default keyword #421

Open yihozhang opened 2 months ago

yihozhang commented 2 months ago

We have decided that functions no longer accepts a :default argument. In other words, no "non-constructor" functions can no longer be implicitly created. Instead, the user is responsible for initializing functions using set explicitly.

This means the following function (from merge-saturates.egg) is no longer expressible in egglog, because (1) baz should not have a :default and (2) looking up (baz new) in bar's merge expression is not allowed (related: #420).

(function baz (i64) i64 :default 0)

(function bar () i64 :merge (min (baz new) 0))

(set (bar) 1)
(set (bar) 2)

(rule ((= f (baz x)) (< x 50))
      ((set (bar) (+ x 1))))