#!/usr/bin/env python3 """Job 990 - the fractional (LP) certificate frontier against the capacity frontier. For each prime p in the ladder: a deep support (a = A0, cap 131072), Q = the primes in (p, 2p]. Two thresholds in N (number of admissible slots in the prefix): N_F, L_F the capacity/counting frontier: the first N with F1 = |D| - sum_q max_b |K| > 0. N_w, L_w the fractional frontier: the smallest N on a contiguous down-run from N_F - 1 on which `certify` still returns a VERIFIED non-coverability, i.e. the counting, tight or weighted rule fires with an exact re-check. `certify` is a decision heuristic for the weighted rule (an LP solved by exponentiated-gradient ascent plus exact rational re-check), so `N_w` is a bounded SEARCH result: the down-run stops at the first prefix the tested budget cannot decide. Every certificate reported is re-checked exactly by `tightcert.verify`, so each row is a proof about one finite support, not an estimate. `ratio = L_w / L_F` is the route's quantity: the fraction of the capacity frontier that a fractional refutation already covers. The `uniform` column is the Q-only dual baseline sum_{q in Q} 2/q, the value of the uniform per-modulus phase mixture. stdout is the artifact and carries no wall-clock; progress goes to stderr. """ import json import sys import time import tightcert as tc T0 = time.time() A0 = 10007 CAP = 131072 BUDGET = dict(iters=700, dual_iters=3000) MAX_DOWN = 24 def main(): ps = [int(x) for x in sys.argv[1:]] or [31, 43, 61, 97, 127] print('# Job 990 - fractional (LP) certificate frontier vs the capacity frontier') print('# support: a = %d, cap %d; Q = primes in (p, 2p]; D_N = first N admissible slots' % (A0, CAP)) print('# N_F/L_F = first N with the counting budget F1 > 0') print('# N_w/L_w = smallest N on the contiguous down-run from N_F-1 with a VERIFIED') print('# non-coverability from the counting, tight or weighted rule') print('# uniform = sum_{q in Q} 2/q (Q-only dual baseline, lower bound on m*)') print('# weighted budget: iters=%d dual_iters=%d; down-run cap %d prefixes' % (BUDGET['iters'], BUDGET['dual_iters'], MAX_DOWN)) print('') print(' p |Q| N_F L_F N_w L_w ratio uniform rule at N_w down-run rules') rows = [] for p in ps: _, qs, slots = tc.prime_band(p, A0, CAP) n_f = l_f = None for N in range(1, len(slots) + 1): f1, _ = tc.budget(slots[:N], qs) if f1 > 0: n_f, l_f = N, slots[N - 1] - A0 + 1 break rows_seen = [] n_w = None for step in range(1, MAX_DOWN + 1): N = n_f - step if N < 1: break D = slots[:N] cert = tc.certify(D, qs, **BUDGET) ok, checks = tc.verify(cert, D, qs) assert ok, (p, N, cert.get('rule'), [c for c in checks if not c[1]]) rule = cert.get('rule') if rule in ('counting', 'tight_dead_slot', 'tight_no_tiling', 'weighted'): n_w, rule_w = N, rule rows_seen.append('%d:%s' % (N, rule)) continue rows_seen.append('%d:%s' % (N, rule)) break l_w = slots[n_w - 1] - A0 + 1 if n_w else None uniform = sum((tc.Fraction(2, q) for q in qs), tc.Fraction(0)) ratio = ('%.4f' % (l_w / l_f)) if (n_w and l_f) else '-' print(' %4d %4d %5d %6d %6s %6s %7s %7.4f %-12s %s' % (p, len(qs), n_f, l_f, n_w or '-', l_w or '-', ratio, float(uniform), rule_w if n_w else '-', ' '.join(rows_seen[:8]))) rows.append({'p': p, 'Q': qs, 'a': A0, 'N_F': n_f, 'L_F': l_f, 'N_w': n_w, 'L_w': l_w, 'rule_at_N_w': rule_w if n_w else None, 'ratio_Lw_over_LF': ratio, 'uniform_2_over_q': [uniform.numerator, uniform.denominator], 'down_run': rows_seen}) sys.stderr.write('ladder p=%d done (%.1fs)\n' % (p, time.time() - T0)) sys.stderr.flush() print('') print('## Reading') print(' ratio = L_w / L_F is how much of the capacity frontier a fractional') print(' refutation already reaches: 1.0 means the LP adds nothing over counting,') print(' and a ratio bounded away from 1 means the fractional relaxation certifies') print(' non-coverability on supports the counting bound cannot touch. The route is') print(' worth pursuing only if the ratio stays bounded away from 1 along the ladder') print(' (a persistent fractional advantage); a ratio rising to 1 kills it.') print('') print('Scope: one deep start per p, a window cap of %d, and a bounded certificate' % CAP) print('search (the down-run stops at the first undecided prefix). No claim here') print('touches H_alpha, TPC, or any infinite family.') json.dump(rows, open('ladder.json', 'w'), indent=1, sort_keys=True) tc.log('ladder done in %.1fs' % (time.time() - T0)) if __name__ == '__main__': main()