broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,0),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,-1,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Through-holes are rejected as broken invariants.

Input: list of Euler operator names applied to counts [V,E,F,L,S,G] starting at zero. Deltas: mvfs(+V,+F,+L,+S), mev(+V,+E), mef(+E,+F,+L), kemr(-E,+L), mekr(+E,-L), kfmrh(-F,+G) and their inverses kvfs, kev, kef, mfkrh. After each op: an unknown name returns ["unknown", i]; a negative count or fewer loops than faces returns ["invalid", i]; a violated Euler-Poincare relation V-E+F-(L-F)=2(S-G) returns ["broken-invariant", i]. Return the final counts.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i]
        if V-E+Fc-L!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]]], [['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i]
        if V-E+2*Fc-L!=2*S: return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]]], [['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Any solid with a ring loop is flagged as broken.

Input: list of Euler operator names applied to counts [V,E,F,L,S,G] starting at zero. Deltas: mvfs(+V,+F,+L,+S), mev(+V,+E), mef(+E,+F,+L), kemr(-E,+L), mekr(+E,-L), kfmrh(-F,+G) and their inverses kvfs, kev, kef, mfkrh. After each op: an unknown name returns ["unknown", i]; a negative count or fewer loops than faces returns ["invalid", i]; a violated Euler-Poincare relation V-E+F-(L-F)=2(S-G) returns ["broken-invariant", i]. Return the final counts.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0: return ['invalid',i]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc-1: return ['invalid',i]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Sequences that give a face no bounding loop are accepted.

Input: list of Euler operator names applied to counts [V,E,F,L,S,G] starting at zero. Deltas: mvfs(+V,+F,+L,+S), mev(+V,+E), mef(+E,+F,+L), kemr(-E,+L), mekr(+E,-L), kfmrh(-F,+G) and their inverses kvfs, kev, kef, mfkrh. After each op: an unknown name returns ["unknown", i]; a negative count or fewer loops than faces returns ["invalid", i]; a violated Euler-Poincare relation V-E+F-(L-F)=2(S-G) returns ["broken-invariant", i]. Return the final counts.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i+1]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',op]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The error points at the operator after the offending one.

Input: list of Euler operator names applied to counts [V,E,F,L,S,G] starting at zero. Deltas: mvfs(+V,+F,+L,+S), mev(+V,+E), mef(+E,+F,+L), kemr(-E,+L), mekr(+E,-L), kfmrh(-F,+G) and their inverses kvfs, kev, kef, mfkrh. After each op: an unknown name returns ["unknown", i]; a negative count or fewer loops than faces returns ["invalid", i]; a violated Euler-Poincare relation V-E+F-(L-F)=2(S-G) returns ["broken-invariant", i]. Return the final counts.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        if op not in D: continue
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    ops=x
    V=E=Fc=L=S=G=0
    D={'mvfs':(1,0,1,1,1,0),'kvfs':(-1,0,-1,-1,-1,0),'mev':(1,1,0,0,0,0),'kev':(-1,-1,0,0,0,0),
       'mef':(0,1,1,1,0,0),'kef':(0,-1,-1,-1,0,0),'kemr':(0,-1,0,1,0,0),'mekr':(0,1,0,-1,0,0),
       'kfmrh':(0,0,-1,0,0,1),'mfkrh':(0,0,1,0,0,-1)}
    for i,op in enumerate(ops):
        op=op.lower()
        if op not in D: return ['unknown',i]
        d=D[op]
        V,E,Fc,L,S,G=V+d[0],E+d[1],Fc+d[2],L+d[3],S+d[4],G+d[5]
        if min(V,E,Fc,L,S,G)<0 or L<Fc: return ['invalid',i]
        if V-E+Fc-(L-Fc)!=2*(S-G): return ['broken-invariant',i]
    return [V,E,Fc,L,S,G]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]]], [['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['ring then remake edge', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'kemr', 'mekr']], [4, 4, 2, 2, 1, 0]], ['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]]], [['kill edge on empty', [['mvfs', 'kev']], ['invalid', 1]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['loop deficit', [['mvfs', 'mev', 'mekr']], ['invalid', 2]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]], ['two shells', [['mvfs', 'mev', 'mvfs', 'mev', 'mev', 'mef']], [5, 4, 3, 3, 2, 0]], ['face without loop', [['mvfs', 'mfkrh']], ['invalid', 1]], ['build and kill', [['mvfs', 'mev', 'mev', 'mef', 'kef', 'kev', 'kev', 'kvfs']], [0, 0, 0, 0, 0, 0]], ['hole into lamina', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mev']], [7, 7, 2, 4, 1, 1]]], [['triangle lamina', [['mvfs', 'mev', 'mev', 'mef']], [3, 3, 2, 2, 1, 0]], ['tetrahedron', [['mvfs', 'mev', 'mev', 'mef', 'mev', 'mef', 'mef']], [4, 6, 4, 4, 1, 0]], ['square with hole ring', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr']], [7, 7, 3, 4, 1, 0]], ['torus handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh']], [7, 7, 2, 4, 1, 1]], ['undo handle', [['mvfs', 'mev', 'mev', 'mev', 'mef', 'mev', 'mev', 'mev', 'mef', 'kemr', 'kfmrh', 'mfkrh']], [7, 7, 3, 4, 1, 0]], ['unknown op', [['mvfs', 'mev', 'split']], ['unknown', 2]], ['uppercase op', [['mvfs', 'MEV']], ['unknown', 1]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Misspelled operators disappear and later counts are wrong without an error.

Input: list of Euler operator names applied to counts [V,E,F,L,S,G] starting at zero. Deltas: mvfs(+V,+F,+L,+S), mev(+V,+E), mef(+E,+F,+L), kemr(-E,+L), mekr(+E,-L), kfmrh(-F,+G) and their inverses kvfs, kev, kef, mfkrh. After each op: an unknown name returns ["unknown", i]; a negative count or fewer loops than faces returns ["invalid", i]; a violated Euler-Poincare relation V-E+F-(L-F)=2(S-G) returns ["broken-invariant", i]. Return the final counts.

split: open-access


prompt:
Two of the four faces of each tet point inward in the extracted surface.

Input: tetrahedra [a,b,c,d] (positively oriented). A tet with repeated vertices returns ["degenerate", i]. Outward faces are (b,c,d),(a,d,c),(a,b,d),(a,c,b). Faces are matched by their vertex set; a set used once is boundary (kept with its first orientation, rotated to start at its smallest vertex); used more than twice returns ["non-manifold", sorted vertices]. Output boundary faces in increasing sorted-vertex-set order.

split: open-access


prompt:
Internal faces, which appear with opposite orientation, are never matched and all appear on the boundary.

Input: tetrahedra [a,b,c,d] (positively oriented). A tet with repeated vertices returns ["degenerate", i]. Outward faces are (b,c,d),(a,d,c),(a,b,d),(a,c,b). Faces are matched by their vertex set; a set used once is boundary (kept with its first orientation, rotated to start at its smallest vertex); used more than twice returns ["non-manifold", sorted vertices]. Output boundary faces in increasing sorted-vertex-set order.

split: open-access


prompt:
Output faces start at an arbitrary corner.

Input: tetrahedra [a,b,c,d] (positively oriented). A tet with repeated vertices returns ["degenerate", i]. Outward faces are (b,c,d),(a,d,c),(a,b,d),(a,c,b). Faces are matched by their vertex set; a set used once is boundary (kept with its first orientation, rotated to start at its smallest vertex); used more than twice returns ["non-manifold", sorted vertices]. Output boundary faces in increasing sorted-vertex-set order.

split: open-access


prompt:
A non-manifold tet mesh produces a surface with a missing fin.

Input: tetrahedra [a,b,c,d] (positively oriented). A tet with repeated vertices returns ["degenerate", i]. Outward faces are (b,c,d),(a,d,c),(a,b,d),(a,c,b). Faces are matched by their vertex set; a set used once is boundary (kept with its first orientation, rotated to start at its smallest vertex); used more than twice returns ["non-manifold", sorted vertices]. Output boundary faces in increasing sorted-vertex-set order.

split: open-access


prompt:
The face list order depends on tet order.

Input: tetrahedra [a,b,c,d] (positively oriented). A tet with repeated vertices returns ["degenerate", i]. Outward faces are (b,c,d),(a,d,c),(a,b,d),(a,c,b). Faces are matched by their vertex set; a set used once is boundary (kept with its first orientation, rotated to start at its smallest vertex); used more than twice returns ["non-manifold", sorted vertices]. Output boundary faces in increasing sorted-vertex-set order.

split: open-access


prompt:
Tets with repeated vertices produce collapsed boundary faces.

Input: tetrahedra [a,b,c,d] (positively oriented). A tet with repeated vertices returns ["degenerate", i]. Outward faces are (b,c,d),(a,d,c),(a,b,d),(a,c,b). Faces are matched by their vertex set; a set used once is boundary (kept with its first orientation, rotated to start at its smallest vertex); used more than twice returns ["non-manifold", sorted vertices]. Output boundary faces in increasing sorted-vertex-set order.

split: open-access


prompt:
Every interior edge is reported as a seam because neighbours traverse it in opposite directions.

Input [faces, uvfaces]: each face has a parallel list of UV indices. A face whose UV list length differs returns ["uv-mismatch", face index]. A geometric edge is a seam when a later face assigns a different UV index to either endpoint than the first face did. Return sorted seam edges [min,max].

split: open-access


prompt:
Edges whose UV splits at only one endpoint are not marked as seams.

Input [faces, uvfaces]: each face has a parallel list of UV indices. A face whose UV list length differs returns ["uv-mismatch", face index]. A geometric edge is a seam when a later face assigns a different UV index to either endpoint than the first face did. Return sorted seam edges [min,max].

split: open-access


prompt:
A short UV list is wrapped around the face and invents seams.

Input [faces, uvfaces]: each face has a parallel list of UV indices. A face whose UV list length differs returns ["uv-mismatch", face index]. A geometric edge is a seam when a later face assigns a different UV index to either endpoint than the first face did. Return sorted seam edges [min,max].

split: open-access


prompt:
The two faces on an edge never meet in the table, so no seam is ever reported.

Input [faces, uvfaces]: each face has a parallel list of UV indices. A face whose UV list length differs returns ["uv-mismatch", face index]. A geometric edge is a seam when a later face assigns a different UV index to either endpoint than the first face did. Return sorted seam edges [min,max].

split: open-access


prompt:
With index gaps the inserted vertex aliases a vertex that already exists.

Input [faces, a, b] for a triangle mesh (any non-triangle returns "non-triangle"). Insert vertex m = max index + 1 on edge {a,b}: each triangle (u,w,c) with {u,w}={a,b} along its boundary becomes [u,m,c] then [m,w,c] at its original position. No such triangle returns "no-edge". Return [m, faces, number of split triangles].

split: open-access


prompt:
The two children of each split face point the opposite way.

Input [faces, a, b] for a triangle mesh (any non-triangle returns "non-triangle"). Insert vertex m = max index + 1 on edge {a,b}: each triangle (u,w,c) with {u,w}={a,b} along its boundary becomes [u,m,c] then [m,w,c] at its original position. No such triangle returns "no-edge". Return [m, faces, number of split triangles].

split: open-access


prompt:
The neighbour across the edge keeps a T-junction.

Input [faces, a, b] for a triangle mesh (any non-triangle returns "non-triangle"). Insert vertex m = max index + 1 on edge {a,b}: each triangle (u,w,c) with {u,w}={a,b} along its boundary becomes [u,m,c] then [m,w,c] at its original position. No such triangle returns "no-edge". Return [m, faces, number of split triangles].

split: open-access


prompt:
Quads are split along a false diagonal and lose a corner.

Input [faces, a, b] for a triangle mesh (any non-triangle returns "non-triangle"). Insert vertex m = max index + 1 on edge {a,b}: each triangle (u,w,c) with {u,w}={a,b} along its boundary becomes [u,m,c] then [m,w,c] at its original position. No such triangle returns "no-edge". Return [m, faces, number of split triangles].

split: open-access


prompt:
Requests for a non-existent edge return the unchanged mesh with a new vertex id.

Input [faces, a, b] for a triangle mesh (any non-triangle returns "non-triangle"). Insert vertex m = max index + 1 on edge {a,b}: each triangle (u,w,c) with {u,w}={a,b} along its boundary becomes [u,m,c] then [m,w,c] at its original position. No such triangle returns "no-edge". Return [m, faces, number of split triangles].

split: open-access


prompt:
Face indices shift, breaking per-face attribute arrays.

Input [faces, a, b] for a triangle mesh (any non-triangle returns "non-triangle"). Insert vertex m = max index + 1 on edge {a,b}: each triangle (u,w,c) with {u,w}={a,b} along its boundary becomes [u,m,c] then [m,w,c] at its original position. No such triangle returns "no-edge". Return [m, faces, number of split triangles].

split: open-access


prompt:
Interior vertices of closed meshes are over-counted by one each.

Input [faces, kind] with kind "tri" or "quad". Valence = number of edge neighbours; boundary vertices touch an edge used once. Regular valence is 6/4 (tri interior/boundary) or 4/3 (quad). Index sum = sum of (regular - valence). Return [index sum, chi=V-E+F, index sum == k*chi] with k=6 for tri and 4 for quad.

split: open-access


prompt:
Open triangle meshes fail the index identity.

Input [faces, kind] with kind "tri" or "quad". Valence = number of edge neighbours; boundary vertices touch an edge used once. Regular valence is 6/4 (tri interior/boundary) or 4/3 (quad). Index sum = sum of (regular - valence). Return [index sum, chi=V-E+F, index sum == k*chi] with k=6 for tri and 4 for quad.

split: open-access


prompt:
Open meshes get a wrong Euler characteristic, so the index identity fails.

Input [faces, kind] with kind "tri" or "quad". Valence = number of edge neighbours; boundary vertices touch an edge used once. Regular valence is 6/4 (tri interior/boundary) or 4/3 (quad). Index sum = sum of (regular - valence). Return [index sum, chi=V-E+F, index sum == k*chi] with k=6 for tri and 4 for quad.

split: open-access


prompt:
Quad meshes report a failed identity.

Input [faces, kind] with kind "tri" or "quad". Valence = number of edge neighbours; boundary vertices touch an edge used once. Regular valence is 6/4 (tri interior/boundary) or 4/3 (quad). Index sum = sum of (regular - valence). Return [index sum, chi=V-E+F, index sum == k*chi] with k=6 for tri and 4 for quad.

split: open-access


prompt:
Faces sharing two edges report degree 2 for one neighbour.

Input: polygon faces. Two faces are adjacent when they share an undirected edge (fins give every pair on the edge). Return [distinct adjacent face count per face, number of adjacent face pairs].

split: open-access


prompt:
Every face degree is one too high.

Input: polygon faces. Two faces are adjacent when they share an undirected edge (fins give every pair on the edge). Return [distinct adjacent face count per face, number of adjacent face pairs].

split: open-access


prompt:
Consistently oriented neighbours are not found; only flipped ones are.

Input: polygon faces. Two faces are adjacent when they share an undirected edge (fins give every pair on the edge). Return [distinct adjacent face count per face, number of adjacent face pairs].

split: open-access


prompt:
Face pairs sharing two edges or fins are miscounted.

Input: polygon faces. Two faces are adjacent when they share an undirected edge (fins give every pair on the edge). Return [distinct adjacent face count per face, number of adjacent face pairs].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('x' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = 'x' if 'x' in ins else ('0' if '0' in ins else '1')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if 'x' in ins else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('x' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if ins[0] == '0' else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if 'x' in ins else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An AND gate with a 0 input and an unknown input reports x instead of the definite 0.

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).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = list(ins)
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if 'x' in ins else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('0' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if 'x' in ins else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A buffer driven by a floating net outputs 'z' and an XOR with a floating pin produces a definite parity.

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).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('x' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('x' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if ins.count('x') % 2 else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An XOR gate with an unknown input returns a definite parity bit.

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).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('x' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if 'x' in ins else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'not') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    gate, ins = args
    def inv(v):
        return {'0': '1', '1': '0'}.get(v, 'x')
    ins = [('x' if v == 'z' else v) for v in ins]
    if gate == 'bufif1':
        d, e = ins
        return 'z' if e == '0' else ('x' if e == 'x' else d)
    if gate in ('and', 'nand'):
        r = '0' if '0' in ins else ('1' if all(v == '1' for v in ins) else 'x')
    elif gate in ('or', 'nor'):
        r = '1' if '1' in ins else ('0' if all(v == '0' for v in ins) else 'x')
    elif gate in ('xor', 'xnor'):
        r = 'x' if 'x' in ins else str(ins.count('1') % 2)
    else:
        r = ins[0]
    return inv(r) if gate in ('nand', 'nor', 'xnor') else r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An XNOR gate returns the same value as XOR.

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).

split: open-access