{"abstract":"Risk is computed from the first census rather than the current population.","category":"Ecological population dynamics","checks":7,"contract":"Log growth increments ln(N[t+1]/N[t]); mu = mean, sigma^2 = sample variance (q-1); d = ln(N_last/threshold); d<=0 gives probability 1.0; zero variance gives 1.0 if mu*T <= -d else 0.0; otherwise P = Phi((-d-muT)/(s sqrtT)) + exp(-2 mu d/s^2) Phi((-d+muT)/(s sqrtT)) capped at 1; return [mu, var, P] rounded 6; None with fewer than three counts, non-positive counts or threshold.","contract_signature":"counts, threshold, horizon","evaluation_group":"w2-ecopop-count-pva","failed_approach":"Using the peak count overstates the distance to the threshold.","family":"w2-ecopop-count-pva-distance-to-threshold","id":"FA-65826","implementations":{"attempt":{"sha256":"627c0d761025acd2d7a6d6246a0c91d07dc493373fef2d3b0671528b806637dd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(counts, threshold, horizon):\n    if len(counts) < 3 or min(counts) <= 0 or threshold <= 0:\n        return None\n    logs = [math.log(counts[t + 1] / counts[t]) for t in range(len(counts) - 1)]\n    q = len(logs)\n    mu = sum(logs) / q\n    var = sum((x - mu) ** 2 for x in logs) / (q - 1)\n    d = math.log(max(counts) / threshold)\n    if d <= 0:\n        return [round(mu, 6), round(var, 6), 1.0]\n    if var == 0:\n        return [round(mu, 6), 0.0, 1.0 if mu * horizon <= -d else 0.0]\n    sd = math.sqrt(var * horizon)\n    phi = lambda z: 0.5 * (1 + math.erf(z / math.sqrt(2)))\n    prob = phi((-d - mu * horizon) / sd) + math.exp(-2 * mu * d / var) * phi((-d + mu * horizon) / sd)\n    return [round(mu, 6), round(var, 6), round(min(prob, 1.0), 6)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919])],\n [('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])],\n [('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])],\n [('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])],\n [('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"418fcf748e3e75d094eb4861c456e39f04b4f108ebcca1387470acc15c3c547e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(counts, threshold, horizon):\n    if len(counts) < 3 or min(counts) <= 0 or threshold <= 0:\n        return None\n    logs = [math.log(counts[t + 1] / counts[t]) for t in range(len(counts) - 1)]\n    q = len(logs)\n    mu = sum(logs) / q\n    var = sum((x - mu) ** 2 for x in logs) / (q - 1)\n    d = math.log(counts[0] / threshold)\n    if d <= 0:\n        return [round(mu, 6), round(var, 6), 1.0]\n    if var == 0:\n        return [round(mu, 6), 0.0, 1.0 if mu * horizon <= -d else 0.0]\n    sd = math.sqrt(var * horizon)\n    phi = lambda z: 0.5 * (1 + math.erf(z / math.sqrt(2)))\n    prob = phi((-d - mu * horizon) / sd) + math.exp(-2 * mu * d / var) * phi((-d + mu * horizon) / sd)\n    return [round(mu, 6), round(var, 6), round(min(prob, 1.0), 6)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919])],\n [('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])],\n [('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])],\n [('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: already below threshold', ([30, 20, 8], 10, 10), [-0.660878, 0.130471, 1.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])],\n [('regression: grizzly census decline',\n   ([45, 42, 44, 38, 36, 35, 31], 10, 20),\n   [-0.062113, 0.004743, 0.688257]),\n  ('regression: fluctuating stable', ([100, 120, 90, 110, 95, 105], 20, 50), [0.009758, 0.046826, 0.191687]),\n  ('control: growing', ([30, 36, 40, 50, 55, 66], 10, 30), [0.157691, 0.003032, 0.0]),\n  ('control: constant decline', ([80, 40, 20], 5, 5), [-0.693147, 0.0, 1.0]),\n  ('control: too short', ([10, 9], 5, 5), None),\n  ('regression: high variance', ([200, 100, 260, 90, 300, 120], 30, 25), [-0.102165, 1.188964, 0.882919]),\n  ('regression: peak then decline', ([60, 120, 80, 70, 65], 15, 40), [0.020011, 0.222192, 0.539603])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-ecopop-count-pva-distance-to-threshold","generated_at":"2026-09-29T14:47:37.646034+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Population projections set harvest quotas, conservation status and pest-control timing; a wrong update order, boundary or rate conversion silently changes management advice.","root_cause":"The starting abundance is the first count.","sha256":"5141ab744ce35969a12f17b1047944ad8505f093f75a692b34c88af65a0b8d09","title":"Count-based population viability (diffusion approximation): distance to threshold · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":37.911,"exit_code":1,"observations":[{"actual":[-0.062113,0.004743,0.19763],"check":"regression: grizzly census decline","expected":[-0.062113,0.004743,0.688257],"passed":false},{"actual":[0.009758,0.046826,0.161525],"check":"regression: fluctuating stable","expected":[0.009758,0.046826,0.191687],"passed":false},{"actual":[0.157691,0.003032,0.0],"check":"control: growing","expected":[0.157691,0.003032,0.0],"passed":true},{"actual":[-0.660878,0.130471,1.0],"check":"control: already below threshold","expected":[-0.660878,0.130471,1.0],"passed":true},{"actual":[-0.693147,0.0,1.0],"check":"control: constant decline","expected":[-0.693147,0.0,1.0],"passed":true},{"actual":null,"check":"control: too short","expected":null,"passed":true},{"actual":[-0.102165,1.188964,0.795455],"check":"regression: high variance","expected":[-0.102165,1.188964,0.882919],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: grizzly census decline\", \"actual\": [-0.062113, 0.004743, 0.19763], \"expected\": [-0.062113, 0.004743, 0.688257], \"passed\": false}, {\"check\": \"regression: fluctuating stable\", \"actual\": [0.009758, 0.046826, 0.161525], \"expected\": [0.009758, 0.046826, 0.191687], \"passed\": false}, {\"check\": \"control: growing\", \"actual\": [0.157691, 0.003032, 0.0], \"expected\": [0.157691, 0.003032, 0.0], \"passed\": true}, {\"check\": \"control: already below threshold\", \"actual\": [-0.660878, 0.130471, 1.0], \"expected\": [-0.660878, 0.130471, 1.0], \"passed\": true}, {\"check\": \"control: constant decline\", \"actual\": [-0.693147, 0.0, 1.0], \"expected\": [-0.693147, 0.0, 1.0], \"passed\": true}, {\"check\": \"control: too short\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"regression: high variance\", \"actual\": [-0.102165, 1.188964, 0.795455], \"expected\": [-0.102165, 1.188964, 0.882919], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.37,"exit_code":1,"observations":[{"actual":[-0.062113,0.004743,0.19763],"check":"regression: grizzly census decline","expected":[-0.062113,0.004743,0.688257],"passed":false},{"actual":[0.009758,0.046826,0.203751],"check":"regression: fluctuating stable","expected":[0.009758,0.046826,0.191687],"passed":false},{"actual":[0.157691,0.003032,0.0],"check":"control: growing","expected":[0.157691,0.003032,0.0],"passed":true},{"actual":[-0.660878,0.130471,1.0],"check":"control: already below threshold","expected":[-0.660878,0.130471,1.0],"passed":true},{"actual":[-0.693147,0.0,1.0],"check":"control: constant decline","expected":[-0.693147,0.0,1.0],"passed":true},{"actual":null,"check":"control: too short","expected":null,"passed":true},{"actual":[-0.102165,1.188964,0.834919],"check":"regression: high variance","expected":[-0.102165,1.188964,0.882919],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: grizzly census decline\", \"actual\": [-0.062113, 0.004743, 0.19763], \"expected\": [-0.062113, 0.004743, 0.688257], \"passed\": false}, {\"check\": \"regression: fluctuating stable\", \"actual\": [0.009758, 0.046826, 0.203751], \"expected\": [0.009758, 0.046826, 0.191687], \"passed\": false}, {\"check\": \"control: growing\", \"actual\": [0.157691, 0.003032, 0.0], \"expected\": [0.157691, 0.003032, 0.0], \"passed\": true}, {\"check\": \"control: already below threshold\", \"actual\": [-0.660878, 0.130471, 1.0], \"expected\": [-0.660878, 0.130471, 1.0], \"passed\": true}, {\"check\": \"control: constant decline\", \"actual\": [-0.693147, 0.0, 1.0], \"expected\": [-0.693147, 0.0, 1.0], \"passed\": true}, {\"check\": \"control: too short\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"regression: high variance\", \"actual\": [-0.102165, 1.188964, 0.834919], \"expected\": [-0.102165, 1.188964, 0.882919], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}