Skip to content

head

Module to normalize rule heads.

NormalizeHead

Bases: Transformer

Normalize (non-choice) rule heads, i.e. remove negated heads and comparisons.

  1. single negation: not l :- body. is turned into :- body, l.

  2. double negation: not not l :- body. is turned into :- body, not l.

  3. comparisons: X < Y :- body. is turned into :- body, not X < Y. (note that negated comparisons are already handled in 1/2)

visit_Rule(node: AST) -> AST

Transform rules heads.

RemoveHeadCondition

Bases: Transformer

Remove conditional literals in rule heads.

h : c :- body. is turned into h :- body, c.

visit_Rule(node: AST) -> AST

Transform rules whose head is a conditional literal.