Skip to content

conflict

Module for checking for naming conflicts of predicates.

GroundTermCollector

Bases: Transformer

Class to collect all ground terms occurring in a program.

__init__() -> None

Initialize an empty set of ground terms.

visit_BinaryOperation(node: AST) -> AST

Collect ground binary operations and recurse into sub-terms.

visit_Function(node: AST) -> AST

Collect ground function terms and recurse into arguments.

visit_SymbolicAtom(node: AST) -> AST

Explicitly visit only the arguments of the atom to avoid collecting the predicate symbol.

visit_SymbolicTerm(node: AST) -> AST

Collect symbolic terms (numbers and symbolic constants), excluding #inf and #sup.

visit_UnaryOperation(node: AST) -> AST

Collect ground unary operations and recurse into sub-terms.

PlaceholderCollector

Bases: Transformer

Class to collect placeholders of a program.

__init__() -> None

Initialize an empty set of placeholders.

visit_Definition(node: AST) -> AST

Add the placeholder to the set of all placeholders.

check_and_rename_auxiliaries(left: list[AST], right: list[AST], publics: set[Predicate], aux: Auxiliaries, ground_terms: set[str]) -> Auxiliaries

Check the auxiliaries for conflicts with the two programs.

check_and_rename_privates(left: list[AST], right: list[AST], publics: set[Predicate]) -> tuple[list[AST], list[AST]]

Check if the private predicates of the programs are distinct and rename conflicting predicates if necessary.

collect_ground_terms(program: list[AST]) -> set[str]

Collect all ground terms occurring in a program.