{"abstract":"A buffer driven by a floating net outputs 'z' and an XOR with a floating pin produces a definite parity.","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":"Treating a floating input as a pulled-down 0 invents a definite value that the contract says is unknown.","family":"w2-digital-logic-simulation-four-valued-gates-floating-input-normalization","id":"FA-88846","implementations":{"attempt":{"sha256":"b5fd3a6a8c22a06142e9518e64f0dfc4426c602d87cf5b207d1f2dbf246cb9e7","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 = [('0' 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 'x' in ins 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":"ceaf263ae5dfa2b288d950fd5f159c4ffa3caee1a9198f62b3947b1243e7ef22","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 = list(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 'x' in ins 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"}},"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-floating-input-normalization","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":"Gate inputs are not normalized, so a 'z' is neither treated as unknown nor caught by the x checks.","sha256":"24f9708e9dbffd0e362902c16c744b791441819e901f773746542f01c3ad9bc4","title":"Floating gate input is evaluated as a literal z · 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.899,"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":"0","check":"buffer of a floating net","expected":"x","passed":false},{"actual":"x","check":"xor gate: two unknowns","expected":"x","passed":true},{"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":"z","check":"bufif1 unknown enable with high data","expected":"x","passed":false},{"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\": \"0\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"xor gate: two unknowns\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"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\": \"z\", \"expected\": \"x\", \"passed\": false}, {\"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":41.63,"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":"z","check":"buffer of a floating net","expected":"x","passed":false},{"actual":"x","check":"xor gate: two unknowns","expected":"x","passed":true},{"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":"1","check":"bufif1 unknown enable with high data","expected":"x","passed":false},{"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\": \"z\", \"expected\": \"x\", \"passed\": false}, {\"check\": \"xor gate: two unknowns\", \"actual\": \"x\", \"expected\": \"x\", \"passed\": true}, {\"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\": \"1\", \"expected\": \"x\", \"passed\": false}, {\"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."}}