Why the analogy entry is late on the flat families (diagnostics only, method unchanged). At flag moments before entry: unlike-past 118, no-memory 7, m<2 2 - the order is not the bottleneck. The period-4 cycle: the flag rises in the phases whose configuration does NOT recur (the undershoot whose relative step shrinks every cycle, and the crossing); the recurring phases have the flag down and read the true order (fun4 = 6(x-2)^5: m ~ 4.9). The entry demands both at the same state. Remembering the analogy until the next flag: flat entry state 12.9 -> 8.2; problems entered APS 3 -> 8, fun9 0 -> 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
vvs
2026-09-21 14:58:20 +01:00
co-authored by Claude Opus 5
parent 1842eb0765
commit b7271a1ce4
4 changed files with 262 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
"""Consequence check for diag_analogy_sequence.py: the flag rises in the phases of the
period-4 cycle whose configuration does NOT recur (the undershoot whose relative step
shrinks every cycle, the crossing), while the recurring phases are the ones with the flag
down. The entry demands both AT THE SAME STATE, so it waits until a flag state happens
to recur.
Candidate (not in the method): the analogy is a property of the RUN, the flag of the
MOMENT - once any state has been analogous to its past with m >= 2, enter at the next
flag. Per problem, on traces of the proposed rule with NO regime (so both rules see the
same states): the state of entry under 'same state' and under 'analogy remembered', and
how many problems would enter at all, per group. Nothing in the method changes.
python -u diag_analogy_decoupled.py
"""
from __future__ import annotations
from collections import defaultdict
from simroot.pure import _analogous_and_steep, _config3, pure_root
from sweep_full import MAXFEV, XTOL, load_problems
FLAT = ("fun3", "fun4", "fun5", "fun6")
def entries(trace):
past, seen = [], False
same = remembered = None
for k, s in enumerate(trace):
cur = _config3(s["x"], s["fx"], s["xp"], s["fp"], s["xp2"], s["fp2"])
flag = s["fp"] != 0.0 and s["fx"] / s["fp"] >= 0.25
ana = _analogous_and_steep(cur, past)
if flag and ana and same is None:
same = k
if flag and (seen or ana) and remembered is None:
remembered = k
seen = seen or ana
if cur is not None:
past.append(cur)
return same, remembered
def main():
per = defaultdict(lambda: [0, 0, 0, 0, 0]) # problems, same, remembered, sum same, sum rem
for s, pid, f, a, b, _root in load_problems():
st = {"trace": []}
pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
guard="project", stats=st)
fam = pid.split(".")[0]
g = "APS" if s == "APS" else ("CHA-flat" if fam in FLAT else f"CHA-{fam}")
same, rem = entries(st["trace"])
p = per[g]
p[0] += 1
p[1] += same is not None
p[2] += rem is not None
if g == "CHA-flat" and same is not None and rem is not None:
p[3] += same
p[4] += rem
print(f"{'group':<10} {'problems':>8} {'enter: same state':>18} {'analogy remembered':>19}")
for g in sorted(per):
n, a_, b_, s1, s2 = per[g]
print(f"{g:<10} {n:8d} {a_:18d} {b_:19d}")
fl = per["CHA-flat"]
print(f"\nflat: mean entry state {fl[3] / fl[1]:.1f} (same state) -> "
f"{fl[4] / fl[1]:.1f} (analogy remembered)")
print("diag done")
if __name__ == "__main__":
main()