PREREG_flat_analogy_mem outcome (decided on the smoke, all 199 problems): NOT accepted. Remembering the analogy until the next flag: CHA 2635 -> 2552 (G2: 2625 -> 2548; flat fun3-6 1234 -> 1151, M4 holds) but APS 2806 -> 2814 (G2: 2782 -> 2787 = Chandrupatla, M2 fails) - the extra false entries. Server regression x2: 1069 passed, 1 failed = the expected paper-number check.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -267,3 +267,36 @@ def test_a_line_is_never_analogous_and_an_exact_power_repeats_with_its_order():
|
||||
new = _config3(0.1, p(0.1), 0.2, p(0.2), 0.4, p(0.4)) # the same shape, zoomed by 4
|
||||
assert new[0] == pytest.approx(old[0]) and new[1] == pytest.approx(old[1])
|
||||
assert _analogous_and_steep(new, [old])
|
||||
|
||||
|
||||
# ---- PREREG_flat_analogy_mem_2026-09-21: the analogy remembered as a property of the run ----
|
||||
@pytest.mark.parametrize("f,a,b", PROBS)
|
||||
@pytest.mark.parametrize("guard", ("project", "credit"))
|
||||
@pytest.mark.parametrize("ext", ("none", "pattern"))
|
||||
def test_the_guarantee_holds_with_the_remembered_analogy(f, a, b, guard, ext):
|
||||
x, n, ok = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard=guard, prestep="flatanalogmem", extrapolate=ext)
|
||||
assert ok and min(a, b) <= x <= max(a, b)
|
||||
half = math.ceil(math.log2(abs(b - a) / XTOL))
|
||||
assert n <= (2 * half + 3 if guard == "project" else half + 4), n
|
||||
|
||||
|
||||
def test_the_remembered_analogy_spares_simple_roots_and_enters_no_later():
|
||||
"""Measured before pinning: simple roots cost exactly the rule without the regime;
|
||||
on powers the entry is never later than the same-state analogy (x^19: 67 -> 57)."""
|
||||
for f, a, b in ((lambda t: 3.0 * t - 1.0, -2.0, 5.0),
|
||||
(lambda t: t ** 3 - 2.0 * t - 5.0, 1.0, 4.0),
|
||||
(lambda t: math.exp(t) - 2.0, 0.0, 3.0)):
|
||||
st = {}
|
||||
_x, n1, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep="flatanalogmem", stats=st)
|
||||
_x, n0, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project")
|
||||
assert st.get("stick_entries", 0) == 0 and n1 == n0
|
||||
for f, a, b in ((lambda t: t ** 9, -1.0, 2.0), (lambda t: t ** 19, -10.0, 100.0),
|
||||
(lambda t: 6.0 * (t - 2.0) ** 5, 0.0, 10.0)):
|
||||
_x, nm, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep="flatanalogmem")
|
||||
_x, na, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep="flatanalog")
|
||||
assert nm <= na, (nm, na)
|
||||
|
||||
Reference in New Issue
Block a user