{"challengeId":"vertex-cover","entry":"verifier.mjs","sha256":"06423400fd2349293e3b7cb49ba2aa5237ccb8fc33c7b47dfd599ede855e6ca2","scoreDirection":"minimize","scoreLabel":"cover size","seedPolicy":{"mode":"fixed","testCount":1},"source":"// FROZEN verifier for vertex-cover. Self-contained (no imports). The fixed,\n// undirected graph below (30 vertices, integer edge list) IS the instance —\n// protected but fully readable. The agent submits a SUBSET of vertices (a cover);\n// the verifier rejects unless EVERY edge has at least one endpoint in the set, and\n// otherwise scores the cover SIZE. Minimum Vertex Cover is NP-complete and the dual\n// of Maximum Independent Set; it underpins network monitoring (where to place\n// watchers so every link is observed), fault detection, and conflict-graph\n// reasoning in bioinformatics. PURE INTEGER arithmetic — deterministic; seedPolicy\n// \"fixed\" (the whole instance is in this file, nothing is sampled at runtime).\n\nconst N = 30;\n// Undirected edges as [u, v] with 0 <= u, v < N. A 5x6 grid backbone plus ten\n// long chords; this mix defeats trivial bipartite shortcuts and keeps a genuine\n// gap between an easy valid cover and the best known small cover.\nconst EDGES = [\n  [0, 1], [1, 2], [2, 3], [3, 4], [4, 5],\n  [6, 7], [7, 8], [8, 9], [9, 10], [10, 11],\n  [12, 13], [13, 14], [14, 15], [15, 16], [16, 17],\n  [18, 19], [19, 20], [20, 21], [21, 22], [22, 23],\n  [24, 25], [25, 26], [26, 27], [27, 28], [28, 29],\n  [0, 6], [6, 12], [12, 18], [18, 24],\n  [1, 7], [7, 13], [13, 19], [19, 25],\n  [2, 8], [8, 14], [14, 20], [20, 26],\n  [3, 9], [9, 15], [15, 21], [21, 27],\n  [4, 10], [10, 16], [16, 22], [22, 28],\n  [5, 11], [11, 17], [17, 23], [23, 29],\n  [0, 7], [2, 9], [10, 17], [12, 19], [20, 27],\n  [5, 12], [15, 22], [3, 11], [8, 16], [21, 28], [4, 11],\n];\n\nfunction gate(name, pass, detail) { return { name, pass, detail }; }\nfunction bad(name, detail) { return { ok: false, score: null, gates: [gate(name, false, detail)], behavior: {}, logs: [] }; }\n\nexport function verify(ctx) {\n  const cover = ctx.solution && typeof ctx.solution === 'object' ? ctx.solution.cover : undefined;\n  if (!Array.isArray(cover)) {\n    return bad('structure', 'expected { cover: [vertex indices, each an integer 0..29] }');\n  }\n  // Membership flags via a fixed-length integer array — pure integer indexing.\n  const inSet = new Array(N).fill(0);\n  for (const raw of cover) {\n    if (!Number.isInteger(raw) || raw < 0 || raw >= N) {\n      return bad('structure', `each vertex must be an integer 0..${N - 1}; got ${String(raw)}`);\n    }\n    inSet[raw] = 1;\n  }\n  // Count distinct covered vertices (duplicates do not inflate the score).\n  let size = 0;\n  for (let i = 0; i < N; i++) size += inSet[i];\n\n  // Reject unless EVERY edge has at least one endpoint in the set.\n  for (const [u, v] of EDGES) {\n    if (inSet[u] === 0 && inSet[v] === 0) {\n      return bad('valid-cover', `edge (${u},${v}) is uncovered — neither endpoint is in the set`);\n    }\n  }\n\n  return {\n    ok: true,\n    score: size,\n    gates: [gate('valid-cover', true, `cover of ${size} vertices guards all ${EDGES.length} edges`)],\n    behavior: { size, vertices: N },\n    logs: [`cover size=${size} over ${EDGES.length} edges`],\n  };\n}\n"}