newground.main_transformer_helpers.helper_part module

General helper module for the reduction.

class newground.main_transformer_helpers.helper_part.HelperPart

Bases: object

General helper class for the reduction.

classmethod add_atom_to_unfoundedness_check(head_string, unfound_atom, unfounded_rules, current_rule_position)

Adds an atom to the ‘’unfoundedness-check’’, i.e., the check at the end of the program (that nothing is unfound).

classmethod generate_head_atom(combination, h_vars, h_args, f_vars_needed, combination_associated_variables, current_rule_position)

Needed for foundedness checks. Generates the head atom of a foundedness-check-rule.

classmethod get_domain_values_from_rule_variable(rule, variable, domain, safe_variables_rules, rule_variables_predicates={})

Provided a rule number and a variable in that rule, one gets the domain of this variable. If applicable it automatically calculates the intersection of different domains.

classmethod get_vars_needed(h_vars, f_vars, f_rem, graph)

Needed for foundedness, gets the reachable variables from one variables.

classmethod ignore_exception(ignore_exception=<class 'Exception'>, default_value=None)

Decorator for ignoring exception from a function e.g. @ignore_exception(DivideByZero) e.g.2. ignore_exception(DivideByZero)(Divide)(2/0)