"""Verify the mass obstruction from the extract of the published 72-grid witness.""" import json from fractions import Fraction as F from math import factorial, prod from pathlib import Path def class_code(parts): small = sorted((j for j in parts if j <= 26), reverse=True) rough = [j for j in parts if 26 < j < 36] large = [j for j in parts if j >= 36] key = [len(small), sum(small), len(rough), max(rough, default=0), max(large, default=0)] + (small + [0, 0, 0])[:3] radices = [37, 73, 3, 37, 73, 27, 27, 27] return sum(x * prod(radices[i+1:]) for i, x in enumerate(key)) data = json.loads(Path(__file__).with_name('grid72.json').read_text()) radius = F(data['basis_radius']) upper = {} for entry in data['entries']: parts = tuple(entry['parts']) assert sum(parts) == 72 and min(parts) >= 2 and class_code(parts) == entry['class_code'] value = F(entry['grid_value']) if entry['basis_correction'] is not None: value += F(entry['basis_correction']) + radius upper[parts] = value target = (2,) * 7 + (58,) compatible = {target} for i in range(7): one = list(target) one[i] += 1 one[-1] -= 1 compatible.add(tuple(sorted(one))) for j in range(i, 7): two = one.copy() two[j] += 1 two[-1] -= 1 compatible.add(tuple(sorted(two))) assert len(compatible) == 4 assert all(upper[row] <= 0 for row in compatible) volume = F(74, 72) * F(2**7, factorial(7)) ratio = -upper[target] / volume assert ratio > F('9.15227') print('overlapping types', len(compatible), 'volume upper', volume) print('magnitude of negative mass divided by volume upper', ratio) print('lower bound exceeds 9.15227')