goldcopy.py
Checks: FLUSH: The cylinder bound theorem; rule; pattern; observation.
Cited on: FLUSH.
To run it: save goldcopy.py, with defer.py, flush.py, goldclimb.py, goldcps.py, goldelta.py, goldfix.py, goldren.py, goldroot.py, goldsurv.py, goldtile.py, ostrowski.py, shifted.py beside it; standard library only.
"""goldcopy.py -- do the climb's five full copies close alone at the R-images?
Frozen before this engine, copied whole:
QUESTION. At x = R(y), y a survivor, the climb puts the copies
C_A = {T_s(v) : v in A_inf(y), s in tau_A}, T_s(v) = phi^-2 v + s, inside
A_inf(x), and C_B = {T'_r(u) : u in B_inf(y), r in tau_B} inside B_inf(x)
(the golden climb, a theorem at every y in [0, 1)). delta_1's
tile closes at the 8 R-images past delta_1 (goldtile.py), its translates
holding C_A. Does C_A alone close, B free: is closed(C_A, B_x) all of
C_A?
THE 8, by hand (x = R(y), R(y) = 1/phi + y/phi^2, x with |A_inf| >= 18):
y = delta_1, delta_2, delta_3, phi/2, (-2 + 4phi)/5, (2 + 5phi)/11,
(-3 + 3phi)/2, (-1 + 7phi)/11. Every y is >= 1/phi: none sits where
Gamma's eleven close alone (goldclimb's control (a), [0, 1/phi)).
RE-DERIVED BY HAND. The copy identity: phi(C - T_s v) = T_s'(phi(c - v))
with s' = phi C - phi s - c/phi; phi(E - T_s v) = T'_r(phi(e - v)), r =
phi E - phi s - e/phi; and with x = 1/phi + y/phi^2, phi(C' + x - phi -
T'_r u) = T_s'(phi(c' + y - phi - u)), s' = phi C' - phi r - (c' + 1)/phi
(each by expanding; phi^2 = phi + 1). The game is on POINTS: a point of
C_A may be the copy of several (s, v) (phi^-2 = T_(phi^-2)(0) =
T_(phi^-4)(1/phi) at y = delta_1), and its moves are the point's.
Where y < 1: c = 0 plays on Z0 = [1/phi - y, y/phi - phi^-2], c = 1 on
[1/phi - y/phi^2, (1 + y)/phi]; Z0's top lies below c = 1's foot iff y
< 1, so a v of A_y in Z0 plays c = 0 alone (Z0 is nonempty iff y >=
1/phi; at y = delta_1, Z0 = {0}, and 0 is in A_(delta_1)). Likewise c' =
-1 on [-2, phi y - 3] and c' = 0 on [-2 + y/phi, phi y - 2] are disjoint
iff y < 1. By the climb's tables only three tau digits leave tau: c = 0 from
s = phi^-2 (to s' = 1 at C = 1, -1/phi at C = 0), c' = -1 from r = -1/phi
and phi^-2. Every e reply stays in tau_B, so every point of C_A has its
B successor in C_B, inside B_x. A rescue is a coincidence of points:
T_1(w) = T_(2phi^-2)(w + 1/phi), as phi^2(1 - 2phi^-2) = 1/phi.
PREDICTIONS.
Q1 (TRANSPLANT from [0, 1/phi), where the eleven close alone) at every
one of the 8, closed(C_A, B_x) is all of C_A.
Q2 (a guess) closed(C_A, C_B) is all of (C_A, C_B) at every one of the 8.
Q3 (by hand, above) every point of C_A or C_B that loses its last move
at the first round of closed(C_A, C_B) is a copy at s = phi^-2 of a v
in Z0, or at r in {-1/phi, phi^-2} of a u playing c' = -1 alone.
KILL (one print): "the five full copies, B free, close whole at n of 8
R-images, in part at m of 8"; the theorem's lead stands iff n = 8
(then the hand closure on Gamma's eleven is owed); else the golden
fixed sets close as a direction, its reopen clause beside the
climb's front.
Controls, read before the kill: (a) a known answer, y = delta_0, x =
delta_1: C_A is all of A_(delta_1) (the climb: tau_A's five T_s send
{1/phi} to delta_1's fixed set, one point each), closed whole, B
free; (b) the climb's inclusion: C_A inside A_x and C_B inside B_x
at all 8 (a theorem); (c) a plant: at x = delta_2, C_A less its s =
2phi^-2 copies loses the point phi^-2 (its successors -1/phi and 1,
1 = T_(2phi^-2)(1/phi) alone among the copies, by hand), read in the
direction it pushes: fewer closed points than the plant holds.
Statistic per x: |C_A|, |A_x|, closed |A| both arms; Q3's first-round
deaths by kind.
FINDINGS (copied from the print).
Controls held: (a) delta_0 -> delta_1, C_A 5 of 5, closed 5; (b) the
inclusions at all 8; (c) the plant at delta_2 holds 14, closes 0; the
c = 0 alone points all in Z0 by hand.
KILL MISSED, Q1 held: "the five full copies, B free, close whole at 8
of 8 R-images, in part at 0 of 8" (|C_A| 17 at delta_2 to 601 at
delta_4, 0.40 to 0.55 of |A_x|): the lead stands, the hand closure
on Gamma's eleven reduced below to the shift. Q2 held: the copy game (C_A,
C_B) closes whole at 8 of 8. Q3 held vacuously: no first-round death
at all, though c = 0 plays alone at 1 to 73 points of A_y and c' = -1
at 1 to 107 of B_y.
After the first run, the rescue: every such v has v + 1/phi in A_y,
and every such u has u + 1/phi in B_y, at all 8, and over all 22
survivors 4086 of 4086 and 6275 of 6275 (a pattern). By hand, sigma
= + 1/phi conjugates digit d at v to d + 1 at sigma v: phi((d + 1) -
sigma v) = sigma(phi(d - v)), for c, e and c' alike; and T_(phi^-2) v
= T_(phi^-4)(sigma v), T'_(-1/phi) u = T'_(4 - 3phi)(sigma u),
T'_(phi^-2) u = T'_(phi^-4)(sigma u), three labels the climb's table keeps
in tau under every digit. So wherever the SHIFT holds (sigma of A_y's
c = 0 alone points in A_y, of B_y's c' = -1 alone points in B_y), the
copies close pointwise on Gamma's eleven labels, each point read at a
safe label (c' = 1's set [-1 + y/phi, phi y - 1] misses c' = -1's
too, y < 2). The SHIFT is goldshift.py's theorem at every y in
[1/phi, 1), and below 1/phi no point plays c = 0 or c' = -1 alone
(Z0 empty, phi y - 3 < -2): the copies close on themselves in
G_(R y) at every y in [0, 1), a theorem by this reduction, read by
hand twice.
RUN RECORD. 5 of 5, 41.9 s, 218.2 MB (the record pin added at the
move to this folder; 4 of 4, 42.5 s, 218.5 MB before). The
rescue print and the 22-survivor SHIFT arm came after the first run,
which printed the kill as above; the Z0 check is an addition to the
frozen controls (a) to (c); the rows print before the controls, and a
failed control prints no verdict, the rows standing. first_round reads
B's deaths against the unpruned C_A, closed()'s first pass against the
pruned one: equal here, no A point dying.
Run: python goldcopy.py
"""
import os
import sys
import time
os.environ.setdefault("OPENBLAS_NUM_THREADS", "1")
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
import goldroot as gr # noqa
import goldtile as gt # noqa
CHECKS = []
TAU_A = [gr.q(*t) for t in gr.goldren.TAU_A[:5]]
TAU_B = [gr.q(*t) for t in gr.goldren.TAU_B]
E2 = gr.E2
S3 = gr.q(2, -1) # phi^-2, tau_A's point 3
S5 = gr.q(4, -2) # 2 phi^-2, tau_A's point 5
IPHI_NEG = gr.q(1, -1) # -1/phi
def check(name, ok, detail=""):
CHECKS.append(bool(ok))
print(f" [{'PASS' if ok else 'FAIL'}] {name}"
+ (f" -- {detail}" if detail else ""))
def T(s, v):
return gr.add(gr.mul(E2, v), s)
def labels(A_y, taus):
"""point -> list of (s, v) whose copy it is."""
lab = {}
for s in taus:
for v in A_y:
lab.setdefault(T(s, v), []).append((s, v))
return lab
def game(H, dq):
A, B = (gr.pts(S) for S in gr.fixed(H))
mA, mB = gt.fast_moves(dq, A, B)
return A, B, mA, mB
def first_round(mA, mB, XA, XB):
dA = {i for i in XA if not any(j in XA for _, j in mA[i][0])
or not any(j in XB for _, j in mA[i][1])}
dB = {i for i in XB if not any(j in XA for _, j in mB[i])}
return dA, dB
def main():
t0 = time.time()
runs = {x: gr.run(gr.spt(*x))["d"] for x in gr.SURV}
sq = {x: gr.pt_q(gr.spt(*x)) for x in gr.SURV}
print(f"runs: {len(runs)} survivors ({time.time() - t0:.1f} s)")
for v in (S3, S5, IPHI_NEG):
assert v in TAU_A + TAU_B
pairs = []
for x in gr.SURV:
pre = gr.sub(gr.mul(gr.P2, sq[x]), gr.PHI)
ys = [z for z in gr.SURV if gr.cmp(sq[z], pre) == 0]
if ys:
pairs.append((ys[0], x))
print(f"R-images among the survivors: {len(pairs)}")
rows = []
for y, x in pairs:
A_y, B_y, mAy, mBy = game(runs[y], sq[y])
A_x, B_x, mA, mB = game(runs[x], sq[x])
ixA = {w: i for i, w in enumerate(A_x)}
ixB = {w: i for i, w in enumerate(B_x)}
labA, labB = labels(A_y, TAU_A), labels(B_y, TAU_B)
CA, CB = set(labA), set(labB)
inc = CA <= set(ixA) and CB <= set(ixB)
iCA = {ixA[w] for w in CA if w in ixA}
iCB = {ixB[w] for w in CB if w in ixB}
free = gr.closed(mA, mB, iCA, set(range(len(B_x))))
copy = gr.closed(mA, mB, iCA, iCB)
# Q3: the first round's deaths in the copy game, by kind
cz = {v for i, v in enumerate(A_y)
if {c for c, _ in mAy[i][0]} == {0}}
cm = {u for i, u in enumerate(B_y)
if {c for c, _ in mBy[i]} == {-1}}
dA, dB = first_round(mA, mB, iCA, iCB)
badA = [A_x[i] for i in dA
if not all(s == S3 and v in cz for s, v in labA[A_x[i]])]
badB = [B_x[i] for i in dB
if not all(r in (IPHI_NEG, S3) and u in cm
for r, u in labB[B_x[i]])]
z0 = [v for v in cz if not (gr.fl(v) >= 1 / gt.PHI - gr.fl(sq[y]) - 1e-12
and gr.fl(v) <= gr.fl(sq[y]) / gt.PHI
- gt.PHI ** -2 + 1e-12)]
# after the first run: which coincidence rescues the leaving digits
SAy, SBy = set(A_y), set(B_y)
sh = [v for v in cz if gr.add(v, gr.IPHI) in SAy]
su = [v for v in cz
if gr.add(gr.mul(gr.q(0, -1), v), gr.IPHI) in SAy]
other = [v for v in cz
if any(s != S3 for s, _ in labA[T(S3, v)])]
shB = [u for u in cm if gr.add(u, gr.IPHI) in SBy]
print(f" rescue: of {len(cz)} c = 0 alone, v + 1/phi in A_y at "
f"{len(sh)}, 1/phi - phi v at {len(su)}, T_(phi^-2) v another "
f"label at {len(other)}; of {len(cm)} c' = -1 alone, u + 1/phi "
f"in B_y at {len(shB)}")
rows.append(dict(y=y, x=x, nAy=len(A_y), nBy=len(B_y), nCA=len(CA),
nCB=len(CB), nAx=len(A_x), nBx=len(B_x), inc=inc,
free=(len(free[0]), len(free[1])),
copy=(len(copy[0]), len(copy[1])),
dA=len(dA), dB=len(dB), badA=badA, badB=badB,
cz=len(cz), cm=len(cm), z0=z0,
iCA=iCA, mA=mA, mB=mB, A_y=A_y, ixA=ixA,
nB=len(B_x)))
name = gr.show(sq[x])
r = rows[-1]
print(f" x = {name:20s} y = {gr.show(sq[y]):18s} |A_y| {r['nAy']:4d} "
f"|C_A| {r['nCA']:5d} |A_x| {r['nAx']:5d} B free: closed "
f"{r['free'][0]}/{r['free'][1]} copy game: closed "
f"{r['copy'][0]}/{r['copy'][1]} of {r['nCA']}/{r['nCB']}")
print(f" c = 0 alone at {r['cz']} of A_y, c' = -1 alone at "
f"{r['cm']} of B_y; first-round deaths A {r['dA']}, B "
f"{r['dB']}; off the named kinds A {len(badA)}, B {len(badB)}")
print(f"== after the first run: the shift by 1/phi at all "
f"{len(gr.SURV)} survivors")
nz = nzb = okz = okzb = 0
for y in gr.SURV:
A_y, B_y, mAy, mBy = game(runs[y], sq[y])
SAy, SBy = set(A_y), set(B_y)
cz = [v for i, v in enumerate(A_y)
if {c for c, _ in mAy[i][0]} == {0}]
cm = [u for i, u in enumerate(B_y) if {c for c, _ in mBy[i]} == {-1}]
a = sum(gr.add(v, gr.IPHI) in SAy for v in cz)
b = sum(gr.add(u, gr.IPHI) in SBy for u in cm)
nz, nzb, okz, okzb = nz + len(cz), nzb + len(cm), okz + a, okzb + b
if a < len(cz) or b < len(cm):
print(f" y = {gr.show(sq[y])}: {a} of {len(cz)}, {b} of "
f"{len(cm)}")
print(f" SHIFT: v + 1/phi in A_y at {okz} of {nz} v playing c = 0 "
f"alone; u + 1/phi in B_y at {okzb} of {nzb} u playing c' = -1 "
f"alone, over {len(gr.SURV)} survivors")
print("== controls")
d0 = [r for r in rows if r["y"] == (0, 0, 1)]
ok_a = (len(d0) == 1 and d0[0]["nCA"] == d0[0]["nAx"]
and d0[0]["free"][0] == d0[0]["nCA"])
check("(a) y = delta_0, x = delta_1: C_A is all of A_x, closed whole, "
"B free", ok_a, f"{d0[0]['nCA']} of {d0[0]['nAx']}, closed "
f"{d0[0]['free'][0]}" if d0 else "missing")
big = [r for r in rows if r["nAx"] >= 18]
check(f"(b) C_A in A_x and C_B in B_x at all {len(big)} R-images past "
"delta_1", len(big) == 8 and all(r["inc"] for r in big))
d2 = [r for r in rows if r["y"] == (-1, 1, 1)][0]
lab5 = labels(d2["A_y"], [s for s in TAU_A if s != S5])
iP = {d2["ixA"][w] for w in lab5}
pl = gr.closed(d2["mA"], d2["mB"], iP, set(range(d2["nB"])))
lost = d2["ixA"][S3] in iP and d2["ixA"][S3] not in pl[0]
one = gr.q(1)
check("(c) the plant at x = delta_2: C_A less its s = 2phi^-2 copies "
"loses phi^-2, fewer closed than it holds",
lost and len(pl[0]) < len(iP) and one not in lab5,
f"plant {len(iP)}, closed {len(pl[0])}")
check("Z0 by hand holds every v of A_y playing c = 0 alone",
all(not r["z0"] for r in big))
ctrl = all(CHECKS)
print("== the kill")
whole = [r for r in big if r["free"][0] == r["nCA"]]
part = [r for r in big if 0 < r["free"][0] < r["nCA"]]
print(f"KILL: the five full copies, B free, close whole at {len(whole)} "
f"of {len(big)} R-images, in part at {len(part)} of {len(big)}")
print(f" Q1 {'held' if len(whole) == 8 else 'KILLED'}; "
f"{'the lead stands' if len(whole) == 8 else 'the lead dies'}")
cw = [r for r in big if r["copy"] == (r["nCA"], r["nCB"])]
print(f" Q2: the copy game closes whole at {len(cw)} of {len(big)}")
q3 = all(not r["badA"] and not r["badB"] for r in big)
nd = sum(r["dA"] + r["dB"] for r in big)
print(f" Q3: every first-round death of the named kinds: {q3} "
f"({nd} deaths)")
check("the record: whole at 8 of 8, the copy game at 8 of 8, the "
"SHIFT at 4086 of 4086 and 6275 of 6275",
len(whole) == 8 and len(cw) == 8
and (okz, nz, okzb, nzb) == (4086, 4086, 6275, 6275))
if not ctrl:
print("CONTROL FAILED: no verdict")
print(f"\n{sum(CHECKS)} of {len(CHECKS)} checks, "
f"{time.time() - t0:.1f} s")
return 0 if all(CHECKS) else 1
if __name__ == "__main__":
sys.exit(main())