inputs¶
Module to check that programs do not contain inputs in their rule heads.
HeadPredicateCollector
¶
Bases: Transformer
Class to collect the head predicates of a normalized program.
check_inputs_not_in_heads(left: list[AST], right: list[AST], inputs: set[Predicate]) -> None
¶
Check that neither program contains an input predicate in a rule head.
Raises an AnthemCXError (causing anthem-cx to exit) if an input predicate occurs in a head. The programs are expected to be normalized.
collect_head_predicates(program: list[AST]) -> set[Predicate]
¶
Collect all predicates occurring in the rule heads of a normalized program.
inputs_in_heads(program: list[AST], inputs: set[Predicate]) -> set[Predicate]
¶
Get the input predicates occurring in the rule heads of a program.
Returns the set of input predicates that occur in a head (empty if the program is valid). The program is expected to be normalized.