Download server/phase2/docs/certificate_math.md from lylybig8/mdm_coverage: direct link, hf CLI and curl.
- Browser
- Download file 7.72 kB
-
https://huggingface.co/datasets/lylybig8/mdm_coverage/resolve/main/server/phase2/docs/certificate_math.md
- Command line
-
hf download hf://datasets/lylybig8/mdm_coverage/server/phase2/docs/certificate_math.md
-
curl -L -o certificate_math.md https://huggingface.co/datasets/lylybig8/mdm_coverage/resolve/main/server/phase2/docs/certificate_math.md
Independently checked finite-dimensional certificates
This verifier uses only Python's standard library. Its bounds are computed with
integers and Fraction; JSON floating-point fields are display values. It does
not treat solver tolerances or an LP status as a proof certificate.
Scope and model
The teacher has independent fair representative bits A_i and independent mismatches E_i ~ Ber(tau), with B_i = A_i xor E_i. The model uses the same fair representative bits and a rational finite mixture of iid Bernoulli mismatch laws. All coordinates are sampled from the original, coherent conditional heads of this model. A round selects its subset before its independent fresh outcomes; heads are frozen throughout a round. Decisions may depend on the full history and private randomness. Every coordinate must be committed by round K.
This is a certificate for this interface, not for rejection, remasking, head-correction, postselection, joint sampling, or arbitrary neural decoders.
Why three integers suffice for a lower certificate
Let s=(c,m,o): c completed pairs, m mismatches among them, and o pairs with one visible endpoint. The remaining f=n-c-o pairs are fresh. Fair singleton values and their endpoint orientations give no information about E. The model's next completion mismatch probability p(c,m) is its exact mixture posterior mean.
Any original action is characterized, as far as the next aggregate state is concerned, by a=(u,v,b): complete u open pairs, cosample v fresh pairs, and reveal one endpoint of b fresh pairs. Every legal action satisfies 0<=u<=o and v+b<=f. Its transition is
c' = c+u+v, o' = o-u+b, m' = m+X+Y,
X ~ Bin(u,p(c,m)), Y ~ Bin(v,1/2), independently.
The transition is valid conditional on the entire original history, not merely after averaging under the teacher. Therefore, for a terminal test depending only on mismatch count, a Bellman minimum over every legal (u,v,b) lower-bounds the expected test under every adaptive, privately randomized original policy. Random mixtures cannot beat the smallest action expectation. In the last round the only allowed count action is (o,f,0).
For the feasible-policy upper certificate, lift each chosen count action by uniformly selecting the concrete eligible pairs and uniformly choosing the orientation of every fresh singleton. The target, model, and this lifted policy are invariant under pair permutations and independent simultaneous flips of both endpoints. These symmetries act transitively on full outputs with the same mismatch count. Consequently the count TV equals full-output TV for the lifted policy. The lower bound itself requires no assumption that an arbitrary policy has symmetric outputs: a terminal count test is already a legitimate full-output test.
All-policy lower certificate
Convert the supplied test to a fixed dyadic function h(m) in [0,1] by rounding down on grid S=2^40. This defines a new legitimate test; there is no need to assume an unquantized floating test is exact or optimal.
Set terminal integer values V_0(n,m,0)=S h(m). For remaining rounds t, compute
V_t(s) = min_legal a floor(sum_j W_j V_{t-1}(s_j) / D_a),
where W_j and D_a are exact integers for the transition law. If p=A/D in lowest terms, convolving Bin(u,p) and Bin(v,1/2) gives denominator D^u 2^v. Induction shows V_t/S is a lower bound on the exact Bellman value. Its absolute downward error is at most t/S. Completed states are absorbing.
Compute E_P h exactly using rational binomial probabilities. Then
L = max(0, V_K(0,0,0)/S - E_P h)
is an all-policy full-output TV lower bound. The test orientation is Q-P: h should be large on counts overrepresented under generated Q. The verifier remains valid for any test, even a poor or sign-reversed one, but may return 0.
Rigorous upper certificate for a recovered policy
Decimal action weights are interpreted as exact rational numbers and normalized separately at each provided state. Missing states use an empty action until the last round, when all remaining coordinates are sampled. This completely specifies a feasible count policy, even at histories whose occupancy was numerically zero in the LP. Thus the certified policy can differ negligibly or materially from the LP's intended policy; the reported certified upper, not its original objective, is authoritative.
Propagate masses on grid F=2^80. For each directed action/outcome edge, round its exact contribution down. Inductively, every stored state mass is no greater than that state's true probability under the reconstructed policy. Let q^- be the terminal subprobability and delta=1-sum_m q^-(m). Then Q(m)>=q^-(m) and sum_m[Q(m)-q^-(m)]=delta, hence
max(0, TV(P,q^-)-delta/2) <= TV(P,Q)
<= min(1, TV(P,q^-)+delta/2).
Both endpoints are exact rational numbers. The right endpoint is a feasible policy upper bound U for the optimum. The reported interval [L,U] is valid even when numerical solver diagnostics are poor. A large gap means certification has not established near-optimality.
Model TV, all-context heads, and KL budget
The model count probabilities are computed exactly. Fairness and exchangeability make count TV exactly equal to joint model TV, rather than merely a projection lower bound. The verifier checks every (c,m), 0<=m<=c<n, to find the largest absolute completion-head error |p(c,m)-tau|. Fresh-coordinate heads coincide with the teacher's fair heads, so this covers all partial-coordinate contexts.
KL(P||R) is an expectation of log(P_count/R_count). For each positive rational x, write x=2^k y with 1<=y<2 and use
log y = 2 sum_{j=0}^{N-1} z^(2j+1)/(2j+1) + remainder,
z=(y-1)/(y+1),
0 <= remainder <= 2 z^(2N+1)/[(2N+1)(1-z^2)].
Here z<=1/3, N=48, and each rational term is bounded on a common 2^-120 grid. The same enclosure is used for log 2. Negative k reverses interval endpoints when multiplying. Summing with exact teacher probabilities gives rigorous KL bounds. A witness meets a supplied budget only if the upper bound is <= that budget. An interval straddling the budget is not accepted as certified feasible.
Interpretation of the execution gap
The reported signed quantity G=L-TV(P,R) is a certified lower bound on the excess of optimal K-round output TV over model joint TV. A positive G establishes an unavoidable extra execution cost for this fixed rational witness. A negative G is not evidence of a negative cost; it means this lower certificate does not establish positive excess. For a witness satisfying all constraints, L is also a valid lower bound on the outer minimax problem, without any claim that the search globally optimized over models.
Self-tests and limits
--self-test checks six n=2 cases by comparing an exact count Bellman recursion
against an independently implemented, literal 2n-coordinate recursion. The
latter enumerates all hidden-coordinate subsets and independent outcomes using
the full rational joint law. Tests also check Bellman rounding enclosures, a
one-pair privately randomized mixture with zero true TV, and logarithm interval
consistency. These are implementation regression tests, not a formal proof in
Lean or a guarantee against all programming errors.
Example:
python src/certify_witness.py --self-test
python src/certify_witness.py --input results/witnesses.json \
--output results/certificates.json
Input may be one witness, a list of witnesses, or an object with a witnesses
array. Witnesses specify n, tau, rational weights and component probabilities,
optional rational budget/head_bound, and cases containing K, terminal_test, and
optionally the recovered policy. Round numbers in policies start at one.