"""Check the preregistration's extrapolation denominator, not its variance.""" from fractions import Fraction import hashlib import json from pathlib import Path import sys EXPECTED = "2fe85c5017e9f72f32dd2717567d7c26ba873581da81e27a64a06c39b906a52f" source = Path(sys.argv[1]).read_bytes() assert hashlib.sha256(source).hexdigest() == EXPECTED, "Source version changed" text = source.decode("utf-8") section = text.split("### 4a.", 1)[1].split("### 4b.", 1)[0] assert "thirty times" in section and "all ten points" in section points = {name: Fraction(value) for name, value in (("first", "0.59646"), ("fit_first", "0.42861"), ("ninth", "0.29508"), ("tenth", "0.28514"))} assert all(str(float(value)) in section for value in points.values()) d = points["tenth"] spans = {"all_ten": points["first"] - d, "fit_subset": points["fit_first"] - d, "last_increment": points["ninth"] - d} ratios = {name: d / span for name, span in spans.items()} half_unit = Fraction(5, 1_000_000) bounds = {name: [(d - half_unit) / (span + 2 * half_unit), (d + half_unit) / (span - 2 * half_unit)] for name, span in spans.items()} assert Fraction(9, 10) < bounds["all_ten"][0] < bounds["all_ten"][1] < 1 assert Fraction(19, 10) < bounds["fit_subset"][0] < bounds["fit_subset"][1] < 2 assert 28 < bounds["last_increment"][0] < bounds["last_increment"][1] < 30 assert bounds["all_ten"][1] < 25, "The claimed all-ten factor survived" assert bounds["fit_subset"][1] < 25, "The claimed fitted-range factor survived" print(json.dumps({ "source_sha256": EXPECTED, "scope": "Arithmetic on published abscissae; no Var(41) computation", "span": {k: str(v) for k, v in spans.items()}, "distance_over_span": {k: format(float(v), ".6f") for k, v in ratios.items()}, "rounding_enclosures": {k: [format(float(v), ".6f") for v in pair] for k, pair in bounds.items()}, "incorrect_all_ten_denominator_rejected": True, }, sort_keys=True, indent=2))