Skip to content

Question regarding false and 0 in E-graphs #271

@ViciousDoormat

Description

@ViciousDoormat

Hello,

The following rewrite rules and E-graph saturation process:

t = @theory a begin
  false --> 0  1
end

g = EGraph{Expr, Nothing}(:(false))
saturate!(g, t)
println(g)

result in the following E-graph:

EGraph{Expr, Nothing} with 2 e-classes:
  1 => [0, %1  %2]
  2 => [1]

As you can see, it puts 0 and false in the same class. This makes sense because in julia 0 == false returns true.
However, is there a way to make sure 0 and false do not end up in the same class?
I tried adding the type Bool to false, but when I do that, it just does not apply the rule anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions