alt-romes / alt-romes/hegg

E-Analysis in test/Sym.hs

未关闭
#35 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Haskell
星标
98
派生
17
PR 合并指标
30 天内没有已合并 PR

描述

I believe the Sym.hs test has some weird corners. Not sure if the test has to be fixed, it seems to test everything it should. Maybe a comment for folks who are looking for examples is fine?

The `Maybe Double` E-Analysis is basically a coarse grained set. Either it represents all Double's or a singleton set of a specific Double.
The join should be set-intersection, but then we should have `joinA Nothing x = x` and `joinA x Nothing = x`.
The current implementation is not unsound, but it loses a lot of accuracy and results depend on the ordering of rules and merges.

Secondly, some rules have the conditional

```
is_not_zero :: Pattern Expr -> RewriteCondition (Maybe Double) Expr
is_not_zero v subst egr =
egr^._class (unsafeGetSubst v subst)._data /= Just 0
```

This is very dangerous because `Nothing` stands for all Doubles. With a fixed joinA, `Nothing `can be refined to `Just 0` later. Fixing the condition to not fire on Nothing makes the test-suite fail, though. In datalogs with lattices this is sometimes solved with stratification, so the stratified rules run only after all rules that could refine the e-analysis finished. But because congruence and e-analysis always run this doesn't seem feasible, so is_not_zero should only fire if the e-class has a known distinct value. Optionally the lattice could be enriched with a specific non-zero case.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。