FA-65796 / Ecological population dynamics / Open access
Rosenzweig-MacArthur equilibrium and enrichment stability: conversion feasibility · case 01
Predators that cannot convert prey fast enough are reported as persisting, or vice versa.
ROOT CAUSE
The feasibility test compares e to m without the handling time.
VERIFIED REPAIR
Restore the conversion feasibility rule: `if e <= h * m:`.
Unsuccessful approach: Scaling e by the attack rate mixes rate units into the persistence test.
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 <= 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]]),
('regression: 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: 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]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
[('regression: 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: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('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]]),
('regression: 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: 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: 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: 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]]),
('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('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]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])]]
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 | ['predator-extinct', [10.0, 0.0]] | ['hopf', [4.0, 1.8]] | Failed |
| regression: enriched cycles | ['predator-extinct', [40.0, 0.0]] | ['cycles', [4.0, 2.7]] | Failed |
| regression: poor habitat stable | ['predator-extinct', [8.0, 0.0]] | ['stable', [4.0, 1.5]] | 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 |
| control: type I predator | ['stable', [4.0, 3.466667]] | ['stable', [4.0, 3.466667]] | Passed |
| regression: lynx hare like | ['stable', [11.111111, 21.728395]] | ['stable', [11.111111, 21.728395]] | Passed |
SHA-256 / 1aa3b52f9f300b14423c627e656e1f7e4ebc3226edce1fa58996f1c47426131b
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 * a <= 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]]),
('regression: 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: 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]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
[('regression: 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: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('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]]),
('regression: 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: 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: 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: 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]]),
('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('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]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])]]
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 |
| regression: 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: 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 |
| control: type I predator | ['stable', [4.0, 3.466667]] | ['stable', [4.0, 3.466667]] | Passed |
| regression: lynx hare like | ['predator-extinct', [60.0, 0.0]] | ['stable', [11.111111, 21.728395]] | Failed |
SHA-256 / 3d6bff45ff904e8660e64db677d6b36f648cae1a7b2fb41814554d7e8a60de7a
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]]),
('regression: 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: 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]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
[('regression: 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: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])],
[('regression: exact hopf point', (1.0, 10.0, 1.0, 0.5, 1.5, 2.0), ['hopf', [4.0, 1.8]]),
('regression: enriched cycles', (1.0, 40.0, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 2.7]]),
('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]]),
('regression: 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: 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: 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: 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]]),
('regression: just above hump', (1.0, 10.06, 1.0, 0.5, 1.5, 2.0), ['cycles', [4.0, 1.807157]]),
('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]]),
('regression: lynx hare like', (1.2, 60.0, 0.05, 0.2, 0.6, 0.3), ['stable', [11.111111, 21.728395]])]]
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 |
| regression: 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: 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 |
| control: type I predator | ['stable', [4.0, 3.466667]] | ['stable', [4.0, 3.466667]] | Passed |
| regression: lynx hare like | ['stable', [11.111111, 21.728395]] | ['stable', [11.111111, 21.728395]] | Passed |
SHA-256 / 9d1b3512fbdb1f426ba2680b5e87b9905c74bc5366b966f383b5b98097feb5fc
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.264031+00:00.
Case digest / dd87b58fcebfac8b242219f244e8e16c718d30a837f5feb69566ebe3e3a38172