{"abstract":"Counting the Python magnitude ignores finite-word two-complement representation.","category":"Integer arithmetic","checks":4,"contract":"Integer arguments; denominators, steps, moduli, and bit widths are positive. Unsigned word inputs fit the specified width except where masking is explicitly the operation. Sequence sizes are nonnegative. n may be any signed integer; count set bits in its low bits-bit word. Exact operational definition: bin(n & ((1<<bits)-1)).count(\"1\")","evaluation_group":"model-1e19ce19f346c0be","failed_approach":"Absolute value does not model sign-extension or high-bit masking.","family":"xn-population-count-width-mask","id":"FA-5416","implementations":{"attempt":{"sha256":"e2c6328f9b6278602019bcb35962cdb924ac3255c3781d00d8e055fb39c48a16","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport calendar\nimport statistics\nimport itertools\nfrom fractions import Fraction\nfrom datetime import date, datetime, timedelta, timezone\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR\n\nN = 1\nobservations = []\ndef solve(n, bits):\n    return bin(abs(n)).count(\"1\")\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1: (-1, 8)', solve(*(-1, 8)), 8)\ncheck('fixture 2: (-2, 8)', solve(*(-2, 8)), 7)\ncheck('fixture 3: (256, 8)', solve(*(256, 8)), 0)\ncheck('fixture 4: (5, 8)', solve(*(5, 8)), 2)\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":"112ef5f02dadae5bbac39f5c98e4ed5ccc426cbc95e25de138dcf475b82002fc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport calendar\nimport statistics\nimport itertools\nfrom fractions import Fraction\nfrom datetime import date, datetime, timedelta, timezone\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR\n\nN = 1\nobservations = []\ndef solve(n, bits):\n    return bin(n).count(\"1\")\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1: (-1, 8)', solve(*(-1, 8)), 8)\ncheck('fixture 2: (-2, 8)', solve(*(-2, 8)), 7)\ncheck('fixture 3: (256, 8)', solve(*(256, 8)), 0)\ncheck('fixture 4: (5, 8)', solve(*(5, 8)), 2)\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"},"fixed":{"sha256":"44407695a58b800b1d3edf53a6c764c56ffecc645ce5ece4b7a5d6ff9f41e1a4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport calendar\nimport statistics\nimport itertools\nfrom fractions import Fraction\nfrom datetime import date, datetime, timedelta, timezone\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR\n\nN = 1\nobservations = []\ndef solve(n, bits):\n    return bin(n & ((1<<bits)-1)).count(\"1\")\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('fixture 1: (-1, 8)', solve(*(-1, 8)), 8)\ncheck('fixture 2: (-2, 8)', solve(*(-2, 8)), 7)\ncheck('fixture 3: (256, 8)', solve(*(256, 8)), 0)\ncheck('fixture 4: (5, 8)', solve(*(5, 8)), 2)\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":" 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":"xn-population-count-width-mask","generated_at":"2026-09-29T14:37:49.412408+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Integer mathematics results depend on the stated convention.","repair":"Apply the specified mathematical contract directly, preserving all terms and boundary cases: return bin(n & ((1<<bits)-1)).count(\"1\")","root_cause":"Counting the Python magnitude ignores finite-word two-complement representation.","sha256":"279ff10f48dfb98719a4a55830647df9b69be1d788bcb0e69782a9f81b320530","title":"Population count width mask · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":130.987,"exit_code":1,"observations":[{"actual":1,"check":"fixture 1: (-1, 8)","expected":8,"passed":false},{"actual":1,"check":"fixture 2: (-2, 8)","expected":7,"passed":false},{"actual":1,"check":"fixture 3: (256, 8)","expected":0,"passed":false},{"actual":2,"check":"fixture 4: (5, 8)","expected":2,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1: (-1, 8)\", \"actual\": 1, \"expected\": 8, \"passed\": false}, {\"check\": \"fixture 2: (-2, 8)\", \"actual\": 1, \"expected\": 7, \"passed\": false}, {\"check\": \"fixture 3: (256, 8)\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"fixture 4: (5, 8)\", \"actual\": 2, \"expected\": 2, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":47.99,"exit_code":1,"observations":[{"actual":1,"check":"fixture 1: (-1, 8)","expected":8,"passed":false},{"actual":1,"check":"fixture 2: (-2, 8)","expected":7,"passed":false},{"actual":1,"check":"fixture 3: (256, 8)","expected":0,"passed":false},{"actual":2,"check":"fixture 4: (5, 8)","expected":2,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1: (-1, 8)\", \"actual\": 1, \"expected\": 8, \"passed\": false}, {\"check\": \"fixture 2: (-2, 8)\", \"actual\": 1, \"expected\": 7, \"passed\": false}, {\"check\": \"fixture 3: (256, 8)\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"fixture 4: (5, 8)\", \"actual\": 2, \"expected\": 2, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":45.912,"exit_code":0,"observations":[{"actual":8,"check":"fixture 1: (-1, 8)","expected":8,"passed":true},{"actual":7,"check":"fixture 2: (-2, 8)","expected":7,"passed":true},{"actual":0,"check":"fixture 3: (256, 8)","expected":0,"passed":true},{"actual":2,"check":"fixture 4: (5, 8)","expected":2,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 1: (-1, 8)\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"fixture 2: (-2, 8)\", \"actual\": 7, \"expected\": 7, \"passed\": true}, {\"check\": \"fixture 3: (256, 8)\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"fixture 4: (5, 8)\", \"actual\": 2, \"expected\": 2, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}