choice¶
Module to transform choice rules into normal form.
ChoiceConditionNormalizer
¶
Bases: Transformer
Normalize conditions in choice heads.
E.g. { l : L } :- body. is turned into: { l } :- body, L.
visit_Rule(node: AST) -> AST | list[AST]
¶
Transform choice rules.
ChoiceElementNormalizer
¶
Bases: Transformer
Normalize choice heads.
E.g. { l1 : L1 ; l2 : L2 } :- body. is turned into: { l1 : L1 } :- body, L1. and { l2 : L2 } :- body, L2.
visit_Rule(node: AST) -> AST | list[AST]
¶
Transform choice rules.
ChoiceGuardNormalizer
¶
Bases: Transformer
Normalize choice heads by removing guards.
E.g. lower <= { l : L } <= upper :- body. is turned into: 1. { l : L } :- body. and 2. :- body, not lower <= { l : L } <= upper.
visit_Rule(node: AST) -> AST | list[AST]
¶
Transform choice rules.
ChoicePoolNormalizer
¶
Bases: Transformer
Remove choices over pools.
E.g. { p(1;2) } :- body. is turned into: { p(1) } :- body. and { p(2) } :- body.
visit_Rule(node: AST) -> AST | list[AST]
¶
Transform choice rules over a pool.
ChoiceTermNormalizer
¶
Bases: Transformer
Normalize terms containing intervals or pools in choice rules.
E.g. { p(1..3) : q(X) } :- body. is turned into: { p(Y) : q(X), Y = 1..3 } :- body.