FA-65806 / Ecological population dynamics / Open access
Rosenzweig-MacArthur equilibrium and enrichment stability: prey isocline hump · case 01
The enrichment threshold is placed at twice its true density.
ROOT CAUSE
The hump of the prey isocline is not halved.
VERIFIED REPAIR
Restore the prey isocline hump rule: `hump = (k - 1 / (a * h)) / 2`.
Unsuccessful approach: Ignoring the saturation shift places the hump at K/2.
Case contract
Type II predator-prey: N* = m/(a(e-hm)) requires e>hm and N*<K else ['predator-extinct', [K, 0]]; P* = (r/a)(1-N*/K)(1+ahN*); hump = (K-1/(ah))/2 for h>0 else -1; stable if N*>hump, 'hopf' if equal, else 'cycles'; values rounded 6; None for invalid parameters.
Why this case matters
Population projections set harvest quotas, conservation status and pest-control timing; a wrong update order, boundary or rate conversion silently changes management advice.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, k, a, h, e, m):
if min(r, k, a, e, m) <= 0 or h < 0:
return None
if e <= h * m:
return ['predator-extinct', [float(k), 0.0]]
ns = m / (a * (e - h * m))
if ns >= k:
return ['predator-extinct', [float(k), 0.0]]
ps = r / a * (1 - ns / k) * (1 + a * h * ns)
hump = (k - 1 / (a * h)) if h > 0 else -1.0
if ns > hump:
kind = 'stable'
elif ns == hump:
kind = 'hopf'
else:
kind = 'cycles'
return [kind, [round(ns, 6), round(ps, 6)]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None)],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
[('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: exact hopf point | ['cycles', [4.0, 1.8]] | ['hopf', [4.0, 1.8]] | Failed |
| control: enriched cycles | ['cycles', [4.0, 2.7]] | ['cycles', [4.0, 2.7]] | Passed |
| regression: poor habitat stable | ['cycles', [4.0, 1.5]] | ['stable', [4.0, 1.5]] | Failed |
| control: just above hump | ['cycles', [4.0, 1.807157]] | ['cycles', [4.0, 1.807157]] | Passed |
| regression: just below enrichment threshold | ['cycles', [4.0, 1.792757]] | ['stable', [4.0, 1.792757]] | Failed |
| control: inefficient predator | ['predator-extinct', [50.0, 0.0]] | ['predator-extinct', [50.0, 0.0]] | Passed |
| control: predator cannot persist capacity | ['predator-extinct', [3.0, 0.0]] | ['predator-extinct', [3.0, 0.0]] | Passed |
SHA-256 / a63800332c92e742a1ec751883874cd525653c09930d6f0c98f8fe748d752d52
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, k, a, h, e, m):
if min(r, k, a, e, m) <= 0 or h < 0:
return None
if e <= h * m:
return ['predator-extinct', [float(k), 0.0]]
ns = m / (a * (e - h * m))
if ns >= k:
return ['predator-extinct', [float(k), 0.0]]
ps = r / a * (1 - ns / k) * (1 + a * h * ns)
hump = k / 2 if h > 0 else -1.0
if ns > hump:
kind = 'stable'
elif ns == hump:
kind = 'hopf'
else:
kind = 'cycles'
return [kind, [round(ns, 6), round(ps, 6)]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None)],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
[('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: exact hopf point | ['cycles', [4.0, 1.8]] | ['hopf', [4.0, 1.8]] | Failed |
| control: enriched cycles | ['cycles', [4.0, 2.7]] | ['cycles', [4.0, 2.7]] | Passed |
| regression: poor habitat stable | ['hopf', [4.0, 1.5]] | ['stable', [4.0, 1.5]] | Failed |
| control: just above hump | ['cycles', [4.0, 1.807157]] | ['cycles', [4.0, 1.807157]] | Passed |
| regression: just below enrichment threshold | ['cycles', [4.0, 1.792757]] | ['stable', [4.0, 1.792757]] | Failed |
| control: inefficient predator | ['predator-extinct', [50.0, 0.0]] | ['predator-extinct', [50.0, 0.0]] | Passed |
| control: predator cannot persist capacity | ['predator-extinct', [3.0, 0.0]] | ['predator-extinct', [3.0, 0.0]] | Passed |
SHA-256 / 8799a7591b1804bae3b5e4b2fef2ae25959a26daa2b92461d8ee173d8c4282fb
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r, k, a, h, e, m):
if min(r, k, a, e, m) <= 0 or h < 0:
return None
if e <= h * m:
return ['predator-extinct', [float(k), 0.0]]
ns = m / (a * (e - h * m))
if ns >= k:
return ['predator-extinct', [float(k), 0.0]]
ps = r / a * (1 - ns / k) * (1 + a * h * ns)
hump = (k - 1 / (a * h)) / 2 if h > 0 else -1.0
if ns > hump:
kind = 'stable'
elif ns == hump:
kind = 'hopf'
else:
kind = 'cycles'
return [kind, [round(ns, 6), round(ps, 6)]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None)],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]]),
('control: invalid rate', (0.0, 10.0, 1.0, 0.5, 1.5, 2.0), None),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]]),
('control: borderline conversion', (1.0, 20.0, 0.5, 0.5, 0.9, 1.6), ['predator-extinct', [20.0, 0.0]])],
[('control: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('regression: poor habitat stable', (1.0, 8.0, 1.0, 0.5, 1.5, 2.0), ['stable', [4.0, 1.5]]),
('control: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('regression: just below enrichment threshold',
(1.0, 9.94, 1.0, 0.5, 1.5, 2.0),
['stable', [4.0, 1.792757]]),
('control: inefficient predator', (1.0, 50.0, 1.0, 0.5, 1.0, 2.0), ['predator-extinct', [50.0, 0.0]]),
('control: predator cannot persist capacity',
(1.0, 3.0, 1.0, 0.5, 1.5, 2.0),
['predator-extinct', [3.0, 0.0]]),
('control: type I predator', (0.8, 30.0, 0.2, 0.0, 0.5, 0.4), ['stable', [4.0, 3.466667]])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: exact hopf point | ['hopf', [4.0, 1.8]] | ['hopf', [4.0, 1.8]] | Passed |
| control: enriched cycles | ['cycles', [4.0, 2.7]] | ['cycles', [4.0, 2.7]] | Passed |
| regression: poor habitat stable | ['stable', [4.0, 1.5]] | ['stable', [4.0, 1.5]] | Passed |
| control: just above hump | ['cycles', [4.0, 1.807157]] | ['cycles', [4.0, 1.807157]] | Passed |
| regression: just below enrichment threshold | ['stable', [4.0, 1.792757]] | ['stable', [4.0, 1.792757]] | Passed |
| control: inefficient predator | ['predator-extinct', [50.0, 0.0]] | ['predator-extinct', [50.0, 0.0]] | Passed |
| control: predator cannot persist capacity | ['predator-extinct', [3.0, 0.0]] | ['predator-extinct', [3.0, 0.0]] | Passed |
SHA-256 / 737ac3bdcd12756075957535814a8ce43d60d2f8ffeedb249a9dbdb12f344f9f
Verification & scope
Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:47:37.301815+00:00.
Case digest / bc0a4f6f653e6000d7533433ece0cec8fa5a6145dfb2cf3b3043467e5b7cd71e