"""Finite checks of an abstract counterexample, not of the twin-gap function.""" import math def q(t): return math.sqrt(t) * (1 + math.sin(math.log(t))) def q_prime(t): return (0.5 + 0.5 * math.sin(math.log(t)) + math.cos(math.log(t))) / math.sqrt(t) def main(): lower = (1 - math.sqrt(5)) / 2 upper = (1 + math.sqrt(5)) / 2 assert 2 + lower / math.sqrt(math.log(2)) > 0 assert 2 + upper / math.sqrt(math.log(2)) < 4 derivative_checks = 0 for i in range(401): t = math.log(2) * math.exp(i / 10) assert lower / math.sqrt(t) - 1e-12 <= q_prime(t) assert q_prime(t) <= upper / math.sqrt(t) + 1e-12 assert 0 < 2 + q_prime(t) < 4 derivative_checks += 1 coefficient = math.sqrt(2) * (1 - math.cos(math.log(2))) assert coefficient > 0 diagonal_checks = 0 previous = 0 for j in range(4): t = math.exp(1.5 * math.pi + 2 * math.pi * j) actual = q(2 * t) - 2 * q(t) expected = coefficient * math.sqrt(t) assert math.isclose(actual, expected, rel_tol=1e-12, abs_tol=1e-10) assert actual > previous previous = actual diagonal_checks += 1 fixed_base_checks = 0 for b in (2, 3, 16, 82, 1000): u = math.log(b) for j in range(31): k = 2**j actual = abs(q((k + 1) * u) - q(k * u)) bound = upper * math.sqrt(u / k) assert actual <= bound + 1e-8 fixed_base_checks += 1 print(f"derivative_checks={derivative_checks}") print(f"diagonal_checks={diagonal_checks}") print(f"fixed_base_checks={fixed_base_checks}") print("PASS: finite checks only; the report supplies the unboundedness proof.") if __name__ == "__main__": main()