import z3

TRUE = z3.BoolVal(True)
FALSE = z3.BoolVal(False)


_const_counter = 0


def fresh_const(sort: z3.SortRef) -> z3.Const:
    global _const_counter
    _const_counter += 1
    return z3.Const(f"{sort.name()}!{_const_counter}", sort)


def fresh_consts(*sorts: z3.SortRef) -> list[z3.Const]:
    return [fresh_const(sort) for sort in sorts]


def consts(*defs: tuple[str, z3.SortRef]) -> list[z3.Const]:
    return [z3.Const(name, sort) for name, sort in defs]
