simplification
LogicSimplify
¶
Bases: UnvalidatedForm, LogicLoader
Simplify a logic program before it is lowered.
Source code in src/finch/finch_logic/simplification.py
simplify_logic(prgm)
¶
Algebraically simplify a logic program.
annihilate is deliberately left out. An operand of a MapJoin carries the
fields that give the result its extent, so discarding one discards a
dimension.
Source code in src/finch/finch_logic/simplification.py
unwrap_literal(node)
¶
Reorder(Literal(v), ()) => Literal(v), and likewise for Relabel.
A literal is zero-dimensional, so reordering or relabelling it by no fields
is the identity. Without this the algebraic rules see nothing: optimize
leaves every literal operand wrapped, so LiteralTerm never matches.