Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
metric-geometry
topology
transfinite-dimension
ordinal-analysis
information-based-complexity
Download verification/verify_examples.py from PureOne/transfinite-computational-collapse-theory: direct link, hf CLI and curl.
- Browser
- Download file 2.88 kB
-
https://huggingface.co/datasets/PureOne/transfinite-computational-collapse-theory/resolve/main/verification/verify_examples.py
- Command line
-
hf download hf://datasets/PureOne/transfinite-computational-collapse-theory/verification/verify_examples.py
-
curl -L -o verify_examples.py https://huggingface.co/datasets/PureOne/transfinite-computational-collapse-theory/resolve/main/verification/verify_examples.py
2.88 kB
| """Check selected finite examples from the TCCT manuscript using exact arithmetic.""" | |
| from fractions import Fraction | |
| from itertools import product | |
| def require(condition, message): | |
| if not condition: | |
| raise AssertionError(message) | |
| def check_query_counts(): | |
| tolerance = Fraction(1, 1024) | |
| geometric_tail = lambda m: Fraction(1, 2**m) | |
| reciprocal_tail = lambda m: Fraction(1, m + 1) | |
| for tail, count in ((geometric_tail, 10), (reciprocal_tail, 1023)): | |
| require(tail(count) <= tolerance < tail(count - 1), f"Wrong minimal count: {count}") | |
| print("Theorem 5.2: the optimal query counts are 10 and 1,023.") | |
| def check_forward_differences(): | |
| for dimension in range(1, 5): | |
| corners = tuple(product((0, 1), repeat=dimension)) | |
| for side in range(1, 6): | |
| values = { | |
| point: (3 + sum((axis + 1) * x**2 for axis, x in enumerate(point))) ** (dimension + 1) | |
| for point in product(range(side + 1), repeat=dimension) | |
| } | |
| mixed_sum = sum( | |
| (-1) ** (dimension - sum(corner)) | |
| * values[tuple(x + offset for x, offset in zip(point, corner))] | |
| for point in product(range(side), repeat=dimension) | |
| for corner in corners | |
| ) | |
| boundary_sum = sum( | |
| (-1) ** (dimension - sum(corner)) * values[tuple(side * bit for bit in corner)] | |
| for corner in corners | |
| ) | |
| require(mixed_sum == boundary_sum, f"Mismatch at dimension {dimension}, side {side}") | |
| print("Equation (13): checked exact telescoping on 20 finite grids.") | |
| def check_transport(): | |
| q = Fraction | |
| operator = ((q(1, 2), q(1, 4)), (q(1, 8), q(1, 4))) | |
| emission = (q(1, 4), q(5, 8)) | |
| exact = (q(1), q(1)) | |
| approximation = (q(61, 64), q(15, 16)) | |
| fixed_point = tuple(emitted + sum(weight * value for weight, value in zip(row, exact)) | |
| for emitted, row in zip(emission, operator)) | |
| require(fixed_point == exact, "The claimed exact radiance is not a fixed point.") | |
| residual = tuple( | |
| estimate - sum(weight * v for weight, v in zip(row, approximation)) - emitted | |
| for estimate, row, emitted in zip(approximation, operator, emission) | |
| ) | |
| require(residual == (-q(1, 128), -q(21, 512)), "Incorrect transport residual.") | |
| boundary_error = abs(exact[1] - approximation[1]) | |
| self_coupling, boundary_coupling = operator[0] | |
| certificate = (abs(residual[0]) + boundary_coupling * boundary_error) / (1 - self_coupling) | |
| require(certificate == abs(exact[0] - approximation[0]) == q(3, 64), | |
| "The interior error does not match the certificate.") | |
| print("Theorem 7.1 example: the error attains the bound 3/64.") | |
| if __name__ == "__main__": | |
| check_query_counts() | |
| check_forward_differences() | |
| check_transport() | |