Пример #1
0
def get_recursive_calls_amount(head: Atom, body: Body) -> int:
    rec_count = 0
    for predicate in _get_body_predicates_list(body):
        if head.get_predicate() == predicate:
            rec_count += 1

    return rec_count
Пример #2
0
def endless_recursion_exists(head: Atom, body: Body) -> bool:
    for literal in body.get_literals():
        if head.get_predicate() == literal.get_predicate():
            if literal.get_variables()[0] == head.get_variables()[0]:
                return True
            return False

    return False