goldroot.py
Checks: FLUSH: The cylinder bound theorem; rule; pattern; observation.
Cited on: FLUSH.
To run it: save goldroot.py, with defer.py, flush.py, goldclimb.py, goldelta.py, goldfix.py, goldren.py, goldsurv.py, ostrowski.py, shifted.py beside it; standard library only.
"""goldroot.py -- the passes at R delta no copy carries, at delta = phi^2/3.
QUESTION. delta = phi^2/3 = (1 + phi)/3 dies at L = 10 (A_9 empty);
delta' = R delta = (3 phi - 2)/3 is fixed at n = 10. The climb's sixteen
pairs (goldclimb.py) put T_t(A_n(delta) cut to I) inside A_n(delta') at
every n, so to n = 8 alone here. Which states of A_n(delta') lie in no
copy, and what game do they play? Is delta''s fixed set an affine copy
of some other survivor's?
DESIGN (frozen before this engine). Both games run on
goldren's gstep at point cells; every set is then read exactly in Q(phi),
a number x + y phi held as two Fractions, its sign that of 2x + y + y
sqrt5, decided in integers. Arms: (H) the histories at delta and
delta'; (C) coverage, k(w) for each fixed state w of delta', the
largest n with w in some pair's copy of A_n(delta) cut to its interval
(B states: the B pairs' copies of B_n), -1 if none, and per n the part
of A_n(delta') outside every copy (floats); (G) the fixed set's game,
each state's moves, the largest closed subgame inside {k(w) < K}; (S)
the roots, survivors of [0, delta_4] whose R-preimage phi^2 x - phi is
no survivor; (F) affine copies a A_inf(x'') + t_A inside A_inf(delta')
and a B_inf(x'') + t_B inside B_inf(delta'), a = +-phi^-j, j in -6..6,
over the survivors x'' with |A_inf| >= 2.
PREDICTIONS (frozen before the engine).
P1 (TRANSPLANT) A_inf(delta'), B_inf(delta') finite point sets in
(1/3)Z[phi], at least one point not in Z[phi].
P2 (a guess) the states with k(w) = 8 do not close alone, nor those
with k(w) < 8.
P3 (the second-map hunch) some other survivor's fixed set has an affine
copy inside delta''s.
P4 the roots are more than phi/2, 2/sqrt5, (2 + 5phi)/11, (-2 +
3phi)/3; delta_1 .. delta_4 are R-images.
KILL of P3 (one print): "affine copies into delta''s fixed set: 0".
Controls: (a) L*(phi^2/3) = 10, delta' fixed at n = 10; (b) the climb
on these numbers at every n <= 8; (c) the coverage read at 0 -> delta_1,
every state covered at its fixed depth; (d) the search finds the climb,
phi/2 -> (-3 + 3phi)/2 at a = phi^-2 for every t_A in tau_A, and a
planted break finds no copy from phi/2.
FINDINGS (copied from the print).
Controls held: (a) G_delta empty at A_9 (L* = 10), G_delta' fixed at
n = 10, equal to G_delta' run at its own point cell; (b) 0 misses;
(c) A(delta_1)'s five states each at k = 1, G_0's fixed depth (B: 9
of 11 at k = 1, two at 0, inclusion only); (d) at phi^-2 the search
finds eight whole-set translations, every s of tau_A among them, and
the target's T_s(a0) moved by 1/3 loses s (a plant caught by
construction, as membership is exact: it reads nothing; the positive
half stands); (e) the sixteen pairs'
images of phi/2's fixed set, 58 of 125 A states and 132 of 311 B, are
a closed subgame of 3/(2 phi)'s game.
(H) A_n(delta) sizes 1, 2, 5, 13, 22, 29, 27, 14, 2, 0, of measure 0
from n = 6 (points); A_n(delta') 1, 2, 5, 13, 34, 84, 164, 244, 290,
301, 301, of positive measure to n = 8 (0.01139 there). So from n = 6
the copies cover none of A_n(delta')'s measure: its pass is carried by
intervals no copy reaches past depth 5 (in measure; in states, 87 A
states have k >= 6, below).
P1 held: A_inf(delta') 301 points, B_inf 763, denominators 1 and 3.
Every survivor's fixed set is points in (1/d)Z[phi], d its
denominator (22 of 22).
(G) the fixed game is near-deterministic: every A state has one c-move
in the set and one or two e-moves (201 and 100), every B state one
c'-move. k on A: 1, 7, 30, 54, 53, 69, 41, 36, 10 states at k = 0 ..
8; on B 1, 8, 31, 91, 143, 132, 159, 95, 85, 18 at k = 0 .. 9.
P2 KILLED: the states at k < 8 hold a closed subgame of 289 of their
291 A states and all 660 B; at k < 7 none; the k = 8 states alone
none (B's 18 at k = 9 are in neither arm). The deepest-covered states
are dispensable, the k = 7 ones not.
P4 held: 13 of 22 survivors are roots: delta_0 (preimage below 0) and
phi/2, 2/sqrt5, (2 + 5phi)/11, (-1 + 7phi)/11, (-2 + 3phi)/3, (2 +
10phi)/19, (-1 + 3phi)/4, (7 + 13phi)/29, 3phi/5, (-9 + 17phi)/19,
(1 + 3phi)/6, (-4 + 20phi)/29, whose preimages are no survivor and
so die (each lies in [0, delta_3], inside goldsurv's S_40); delta_1 ..
delta_4 are R-images. The chain's |A_inf| 1, 5, 31, 211, 1437.
KILL of P3 missed: "affine copies into delta''s fixed set: 88139", every
one from delta_1's five points, at 10 of the 26 scales; the 7 other
sources searched (18 to 211 points) give 0 at every scale +-phi^-j,
|j| <= 6, 12 sources larger than delta''s set are not searched, and
delta_0's one point, which copies anywhere, is skipped.
The copies' unions hold closed subgames at two scales: +phi^0 (85 t_A
x 122 t_B, 181 of 301 A states) and -phi^-1 (53, inside the 181, as
the distinct count is 181). A
union of translates of delta_1's fixed set closing in delta''s game
is a translation game at scale 1, the second map P3 asked for, or an
artefact of a five-point set among 301: no null was run, so which is
open.
RUN RECORD. 8 of 8, 75.4 s, peak 224.0 MB under a 2048 MB cap. Changes
to what was frozen: control (c)'s check first read B's states too, which
was never frozen (B's copies are an inclusion, no known answer), and
failed there alone; it reads A now, B printed. Control (d)'s planted
break was frozen as the target's A set shifted by 1/3, which a
translation search cannot see, and first ran as an arbitrary point moved,
which the copy never used: it failed as a control; it runs now on the
point T_s(a0) the copy needs. (F)'s closedness, added after the first
run, reads each scale's union of copies, as one translation's image need
not close (the climb's own closes only as a family); control (e), added
with it, reads that instrument on the climb. Control (c) was frozen
as "k = its fixed depth", read as G_0's (n = 1; delta_1's n = 4 lies
past G_0's history); it reaches the eleven full pairs at k <= 1 only,
so the k up to 8 that P2 reads have no known-answer control. After a
review: (F) first printed the sum of the closed parts over scales (234
= 181 + 53) labelled as states, now each scale's and the distinct
count; the points and (1/d) check over all 22 added; P3's reading,
first "no support" by an untested abundance, restated as open. The
load-bearing FINDINGS figures are now checks (15 of 15, 76.9 s); printed
only: (H)'s 0.01139, (c)'s k = 1 (top is not asserted) and its B side,
(d)'s eight translations, (e)'s 58 of 125 and 132 of 311, P3's 85 x 122,
its 10 of 26 scales, its per-source zeros, sizes and the 12 not
searched, and P4's list past its four named roots and its [0, delta_3].
Run: python goldroot.py
"""
from collections import Counter
from fractions import Fraction as Fr
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)
from goldsurv import Cell, Pt # noqa
import goldren # noqa
import goldclimb # noqa
CHECKS = []
def check(name, ok, detail=""):
CHECKS.append(bool(ok))
print(f" [{'ok ' if ok else 'FAIL'}] {name}"
+ (f" -- {detail}" if detail else ""))
# ------------------------------------------------------------ Q(phi)
def q(x, y=0):
return (Fr(x), Fr(y))
def add(u, v):
return (u[0] + v[0], u[1] + v[1])
def sub(u, v):
return (u[0] - v[0], u[1] - v[1])
def mul(u, v):
return (u[0] * v[0] + u[1] * v[1], u[0] * v[1] + u[1] * v[0] + u[1] * v[1])
def sgn(u):
"""sign of x + y phi: 2x + y + y sqrt5, in integers."""
d = u[0].denominator * u[1].denominator
p, r = int((2 * u[0] + u[1]) * d), int(u[1] * d)
if p >= 0 and r >= 0:
return 1 if p or r else 0
if p <= 0 and r <= 0:
return -1
s = p * p - 5 * r * r
return (1 if s > 0 else -1) if p > 0 else (1 if s < 0 else -1)
def cmp(u, v):
return sgn(sub(u, v))
def fl(u):
return float(u[0]) + float(u[1]) * (1 + 5 ** .5) / 2
def show(u):
x, y = u
d = x.denominator * y.denominator // __import__("math").gcd(
x.denominator, y.denominator)
a, b = int(x * d), int(y * d)
s = f"{a} + {b}phi" if b >= 0 else f"{a} - {-b}phi"
return f"({s})/{d}" if d != 1 else f"({s})"
PHI = q(0, 1)
IPHI = q(-1, 1)
E2 = q(2, -1) # phi^-2
P2 = q(1, 1) # phi^2
def phipow(j):
x = q(1)
for _ in range(abs(j)):
x = mul(x, PHI if j > 0 else IPHI)
return x
def at(f, d):
"""linear function ((alpha), (beta)) of goldsurv at delta = d."""
return add(q(*f[0]), mul(q(*f[1]), d))
def ivs(S, d):
return [(at(x, d), at(y, d)) for x, y in S]
def pt_q(pt):
a, b, den = pt.exact()
return q(Fr(a, den), Fr(b, den))
# interval lists of Q(phi), sorted, closed
def norm(xs):
xs = sorted((iv for iv in xs if cmp(iv[0], iv[1]) <= 0),
key=lambda iv: fl(iv[0]))
out = []
for a, b in xs:
if out and cmp(a, out[-1][1]) <= 0:
if cmp(b, out[-1][1]) > 0:
out[-1] = (out[-1][0], b)
else:
out.append((a, b))
return out
def inter(U, V):
out = []
for a, b in U:
for c, d in V:
lo = a if cmp(a, c) >= 0 else c
hi = b if cmp(b, d) <= 0 else d
if cmp(lo, hi) <= 0:
out.append((lo, hi))
return norm(out)
def inside(X, Y):
return all(any(cmp(c, a) <= 0 and cmp(b, d) <= 0 for c, d in Y)
for a, b in X)
def affine(S, a, t):
out = []
for x, y in S:
u, v = add(mul(a, x), t), add(mul(a, y), t)
out.append((u, v) if cmp(u, v) <= 0 else (v, u))
return norm(out)
def measure(S):
return sum(fl(b) - fl(a) for a, b in S)
def minus(X, Y):
"""X less Y as float pieces (lo, hi), lengths >= 0; points kept."""
out = []
for a, b in X:
lo, hi = fl(a), fl(b)
cur = [(lo, hi)]
for c, d in Y:
c, d = fl(c), fl(d)
nxt = []
for u, v in cur:
if d < u - 1e-12 or c > v + 1e-12:
nxt.append((u, v))
continue
if c > u + 1e-12:
nxt.append((u, c))
if d < v - 1e-12:
nxt.append((d, v))
cur = nxt
out += cur
return out
# ------------------------------------------------------------ the games
def run(pt):
"""goldren's two games at the point cell pt: G_pt and G_(R pt)."""
st = goldren.fresh()
goldren.run_cell(Cell(pt, None), st)
d = pt_q(pt)
out = {}
for g in ("d", "R"):
H = st[g]
out[g] = {"A": [ivs(S, d) for S in H["A"]],
"B": [ivs(S, d) for S in H["B"]], "end": H["end"]}
return out
def fixed(H):
return H["A"][-1], H["B"][-1]
def points(S):
return all(cmp(a, b) == 0 for a, b in S)
def pts(S):
return [a for a, b in S]
def pairs_at(d):
"""The sixteen pairs at delta = d: (t, interval list) on A and B."""
A, B = goldclimb.family()
return ([(q(*t), ivs([I], d)) for t, I in A],
[(q(*t), ivs([I], d)) for t, I in B])
def copies(pairs, S):
out = []
for t, I in pairs:
out += affine(inter(S, I), E2, t)
return norm(out)
def kdepth(w, pairs, hist):
"""largest n with w in a pair's copy of hist[n] cut to its interval."""
k = -1
for n, S in enumerate(hist):
for t, I in pairs:
v = mul(P2, sub(w, t))
if any(cmp(a, v) <= 0 and cmp(v, b) <= 0 for a, b in inter(S, I)):
k = n
break
return k
def moves(dp, A, B):
"""The fixed game at delta' = dp on point sets A, B: each state's
landing states, A: c (to A) and e (to B); B: c' (to A)."""
def find(x, S):
return [i for i, y in enumerate(S) if cmp(x, y) == 0]
mA, mB = [], []
for v in A:
c = [(cc, i) for cc in (0, 1) for i in find(mul(PHI, sub(q(cc), v)), A)]
e = [(ee, i) for ee in (0, 1) for i in find(mul(PHI, sub(q(ee), v)), B)]
mA.append((c, e))
for u in B:
cp = [(cc, i) for cc in (-1, 0, 1)
for i in find(mul(PHI, sub(add(q(cc), sub(dp, PHI)), u)), A)]
mB.append(cp)
return mA, mB
def closed(mA, mB, XA, XB):
XA, XB = set(XA), set(XB)
while True:
nA = {i for i in XA if any(j in XA for _, j in mA[i][0])
and any(j in XB for _, j in mA[i][1])}
nB = {i for i in XB if any(j in nA for _, j in mB[i])}
if nA == XA and nB == XB:
return XA, XB
XA, XB = nA, nB
def search(src, tgt, grid=range(-6, 7)):
"""affine copies a src + t inside tgt (A and B, own translations);
points are exact Fraction pairs, so a set reads membership."""
(sA, sB), (tA, tB) = src, tgt
if len(sA) > len(tA) or len(sB) > len(tB):
return []
SA, SB = set(tA), set(tB)
hits = []
for j in grid:
for sign in (1, -1):
a = mul(q(sign), phipow(-j))
okA = [t for t in (sub(w, mul(a, sA[0])) for w in tA)
if all(add(mul(a, v), t) in SA for v in sA)]
if not okA:
continue
okB = [t for t in (sub(w, mul(a, sB[0])) for w in tB)
if all(add(mul(a, v), t) in SB for v in sB)] if sB else [None]
if okB:
hits.append((sign, j, okA, okB))
return hits
# ------------------------------------------------------------ data
D = Pt((1, 1), (3, 0)) # phi^2/3
DP = Pt((-2, 3), (3, 0)) # R(phi^2/3)
SURV = [(0, 0, 1), (-1, 1, 1), (-4, 3, 1), (-12, 8, 1), (-33, 21, 1),
(0, 1, 2), (-2, 4, 5), (2, 5, 11), (-3, 3, 2), (-1, 7, 11),
(-2, 3, 3), (2, 10, 19), (-13, 11, 5), (-1, 3, 4), (7, 13, 29),
(-12, 14, 11), (0, 3, 5), (-11, 8, 2), (-9, 17, 19), (1, 3, 6),
(-20, 19, 11), (-4, 20, 29)]
FIXED_REC = [1, 4, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10] + [11] * 9
def spt(a, b, den):
return Pt((a, b), (den, 0))
def main():
t0 = time.time()
print("== (a) the two histories at delta = phi^2/3")
G = run(D)
d, R = G["d"], G["R"]
Gp = run(DP)["d"]
print(f" G_delta ends {d['end']}, sizes A_n "
f"{[len(S) for S in d['A']]}; B_n {[len(S) for S in d['B']]}")
print(f" G_delta' ends {R['end']}, sizes A_n "
f"{[len(S) for S in R['A']]}; B_n {[len(S) for S in R['B']]}")
same = all(len(x) == len(y) and all(cmp(p[0], r[0]) == 0 and
cmp(p[1], r[1]) == 0
for p, r in zip(x, y))
for x, y in zip(R["A"] + R["B"], Gp["A"] + Gp["B"]))
check("(a) L*(phi^2/3) = 10, delta' fixed at n = 10; G_delta' at its "
"own point cell equal",
d["end"] == ("empty", 10) and R["end"] == ("fixed", 10)
and Gp["end"] == ("fixed", 10) and same)
check("(H) A_n(delta) 1, 2, 5, 13, 22, 29, 27, 14, 2, 0 pieces; "
"A_n(delta') 1, 2, 5, 13, 34, 84, 164, 244, 290, 301, 301",
[len(S) for S in d["A"]] == [1, 2, 5, 13, 22, 29, 27, 14, 2, 0]
and [len(S) for S in R["A"]] == [1, 2, 5, 13, 34, 84, 164, 244,
290, 301, 301])
dq, dpq = pt_q(D), pt_q(DP)
PA, PB = pairs_at(dq)
print("== (b) the climb on these numbers, n <= 8")
bad = []
for n in range(len(d["A"])):
if not d["A"][n]:
continue
for t, I in PA:
if not inside(affine(inter(d["A"][n], I), E2, t),
R["A"][min(n, len(R["A"]) - 1)]):
bad.append(("A", n, show(t)))
for n in range(len(d["B"])):
for t, I in PB:
if not inside(affine(inter(d["B"][n], I), E2, t),
R["B"][min(n, len(R["B"]) - 1)]):
bad.append(("B", n, show(t)))
check("(b) every pair's copy inside A_n(delta'), B_n(delta')",
not bad, f"{len(bad)} misses {bad[:4]}")
print("== (H) the fixed set of delta' = (3phi - 2)/3")
FA, FB = fixed(R)
isp = points(FA) and points(FB)
dens = sorted({x.denominator for v in pts(FA) + pts(FB) for x in v})
print(f" A_inf: {len(FA)} pieces, B_inf: {len(FB)}; all points "
f"{isp}; denominators {dens}")
if isp:
A, B = pts(FA), pts(FB)
print(" A_inf " + ", ".join(show(v) for v in A))
print(" B_inf " + ", ".join(show(v) for v in B))
print(" A_8(delta), B_8(delta), B_9(delta): "
+ "; ".join(", ".join(f"[{show(a)}, {show(b)}]" for a, b in S)
or "empty" for S in (d["A"][8], d["B"][8],
d["B"][9] if len(d["B"]) > 9
else [])))
p1 = isp and set(dens) <= {1, 3} and 3 in dens
print(f" P1 {'held' if p1 else 'KILLED'}")
check("P1 held: A_inf(delta') 301 points, B_inf 763, denominators 1 "
"and 3", p1 and len(FA) == 301 and len(FB) == 763)
print("== (C) coverage: the part of A_n(delta') outside every copy")
none_from6 = True
for n in range(len(R["A"])):
An = R["A"][n]
Cn = copies(PA, d["A"][n]) if n < len(d["A"]) else []
Bn = R["B"][n]
CBn = copies(PB, d["B"][n]) if n < len(d["B"]) else []
uA, uB = minus(An, Cn), minus(Bn, CBn)
md = measure(d["A"][n]) if n < len(d["A"]) else 0.0
if n >= 6:
live = md == 0 and (measure(An) > 0 if n <= 8 else True)
none_from6 &= live and abs(sum(v - u for u, v in uA)
- measure(An)) < 1e-12
print(f" n {n:2d}: A_n(delta) measure {md:.5f}; A {len(An)} pieces,"
f" measure {measure(An):.5f},"
f" outside copies {len(uA)} pieces {sum(v - u for u, v in uA):.5f}"
f"; B outside {len(uB)} pieces {sum(v - u for u, v in uB):.5f}")
check("(H) from n = 6 A_n(delta) has measure 0, A_n(delta')'s positive "
"to n = 8; the copies cover none of it (forced by the first)",
none_from6)
if not isp:
print(" (fixed set not points: the per-state arms stop here)")
return finish(t0)
kA = [kdepth(w, PA, d["A"]) for w in A]
kB = [kdepth(u, PB, d["B"]) for u in B]
print(f" k on A_inf {kA}; on B_inf {kB}")
print("== (c) the coverage read at delta = 0 -> delta_1")
G0 = run(Pt((0, 0)))
A1, B1 = (pts(S) for S in fixed(G0["R"]))
P0A, P0B = ([(q(*t), ivs([I], q(0))) for t, I in goldclimb.ELEVEN[0]],
[(q(*t), ivs([I], q(0))) for t, I in goldclimb.ELEVEN[1]])
k0A = [kdepth(w, P0A, G0["d"]["A"]) for w in A1]
k0B = [kdepth(u, P0B, G0["d"]["B"]) for u in B1]
top = len(G0["d"]["A"]) - 1
print(f" A(delta_1) {[show(v) for v in A1]}: k {k0A}; B k {k0B}; "
f"G_0 fixed at n = {top}")
check("(c) every state of A(delta_1) covered at G_0's fixed depth "
"(B printed: inclusion only, no known answer)",
all(k == top for k in k0A))
print("== (G) the fixed set's game at delta'")
mA, mB = moves(dpq, A, B)
print(f" k histogram, A: {sorted(Counter(kA).items())}; B: "
f"{sorted(Counter(kB).items())}")
print(f" out-degree (c, e) on A: "
f"{sorted(Counter((len(c), len(e)) for c, e in mA).items())}; "
f"c' on B: {sorted(Counter(len(x) for x in mB).items())}")
for i, (c, e) in enumerate(mA[:4]):
print(f" a{i} {show(A[i])} k {kA[i]}: c -> "
f"{[(x, 'a%d' % j) for x, j in c]}; e -> "
f"{[(x, 'b%d' % j) for x, j in e]}")
XA, XB = closed(mA, mB, range(len(A)), range(len(B)))
check("(G) the fixed set closes on itself (a fixed set's own law)",
len(XA) == len(A) and len(XB) == len(B))
check("(G) one c-move per A state, one or two e-moves (201, 100), one "
"c'-move per B state; k on A 1, 7, 30, 54, 53, 69, 41, 36, 10 at "
"k = 0 .. 8, on B 1, 8, 31, 91, 143, 132, 159, 95, 85, 18 at 0 .. 9",
Counter((len(c), len(e)) for c, e in mA) == {(1, 1): 201,
(1, 2): 100}
and Counter(len(x) for x in mB) == {1: len(B)}
and [Counter(kA)[k] for k in range(9)] == [1, 7, 30, 54, 53, 69,
41, 36, 10]
and [Counter(kB)[k] for k in range(10)] == [1, 8, 31, 91, 143,
132, 159, 95, 85, 18])
for K in sorted(set(kA + kB)) + [99]:
cA, cB = closed(mA, mB, [i for i in range(len(A)) if kA[i] < K],
[i for i in range(len(B)) if kB[i] < K])
print(f" largest closed subgame in k < {K}: |A| {len(cA)} of "
f"{sum(k < K for k in kA)}, |B| {len(cB)} of "
f"{sum(k < K for k in kB)}")
top8A = [i for i in range(len(A)) if kA[i] == 8]
top8B = [i for i in range(len(B)) if kB[i] == 8]
c8 = closed(mA, mB, top8A, top8B)
clo = closed(mA, mB, [i for i in range(len(A)) if kA[i] < 8],
[i for i in range(len(B)) if kB[i] < 8])
print(f" in k = 8 alone: |A| {len(c8[0])} of {len(top8A)}, |B| "
f"{len(c8[1])} of {len(top8B)}")
p2 = not c8[0] and not clo[0]
print(f" P2 {'held' if p2 else 'KILLED'}")
c7 = closed(mA, mB, [i for i in range(len(A)) if kA[i] < 7],
[i for i in range(len(B)) if kB[i] < 7])
check("P2 killed: k < 8 holds a closed subgame of 289 of its 291 A "
"states and all 660 B; k < 7 none; k = 8 alone none",
(len(clo[0]), len(clo[1])) == (289, 660)
and sum(k < 8 for k in kA) == 291 and sum(k < 8 for k in kB) == 660
and not c7[0] and not c8[0])
print("== (S) the roots: survivors whose R-preimage is no survivor")
sv = [pt_q(spt(*x)) for x in SURV]
runs, fx = {}, []
for x, xq in zip(SURV, sv):
g = run(spt(*x))["d"]
runs[x] = g
fx.append(g["end"][1] if g["end"][0] == "fixed" else None)
check("(S) the 22 survivors fixed, at goldsurv's recorded depths",
sorted(f for f in fx if f is not None) == FIXED_REC
and None not in fx)
dok = []
for x in SURV:
FA2, FB2 = fixed(runs[x])
ds = {y.denominator for v in pts(FA2) + pts(FB2) for y in v}
dok.append(points(FA2) and points(FB2)
and all(x[2] % e == 0 for e in ds))
check("(S) every survivor's fixed set is points, in (1/d)Z[phi], d its "
"denominator", all(dok), f"{sum(dok)} of {len(dok)}")
roots = []
for x, xq, n in zip(SURV, sv, fx):
pre = sub(mul(P2, xq), PHI)
hit = [y for y, yq in zip(SURV, sv) if cmp(yq, pre) == 0]
tag = f"R({show(pre)})" + (" survivor" if hit else
(" outside [0, 1)" if sgn(pre) < 0 else
" dies"))
if not hit:
roots.append(x)
print(f" {show(xq)} (fixed n {n}, |A| {len(runs[x]['A'][-1])}, "
f"|B| {len(runs[x]['B'][-1])}): {tag}")
print(f" roots: {len(roots)} of {len(SURV)}")
chain = SURV[1:5]
want = {(0, 1, 2), (-2, 4, 5), (2, 5, 11), (-2, 3, 3)}
p4 = want < set(roots) and not set(chain) & set(roots)
print(f" P4 {'held' if p4 else 'KILLED'}")
check("P4 held: 13 of 22 survivors are roots, delta_1 .. delta_4 "
"R-images; the chain's |A_inf| 1, 5, 31, 211, 1437",
p4 and len(roots) == 13
and [len(runs[x]["A"][-1]) for x in SURV[:5]] == [1, 5, 31, 211,
1437])
print("== (d) the copy search against the climb, phi/2 -> 3/(2 phi)")
src = tuple(pts(S) for S in fixed(runs[(0, 1, 2)]))
tgt = tuple(pts(S) for S in fixed(runs[(-3, 3, 2)]))
hits = search(src, tgt)
tau = [q(*t) for t in goldren.TAU_A[:5]]
clim = [h for h in hits if h[0] == 1 and h[1] == 2]
ok = clim and all(any(cmp(t, s) == 0 for t in clim[0][2]) for s in tau)
print(f" {len(hits)} scales hit; at phi^-2: t_A "
f"{[show(t) for t in clim[0][2]] if clim else None}")
img = add(mul(E2, src[0][0]), tau[0])
broke = ([add(w, q(Fr(1, 3))) if cmp(w, img) == 0 else w
for w in tgt[0]], tgt[1])
bh = search(src, broke)
check("(d) the search finds the climb (every t_A of tau_A at phi^-2); "
"the target point T_s(a0), s = -phi^-3, moved by 1/3: the "
"phi^-2 copy at s lost",
ok and not [h for h in bh if h[0] == 1 and h[1] == 2
and any(cmp(t, tau[0]) == 0 for t in h[2])],
f"broken target: {len(bh)} scales hit")
hq = pt_q(spt(0, 1, 2))
QA, QB = pairs_at(hq)
mA2, mB2 = moves(pt_q(spt(-3, 3, 2)), *tgt)
jA = {i for t, I in QA for v in src[0] for i, w in enumerate(tgt[0])
if inside([(v, v)], I) and cmp(add(mul(E2, v), t), w) == 0}
jB = {i for t, I in QB for u in src[1] for i, w in enumerate(tgt[1])
if inside([(u, u)], I) and cmp(add(mul(E2, u), t), w) == 0}
cl = closed(mA2, mB2, jA, jB)
print(f" the sixteen pairs' images of phi/2's fixed set: |A| "
f"{len(jA)} of {len(tgt[0])}, |B| {len(jB)} of {len(tgt[1])}; "
f"closed part |A| {len(cl[0])}, |B| {len(cl[1])}")
check("(e) the climb's image of phi/2's fixed set is a closed subgame "
"(the theorem's known answer, the closure instrument read)",
jA and cl == (jA, jB))
print("== (F) affine copies into delta''s fixed set")
tot = nsearched = 0
gset = set()
scl = {}
ixA = {w: i for i, w in enumerate(A)}
ixB = {w: i for i, w in enumerate(B)}
for x, xq in zip(SURV, sv):
if x == (-2, 3, 3):
continue
s2 = tuple(pts(S) for S in fixed(runs[x]))
if len(s2[0]) < 2:
continue
big = len(s2[0]) > len(A) or len(s2[1]) > len(B)
hs = search(s2, (A, B))
nt = sum(len(tA) * len(tB) for _, _, tA, tB in hs)
tot += nt
nsearched += not big
per = []
for sign, j, tA, tB in hs:
a = mul(q(sign), phipow(-j))
iA = {ixA[add(mul(a, v), t)] for t in tA for v in s2[0]}
iB = {ixB[add(mul(a, u), tb)] for tb in tB if tb is not None
for u in s2[1]}
cA = closed(mA, mB, iA, iB)[0]
gset |= cA
if cA:
scl[(sign, j)] = scl.get((sign, j), set()) | cA
per.append(f"{'-' if sign < 0 else '+'}phi^{-j}: {len(tA)} t_A "
f"x {len(tB)} t_B, union |A| {len(iA)}, closed "
f"{len(cA)}")
print(f" from {show(xq)} (|A| {len(s2[0])}, |B| {len(s2[1])}): "
+ ("larger than delta''s, no search" if big else
f"{len(hs)} scales, {nt} copies")
+ "".join(f"\n {r}" for r in per))
print(f" sources searched: {nsearched}; affine copies into delta''s "
f"fixed set: {tot}")
print(f" distinct A states in a closed subgame of some scale's "
f"union: {len(gset)}")
print(f" P3 {'held' if tot else 'KILLED'}")
check("(F) 88139 copies over 8 sources searched, delta_1's and 7 "
"others; closed parts at "
"+phi^0 (181) and -phi^-1 (53, inside it), 181 distinct",
tot == 88139 and nsearched == 8 and len(gset) == 181
and {k: len(v) for k, v in scl.items()} == {(1, 0): 181,
(-1, 1): 53}
and scl[(-1, 1)] <= scl[(1, 0)])
return finish(t0)
def finish(t0):
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())