FA-88466 / Mesh topology invariants / Open access
Valence counts a vertex as its own neighbour · case 01
Faces with a repeated corner raise the valence and create a fake boundary edge.
ROOT CAUSE
Coincident consecutive corners are not skipped.
VERIFIED REPAIR
Skip pairs with a == b.
Unsuccessful approach: Breaking out of the face at the first coincident pair drops its remaining real edges.
Case contract
Input: polygon faces. Neighbours of a vertex are the other endpoints of its edges (consecutive face corners, skipping coincident pairs). Boundary vertices are endpoints of edges used by exactly one face. Irregular vertices have valence != 6 (interior) or != 4 (boundary). Return [{vertex: valence}, irregular count, sorted boundary vertices].
Why this case matters
Mesh processing pipelines (remeshing, export, simulation, printing) trust these topological counts and adjacency answers; a wrong invariant silently accepts broken meshes or rejects valid ones.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
faces=x
nb={}
cnt={}
for f in faces:
n=len(f)
for i in range(n):
a,b=f[i],f[(i+1)%n]
nb.setdefault(a,set()).add(b)
nb.setdefault(b,set()).add(a)
k=(min(a,b),max(a,b))
cnt[k]=cnt.get(k,0)+1
bnd=set()
for (a,b),c in cnt.items():
if c==1: bnd.update((a,b))
val={str(v):len(nb[v]) for v in sorted(nb)}
irr=sum(1 for v in nb if len(nb[v])!=(4 if v in bnd else 6))
return [val,irr,sorted(bnd)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]]], [['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]], ['triangle torus', [[[0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [2, 3, 0], [3, 6, 7], [3, 7, 4], [4, 7, 8], [4, 8, 5], [5, 8, 6], [5, 6, 3], [6, 0, 1], [6, 1, 7], [7, 1, 2], [7, 2, 8], [8, 2, 0], [8, 0, 6]]], [{'0': 6, '1': 6, '2': 6, '3': 6, '4': 6, '5': 6, '6': 6, '7': 6, '8': 6}, 0, []]], ['quad torus', [[[0, 3, 4, 1], [1, 4, 5, 2], [2, 5, 3, 0], [3, 6, 7, 4], [4, 7, 8, 5], [5, 8, 6, 3], [6, 0, 1, 7], [7, 1, 2, 8], [8, 2, 0, 6]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4, '8': 4}, 9, []]]], [['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]], ['triangle torus', [[[0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [2, 3, 0], [3, 6, 7], [3, 7, 4], [4, 7, 8], [4, 8, 5], [5, 8, 6], [5, 6, 3], [6, 0, 1], [6, 1, 7], [7, 1, 2], [7, 2, 8], [8, 2, 0], [8, 0, 6]]], [{'0': 6, '1': 6, '2': 6, '3': 6, '4': 6, '5': 6, '6': 6, '7': 6, '8': 6}, 0, []]], ['quad torus', [[[0, 3, 4, 1], [1, 4, 5, 2], [2, 5, 3, 0], [3, 6, 7, 4], [4, 7, 8, 5], [5, 8, 6, 3], [6, 0, 1, 7], [7, 1, 2, 8], [8, 2, 0, 6]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4, '8': 4}, 9, []]], ['cube', [[[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]]], [{'0': 3, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 3, '7': 3}, 8, []]], ['single triangle', [[[0, 1, 2]]], [{'0': 2, '1': 2, '2': 2}, 3, [0, 1, 2]]]], [['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['cube', [[[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]]], [{'0': 3, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 3, '7': 3}, 8, []]], ['single triangle', [[[0, 1, 2]]], [{'0': 2, '1': 2, '2': 2}, 3, [0, 1, 2]]]], [['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]]]]
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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| disk | [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]] | [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]] | Passed |
| fan | [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]] | [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]] | Passed |
| tetrahedron | [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []] | [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []] | Passed |
| octahedron | [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []] | [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []] | Passed |
| triangle grid | [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]] | [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]] | Passed |
| quad grid | [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]] | [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]] | Passed |
| degenerate corner | [{'0': 3, '1': 3, '2': 3, '3': 2}, 4, [0, 1, 2, 3]] | [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]] | Failed |
SHA-256 / 884d3369665947636c897bd75ee1dde61687a9da80c76f75e3f1841dd5a4569c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
faces=x
nb={}
cnt={}
for f in faces:
n=len(f)
for i in range(n):
a,b=f[i],f[(i+1)%n]
if a==b: break
nb.setdefault(a,set()).add(b)
nb.setdefault(b,set()).add(a)
k=(min(a,b),max(a,b))
cnt[k]=cnt.get(k,0)+1
bnd=set()
for (a,b),c in cnt.items():
if c==1: bnd.update((a,b))
val={str(v):len(nb[v]) for v in sorted(nb)}
irr=sum(1 for v in nb if len(nb[v])!=(4 if v in bnd else 6))
return [val,irr,sorted(bnd)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]]], [['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]], ['triangle torus', [[[0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [2, 3, 0], [3, 6, 7], [3, 7, 4], [4, 7, 8], [4, 8, 5], [5, 8, 6], [5, 6, 3], [6, 0, 1], [6, 1, 7], [7, 1, 2], [7, 2, 8], [8, 2, 0], [8, 0, 6]]], [{'0': 6, '1': 6, '2': 6, '3': 6, '4': 6, '5': 6, '6': 6, '7': 6, '8': 6}, 0, []]], ['quad torus', [[[0, 3, 4, 1], [1, 4, 5, 2], [2, 5, 3, 0], [3, 6, 7, 4], [4, 7, 8, 5], [5, 8, 6, 3], [6, 0, 1, 7], [7, 1, 2, 8], [8, 2, 0, 6]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4, '8': 4}, 9, []]]], [['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]], ['triangle torus', [[[0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [2, 3, 0], [3, 6, 7], [3, 7, 4], [4, 7, 8], [4, 8, 5], [5, 8, 6], [5, 6, 3], [6, 0, 1], [6, 1, 7], [7, 1, 2], [7, 2, 8], [8, 2, 0], [8, 0, 6]]], [{'0': 6, '1': 6, '2': 6, '3': 6, '4': 6, '5': 6, '6': 6, '7': 6, '8': 6}, 0, []]], ['quad torus', [[[0, 3, 4, 1], [1, 4, 5, 2], [2, 5, 3, 0], [3, 6, 7, 4], [4, 7, 8, 5], [5, 8, 6, 3], [6, 0, 1, 7], [7, 1, 2, 8], [8, 2, 0, 6]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4, '8': 4}, 9, []]], ['cube', [[[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]]], [{'0': 3, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 3, '7': 3}, 8, []]], ['single triangle', [[[0, 1, 2]]], [{'0': 2, '1': 2, '2': 2}, 3, [0, 1, 2]]]], [['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['cube', [[[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]]], [{'0': 3, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 3, '7': 3}, 8, []]], ['single triangle', [[[0, 1, 2]]], [{'0': 2, '1': 2, '2': 2}, 3, [0, 1, 2]]]], [['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]]]]
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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| disk | [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]] | [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]] | Passed |
| fan | [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]] | [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]] | Passed |
| tetrahedron | [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []] | [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []] | Passed |
| octahedron | [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []] | [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []] | Passed |
| triangle grid | [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]] | [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]] | Passed |
| quad grid | [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]] | [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]] | Passed |
| degenerate corner | [{'0': 3, '1': 1, '2': 2, '3': 2}, 4, [0, 1, 2, 3]] | [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]] | Failed |
SHA-256 / 737aad19af7896710ce50b350dedac095260c7faaa31af02c497818af743a95f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
faces=x
nb={}
cnt={}
for f in faces:
n=len(f)
for i in range(n):
a,b=f[i],f[(i+1)%n]
if a==b: continue
nb.setdefault(a,set()).add(b)
nb.setdefault(b,set()).add(a)
k=(min(a,b),max(a,b))
cnt[k]=cnt.get(k,0)+1
bnd=set()
for (a,b),c in cnt.items():
if c==1: bnd.update((a,b))
val={str(v):len(nb[v]) for v in sorted(nb)}
irr=sum(1 for v in nb if len(nb[v])!=(4 if v in bnd else 6))
return [val,irr,sorted(bnd)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]]], [['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]], ['triangle torus', [[[0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [2, 3, 0], [3, 6, 7], [3, 7, 4], [4, 7, 8], [4, 8, 5], [5, 8, 6], [5, 6, 3], [6, 0, 1], [6, 1, 7], [7, 1, 2], [7, 2, 8], [8, 2, 0], [8, 0, 6]]], [{'0': 6, '1': 6, '2': 6, '3': 6, '4': 6, '5': 6, '6': 6, '7': 6, '8': 6}, 0, []]], ['quad torus', [[[0, 3, 4, 1], [1, 4, 5, 2], [2, 5, 3, 0], [3, 6, 7, 4], [4, 7, 8, 5], [5, 8, 6, 3], [6, 0, 1, 7], [7, 1, 2, 8], [8, 2, 0, 6]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4, '8': 4}, 9, []]]], [['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]], ['triangle torus', [[[0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [2, 3, 0], [3, 6, 7], [3, 7, 4], [4, 7, 8], [4, 8, 5], [5, 8, 6], [5, 6, 3], [6, 0, 1], [6, 1, 7], [7, 1, 2], [7, 2, 8], [8, 2, 0], [8, 0, 6]]], [{'0': 6, '1': 6, '2': 6, '3': 6, '4': 6, '5': 6, '6': 6, '7': 6, '8': 6}, 0, []]], ['quad torus', [[[0, 3, 4, 1], [1, 4, 5, 2], [2, 5, 3, 0], [3, 6, 7, 4], [4, 7, 8, 5], [5, 8, 6, 3], [6, 0, 1, 7], [7, 1, 2, 8], [8, 2, 0, 6]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4, '8': 4}, 9, []]], ['cube', [[[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]]], [{'0': 3, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 3, '7': 3}, 8, []]], ['single triangle', [[[0, 1, 2]]], [{'0': 2, '1': 2, '2': 2}, 3, [0, 1, 2]]]], [['disk', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1]]], [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]]], ['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['cube', [[[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]]], [{'0': 3, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3, '6': 3, '7': 3}, 8, []]], ['single triangle', [[[0, 1, 2]]], [{'0': 2, '1': 2, '2': 2}, 3, [0, 1, 2]]]], [['fan', [[[0, 1, 2], [0, 2, 3], [0, 3, 4]]], [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]]], ['tetrahedron', [[[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]]], [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []]], ['octahedron', [[[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [5, 2, 1], [5, 3, 2], [5, 4, 3], [5, 1, 4]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []]], ['triangle grid', [[[0, 1, 4], [0, 4, 3], [1, 2, 5], [1, 5, 4], [3, 4, 7], [3, 7, 6], [4, 5, 8], [4, 8, 7]]], [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]]], ['quad grid', [[[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]], [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]]], ['degenerate corner', [[[0, 1, 1, 2], [0, 2, 3]]], [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]]], ['open cylinder', [[[0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]]], [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4, '6': 4, '7': 4}, 0, [0, 1, 2, 3, 4, 5, 6, 7]]]]]
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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| disk | [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]] | [{'0': 5, '1': 3, '2': 3, '3': 3, '4': 3, '5': 3}, 6, [1, 2, 3, 4, 5]] | Passed |
| fan | [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]] | [{'0': 4, '1': 2, '2': 3, '3': 3, '4': 2}, 4, [0, 1, 2, 3, 4]] | Passed |
| tetrahedron | [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []] | [{'0': 3, '1': 3, '2': 3, '3': 3}, 4, []] | Passed |
| octahedron | [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []] | [{'0': 4, '1': 4, '2': 4, '3': 4, '4': 4, '5': 4}, 6, []] | Passed |
| triangle grid | [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]] | [{'0': 3, '1': 4, '2': 2, '3': 4, '4': 6, '5': 4, '6': 2, '7': 4, '8': 3}, 4, [0, 1, 2, 3, 5, 6, 7, 8]] | Passed |
| quad grid | [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]] | [{'0': 2, '1': 3, '2': 2, '3': 3, '4': 4, '5': 3, '6': 2, '7': 3, '8': 2}, 9, [0, 1, 2, 3, 5, 6, 7, 8]] | Passed |
| degenerate corner | [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]] | [{'0': 3, '1': 2, '2': 3, '3': 2}, 4, [0, 1, 2, 3]] | Passed |
SHA-256 / f3832f29982fa022bcf839e96f0794003daf5da69893123f9ae5495d3c918534
Verification & scope
Pure combinatorial teaching model over integer face lists with a stipulated contract; no geometry kernel or file format is implied. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:08.393517+00:00.
Case digest / f1b80d0c92ced4618da558016b51e61420ebef22fcc52b734fb4107c08108a11