FA-65526 / Ecological population dynamics / Open access
Lotka-Volterra competition outcome: species1 invasion criterion · case 01
Outcomes flip when competition coefficients are asymmetric.
ROOT CAUSE
The invasion criterion uses a12 where a21 belongs.
VERIFIED REPAIR
Restore the species1 invasion criterion rule: `c1 = k1 * a21 - k2`.
Unsuccessful approach: Multiplying K2 instead of K1 by a21 compares the wrong isocline intercepts.
Case contract
c1=K1*a21-K2, c2=K2*a12-K1; any zero -> neutral; c1>0,c2<0 species1 wins at [K1,0]; c1<0,c2>0 species2 at [0,K2]; otherwise interior N1=(K1-a12K2)/(1-a12a21), N2=(K2-a21K1)/(1-a12a21), coexist if both negative, founder if both positive; None for non-positive K or negative coefficients (zero allowed).
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(k1, k2, a12, a21):
if min(k1, k2) <= 0 or min(a12, a21) < 0:
return None
c1 = k1 * a12 - k2
c2 = k2 * a12 - k1
if c1 == 0 or c2 == 0:
return ['neutral', None]
if c1 > 0 and c2 < 0:
return ['species1', [float(k1), 0.0]]
if c1 < 0 and c2 > 0:
return ['species2', [0.0, float(k2)]]
den = 1 - a12 * a21
n1 = (k1 - a12 * k2) / den
n2 = (k2 - a21 * k1) / den
kind = 'coexist' if c1 < 0 else 'founder'
return [kind, [round(n1, 4), round(n2, 4)]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
[('regression: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('regression: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
('regression: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
('regression: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
('regression: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
[('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
('regression: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])]]
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: weak competition coexist | ['coexist', [75.0, 50.0]] | ['coexist', [75.0, 50.0]] | Passed |
| regression: strong asymmetric species1 | ['coexist', [175.0, -150.0]] | ['species1', [100.0, 0.0]] | Failed |
| regression: species2 wins | ['species2', [0.0, 120.0]] | ['species2', [0.0, 120.0]] | Passed |
| regression: neutral tie | ['species1', [100.0, 0.0]] | ['neutral', None] | Failed |
| control: invalid negative coefficient | None | None | Passed |
| control: invalid capacity | None | None | Passed |
| control: near tie | ['species1', [100.0, 0.0]] | ['species1', [100.0, 0.0]] | Passed |
SHA-256 / 7119331631d3c4a80478aab2eff327cbe78d34aa3f0e3dff196feebbfdbb0114
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(k1, k2, a12, a21):
if min(k1, k2) <= 0 or min(a12, a21) < 0:
return None
c1 = k1 - k2 * a21
c2 = k2 * a12 - k1
if c1 == 0 or c2 == 0:
return ['neutral', None]
if c1 > 0 and c2 < 0:
return ['species1', [float(k1), 0.0]]
if c1 < 0 and c2 > 0:
return ['species2', [0.0, float(k2)]]
den = 1 - a12 * a21
n1 = (k1 - a12 * k2) / den
n2 = (k2 - a21 * k1) / den
kind = 'coexist' if c1 < 0 else 'founder'
return [kind, [round(n1, 4), round(n2, 4)]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
[('regression: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('regression: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
('regression: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
('regression: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
('regression: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
[('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
('regression: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])]]
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: weak competition coexist | ['species1', [100.0, 0.0]] | ['coexist', [75.0, 50.0]] | Failed |
| regression: strong asymmetric species1 | ['species1', [100.0, 0.0]] | ['species1', [100.0, 0.0]] | Passed |
| regression: species2 wins | ['founder', [-236.3636, 190.9091]] | ['species2', [0.0, 120.0]] | Failed |
| regression: neutral tie | ['species1', [100.0, 0.0]] | ['neutral', None] | Failed |
| control: invalid negative coefficient | None | None | Passed |
| control: invalid capacity | None | None | Passed |
| control: near tie | ['species1', [100.0, 0.0]] | ['species1', [100.0, 0.0]] | Passed |
SHA-256 / da43c827dfc85c6f46d7620c6e254dabf4dac3997cfb075fda19dc7565dd9d72
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(k1, k2, a12, a21):
if min(k1, k2) <= 0 or min(a12, a21) < 0:
return None
c1 = k1 * a21 - k2
c2 = k2 * a12 - k1
if c1 == 0 or c2 == 0:
return ['neutral', None]
if c1 > 0 and c2 < 0:
return ['species1', [float(k1), 0.0]]
if c1 < 0 and c2 > 0:
return ['species2', [0.0, float(k2)]]
den = 1 - a12 * a21
n1 = (k1 - a12 * k2) / den
n2 = (k2 - a21 * k1) / den
kind = 'coexist' if c1 < 0 else 'founder'
return [kind, [round(n1, 4), round(n2, 4)]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
[('regression: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('regression: no competition', (70, 40, 0.0, 0.0), ['coexist', [70.0, 40.0]]),
('regression: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])],
[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: coexist with one strong coefficient', (200, 60, 1.5, 0.2), ['coexist', [157.1429, 28.5714]]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
('regression: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
[('regression: weak competition coexist', (100, 80, 0.5, 0.4), ['coexist', [75.0, 50.0]]),
('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]]),
('regression: founder asymmetric', (90, 150, 2.0, 2.5), ['founder', [52.5, 18.75]])],
[('regression: strong asymmetric species1', (100, 60, 0.5, 1.2), ['species1', [100.0, 0.0]]),
('regression: species2 wins', (50, 120, 1.5, 0.3), ['species2', [0.0, 120.0]]),
('regression: founder control', (100, 100, 1.5, 1.6), ['founder', [35.7143, 42.8571]]),
('regression: neutral tie', (100, 50, 1.0, 0.5), ['neutral', None]),
('control: invalid negative coefficient', (100, 100, -0.1, 0.5), None),
('control: invalid capacity', (0, 100, 0.5, 0.5), None),
('control: near tie', (100, 99.5, 1.0, 1.0), ['species1', [100.0, 0.0]])]]
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: weak competition coexist | ['coexist', [75.0, 50.0]] | ['coexist', [75.0, 50.0]] | Passed |
| regression: strong asymmetric species1 | ['species1', [100.0, 0.0]] | ['species1', [100.0, 0.0]] | Passed |
| regression: species2 wins | ['species2', [0.0, 120.0]] | ['species2', [0.0, 120.0]] | Passed |
| regression: neutral tie | ['neutral', None] | ['neutral', None] | Passed |
| control: invalid negative coefficient | None | None | Passed |
| control: invalid capacity | None | None | Passed |
| control: near tie | ['species1', [100.0, 0.0]] | ['species1', [100.0, 0.0]] | Passed |
SHA-256 / 99d86e72fd0ef81244ff77f91a877101e20e4bcebe8ec3924f743a059292e1c6
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:34.704688+00:00.
Case digest / 95efd23f2bb7b7f5cac7193da7e15eb9677cba307199cd3ac36fb8b6d139e0ec