import z3

from common import config
from common.relations import Relation
from fest.z3_utils import find_order_relation


@config(induction_relations=config.axer.induction_relations)
def find_induction_relation(
    formula: z3.BoolRef, *, induction_relations: list[str] = []
) -> Relation | None:
    if (
        order := find_order_relation(formula, order_relations=induction_relations)
    ) is not None:
        return order

    return find_order_relation(formula)
