File size: 10,234 Bytes
7956103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Biased-representative finite-policy experiment

## Scope and frozen instance

For each pair, draw `A_i ~ Bernoulli(a)` independently of a mismatch vector
`E`, and set `B_i = A_i xor E_i`. The teacher has iid mismatches with rate
`tau = 1/4`. The oracle mismatch law is the fixed two-component mixture

```
R_E = (11681887 / 16777216) Bern(1/4)^n
    + ( 5095329 / 16777216) Bern(1/2)^n.
```

These rational parameters are frozen from the phase-2 selected
`n8_B1_10_single_d1_4` model. They are not retuned at a new dimension, bias, or
round cap. Required cases are `n=4`, `a in {1/2,2/5,1/4}`, `K in {2,3,4}`.
The extension is `n=6`, the same three biases, and `K in {3,4}`, and is run
only if the prespecified resource gate succeeds. The gate is independent of
the numerical scientific outcome.

At every round, the policy may select any subset of currently masked
coordinates, using all past information and private randomization. Selected
coordinates are sampled independently from the oracle's exact singleton
conditionals at the **pre-round context**. All coordinates must be completed
by round K; empty batches allow earlier completion. This is a fixed-head,
fixed-oracle experiment, not optimization over oracle parameters.

## Nine-type state and exact singleton conditionals

A state is the histogram of these pair types, in order:

```
empty, A0, A1, B0, B1, 00, 01, 10, 11.
```

Unlike in the fair case, A and B are not interchangeable, B-only observations
carry information about the latent component, and bit flips are not a valid
symmetry. The fair three-count state is therefore not used.

For component mismatch rate p, put `q_p = a + (1-2a)p`. The likelihoods of
the nine types are

```
1, 1-a, a, 1-q_p, q_p, (1-a)(1-p), (1-a)p, ap, a(1-p).
```

For a labeled partial context with histogram h, its component posterior is
proportional to its component weight times the product of these likelihoods
raised to the histogram counts. The multinomial coefficient cancels between
components if one conditions on the histogram instead of a labeled context.

Within component p, the probabilities of value 1 for the six possible head
types are

```
empty A: a                empty B: q_p
B | A=0: p               B | A=1: 1-p
A | B=0: ap/(1-q_p)      A | B=1: a(1-p)/q_p.
```

The oracle heads average these six quantities against the **full current
component posterior**. In particular, the nonlinear reverse heads must not
be obtained by substituting the posterior mean p into the displayed
fractions. That substitution would double-condition incorrectly.

For example, a=2/5, component weights (7/10,3/10), rates (1/4,1/2), and a
context observing only B=1 give `R(A=1 | B=1)=18/31`. This is an independent
reverse-head regression fixture.

## Actions and transitions

An aggregate action is the seven-tuple

```
(empty_A, empty_B, empty_both, fill_A0, fill_A1, fill_B0, fill_B1).
```

The first three numbers partition a subset of empty pairs; the last four
select a subset from each singleton type. At the final round the unique
legal action completes all masked coordinates. In other rounds every legal
tuple, including the empty action, is enumerated.

For an empty pair selected in both coordinates, the two sampled bits are
independent Bernoulli draws with the frozen empty-A and empty-B heads. Their
joint law is **not** the oracle's pair law. All other selected-coordinate
draws are also conditionally independent in the round. Exact multinomial
laws within each selected type, followed by histogram convolution, give the
rational transition kernel.

For n pairs there are `C(n+8,8)` states and `C(n+3,3)` terminal histograms.
Strict positivity makes every histogram reachable after one round. A full
nonfinal layer has `C(n+15,15)` state-action pairs. Thus for K>=2 the layered
occupation LP has

```
C(n+3,3) + (K-2) C(n+15,15) + C(n+8,8)
```

action variables, before the additional terminal absolute-value variables.
The required n=4 cases have 530, 4406, and 8282 action variables for K=2,3,4.
The n=6 K=3,4 extension has 57351 and 111615 action variables. The extension
gate explicitly constructs all n=6 exact kernels at a=2/5, checks the K=4
edge count, and enforces 120000 action variables, 3000000 transition entries,
and 120 seconds of kernel-building time. Each LP has a 90-second solve cap.

## Why the terminal objective is full TV

The four completed pair types (00,01,10,11), not merely mismatch count, are
the terminal observable. Both the teacher and the uniformly lifted policies
are invariant under permutations of pairs. A terminal four-type histogram
is exactly an orbit of that permutation group. Both distributions are
constant on each orbit, so summing the labeled-coordinate L1 distance over
an orbit gives the L1 distance of its histogram masses. Consequently,
four-type histogram TV equals the full 2n-coordinate TV for the constructed
policy. A mismatch-count-only TV would in general be insufficient.

Every aggregate action can be lifted by uniformly choosing disjoint pair
subsets within each current type. This gives a legal, permutation-equivariant
policy with exactly the aggregate transition law. Conversely, after any
full labeled history, an arbitrary labeled action has an aggregate tuple
and the displayed aggregate kernel. This fact justifies the Bellman lower
bound for all history-dependent policies, without assuming their final
output is symmetric. Equivalently, pair-permutation symmetrization cannot
increase TV to the symmetric teacher, and occupation-measure Markovization
then yields the finite aggregate LP optimum.

## Rational certificates

The LP minimizes half the terminal L1 distance using action occupation
measures. Mixtures are optimized before TV is evaluated; this is not an
average of deterministic-policy TVs. The numerical solver proposes a
bounded terminal test and a feasible policy candidate. Its floating-point
optimality report is not taken as a rigorous certificate.

For the lower certificate, clip the LP-derived test into [0,1], interpret
its printed decimals exactly, and round down to the dyadic grid 2^-40.
Starting from this test, perform backward Bellman minimization over every
legal aggregate action with the exact rational transition kernel, rounding
each expectation down to the same grid. The result is a lower enclosure
of the minimum expected test value over all policies. Subtract the exact
teacher mean of the dyadic test and truncate below at zero. Since TV
dominates `E_Q f - E_P f` for every f in [0,1], the result L is an all-policy
lower bound. Bellman rounding contributes at most K * 2^-40.

For the upper certificate, interpret nonnegative recovered action weights
as exact decimal rationals and normalize each state. Missing states use a
legal empty action, or the forced completion action in the last round.
Propagate state mass on a 2^-80 grid, rounding each edge contribution down.
This produces a componentwise lower terminal mass vector q_lo. Its missing
mass `e=1-sum(q_lo)` bounds the total omitted probability. Therefore

```
U = min(1, (sum_h |P(h)-q_lo(h)| + e)/2)
```

is an upper bound on the full TV of this explicitly legal lifted policy.
Every case reports exact rational L and U as authoritative fields, with
floating-point values for display. The interval `L <= inf_policy TV <= U`
is not a proof-assistant formalization.

The exact kernel is shared by LP assembly and rational certification; LP
assembly converts it to floating point. Independence comes from the
separate literal-coordinate kernel checks and literal Bellman/LP comparison,
not from claiming two independently written reduced kernels.

## KL, model TV, and head errors

The teacher and oracle use the same A law. Under the invertible map
`(A,E) -> (A,B)`, their joint likelihood ratio depends only on mismatch
count. Thus their joint KL and TV are exactly the mismatch-count KL and TV,
independent of a at fixed n. The code additionally verifies model TV against
the full four-type histogram distribution. Natural logarithms are enclosed
using rational range reduction, a finite atanh series, and a rigorous tail
bound. The exact KL upper bound is checked against 1/10.

The n=8 calibration is not transferred as an equality to n=4 or n=6. Actual
KL is reported at each dimension; the oracle is not adjusted to use the
remaining budget. Similarly, bias changes can change the uniform head
error. Every valid partial histogram and every available head are enumerated
exactly. The maximum error and a witnessing context are reported, including
whether it exceeds 1/4. No point is excluded on that basis, and this is not
described as a common-head-budget comparison. In particular, a component
shift by 1/4 need not bound reverse-head error: a=2/5, tau=1/4, p=1/2 gives
an `A|B=1` head difference of 4/15.

Positive `L-TV(P,R)` would certify finite-depth cost beyond the serial
oracle-law baseline. Nonpositive values do not refute the theory. Positive
`L_K-U_(K+1)` certifies a finite-dimensional depth separation. Neither metric
is assumed positive when choosing the grid or deciding the resource gate.

## Validation and command line

`--self-test` uses only the standard library and exhaustively compares n=2
literal heads and all selected-coordinate subset kernels at all three
biases. It also checks exact-teacher two-round controls and the reverse-head
counterexample. The default scientific run additionally compares all n=2,
K=2,3, three-bias histogram LPs with independently assembled full-coordinate
LPs. Every a=1/2 scientific case is compared to the frozen phase-2 fair
three-count LP implementation in `vendor/policy_lp.py`.

```
python biased_policy.py --self-test
python biased_policy.py --config phase3_config.json --profile-only
python biased_policy.py --config phase3_config.json --gate-profile --output gate.json
python biased_policy.py --config phase3_config.json --lp-self-test --output lp_checks.json
python biased_policy.py --config phase3_config.json --output biased_results.json
```

The main result is checkpointed after every case. Failed cases are retained
with their errors; the resource-gated extension is explicitly marked run or
skipped. No failure or negative scientific outcome is silently removed.