{"abstract":"An XOR gate with an unknown input returns a definite parity bit.","category":"Digital logic simulation","checks":11,"contract":"Values are '0','1','x','z'. A 'z' on any gate input is read as 'x'. and/nand: any 0 -> 0, all 1 -> 1, else x; or/nor: any 1 -> 1, all 0 -> 0, else x; xor/xnor: any x -> x, else parity of ones; buf/not use the single input; nand/nor/xnor/not invert (x stays x). bufif1(data, enable): enable 0 -> 'z', enable x/z -> 'x', enable 1 -> data (z data becomes x).","contract_signature":"*args","evaluation_group":"w2-digital-logic-simulation-four-valued-gates","failed_approach":"Letting pairs of unknown inputs cancel each other still yields a definite value for x xor x.","family":"w2-digital-logic-simulation-four-valued-gates-xor-unknown-propagation","id":"FA-88851","implementations":{"attempt":{"sha256":"8e26428f600eb56417aee5631c5a8afec6bd584136622b9f460e3ceb7e6be7a8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    gate, ins = args\n    def inv(v):\n        return {'0': '1', '1': '0'}.get(v, 'x')\n    ins = [('x' if v == 'z' else v) for v in ins]\n    if gate == 'bufif1':\n        d, e = ins\n        return 'z' if e == '0' else ('x' if e == 'x' else d)\n    if gate in ('and', 'nand'):\n        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')\n    elif gate in ('or', 'nor'):\n        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')\n    elif gate in ('xor', 'xnor'):\n        r = 'x' if ins.count('x') % 2 else str(ins.count('1') % 2)\n    else:\n        r = ins[0]\n    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('and gate: controlling zero after unknowns', ['and', ['x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '0']], '0'), ('inverter control', ['not', ['1']], '0'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['1', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '0']], '1'), ('inverter control', ['not', ['0']], '1'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['0', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '1', '0']], '0'), ('inverter control', ['not', ['1']], '0'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['1', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', 'z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', 'x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', '1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0', '0', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '1', '1', '0']], '1'), ('inverter control', ['not', ['0']], '1'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['0', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', 'z', 'z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', 'x', 'x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1', '1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', '1', '1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0', '0', '0', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '1', '1', '1', '0']], '0'), ('inverter control', ['not', ['1']], '0'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['1', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', 'z', 'z', 'z', '1']], '1')]]\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":"0005f436db5360904f44ad702b745513c274b3916c15f40215a26f163d9c8546","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    gate, ins = args\n    def inv(v):\n        return {'0': '1', '1': '0'}.get(v, 'x')\n    ins = [('x' if v == 'z' else v) for v in ins]\n    if gate == 'bufif1':\n        d, e = ins\n        return 'z' if e == '0' else ('x' if e == 'x' else d)\n    if gate in ('and', 'nand'):\n        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')\n    elif gate in ('or', 'nor'):\n        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')\n    elif gate in ('xor', 'xnor'):\n        r = str(ins.count('1') % 2)\n    else:\n        r = ins[0]\n    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('and gate: controlling zero after unknowns', ['and', ['x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '0']], '0'), ('inverter control', ['not', ['1']], '0'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['1', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '0']], '1'), ('inverter control', ['not', ['0']], '1'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['0', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '1', '0']], '0'), ('inverter control', ['not', ['1']], '0'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['1', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', 'z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', 'x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', '1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0', '0', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '1', '1', '0']], '1'), ('inverter control', ['not', ['0']], '1'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['0', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', 'z', 'z', '1']], '1')], [('and gate: controlling zero after unknowns', ['and', ['x', 'x', 'x', 'x', 'x', '0']], '0'), ('nand gate: all ones', ['nand', ['1', '1', '1', '1', '1', '1']], '0'), ('xor gate: floating input', ['xor', ['1', '1', '1', '1', '1', 'z']], 'x'), ('buffer of a floating net', ['buf', ['z']], 'x'), ('xor gate: two unknowns', ['xor', ['x', 'x', '0', '0', '0', '0']], 'x'), ('xnor gate: parity inversion', ['xnor', ['1', '1', '1', '1', '1', '0']], '0'), ('inverter control', ['not', ['1']], '0'), ('bufif1 unknown enable with low data', ['bufif1', ['0', 'x']], 'x'), ('bufif1 unknown enable with high data', ['bufif1', ['1', 'z']], 'x'), ('bufif1 disabled drives z', ['bufif1', ['1', '0']], 'z'), ('or gate: controlling one beside z', ['or', ['z', 'z', 'z', 'z', 'z', '1']], '1')]]\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":"A deterministic bounded teaching model of one simulator rule set; the contract is stipulated and is not a claim of conformance to any HDL standard or commercial simulator. 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-digital-logic-simulation-four-valued-gates-xor-unknown-propagation","generated_at":"2026-09-29T14:51:12.076427+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Gate-level logic simulators must propagate unknown and high-impedance values without inventing definite levels.","root_cause":"The parity is computed from the count of ones only, silently treating x as 0.","sha256":"8f70e5cbd98f6f67bbe008c5829f45a617a07914bedde4a7ce4608987d309678","title":"XOR parity ignores unknown inputs · 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.007,"exit_code":1,"observations":[{"actual":"0","check":"and gate: controlling zero after unknowns","expected":"0","passed":true},{"actual":"0","check":"nand gate: all ones","expected":"0","passed":true},{"actual":"x","check":"xor gate: floating input","expected":"x","passed":true},{"actual":"x","check":"buffer of a floating net","expected":"x","passed":true},{"actual":"0","check":"xor gate: two unknowns","expected":"x","passed":false},{"actual":"0","check":"xnor gate: parity inversion","expected":"0","passed":true},{"actual":"0","check":"inverter control","expected":"0","passed":true},{"actual":"x","check":"bufif1 unknown enable with low data","expected":"x","passed":true},{"actual":"x","check":"bufif1 unknown enable with high data","expected":"x","passed":true},{"actual":"z","check":"bufif1 disabled drives z","expected":"z","passed":true},{"actual":"1","check":"or gate: controlling one beside z","expected":"1","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"and gate: controlling zero after unknowns\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"nand gate: all ones\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"xor gate: floating input\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"buffer of a floating net\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"xor gate: two unknowns\", \"actual\": \"0\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"xnor gate: parity inversion\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"inverter control\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"bufif1 unknown enable with low data\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"bufif1 unknown enable with high data\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"bufif1 disabled drives z\", \"actual\": \"z\", \"expected\": \"z\", \"passed\": true}, {\"check\": \"or gate: controlling one beside z\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.95,"exit_code":1,"observations":[{"actual":"0","check":"and gate: controlling zero after unknowns","expected":"0","passed":true},{"actual":"0","check":"nand gate: all ones","expected":"0","passed":true},{"actual":"1","check":"xor gate: floating input","expected":"x","passed":false},{"actual":"x","check":"buffer of a floating net","expected":"x","passed":true},{"actual":"0","check":"xor gate: two unknowns","expected":"x","passed":false},{"actual":"0","check":"xnor gate: parity inversion","expected":"0","passed":true},{"actual":"0","check":"inverter control","expected":"0","passed":true},{"actual":"x","check":"bufif1 unknown enable with low data","expected":"x","passed":true},{"actual":"x","check":"bufif1 unknown enable with high data","expected":"x","passed":true},{"actual":"z","check":"bufif1 disabled drives z","expected":"z","passed":true},{"actual":"1","check":"or gate: controlling one beside z","expected":"1","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"and gate: controlling zero after unknowns\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"nand gate: all ones\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"xor gate: floating input\", \"actual\": \"1\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"buffer of a floating net\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"xor gate: two unknowns\", \"actual\": \"0\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"xnor gate: parity inversion\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"inverter control\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"bufif1 unknown enable with low data\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"bufif1 unknown enable with high data\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"check\": \"bufif1 disabled drives z\", \"actual\": \"z\", \"expected\": \"z\", \"passed\": true}, {\"check\": \"or gate: controlling one beside z\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}], \"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."}}