"""slackzero.py -- at slack 0, does every unequal three-atom vector fail? QUESTION. Three atoms, masses m, a, b (sum 1), T = 1 - m, m < a. The hand construction: atom 1's row (1 - P, P, 0), atom 2's (1, 0, 0), atom 0's (x, y, y), y = (1 - x)/2, P in [2/5, 1/2), P < x < x_max, x_max = min(aP/m, 1 - P, and 2aP/m - 1 when 2m <= a). By hand, t* = P < x and atom 0 is forced-abandoned, so at slack 0 a three-atom vector keeps the abandonment condition at every row iff its masses are equal. BY HAND (frozen before this script, with the predictions). PROOF. Coverage m X + a Y + b Z, X = (0, x, x + y, 1), Y = (0, 1 - P, 1, 1), Z = (0, 1, 1, 1) by size; the bar a + b. Abandoning: Y = Z = 1, cheapest (0, 2, 1) at 2a + b, so OPT <= 2a + b. Serving at cost <= 2a + b misses: s2 = 0, s1 >= 2: m s0 <= b against m X(s0) >= b; X(s0) < 1 <= s0 at s0 <= 2, and s0 = 3 needs 3m <= b <= m. s2 = 0, s1 = 0: m X <= m < a. s2 = 0, s1 = 1: needs m X(s0) >= aP + b. s0 = 1: m x < aP. s0 = 2 (affordable iff 2m <= a + b): m(1 + x)/2 < (a + b)(2 - P)/4, below aP + b iff a(2 - 5P) < b(2 + P), true at P >= 2/5. s0 = 3 (iff 3m <= a + b): m <= (a + b)/3 < aP + b as P > 1/3. s2 >= 1, s1 = 0: m X >= a, impossible (m < a). s2 >= 1, s1 = 1: needs m X(s0) >= aP. s0 = 1: no. s0 = 2 (iff 2m <= a): x < 2aP/m - 1 gives m(1 + x)/2 < aP. s0 = 3 (iff 3m <= a): m <= a/3 < aP. s2 >= 1, s1 >= 2, s0 >= 1: cost > 2a + b. Level: at t in (P, x] the pairs cover m x + a(1 - P) + b < a + b; at t = P they cover >= a + b. So t* = P. The interval is nonempty: aP/m > P, 1 - P > P, and at 2m <= a, 2aP/m - 1 > P iff P > m/(2a - m) <= 1/3. COROLLARY. At slack 0 only atoms of mass 1 - T can be abandoned, so a vector qualifies iff no lightest atom is lighter than another: iff the masses are equal (equal masses qualify, fates.py::section_equal). TRANSPLANT: none; H (P = 7/20 < 2/5) is a cell outside this family. PREDICTIONS (frozen before this script). (1) At 2,000 exact vectors drawn at slack 0 with m < a (m, a, b on the 1/1000, seed 3), P and x drawn in the stated ranges, fates.Fates reads atom 0 A and sets.Anatomy's t* = P (strongly; the proof). (2) With x drawn above aP/m (and below 1 - P), (1, 1, 1) covers and atom 0 is not forced-abandoned at every draw (strongly). KILL (frozen; what the script PRINTS): "KILL slack0: construction cells failing n of 2000" fires iff n >= 1. CONTROL: fates.Fates reads ABOVE, BELOW, DA, DS, FA, FS as fatecensus.py's hand cells print (ASS, SAS, SSA, SAS, AAS, SSS), at the module's T = 7/10, before T is moved. FINDINGS. SCOPE: the frozen claim said "m the least" and the draws never enforced m <= b (b < m at 1071 of the 2000, slack m - b > 0 there); the proof never uses it. So what holds is wider: any three-atom vector with an atom of mass exactly 1 - T lighter than another fails at some rows, at any slack; at slack 0 (that atom the least) the condition holds at every row iff the masses are equal. The power check first counted f == "A" and t == P, which the level alone settles above aP/m (t* = x there); it now counts the fate alone. The frozen COROLLARY's pointer for equal masses now names fates.py. The kill misses: "KILL slack0: construction cells failing 0 of 2000" (941 draws with 2m <= a, where the third bound binds). (1) and (2) held: above aP/m the construction holds at 0 of 500 draws. CONTROL: the six hand cells read ASS, SAS, SSA, SAS, AAS, SSS; each read asserts the engine's bar is 1 - m. Run: 3/3 checks, 0.7 s, peak commit 9.1 MB. RUN: python slackzero.py. """ import random import sys import time from fractions import Fraction as F import sets from fates import ABOVE, BELOW, DA, DS, FA, FS, Fates from sets import Cell CHECKS = [] def check(name, ok, detail=""): CHECKS.append(bool(ok)) tail = f" ({detail})" if detail else "" print(f" {'PASS' if ok else 'FAIL'} {name}{tail}", flush=True) def x_max(m, a, P): top = min(a * P / m, 1 - P) if 2 * m <= a: top = min(top, 2 * a * P / m - 1) return top def read(m, a, b, P, x): """Atom 0's fate and t* at the construction's cell, T = 1 - m.""" sets.T = 1 - m y = (1 - x) / 2 cell = Cell("c", [m, a, b], [[x, y, y], [1 - P, P, F(0)], [F(1), F(0), F(0)]]) fx = Fates(cell) assert F(fx.an.sc.TQ, fx.an.sc.Q) == 1 - m, "T did not move" return fx.fate_of(0), fx.an.t def draw(rng, plant=False): while True: m = F(rng.randint(10, 490), 1000) a = F(rng.randint(int(m * 1000) + 1, 999 - int(m * 1000)), 1000) b = 1 - m - a P = F(rng.randint(400, 499), 1000) if plant: lo, hi = a * P / m, 1 - P else: lo, hi = P, x_max(m, a, P) if b > 0 and hi > lo: return m, a, b, P, lo + (hi - lo) * F(rng.randint(1, 999), 1000) def main(): t0 = time.time() print("CONTROL") want = {"ABOVE": "ASS", "BELOW": "SAS", "DA": "SSA", "DS": "SAS", "FA": "AAS", "FS": "SSS"} got = {} for name, cell in (("ABOVE", ABOVE), ("BELOW", BELOW), ("DA", DA), ("DS", DS), ("FA", FA), ("FS", FS)): fx = Fates(cell) got[name] = "".join(fx.fate_of(r) for r in range(3)) print(f" hand cells: {got}") check("CONTROL: the six hand cells' fates at T = 7/10", got == want) if not all(CHECKS): print("CONTROL FAILED: nothing below is read.") return 1 print("THE CONSTRUCTION") rng = random.Random(3) bad, first, small, wide = 0, None, 0, 0 for _ in range(2000): m, a, b, P, x = draw(rng) small += 2 * m <= a wide += b < m f, t = read(m, a, b, P, x) if f != "A" or t != P: bad += 1 first = first or (m, a, b, P, x, f, t) print(f" 2000 draws, {small} with 2m <= a, {wide} at slack m - b > 0;" f" first failure {first}") print(f"KILL slack0: construction cells failing {bad} of 2000") print(f"KILL fires: {bad >= 1}") check("(1) atom 0 forced-abandoned, t* = P, at every draw", bad == 0) print("THE KILL'S POWER: x above aP/m") rng = random.Random(4) held = 0 for _ in range(500): m, a, b, P, x = draw(rng, plant=True) f, t = read(m, a, b, P, x) held += f == "A" print(f" 500 draws above aP/m: atom 0 forced-abandoned at {held}") check("(2) above aP/m atom 0 is never forced-abandoned", held == 0) print(f"\n{sum(CHECKS)}/{len(CHECKS)} checks, {time.time() - t0:.1f} s") return 0 if all(CHECKS) else 1 if __name__ == "__main__": try: code = main() finally: sets.T = F(7, 10) sys.exit(code)