emmalanguage/emma

[IR] Normalize guards in conjunctive normal form

Closed this issue · 2 comments

The following transformations of guards can improve join combination. Consider boolean expressions returned in guards:

  1. Eliminate double negation (!!x => x);
  2. Move negation inside conjunction / disjunction (!(x || y) => !x && !y)
  3. Distribute disjunction over conjunction ((x && y) || z => (x || z) && (y || z))
  4. Split guards that return a conjunction in two guards. Repeat from 1. in sub-guards.
  5. MatchEquiJoin should collect all guards of the form f(x) == g(y) and emit k(x) = (f1(x), ... fn(x)) i.e. the join with largest possible selectivity.

@ParkL, @harrygav, @akunft this is a good starter to get to know the API.

Resolved via #363.