"""Independent second-order rigorous verifier for the continuum fixed-cap tables of main.tex (Section 'Continuum certificates at fixed height'). Reads only the coefficient JSON (cuts, small_bins, coefficients, target, empty_direction). Formulas for the independent implementation: free list, count vector r, no giant: f = c_r [+ w_j H(s) if exactly one small part s and j rough parts], w_2 = 1, w_3 = -1; f = 0 if a part < eta. giant list (z, y), y > 1/2: f = -y [ G_z(y) + tag_z(y) ], G_z = sum_{r>=z} c_r L_{r-z} = chiA_z + sum_{v != 0} (-1)^{|v|} K_v * chiA_{z+v}, A_u = sum_{r>=u} c_r K_{r-u} (free completion mass of observation u), tag_z = sum_j w_j P_{j-b}(y) if z has no small part (b rough parts), = H(s) sum_j w_j L^R_{j-b}(y) if z has one small part s. diagonal: H(s) = - D_i(1-s) / Den(1-s), D_i = sum_{r>=e_i} c_r T_{r-e_i} = Atilde_{e_i} + chiA_{e_i} + sum_{v!=0} (-2)^{|v|} K_v * chiA_{e_i+v}, Atilde_u = sum_{r>=u} c_r (-1)^{|r-u|} K_{r-u}, Den = sum_j w_j T^R_j = 2 R_2 + 2 R_1 * chiR_2 (using chiR_1 = chiR_0 = 0). empty signed: t = -(sum_r c_r T_r(1) + S_2(1) - S_3(1)) / sum_r d_r T_r(1), on rough-only boxes. prime: f((1)) = -[ G_0(1) + t G^dir_0(1) + P_2(1) - P_3(1) ]. """ import json, sys, time, math from fractions import Fraction as Fr from itertools import product, combinations_with_replacement import numpy as np from plencl import (PL, Cubic, CubicAcc, conv, reenclose, pl_to_cubic, pl_axpy, point_inner, cubic_cell_bounds, cubic_right_end, cubic_sub_bounds, float_interval, zero_pl, dn, up) KSUB = 8 # final-step subdivision of each y-cell (for the -y*B product only) def log(*a): print(time.strftime('%H:%M:%S', time.gmtime()), *a, flush=True) def base_kernel(M, a, b): """1/t on cells [a,b): lower = tangent at the cell midpoint (1/t convex), upper = chord.""" m = np.arange(a, b, dtype=np.float64) assert a >= 1 lo0 = np.maximum(dn(dn(4.0 * M * (m + 1)) / up((2 * m + 1) ** 2)), 0.0) lo1 = np.maximum(dn(dn(4.0 * M * m) / up((2 * m + 1) ** 2)), 0.0) hi0 = up(M / m); hi1 = up(M / (m + 1)) return PL(a, lo0, lo1, hi0, hi1) def scale_pl(F, num, den): """F * num/den for positive integers num, den (outward).""" l0 = dn(dn(F.lo0 * num) / den); l1 = dn(dn(F.lo1 * num) / den) if F.nonneg: l0 = np.maximum(l0, 0.0); l1 = np.maximum(l1, 0.0) return PL(F.off, l0, l1, up(up(F.hi0 * num) / den), up(up(F.hi1 * num) / den), nonneg=F.nonneg) def iv_add(x, y, k=1): if k >= 0: return (float(dn(x[0] + k * y[0])), float(up(x[1] + k * y[1]))) return (float(dn(x[0] + k * y[1])), float(up(x[1] + k * y[0]))) def iv_mul(x, y): p = [x[i] * y[j] for i in range(2) for j in range(2)] return (float(dn(min(p))), float(up(max(p)))) def iv_div(x, y): assert y[0] > 0 or y[1] < 0 p = [x[i] / y[j] for i in range(2) for j in range(2)] return (float(dn(min(p))), float(up(max(p)))) class RMQ: def __init__(self, lo, hi): self.low = [lo]; self.high = [hi]; w = 1 while 2 * w <= len(lo): self.low.append(np.minimum(self.low[-1][:-w], self.low[-1][w:])) self.high.append(np.maximum(self.high[-1][:-w], self.high[-1][w:])) w *= 2 def query(self, a, b): """min/max over indices a..b inclusive (arrays).""" ln = b - a + 1 assert np.all(ln >= 1) lev = np.zeros_like(ln) while True: nxt = (1 << (lev + 1)) <= ln if not np.any(nxt): break lev = lev + nxt lo = np.empty(len(a)); hi = np.empty(len(a)) for L in np.unique(lev): k = lev == L l = a[k]; r = b[k] + 1 - (1 << L) lo[k] = np.minimum(self.low[L][l], self.low[L][r]) hi[k] = np.maximum(self.high[L][l], self.high[L][r]) return lo, hi def verify(fname, M, probe=()): probes = {} dat = json.load(open(fname)) den_ = dat['denominator'] cuts = [] for c in dat['cuts']: x = Fr(c * M, den_) assert x.denominator == 1, 'mesh must align with the cuts' cuts.append(int(x)) small = int(dat.get('small_bins', 1)) k = len(cuts) - 1 eta, alpha, half = cuts[0], cuts[small], M // 2 assert cuts[-1] == half and M % 2 == 0 co = {tuple(map(int, s.split(','))): Fr(str(v)) for s, v in dat['coefficients'].items()} target = Fr(str(dat['target'])) mode = dat.get('empty_direction', 'single') assert dat['profile'] == '23' prof = {2: 1, 3: -1} lower = lambda v: sum(a * b for a, b in zip(v, cuts[:-1])) upper = lambda v: sum(a * b for a, b in zip(v, cuts[1:])) zero = (0,) * k unit = lambda i: tuple(int(j == i) for j in range(k)) add = lambda a, b: tuple(x + y for x, y in zip(a, b)) sub = lambda a, b: tuple(x - y for x, y in zip(a, b)) leq = lambda a, b: all(x <= y for x, y in zip(a, b)) parts = lambda r: product(*(range(a + 1) for a in r)) nsm = lambda v: sum(v[:small]) # support rule of the paper: two smallest small-bin lower edges sum >= alpha for r in co: least = [cuts[i] for i in range(small) for _ in range(min(r[i], 2))] assert len(least) < 2 or least[0] + least[1] >= alpha, ('support rule', r) assert sum(a * b for a, b in zip(r, cuts[:-1])) < M < sum(a * b for a, b in zip(r, cuts[1:])) or True log(f'table {fname} M={M} bins={k} small={small} eta={eta/M} alpha={alpha/M} coefficients={len(co)} mode={mode}') # ---------- index sets tagboxes = set() for i in range(small): for cnt in prof: for rough in combinations_with_replacement(range(small, k), cnt): v = list(unit(i)) for j in rough: v[j] += 1 tagboxes.add(tuple(v)) free = set(co) | tagboxes subs_free = set() for r in free: for v in parts(r): subs_free.add(v) obs = sorted([z for z in subs_free if z != zero and lower(z) < half], key=lambda z: (sum(z), z)) subs_co = set() for r in co: for v in parts(r): subs_co.add(v) # (z, v) pairs and A keys. z ranges over obs and the empty observation. pairs = {} # u -> list of (z, v) Akeys = set() left = set() for z in [zero] + obs: if z not in subs_co: continue for r in co: if not leq(z, r): continue d = sub(r, z) for v in parts(d): w = sub(d, v) if upper(w) <= half or sum(w) == 0: continue if v != zero and lower(z) + lower(v) >= half: continue if v != zero and v == d: continue u = add(z, v) Akeys.add(u) pairs.setdefault(u, set()).add((z, v)) if v != zero: left.add(v) rough_boxes = [r for r in co if nsm(r) == 0] rough_subs = set() for r in rough_boxes: for v in parts(r): rough_subs.add(v) log(f'observations {len(obs)}, A keys {len(Akeys)}, left kernels {len(left)}, ' f'(z,v) pairs {sum(len(p) for p in pairs.values())}, rough boxes {len(rough_boxes)}') # ---------- accumulators Apos = {}; Aneg = {} for u in Akeys: a, b = half, M - lower(u) Apos[u] = zero_pl(a, b); Aneg[u] = zero_pl(a, b) Atpos = {}; Atneg = {} for i in range(small): u = unit(i) a, b = max(half, M - cuts[i + 1]), M - cuts[i] Atpos[u] = zero_pl(a, b); Atneg[u] = zero_pl(a, b) A0 = (0.0, 0.0); At0 = (0.0, 0.0) # A_0(1), Atilde_0(1) K1 = {} # K_r(1) for direction boxes Kleft = {}; Kright_rough = {}; Kleft_rough = {} contrib = {} # w -> list of (u, c) for u in Akeys: for r in co: if leq(u, r): contrib.setdefault(sub(r, u), []).append((u, co[r])) cint = {r: float_interval(c) for r, c in co.items()} # ---------- kernels K_u by increasing |u| needed = set(subs_co) levels = {} maxlev = max(sum(v) for v in needed) base = {i: base_kernel(M, cuts[i], cuts[i + 1]) for i in range(k)} prev = {zero: None} nconv = 0 t0 = time.time() for lev in range(1, maxlev + 1): cur = {} for u in sorted(v for v in needed if sum(v) == lev): i = next(j for j in range(k) if u[j]) par = sub(u, unit(i)) if lev == 1: K = base[i] else: P = prev[par] cb = conv(P, base[i], M, lim=M) nconv += 1 K = scale_pl(reenclose(cb), 1, u[i]).trim() cur[u] = K if u in left: Kleft[u] = K.window(K.off, min(K.end, half)) if u in rough_subs: Kright_rough[u] = K.window(max(K.off, half), M) Kleft_rough[u] = K.window(K.off, min(K.end, half)) # contributions c_{u'+u} K_u into A_{u'} for (up_, c) in contrib.get(u, ()): clo, chi = cint[add(up_, u)] tgt = Apos[up_] if c > 0 else Aneg[up_] if c < 0: clo, chi = -chi, -clo win = K.window(max(K.off, tgt.off), min(K.end, tgt.end)) pl_axpy(tgt, win, clo, chi) # Atilde for u' = e_i for i2 in range(small): ui = unit(i2); r = add(ui, u) if r in co: c = co[r] * (-1) ** lev clo, chi = float_interval(abs(c)) tgt = Atpos[ui] if c > 0 else Atneg[ui] win = K.window(max(K.off, tgt.off), min(K.end, tgt.end)) pl_axpy(tgt, win, clo, chi) # point values at y = 1 for the empty observation if u in co and K.end == M: v1 = (float(K.lo1[-1]), float(K.hi1[-1])) A0 = iv_add(A0, iv_mul(cint[u], v1)) At0 = iv_add(At0, iv_mul(cint[u], v1), 1 if lev % 2 == 0 else -1) K1[u] = v1 prev = cur log(f' level {lev}: {len(cur)} kernels, total conv {nconv}, {time.time()-t0:.0f}s') del prev, cur # ---------- pooled rough kernels and tags R1 = base_kernel(M, alpha, half) R2 = scale_pl(reenclose(conv(R1, R1, M, lim=M)), 1, 2).trim() R3 = scale_pl(reenclose(conv(R2, R1, M, lim=M)), 1, 3).trim() chiR2 = R2.window(max(R2.off, half), M); chiR3 = R3.window(max(R3.off, half), M) Rc = conv(R1, chiR2, M, lim=M) # R_1 * chi R_2 # Den on y-cells [M-alpha, M-eta) denacc = CubicAcc(M - alpha, M - eta) denacc.add(pl_to_cubic(R2), 2); denacc.add(Rc, 2) den_lo, den_hi = cubic_cell_bounds(denacc.cubic()) # ---------- observations with one small part first: G_{e_i}, D_i, H def G_and_D(z, want_D): a, b = max(half, M - upper(z)), M - lower(z) G = CubicAcc(a, b) D = CubicAcc(a, b) if want_D else None nc = 0 for (zz, v) in sorted(((zz, v) for u in Akeys for (zz, v) in pairs[u] if zz == z), key=lambda p: p[1]): u = add(z, v) if v == zero: G.add(pl_to_cubic(Apos[u]), 1); G.add(pl_to_cubic(Aneg[u]), -1) if want_D: D.add(pl_to_cubic(Apos[u]), 1); D.add(pl_to_cubic(Aneg[u]), -1) continue Kv = Kleft[v] cp = conv(Kv, Apos[u], M, lim=b); cn = conv(Kv, Aneg[u], M, lim=b) nc += 2 s1 = (-1) ** sum(v) G.add(cp, s1); G.add(cn, -s1) if want_D: s2 = (-2) ** sum(v) D.add(cp, s2); D.add(cn, -s2) if want_D: D.add(pl_to_cubic(Atpos[z]), 1); D.add(pl_to_cubic(Atneg[z]), -1) return G, D, nc Gcache = {} Hlo = np.full(M, np.nan); Hhi = np.full(M, np.nan) for i in range(small): z = unit(i) G, D, nc = G_and_D(z, True) if z in subs_co else (None, None, 0) Gcache[z] = G a, b = max(half, M - cuts[i + 1]), M - cuts[i] assert a == M - cuts[i + 1] dlo, dhi = cubic_cell_bounds(D.cubic()) n = np.arange(a, b) dl = den_lo[n - denacc.off]; dh = den_hi[n - denacc.off] assert dl.min() > 0, 'denominator separated from zero' q = [(-dhi) / dl, (-dhi) / dh, (-dlo) / dl, (-dlo) / dh] hl = dn(np.minimum.reduce(q)); hh = up(np.maximum.reduce(q)) m = M - 1 - n # s-cell of y-cell n Hlo[m] = hl; Hhi[m] = hh log(f' small bin {i}: D_i/Den done ({nc} conv), H in [{hl.min():.6f},{hh.max():.6f}], Den min {dl.min():.6f}') sl = slice(eta, alpha) assert not np.any(np.isnan(Hlo[sl])) and Hlo[sl].min() > 0, 'H positive' log(f'H enclosure over (eta,alpha): [{Hlo[sl].min():.8f}, {Hhi[sl].max():.8f}], ' f'max cell width {np.max(Hhi[sl]-Hlo[sl]):.2e}, Den min {den_lo.min():.8f}') Hrmq = RMQ(Hlo[sl].copy(), Hhi[sl].copy()) # J_0 = H(t)/t on (eta, alpha): H constant bound per cell times linear 1/t bounds kk = base_kernel(M, eta, alpha) J0 = PL(eta, np.maximum(dn(Hlo[sl] * kk.lo0), 0.0), np.maximum(dn(Hlo[sl] * kk.lo1), 0.0), up(Hhi[sl] * kk.hi0), up(Hhi[sl] * kk.hi1)) J1 = reenclose(conv(J0, R1, M, lim=M)).trim() J2 = reenclose(conv(J0, R2, M, lim=M)).trim() J3c = conv(J0, R3, M, lim=M) chiJ1 = J1.window(max(J1.off, half), M); chiJ2 = J2.window(max(J2.off, half), M) Q1 = conv(R1, chiJ1, M, lim=M); Q2 = conv(R1, chiJ2, M, lim=M); Q3 = conv(R2, chiJ1, M, lim=M) Q4 = conv(J0, chiR2, M, lim=M); Q5 = conv(J0, chiR3, M, lim=M); Q6 = conv(J1, chiR2, M, lim=M) J2c = pl_to_cubic(J2); J1c = pl_to_cubic(J1) def comb(terms, a, b): acc = CubicAcc(a, b) for cb, w in terms: acc.add(cb, w) return acc.cubic() P1 = [(J1c, 1)] P2 = [(J2c, 1), (Q1, -1), (Q4, -1)] P3 = [(J3c, 1), (Q2, -1), (Q3, 1), (Q5, -1), (Q6, 1)] neg = lambda T: [(c, -w) for c, w in T] ordinary = {0: P2 + neg(P3), 1: P1 + neg(P2), 2: neg(P1)} ordc = {b: comb(T, half, M) for b, T in ordinary.items()} pinned = {0: [(pl_to_cubic(R2), 1), (pl_to_cubic(R3), -1), (Rc, 1)], 1: [(pl_to_cubic(R2), -1)]} pinc = {b: comb(T, half, M) for b, T in pinned.items()} S2 = [(Q1, -2), (Q4, -2)] S3 = [(J3c, 2), (Q2, -2), (Q3, 4), (Q5, -2), (Q6, 4)] Sc = comb(S2 + neg(S3), M - 1, M) s_lo, s_hi = cubic_right_end(Sc) S_end = (float(s_lo[-1]), float(s_hi[-1])) # sum_j w_j S_j(1) o_lo, o_hi = cubic_right_end(ordc[0]) P_end = (float(o_lo[-1]), float(o_hi[-1])) # P_2(1) - P_3(1) log(f'tags: sum w_j S_j(1) in {S_end}, P_2(1)-P_3(1) in {P_end}') # ---------- point inner products at y = 1 I = {} for v in sorted(left): if v in Akeys: pp = point_inner(Kleft[v], Apos[v], M); pn = point_inner(Kleft[v], Aneg[v], M) I[v] = (float(dn(pp[0] - pn[1])), float(up(pp[1] - pn[0]))) G0 = A0 D0 = iv_add(A0, At0) for v, val in I.items(): G0 = iv_add(G0, val, (-1) ** sum(v)) D0 = iv_add(D0, val, (-2) ** sum(v)) # T_r(1) and L_r(1) for rough boxes Tr = {}; Lr = {} for r in rough_boxes: k1 = K1.get(r, (0.0, 0.0)) T = (0.0, 0.0) if sum(r) % 2 else iv_add((0.0, 0.0), k1, 2) L = k1 for v in parts(r): if v == zero or v == r or lower(v) >= half: continue w = sub(r, v) if upper(w) <= half: continue val = point_inner(Kleft_rough[v], Kright_rough[w], M) T = iv_add(T, val, (-2) ** sum(v)); L = iv_add(L, val, (-1) ** sum(v)) Tr[r] = T; Lr[r] = L if mode == 'aligned': direction = {r: (1 if Tr[r][0] > 0 else -1) for r in rough_boxes if Tr[r][0] > 0 or Tr[r][1] < 0} desc = f'{len(direction)} aligned rough boxes' else: g = max(rough_boxes, key=lambda r: min(abs(x) for x in Tr[r]) if Tr[r][0] * Tr[r][1] > 0 else 0) direction = {g: 1} desc = str(g) dden = (0.0, 0.0); Gdir = (0.0, 0.0) for r, d in direction.items(): dden = iv_add(dden, Tr[r], d); Gdir = iv_add(Gdir, Lr[r], d) assert dden[0] > 0 or dden[1] < 0 tglob = iv_add(D0, S_end) t = iv_div((-tglob[1], -tglob[0]), dden) prime = iv_add(iv_add(G0, iv_mul(t, Gdir)), P_end) prime = (-prime[1], -prime[0]) log(f'empty direction {desc}: t in {t}; prime value in {prime} (width {prime[1]-prime[0]:.2e})') assert prime[1] < 0 # ---------- fold t into A for rough-only keys, and into the free constants tpos = (max(t[0], 0.0), max(t[1], 0.0)); tneg = (max(-t[1], 0.0), max(-t[0], 0.0)) cfree = {r: cint[r] for r in co} for r, d in direction.items(): cfree[r] = iv_add(cint[r], t, d) for u in Akeys: if nsm(u) != 0: continue for r, d in direction.items(): if not leq(u, r): continue w = sub(r, u) if w not in Kright_rough: continue K = Kright_rough[w] for tgt, (a_, b_) in ((Apos[u], tpos if d > 0 else tneg), (Aneg[u], tneg if d > 0 else tpos)): if b_ == 0: continue win = K.window(max(K.off, tgt.off), min(K.end, tgt.end)) pl_axpy(tgt, win, a_, b_) # ---------- free values flo = 0.0; fhi = 0.0; where_hi = None; where_lo = None for r in sorted(free): if not (lower(r) < M < upper(r)): continue val = cfree.get(r, (0.0, 0.0)) if nsm(r) == 1 and sum(r[small:]) in prof: i = r[:small].index(1) rr = tuple(0 if j < small else r[j] for j in range(k)) a = max(cuts[i], M - upper(rr)); b = min(cuts[i + 1], M - lower(rr)) if b <= a: continue hl, hh = Hrmq.query(np.array([a - eta]), np.array([b - 1 - eta])) w = prof[sum(r[small:])] val = iv_add(val, (float(hl[0]), float(hh[0])), w) if val[1] > fhi: fhi, where_hi = val[1], (r, 'free') if val[0] < flo: flo, where_lo = val[0], (r, 'free') log(f'free interval [{flo:.8f}, {fhi:.8f}]') # ---------- giant rows nconv2 = 0; cells = 0 for z in obs: a, b = max(half, M - upper(z)), M - lower(z) if b <= a: continue n = np.arange(a, b) blo = np.zeros(len(n)); bhi = np.zeros(len(n)) comps = [] # (cubic, index array) whose sum is the bracket, refined per sub-interval extra = (np.zeros(len(n)), np.zeros(len(n))) # tag product bounds (cellwise) okmask = np.ones(len(n), dtype=bool) if z in subs_co: if z in Gcache: G = Gcache.pop(z) else: G, _, nc = G_and_D(z, False); nconv2 += nc gl, gh = cubic_cell_bounds(G.cubic()) if z in probe: probes[z] = G.cubic() assert G.off == a and len(gl) == len(n) blo = gl; bhi = gh comps.append((G.cubic(), n - a)) ns = nsm(z); bR = sum(z[small:]) if ns == 0 and bR in ordc: ol, oh = cubic_cell_bounds(ordc[bR]) blo = dn(blo + ol[n - half]); bhi = up(bhi + oh[n - half]) comps.append((ordc[bR], n - half)) elif ns == 1 and bR in pinc: i = z[:small].index(1) zR = tuple(0 if j < small else z[j] for j in range(k)) s_a = np.maximum(cuts[i], M - (n + 1) - upper(zR)) s_b = np.minimum(cuts[i + 1], M - n - lower(zR)) ok = s_a <= s_b pl_, ph_ = cubic_cell_bounds(pinc[bR]) pl_ = pl_[n - half]; ph_ = ph_[n - half] # cells [m, m+1) meeting the closed s-interval, clipped to the bin ma = np.clip(s_a - 1, cuts[i], cuts[i + 1] - 1); mb = np.clip(s_b, cuts[i], cuts[i + 1] - 1) tl = np.zeros(len(n)); th = np.zeros(len(n)) if np.any(ok): hl, hh = Hrmq.query(ma[ok] - eta, mb[ok] - eta) prods = [hl * pl_[ok], hl * ph_[ok], hh * pl_[ok], hh * ph_[ok]] tl[ok] = dn(np.minimum.reduce(prods)); th[ok] = up(np.maximum.reduce(prods)) blo = dn(blo + tl); bhi = up(bhi + th) extra = (tl, th) # cells where no s is feasible carry no giant list at all blo = np.where(ok, blo, 0.0); bhi = np.where(ok, bhi, 0.0) okmask = ok y0 = n / M; y1 = (n + 1) / M y0 = dn(y0); y1 = up(y1) cand = [-y0 * blo, -y0 * bhi, -y1 * blo, -y1 * bhi] vlo = dn(np.minimum.reduce(cand)); vhi = up(np.maximum.reduce(cand)) if KSUB > 1: # refine: bracket bounds on each sub-interval [q/K,(q+1)/K] of the cell slo = np.full(len(n), np.inf); shi = np.full(len(n), -np.inf) for q in range(KSUB): ta, tb = q / KSUB, (q + 1) / KSUB bl = extra[0].copy(); bh = extra[1].copy() for cb_, idx in comps: l_, h_ = cubic_sub_bounds(cb_, ta, tb, sel=idx) bl = dn(bl + l_); bh = up(bh + h_) bl = np.where(okmask, bl, 0.0); bh = np.where(okmask, bh, 0.0) ya = dn((n + ta) / M); yb = up((n + tb) / M) c2 = [-ya * bl, -ya * bh, -yb * bl, -yb * bh] slo = np.minimum(slo, dn(np.minimum.reduce(c2))); shi = np.maximum(shi, up(np.maximum.reduce(c2))) # both are valid; keep the tighter vlo = np.maximum(vlo, slo); vhi = np.minimum(vhi, shi) cells += len(n) j = int(np.argmin(vlo)); jj = int(np.argmax(vhi)) if vlo[j] < flo: flo, where_lo = float(vlo[j]), (z, float(y0[j])) if vhi[jj] > fhi: fhi, where_hi = float(vhi[jj]), (z, float(y0[jj])) log(f'giant cells {cells}, extra conv {nconv2}') cap_hi = float(up(1 + up(fhi / (-prime[1])))) reserve = float(dn(flo - prime[1])) ok = flo > prime[1] and Fr(cap_hi) < target log(f'RESULT {fname} M={M}: prime in [{prime[0]:.9f},{prime[1]:.9f}] nonprime in [{flo:.9f},{fhi:.9f}] ' f'cap upper {cap_hi:.9f} target {float(target)} positivity reserve {reserve:.6f} ' f'lowest at {where_lo} highest at {where_hi} -> {"PASS" if ok else "NOT CERTIFIED"}') return dict(probes=probes, prime=prime, flo=flo, fhi=fhi, cap=cap_hi, reserve=reserve, ok=ok, t=t, direction=desc, H=(float(Hlo[sl].min()), float(Hhi[sl].max())), den=float(den_lo.min())) if __name__ == '__main__': fname = sys.argv[1]; M = int(sys.argv[2]) verify(fname, M)