def binary_pascal_rank_certificate(
degree: int,
window: int,
weight: int,
*,
max_degree: int = 10,
max_columns: int = 4096,
) -> PascalRankCertificate:
"""Compute a finite F.60 certificate with explicit exponential-work limits."""
_validate_parameters(degree, window, weight)
if any(
not isinstance(value, int) or isinstance(value, bool) or value < 1
for value in (max_degree, max_columns)
):
raise ValueError("max_degree and max_columns must be positive integers.")
columns = sum(comb(degree, s) for s in range(window, weight + 1))
if degree > max_degree or columns > max_columns:
raise ValueError(
"Finite PBW certificate exceeds the declared degree/column budget."
)
rows, actual_columns = (
_certificate_rows(degree, window, weight) if columns else ((), 0)
)
if actual_columns != columns:
raise RuntimeError("PBW--forest column count disagrees with F.61.")
pivot_rows, pivot_columns, kernel = _eliminate(rows, columns)
return PascalRankCertificate(
degree, window, weight, columns, rows, pivot_rows, pivot_columns, kernel
)