{"abstract":"The reduction disagrees with its explicit aggregation oracle.","category":"Numerical aggregation","checks":8,"contract":"For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return \"0\". Exact Fraction string; no inferential p-value claim.","contract_signature":"table","evaluation_group":"s3-na-contingency-pearson-reduction","failed_approach":"Adding observed count to expectation changes the Pearson normalization.","family":"s3-numerical-aggregation-contingency-pearson-reduction-pearson-observed-denominator","id":"FA-13681","implementations":{"attempt":{"sha256":"42097e3f5b20efd0f77f672988da0f3eb19b8c714f1236ff5e07ffdc0f253530","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nfrom collections import Counter, defaultdict\nimport math\nimport itertools\nN = 1\nobservations = []\ndef solve(table):\n    n=len(table)\n    m=len(table[0]) if n else 0\n    rows=[sum(r) for r in table]\n    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]\n    total=sum(rows)\n    if not total: return \"0\"\n    stat=Fraction(0)\n    for i in range(n):\n        for j in range(m):\n            expected=Fraction(rows[i]*cols[j],total)\n            if expected==0: continue\n            stat+=(table[i][j]-expected)**2/(expected+table[i][j])\n    return str(stat)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('regression 1', solve(*([[4, 0], [0, 4]],)), '8')\ncheck('regression 2', solve(*([[2, 3], [4, 6]],)), '0')\ncheck('regression 3', solve(*([],)), '0')\ncheck('regression 4', solve(*([[0, 0], [0, 0]],)), '0')\ncheck('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')\ncheck('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')\ncheck('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')\ncheck(\"variable diagonal mass\",solve([[N,0],[0,N]]),str(2*N))\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":"7dd3d454b92e5acf5fa798c1e77461fae7513fe4b2c3c24d1ede622136b56521","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nfrom collections import Counter, defaultdict\nimport math\nimport itertools\nN = 1\nobservations = []\ndef solve(table):\n    n=len(table)\n    m=len(table[0]) if n else 0\n    rows=[sum(r) for r in table]\n    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]\n    total=sum(rows)\n    if not total: return \"0\"\n    stat=Fraction(0)\n    for i in range(n):\n        for j in range(m):\n            expected=Fraction(rows[i]*cols[j],total)\n            if expected==0: continue\n            stat+=(table[i][j]-expected)**2/max(1,table[i][j])\n    return str(stat)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('regression 1', solve(*([[4, 0], [0, 4]],)), '8')\ncheck('regression 2', solve(*([[2, 3], [4, 6]],)), '0')\ncheck('regression 3', solve(*([],)), '0')\ncheck('regression 4', solve(*([[0, 0], [0, 0]],)), '0')\ncheck('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')\ncheck('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')\ncheck('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')\ncheck(\"variable diagonal mass\",solve([[N,0],[0,N]]),str(2*N))\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":"Small offline integer/rational inputs only; no performance, statistical inference, or production-library conformance claim. 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":"s3-numerical-aggregation-contingency-pearson-reduction-pearson-observed-denominator","generated_at":"2026-09-29T14:39:09.680241+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Exact bounded examples isolate a reduction defect without floating-point or external-service effects.","root_cause":"Residuals are normalized by observed counts.","sha256":"3a267014b31dee1bc6ca1d8bfd506e135d70c3d3157b263af84a6c7321455dd6","title":"Contingency pearson reduction: Residuals are normalized by observed counts. · 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":43.472,"exit_code":1,"observations":[{"actual":"16/3","check":"regression 1","expected":"8","passed":false},{"actual":"0","check":"regression 2","expected":"0","passed":true},{"actual":"0","check":"regression 3","expected":"0","passed":true},{"actual":"0","check":"regression 4","expected":"0","passed":true},{"actual":"4020/1547","check":"regression 5","expected":"30/7","passed":false},{"actual":"0","check":"regression 6","expected":"0","passed":true},{"actual":"88/35","check":"regression 7","expected":"4","passed":false},{"actual":"4/3","check":"variable diagonal mass","expected":"2","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 1\", \"actual\": \"16/3\", \"expected\": \"8\", \"passed\": false}, {\"check\": \"regression 2\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 3\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 4\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 5\", \"actual\": \"4020/1547\", \"expected\": \"30/7\", \"passed\": false}, {\"check\": \"regression 6\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 7\", \"actual\": \"88/35\", \"expected\": \"4\", \"passed\": false}, {\"check\": \"variable diagonal mass\", \"actual\": \"4/3\", \"expected\": \"2\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.922,"exit_code":1,"observations":[{"actual":"10","check":"regression 1","expected":"8","passed":false},{"actual":"0","check":"regression 2","expected":"0","passed":true},{"actual":"0","check":"regression 3","expected":"0","passed":true},{"actual":"0","check":"regression 4","expected":"0","passed":true},{"actual":"1793/600","check":"regression 5","expected":"30/7","passed":false},{"actual":"0","check":"regression 6","expected":"0","passed":true},{"actual":"33/8","check":"regression 7","expected":"4","passed":false},{"actual":"1","check":"variable diagonal mass","expected":"2","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 1\", \"actual\": \"10\", \"expected\": \"8\", \"passed\": false}, {\"check\": \"regression 2\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 3\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 4\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 5\", \"actual\": \"1793/600\", \"expected\": \"30/7\", \"passed\": false}, {\"check\": \"regression 6\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"regression 7\", \"actual\": \"33/8\", \"expected\": \"4\", \"passed\": false}, {\"check\": \"variable diagonal mass\", \"actual\": \"1\", \"expected\": \"2\", \"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."}}