Formalization: Second-order Minimax Risk in Multi-arm Binary Randomization

The complete Lean development behind this paper — every definition, lemma, and theorem of its module, including helpers the paper text never cites. Identifiers link within this page, into the Causalean library, or out to the official Mathlib docs.

CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Basic 78 declarations Core objects for the unrestricted labeled game, its response-type orbit game, the contrast-weighted first-order procedure, and the rational grid LP.

Core objects for the unrestricted labeled game, its response-type orbit game, the contrast-weighted first-order procedure, and the rational grid LP.

The LP feasibility predicate intentionally has no sign row and no upper bound for its epigraph coordinate. Nonnegativity and attainment are theorem-level consequences handled by the rational LP bridge.

def rhoN

Unrestricted design-and-estimator minimax risk over complete labeled schedules.

Definition (Lean source)
K n :
c :
Contrast ℝ K
rhoN K n c :
minimaxValue (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rhoN · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:30

Second-order improvement for the paper's own minimax risk (not an arbitrary sequence).

Definition (Lean source)
K :
c :
Contrast ℝ K
n :
dN K c n :
C0 c / n - rhoN K n c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dN · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:36

The cluster-owned minimax-envelope property pinning the improvement to [0,∞).

Definition (Lean source)
K :
c :
Contrast ℝ K
n :
MinimaxEnvelopeBound K c :
Prop
rhoN K n c ≤ C0 c / n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.MinimaxEnvelopeBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:41

Orbit risk of a mixture/invariant-estimator pair.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
q :
m :
orbitRisk c q m :
∑ r, q.1.p r * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * ((q.2 r x : ℝ) - tauCount c m) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:46
def orbitGameValue

Minimax value of the finite response-type orbit experiment.

Definition (Lean source)
K n :
c :
Contrast ℝ K
orbitGameValue K n c :
minimaxValue (fun (q : OrbitProcedure K n c) (m : CountVec K n) => orbitRisk c q m)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitGameValue · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:52
theorem Lc_pos

the contrast norm is positive.

Formal statement
K :
shared
c :
Contrast ℝ K
0 < Lc c
Proof (Lean source)
lemma Lc_pos (c : Contrast ℝ K) : 0 < Lc c := by have hnonneg : 0 ≤ Lc c := sum_nonneg fun _ _ => abs_nonneg _ have hne : Lc c ≠ 0 := by intro hsum apply c.nonzero funext a apply abs_eq_zero.mp exact congrFun ((Fintype.sum_eq_zero_iff_of_nonneg (fun a => abs_nonneg (c a))).mp hsum) a exact lt_of_le_of_ne hnonneg (Ne.symm hne)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Lc_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:58
theorem qStar_nonneg

the q star is nonnegative.

Formal statement
K :
shared
c :
Contrast ℝ K
a :
Arm K
0 ≤ qStar c a
Proof (Lean source)
lemma qStar_nonneg (c : Contrast ℝ K) (a : Arm K) : 0 ≤ qStar c a := by exact div_nonneg (abs_nonneg _) (le_of_lt (Lc_pos c))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.qStar_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:70
theorem qStar_sum

the q star sums.

Formal statement
K :
shared
c :
Contrast ℝ K
∑ a, qStar c a = 1
Proof (Lean source)
lemma qStar_sum (c : Contrast ℝ K) : ∑ a, qStar c a = 1 := by simp only [qStar] rw [← Finset.sum_div] exact div_self (ne_of_gt (Lc_pos c))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.qStar_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:74

One-unit contrast-weighted categorical design.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
qStarDesign c :
clause 1
p := qStar c
clause 2
p_nonneg := qStar_nonneg c
clause 3
p_sum := qStar_sum c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.qStarDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:80
def centeredContrastScore

The unprojected centered inverse-allocation contrast score.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
A :
Assign K n
centeredContrastScore c A y :
((n : ℝ)⁻¹) * ∑ i, if _h : qStar c (A i)
= 0 then 0 else c (A i) * ((if y i then 1 else 0) - 1 / 2) / qStar c (A i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.centeredContrastScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:87
def contrastWeightedProcedure

Independent contrast-weighted allocation and the clipped centered score rule.

Definition (Lean source)
K n :
c :
Contrast ℝ K
contrastWeightedProcedure K n c :
Procedure K n c
(prodDesign (fun _ : Unit n => qStarDesign c), fun A y => ⟨clip c (centeredContrastScore c A y), clip_mem c _⟩)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrastWeightedProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:95

Exact rational grid-program feasibility. In particular, there is no u ≥ 0 row and no false u ≤ h_c² feasibility clause.

Definition (Lean source)
K n M :
c :
pi :
GridPi K n
w :
u :
GridLPFeasible K n M c pi w u :
Prop
clause 1
∑ r, pi r = 1
clause 2
r x :
∑ g, w r x g = pi r
clause 3
r :
0 ≤ pi r
clause 5
m :
∑ r, ∑ x, ∑ g, orbitLik m r x * w r x g * (gammaMC M c g - tauCountRat c m) ^ 2 ≤ u
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridLPFeasible · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:104
def gridLPValueRaw

The raw grid-program value is the infimum feasible epigraph coordinate, with no positivity assumptions imposed at the definition stage.

Definition (Lean source)
K n M :
c :
gridLPValueRaw K n M c :
sInf {v : ℝ | ∃ (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ), GridLPFeasible K n M c pi w u ∧ v = (u : ℝ)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValueRaw · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:117
def gridLPValue

Real infimum of the exact rational feasible objective values on n, M ≥ 1.

Definition (Lean source)
K n M :
c :
_hn :
0 < n
_hM :
0 < M
gridLPValue K n M c _hn _hM :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValue · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:123

The diagnostic three-arm contrast (1,-1/2,-1/2).

Definition (Lean source)
cDaggerQ :
clause 1
coeff := fun i => Fin.cases 1 (Fin.cases (-1 / 2) (fun _ => -1 / 2)) i
clause 2
nonzero := by intro h have h0 := congrFun h (0 : Fin 3) norm_num at h0
clause 3
sum_zero := by simp [Fin.sum_univ_succ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.cDaggerQ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:128

The witness contrast is the centered and normalized three-arm contrast used for the certified separation.

Definition (Lean source)
cDagger :
Contrast ℝ 3
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.cDagger · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:139
def gridLPValueK3

Three-arm specialization of the rational contrast grid value.

Definition (Lean source)
n M :
hM :
0 < M
gridLPValueK3 n M hM :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValueK3 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:143

Three-arm unrestricted minimax risk.

Definition (Lean source)
n :
rhoNDagger n :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rhoNDagger · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:148
def twoArmContrastQ

Two-arm contrast (1,-1).

Definition (Lean source)
twoArmContrastQ :
clause 1
coeff := fun i => Fin.cases 1 (fun _ => -1) i
clause 2
nonzero := by intro h have h0 := congrFun h (0 : Fin 2) norm_num at h0
clause 3
sum_zero := by simp [Fin.sum_univ_succ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmContrastQ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:152

The canonical two-arm contrast assigns coefficients one and minus one to the two treatment arms.

Definition (Lean source)
twoArmContrast :
Contrast ℝ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmContrast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:161

The unrestricted two-arm value.

Definition (Lean source)
n :
rho2 n :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rho2 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:164

Airy-rate scaling used only by the cited comparison gates.

Definition (Lean source)
n :
secondOrderScale n :
(n : ℝ) ^ (4 / 3 : ℝ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.secondOrderScale · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:167
structure PositiveLimitBranch

Witness that the conditional second-order branch exists.

Definition (Lean source)
K :
c :
Contrast ℝ K
limit :
positive :
0 < limit
converges :
Tendsto (fun n => a n * dN K c n) atTop (nhds limit)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PositiveLimitBranch · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:170
def AiryConstant

Carrier for the paper's positive Airy constant.

Definition (Lean source)
AiryConstant :
Type
{C : ℝ // 0 < C}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.AiryConstant · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:176
def IsAiryGroundStateConstant

Identification of the Airy constant through a normalized Airy ground state.

Definition (Lean source)
IsAiryGroundStateConstant C :
Prop
∃ (Ai dAi : ℝ → ℝ) (aPrime : ℝ),
clause 1
x :
HasDerivAt Ai (dAi x) x
clause 2
x :
HasDerivAt dAi (x * Ai x) x
clause 3
clause 4
Ai 0 > 0
clause 5
aPrime < 0
clause 6
dAi aPrime = 0
clause 7
b :
b < 0
dAi b = 0
b ≤ aPrime
clause 8
C.1 = -(4 : ℝ) ^ (1 / 3 : ℝ) * aPrime
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsAiryGroundStateConstant · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:180
def IsPublishedAiryConstant

The numerical bracket is benchmark information, separate from the symbol's space.

Definition (Lean source)
IsPublishedAiryConstant C :
Prop
clause 2
1.617 < C.1
clause 3
C.1 < 1.618
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsPublishedAiryConstant · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:189
def ScalarTriple

State space of the published scalar two-arm experiment.

Definition (Lean source)
n :
ScalarTriple n :
Type
{θ : Fin (n + 1) × Fin (n + 1) × Fin (n + 1) // (θ.1 : ℕ) + (θ.2.1 : ℕ) + (θ.2.2 : ℕ) = n}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ScalarTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:193
instance instFintypeScalarTriple

The scalar triple collection has a finite enumeration.

Definition (Lean source)
instance (n : ℕ) : Fintype (ScalarTriple n) := by unfold ScalarTriple; infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeScalarTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:198
def scalarExperimentRisk

Scalar experiment risk is the mean squared estimation error under the fair Bernoulli score experiment.

Definition (Lean source)
n :
f :
Fin (n + 1) → ℝ
θ :
scalarExperimentRisk n f θ :
∑ k : Fin ((θ.1.2.2 : ℕ) + 1), ((choose (θ.1.2.2 : ℕ) k : ℝ) / 2 ^ (θ.1.2.2 : ℕ)) * (f ⟨(θ.1.1 : ℕ) + (k : ℕ), by have ht := θ.property have hk : (k : ℕ) ≤ (θ.1.2.2 : ℕ) := Nat.le_of_lt_succ k.isLt omega⟩ - (((θ.1.1 : ℕ) : ℝ) - ((θ.1.2.1 : ℕ) : ℝ)) / n) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarExperimentRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:201
def scalarMinimaxValue

The scalar minimax value is the least worst-case scalar experiment risk over all clipped estimators.

Definition (Lean source)
n :
scalarMinimaxValue n :
sInf {v : ℝ | ∃ f : Fin (n + 1) → ℝ, v = ⨆ θ : ScalarTriple n, scalarExperimentRisk n f θ}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarMinimaxValue · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:212

Sudijono, Dobriban, and Tchetgen Tchetgen (2026), Theorems 2.1–2.2 and 3.1, arXiv:2608.13822. This proposition records exactly the scalar reduction and Airy expansion used as secondary context.

Definition (Lean source)
PublishedTwoArmMinimaxAiry :
Sort 0
(∀ n, 0 < n → rho2 n = scalarMinimaxValue n) ∧
∃ C : AiryConstant,
Tendsto (fun n => secondOrderScale n * (rho2 n - ((n : ℝ)⁻¹ - C.1 / secondOrderScale n))) atTop (nhds 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PublishedTwoArmMinimaxAiry · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:217

A hull schedule assigns each unit and treatment arm a potential outcome in the unit interval.

Definition (Lean source)
N :
L U :
HullSchedule N L U :
Type
{Y : Fin N → Fin 2 → ℝ // ∀ i a, Y i a ∈ Icc L U}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HullSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:229

A hull estimator maps an assignment and its real-valued observed outcomes to a clipped contrast estimate.

Definition (Lean source)
N :
HullEstimator N :
Type
Assign 2 N → (Fin N → ℝ) → ℝ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HullEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:233

The source optimizes only over estimators measurable in their real data argument.

Definition (Lean source)
N :
shared
est :
A :
IsMeasurableHullEstimator est :
Prop
Measurable (est A)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsMeasurableHullEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:236
def hullTarget

The hull target is the population average of the contrast-weighted real potential outcomes.

Definition (Lean source)
N :
L U :
Y :
hullTarget Y :
(N : ℝ)⁻¹ * ∑ i, (Y.1 i 1 - Y.1 i 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullTarget · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:240

Hull risk is the design expectation of squared error for a hull decision at a fixed hull schedule.

Definition (Lean source)
N :
L U :
D :
est :
Y :
hullRisk D est Y :
D.E fun A => (est A (fun i => Y.1 i (A i)) - hullTarget Y) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:244
def hullMinimaxValue

The hull minimax value is the least worst-case hull risk over all hull decisions.

Definition (Lean source)
N :
L U :
hullMinimaxValue N L U :
sInf {v : ℝ | ∃ (D : FiniteDesign (Assign 2 N)) (est : HullEstimator N), IsMeasurableHullEstimator est ∧ v = ⨆ Y : HullSchedule N L U, hullRisk D est Y}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullMinimaxValue · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:250
def hullKernel

The hull observation kernel gives the probability of an observed assignment–outcome pair under a hull schedule and assignment design.

Definition (Lean source)
_N k m x :
hullKernel _N k m x :
if k ≤ x then (choose m (x - k) : ℝ) / 2 ^ m else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:256
def HullDecision

A hull decision combines a finite assignment design with a hull estimator.

Definition (Lean source)
N :
HullDecision N :
Type
Fin (N + 1) → Icc (0 : ℝ) 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HullDecision · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:260
def hullObjective

The finite maximum in Hull's displayed definition of κ_N.

Definition (Lean source)
N :
d :
hullObjective N d :
⨆ km : {q : ℕ × ℕ // q.1 + q.2 ≤ N}, ∑ x : Fin (N + 1), hullKernel N km.1.1 km.1.2 x * ((d x : ℝ) - (2 * km.1.1 + km.1.2 : ℕ) / (N : ℝ)) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullObjective · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:263

Hull's displayed finite min--max constant.

Definition (Lean source)
N :
hullKappa N :
sInf {v : ℝ | ∃ d : HullDecision N, v = hullObjective N d}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullKappa · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:269
def hullIndependentDesign

The independent fair assignment mechanism used by Hull's attaining procedure.

Definition (Lean source)
N :
hullIndependentDesign N :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hullIndependentDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:273

The positive mathematical content of Hull's Theorem 1 at fixed N, L, and U.

Definition (Lean source)
N :
L U :
HullPublishedTheoremAt N L U :
Prop
clause 1
hullMinimaxValue N L U = (U - L) ^ 2 * hullKappa N
clause 2
∃ dStar : HullDecision N, hullObjective N dStar = hullKappa N
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HullPublishedTheoremAt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:280

Bibliographic scope metadata for Hull (2026), Theorem 1. This non-Prop payload records the source boundary without turning a literature-scope judgment into a mathematical premise of this paper.

Definition (Lean source)
PublishedHullTwoArmBoundedScope :
_root_.List _root_.String
["Hull's unrestricted minimax theorem concerns a finite population with two treatment arms", "potential outcomes are bounded in a known interval", "optimization is over arbitrary assignment mechanisms and measurable estimators", "the source does not state a fixed-K-at-least-three bounded-outcome orbit-game theorem"]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PublishedHullTwoArmBoundedScope · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:289
def IsBalancedLabelBlinded

Balanced, treatment-label-blinded two-arm assignment designs.

Definition (Lean source)
n :
D :
IsBalancedLabelBlinded D :
Prop
clause 1
A :
D.p A ≠ 0
(Finset.univ.filter fun i => A i = 0).card = n / 2
clause 2
A :
D.p A = D.p (fun i => if A i = 0 then 1 else 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsBalancedLabelBlinded · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:300
def IsInferenceCapped

A procedure is inference-capped when every estimate lies in the natural closed interval determined by the contrast norm.

Definition (Lean source)
n :
D :
cap :
A :
IsInferenceCapped D cap :
Prop
D.p A ≤ cap
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsInferenceCapped · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:306
def KallusSchedule

A two-arm potential-outcome schedule in Kallus's real conditional-mean model.

Definition (Lean source)
n :
KallusSchedule n :
Type
Fin n → Fin 2 → ℝ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.KallusSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:311
def kallusTarget

The sample-average treatment effect attached to a Kallus schedule.

Definition (Lean source)
n :
kallusTarget Y :
(n : ℝ)⁻¹ * ∑ i, (Y i 1 - Y i 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.kallusTarget · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:314
def kallusSATEEstimator

Kallus's fixed sample-average-treatment-effect estimator 2 n⁻¹ ⟨W,Yobs⟩.

Definition (Lean source)
n :
kallusSATEEstimator n :
fun A y => 2 * (n : ℝ)⁻¹ * ∑ i, (if A i = 1 then 1 else -1) * y i
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.kallusSATEEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:318
def IsUnbiasedSATE

A procedure is unbiased for the sample average treatment effect when its expected estimate equals the finite-population contrast target for every response schedule.

Definition (Lean source)
IsUnbiasedSATE est :
Prop
D.E (fun A => est A (fun i => Y i (A i))) = kallusTarget Y
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsUnbiasedSATE · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:322
def kallusWorstRisk

Kallus's worst-case design-dependent variance contribution over conditional means. The extended-real codomain faithfully includes arbitrary unbounded specified classes.

Definition (Lean source)
n :
M :
Set (Fin n → ℝ)
D :
kallusWorstRisk M D :
⨆ μ : M, ofReal (D.E fun A => (∑ i, (if A i = 1 then 1 else -1) * μ.1 i) ^ 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.kallusWorstRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:329
def IsOrdinaryMSOD

Ordinary MSOD optimality in the balanced label-blinded design class.

Definition (Lean source)
n :
M :
Set (Fin n → ℝ)
D :
IsOrdinaryMSOD M D :
Prop
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsOrdinaryMSOD · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:336
def IsInferenceConstrainedMSOD

Inference-constrained MSOD optimality among designs satisfying the probability cap.

Definition (Lean source)
n :
M :
Set (Fin n → ℝ)
cap :
D :
IsInferenceConstrainedMSOD M cap D :
Prop
clause 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsInferenceConstrainedMSOD · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:342
structure KallusMsodScope

The source-specified conditional-mean class, fixed SATE rule, and feasible cap.

Definition (Lean source)
n :
conditionalMeanClass :
Set (Fin n → ℝ)
fixedUnbiasedEstimator :
fixed_estimator_spec :
fixedUnbiasedEstimator = kallusSATEEstimator n
estimator_unbiased :
IsUnbiasedSATE fixedUnbiasedEstimator
significanceLevel :
significanceLevel_pos :
0 < significanceLevel
significanceLevel_le_one :
significanceLevel ≤ 1
probabilityCap :
probabilityCap_pos :
0 < probabilityCap
probabilityCap_eq :
probabilityCap = significanceLevel / 2
capped_class_feasible :
∃ D : FiniteDesign (Assign 2 n),
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.KallusMsodScope · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:349

Kallus (2020), Sections 2 and 7, arXiv:2005.03151. This records the two-arm, even-population, balanced label-blinded ordinary MSOD and the separate capped feasible-class MSOD for an arbitrary specified conditional-mean class, fixed unbiased SATE estimator, and significance-linked cap α / 2. The source notes that ordinary MSOD may lack the uniformity needed for Fisher randomization inference; no universal strict separation from the capped class is asserted here.

Definition (Lean source)
PublishedKallusMsodInferenceScope :
Sort 0
(∀ n : ℕ, 0 < n → Even n → ∀ scope : KallusMsodScope n, ∃ Dordinary : FiniteDesign (Assign 2 n), IsOrdinaryMSOD scope.conditionalMeanClass Dordinary) ∧
(∃ (n : ℕ) (_hn : 0 < n) (_heven : Even n) (scope : KallusMsodScope n) (Dordinary : FiniteDesign (Assign 2 n)), scope.conditionalMeanClass.Nonempty ∧ IsOrdinaryMSOD scope.conditionalMeanClass Dordinary ∧ ¬ IsInferenceCapped Dordinary scope.probabilityCap) ∧
(∀ n : ℕ, 0 < n → Even n → ∀ scope : KallusMsodScope n, ∃ Dinference : FiniteDesign (Assign 2 n), IsInferenceConstrainedMSOD scope.conditionalMeanClass scope.probabilityCap Dinference)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PublishedKallusMsodInferenceScope · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:365
def SamplingDesign

A sampling design assigns a probability to every subset of the finite population, with total mass one.

Definition (Lean source)
N :
SamplingDesign N :
Type
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.SamplingDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:395
def SamplingEstimator

An estimator sees only the values of sampled coordinates.

Definition (Lean source)
N :
SamplingEstimator N :
Type
(S : Finset (Fin N)) → ({j : Fin N // j ∈ S} → ℝ) → ℝ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.SamplingEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:399
def IsSamplingEstimatorMeasurable

Each sample-specific estimator component is measurable, as required by the source.

Definition (Lean source)
N :
S :
IsSamplingEstimatorMeasurable est :
Prop
Measurable (est S)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsSamplingEstimatorMeasurable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:403
def inclusionProbability

A unit’s inclusion probability is the total sampling-design mass of subsets containing that unit.

Definition (Lean source)
N :
j :
Fin N
inclusionProbability D j :
∑ S with j ∈ S, D.p S
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.inclusionProbability · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:407
def IsDesignUnbiasedBoundedTotal

Design unbiasedness on the source's bounded finite-population parameter box.

Definition (Lean source)
N :
lower upper :
Fin N → ℝ
y :
Fin N → ℝ
(∀ j, y j ∈ Icc (lower j) (upper j))
IsDesignUnbiasedBoundedTotal lower upper D est :
Prop
D.E (fun S => est S (fun j => y j.1)) = ∑ j, y j
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsDesignUnbiasedBoundedTotal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:411
def samplingWorstRisk

Sampling worst-case risk is the largest mean squared estimation error over all bounded finite-population outcome vectors.

Definition (Lean source)
N :
lower upper :
Fin N → ℝ
samplingWorstRisk lower upper D est :
⨆ y : {y : Fin N → ℝ // ∀ j, y j ∈ Icc (lower j) (upper j)}, D.E (fun S => (est S (fun j => y.1 j.1) - ∑ j, y.1 j) ^ 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.samplingWorstRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:417
def IsIndependentSampling

A sampling design is independent when every subset has the product probability generated by unit-specific inclusion probabilities.

Definition (Lean source)
N :
pi :
Fin N → ℝ
S :
IsIndependentSampling D pi :
Prop
D.p S = ∏ j, if j ∈ S then pi j else 1 - pi j
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsIndependentSampling · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:423
def midpointDifferencedHT

The source's midpoint-differenced Horvitz--Thompson estimator.

Definition (Lean source)
N :
lower upper :
Fin N → ℝ
midpointDifferencedHT lower upper D :
fun S y
=> (∑ j, (lower j + upper j) / 2)
+ ∑ j : {j : Fin N // j ∈ S}, (y j - (lower j.1 + upper j.1) / 2) / inclusionProbability D j.1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.midpointDifferencedHT · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:427

Aronow and Lopatto (2026), Theorems 1–3, arXiv:2605.20572. This is the cited unit-inclusion, design-unbiased bounded-total statement, not a multi-arm result.

Definition (Lean source)
PublishedAronowLopattoBoundedUnbiased :
Sort 0
∀ (N : ℕ) (lower upper : Fin N → ℝ) (D : SamplingDesign N)
if
(∀ j, lower j ≤ upper j)
and
(∀ j, 0 < inclusionProbability D j ∧ inclusionProbability D j ≤ 1)
then
(∀ est : SamplingEstimator N, IsDesignUnbiasedBoundedTotal lower upper D est → ∀ ε : ℝ, 0 < ε → ∃ y : {y : Fin N → ℝ // ∀ j, y j ∈ Icc (lower j) (upper j)}, (∑ j, ((upper j - lower j) / 2) ^ 2 * (1 - inclusionProbability D j) / inclusionProbability D j) - ε ≤ D.E (fun S => (est S (fun j => y.1 j.1) - ∑ j, y.1 j) ^ 2)) ∧
IsDesignUnbiasedBoundedTotal lower upper D (midpointDifferencedHT lower upper D) ∧
((samplingWorstRisk lower upper D (midpointDifferencedHT lower upper D) = ∑ j, ((upper j - lower j) / 2) ^ 2 * (1 - inclusionProbability D j) / inclusionProbability D j) ↔ ∀ i j, i ≠ j → 0 < upper i - lower i → 0 < upper j - lower j → D.Pr (fun S => i ∈ S ∧ j ∈ S) = inclusionProbability D i * inclusionProbability D j) ∧
((∀ j, 0 < upper j - lower j) → ∀ b : ℝ, 0 < b → b ≤ N → ∃ (γ : ℝ) (Dstar : SamplingDesign N) (estar : SamplingEstimator N), 0 < γ ∧ (∀ j, inclusionProbability Dstar j = min 1 (γ * ((upper j - lower j) / 2))) ∧ ∑ j, inclusionProbability Dstar j = b ∧ IsIndependentSampling Dstar (inclusionProbability Dstar) ∧ estar = midpointDifferencedHT lower upper Dstar ∧ IsSamplingEstimatorMeasurable estar ∧ IsDesignUnbiasedBoundedTotal lower upper Dstar estar ∧ (∀ (D' : SamplingDesign N) (e' : SamplingEstimator N), (∀ j, 0 < inclusionProbability D' j) → (∑ j, inclusionProbability D' j) ≤ b → IsDesignUnbiasedBoundedTotal lower upper D' e' → ∀ ε : ℝ, 0 < ε → ∃ y : {y : Fin N → ℝ // ∀ j, y j ∈ Icc (lower j) (upper j)}, samplingWorstRisk lower upper Dstar estar - ε ≤ D'.E (fun S => (e' S (fun j => y.1 j.1) - ∑ j, y.1 j) ^ 2)))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PublishedAronowLopattoBoundedUnbiased · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:435
def scalarPriorBayesRisk

Scalar prior Bayes risk is the least prior-averaged scalar squared-error risk over all estimators.

Definition (Lean source)
n :
scalarPriorBayesRisk n prior :
sInf {v : ℝ | ∃ f : Fin (n + 1) → ℝ, v = ∑ θ, prior.p θ * scalarExperimentRisk n f θ}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarPriorBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:484
def IsBalancedBernoulliScalarProcedure

A scalar procedure is balanced Bernoulli when the design is the fair product design and the estimator depends only on the observed score count.

Definition (Lean source)
n :
f :
Fin (n + 1) → ℝ
p :
Procedure 2 n twoArmContrast
IsBalancedBernoulliScalarProcedure n f p :
Prop
clause 1
clause 2
A :
Assign 2 n
(p.2 A y : ℝ)
= f ⟨(Finset.univ.filter fun i => if A i = 0 then y i else !(y i)).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i => if A i = 0 then y i else !(y i)) univ))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsBalancedBernoulliScalarProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:490
def IsAdmissibleTwoArmProcedure

Decision-theoretic admissibility: no procedure weakly dominates everywhere and strictly somewhere.

Definition (Lean source)
n :
p :
Procedure 2 n twoArmContrast
IsAdmissibleTwoArmProcedure p :
Prop
¬ ∃ q : Procedure 2 n twoArmContrast, (∀ z, labeledRisk twoArmContrast q z ≤ labeledRisk twoArmContrast p z) ∧ (∃ z, labeledRisk twoArmContrast q z < labeledRisk twoArmContrast p z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsAdmissibleTwoArmProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:501
def IsLeastFavorableScalarPrior

A prior is least favorable for the scalar experiment when it maximizes scalar Bayes risk.

Definition (Lean source)
n :
prior' :
IsLeastFavorableScalarPrior prior :
Prop
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsLeastFavorableScalarPrior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:507
structure PublishedAiryAsymptoticData

Source-specific Airy shrinkage and squared-ground-state data.

Definition (Lean source)
hA :
ℝ → ℝ
phiA :
ℝ → ℝ
constant :
constant_spec :
phiA_smooth :
ContDiff ℝ 2 phiA
phiA_positive :
∀ t, 0 < phiA t
phiA_even :
∀ t, phiA (-t) = phiA t
phiA_normalized :
∫ t in Ioi (0 : ℝ), phiA t ^ 2 ∂MeasureTheory.volume = 1
phiA_ground_state :
∀ t, -4 * deriv (deriv phiA) t + |t| * phiA t = constant.1 * phiA t
hA_formula :
∀ t, hA t = -2 * deriv phiA t / phiA t
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PublishedAiryAsymptoticData · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:513
def publishedAiryUpperEstimator

The published nonlinear rule X/n - n⁻²ᐟ³ h_A(X/n²ᐟ³).

Definition (Lean source)
n :
X :
publishedAiryUpperEstimator data n X :
X / n - (n : ℝ) ^ (-(2 / 3 : ℝ)) * data.hA (X / (n : ℝ) ^ (2 / 3 : ℝ))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.publishedAiryUpperEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:527
def publishedAiryPriorWeight

The explicit symmetric φ_A² weights from the published lower sequence.

Definition (Lean source)
publishedAiryPriorWeight data n θ :
if (θ.1.1 : ℕ) = 0 ∧
(θ.1.2.1 : ℕ)
= 0 then data.phiA 0 ^ 2 else if (θ.1.2.1 : ℕ) = 0 then (1 / 2 : ℝ) * data.phiA (((θ.1.1 : ℕ) : ℝ) / (n : ℝ) ^ (2 / 3 : ℝ)) ^ 2 else if (θ.1.1 : ℕ) = 0 then (1 / 2 : ℝ) * data.phiA (((θ.1.2.1 : ℕ) : ℝ) / (n : ℝ) ^ (2 / 3 : ℝ)) ^ 2 else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.publishedAiryPriorWeight · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:533
def IsPublishedAiryPrior

A scalar prior is exactly the normalized published symmetric φ_A² prior.

Definition (Lean source)
n :
θ :
IsPublishedAiryPrior data n prior :
Prop
prior.p θ = publishedAiryPriorWeight data n θ / ∑ θ', publishedAiryPriorWeight data n θ'
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsPublishedAiryPrior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:543
def publishedTwoArmScalarAttainmentScopeBoundary

Bibliographic boundary: the cited scalar prior is not lifted by the source to complete response schedules. This metadata is deliberately separate from the source's positive logical carrier below.

Definition (Lean source)
publishedTwoArmScalarAttainmentScopeBoundary :
["the cited source supplies no lift of its scalar least-favorable prior to complete response schedules"]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.publishedTwoArmScalarAttainmentScopeBoundary · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:549

Sudijono, Dobriban, and Tchetgen Tchetgen (2026), Theorems 2.1–2.2, 3.1, and C.1–C.2, arXiv:2608.13822. The four positive clauses retained here are: posterior-mean/least-favorable scalar attainment and Bayes-risk equality; scalar/full-game equality with balanced attainment and admissibility; the explicit h_A nonlinear-shrinkage upper sequence; and the explicit symmetric φ_A² scalar-prior lower sequence. The cited prior is on scalar effect-class triples; no complete-schedule lift is asserted here.

Definition (Lean source)
PublishedTwoArmScalarAttainmentScope :
Sort 0
= ["the cited source supplies no lift of its scalar least-favorable prior to complete response schedules"] ∧
(∀ n : ℕ, 0 < n → ∃ (f : Fin (n + 1) → ℝ) (prior : FiniteDesign (ScalarTriple n)) (bayesRisk : ℝ), (∀ x : Fin (n + 1), 0 < (∑ θ, prior.p θ * ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), if (x : ℕ) = (θ.1.1 : ℕ) + k then (choose (θ.1.2.2 : ℕ) k : ℝ) / 2 ^ (θ.1.2.2 : ℕ) else 0) → f x = (∑ θ, prior.p θ * (∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), if (x : ℕ) = (θ.1.1 : ℕ) + k then ((choose (θ.1.2.2 : ℕ) k : ℝ) / 2 ^ (θ.1.2.2 : ℕ)) * ((((θ.1.1 : ℕ) : ℝ) - ((θ.1.2.1 : ℕ) : ℝ)) / n) else 0)) / (∑ θ, prior.p θ * ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), if (x : ℕ) = (θ.1.1 : ℕ) + k then (choose (θ.1.2.2 : ℕ) k : ℝ) / 2 ^ (θ.1.2.2 : ℕ) else 0)) ∧ (∀ f', f' ≠ f → (⨆ θ, scalarExperimentRisk n f θ) < (⨆ θ, scalarExperimentRisk n f' θ)) ∧ bayesRisk = scalarPriorBayesRisk n prior ∧ bayesRisk = scalarMinimaxValue n ∧ IsLeastFavorableScalarPrior prior ∧ rho2 n = scalarMinimaxValue n ∧ (∃ fullProcedure : Procedure 2 n twoArmContrast, IsBalancedBernoulliScalarProcedure n f fullProcedure ∧ worstCaseRisk (fun (p : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast p z) fullProcedure = rho2 n ∧ IsAdmissibleTwoArmProcedure fullProcedure)) ∧
(∃ (data : PublishedAiryAsymptoticData) (priorSequence : (m : ℕ) → FiniteDesign (ScalarTriple m)) (upperRemainder lowerRemainder : ℕ → ℝ), (∀ m, IsPublishedAiryPrior data m (priorSequence m)) ∧ Tendsto (fun m => secondOrderScale m * upperRemainder m) atTop (nhds 0) ∧ Tendsto (fun m => secondOrderScale m * lowerRemainder m) atTop (nhds 0) ∧ (∀ m, (⨆ θ : ScalarTriple m, scalarExperimentRisk m (fun X₂ => publishedAiryUpperEstimator data m (2 * (X₂ : ℝ) - m)) θ) ≤ (m : ℝ)⁻¹ - data.constant.1 / secondOrderScale m + upperRemainder m) ∧ (∀ m : ℕ, (m : ℝ)⁻¹ - data.constant.1 / secondOrderScale m + lowerRemainder m ≤ scalarPriorBayesRisk m (priorSequence m)))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PublishedTwoArmScalarAttainmentScope · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:556
structure BoundaryLayerHandle

Descriptive, nonassertive payload for the unresolved active-face program.

Definition (Lean source)
startingObject :
faceEnumeration :
steinExpansion :
normalizerSelection :
limitProblem :
compatibilityConditions :
nonassertionDisclaimer :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.BoundaryLayerHandle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:614
def activeFaceBoundaryLayerHandle Remark 1 in the paper ↗

The active-face boundary-layer handle records the paper’s boundary-layer scaling quantities for a contrast and population size.

Definition (Lean source)
activeFaceBoundaryLayerHandle :
{ startingObject := "Start from the exact response-type orbit game." faceEnumeration := "Enumerate binding response-type and allocation faces." steinExpansion := "Expand risk by a vector Stein identity within each stratum." normalizerSelection := "Use the certified c-dagger LP sequence to select a normalizer." limitProblem := "Pass the primal and dual games to a stratified diffusion-control or spectral value problem." compatibilityConditions := "Impose face and corner compatibility conditions." nonassertionDisclaimer := "No limiting operator, normalizer, or value problem is asserted." }
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.activeFaceBoundaryLayerHandle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:625
structure FeedbackHandle

Descriptive, nonassertive payload for the unresolved feedback construction.

Definition (Lean source)
scoreVector :
saddleCorrection :
finiteLift :
priorDiscretization :
nonassertionDisclaimer :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.FeedbackHandle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:635
def contrastScoreFeedbackHandle Remark 2 in the paper ↗

The contrast-score feedback handle records the score mean, variance, and shrinkage quantities used in the upper-risk analysis.

Definition (Lean source)
contrastScoreFeedbackHandle :
{ scoreVector := "Begin with the centered arm-score vector generated by q-star." saddleCorrection := "Derive an orbit-saddle posterior mean or feedback correction from the limiting value function." finiteLift := "Lift that correction to finite n." priorDiscretization := "Discretize the squared ground state or dual occupation measure into a least-favorable prior on response-type counts." nonassertionDisclaimer := "Optimizer and prior convergence remain unresolved." }
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrastScoreFeedbackHandle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Basic.lean:644
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.BayesInformation 6 declarations Bayesian information inequality over a general σ-finite observation measure.

Bayesian information inequality over a general σ-finite observation measure. The bundle below exposes the paper's density, support, a.e.-AC, derivative, differentiation-under-the-integral, finite-information, and joint-integrability premises without replacing them by everywhere differentiability or an unweighted assumption.

def bayesJointIntegral

The Bayes joint integral averages an observation field against its likelihood and then against the parameter prior.

Definition (Lean source)
Ω :
μ :
ell u :
w :
ℝ → ℝ
p f :
ℝ → Ω → ℝ
bayesJointIntegral μ ell u w p f :
∫ θ in ell..u, ∫ x, f θ x * p θ x * w θ ∂μ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.bayesJointIntegral · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/BayesInformation.lean:16
def priorInformation

Prior information is the prior expectation of the squared logarithmic derivative of the prior density.

Definition (Lean source)
ell u :
w dw :
ℝ → ℝ
priorInformation ell u w dw :
∫ θ in ell..u, if 0 < w θ then dw θ ^ 2 / w θ else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.priorInformation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/BayesInformation.lean:22
def fisherInformation

Fisher information is the joint prior-and-observation expectation of the squared likelihood score.

Definition (Lean source)
Ω :
μ :
p dp :
ℝ → Ω → ℝ
θ :
fisherInformation μ p dp θ :
∫ x, if 0 < p θ x then dp θ x ^ 2 / p θ x else 0 ∂μ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fisherInformation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/BayesInformation.lean:26
structure BayesianInformationRegularity

All hypotheses stated in the paper for the observation-dependent van Trees bound.

Definition (Lean source)
Ω :
μ :
ell u :
w dw :
ℝ → ℝ
p dp g dg :
ℝ → Ω → ℝ
T :
Ω → ℝ
interval_nonempty :
ell < u
prior_nonnegative :
∀ θ, 0 ≤ w θ
prior_probability :
∫ θ in ell..u, w θ = 1
prior_C1 :
ContDiff ℝ 1 w
prior_compact_support :
IsCompact (tsupport w) ∧ tsupport w ⊆ Ioo ell u
prior_positive_on_interior :
∀ θ ∈ interior (tsupport w), 0 < w θ
prior_derivative :
∀ θ, dw θ = deriv w θ
density_nonnegative :
∀ θ ∈ Ioo ell u, ∀ᵐ x ∂μ, 0 ≤ p θ x
density_probability :
∀ θ ∈ Ioo ell u, ∫ x, p θ x ∂μ = 1
density_integrable :
∀ θ ∈ Ioo ell u, Integrable (fun x => p θ x) μ
density_derivative_integrable :
∀ θ ∈ Ioo ell u, Integrable (fun x => dp θ x) μ
density_integral_derivative :
∀ θ ∈ Ioo ell u, HasDerivAt (fun t => ∫ x, p t x ∂μ) (∫ x, dp θ x ∂μ) θ
likelihood_ac_ae :
∀ᵐ x ∂μ, ∀ a ∈ Ioo ell u, ∀ b ∈ Ioo ell u, AbsolutelyContinuousOnInterval (fun θ => p θ x) a b
likelihood_derivative_ae :
∀ᵐ x ∂μ, ∀ᵐ θ ∂volume.restrict (Ioo ell u), dp θ x = deriv (fun s => p s x) θ
target_ac_ae :
∀ᵐ x ∂μ, ∀ a ∈ Ioo ell u, ∀ b ∈ Ioo ell u, AbsolutelyContinuousOnInterval (fun θ => g θ x) a b
target_derivative_ae :
∀ᵐ x ∂μ, ∀ᵐ θ ∂volume.restrict (Ioo ell u), dg θ x = deriv (fun s => g s x) θ
likelihood_hasDerivAt_ae :
∀ᵐ z ∂((volume.restrict (Ioo ell u)).prod μ), HasDerivAt (fun t => p t z.2) (dp z.1 z.2) z.1
target_hasDerivAt_ae :
∀ᵐ z ∂((volume.restrict (Ioo ell u)).prod μ), HasDerivAt (fun t => g t z.2) (dg z.1 z.2) z.1
differentiation_under_integral :
∀ θ ∈ Ioo ell u, ∫ x, dp θ x ∂μ = 0
prior_information_integrable :
IntegrableOn (fun θ => if 0 < w θ then dw θ ^ 2 / w θ else 0) (Icc ell u)
fisher_information_integrable :
∀ θ ∈ Ioo ell u, Integrable (fun x => if 0 < p θ x then dp θ x ^ 2 / p θ x else 0) μ
total_information_positive :
0 < priorInformation ell u w dw + ∫ θ in ell..u, fisherInformation μ p dp θ * w θ
risk_joint_integrable :
Integrable (fun z : ℝ × Ω => (T z.2 - g z.1 z.2) ^ 2 * p z.1 z.2 * w z.1) ((volume.restrict (Icc ell u)).prod μ)
derivative_joint_integrable :
Integrable (fun z : ℝ × Ω => dg z.1 z.2 * p z.1 z.2 * w z.1) ((volume.restrict (Icc ell u)).prod μ)
score_joint_integrable :
Integrable (fun z : ℝ × Ω => ((if 0 < w z.1 then dw z.1 / w z.1 else 0) + (if 0 < p z.1 z.2 then dp z.1 z.2 / p z.1 z.2 else 0)) ^ 2 * p z.1 z.2 * w z.1) ((volume.restrict (Icc ell u)).prod μ)
product_ac_ae :
∀ᵐ x ∂μ, AbsolutelyContinuousOnInterval (fun θ => w θ * p θ x * (T x - g θ x)) ell u
boundary_vanishes_ae :
∀ᵐ x ∂μ, w ell * p ell x * (T x - g ell x) = 0 ∧ w u * p u x * (T x - g u x) = 0
derivative_balance_joint_integrable :
Integrable (derivativeBalanceField w dw p dp g dg T) ((volume.restrict (Icc ell u)).prod μ)
error_score_joint_integrable :
Integrable (errorScoreField w dw p dp g T) ((volume.restrict (Icc ell u)).prod μ)
joint_score_sq_integrable :
Integrable (scoreSqField w dw p dp) ((volume.restrict (Icc ell u)).prod μ)
prior_score_sq_integrable :
Integrable (fun θ => w θ * (priorScore w dw θ) ^ 2) (volume.restrict (Icc ell u))
prior_score_joint_sq_integrable :
Integrable (fun z : ℝ × Ω => w z.1 * p z.1 z.2 * (priorScore w dw z.1) ^ 2) ((volume.restrict (Icc ell u)).prod μ)
fisher_score_joint_sq_integrable :
Integrable (fun z : ℝ × Ω => w z.1 * p z.1 z.2 * (likelihoodScore p dp z.1 z.2) ^ 2) ((volume.restrict (Icc ell u)).prod μ)
score_cross_joint_integrable :
Integrable (fun z : ℝ × Ω => w z.1 * p z.1 z.2 * (priorScore w dw z.1 * likelihoodScore p dp z.1 z.2)) ((volume.restrict (Icc ell u)).prod μ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.BayesianInformationRegularity · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/BayesInformation.lean:31
theorem bayesianInformation_ae_section_nonnegative Lemma bayesianInformation_ae_section_nonnegative in the paper ↗

the population size is positive, the relevant sections are almost everywhere absolutely continuous, Sectionwise absolute continuity turns parameterwise a.e. nonnegativity into a common full-measure set of sections that are nonnegative on the interval.

Formal statement
Ω :
μ :
ell u :
p :
ℝ → Ω → ℝ
hn :
∀ θ
if
θ ∈ Ioo ell u
then
∀ᵐ x ∂μ, 0 ≤ p θ x
hac :
∀ᵐ x ∂μ, ∀ a ∈ Ioo ell u, ∀ b ∈ Ioo ell u, AbsolutelyContinuousOnInterval (fun θ => p θ x) a b
∀ᵐ x ∂μ, ∀ θ, θ ∈ Ioo ell u → 0 ≤ p θ x
Proof (Lean source)
lemma bayesianInformation_ae_section_nonnegative {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) {ell u : ℝ} {p : ℝ → Ω → ℝ} (hn : ∀ θ, θ ∈ Ioo ell u → ∀ᵐ x ∂μ, 0 ≤ p θ x) (hac : ∀ᵐ x ∂μ, ∀ a ∈ Ioo ell u, ∀ b ∈ Ioo ell u, AbsolutelyContinuousOnInterval (fun θ => p θ x) a b) : ∀ᵐ x ∂μ, ∀ θ, θ ∈ Ioo ell u → 0 ≤ p θ x := by have hrat : ∀ᵐ x ∂μ, ∀ q : ℚ, ((q : ℝ) ∈ Ioo ell u → 0 ≤ p q x) := by rw [ae_all_iff] intro q by_cases hq : (q : ℝ) ∈ Ioo ell u · exact (hn q hq).mono (fun _ hx _ => hx) · exact Filter.Eventually.of_forall (fun _ h => (hq h).elim) filter_upwards [hac, hrat] with x hxac hxrat intro θ hθ rcases hθ with ⟨hellθ, hθu⟩ obtain ⟨q, _hqmono, hqθ, hqlim⟩ := Rat.denseRange_cast.exists_seq_strictMono_tendsto Rat.cast_mono θ let a := (ell + θ) / 2 let b := (θ + u) / 2 have ha : a ∈ Ioo ell u := by dsimp [a]; constructor <;> linarith have hb : b ∈ Ioo ell u := by dsimp [b]; constructor <;> linarith have hab : a < b := by dsimp [a, b]; linarith have hθab : θ ∈ Ioo a b := by dsimp [a, b]; constructor <;> linarith have hcont : ContinuousAt (fun s => p s x) θ := (hxac a ha b hb).continuousOn.continuousAt (by simpa [hab.le] using Icc_mem_nhds hθab.1 hθab.2) apply isClosed_Ici.mem_of_tendsto (hcont.tendsto.comp hqlim) filter_upwards [(tendsto_order.1 hqlim).1 a hθab.1] with n hn exact hxrat (q n) ⟨ha.1.trans hn, (hqθ n).trans hθu⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.bayesianInformation_ae_section_nonnegative · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/BayesInformation.lean:115
theorem bayesianInformationInequality Lemma 2 in the paper ↗

The AC-regularity Bayesian Cramér–Rao inequality for a target g(θ,x).

Formal statement
Ω :
μ :
ell u :
w dw :
ℝ → ℝ
p dp g dg :
ℝ → Ω → ℝ
T :
Ω → ℝ
h :
BayesianInformationRegularity μ ell u w dw p dp g dg T
bayesJointIntegral μ ell u w p (fun θ x => (T x - g θ x) ^ 2)
bayesJointIntegral μ ell u w p dg ^ 2 / (priorInformation ell u w dw + ∫ θ in ell..u, fisherInformation μ p dp θ * w θ)
Proof (Lean source)
lemma bayesianInformationInequality {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [SigmaFinite μ] (ell u : ℝ) (w dw : ℝ → ℝ) (p dp g dg : ℝ → Ω → ℝ) (T : Ω → ℝ) (h : BayesianInformationRegularity μ ell u w dw p dp g dg T) : bayesJointIntegral μ ell u w p (fun θ x => (T x - g θ x) ^ 2) ≥ bayesJointIntegral μ ell u w p dg ^ 2 / (priorInformation ell u w dw + ∫ θ in ell..u, fisherInformation μ p dp θ * w θ) := by let PM := Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure have hsupport : support w ⊆ Icc ell u := by intro θ hθ exact ⟨le_of_lt (h.prior_compact_support.2 (subset_tsupport w hθ)).1, le_of_lt (h.prior_compact_support.2 (subset_tsupport w hθ)).2⟩ have hwderiv : ∀ θ, HasDerivAt w (dw θ) θ := by intro θ rw [h.prior_derivative θ] exact (h.prior_C1.differentiable (by norm_num)).differentiableAt.hasDerivAt have hwnorm : ∫ θ, w θ ∂PM ell u = 1 := by rw [← h.prior_probability, intervalIntegral.integral_of_le h.interval_nonempty.le] unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure rw [restrict_Ioc_eq_restrict_Icc] have hboundary : ∀ᵐ x ∂μ, w u * p u x * (T x - g u x) = 0 ∧ w ell * p ell x * (T x - g ell x) = 0 := by filter_upwards [h.boundary_vanishes_ae] with x hx exact ⟨hx.2, hx.1⟩ have hsensitivityInt : Integrable (sensitivityField w p dg) ((PM ell u).prod μ) := by change Integrable (sensitivityField w p dg) ((volume.restrict (Icc ell u)).prod μ) convert h.derivative_joint_integrable using 1 ext z simp [sensitivityField, jointDensity] ring have herrorSqInt : Integrable (errorSqField w p g T) ((PM ell u).prod μ) := by change Integrable (errorSqField w p g T) ((volume.restrict (Icc ell u)).prod μ) convert h.risk_joint_integrable using 1 ext z simp [errorSqField, jointDensity] ring letI : IsFiniteMeasure (PM ell u) := by unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure infer_instance have hrisk : bayesJointIntegral μ ell u w p (fun θ x => (T x - g θ x) ^ 2) = ∫ z, errorSqField w p g T z ∂((PM ell u).prod μ) := by calc _ = ∫ θ, ∫ x, (T x - g θ x) ^ 2 * p θ x * w θ ∂μ ∂PM ell u := by rw [bayesJointIntegral, intervalIntegral.integral_of_le h.interval_nonempty.le] unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure rw [restrict_Ioc_eq_restrict_Icc] _ = _ := by rw [MeasureTheory.integral_prod _ herrorSqInt] apply MeasureTheory.integral_congr_ae filter_upwards with θ apply MeasureTheory.integral_congr_ae filter_upwards with x simp [errorSqField, jointDensity] ring have hsensitivity : bayesJointIntegral μ ell u w p dg = ∫ z, sensitivityField w p dg z ∂((PM ell u).prod μ) := by calc _ = ∫ θ, ∫ x, dg θ x * p θ x * w θ ∂μ ∂PM ell u := by rw [bayesJointIntegral, intervalIntegral.integral_of_le h.interval_nonempty.le] unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure rw [restrict_Ioc_eq_restrict_Icc] _ = _ := by rw [MeasureTheory.integral_prod _ hsensitivityInt] apply MeasureTheory.integral_congr_ae filter_upwards with θ apply MeasureTheory.integral_congr_ae filter_upwards with x simp [sensitivityField, jointDensity] ring have hprior : priorInformation ell u w dw = priorInformation ell u w dw := by rw [priorInformation, priorInformation, intervalIntegral.integral_of_le h.interval_nonempty.le] rw [Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure, ← restrict_Ioc_eq_restrict_Icc] apply MeasureTheory.integral_congr_ae filter_upwards with θ simp [priorScore] split_ifs with hθ · field_simp · ring have hfisher : (∫ θ in ell..u, fisherInformation μ p dp θ * w θ) = ∫ θ, w θ * fisherInformation μ p dp θ ∂PM ell u := by rw [intervalIntegral.integral_of_le h.interval_nonempty.le] unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure rw [restrict_Ioc_eq_restrict_Icc] apply MeasureTheory.integral_congr_ae filter_upwards with θ have hFI : fisherInformation μ p dp θ = fisherInformation μ p dp θ := by rw [fisherInformation, fisherInformation] apply MeasureTheory.integral_congr_ae filter_upwards with x simp [likelihoodScore] split_ifs with hx · field_simp · ring rw [hFI, mul_comm] have hinfoPos : 0 < priorInformation ell u w dw + ∫ θ, w θ * fisherInformation μ p dp θ ∂PM ell u := by rw [← hprior, ← hfisher] exact h.total_information_positive have hvt : (∫ z, sensitivityField w p dg z ∂((PM ell u).prod μ)) ^ 2 / (priorInformation ell u w dw + ∫ θ, w θ * fisherInformation μ p dp θ ∂PM ell u) ≤ ∫ z, errorSqField w p g T z ∂((PM ell u).prod μ) := by letI : IsFiniteMeasure (PM ell u) := by unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure infer_instance have hmemIcc : ∀ᵐ θ ∂PM ell u, θ ∈ Icc ell u := by unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure exact ae_restrict_mem measurableSet_Icc have hmemIoo : ∀ᵐ θ ∂PM ell u, θ ∈ Ioo ell u := by filter_upwards [hmemIcc, (by unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure exact ae_restrict_of_ae (volume.ae_ne ell)), (by unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure exact ae_restrict_of_ae (volume.ae_ne u))] with θ hθ hθell hθu exact ⟨lt_of_le_of_ne hθ.1 (Ne.symm hθell), lt_of_le_of_ne hθ.2 hθu⟩ have hpSections : ∀ᵐ x ∂μ, ∀ θ, θ ∈ Ioo ell u → 0 ≤ p θ x := bayesianInformation_ae_section_nonnegative μ h.density_nonnegative h.likelihood_ac_ae have hpNonneg : ∀ᵐ z ∂((PM ell u).prod μ), 0 ≤ p z.1 z.2 := by have hx : ∀ᵐ z ∂((PM ell u).prod μ), ∀ θ, θ ∈ Ioo ell u → 0 ≤ p θ z.2 := Measure.quasiMeasurePreserving_snd.tendsto_ae.eventually hpSections have hθ : ∀ᵐ z ∂((PM ell u).prod μ), z.1 ∈ Ioo ell u := Measure.quasiMeasurePreserving_fst.tendsto_ae.eventually hmemIoo filter_upwards [hx, hθ] with z hxz hθz exact hxz z.1 hθz have hwzero : ∀ θ, w θ = 0 → dw θ = 0 := by intro θ hzero exact derivative_eq_zero_of_nonnegative_of_eq_zero h.prior_nonnegative (hwderiv θ) hzero have hpzero : ∀ᵐ z ∂((PM ell u).prod μ), p z.1 z.2 = 0 → dp z.1 z.2 = 0 := by have hx : ∀ᵐ z ∂((PM ell u).prod μ), ∀ θ, θ ∈ Ioo ell u → 0 ≤ p θ z.2 := Measure.quasiMeasurePreserving_snd.tendsto_ae.eventually hpSections have hθ : ∀ᵐ z ∂((PM ell u).prod μ), z.1 ∈ Ioo ell u := Measure.quasiMeasurePreserving_fst.tendsto_ae.eventually hmemIoo have hderiv : ∀ᵐ z ∂((PM ell u).prod μ), HasDerivAt (fun t => p t z.2) (dp z.1 z.2) z.1 := by simpa [PM, Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure, restrict_Ioo_eq_restrict_Icc] using h.likelihood_hasDerivAt_ae filter_upwards [hderiv, hx, hθ] with z hder hxz hθz intro hz have hmin : IsLocalMin (fun t => p t z.2) z.1 := by filter_upwards [Ioo_mem_nhds hθz.1 hθz.2] with t ht rw [hz] exact hxz t ht exact hmin.hasDerivAt_eq_zero hder have hdpSwap : ∀ᵐ z ∂(μ.prod (PM ell u)), HasDerivAt (fun t => p t z.1) (dp z.2 z.1) z.2 := by have hderiv : ∀ᵐ z ∂((PM ell u).prod μ), HasDerivAt (fun t => p t z.2) (dp z.1 z.2) z.1 := by simpa [PM, Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure, restrict_Ioo_eq_restrict_Icc] using h.likelihood_hasDerivAt_ae have hz := Measure.measurePreserving_swap.quasiMeasurePreserving.tendsto_ae.eventually hderiv simpa [swap] using hz have hdgSwap : ∀ᵐ z ∂(μ.prod (PM ell u)), HasDerivAt (fun t => g t z.1) (dg z.2 z.1) z.2 := by have hderiv : ∀ᵐ z ∂((PM ell u).prod μ), HasDerivAt (fun t => g t z.2) (dg z.1 z.2) z.1 := by simpa [PM, Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure, restrict_Ioo_eq_restrict_Icc] using h.target_hasDerivAt_ae have hz := Measure.measurePreserving_swap.quasiMeasurePreserving.tendsto_ae.eventually hderiv simpa [swap] using hz have hdpSections : ∀ᵐ x ∂μ, ∀ᵐ θ ∂PM ell u, HasDerivAt (fun t => p t x) (dp θ x) θ := by simpa using Measure.ae_ae_of_ae_prod hdpSwap have hdgSections : ∀ᵐ x ∂μ, ∀ᵐ θ ∂PM ell u, HasDerivAt (fun t => g t x) (dg θ x) θ := by simpa using Measure.ae_ae_of_ae_prod hdgSwap have hbalanceZero : ∫ z, derivativeBalanceField w dw p dp g dg T z ∂((PM ell u).prod μ) = 0 := by have hbalanceInt : Integrable (derivativeBalanceField w dw p dp g dg T) ((PM ell u).prod μ) := by simpa [PM, Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure] using h.derivative_balance_joint_integrable rw [integral_prod_symm _ hbalanceInt] apply integral_eq_zero_of_ae filter_upwards [h.product_ac_ae, hboundary, hdpSections, hdgSections, hbalanceInt.prod_left_ae] with x hacx hboundaryx hdpx hdgx hintx let q : ℝ → ℝ := fun θ => w θ * p θ x * (T x - g θ x) have hqderiv : ∀ᵐ θ ∂PM ell u, HasDerivAt q (derivativeBalanceField w dw p dp g dg T (θ, x)) θ := by filter_upwards [hdpx, hdgx] with θ hdpθ hdgθ have hm := ((hwderiv θ).mul hdpθ).mul (hdgθ.const_sub (T x)) simp only [Pi.mul_apply] at hm have hfun : q = (w * (fun t => p t x)) * (fun t => T x - g t x) := by funext t rfl have hcoef : derivativeBalanceField w dw p dp g dg T (θ, x) = (dw θ * p θ x + w θ * dp θ x) * (T x - g θ x) + w θ * p θ x * -dg θ x := by simp [derivativeBalanceField, jointDensity] ring rw [hfun, hcoef] exact hm calc (∫ θ, derivativeBalanceField w dw p dp g dg T (θ, x) ∂PM ell u) = ∫ θ, deriv q θ ∂PM ell u := by apply integral_congr_ae filter_upwards [hqderiv] with θ hθ exact hθ.deriv.symm _ = ∫ θ in ell..u, deriv q θ := by unfold PM Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure rw [intervalIntegral.integral_of_le h.interval_nonempty.le, restrict_Ioc_eq_restrict_Icc] _ = q u - q ell := hacx.integral_deriv_eq_sub _ = 0 := by simp [q, hboundaryx.1, hboundaryx.2] have herrorSensitivity : -- … truncated; follow the source link for the rest …
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.bayesianInformationInequality · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/BayesInformation.lean:148
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.EmbeddedTwoArm 39 declarations Paper-local sign-group embedding for the unrestricted two-arm converse.

Paper-local sign-group embedding for the unrestricted two-arm converse.

def signGroupScale

Half of the contrast's ℓ₁ norm, the scale of the sign-group embedding.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
signGroupScale c :
Lc c / 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.signGroupScale · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:17
theorem signGroupScale_pos

the sign group scale is positive.

Formal statement
K :
shared
c :
Contrast ℝ K
Proof (Lean source)
lemma signGroupScale_pos (c : Contrast ℝ K) : 0 < signGroupScale c := by exact div_pos (Lc_pos c) (by norm_num)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.signGroupScale_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:21
theorem signGroupScale_sq

the sign group scale squared property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
signGroupScale c ^ 2 = C0 c
Proof (Lean source)
lemma signGroupScale_sq (c : Contrast ℝ K) : signGroupScale c ^ 2 = C0 c := by unfold signGroupScale C0 ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.signGroupScale_sq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:26
theorem positiveCoefficientSum

the positive coefficient sums.

Formal statement
K :
shared
c :
Contrast ℝ K
∑ a with 0 < c a, c a = signGroupScale c
Proof (Lean source)
lemma positiveCoefficientSum (c : Contrast ℝ K) : ∑ a with 0 < c a, c a = signGroupScale c := by classical let P : ℝ := ∑ a with 0 < c a, c a let N : ℝ := ∑ a with c a < 0, c a have hsum : P + N = 0 := by rw [← c.sum_zero] dsimp [P, N] simp only [Finset.sum_filter, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro a _ by_cases hp : 0 < c a · simp [hp, not_lt.mpr hp.le] · by_cases hn : c a < 0 · simp [hp, hn] · have hz : c a = 0 := le_antisymm (le_of_not_gt hp) (le_of_not_gt hn) simp [hp, hn, hz] have habs : Lc c = P - N := by unfold Lc dsimp [P, N] simp only [Finset.sum_filter, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro a _ by_cases hp : 0 < c a · simp [hp, not_lt.mpr hp.le, abs_of_pos hp] · by_cases hn : c a < 0 · simp [hp, hn, abs_of_neg hn] · have hz : c a = 0 := le_antisymm (le_of_not_gt hp) (le_of_not_gt hn) simp [hp, hn, hz] unfold signGroupScale dsimp [P, N] at hsum habs ⊢ linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.positiveCoefficientSum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:32
theorem negativeCoefficientSum

the negative coefficient sums.

Formal statement
K :
shared
c :
Contrast ℝ K
∑ a with c a < 0, c a = -signGroupScale c
Proof (Lean source)
lemma negativeCoefficientSum (c : Contrast ℝ K) : ∑ a with c a < 0, c a = -signGroupScale c := by have hp := positiveCoefficientSum c have hs : (∑ a with 0 < c a, c a) + (∑ a with c a < 0, c a) = 0 := by classical calc _ = ∑ a, c a := by simp only [Finset.sum_filter, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro a _ by_cases hpa : 0 < c a · simp [hpa, not_lt.mpr hpa.le] · by_cases hna : c a < 0 · simp [hpa, hna] · have hz : c a = 0 := le_antisymm (le_of_not_gt hpa) (le_of_not_gt hna) simp [hpa, hna, hz] _ = 0 := c.sum_zero linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.negativeCoefficientSum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:68
def signGroupAssignment

Coarsen a K-arm assignment to its positive/negative sign group, using a fair coin on zero-coefficient arms.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
w :
Assign K n × (Unit n → Bool)
signGroupAssignment c w :
Assign 2 n
fun i => if 0 < c (w.1 i) then 0 else if c (w.1 i) < 0 then 1 else if w.2 i then 0 else 1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.signGroupAssignment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:89

Embed a two-arm binary schedule by copying its coordinates over the corresponding positive and negative sign groups and fixing inactive outcomes to zero.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule 2 n
embeddedSignSchedule c z :
Schedule K n
fun i a => if 0 < c a then z i 0 else if c a < 0 then z i 1 else false
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embeddedSignSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:96
def inactiveZeroObservation

The pseudo-observation supplied to the original estimator: retain active-arm outcomes and replace inactive-arm outcomes by the fixed embedded value zero.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
A :
Assign K n
inactiveZeroObservation c A y :
fun i => if c (A i) = 0 then false else y i
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.inactiveZeroObservation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:102
theorem embeddedSignSchedule_observation

the embedded sign schedule observation property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule 2 n
w :
Assign K n × (Unit n → Bool)
Proof (Lean source)
lemma embeddedSignSchedule_observation (c : Contrast ℝ K) (z : Schedule 2 n) (w : Assign K n × (Unit n → Bool)) : inactiveZeroObservation c w.1 (obsOutcome z (signGroupAssignment c w)) = obsOutcome (embeddedSignSchedule c z) w.1 := by funext i unfold inactiveZeroObservation obsOutcome potentialOutcome signGroupAssignment embeddedSignSchedule by_cases hp : 0 < c (w.1 i) · simp [hp, ne_of_gt hp] by_cases hn : c (w.1 i) < 0 · simp [hp, hn, ne_of_lt hn] have hz : c (w.1 i) = 0 := le_antisymm (le_of_not_gt hp) (le_of_not_gt hn) simp [hp, hn, hz]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embeddedSignSchedule_observation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:108
theorem embeddedSignSchedule_target

the embedded sign schedule target property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule 2 n
Proof (Lean source)
lemma embeddedSignSchedule_target (c : Contrast ℝ K) (z : Schedule 2 n) : tauC c (embeddedSignSchedule c z) = signGroupScale c * tauC twoArmContrast z := by classical have hi (i : Unit n) : (∑ a, c a * if embeddedSignSchedule c z i a then 1 else 0) = signGroupScale c * (∑ a, twoArmContrast a * if z i a then 1 else 0) := by have hp := positiveCoefficientSum c have hn := negativeCoefficientSum c cases z0 : z i 0 <;> cases z1 : z i 1 <;> simp [embeddedSignSchedule, twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ, z0, z1, Finset.sum_filter] at hp hn ⊢ · simpa [and_iff_right_of_imp (fun h : c _ < 0 => h.le)] using hn · exact hp · calc (∑ x, if 0 = c x then 0 else c x) = ∑ x, c x := by apply Finset.sum_congr rfl intro a _ by_cases hz : c a = 0 <;> simp [hz] _ = 0 := c.sum_zero unfold tauC simp_rw [hi] simp_rw [← mul_assoc] rw [← Finset.mul_sum] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embeddedSignSchedule_target · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:123
def fairBoolDesign

A fair coin as a finite design.

Definition (Lean source)
fairBoolDesign :
clause 1
p := fun _ => 1 / 2
clause 2
p_nonneg := by intro; norm_num
clause 3
p_sum := by simp [Fintype.sum_bool]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fairBoolDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:151
def signLatentDesign

The original arbitrary assignment design augmented by independent fair inactive-arm coins.

Definition (Lean source)
K :
shared
n :
shared
D :
signLatentDesign D :
FiniteDesign (Assign K n × (Unit n → Bool))
compound D (fun _ _ => fairBoolDesign)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.signLatentDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:158
theorem signLatentDesign_E_fst

the sign latent design e fst property holds.

Formal statement
K :
shared
n :
shared
D :
f :
Assign K n → ℝ
(signLatentDesign D).E (fun w => f w.1) = D.E f
Proof (Lean source)
lemma signLatentDesign_E_fst (D : FiniteDesign (Assign K n)) (f : Assign K n → ℝ) : (signLatentDesign D).E (fun w => f w.1) = D.E f := by classical rw [signLatentDesign, FiniteDesign.E_compound] unfold FiniteDesign.E apply Finset.sum_congr rfl intro A _ calc (∑ s : Unit n → Bool, D.p A * (∏ i, fairBoolDesign.p (s i)) * f A) = D.p A * f A * ∑ s : Unit n → Bool, ∏ i, fairBoolDesign.p (s i) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro s _ ring _ = D.p A * f A := by rw [show (∑ s : Unit n → Bool, ∏ i, fairBoolDesign.p (s i)) = 1 from (prodDesign (fun _ : Unit n => fairBoolDesign)).p_sum, mul_one]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.signLatentDesign_E_fst · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:164
def scaledLatentEstimator

The original estimator, evaluated on the pseudo-observation and rescaled to the two-arm natural action interval.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
p :
Procedure K n c
w :
Assign K n × (Unit n → Bool)
scaledLatentEstimator c p w y :
(signGroupScale c)⁻¹ * (p.2 w.1 (inactiveZeroObservation c w.1 y) : ℝ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scaledLatentEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:185
theorem scaledLatentEstimator_mem_Icc

the scaled latent estimator belongs to closed interval.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
p :
Procedure K n c
w :
Assign K n × (Unit n → Bool)
scaledLatentEstimator c p w y ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma scaledLatentEstimator_mem_Icc (c : Contrast ℝ K) (p : Procedure K n c) (w : Assign K n × (Unit n → Bool)) (y : ObservedOutcome n) : scaledLatentEstimator c p w y ∈ Icc (-1 : ℝ) 1 := by have ha := signGroupScale_pos c have hv := (p.2 w.1 (inactiveZeroObservation c w.1 y)).property unfold scaledLatentEstimator constructor · rw [inv_mul_eq_div] apply (le_div_iff₀ ha).2 simpa only [neg_one_mul, signGroupScale, neg_div] using hv.1 · rw [inv_mul_eq_div] apply (div_le_iff₀ ha).2 simpa only [one_mul, signGroupScale] using hv.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scaledLatentEstimator_mem_Icc · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:192
def inducedTwoArmProcedure

Rao--Blackwellize the scaled latent estimator along the deterministic sign-group map.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
p :
Procedure K n c
inducedTwoArmProcedure c p :
Procedure 2 n twoArmContrast
φ :
(D.map φ, fun b y => ⟨conditionalMeanAlongMap D φ 0 (scaledLatentEstimator c p) b y, by simpa [Lc, twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ] using conditionalMeanAlongMap_mem_Icc D φ 0 (scaledLatentEstimator c p) b y (by norm_num) (scaledLatentEstimator_mem_Icc c p)⟩)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.inducedTwoArmProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:208
theorem inducedTwoArmProcedure_statewiseRisk

Statewise squared risk contracts after sign-group coarsening and rescaling.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
p :
Procedure K n c
z :
Schedule 2 n
Proof (Lean source)
lemma inducedTwoArmProcedure_statewiseRisk (c : Contrast ℝ K) (p : Procedure K n c) (z : Schedule 2 n) : labeledRisk twoArmContrast (inducedTwoArmProcedure c p) z ≤ (signGroupScale c)⁻¹ ^ 2 * labeledRisk c p (embeddedSignSchedule c z) := by let D := signLatentDesign p.1 let φ := signGroupAssignment (n := n) c let v : Assign 2 n → ObservedOutcome n := fun b => obsOutcome z b have hRB := E_map_conditionalMeanAlongMap_sq_le D φ 0 (scaledLatentEstimator c p) v (tauC twoArmContrast z) unfold labeledRisk FiniteDesign.mse inducedTwoArmProcedure change (D.map φ).E (fun b => (conditionalMeanAlongMap D φ 0 (scaledLatentEstimator c p) b (v b) - tauC twoArmContrast z) ^ 2) ≤ _ refine hRB.trans ?_ rw [show D.E (fun w => (scaledLatentEstimator c p w (v (φ w)) - tauC twoArmContrast z) ^ 2) = D.E (fun w => (signGroupScale c)⁻¹ ^ 2 * (((p.2 w.1 (obsOutcome (embeddedSignSchedule c z) w.1) : ℝ) - tauC c (embeddedSignSchedule c z)) ^ 2)) by apply D.E_congr intro w unfold scaledLatentEstimator rw [show v (φ w) = obsOutcome z (signGroupAssignment c w) by rfl, embeddedSignSchedule_observation] rw [embeddedSignSchedule_target] field_simp [(signGroupScale_pos c).ne']] rw [D.E_const_mul] change (signGroupScale c)⁻¹ ^ 2 * D.E (fun w => ((p.2 w.1 (obsOutcome (embeddedSignSchedule c z) w.1) : ℝ) - tauC c (embeddedSignSchedule c z)) ^ 2) ≤ _ rw [show D.E (fun w => ((p.2 w.1 (obsOutcome (embeddedSignSchedule c z) w.1) : ℝ) - tauC c (embeddedSignSchedule c z)) ^ 2) = p.1.E (fun A => ((p.2 A (obsOutcome (embeddedSignSchedule c z) A) : ℝ) - tauC c (embeddedSignSchedule c z)) ^ 2) by simpa [D] using signLatentDesign_E_fst p.1 (fun A => ((p.2 A (obsOutcome (embeddedSignSchedule c z) A) : ℝ) - tauC c (embeddedSignSchedule c z)) ^ 2)]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.inducedTwoArmProcedure_statewiseRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:222
theorem inducedTwoArmProcedure_worstCaseRisk

the induced two arm procedure worst case risk property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
p :
Procedure K n c
worstCaseRisk (fun (q : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast q z) (inducedTwoArmProcedure c p)
≤ (signGroupScale c)⁻¹ ^ 2 * worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => labeledRisk c q z) p
Proof (Lean source)
lemma inducedTwoArmProcedure_worstCaseRisk (c : Contrast ℝ K) (p : Procedure K n c) : worstCaseRisk (fun (q : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast q z) (inducedTwoArmProcedure c p) ≤ (signGroupScale c)⁻¹ ^ 2 * worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => labeledRisk c q z) p := by apply worstCaseRisk_le intro z calc labeledRisk twoArmContrast (inducedTwoArmProcedure c p) z ≤ (signGroupScale c)⁻¹ ^ 2 * labeledRisk c p (embeddedSignSchedule c z) := inducedTwoArmProcedure_statewiseRisk c p z _ ≤ (signGroupScale c)⁻¹ ^ 2 * worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => labeledRisk c q z) p := by gcongr exact le_worstCaseRisk (Finite.bddAbove_range _) _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.inducedTwoArmProcedure_worstCaseRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:262
theorem embeddedTwoArmLowerBound

Every unrestricted K-arm procedure induces a no-better two-arm procedure, yielding the sign-group minimax lower bound for arbitrary dependent designs and biased estimators.

Formal statement
K n :
c :
Contrast ℝ K
C0 c * rho2 n ≤ rhoN K n c
Proof (Lean source)
lemma embeddedTwoArmLowerBound (K n : ℕ) (c : Contrast ℝ K) : C0 c * rho2 n ≤ rhoN K n c := by let _ : Nonempty (Procedure K n c) := ⟨contrastWeightedProcedure K n c⟩ unfold rho2 rhoN rw [← signGroupScale_sq c] apply Causalean.Stat.le_minimaxValue intro p have hmin : minimaxValue (fun (q : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast q z) ≤ worstCaseRisk (fun (q : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast q z) (inducedTwoArmProcedure c p) := minimaxValue_le_worstCaseRisk_of_nonneg (fun q z => q.1.mse_nonneg _ _) _ have h := hmin.trans (inducedTwoArmProcedure_worstCaseRisk c p) have ha : signGroupScale c ≠ 0 := (signGroupScale_pos c).ne' calc signGroupScale c ^ 2 * minimaxValue (fun (q : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast q z) ≤ signGroupScale c ^ 2 * ((signGroupScale c)⁻¹ ^ 2 * worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => labeledRisk c q z) p) := mul_le_mul_of_nonneg_left h (sq_nonneg _) _ = worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => labeledRisk c q z) p := by field_simp [ha]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embeddedTwoArmLowerBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:283
theorem exists_positive_contrast_arm

the exists positive contrast arm.

Formal statement
K :
shared
c :
Contrast ℝ K
∃ a, 0 < c a
Proof (Lean source)
lemma exists_positive_contrast_arm (c : Contrast ℝ K) : ∃ a, 0 < c a := by by_contra h push_neg at h have hp := positiveCoefficientSum c have hempty : Finset.univ.filter (fun a => 0 < c a) = ∅ := Finset.filter_eq_empty_iff.mpr (fun a _ => not_lt.mpr (h a)) simp only [hempty, Finset.sum_empty] at hp exact (signGroupScale_pos c).ne' hp.symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exists_positive_contrast_arm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:314
theorem exists_negative_contrast_arm

the exists negative contrast arm.

Formal statement
K :
shared
c :
Contrast ℝ K
∃ a, c a < 0
Proof (Lean source)
lemma exists_negative_contrast_arm (c : Contrast ℝ K) : ∃ a, c a < 0 := by by_contra h push_neg at h have hn := negativeCoefficientSum c have hempty : Finset.univ.filter (fun a => c a < 0) = ∅ := Finset.filter_eq_empty_iff.mpr (fun a _ => not_lt.mpr (h a)) simp only [hempty, Finset.sum_empty] at hn exact (signGroupScale_pos c).ne' (neg_eq_zero.mp hn.symm)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exists_negative_contrast_arm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:325
def positiveContrastArm

The positive contrast arm property holds.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
positiveContrastArm c :
Arm K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.positiveContrastArm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:336
def negativeContrastArm

The negative contrast arm property holds.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
negativeContrastArm c :
Arm K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.negativeContrastArm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:341
theorem positiveContrastArm_pos

the positive contrast arm is positive.

Formal statement
K :
shared
c :
Contrast ℝ K
Proof (Lean source)
lemma positiveContrastArm_pos (c : Contrast ℝ K) : 0 < c (positiveContrastArm c) := Classical.choose_spec (exists_positive_contrast_arm c)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.positiveContrastArm_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:346
theorem negativeContrastArm_neg

the negative contrast arm neg property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
Proof (Lean source)
lemma negativeContrastArm_neg (c : Contrast ℝ K) : c (negativeContrastArm c) < 0 := Classical.choose_spec (exists_negative_contrast_arm c)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.negativeContrastArm_neg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:351
theorem support_eq_positive_negative_of_card_two

the stated side condition holds, the support equals positive negative when cardinality two.

Formal statement
K :
shared
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
Proof (Lean source)
lemma support_eq_positive_negative_of_card_two (c : Contrast ℝ K) (hcard : (Sc c).card = 2) : Sc c = {positiveContrastArm c, negativeContrastArm c} := by symm apply Finset.eq_of_subset_of_card_le · intro a ha simp only [Finset.mem_insert, mem_singleton] at ha rcases ha with rfl | rfl · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (positiveContrastArm_pos c).ne'⟩ · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (negativeContrastArm_neg c).ne⟩ · rw [hcard] have hne : positiveContrastArm c ≠ negativeContrastArm c := by intro h have hp := positiveContrastArm_pos c rw [h] at hp linarith [negativeContrastArm_neg c] simp [hne]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.support_eq_positive_negative_of_card_two · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:356
theorem coefficient_eq_zero_of_card_two

the stated side condition holds, the stated side condition holds, the stated side condition holds, the coefficient equals zero when cardinality two.

Formal statement
K :
shared
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
a :
Arm K
haP :
haN :
c a = 0
Proof (Lean source)
lemma coefficient_eq_zero_of_card_two (c : Contrast ℝ K) (hcard : (Sc c).card = 2) {a : Arm K} (haP : a ≠ positiveContrastArm c) (haN : a ≠ negativeContrastArm c) : c a = 0 := by by_contra ha have hm : a ∈ Sc c := Finset.mem_filter.mpr ⟨Finset.mem_univ _, ha⟩ rw [support_eq_positive_negative_of_card_two c hcard] at hm simpa [haP, haN] using hm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.coefficient_eq_zero_of_card_two · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:376
theorem positiveContrastArm_coeff

the stated side condition holds, the positive contrast arm coeff property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
Proof (Lean source)
lemma positiveContrastArm_coeff (c : Contrast ℝ K) (hcard : (Sc c).card = 2) : c (positiveContrastArm c) = signGroupScale c := by have hp := positiveCoefficientSum c classical rw [show (∑ a with 0 < c a, c a) = c (positiveContrastArm c) by rw [Finset.sum_eq_single (positiveContrastArm c)] · intro b hb hne have hb0 := coefficient_eq_zero_of_card_two c hcard hne (fun h => by rw [h] at hb linarith [negativeContrastArm_neg c, (Finset.mem_filter.mp hb).2]) simp [hb0] · simp [positiveContrastArm_pos c] ] at hp exact hp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.positiveContrastArm_coeff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:386
theorem negativeContrastArm_coeff

the stated side condition holds, the negative contrast arm coeff property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
Proof (Lean source)
lemma negativeContrastArm_coeff (c : Contrast ℝ K) (hcard : (Sc c).card = 2) : c (negativeContrastArm c) = -signGroupScale c := by have hn := negativeCoefficientSum c classical rw [show (∑ a with c a < 0, c a) = c (negativeContrastArm c) by rw [Finset.sum_eq_single (negativeContrastArm c)] · intro b hb hne have hb0 := coefficient_eq_zero_of_card_two c hcard (fun h => by rw [h] at hb linarith [positiveContrastArm_pos c, (Finset.mem_filter.mp hb).2]) hne simp [hb0] · simp [negativeContrastArm_neg c] ] at hn exact hn
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.negativeContrastArm_coeff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:404
def twoToActiveAssignment

The two to active assignment property holds.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
B :
Assign 2 n
twoToActiveAssignment c B :
Assign K n
fun i => if B i = 0 then positiveContrastArm c else negativeContrastArm c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoToActiveAssignment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:422
def activeToTwoAssignment

The active to two assignment property holds.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
A :
Assign K n
activeToTwoAssignment c A :
Assign 2 n
fun i => if A i = positiveContrastArm c then 0 else 1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.activeToTwoAssignment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:427
theorem positiveContrastArm_ne_negativeContrastArm

the positive contrast arm ne negative contrast arm property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.positiveContrastArm_ne_negativeContrastArm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:432
theorem activeToTwo_twoToActive

the active to two two to active property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
B :
Assign 2 n
Proof (Lean source)
lemma activeToTwo_twoToActive (c : Contrast ℝ K) (B : Assign 2 n) : activeToTwoAssignment c (twoToActiveAssignment c B) = B := by funext i generalize hB : B i = b fin_cases b · simp [activeToTwoAssignment, twoToActiveAssignment, hB] · simp [activeToTwoAssignment, twoToActiveAssignment, hB, (positiveContrastArm_ne_negativeContrastArm c).symm]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.activeToTwo_twoToActive · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:441
def activeSchedule

The active schedule property holds.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule K n
activeSchedule c z :
Schedule 2 n
fun i b => z i (if b = 0 then positiveContrastArm c else negativeContrastArm c)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.activeSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:452
theorem activeSchedule_observation

the active schedule observation property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule K n
B :
Assign 2 n
Proof (Lean source)
lemma activeSchedule_observation (c : Contrast ℝ K) (z : Schedule K n) (B : Assign 2 n) : obsOutcome (activeSchedule c z) B = obsOutcome z (twoToActiveAssignment c B) := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.activeSchedule_observation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:457
theorem activeSchedule_target

the stated side condition holds, the active schedule target property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
z :
Schedule K n
Proof (Lean source)
lemma activeSchedule_target (c : Contrast ℝ K) (hcard : (Sc c).card = 2) (z : Schedule K n) : tauC c z = signGroupScale c * tauC twoArmContrast (activeSchedule c z) := by classical have hi (i : Unit n) : (∑ a, c a * if z i a then 1 else 0) = signGroupScale c * (∑ b, twoArmContrast b * if activeSchedule c z i b then 1 else 0) := by rw [show (∑ a, c a * if z i a then 1 else 0) = c (positiveContrastArm c) * (if z i (positiveContrastArm c) then 1 else 0) + c (negativeContrastArm c) * (if z i (negativeContrastArm c) then 1 else 0) by calc _ = ∑ a ∈ {positiveContrastArm c, negativeContrastArm c}, c a * if z i a then 1 else 0 := by symm apply Finset.sum_subset (by simp) intro a _ ha have haP : a ≠ positiveContrastArm c := fun h => ha (by simp [h]) have haN : a ≠ negativeContrastArm c := fun h => ha (by simp [h]) simp [coefficient_eq_zero_of_card_two c hcard haP haN] _ = _ := by have hne : positiveContrastArm c ≠ negativeContrastArm c := by intro h have hp := positiveContrastArm_pos c rw [h] at hp linarith [negativeContrastArm_neg c] simp [hne]] rw [positiveContrastArm_coeff c hcard, negativeContrastArm_coeff c hcard] simp [activeSchedule, twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ] by_cases hP : z i (positiveContrastArm c) <;> by_cases hN : z i (negativeContrastArm c) <;> simp [hP, hN] <;> ring unfold tauC simp_rw [hi, ← mul_assoc] rw [← Finset.mul_sum] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.activeSchedule_target · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:464

The lift two arm procedure property holds.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
p :
Procedure 2 n twoArmContrast
liftTwoArmProcedure c p :
Procedure K n c
(p.1.map (twoToActiveAssignment c), fun A y => ⟨signGroupScale c * (p.2 (activeToTwoAssignment c A) y : ℝ), by have hv := (p.2 (activeToTwoAssignment c A) y).property have hLc2 : Lc twoArmContrast = 2 := by norm_num [Lc, twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ] have ha := (signGroupScale_pos c).le have hv' : (p.2 (activeToTwoAssignment c A) y : ℝ) ∈ Icc (-1 : ℝ) 1 := by simpa [hLc2] using hv constructor · change -Lc c / 2 ≤ signGroupScale c * _ have hh := mul_le_mul_of_nonneg_left hv'.1 ha simpa [signGroupScale, neg_div] using hh · change signGroupScale c * _ ≤ Lc c / 2 simpa [signGroupScale] using mul_le_mul_of_nonneg_left hv'.2 ha⟩)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.liftTwoArmProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:503
theorem liftTwoArmProcedure_statewiseRisk

the stated side condition holds, the lift two arm procedure statewise risk property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
p :
Procedure 2 n twoArmContrast
z :
Schedule K n
Proof (Lean source)
lemma liftTwoArmProcedure_statewiseRisk (c : Contrast ℝ K) (hcard : (Sc c).card = 2) (p : Procedure 2 n twoArmContrast) (z : Schedule K n) : labeledRisk c (liftTwoArmProcedure c p) z = signGroupScale c ^ 2 * labeledRisk twoArmContrast p (activeSchedule c z) := by unfold labeledRisk FiniteDesign.mse liftTwoArmProcedure rw [p.1.E_map] rw [← p.1.E_const_mul] apply p.1.E_congr intro B change (signGroupScale c * (p.2 (activeToTwoAssignment c (twoToActiveAssignment c B)) (obsOutcome z (twoToActiveAssignment c B)) : ℝ) - tauC c z) ^ 2 = signGroupScale c ^ 2 * ((p.2 B (obsOutcome (activeSchedule c z) B) : ℝ) - tauC twoArmContrast (activeSchedule c z)) ^ 2 rw [activeToTwo_twoToActive, activeSchedule_observation, activeSchedule_target c hcard] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.liftTwoArmProcedure_statewiseRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:523
theorem supportTwoUpperBound

the stated side condition holds, the support two upper bound property holds.

Formal statement
K n :
c :
Contrast ℝ K
hcard :
(Sc c).card = 2
rhoN K n c ≤ C0 c * rho2 n
Proof (Lean source)
lemma supportTwoUpperBound (K n : ℕ) (c : Contrast ℝ K) (hcard : (Sc c).card = 2) : rhoN K n c ≤ C0 c * rho2 n := by let _ : Nonempty (Procedure 2 n twoArmContrast) := ⟨contrastWeightedProcedure 2 n twoArmContrast⟩ unfold rhoN rho2 rw [← signGroupScale_sq c] let A : ℝ := signGroupScale c ^ 2 have hA : 0 < A := by dsimp [A]; exact sq_pos_of_pos (signGroupScale_pos c) have hscale : A * Causalean.Stat.minimaxValue (fun (p : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast p z) = Causalean.Stat.minimaxValue (fun (p : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => A * labeledRisk twoArmContrast p z) := by unfold Causalean.Stat.minimaxValue Causalean.Stat.worstCaseRisk have hbdd : BddBelow (range (fun p : Procedure 2 n twoArmContrast => ⨆ z : Schedule 2 n, labeledRisk twoArmContrast p z)) := bddBelow_range_worstCaseRisk (fun (p : Procedure 2 n twoArmContrast) z => p.1.mse_nonneg _ _) calc A * (⨅ p : Procedure 2 n twoArmContrast, ⨆ z : Schedule 2 n, labeledRisk twoArmContrast p z) = ⨅ p : Procedure 2 n twoArmContrast, A * (⨆ z : Schedule 2 n, labeledRisk twoArmContrast p z) := (OrderIso.mulLeft₀ A hA).map_ciInf hbdd _ = ⨅ p : Procedure 2 n twoArmContrast, ⨆ z : Schedule 2 n, A * labeledRisk twoArmContrast p z := by congr with p exact (OrderIso.mulLeft₀ A hA).map_ciSup (Finite.bddAbove_range _) change Causalean.Stat.minimaxValue (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) ≤ A * Causalean.Stat.minimaxValue (fun (p : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast p z) rw [hscale] apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk (fun p z => p.1.mse_nonneg _ _)) intro p refine ⟨liftTwoArmProcedure c p, ?_⟩ apply worstCaseRisk_le intro z rw [liftTwoArmProcedure_statewiseRisk c hcard] change A * labeledRisk twoArmContrast p (activeSchedule c z) ≤ _ exact le_worstCaseRisk (risk := fun (p : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => A * labeledRisk twoArmContrast p z) (e := p) (Finite.bddAbove_range _) (activeSchedule c z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.supportTwoUpperBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/EmbeddedTwoArm.lean:543
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.FiniteGame 2 declarations Compact finite-state game separation and saddle-point scaffolding.

Compact finite-state game separation and saddle-point scaffolding.

A least-favorable response-count prior and an optimal orbit procedure form a saddle.

Definition (Lean source)
K :
shared
n :
c :
Contrast ℝ K
HasOrbitSaddle n c :
Prop
∃ (q : OrbitProcedure K n c) (nu : FiniteDesign (CountVec K n)),
clause 1
m :
orbitRisk c q m ≤ orbitGameValue K n c
clause 2
q' :
orbitGameValue K n c ≤ nu.E (fun m => orbitRisk c q' m)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HasOrbitSaddle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/FiniteGame.lean:14
theorem finite_orbit_game_has_saddle

the finite response-type orbit game admits optimal mixed strategies for both players with a common saddle value.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
Proof (Lean source)
lemma finite_orbit_game_has_saddle : HasOrbitSaddle n c := by classical let X : AllocVec K n → Type := fun r => ObsVec r let l : ℝ := -Lc c / 2 let u : ℝ := Lc c / 2 have hK : K ≠ 0 := by intro hK apply c.nonzero funext a exact elim0 (hK ▸ a) letI : Nonempty (Arm K) := Fintype.card_pos_iff.mp (by simpa using Nat.pos_of_ne_zero hK) letI : Nonempty (CountVec K n) := ⟨scheduleCounts (fun _ _ => false)⟩ let a₀ : Arm K := Classical.choice inferInstance let r₀ : AllocVec K n := ⟨fun a => if a = a₀ then ⟨n, Nat.lt_succ_self n⟩ else 0, by rw [Finset.sum_eq_single a₀] · simp · intro b _ hba simp [hba] · simp⟩ letI : Nonempty (AllocVec K n) := ⟨r₀⟩ have hlu : l ≤ u := by dsimp [l, u] have hLc : 0 ≤ Lc c := sum_nonneg fun _ _ => abs_nonneg _ linarith let P : CountVec K n → ∀ r : AllocVec K n, X r → ℝ := fun m r x => (orbitLik m r x : ℝ) let tau : CountVec K n → ℝ := tauCount c have hP : ∀ m r x, 0 ≤ P m r x := by intro m r x change (0 : ℝ) ≤ ((orbitLik m r x : ℚ) : ℝ) exact_mod_cast orbitLik_nonneg m r x let e : OrbitProcedure K n c ≃ Procedure X l u := { toFun := fun q => ⟨q.1, q.2⟩ invFun := fun q => (q.design, q.decision) left_inv := fun _ => rfl right_inv := fun q => by cases q; rfl } have hvalue : minimaxValue (Causalean.Stat.Minimax.FiniteSquaredLoss.risk P tau : Procedure X l u → CountVec K n → ℝ) = orbitGameValue K n c := by unfold orbitGameValue minimaxValue rw [← e.iInf_comp] rfl obtain ⟨qstar, deltastar, nu, hupper, hlower⟩ := finite_bounded_squared_loss_has_saddle P tau hlu hP refine ⟨(qstar, deltastar), nu, ?_, ?_⟩ · intro m change Causalean.Stat.Minimax.FiniteSquaredLoss.risk P tau ⟨qstar, deltastar⟩ m ≤ orbitGameValue K n c rw [← hvalue] exact hupper m · intro q' have h := hlower (e q') rw [hvalue] at h exact h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finite_orbit_game_has_saddle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/FiniteGame.lean:22
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.FirstOrderUpper 4 declarations The contrast-weighted finite-sample upper risk bound, split out to avoid theorem cycles.

The contrast-weighted finite-sample upper risk bound, split out to avoid theorem cycles.

def upperUnitScore

The upper-bound unit score is the contrast-weighted inverse-probability score used by the explicit first-order procedure.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
t :
a :
Arm K
upperUnitScore c t a :
if qStar c a = 0 then 0 else c a * ((if t a then 1 else 0) - 1 / 2) / qStar c a
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.upperUnitScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/FirstOrderUpper.lean:10
theorem upperUnitScore_mean

the upper unit score mean property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
(qStarDesign c).E (upperUnitScore c t) = ∑ a, c a * (if t a then 1 else 0)
Proof (Lean source)
lemma upperUnitScore_mean (c : Contrast ℝ K) (t : RespType K) : (qStarDesign c).E (upperUnitScore c t) = ∑ a, c a * (if t a then 1 else 0) := by classical unfold E upperUnitScore qStarDesign calc ∑ a, qStar c a * (if qStar c a = 0 then 0 else c a * ((if t a then 1 else 0) - 1 / 2) / qStar c a) = ∑ a, c a * ((if t a then 1 else 0) - 1 / 2) := by apply Finset.sum_congr rfl intro a _ by_cases hc : c a = 0 · simp [qStar, hc] · have hq : qStar c a ≠ 0 := div_ne_zero (abs_ne_zero.mpr hc) (ne_of_gt (Lc_pos c)) rw [if_neg hq] field_simp [hq] _ = ∑ a, c a * (if t a then 1 else 0) := by calc _ = ∑ a, (c a * (if t a then 1 else 0) - c a / 2) := by apply Finset.sum_congr rfl intro a _ ring _ = (∑ a, c a * (if t a then 1 else 0)) - ∑ a, c a / 2 := by rw [Finset.sum_sub_distrib] _ = _ := by rw [← Finset.sum_div, c.sum_zero]; norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.upperUnitScore_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/FirstOrderUpper.lean:15
theorem upperUnitScore_secondMoment

the upper unit score second moment property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
(qStarDesign c).E (fun a => upperUnitScore c t a ^ 2) = C0 c
Proof (Lean source)
lemma upperUnitScore_secondMoment (c : Contrast ℝ K) (t : RespType K) : (qStarDesign c).E (fun a => upperUnitScore c t a ^ 2) = C0 c := by classical unfold E upperUnitScore qStarDesign rw [C0] have hhalf (a : Arm K) : ((if t a then (1 : ℝ) else 0) - 1 / 2) ^ 2 = 1 / 4 := by by_cases ht : t a <;> simp [ht] <;> norm_num calc ∑ a, qStar c a * (if qStar c a = 0 then 0 else c a * ((if t a then 1 else 0) - 1 / 2) / qStar c a) ^ 2 = ∑ a, Lc c * |c a| / 4 := by apply Finset.sum_congr rfl intro a _ by_cases hc : c a = 0 · simp [qStar, hc] · have hq : qStar c a ≠ 0 := div_ne_zero (abs_ne_zero.mpr hc) (ne_of_gt (Lc_pos c)) rw [if_neg hq, div_pow, mul_pow, hhalf] simp only [qStar] field_simp [abs_ne_zero.mpr hc, ne_of_gt (Lc_pos c)] rw [sq_abs] _ = Lc c ^ 2 / 4 := by rw [← Finset.sum_div, ← Finset.mul_sum] simp only [Lc] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.upperUnitScore_secondMoment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/FirstOrderUpper.lean:42
theorem contrastWeightedProcedure_upperRisk

the population size is positive, the contrast weighted procedure upper risk property holds.

Formal statement
K n :
c :
Contrast ℝ K
hn :
0 < n
worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (contrastWeightedProcedure K n c)
C0 c / n
Proof (Lean source)
lemma contrastWeightedProcedure_upperRisk (K n : ℕ) (c : Contrast ℝ K) (hn : 0 < n) : worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (contrastWeightedProcedure K n c) ≤ C0 c / n := by classical apply worstCaseRisk_le intro z let D := prodDesign (fun _ : Unit n => qStarDesign c) let raw : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, upperUnitScore c (z i) (A i) have hunbiased : D.Unbiased raw (tauC c z) := by unfold Unbiased raw D tauC rw [E_const_mul, E_sum] simp_rw [E_prod_apply, upperUnitScore_mean] have hvar : D.Var raw ≤ C0 c / n := by rw [show raw = fun A => ∑ i, (n : ℝ)⁻¹ * upperUnitScore c (z i) (A i) by funext A; simp only [raw]; rw [Finset.mul_sum], Var_prod_linear_comb] calc _ ≤ ∑ _i : Unit n, (n : ℝ)⁻¹ ^ 2 * C0 c := by apply Finset.sum_le_sum intro i _ gcongr rw [Var_eq, upperUnitScore_secondMoment] exact sub_le_self _ (sq_nonneg _) _ = C0 c / n := by simp; field_simp unfold labeledRisk contrastWeightedProcedure change D.mse (fun A => clip c (centeredContrastScore c A (obsOutcome z A))) (tauC c z) ≤ C0 c / n calc _ ≤ D.mse raw (tauC c z) := by unfold mse apply Finset.sum_le_sum intro A _ apply mul_le_mul_of_nonneg_left _ (D.p_nonneg A) change (clip c (centeredContrastScore c A (obsOutcome z A)) - tauC c z) ^ 2 ≤ (raw A - tauC c z) ^ 2 have hraw : centeredContrastScore c A (obsOutcome z A) = raw A := rfl rw [hraw] exact clip_sq_dist_le c _ _ (tauC_mem_naturalInterval c z hn) _ = D.Var raw := D.mse_eq_var_of_unbiased hunbiased _ ≤ _ := hvar
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrastWeightedProcedure_upperRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/FirstOrderUpper.lean:70
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.GridApprox 17 declarations Posterior-mean lower certificates and barycenter upper certificates.

Posterior-mean lower certificates and barycenter upper certificates.

Rational probability vectors on response-count orbits.

Definition (Lean source)
K :
shared
n :
shared
nu :
CountVec K n → ℚ
IsRationalPrior nu :
Prop
clause 1
m :
0 ≤ nu m
clause 2
∑ m, nu m = 1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsRationalPrior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:13
def predictiveMass

Prior predictive mass of an allocation-observation orbit.

Definition (Lean source)
K :
shared
n :
shared
_c :
nu :
CountVec K n → ℚ
r :
x :
predictiveMass _c nu r x :
∑ m, nu m * orbitLik m r x
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.predictiveMass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:17
def predictiveTarget

Prior predictive target numerator.

Definition (Lean source)
K :
shared
n :
shared
c :
nu :
CountVec K n → ℚ
r :
x :
predictiveTarget c nu r x :
∑ m, nu m * orbitLik m r x * tauCountRat c m
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.predictiveTarget · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:22
def allocationBayesRisk

Posterior-mean Bayes lower certificate for an allocation orbit.

Definition (Lean source)
K :
shared
n :
shared
c :
nu :
CountVec K n → ℚ
r :
allocationBayesRisk c nu r :
(∑ m, nu m * tauCountRat c m ^ 2)
- ∑ x : ObsVec r, if _h : 0 < predictiveMass c nu r x then predictiveTarget c nu r x ^ 2 / predictiveMass c nu r x else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:27

The unrestricted prior lower certificate B.

Definition (Lean source)
K :
shared
n :
shared
c :
nu :
CountVec K n → ℚ
lowerCertificate c nu :
sInf {v : ℝ | ∃ r : AllocVec K n, v = (allocationBayesRisk c nu r : ℝ)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lowerCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:35

Worst-case risk of a rational allocation mixture and real orbit rule.

Definition (Lean source)
K :
shared
n :
shared
c :
pi :
GridPi K n
delta :
∀ r : AllocVec K n
if
then
upperCertificate c pi delta :
⨆ m : CountVec K n, ∑ r, (pi r : ℝ) * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * (delta r x - (tauCountRat c m : ℝ)) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.upperCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:39

Full rational dual multipliers for every equality, nonnegativity, and risk row.

Definition (Lean source)
K n M :
normalizationUpper :
normalizationLower :
occupancyUpper :
∀ r : AllocVec K n
if
then
occupancyLower :
∀ r : AllocVec K n
if
then
piNonnegative :
AllocVec K n → ℚ
weightNonnegative :
risk :
CountVec K n → ℚ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridDualMultipliers · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:46
def decodeGridDualMultipliers

Decode the row multipliers of the generic rational program into the paper's named normalization, occupancy, sign, and risk multipliers.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
y :
GR K n M → ℚ
decodeGridDualMultipliers y :
clause 1
normalizationUpper := y (.norm false)
clause 2
normalizationLower := y (.norm true)
clause 3
occupancyUpper r x := y (.occ r x false)
clause 4
occupancyLower r x := y (.occ r x true)
clause 5
piNonnegative r := y (.piNonneg r)
clause 6
weightNonnegative r x g := y (.wNonneg r x g)
clause 7
risk m := y (.risk m)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decodeGridDualMultipliers · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:57

Feasibility of all full-dual multipliers and every primal-coordinate stationarity row.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
c :
GridDualFeasible c y :
Prop
clause 1
0 ≤ y.normalizationUpper
clause 2
0 ≤ y.normalizationLower
clause 3
r x :
0 ≤ y.occupancyUpper r x
0 ≤ y.occupancyLower r x
clause 4
r :
0 ≤ y.piNonnegative r
clause 5
r x g :
0 ≤ y.weightNonnegative r x g
clause 6
m :
0 ≤ y.risk m
clause 7
∑ m, y.risk m = 1
clause 8
r :
y.normalizationUpper
- y.normalizationLower
- ∑ x, (y.occupancyUpper r x - y.occupancyLower r x)
- y.piNonnegative r
= 0
clause 9
r x g :
y.occupancyUpper r x
- y.occupancyLower r x
- y.weightNonnegative r x g
+ ∑ m, y.risk m * orbitLik m r x * (gammaMC M c g - tauCountRat c m) ^ 2
= 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridDualFeasible · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:69
def gridDualObjective

Objective of the full rational dual in the sign convention of RationalLP.Program.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
gridDualObjective y :
y.normalizationLower - y.normalizationUpper
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridDualObjective · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:85

Exact rational primal/dual certificate, coupled by full dual feasibility and equal objectives.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
c :
pi :
GridPi K n
w :
u :
nu :
CountVec K n → ℚ
ExactGridPrimalDualCertificate c pi w u nu :
Prop
∃ (wQ : RationalGridWeight K n M) (y : GridDualMultipliers K n M),
clause 1
clause 2
GridLPFeasible K n M c pi wQ u
clause 3
clause 4
nu = y.risk
clause 5
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ExactGridPrimalDualCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:89

δ is exactly the conditional barycenter Σ_g g w/π, with zero convention.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
c :
pi :
GridPi K n
w :
delta :
∀ r : AllocVec K n
if
then
r x :
IsGridBarycenter c pi w delta :
Prop
delta r x = if _h : 0 < pi r then ∑ g, (gammaMC M c g : ℝ) * w r x g / (pi r : ℝ) else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsGridBarycenter · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:99
theorem nearest_grid_error

the grid resolution is positive, the stated side condition holds, the nearest grid error property holds.

Formal statement
K :
shared
c :
M :
hM :
0 < M
v :
hv :
v ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ)
∃ j : Fin (2 * M + 1), |v - (gammaMC M c j : ℝ)| ≤ (hRat c : ℝ) / (2 * M)
Proof (Lean source)
lemma nearest_grid_error (c : RatContrast K) (M : ℕ) (hM : 0 < M) (v : ℝ) (hv : v ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ)) : ∃ j : Fin (2 * M + 1), |v - (gammaMC M c j : ℝ)| ≤ (hRat c : ℝ) / (2 * M) := by have hLc : 0 < LcRat c := by have hnonneg : 0 ≤ LcRat c := sum_nonneg fun _ _ => abs_nonneg _ have hne : LcRat c ≠ 0 := by intro hsum apply c.nonzero funext a apply abs_eq_zero.mp exact congrFun ((Fintype.sum_eq_zero_iff_of_nonneg (fun a => abs_nonneg (c a))).mp hsum) a exact lt_of_le_of_ne hnonneg (Ne.symm hne) have hhQ : 0 < hRat c := by simp only [hRat] positivity have hh : 0 < (hRat c : ℝ) := by exact_mod_cast hhQ let x : ℝ := (v + (hRat c : ℝ)) * M / (hRat c : ℝ) have hx0 : 0 ≤ x := by dsimp [x] exact div_nonneg (mul_nonneg (by linarith [hv.1]) (Nat.cast_nonneg M)) (le_of_lt hh) have hx2 : x ≤ (2 * M : ℕ) := by dsimp [x] rw [div_le_iff₀ hh] have := hv.2 push_cast nlinarith let z : ℤ := round x have hz0 : 0 ≤ z := by have hr := abs_sub_round x by_contra h have hz : z ≤ -1 := by omega have hcast : (z : ℝ) ≤ -1 := by exact_mod_cast hz dsimp [z] at hcast ⊢ rw [abs_of_nonneg] at hr · linarith · linarith have hz2 : z ≤ (2 * M : ℕ) := by have hr := abs_sub_round x by_contra h have hz : (2 * M : ℤ) + 1 ≤ z := by omega have hcast : ((2 * M : ℤ) : ℝ) + 1 ≤ (z : ℝ) := by exact_mod_cast hz dsimp [z] at hcast ⊢ norm_num [Nat.cast_mul] at hx2 hcast have hsign : x - (round x : ℝ) ≤ 0 := by linarith [hx2, hcast] rw [abs_of_nonpos hsign] at hr linarith [hx2, hcast] let j : Fin (2 * M + 1) := ⟨z.toNat, by have hnat := Int.toNat_le_toNat hz2 have : z.toNat ≤ 2 * M := by simpa [Int.toNat_of_nonneg hz0] using hnat omega⟩ refine ⟨j, ?_⟩ have hjz : ((j : ℕ) : ℤ) = z := by dsimp [j] simp [Int.toNat_of_nonneg hz0] have hjzR : ((j : ℕ) : ℝ) = (z : ℝ) := by exact_mod_cast hjz have hr := abs_sub_round x change |v - (-((hRat c : ℚ)) + (j : ℚ) * hRat c / M : ℚ)| ≤ _ push_cast rw [hjzR] have hMR : (0 : ℝ) < M := by positivity have hid : v - (-((hRat c : ℝ)) + (z : ℝ) * (hRat c : ℝ) / M) = ((hRat c : ℝ) / M) * (x - (z : ℝ)) := by dsimp [x] field_simp ring rw [hid, abs_mul, abs_of_pos (div_pos hh hMR)] calc (hRat c : ℝ) / M * |x - (z : ℝ)| ≤ (hRat c : ℝ) / M * (1 / 2) := by gcongr _ = (hRat c : ℝ) / (2 * M) := by field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.nearest_grid_error · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:105

A grid row index pairs an allocation-count vector with a compatible observed-success vector.

Definition (Lean source)
K n M :
GridRowIndex K n M :
Type
Bool ⊕ (Σ r : AllocVec K n, ObsVec r × Bool) ⊕ AllocVec K n ⊕ (Σ r : AllocVec K n, ObsVec r × Fin (2 * M + 1)) ⊕ CountVec K n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridRowIndex · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:180
def gridRowEquiv

The grid row equiv property holds.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
gridRowEquiv :
GR K n M ≃ GridRowIndex K n M
where
| .norm b => .inl b
| .occ r z b => .inr (.inl ⟨r, (z, b)⟩)
| .piNonneg r => .inr (.inr (.inl r))
| .wNonneg r z g => .inr (.inr (.inr (.inl ⟨r, (z, g)⟩)))
| .risk m => .inr (.inr (.inr (.inr m)))
invFun
| .inl b => .norm b
| .inr (.inl ⟨r, (z, b)⟩) => .occ r z b
| .inr (.inr (.inl r)) => .piNonneg r
| .inr (.inr (.inr (.inl ⟨r, (z, g)⟩))) => .wNonneg r z g
| .inr (.inr (.inr (.inr m))) => .risk m
left_inv i := by cases i <;> rfl
right_inv i := by
rcases i with b | i
· rfl
rcases i with i | i
· rcases i with ⟨r, z, b⟩
rcases i with r | i
· rfl
rcases i with i | m
· rcases i with ⟨r, z, g⟩
· rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridRowEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:187
theorem sum_grid_rows

the sums grid rows.

Formal statement
K :
shared
n :
shared
M :
shared
f :
GR K n M → ℚ
∑ i, f i
= ∑ b, f (.norm b)
+ ∑ r, ∑ z, ∑ b, f (.occ r z b)
+ ∑ r, f (.piNonneg r)
+ ∑ r, ∑ z, ∑ g, f (.wNonneg r z g)
+ ∑ m, f (.risk m)
Proof (Lean source)
lemma sum_grid_rows (f : GR K n M → ℚ) : ∑ i, f i = ∑ b, f (.norm b) + ∑ r, ∑ z, ∑ b, f (.occ r z b) + ∑ r, f (.piNonneg r) + ∑ r, ∑ z, ∑ g, f (.wNonneg r z g) + ∑ m, f (.risk m) := by rw [show (∑ i, f i) = ∑ j : GridRowIndex K n M, f ((gridRowEquiv).symm j) by exact Fintype.sum_equiv gridRowEquiv _ _ (fun i => congrArg f (gridRowEquiv.symm_apply_apply i).symm)] simp only [GridRowIndex, Fintype.sum_sum_type, Fintype.sum_sigma] simp [gridRowEquiv] simp_rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_bool] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.sum_grid_rows · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:216
theorem exists_exact_grid_primal_dual_certificate

the population size is positive, the grid resolution is positive, The generic rational optimizer decodes to the paper's exact primal/dual certificate, and its rational objective is the real grid-program value.

Formal statement
K :
shared
n :
shared
M :
shared
c :
hn :
0 < n
hM :
0 < M
∃ (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ),
conclusion 1
conclusion 2
(u : ℝ) = gridLPValue K n M c hn hM
Proof (Lean source)
lemma exists_exact_grid_primal_dual_certificate (c : RatContrast K) (hn : 0 < n) (hM : 0 < M) : ∃ (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ), ExactGridPrimalDualCertificate c pi w u nu ∧ (u : ℝ) = gridLPValue K n M c hn hM := by classical obtain ⟨x, y, hx, hy, hxy, hvalue⟩ := gridProgram_optimal_primal_dual_exists (c := c) hn hM let pi : GridPi K n := decodePi x let wQ : RationalGridWeight K n M := decodeW x let w : GridWeight K n M := rationalGridWeightToReal M wQ let u : ℚ := decodeU x let yd : GridDualMultipliers K n M := decodeGridDualMultipliers y let nu : CountVec K n → ℚ := fun m => y (.risk m) have hprimal : GridLPFeasible K n M c pi wQ u := by exact (gridProgram_feasible_iff c x).mp hx have hdual : GridDualFeasible c yd := by refine ⟨hy.1 (.norm false), hy.1 (.norm true), ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ · intro r z exact ⟨hy.1 (.occ r z false), hy.1 (.occ r z true)⟩ · exact fun r => hy.1 (.piNonneg r) · exact fun r z g => hy.1 (.wNonneg r z g) · exact dualRiskRow_nonneg hy · exact dualRiskRow_sum_eq_one hy · intro r have hs := hy.2 (gvEquiv K n M (.inr (.inl r))) simp only [gridProgram, gvEquiv, Equiv.symm_apply_apply] at hs rw [show (∑ i : GR K n M, y i * rowCoeff c i (.inr (.inl r))) = y (.norm false) - y (.norm true) - ∑ z, (y (.occ r z false) - y (.occ r z true)) - y (.piNonneg r) by rw [sum_grid_rows] simp [rowCoeff] rw [Finset.sum_add_distrib, Finset.sum_neg_distrib] ring] at hs simpa [yd, decodeGridDualMultipliers, objCoeff] using hs · intro r z g have hs := hy.2 (gvEquiv K n M (.inr (.inr ⟨r, (z, g)⟩))) simp only [gridProgram, gvEquiv, Equiv.symm_apply_apply] at hs rw [show (∑ i : GR K n M, y i * rowCoeff c i (.inr (.inr ⟨r, (z, g)⟩))) = y (.occ r z false) - y (.occ r z true) - y (.wNonneg r z g) + ∑ m, y (.risk m) * orbitLik m r z * (gammaMC M c g - tauCountRat c m) ^ 2 by rw [sum_grid_rows] simp [rowCoeff, Finset.sum_ite_irrel] rw [show (∑ x : ObsVec r, ∑ g' : Fin (2 * M + 1), if z = x ∧ g = g' then -y (.wNonneg r x g') else 0) = -y (.wNonneg r z g) by calc _ = ∑ g' : Fin (2 * M + 1), if z = z ∧ g = g' then -y (.wNonneg r z g') else 0 := by apply Finset.sum_eq_single z · intro z' _ hz' have hzz' : z ≠ z' := Ne.symm hz' simp only [hzz', false_and, if_false, Finset.sum_const_zero] · intro hz exact (hz (Finset.mem_univ z)).elim _ = -y (.wNonneg r z g) := by simp only [eq_self, true_and] simpa only [eq_comm] using (Fintype.sum_ite_eq' g (fun g' => -y (.wNonneg r z g')))] rw [show (∑ m, y (.risk m) * (orbitLik m r z * (gammaMC M c g - tauCountRat c m) ^ 2)) = ∑ m, y (.risk m) * orbitLik m r z * (gammaMC M c g - tauCountRat c m) ^ 2 by apply Finset.sum_congr rfl intro m _ ring] ring] at hs simpa [yd, decodeGridDualMultipliers, objCoeff] using hs have huobj : (gridProgram c).objective x = u := gridProgram_objective c x have hdualobj : (gridProgram c).dualObjective y = gridDualObjective yd := by rw [gridProgram_dualObjective_eq_normalization] rfl refine ⟨pi, w, u, nu, ?_, ?_⟩ · refine ⟨wQ, yd, rfl, hprimal, hdual, rfl, ?_⟩ rw [← hdualobj, ← hxy, huobj] · rw [← huobj] exact hvalue
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exists_exact_grid_primal_dual_certificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/GridApprox.lean:234
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk000 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_000

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 000.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = false
h01 :
z 0 1 = false
h02 :
z 0 2 = false
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_000 (z : Schedule 3 3) (h00 : z 0 0 = false) (h01 : z 0 1 = false) (h02 : z 0 2 = false) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_000 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk000.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk001 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_001

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 001.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = false
h01 :
z 0 1 = false
h02 :
z 0 2 = true
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_001 (z : Schedule 3 3) (h00 : z 0 0 = false) (h01 : z 0 1 = false) (h02 : z 0 2 = true) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_001 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk001.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk010 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_010

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 010.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = false
h01 :
z 0 1 = true
h02 :
z 0 2 = false
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_010 (z : Schedule 3 3) (h00 : z 0 0 = false) (h01 : z 0 1 = true) (h02 : z 0 2 = false) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_010 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk010.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk011 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_011

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 011.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = false
h01 :
z 0 1 = true
h02 :
z 0 2 = true
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_011 (z : Schedule 3 3) (h00 : z 0 0 = false) (h01 : z 0 1 = true) (h02 : z 0 2 = true) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_011 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk011.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk100 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_100

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 100.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = true
h01 :
z 0 1 = false
h02 :
z 0 2 = false
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_100 (z : Schedule 3 3) (h00 : z 0 0 = true) (h01 : z 0 1 = false) (h02 : z 0 2 = false) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_100 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk100.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk101 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_101

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 101.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = true
h01 :
z 0 1 = false
h02 :
z 0 2 = true
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_101 (z : Schedule 3 3) (h00 : z 0 0 = true) (h01 : z 0 1 = false) (h02 : z 0 2 = true) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_101 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk101.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk110 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_110

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 110.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = true
h01 :
z 0 1 = true
h02 :
z 0 2 = false
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_110 (z : Schedule 3 3) (h00 : z 0 0 = true) (h01 : z 0 1 = true) (h02 : z 0 2 = false) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_110 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk110.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataRisk111 1 declarations One response-type slice of the exact full-data risk certificate.

One response-type slice of the exact full-data risk certificate.

theorem k3FullDataRule_risk_le_111

the stated side condition holds, the stated side condition holds, the stated side condition holds, the three-arm full data rule risk is at most 111.

Formal statement
z :
Schedule 3 3
h00 :
z 0 0 = true
h01 :
z 0 1 = true
h02 :
z 0 2 = true
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le_111 (z : Schedule 3 3) (h00 : z 0 0 = true) (h01 : z 0 1 = true) (h02 : z 0 2 = true) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] z - k3FullDataTargetQ z) ^ 2)] · simp only [Fintype.sum_prod_type] cases h10 : z 1 0 <;> cases h11 : z 1 1 <;> cases h12 : z 1 2 <;> cases h20 : z 2 0 <;> cases h21 : z 2 1 <;> cases h22 : z 2 2 <;> simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, Fin.sum_univ_succ, Fin.prod_univ_succ, h00, h01, h02, h10, h11, h12, h20, h21, h22] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le_111 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataRisk111.lean:9
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataWitness 3 declarations Assembly of the exact finite full-data three-arm witness.

Assembly of the exact finite full-data three-arm witness.

theorem k3FullDataRule_risk_le

the three-arm full data rule risk is at most property holds.

Formal statement
z :
Schedule 3 3
≤ (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_risk_le (z : Schedule 3 3) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z ≤ (fullDataRuleRiskBound : ℝ) := by cases h00 : z 0 0 <;> cases h01 : z 0 1 <;> cases h02 : z 0 2 all_goals first | exact k3FullDataRule_risk_le_000 z h00 h01 h02 | exact k3FullDataRule_risk_le_001 z h00 h01 h02 | exact k3FullDataRule_risk_le_010 z h00 h01 h02 | exact k3FullDataRule_risk_le_011 z h00 h01 h02 | exact k3FullDataRule_risk_le_100 z h00 h01 h02 | exact k3FullDataRule_risk_le_101 z h00 h01 h02 | exact k3FullDataRule_risk_le_110 z h00 h01 h02 | exact k3FullDataRule_risk_le_111 z h00 h01 h02
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_risk_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitness.lean:15
theorem k3FullDataRule_boundary_risk

the three-arm full data rule boundary risk property holds.

Formal statement
= (fullDataRuleRiskBound : ℝ)
Proof (Lean source)
lemma k3FullDataRule_boundary_risk : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) k3BoundarySchedule = (fullDataRuleRiskBound : ℝ) := by rw [k3FullDataRiskQ_cast] norm_cast unfold k3FullDataRiskQ rw [Fintype.sum_equiv (k3FullDataFin3FunEquiv (Fin 3)) _ (fun p ↦ k3FullDataAssignmentProbQ ![p.1, p.2.1, p.2.2] * (k3FullDataEstimateQ ![p.1, p.2.1, p.2.2] k3BoundarySchedule - k3FullDataTargetQ k3BoundarySchedule) ^ 2)] · simp only [Fintype.sum_prod_type] simp [k3FullDataAssignmentProbQ, k3FullDataEstimateQ, k3FullDataTargetQ, k3FullDataTable, k3FullDataR1, k3FullDataS1, k3FullDataSMinus, obsOutcome, potentialOutcome, fullDataRuleRiskBound, k3BoundarySchedule, Fin.sum_univ_succ, Fin.prod_univ_succ] <;> norm_num [cDaggerQ_zero, cDaggerQ_one, cDaggerQ_two] · intro A rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_boundary_risk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitness.lean:33
theorem k3FullDataRule_worstCaseRisk

the three-arm full data rule worst case risk property holds.

Formal statement
worstCaseRisk (fun (p : Procedure 3 3 cDagger) (z : Schedule 3 3) ↦ labeledRisk cDagger p z) (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule)
Proof (Lean source)
lemma k3FullDataRule_worstCaseRisk : worstCaseRisk (fun (p : Procedure 3 3 cDagger) (z : Schedule 3 3) ↦ labeledRisk cDagger p z) (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) = fullDataRuleRiskBound := by apply le_antisymm · apply worstCaseRisk_le exact k3FullDataRule_risk_le · rw [← k3FullDataRule_boundary_risk] exact le_worstCaseRisk (Set.finite_range _).bddAbove _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_worstCaseRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitness.lean:56
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3FullDataWitnessBase 23 declarations Definitions for the exact finite full-data three-arm witness.

Definitions for the exact finite full-data three-arm witness.

A three-bit response type is identified with its ordered triple of binary potential outcomes.

Definition (Lean source)
α :
Type*
k3FullDataFin3FunEquiv α :
(Fin 3 → α) ≃ α × α × α
clause 1
toFun f := (f 0, f 1, f 2)
clause 2
invFun p := ![p.1, p.2.1, p.2.2]
clause 3
left_inv f := by funext i; fin_cases i <;> rfl
clause 4
right_inv p := by rcases p with ⟨a, b, c⟩; rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataFin3FunEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:11
def k3FullDataR1

The three-arm full data r1 property holds.

Definition (Lean source)
A :
Assign 3 3
k3FullDataR1 A :
(if A 0 = 0 then 1 else 0) + (if A 1 = 0 then 1 else 0) + (if A 2 = 0 then 1 else 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataR1 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:19
def k3FullDataS1

The three-arm full data s1 property holds.

Definition (Lean source)
A :
Assign 3 3
k3FullDataS1 A y :
(if A 0 = 0 then if y 0 then 1 else -1 else 0)
+ (if A 1 = 0 then if y 1 then 1 else -1 else 0)
+ (if A 2 = 0 then if y 2 then 1 else -1 else 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataS1 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:25
def k3FullDataSMinus

The three-arm full data sminus property holds.

Definition (Lean source)
A :
Assign 3 3
k3FullDataSMinus A y :
(if A 0 = 0 then 0 else if y 0 then -1 else 1)
+ (if A 1 = 0 then 0 else if y 1 then -1 else 1)
+ (if A 2 = 0 then 0 else if y 2 then -1 else 1)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataSMinus · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:32

The exact three-arm full-data table assigns the certified rational estimate to every binary response triple.

Definition (Lean source)
r :
s h :
k3FullDataTable r s h :
{v : ℤ // -1000 ≤ v ∧ v ≤ 1000}
if r = 0 ∧
s = 0 ∧
h = -3 then ⟨-623, by norm_num⟩ else if r = 0 ∧
s = 0 ∧
h = -1 then ⟨-183, by norm_num⟩ else if r = 0 ∧
s = 0 ∧
h = 1 then ⟨183, by norm_num⟩ else if r = 0 ∧
s = 0 ∧
h = 3 then ⟨623, by norm_num⟩ else if r = 1 ∧
s = -1 ∧
h = -2 then ⟨-638, by norm_num⟩ else if r = 1 ∧
s = -1 ∧
h = 0 then ⟨-199, by norm_num⟩ else if r = 1 ∧
s = -1 ∧
h = 2 then ⟨148, by norm_num⟩ else if r = 1 ∧
s = 1 ∧
h = -2 then ⟨-148, by norm_num⟩ else if r = 1 ∧
s = 1 ∧
h = 0 then ⟨199, by norm_num⟩ else if r = 1 ∧
s = 1 ∧
h = 2 then ⟨638, by norm_num⟩ else if r = 2 ∧
s = -2 ∧
h = -1 then ⟨-648, by norm_num⟩ else if r = 2 ∧
s = -2 ∧
h = 1 then ⟨-210, by norm_num⟩ else if r = 2 ∧
s = 0 ∧
h = -1 then ⟨-167, by norm_num⟩ else if r = 2 ∧
s = 0 ∧
h = 1 then ⟨167, by norm_num⟩ else if r = 2 ∧
s = 2 ∧
h = -1 then ⟨210, by norm_num⟩ else if r = 2 ∧
s = 2 ∧
h = 1 then ⟨648, by norm_num⟩ else if r = 3 ∧
s = -3 ∧
h = 0 then ⟨-660, by norm_num⟩ else if r = 3 ∧
s = -1 ∧
h = 0 then ⟨-167, by norm_num⟩ else if r = 3 ∧
s = 1 ∧
h = 0 then ⟨167, by norm_num⟩ else if r = 3 ∧
s = 3 ∧
h = 0 then ⟨660, by norm_num⟩ else ⟨0, by norm_num⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataTable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:39
theorem cDaggerQ_zero

the c dagger q zero property holds.

Formal statement
cDaggerQ (0 : Arm 3) = 1
Proof (Lean source)
lemma cDaggerQ_zero : cDaggerQ (0 : Arm 3) = 1 := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.cDaggerQ_zero · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:63
theorem cDaggerQ_one

the c dagger q one property holds.

Formal statement
cDaggerQ (1 : Arm 3) = -(1 / 2)
Proof (Lean source)
lemma cDaggerQ_one : cDaggerQ (1 : Arm 3) = -(1 / 2) := by have h : (1 : Fin 3) = Fin.succ (0 : Fin 2) := Fin.ext (by rfl) simp only [cDaggerQ, h, Fin.cases_succ, Fin.cases_zero] ring_nf
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.cDaggerQ_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:67
theorem cDaggerQ_two

the c dagger q two property holds.

Formal statement
cDaggerQ (2 : Arm 3) = -(1 / 2)
Proof (Lean source)
lemma cDaggerQ_two : cDaggerQ (2 : Arm 3) = -(1 / 2) := by have h : (2 : Fin 3) = Fin.succ (1 : Fin 2) := Fin.ext (by rfl) have h' : (1 : Fin 2) = Fin.succ (0 : Fin 1) := Fin.ext (by rfl) simp only [cDaggerQ, h, h', Fin.cases_succ] ring_nf
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.cDaggerQ_two · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:74
theorem cDagger_apply

the c dagger evaluation property holds.

Formal statement
a :
Arm 3
cDagger a = if a = 0 then 1 else -(1 / 2)
Proof (Lean source)
@[simp] lemma cDagger_apply (a : Arm 3) : cDagger a = if a = 0 then 1 else -(1 / 2) := by change ((cDaggerQ a : ℚ) : ℝ) = _ fin_cases a · simpa using congrArg (fun q : ℚ ↦ (q : ℝ)) cDaggerQ_zero · simpa using congrArg (fun q : ℚ ↦ (q : ℝ)) cDaggerQ_one · simpa using congrArg (fun q : ℚ ↦ (q : ℝ)) cDaggerQ_two
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.cDagger_apply · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:82
theorem qStarDesign_cDagger_p

the q star design c dagger p property holds.

Formal statement
a :
Arm 3
(qStarDesign cDagger).p a = if a = 0 then 1 / 2 else 1 / 4
Proof (Lean source)
@[simp] lemma qStarDesign_cDagger_p (a : Arm 3) : (qStarDesign cDagger).p a = if a = 0 then 1 / 2 else 1 / 4 := by have hLc : Lc cDagger = 2 := by norm_num [Lc, cDagger, cDaggerQ, ratContrastToReal, Fin.sum_univ_succ] change |cDagger a| / Lc cDagger = _ rw [hLc, cDagger_apply] by_cases h : a = 0 <;> simp [h] <;> ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.qStarDesign_cDagger_p · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:92
theorem k3FullDataTable_scaled_mem

the three-arm full data table scaled belongs to property holds.

Formal statement
r :
s h :
(((k3FullDataTable r s h).1 : ℝ) / 1000) ∈ Icc (-1) 1
Proof (Lean source)
lemma k3FullDataTable_scaled_mem (r : ℕ) (s h : ℤ) : (((k3FullDataTable r s h).1 : ℝ) / 1000) ∈ Icc (-1) 1 := by have hb := (k3FullDataTable r s h).2 have hlow : (-1000 : ℝ) ≤ ((k3FullDataTable r s h).1 : ℝ) := by exact_mod_cast hb.1 have hupp : ((k3FullDataTable r s h).1 : ℝ) ≤ 1000 := by exact_mod_cast hb.2 constructor · norm_num linarith · norm_num linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataTable_scaled_mem · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:102
theorem clip_cDagger_eq_self

the observed count satisfies its stated condition, the clip c dagger equals self.

Formal statement
x :
hx :
x ∈ Icc (-1) 1
Proof (Lean source)
lemma clip_cDagger_eq_self (x : ℝ) (hx : x ∈ Icc (-1) 1) : clip cDagger x = x := by have hLc : Lc cDagger = 2 := by norm_num [Lc, cDagger, cDaggerQ, ratContrastToReal, Fin.sum_univ_succ] unfold clip rw [hLc] norm_num rw [min_eq_right hx.2, max_eq_right hx.1]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clip_cDagger_eq_self · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:117
def k3FullDataRule

The three-arm full-data rule clips the certified table value to the natural contrast interval.

Definition (Lean source)
k3FullDataRule :
fun A y ↦ ⟨clip cDagger (((k3FullDataTable (k3FullDataR1 A) (k3FullDataS1 A y) (k3FullDataSMinus A y)).1 : ℝ) / 1000), clip_mem cDagger _⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:128
theorem k3FullDataRule_coe

the three-arm full data rule real-valued representation property holds.

Formal statement
A :
Assign 3 3
(k3FullDataRule A y : ℝ)
= ((k3FullDataTable (k3FullDataR1 A) (k3FullDataS1 A y) (k3FullDataSMinus A y)).1 : ℝ) / 1000
Proof (Lean source)
@[simp] lemma k3FullDataRule_coe (A : Assign 3 3) (y : ObservedOutcome 3) : (k3FullDataRule A y : ℝ) = ((k3FullDataTable (k3FullDataR1 A) (k3FullDataS1 A y) (k3FullDataSMinus A y)).1 : ℝ) / 1000 := by simp only [k3FullDataRule] exact clip_cDagger_eq_self _ (k3FullDataTable_scaled_mem _ _ _)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRule_coe · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:136
def k3BoundarySchedule

The boundary schedule repeats a fixed three-arm response type across the whole population.

Definition (Lean source)
k3BoundarySchedule :
Schedule 3 3
fun i _ ↦ i ≠ 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3BoundarySchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:145
def k3FullDataTargetQ

The three-arm full data target q property holds.

Definition (Lean source)
z :
Schedule 3 3
k3FullDataTargetQ z :
((3 : ℚ)⁻¹) * ∑ i : Fin 3, ∑ a : Fin 3, cDaggerQ a * if z i a then 1 else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataTargetQ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:149
def k3FullDataAssignmentProbQ

The three-arm full data assignment prob q property holds.

Definition (Lean source)
A :
Assign 3 3
k3FullDataAssignmentProbQ A :
∏ i : Fin 3, if A i = 0 then 1 / 2 else 1 / 4
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataAssignmentProbQ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:155
def k3FullDataEstimateQ

The three-arm full data estimate q property holds.

Definition (Lean source)
A :
Assign 3 3
z :
Schedule 3 3
k3FullDataEstimateQ A z :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataEstimateQ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:160
def k3FullDataRiskQ

The three-arm full data risk q property holds.

Definition (Lean source)
z :
Schedule 3 3
k3FullDataRiskQ z :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRiskQ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:166
theorem k3FullDataTargetQ_cast

the three-arm full data target q real-valued identity property holds.

Formal statement
z :
Schedule 3 3
tauC cDagger z = (k3FullDataTargetQ z : ℝ)
Proof (Lean source)
lemma k3FullDataTargetQ_cast (z : Schedule 3 3) : tauC cDagger z = (k3FullDataTargetQ z : ℝ) := by unfold tauC k3FullDataTargetQ cDagger ratContrastToReal push_cast congr 1 apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro a ha by_cases h : z i a = true <;> simp [h]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataTargetQ_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:173
theorem k3FullDataAssignmentProbQ_cast

the three-arm full data assignment prob q real-valued identity property holds.

Formal statement
A :
Assign 3 3
(prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger)).p A
= (k3FullDataAssignmentProbQ A : ℝ)
Proof (Lean source)
lemma k3FullDataAssignmentProbQ_cast (A : Assign 3 3) : (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger)).p A = (k3FullDataAssignmentProbQ A : ℝ) := by rw [prodDesign_p] unfold k3FullDataAssignmentProbQ push_cast simp only [qStarDesign_cDagger_p] apply Finset.prod_congr rfl intro i hi by_cases h : A i = 0 <;> simp [h]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataAssignmentProbQ_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:186
theorem k3FullDataEstimateQ_cast

the three-arm full data estimate q real-valued identity property holds.

Formal statement
A :
Assign 3 3
z :
Schedule 3 3
(k3FullDataRule A (obsOutcome z A) : ℝ) = (k3FullDataEstimateQ A z : ℝ)
Proof (Lean source)
lemma k3FullDataEstimateQ_cast (A : Assign 3 3) (z : Schedule 3 3) : (k3FullDataRule A (obsOutcome z A) : ℝ) = (k3FullDataEstimateQ A z : ℝ) := by simp [k3FullDataEstimateQ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataEstimateQ_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:200
theorem k3FullDataRiskQ_cast

the three-arm full data risk q real-valued identity property holds.

Formal statement
z :
Schedule 3 3
= (k3FullDataRiskQ z : ℝ)
Proof (Lean source)
lemma k3FullDataRiskQ_cast (z : Schedule 3 3) : labeledRisk cDagger (prodDesign (fun _ : Unit 3 ↦ qStarDesign cDagger), k3FullDataRule) z = (k3FullDataRiskQ z : ℝ) := by unfold labeledRisk mse E k3FullDataRiskQ push_cast apply Finset.sum_congr rfl intro A hA rw [k3FullDataAssignmentProbQ_cast, k3FullDataEstimateQ_cast, k3FullDataTargetQ_cast]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3FullDataRiskQ_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3FullDataWitnessBase.lean:207
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.K3Numerics 3 declarations Exact finite rational witnesses for the three-arm scalar-compression diagnostic.

Exact finite rational witnesses for the three-arm scalar-compression diagnostic.

The full-data rule risk bound is the exact rational certificate used for the three-arm full-information procedure.

Definition (Lean source)
fullDataRuleRiskBound :
511653 / 4000000
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fullDataRuleRiskBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3Numerics.lean:8

The scalar Bayes certificate is the exact rational lower bound used for the compressed-score experiment.

Definition (Lean source)
scalarBayesCertificate :
18213 / 136000
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarBayesCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3Numerics.lean:10
theorem k3_rational_separation

the three-arm rational separation property holds.

Formal statement
conclusion 1
(fullDataRuleRiskBound : ℝ) < (scalarBayesCertificate : ℝ)
conclusion 2
(13 / 100 : ℝ) < 1 - sqrt 3 / 2
Proof (Lean source)
lemma k3_rational_separation : (fullDataRuleRiskBound : ℝ) < (scalarBayesCertificate : ℝ) ∧ (13 / 100 : ℝ) < 1 - sqrt 3 / 2 := by constructor · norm_num [fullDataRuleRiskBound, scalarBayesCertificate] · have hsqrt : sqrt 3 < 87 / 50 := by rw [Real.sqrt_lt' (by norm_num : (0 : ℝ) < 87 / 50)] norm_num linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3_rational_separation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/K3Numerics.lean:13
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.OrbitCounting 7 declarations Orbit cardinalities and contingency-table counting identities.

Orbit cardinalities and contingency-table counting identities.

Bounded coordinates summing to n are equivalent to natural coordinates summing to n.

Definition (Lean source)
α :
Type*
n :
finCountEquivNatCount α n :
{f : α → Fin (n + 1) // ∑ a, (f a : ℕ) = n} ≃ {f : α → ℕ // ∑ a, f a = n}
clause 1
toFun f := ⟨fun a => f.1 a, f.2⟩
clause 2
invFun f := ⟨fun a
=> ⟨f.1 a, by rw [Nat.lt_succ_iff] exact Finset.single_le_sum (fun _ _ => zero_le _) (Finset.mem_univ a) |>.trans_eq f.2⟩, f.2⟩
clause 3
left_inv f := by ext a; rfl
clause 4
right_inv f := by apply Subtype.ext; funext a; rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finCountEquivNatCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:14

Natural count vectors of total n are the full finite antidiagonal.

Definition (Lean source)
α :
n :
natCountEquivAntidiag α n :
{f : α → ℕ // ∑ a, f a = n} ≃ ↥(piAntidiag (Finset.univ : Finset α) n)
clause 1
toFun f := ⟨f.1, by simp [Finset.mem_piAntidiag, f.2]⟩
clause 2
invFun f := ⟨f.1, (Finset.mem_piAntidiag.mp f.2).1⟩
clause 3
left_inv f := by apply Subtype.ext; funext a; rfl
clause 4
right_inv f := by ext a; rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.natCountEquivAntidiag · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:27
theorem boundedCountVectorCardinality Lemma boundedCountVectorCardinality in the paper ↗

the stated side condition holds, Stars and bars for bounded coordinates whose fixed total makes the bounds automatic.

Formal statement
α :
:
0 < card α
n :
card {f : α → Fin (n + 1) // ∑ a, (f a : ℕ) = n}
= choose (n + card α - 1) (card α - 1)
Proof (Lean source)
lemma boundedCountVectorCardinality (α : Type*) [Fintype α] [DecidableEq α] (hα : 0 < card α) (n : ℕ) : card {f : α → Fin (n + 1) // ∑ a, (f a : ℕ) = n} = choose (n + card α - 1) (card α - 1) := by rw [Fintype.card_congr ((finCountEquivNatCount α n).trans (natCountEquivAntidiag α n))] rw [Fintype.card_coe] let e : Sym α n ↪ (α → ℕ) := ⟨fun m a => m.1.count a, Multiset.count_injective.comp Sym.coe_injective⟩ have hmap : ((Finset.univ : Finset α).sym n).map e = piAntidiag (Finset.univ : Finset α) n := Finset.map_sym_eq_piAntidiag Finset.univ n calc #(piAntidiag (Finset.univ : Finset α) n) = #(((Finset.univ : Finset α).sym n).map e) := congrArg card hmap.symm _ = #((Finset.univ : Finset α).sym n) := Finset.card_map e _ = #(Finset.univ : Finset (Sym α n)) := by simp _ = card (Sym α n) := Finset.card_univ _ = choose (card α + n - 1) n := Sym.card_sym_eq_choose n _ = choose (n + card α - 1) (card α - 1) := by have hleft : card α + n - 1 = n + (card α - 1) := by omega have hright : n + card α - 1 = n + (card α - 1) := by omega rw [hleft, hright] exact Nat.choose_symm_add
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.boundedCountVectorCardinality · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:37
def allocationObservationEquivNatCount

Allocation counts together with compatible success counts are equivalent to counts of arm/outcome pairs.

Definition (Lean source)
K :
shared
n :
shared
allocationObservationEquivNatCount :
(Σ r : AllocVec K n, ObsVec r) ≃ {f : Arm K × Bool → ℕ // ∑ q, f q = n}
clause 1
toFun q := ⟨fun ab
=> if ab.2 then q.2.1 ab.1 else q.1.1 ab.1
- q.2.1 ab.1, by rw [Fintype.sum_prod_type] calc ∑ a, ((q.2.1 a : ℕ) + ((q.1.1 a : ℕ) - (q.2.1 a : ℕ)))
= ∑ a, (q.1.1 a : ℕ) := by apply Finset.sum_congr rfl intro a _ exact Nat.add_sub_of_le (q.2.2 a) _ = n := q.1.2⟩
clause 2
invFun f := by let r : AllocVec K n := ⟨fun a
=> ⟨f.1 (a, true)
+ f.1 (a, false), by rw [Nat.lt_succ_iff] calc f.1 (a, true)
+ f.1 (a, false)
= ∑ b : Bool, f.1 (a, b) := by simp _ ≤ ∑ a, ∑ b : Bool, f.1 (a, b) := by have hnonneg : ∀ a : Arm K, 0 ≤ ∑ b : Bool, f.1 (a, b) := fun a => sum_nonneg fun _ _ => zero_le _ exact Finset.single_le_sum (fun a _ => hnonneg a) (Finset.mem_univ a) _ = ∑ q, f.1 q := by rw [Fintype.sum_prod_type] _ = n := f.2⟩, by change (∑ a, (f.1 (a, true) + f.1 (a, false))) = n calc _ = ∑ a, ∑ b : Bool, f.1 (a, b) := by apply Finset.sum_congr rfl intro a _ simp _ = ∑ q, f.1 q := by rw [Fintype.sum_prod_type] _ = n := f.2⟩ exact ⟨r, ⟨fun a => ⟨f.1 (a, true), by rw [Nat.lt_succ_iff] exact (le_add_right _ _).trans (Fin.is_le (r.1 a))⟩, fun a => le_add_right _ _⟩⟩
clause 3
left_inv q := by apply Sigma.ext · apply Subtype.ext funext a apply Fin.ext simp only exact Nat.add_sub_of_le (q.2.2 a) · apply (Subtype.heq_iff_coe_eq (fun x => by constructor <;> intro hx a · simpa [Nat.add_sub_of_le (q.2.2 a)] using hx a · simpa [Nat.add_sub_of_le (q.2.2 a)] using hx a)).2 rfl
clause 4
right_inv f := by apply Subtype.ext funext ab cases ab with | mk a b => cases b <;> simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationObservationEquivNatCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:63
theorem allocation_observation_cardinality

there are at least two treatment arms, The allocation/observation orbit pairs have the stars-and-bars cardinality for 2K arm/outcome cells.

Formal statement
K :
shared
n :
shared
(∑ r : AllocVec K n, card (ObsVec r)) = choose (n + 2 * K - 1) (2 * K - 1)
Proof (Lean source)
-- @node: allocation_observation_cardinality lemma allocation_observation_cardinality (hK : AdmissibleArmCount K) : (∑ r : AllocVec K n, card (ObsVec r)) = choose (n + 2 * K - 1) (2 * K - 1) := by letI : Fintype {f : Arm K × Bool → ℕ // ∑ q, f q = n} := Fintype.ofEquiv ↥(piAntidiag (Finset.univ : Finset (Arm K × Bool)) n) (natCountEquivAntidiag (Arm K × Bool) n).symm rw [← Fintype.card_sigma] rw [Fintype.card_congr (allocationObservationEquivNatCount (K := K) (n := n))] rw [Fintype.card_congr (natCountEquivAntidiag (Arm K × Bool) n)] rw [Fintype.card_coe] let e : Sym (Arm K × Bool) n ↪ ((Arm K × Bool) → ℕ) := ⟨fun m a => m.1.count a, Multiset.count_injective.comp Sym.coe_injective⟩ have hmap : ((Finset.univ : Finset (Arm K × Bool)).sym n).map e = piAntidiag (Finset.univ : Finset (Arm K × Bool)) n := Finset.map_sym_eq_piAntidiag Finset.univ n calc #(piAntidiag (Finset.univ : Finset (Arm K × Bool)) n) = #(((Finset.univ : Finset (Arm K × Bool)).sym n).map e) := congrArg card hmap.symm _ = #((Finset.univ : Finset (Arm K × Bool)).sym n) := Finset.card_map e _ = #(Finset.univ : Finset (Sym (Arm K × Bool) n)) := by simp _ = card (Sym (Arm K × Bool) n) := Finset.card_univ _ = choose (card (Arm K × Bool) + n - 1) n := Sym.card_sym_eq_choose n _ = choose (n + 2 * K - 1) (2 * K - 1) := by simp only [Fintype.card_prod, Fintype.card_fin, Fintype.card_bool] have hKpos : 0 < K := by unfold AdmissibleArmCount at hK; omega have hleft : K * 2 + n - 1 = n + (2 * K - 1) := by omega have hright : n + 2 * K - 1 = n + (2 * K - 1) := by omega rw [hleft, hright] exact Nat.choose_symm_add
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocation_observation_cardinality · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:121
theorem response_count_cardinality

the response count cardinality property holds.

Formal statement
K :
shared
n :
shared
card (CountVec K n) = choose (n + 2 ^ K - 1) (2 ^ K - 1)
Proof (Lean source)
lemma response_count_cardinality : card (CountVec K n) = choose (n + 2 ^ K - 1) (2 ^ K - 1) := by unfold CountVec RespType Arm simpa using boundedCountVectorCardinality (Fin K → Bool) (by simp) n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.response_count_cardinality · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:154
theorem allocation_count_cardinality

there are at least two treatment arms, the allocation count cardinality property holds.

Formal statement
K :
shared
n :
shared
card (AllocVec K n) = choose (n + K - 1) (K - 1)
Proof (Lean source)
lemma allocation_count_cardinality (hK : AdmissibleArmCount K) : card (AllocVec K n) = choose (n + K - 1) (K - 1) := by have hKpos : 0 < K := by unfold AdmissibleArmCount at hK omega unfold AllocVec Arm simpa using boundedCountVectorCardinality (Fin K) (by simpa using hKpos) n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocation_count_cardinality · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitCounting.lean:160
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.OrbitLikelihood 18 declarations The exact rational likelihood of an observed arm-success orbit, obtained by summing multinomial contingency-table counts over the prescribed fiber.

The exact rational likelihood of an observed arm-success orbit, obtained by summing multinomial contingency-table counts over the prescribed fiber.

def rawContingencyCount

Joint response-type/arm count induced by a labeled schedule and assignment.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
A :
Assign K n
t :
a :
Arm K
rawContingencyCount z A t a :
Fin (n + 1)
⟨(Finset.univ.filter fun i => z i = t ∧ A i = a).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i => z i = t ∧ A i = a) univ))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawContingencyCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:16
def contingencyCounts

The contingency-count table records how many units of each response type receive each treatment arm.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
A :
Assign K n
contingencyCounts z A :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contingencyCounts · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:24
def ContingencyAssignments

Assignments inducing one fixed response-type/arm contingency table.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
h :
ContingencyAssignments z h :
Type
{A : Assign K n // contingencyCounts z A = h}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ContingencyAssignments · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:89
instance instFintypeContingencyAssignments

The contingency assignments collection has a finite enumeration.

Definition (Lean source)
noncomputable instance (z : Schedule K n) (h : Contingency K n) : Fintype (ContingencyAssignments z h) := by classical unfold ContingencyAssignments infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeContingencyAssignments · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:93
theorem contingencyAssignments_card_cast

the stated contingency-table condition holds, Exact multinomial count of assignments inducing a fixed feasible contingency table.

Formal statement
K :
shared
n :
shared
x :
shared
z :
Schedule K n
h :
hh :
= ∏ t, (((scheduleCounts z).1 t : ℕ).factorial : ℚ) / ∏ a, (((h t a : Fin (n + 1)) : ℕ).factorial : ℚ)
Proof (Lean source)
lemma contingencyAssignments_card_cast (z : Schedule K n) (h : Contingency K n) (hh : h ∈ contingencyFiber (scheduleCounts z) r x) : (card (ContingencyAssignments z h) : ℚ) = ∏ t, (((scheduleCounts z).1 t : ℕ).factorial : ℚ) / ∏ a, (((h t a : Fin (n + 1)) : ℕ).factorial : ℚ) := by classical rw [Fintype.card_congr (contingencyAssignmentsEquiv z h), Fintype.card_pi] push_cast apply Finset.prod_congr rfl intro t _ rcases (Finset.mem_filter.mp hh).2 with ⟨hrow, _, _⟩ have hcard : card {i : Unit n // z i = t} = ((scheduleCounts z).1 t : ℕ) := by rw [Fintype.card_subtype] rfl have hex := exactFiber_card_cast_eq_div (I := {i : Unit n // z i = t}) (fun a => (h t a : ℕ)) ((hrow t).trans hcard.symm) rw [hcard] at hex exact hex
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contingencyAssignments_card_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:144
def LabeledObservationAssignments

Labeled assignments with prescribed allocation and observed-success counts.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
r :
x :
LabeledObservationAssignments z r x :
Type
{A : Assign K n // assignmentCounts A = r ∧ ∀ a, (rawObservedCount A (obsOutcome z A) a : ℕ) = (x.1 a : ℕ)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.LabeledObservationAssignments · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:165
instance instFintypeLabeledObservationAssignments

The labeled observation assignments collection has a finite enumeration.

Definition (Lean source)
noncomputable instance (z : Schedule K n) (r : AllocVec K n) (x : ObsVec r) : Fintype (LabeledObservationAssignments z r x) := by classical unfold LabeledObservationAssignments infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeLabeledObservationAssignments · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:171
theorem labeledObservationAssignments_card_cast

Cardinality of an observed labeled fiber as the contingency-table sum in orbitLik.

Formal statement
K :
shared
n :
shared
z :
Schedule K n
r :
x :
= ∑ h ∈ contingencyFiber (scheduleCounts z) r x, ∏ t, (((scheduleCounts z).1 t : ℕ).factorial : ℚ) / ∏ a, (((h t a : Fin (n + 1)) : ℕ).factorial : ℚ)
Proof (Lean source)
lemma labeledObservationAssignments_card_cast (z : Schedule K n) (r : AllocVec K n) (x : ObsVec r) : (card (LabeledObservationAssignments z r x) : ℚ) = ∑ h ∈ contingencyFiber (scheduleCounts z) r x, ∏ t, (((scheduleCounts z).1 t : ℕ).factorial : ℚ) / ∏ a, (((h t a : Fin (n + 1)) : ℕ).factorial : ℚ) := by classical rw [Fintype.card_congr (labeledObservationEquivContingencies z r x), Fintype.card_sigma] push_cast rw [← Finset.sum_subtype (contingencyFiber (scheduleCounts z) r x) (fun _ => Iff.rfl) (fun h => (card (ContingencyAssignments z h) : ℚ))] apply Finset.sum_congr rfl intro h hh exact contingencyAssignments_card_cast z h hh
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.labeledObservationAssignments_card_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:212
instance allocationAssignmentsFintype

The allocation assignments collection has a finite enumeration.

Definition (Lean source)
noncomputable instance allocationAssignmentsFintype (r : AllocVec K n) : Fintype {A : Assign K n // assignmentCounts A = r} := by classical infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationAssignmentsFintype · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:245
theorem allocationOrbitCard_cast_eq_factorial_div

Exact multinomial cardinality of an allocation orbit.

Formal statement
K :
shared
n :
shared
r :
(allocationOrbitCard r : ℚ) = (n.factorial : ℚ) / ∏ a, (((r.1 a : ℕ).factorial : ℕ) : ℚ)
Proof (Lean source)
lemma allocationOrbitCard_cast_eq_factorial_div (r : AllocVec K n) : (allocationOrbitCard r : ℚ) = (n.factorial : ℚ) / ∏ a, (((r.1 a : ℕ).factorial : ℕ) : ℚ) := by classical unfold allocationOrbitCard rw [Fintype.card_congr (allocationAssignmentsEquivExactFiber r)] simpa using exactFiber_card_cast_eq_div (I := Unit n) (fun a => (r.1 a : ℕ)) (by simpa using r.2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationOrbitCard_cast_eq_factorial_div · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:251
def observedVecFor

Observed-success orbit of an assignment already identified with allocation orbit r.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
r :
A :
{A : Assign K n // assignmentCounts A = r}
observedVecFor z r A :
⟨rawObservedCount A.1 (obsOutcome z A.1), fun a
=> by calc (rawObservedCount A.1 (obsOutcome z A.1) a : ℕ) ≤ (rawAssignmentCount A.1 a : ℕ) := rawObservedCount_le _ _ _ _ = (r.1 a : ℕ) := by have ha := congrArg (fun q : AllocVec K n => (q.1 a : ℕ)) A.2 simpa [assignmentCounts] using ha⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observedVecFor · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:261
theorem sum_allocationFiber_by_observed

Regroup a real-valued sum over one allocation orbit by observed-success fibers.

Formal statement
K :
shared
n :
shared
z :
Schedule K n
r :
F :
ObsVec r → ℝ
∑ A : {A : Assign K n // assignmentCounts A = r}, F (observedVecFor z r A)
= ∑ x : ObsVec r, card (LabeledObservationAssignments z r x) * F x
Proof (Lean source)
lemma sum_allocationFiber_by_observed (z : Schedule K n) (r : AllocVec K n) (F : ObsVec r → ℝ) : ∑ A : {A : Assign K n // assignmentCounts A = r}, F (observedVecFor z r A) = ∑ x : ObsVec r, card (LabeledObservationAssignments z r x) * F x := by classical rw [← Fintype.sum_fiberwise (observedVecFor z r) (fun A => F (observedVecFor z r A))] apply Finset.sum_congr rfl intro x _ have hterm (A : {A : {A : Assign K n // assignmentCounts A = r} // observedVecFor z r A = x}) : F (observedVecFor z r A.1) = F x := by rw [A.2] simp_rw [hterm] rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] congr 1 exact_mod_cast Fintype.card_congr (labeledObservationEquivObservedFiber z r x).symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.sum_allocationFiber_by_observed · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:306
def orbitLik

The response-type orbit likelihood, kept over so coefficient rationality is definitionally visible.

Definition (Lean source)
K :
shared
n :
shared
m :
r :
x :
orbitLik m r x :
((∏ a, ((r.1 a : ℕ).factorial : ℚ)) / (n.factorial : ℚ)) * ∑ h ∈ contingencyFiber m r x, ∏ t, (((m.1 t : ℕ).factorial : ℚ) / (∏ a, ((h t a : ℕ).factorial : ℚ)))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitLik · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:326
theorem labeledObservation_card_ratio_eq_orbitLik

The labeled observation-fiber ratio is exactly the factorial orbit likelihood.

Formal statement
K :
shared
n :
shared
z :
Schedule K n
r :
x :
Proof (Lean source)
lemma labeledObservation_card_ratio_eq_orbitLik (z : Schedule K n) (r : AllocVec K n) (x : ObsVec r) : (card (LabeledObservationAssignments z r x) : ℚ) / allocationOrbitCard r = orbitLik (scheduleCounts z) r x := by rw [labeledObservationAssignments_card_cast, allocationOrbitCard_cast_eq_factorial_div] unfold orbitLik have hn : (n.factorial : ℚ) ≠ 0 := by positivity have hr : (∏ a, (((r.1 a : ℕ).factorial : ℕ) : ℚ)) ≠ 0 := Finset.prod_ne_zero_iff.mpr fun _ _ => by positivity field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.labeledObservation_card_ratio_eq_orbitLik · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:335
theorem labeledObservation_card_ratio_eq_orbitLik_real

the labeled observation cardinality ratio equals orbit lik real.

Formal statement
K :
shared
n :
shared
z :
Schedule K n
r :
x :
Proof (Lean source)
lemma labeledObservation_card_ratio_eq_orbitLik_real (z : Schedule K n) (r : AllocVec K n) (x : ObsVec r) : (card (LabeledObservationAssignments z r x) : ℝ) / allocationOrbitCard r = (orbitLik (scheduleCounts z) r x : ℝ) := by have h := congrArg (fun q : ℚ => (q : ℝ)) (labeledObservation_card_ratio_eq_orbitLik z r x) norm_num at h exact h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.labeledObservation_card_ratio_eq_orbitLik_real · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:348
theorem orbitLik_nonneg

the orbit lik is nonnegative.

Formal statement
K :
shared
n :
shared
m :
r :
x :
0 ≤ orbitLik m r x
Proof (Lean source)
lemma orbitLik_nonneg (m : CountVec K n) (r : AllocVec K n) (x : ObsVec r) : 0 ≤ orbitLik m r x := by unfold orbitLik apply mul_nonneg · apply div_nonneg · exact prod_nonneg fun _ _ => by positivity · positivity · apply sum_nonneg intro h hh apply prod_nonneg intro t ht apply div_nonneg <;> positivity
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitLik_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:358
theorem orbitLik_sum_obs

the orbit lik sums obs.

Formal statement
K :
shared
n :
shared
m :
r :
∑ x : ObsVec r, orbitLik m r x = 1
Proof (Lean source)
lemma orbitLik_sum_obs (m : CountVec K n) (r : AllocVec K n) : ∑ x : ObsVec r, orbitLik m r x = 1 := by obtain ⟨z, hz⟩ := exists_fun_card_fiber_eq (fun t => (m.1 t : ℕ)) m.2 have hm : scheduleCounts z = m := by apply Subtype.ext funext t apply Fin.ext simpa [scheduleCounts, rawScheduleCount] using hz t subst m simp_rw [← labeledObservation_card_ratio_eq_orbitLik z r] rw [← Finset.sum_div] have hsum := congrArg (fun q : ℕ => (q : ℚ)) (sum_labeledObservationAssignments_card z r) push_cast at hsum rw [hsum, div_self] exact_mod_cast (ne_of_gt (allocationOrbitCard_pos r))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitLik_sum_obs · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:372
def tauCountRat

Rational orbit target used by the exact LP.

Definition (Lean source)
K :
shared
n :
shared
c :
m :
tauCountRat c m :
((n : ℚ)⁻¹) * ∑ t, (m.1 t : ℚ) * ∑ a, c a * if t a then 1 else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauCountRat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitLikelihood.lean:390
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.OrbitRiskBridge 2 declarations Exact finite-sum regrouping from the labeled experiment to the response-type orbit experiment.

Exact finite-sum regrouping from the labeled experiment to the response-type orbit experiment.

theorem tauC_eq_tauCount_scheduleCounts

The labeled contrast target depends only on response-type counts.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
z :
Schedule K n
Proof (Lean source)
lemma tauC_eq_tauCount_scheduleCounts (z : Schedule K n) : tauC c z = tauCount c (scheduleCounts z) := by unfold tauC tauCount congr 1 rw [← Fintype.sum_fiberwise z (fun i => ∑ a, c a * if z i a then 1 else 0)] apply Finset.sum_congr rfl intro t _ have hterm (i : {i : Unit n // z i = t}) : (∑ a, c a * if z i.1 a then 1 else 0) = ∑ a, c a * if t a then 1 else 0 := by rw [i.2] simp_rw [hterm] rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] congr 1 norm_cast rw [Fintype.card_subtype] rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauC_eq_tauCount_scheduleCounts · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitRiskBridge.lean:16
theorem labeledRisk_eq_orbitRisk_of_realizes

the labeled design realizes the orbit design, the labeled estimator realizes the orbit estimator, Exact risk equality once a labeled procedure has the stated orbitwise design masses and estimator values.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
q :
hdesign :
∀ A, p.1.p A = q.1.p (assignmentCounts A) / allocationOrbitCard (assignmentCounts A)
hest :
∀ A y, (p.2 A y : ℝ) = (q.2 (assignmentCounts A) (observedCounts A y) : ℝ)
z :
Schedule K n
Proof (Lean source)
lemma labeledRisk_eq_orbitRisk_of_realizes (p : Procedure K n c) (q : OrbitProcedure K n c) (hdesign : ∀ A, p.1.p A = q.1.p (assignmentCounts A) / allocationOrbitCard (assignmentCounts A)) (hest : ∀ A y, (p.2 A y : ℝ) = (q.2 (assignmentCounts A) (observedCounts A y) : ℝ)) (z : Schedule K n) : labeledRisk c p z = orbitRisk c q (scheduleCounts z) := by classical unfold labeledRisk mse E orbitRisk rw [tauC_eq_tauCount_scheduleCounts] rw [← Fintype.sum_fiberwise assignmentCounts (fun A => p.1.p A * ((p.2 A (obsOutcome z A) : ℝ) - tauCount c (scheduleCounts z)) ^ 2)] apply Finset.sum_congr rfl intro r _ let F : ObsVec r → ℝ := fun x => ((q.2 r x : ℝ) - tauCount c (scheduleCounts z)) ^ 2 calc ∑ A : {A : Assign K n // assignmentCounts A = r}, p.1.p A.1 * ((p.2 A.1 (obsOutcome z A.1) : ℝ) - tauCount c (scheduleCounts z)) ^ 2 = ∑ A : {A : Assign K n // assignmentCounts A = r}, (q.1.p r / allocationOrbitCard r) * F (observedVecFor z r A) := by apply Finset.sum_congr rfl intro A _ rcases A with ⟨A, hA⟩ subst r rw [hdesign, hest] rfl _ = (q.1.p r / allocationOrbitCard r) * ∑ A : {A : Assign K n // assignmentCounts A = r}, F (observedVecFor z r A) := by rw [Finset.mul_sum] _ = (q.1.p r / allocationOrbitCard r) * ∑ x : ObsVec r, card (LabeledObservationAssignments z r x) * F x := by rw [sum_allocationFiber_by_observed] _ = q.1.p r * ∑ x : ObsVec r, (orbitLik (scheduleCounts z) r x : ℝ) * F x := by rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro x _ rw [← labeledObservation_card_ratio_eq_orbitLik_real z r x] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.labeledRisk_eq_orbitRisk_of_realizes · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/OrbitRiskBridge.lean:35
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.PermutationFibers 27 declarations Finite fiber permutations and the assignment/observation orbit facts used by the response-type reduction.

Finite fiber permutations and the assignment/observation orbit facts used by the response-type reduction.

def permuteSchedule

Relabeling a schedule by a unit permutation moves each unit’s response type along the inverse permutation.

Definition (Lean source)
K :
shared
n :
shared
σ :
z :
Schedule K n
permuteSchedule σ z :
Schedule K n
fun i => z (σ.symm i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.permuteSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:21
def permuteAssign

Relabeling an assignment by a unit permutation moves each unit’s treatment along the inverse permutation.

Definition (Lean source)
K :
shared
n :
shared
σ :
A :
Assign K n
permuteAssign σ A :
Assign K n
fun i => A (σ.symm i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.permuteAssign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:25
def permuteObserved

Relabeling an observed-outcome vector by a unit permutation moves each outcome along the inverse permutation.

Definition (Lean source)
n :
shared
σ :
permuteObserved σ y :
fun i => y (σ.symm i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.permuteObserved · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:29
def rawAssignmentCount

Allocation counts of a labeled assignment.

Definition (Lean source)
K :
shared
n :
shared
A :
Assign K n
a :
Arm K
rawAssignmentCount A a :
Fin (n + 1)
⟨(Finset.univ.filter fun i => A i = a).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i => A i = a) univ))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawAssignmentCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:33
theorem rawAssignmentCount_sum

the raw assignment count sums.

Formal statement
K :
shared
n :
shared
A :
Assign K n
∑ a, ((rawAssignmentCount A a : Fin (n + 1)) : ℕ) = n
Proof (Lean source)
lemma rawAssignmentCount_sum (A : Assign K n) : ∑ a, ((rawAssignmentCount A a : Fin (n + 1)) : ℕ) = n := by symm simpa [rawAssignmentCount] using (Finset.card_eq_sum_card_fiberwise (s := (Finset.univ : Finset (Unit n))) (t := (Finset.univ : Finset (Arm K))) (f := A) (by simp))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawAssignmentCount_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:40
def assignmentCounts

The assignment-count vector records the number of units allocated to each treatment arm.

Definition (Lean source)
K :
shared
n :
shared
A :
Assign K n
assignmentCounts A :
⟨rawAssignmentCount A, rawAssignmentCount_sum A⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.assignmentCounts · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:48
def rawObservedCount

Observed-success counts paired with the allocation orbit of (A,y).

Definition (Lean source)
K :
shared
n :
shared
A :
Assign K n
a :
Arm K
rawObservedCount A y a :
Fin (n + 1)
⟨(Finset.univ.filter fun i => A i = a ∧ y i).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i => A i = a ∧ y i) univ))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawObservedCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:52
theorem rawObservedCount_le

the raw observed count is at most property holds.

Formal statement
K :
shared
n :
shared
A :
Assign K n
a :
Arm K
(rawObservedCount A y a : ℕ) ≤ (rawAssignmentCount A a : ℕ)
Proof (Lean source)
lemma rawObservedCount_le (A : Assign K n) (y : ObservedOutcome n) (a : Arm K) : (rawObservedCount A y a : ℕ) ≤ (rawAssignmentCount A a : ℕ) := by change (Finset.univ.filter fun i => A i = a ∧ y i).card ≤ (Finset.univ.filter fun i => A i = a).card apply Finset.card_le_card intro i hi simp only [mem_filter, Finset.mem_univ, true_and] at hi ⊢ exact hi.1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawObservedCount_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:60
def observedCounts

The observed-count vector records the number of observed successes within each treatment arm.

Definition (Lean source)
K :
shared
n :
shared
A :
Assign K n
observedCounts A y :
⟨rawObservedCount A y, rawObservedCount_le A y⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observedCounts · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:70
def fiberwisePermOfCardEq

A permutation obtained by matching corresponding finite fibers.

Definition (Lean source)
I C :
f g :
I → C
h :
∀ a, card {i // f i = a} = card {i // g i = a}
fiberwisePermOfCardEq f g h :
Equiv.ofFiberEquiv fun a => Fintype.equivOfCardEq (h a)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fiberwisePermOfCardEq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:74
theorem fiberwisePermOfCardEq_spec

the stated side condition holds, the fiberwise perm when cardinality equals spec.

Formal statement
I C :
f g :
I → C
h :
∀ a, card {i // f i = a} = card {i // g i = a}
i :
I
g (fiberwisePermOfCardEq f g h i) = f i
Proof (Lean source)
lemma fiberwisePermOfCardEq_spec {I C : Type*} [Fintype I] [Fintype C] [DecidableEq C] (f g : I → C) (h : ∀ a, card {i // f i = a} = card {i // g i = a}) (i : I) : g (fiberwisePermOfCardEq f g h i) = f i := Equiv.ofFiberEquiv_map (fun a => Fintype.equivOfCardEq (h a)) i
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fiberwisePermOfCardEq_spec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:82
def FiberProfile

Functions with the same fiber cardinalities as a fixed finite function.

Definition (Lean source)
I C :
f :
I → C
FiberProfile f :
Type (max 0 u_1 u_2)
{g : I → C // ∀ c, card {i // g i = c} = card {i // f i = c}}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.FiberProfile · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:90
theorem fiberProfile_card_mul

Orbit-stabilizer cardinality for a prescribed finite fiber profile.

Formal statement
f :
I → C
card (FiberProfile f) * ∏ c, (card {i // f i = c}).factorial
Proof (Lean source)
lemma fiberProfile_card_mul {I C : Type*} [Fintype I] [Fintype C] [DecidableEq I] [DecidableEq C] (f : I → C) : card (FiberProfile f) * ∏ c, (card {i // f i = c}).factorial = (card I).factorial := by classical letI : Fintype ((Perm I)ᵈᵐᵃ) := Fintype.ofEquiv (Perm I) DomMulAct.mk rw [Fintype.card_congr (fiberProfileEquivOrbit f)] have hstab : card (MulAction.stabilizer ((Perm I)ᵈᵐᵃ) f) = ∏ c, (card {i // f i = c}).factorial := by let e : MulAction.stabilizer ((Perm I)ᵈᵐᵃ) f ≃ {σ : Perm I // f ∘ σ = f} := Equiv.subtypeEquiv DomMulAct.mk.symm fun _ => DomMulAct.mem_stabilizer_iff rw [Fintype.card_congr e, DomMulAct.stabilizer_card] have hgroup : card ((Perm I)ᵈᵐᵃ) = (card I).factorial := by rw [Fintype.card_congr DomMulAct.mk.symm, Fintype.card_perm] have horbit := MulAction.card_orbit_mul_card_stabilizer_eq_card_group ((Perm I)ᵈᵐᵃ) f rw [hstab, hgroup] at horbit exact horbit
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fiberProfile_card_mul · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:128
theorem assignmentCounts_permute

the assignment counts permute property holds.

Formal statement
K :
shared
n :
shared
A :
Assign K n
σ :
Proof (Lean source)
lemma assignmentCounts_permute (A : Assign K n) (σ : Perm (Unit n)) : assignmentCounts (permuteAssign σ A) = assignmentCounts A := by apply Subtype.ext funext a apply Fin.ext change #(Finset.univ.filter fun i => A (σ.symm i) = a) = #(Finset.univ.filter fun i => A i = a) let e : {i // A (σ.symm i) = a} ≃ {i // A i = a} := { toFun := fun i => ⟨σ.symm i, i.2⟩ invFun := fun i => ⟨σ i, by simpa using i.2⟩ left_inv := fun i => by ext; simp right_inv := fun i => by ext; simp } simpa only [← Fintype.card_subtype] using Fintype.card_congr e
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.assignmentCounts_permute · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:157
theorem observedCounts_permute

the observed counts permute property holds.

Formal statement
K :
shared
n :
shared
A :
Assign K n
σ :
Proof (Lean source)
lemma observedCounts_permute (A : Assign K n) (y : ObservedOutcome n) (σ : Perm (Unit n)) : (observedCounts (permuteAssign σ A) (permuteObserved σ y)).1 = (observedCounts A y).1 := by funext a apply Fin.ext change #(Finset.univ.filter fun i => A (σ.symm i) = a ∧ y (σ.symm i)) = #(Finset.univ.filter fun i => A i = a ∧ y i) let e : {i // A (σ.symm i) = a ∧ y (σ.symm i)} ≃ {i // A i = a ∧ y i} := { toFun := fun i => ⟨σ.symm i, i.2⟩ invFun := fun i => ⟨σ i, by simpa using i.2⟩ left_inv := fun i => by ext; simp right_inv := fun i => by ext; simp } simpa only [← Fintype.card_subtype] using Fintype.card_congr e
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observedCounts_permute · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:172
theorem assignmentCounts_eq_iff_perm

Equal allocation counts are exactly equality up to a unit permutation.

Formal statement
K :
shared
n :
shared
A B :
Assign K n
assignmentCounts A = assignmentCounts B ↔ ∃ σ : Perm (Unit n), permuteAssign σ A = B
Proof (Lean source)
lemma assignmentCounts_eq_iff_perm (A B : Assign K n) : assignmentCounts A = assignmentCounts B ↔ ∃ σ : Perm (Unit n), permuteAssign σ A = B := by constructor · intro hAB have hfiber : ∀ a, card {i // A i = a} = card {i // B i = a} := by intro a have ha := congrArg (fun r : AllocVec K n => (r.1 a : ℕ)) hAB simpa [assignmentCounts, rawAssignmentCount, card_fiber_eq_filter] using ha let σ := fiberwisePermOfCardEq A B hfiber refine ⟨σ, funext fun i => ?_⟩ have hs := fiberwisePermOfCardEq_spec A B hfiber (σ.symm i) simpa [permuteAssign, σ] using hs.symm · rintro ⟨σ, rfl⟩ exact (assignmentCounts_permute A σ).symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.assignmentCounts_eq_iff_perm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:189
theorem exists_fun_card_fiber_eq

the prescribed fiber sizes sum to the domain cardinality, Realize prescribed finite fiber sizes by a function on Fin n.

Formal statement
n :
shared
C :
d :
C → ℕ
hd :
∑ a, d a = n
∃ f : Fin n → C, ∀ a, #(Finset.univ.filter fun i => f i = a) = d a
Proof (Lean source)
lemma exists_fun_card_fiber_eq {C : Type*} [Fintype C] [DecidableEq C] (d : C → ℕ) (hd : ∑ a, d a = n) : ∃ f : Fin n → C, ∀ a, #(Finset.univ.filter fun i => f i = a) = d a := by classical let S := Σ a : C, Fin (d a) have hcard : card (Fin n) = card S := by simp [S, hd] let e : Fin n ≃ S := Fintype.equivOfCardEq hcard let f : Fin n → C := fun i => (e i).1 refine ⟨f, fun a => ?_⟩ let ef : {i // f i = a} ≃ {s : S // s.1 = a} := e.subtypeEquiv fun i => by rfl let es : {s : S // s.1 = a} ≃ Fin (d a) := { toFun := fun s => cast (congrArg Fin (congrArg d s.2)) s.1.2 invFun := fun j => ⟨⟨a, j⟩, rfl⟩ left_inv := fun s => by rcases s with ⟨⟨b, j⟩, hb⟩ dsimp at hb ⊢ subst b rfl right_inv := fun j => rfl } let ea := ef.trans es rw [← card_fiber_eq_filter] exact (Fintype.card_congr ea).trans (Fintype.card_fin _)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exists_fun_card_fiber_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:206
def ExactFiber

Functions on a finite type with prescribed fiber cardinalities.

Definition (Lean source)
I C :
d :
C → ℕ
ExactFiber d :
Type (max 0 u_1 u_2)
{f : I → C // ∀ c, card {i // f i = c} = d c}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ExactFiber · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:232
instance exactFiberFintype

The exact fiber collection has a finite enumeration.

Definition (Lean source)
noncomputable instance exactFiberFintype {I C : Type*} [Fintype I] [Fintype C] [DecidableEq C] (d : C → ℕ) : Fintype (ExactFiber (I := I) d) := by classical unfold ExactFiber infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exactFiberFintype · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:237
theorem exists_fun_fiber_card_eq

the prescribed fiber sizes sum to the domain cardinality, Prescribed fibers whose sizes sum to the domain cardinality are realizable.

Formal statement
I C :
d :
C → ℕ
hd :
∑ c, d c = card I
∃ f : I → C, ∀ c, card {i // f i = c} = d c
Proof (Lean source)
lemma exists_fun_fiber_card_eq {I C : Type*} [Fintype I] [Fintype C] [DecidableEq C] (d : C → ℕ) (hd : ∑ c, d c = card I) : ∃ f : I → C, ∀ c, card {i // f i = c} = d c := by classical obtain ⟨g, hg⟩ := exists_fun_card_fiber_eq (n := card I) d hd let e : I ≃ Fin (card I) := Fintype.equivFin I refine ⟨fun i => g (e i), fun c => ?_⟩ let ec : {i // g (e i) = c} ≃ {j // g j = c} := e.subtypeEquiv fun _ => Iff.rfl rw [Fintype.card_congr ec, Fintype.card_subtype] exact hg c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exists_fun_fiber_card_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:245
theorem exactFiber_card_mul

the prescribed fiber sizes sum to the domain cardinality, Multinomial cardinality identity for prescribed finite fibers.

Formal statement
d :
C → ℕ
hd :
∑ c, d c = card I
card (ExactFiber (I := I) d) * ∏ c, (d c).factorial = (card I).factorial
Proof (Lean source)
lemma exactFiber_card_mul {I C : Type*} [Fintype I] [Fintype C] [DecidableEq I] [DecidableEq C] (d : C → ℕ) (hd : ∑ c, d c = card I) : card (ExactFiber (I := I) d) * ∏ c, (d c).factorial = (card I).factorial := by classical obtain ⟨f, hf⟩ := exists_fun_fiber_card_eq (I := I) d hd let e : ExactFiber (I := I) d ≃ FiberProfile f := { toFun := fun g => ⟨g.1, fun c => (g.2 c).trans (hf c).symm⟩ invFun := fun g => ⟨g.1, fun c => (g.2 c).trans (hf c)⟩ left_inv := fun _ => rfl right_inv := fun _ => rfl } rw [Fintype.card_congr e] simpa only [hf] using fiberProfile_card_mul f
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exactFiber_card_mul · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:257
theorem exactFiber_card_cast_eq_div

the prescribed fiber sizes sum to the domain cardinality, Rational multinomial formula for the number of functions with prescribed fibers.

Formal statement
d :
C → ℕ
hd :
∑ c, d c = card I
(card (ExactFiber (I := I) d) : ℚ)
= ((card I).factorial : ℚ) / ∏ c, ((d c).factorial : ℚ)
Proof (Lean source)
lemma exactFiber_card_cast_eq_div {I C : Type*} [Fintype I] [Fintype C] [DecidableEq I] [DecidableEq C] (d : C → ℕ) (hd : ∑ c, d c = card I) : (card (ExactFiber (I := I) d) : ℚ) = ((card I).factorial : ℚ) / ∏ c, ((d c).factorial : ℚ) := by have h := congrArg (fun q : ℕ => (q : ℚ)) (exactFiber_card_mul d hd) push_cast at h apply (eq_div_iff ?_).2 h exact Finset.prod_ne_zero_iff.mpr fun _ _ => by positivity
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exactFiber_card_cast_eq_div · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:273
theorem assignmentCounts_surjective

the assignment counts surjective property holds.

Formal statement
K :
shared
n :
shared
Surjective (assignmentCounts : Assign K n → AllocVec K n)
Proof (Lean source)
lemma assignmentCounts_surjective : Surjective (assignmentCounts : Assign K n → AllocVec K n) := by intro r obtain ⟨A, hA⟩ := exists_fun_card_fiber_eq (fun a => (r.1 a : ℕ)) r.2 refine ⟨A, Subtype.ext (funext fun a => Fin.ext ?_)⟩ simpa [assignmentCounts, rawAssignmentCount] using hA a
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.assignmentCounts_surjective · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:284
theorem observedCounts_realizable

Prescribed success counts below prescribed allocation counts are jointly realizable.

Formal statement
K :
shared
n :
shared
r :
x :
∃ (A : Assign K n) (y : ObservedOutcome n),
conclusion 1
a :
(rawObservedCount A y a : ℕ) = (x.1 a : ℕ)
Proof (Lean source)
lemma observedCounts_realizable (r : AllocVec K n) (x : ObsVec r) : ∃ (A : Assign K n) (y : ObservedOutcome n), assignmentCounts A = r ∧ ∀ a, (rawObservedCount A y a : ℕ) = (x.1 a : ℕ) := by classical obtain ⟨A, hA⟩ := assignmentCounts_surjective r have hcard (a : Arm K) : #(Finset.univ.filter fun i => A i = a) = (r.1 a : ℕ) := by have ha := congrArg (fun s : AllocVec K n => (s.1 a : ℕ)) hA simpa [assignmentCounts, rawAssignmentCount] using ha have hexists (a : Arm K) : ∃ s ⊆ (Finset.univ.filter fun i => A i = a), #s = (x.1 a : ℕ) := by apply Finset.exists_subset_card_eq rw [hcard] exact x.2 a let s : Arm K → Finset (Unit n) := fun a => choose (hexists a) have hs_subset (a : Arm K) : s a ⊆ Finset.univ.filter fun i => A i = a := (Classical.choose_spec (hexists a)).1 have hs_card (a : Arm K) : #(s a) = (x.1 a : ℕ) := (Classical.choose_spec (hexists a)).2 let y : ObservedOutcome n := fun i => i ∈ s (A i) refine ⟨A, y, hA, fun a => ?_⟩ simp only [rawObservedCount] simp only [y, decide_eq_true_eq] rw [← hs_card a] congr 1 ext i simp only [mem_filter, Finset.mem_univ, true_and] constructor · rintro ⟨hiA, hi⟩ simpa [hiA] using hi · intro hi have hiA : A i = a := (Finset.mem_filter.mp (hs_subset a hi)).2 exact ⟨hiA, by simpa [hiA] using hi⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observedCounts_realizable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:292
theorem assignmentObservedCounts_eq_iff_perm

Allocation and success counts classify labeled assignment/outcome pairs up to permutation.

Formal statement
K :
shared
n :
shared
A B :
Assign K n
y v :
↔ ∃ σ : Perm (Unit n), permuteAssign σ A = B ∧ permuteObserved σ y = v
Proof (Lean source)
lemma assignmentObservedCounts_eq_iff_perm (A B : Assign K n) (y v : ObservedOutcome n) : (assignmentCounts A = assignmentCounts B ∧ (observedCounts A y).1 = (observedCounts B v).1) ↔ ∃ σ : Perm (Unit n), permuteAssign σ A = B ∧ permuteObserved σ y = v := by constructor · rintro ⟨hA, hx⟩ let f : Unit n → Arm K × Bool := fun i => (A i, y i) let g : Unit n → Arm K × Bool := fun i => (B i, v i) have hfiber : ∀ ab, card {i // f i = ab} = card {i // g i = ab} := by rintro ⟨a, b⟩ exact jointFiberCard_eq_of_counts A B y v hA hx a b let σ := fiberwisePermOfCardEq f g hfiber refine ⟨σ, funext fun i => ?_, funext fun i => ?_⟩ · have hs := fiberwisePermOfCardEq_spec f g hfiber (σ.symm i) simpa [permuteAssign, σ, f, g] using congrArg fst hs.symm · have hs := fiberwisePermOfCardEq_spec f g hfiber (σ.symm i) simpa [permuteObserved, σ, f, g] using congrArg snd hs.symm · rintro ⟨σ, rfl, rfl⟩ exact ⟨(assignmentCounts_permute A σ).symm, (observedCounts_permute A y σ).symm⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.assignmentObservedCounts_eq_iff_perm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:368
def allocationOrbitCard

Number of labeled assignments in one allocation-count orbit.

Definition (Lean source)
K :
shared
n :
shared
r :
allocationOrbitCard r :
by classical exact card {A : Assign K n // assignmentCounts A = r}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationOrbitCard · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:392
theorem allocationOrbitCard_pos

the allocation orbit cardinality is positive.

Formal statement
K :
shared
n :
shared
r :
Proof (Lean source)
lemma allocationOrbitCard_pos (r : AllocVec K n) : 0 < allocationOrbitCard r := by classical obtain ⟨A, hA⟩ := assignmentCounts_surjective r unfold allocationOrbitCard exact Fintype.card_pos_iff.mpr ⟨⟨A, hA⟩⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationOrbitCard_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/PermutationFibers.lean:398
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.RationalContrastApproximation 2 declarations Quantitative rational approximation inside the finite-dimensional zero-sum contrast space.

Quantitative rational approximation inside the finite-dimensional zero-sum contrast space.

theorem exists_ratContrast_close

there are at least two treatment arms, the stated side condition holds, the stated side condition holds, the exists rat contrast close.

Formal statement
K :
c :
Contrast ℝ K
ε :
:
0 < ε
hεc :
ε < Lc c / 2
Proof (Lean source)
lemma exists_ratContrast_close (K : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) (ε : ℝ) (hε : 0 < ε) (hεc : ε < Lc c / 2) : ∃ q : RatContrast K, contrastDistance c (ratContrastToReal q) ≤ ε := by classical have hKpos : 0 < K := lt_of_lt_of_le (by norm_num) hK let k0 : Arm K := ⟨0, hKpos⟩ let δ : ℝ := ε / (2 * K) have hδ : 0 < δ := by dsimp [δ]; positivity choose r hr using fun a : Arm K => exists_rat_near (c a) hδ let f : Arm K → ℚ := fun a => if a = k0 then -∑ b ∈ Finset.univ.erase k0, r b else r a have hsum : ∑ a, f a = 0 := by rw [← Finset.sum_erase_add univ f (Finset.mem_univ k0)] have hrest : ∑ a ∈ Finset.univ.erase k0, f a = ∑ a ∈ Finset.univ.erase k0, r a := by apply Finset.sum_congr rfl intro a ha simp [f, (Finset.mem_erase.mp ha).1] rw [hrest] simp [f] have hc0 : c k0 = -∑ a ∈ Finset.univ.erase k0, c a := by have hs := Finset.sum_erase_add univ c (Finset.mem_univ k0) rw [c.sum_zero] at hs linarith have hrestBound : ∑ a ∈ Finset.univ.erase k0, |c a - (r a : ℝ)| ≤ (K : ℝ) * δ := by calc _ ≤ ∑ _a ∈ Finset.univ.erase k0, δ := by apply Finset.sum_le_sum intro a _ha exact (hr a).le _ ≤ (K : ℝ) * δ := by rw [Finset.sum_const, nsmul_eq_mul] apply mul_le_mul_of_nonneg_right _ hδ.le simpa using Finset.card_le_card (Finset.erase_subset univ k0) have hk0Bound : |c k0 - (f k0 : ℝ)| ≤ (K : ℝ) * δ := by calc |c k0 - (f k0 : ℝ)| = |∑ a ∈ Finset.univ.erase k0, (c a - (r a : ℝ))| := by rw [hc0] simp only [f, if_pos, Rat.cast_neg, Rat.cast_sum] rw [Finset.sum_sub_distrib] rw [show -∑ a ∈ Finset.univ.erase k0, c a - -(∑ i ∈ Finset.univ.erase k0, (r i : ℝ)) = -(∑ a ∈ Finset.univ.erase k0, c a - ∑ i ∈ Finset.univ.erase k0, (r i : ℝ)) by ring, abs_neg] _ ≤ ∑ a ∈ Finset.univ.erase k0, |c a - (r a : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ (K : ℝ) * δ := hrestBound have hL1 : ∑ a, |c a - (f a : ℝ)| ≤ ε := by rw [← Finset.sum_erase_add univ (fun a => |c a - (f a : ℝ)|) (Finset.mem_univ k0)] have hrestF : ∑ a ∈ Finset.univ.erase k0, |c a - (f a : ℝ)| = ∑ a ∈ Finset.univ.erase k0, |c a - (r a : ℝ)| := by apply Finset.sum_congr rfl intro a ha simp [f, (Finset.mem_erase.mp ha).1] rw [hrestF] calc _ ≤ (K : ℝ) * δ + (K : ℝ) * δ := add_le_add hrestBound hk0Bound _ = ε := by dsimp [δ]; field_simp; norm_num have hfne : f ≠ 0 := by intro hf have hLc_le : Lc c ≤ ε := by unfold Lc at * simpa [hf] using hL1 linarith let q : RatContrast K := ⟨f, hfne, hsum⟩ refine ⟨q, ?_⟩ unfold contrastDistance change (∑ a, |c a - (f a : ℝ)|) / 2 ≤ ε linarith [hL1, hε]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exists_ratContrast_close · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalContrastApproximation.lean:9
theorem coordinate_le_two_contrastDistance

the coordinate is at most two contrast distance.

Formal statement
K :
shared
c c' :
Contrast ℝ K
a :
Arm K
|c a - c' a| ≤ 2 * contrastDistance c c'
Proof (Lean source)
lemma coordinate_le_two_contrastDistance (c c' : Contrast ℝ K) (a : Arm K) : |c a - c' a| ≤ 2 * contrastDistance c c' := by unfold contrastDistance have h := Finset.single_le_sum (s := univ) (fun b _ => abs_nonneg (c b - c' b)) (Finset.mem_univ a) rw [show 2 * ((∑ a, |c a - c' a|) / 2) = ∑ a, |c a - c' a| by ring] exact h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.coordinate_le_two_contrastDistance · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalContrastApproximation.lean:86
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.RationalGridCertificateFinite 21 declarations Finite-sample algebra for exact rational grid certificates.

Finite-sample algebra for exact rational grid certificates.

theorem rationalContrast_admissibleArmCount

the rational contrast admissible arm count property holds.

Formal statement
K :
shared
c :
Proof (Lean source)
lemma rationalContrast_admissibleArmCount (c : RatContrast K) : AdmissibleArmCount K := by unfold AdmissibleArmCount by_contra hK have hK' : K < 2 := by omega interval_cases K · apply c.nonzero funext a exact elim0 a · apply c.nonzero funext a fin_cases a simpa using c.sum_zero
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rationalContrast_admissibleArmCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:18
theorem tauCountRat_cast

the tau count rat real-valued identity property holds.

Formal statement
K :
shared
n :
shared
c :
m :
(tauCountRat c m : ℝ) = tauCount (ratContrastToReal c) m
Proof (Lean source)
lemma tauCountRat_cast (c : RatContrast K) (m : CountVec K n) : (tauCountRat c m : ℝ) = tauCount (ratContrastToReal c) m := by unfold tauCountRat tauCount ratContrastToReal push_cast congr 1 apply Finset.sum_congr rfl intro t _ congr 1 apply Finset.sum_congr rfl intro a _ by_cases hta : t a = true <;> simp [hta]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauCountRat_cast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:33
def rationalOrbitModel

The rational orbit model uses exact rational orbit likelihoods, contrast targets, and allocation designs.

Definition (Lean source)
K :
shared
n :
shared
c :
rationalOrbitModel c :
Model (CountVec K n) (AllocVec K n) (fun r => ObsVec r)
clause 1
P m r x := (orbitLik m r x : ℝ)
clause 2
P_nonneg m r x := by exact_mod_cast orbitLik_nonneg m r x
clause 3
P_sum m r := by exact_mod_cast orbitLik_sum_obs m r
clause 4
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rationalOrbitModel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:47
def rationalPriorOf

A rational response-count prior is interpreted as a real finite probability design.

Definition (Lean source)
K :
shared
n :
shared
nu :
CountVec K n → ℚ
hnu :
rationalPriorOf nu hnu :
clause 1
p m := (nu m : ℝ)
clause 2
p_nonneg m := by exact_mod_cast hnu.1 m
clause 3
p_sum := by exact_mod_cast hnu.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rationalPriorOf · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:57
def rationalGridDesignOf

Rational grid weights induce a real finite design on allocation-count vectors.

Definition (Lean source)
K :
shared
n :
shared
pi :
GridPi K n
hpi0 :
∀ r, 0 ≤ pi r
hpi1 :
∑ r, pi r = 1
rationalGridDesignOf pi hpi0 hpi1 :
clause 1
p r := (pi r : ℝ)
clause 2
p_nonneg r := by exact_mod_cast hpi0 r
clause 3
p_sum := by exact_mod_cast hpi1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rationalGridDesignOf · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:66
theorem posteriorResidual_eq_secondMoment_sub

the posterior residual equals second moment sub.

Formal statement
Theta :
Type u_1
shared
B :
Type u_2
B → Type u_3
shared
Mdl :
Model Theta B X
prior :
b :
B
Mdl.posteriorResidual prior b
= (∑ theta, prior.p theta * Mdl.tau theta ^ 2)
- ∑ x, if Mdl.predictiveMass prior b x
= 0 then 0 else Mdl.predictiveTarget prior b x ^ 2 / Mdl.predictiveMass prior b x
Proof (Lean source)
lemma posteriorResidual_eq_secondMoment_sub (Mdl : Model Theta B X) (prior : FiniteDesign Theta) (b : B) : Mdl.posteriorResidual prior b = (∑ theta, prior.p theta * Mdl.tau theta ^ 2) - ∑ x, if Mdl.predictiveMass prior b x = 0 then 0 else Mdl.predictiveTarget prior b x ^ 2 / Mdl.predictiveMass prior b x := by classical unfold posteriorResidual simp_rw [Finset.mul_sum, ← mul_assoc] rw [Finset.sum_comm] calc (∑ x, ∑ theta, prior.p theta * Mdl.P theta b x * (Mdl.posteriorMean prior b x - Mdl.tau theta) ^ 2) = ∑ x, ((∑ theta, prior.p theta * Mdl.P theta b x * Mdl.tau theta ^ 2) - if Mdl.predictiveMass prior b x = 0 then 0 else Mdl.predictiveTarget prior b x ^ 2 / Mdl.predictiveMass prior b x) := by apply Finset.sum_congr rfl intro x _ by_cases hx : Mdl.predictiveMass prior b x = 0 · rw [if_pos hx] have hjoint := Mdl.joint_eq_zero_of_predictiveMass_eq_zero prior hx simp only [posteriorMean, hx, if_pos, zero_sub] simp_rw [hjoint] simp · rw [if_neg hx, posteriorMean, if_neg hx] let D := Mdl.predictiveMass prior b x let N := Mdl.predictiveTarget prior b x let Q := ∑ theta, prior.p theta * Mdl.P theta b x * Mdl.tau theta ^ 2 have hD : D ≠ 0 := hx have hsumD : (∑ theta, prior.p theta * Mdl.P theta b x) = D := rfl have hsumN : (∑ theta, prior.p theta * Mdl.P theta b x * Mdl.tau theta) = N := rfl change (∑ theta, prior.p theta * Mdl.P theta b x * (N / D - Mdl.tau theta) ^ 2) = Q - N ^ 2 / D calc _ = ∑ theta, (prior.p theta * Mdl.P theta b x * (N / D) ^ 2 - 2 * (prior.p theta * Mdl.P theta b x * Mdl.tau theta) * (N / D) + prior.p theta * Mdl.P theta b x * Mdl.tau theta ^ 2) := by apply Finset.sum_congr rfl intro theta _ ring _ = D * (N / D) ^ 2 - 2 * N * (N / D) + Q := by rw [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.sum_mul, ← Finset.sum_mul, hsumD] rw [← Finset.mul_sum, hsumN] _ = Q - N ^ 2 / D := by field_simp; ring _ = (∑ theta, prior.p theta * Mdl.tau theta ^ 2) - ∑ x, if Mdl.predictiveMass prior b x = 0 then 0 else Mdl.predictiveTarget prior b x ^ 2 / Mdl.predictiveMass prior b x := by rw [Finset.sum_sub_distrib] congr 1 rw [Finset.sum_comm] apply Finset.sum_congr rfl intro theta _ calc (∑ x, prior.p theta * Mdl.P theta b x * Mdl.tau theta ^ 2) = prior.p theta * Mdl.tau theta ^ 2 * ∑ x, Mdl.P theta b x := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ ring _ = prior.p theta * Mdl.tau theta ^ 2 := by rw [Mdl.P_sum, mul_one]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.posteriorResidual_eq_secondMoment_sub · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:78
theorem posteriorResidual_eq_allocationBayesRisk

the stated side condition holds, the posterior residual equals allocation bayes risk.

Formal statement
K :
shared
n :
shared
c :
nu :
CountVec K n → ℚ
hnu :
r :
(rationalOrbitModel c).posteriorResidual (rationalPriorOf nu hnu) r
= (allocationBayesRisk c nu r : ℝ)
Proof (Lean source)
lemma posteriorResidual_eq_allocationBayesRisk (c : RatContrast K) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (r : AllocVec K n) : (rationalOrbitModel c).posteriorResidual (rationalPriorOf nu hnu) r = (allocationBayesRisk c nu r : ℝ) := by classical rw [posteriorResidual_eq_secondMoment_sub] unfold allocationBayesRisk predictiveMass predictiveTarget rationalOrbitModel rationalPriorOf push_cast simp_rw [tauCountRat_cast] apply congrArg₂ (fun x y : ℝ => x - y) · apply Finset.sum_congr rfl intro m _ ring · apply Finset.sum_congr rfl intro x _ have hmass : (0 : ℝ) ≤ ∑ m, (nu m : ℝ) * (orbitLik m r x : ℝ) := sum_nonneg fun m _ => mul_nonneg (by exact_mod_cast hnu.1 m) (by exact_mod_cast orbitLik_nonneg m r x) by_cases hq : 0 < predictiveMass c nu r x · have hr : (0 : ℝ) < ∑ m, (nu m : ℝ) * (orbitLik m r x : ℝ) := by exact_mod_cast hq rw [if_neg (ne_of_gt hr), dif_pos hq] unfold predictiveTarget predictiveMass push_cast simp_rw [tauCountRat_cast] · have hq0 : predictiveMass c nu r x = 0 := by have : 0 ≤ predictiveMass c nu r x := sum_nonneg fun m _ => mul_nonneg (hnu.1 m) (orbitLik_nonneg m r x) linarith have hr0 : (∑ m, (nu m : ℝ) * (orbitLik m r x : ℝ)) = 0 := by exact_mod_cast hq0 rw [if_pos hr0, dif_neg hq] norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.posteriorResidual_eq_allocationBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:148
theorem Lc_ratContrastToReal

the contrast norm rat contrast to real property holds.

Formal statement
K :
shared
c :
Lc (ratContrastToReal c) = (LcRat c : ℝ)
Proof (Lean source)
lemma Lc_ratContrastToReal (c : RatContrast K) : Lc (ratContrastToReal c) = (LcRat c : ℝ) := by unfold Lc LcRat ratContrastToReal push_cast apply Finset.sum_congr rfl intro a _ exact_mod_cast rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Lc_ratContrastToReal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:187
theorem hRat_cast

the h rat real-valued identity property holds.

Formal statement
K :
shared
c :
(hRat c : ℝ) = Lc (ratContrastToReal c) / 2
Proof (Lean source)
lemma hRat_cast (c : RatContrast K) : (hRat c : ℝ) = Lc (ratContrastToReal c) / 2 := by rw [Lc_ratContrastToReal] unfold hRat push_cast ring
theorem hRat_sq_eq_C0

the h rat squared equals c0.

Formal statement
K :
shared
c :
(hRat c : ℝ) ^ 2 = C0 (ratContrastToReal c)
Proof (Lean source)
lemma hRat_sq_eq_C0 (c : RatContrast K) : (hRat c : ℝ) ^ 2 = C0 (ratContrastToReal c) := by rw [hRat_cast] unfold C0 ring
theorem tauCount_mem_gridInterval

the population size is positive, the tau count belongs to grid interval.

Formal statement
K :
shared
n :
shared
c :
m :
hn :
0 < n
tauCount (ratContrastToReal c) m ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ)
Proof (Lean source)
lemma tauCount_mem_gridInterval (c : RatContrast K) (m : CountVec K n) (hn : 0 < n) : tauCount (ratContrastToReal c) m ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ) := by obtain ⟨z, hz⟩ := exists_fun_card_fiber_eq (C := RespType K) (fun t => (m.1 t : ℕ)) m.2 have hm : scheduleCounts z = m := by apply Subtype.ext funext t apply Fin.ext simpa [scheduleCounts, rawScheduleCount] using hz t rw [← hm, ← tauC_eq_tauCount_scheduleCounts, hRat_cast] simpa [neg_div] using tauC_mem_naturalInterval (ratContrastToReal c) z hn
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauCount_mem_gridInterval · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:214
theorem gammaMC_mem_gridInterval

the grid resolution is positive, the gamma mc belongs to grid interval.

Formal statement
K :
shared
M :
shared
c :
hM :
0 < M
g :
Fin (2 * M + 1)
(gammaMC M c g : ℝ) ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ)
Proof (Lean source)
lemma gammaMC_mem_gridInterval (c : RatContrast K) (hM : 0 < M) (g : Fin (2 * M + 1)) : (gammaMC M c g : ℝ) ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ) := by have hhQ : 0 ≤ hRat c := by unfold hRat LcRat positivity have hh : (0 : ℝ) ≤ (hRat c : ℝ) := by exact_mod_cast hhQ have hMR : (0 : ℝ) < M := by positivity have hg : ((g : ℕ) : ℝ) ≤ 2 * M := by exact_mod_cast (Nat.le_of_lt_succ g.2) unfold gammaMC push_cast constructor <;> (field_simp; nlinarith)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gammaMC_mem_gridInterval · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:228
theorem posteriorMean_mem_gridInterval

the stated side condition holds, the population size is positive, the posterior mean belongs to grid interval.

Formal statement
K :
shared
n :
shared
c :
nu :
CountVec K n → ℚ
hnu :
hn :
0 < n
r :
x :
(rationalOrbitModel c).posteriorMean (rationalPriorOf nu hnu) r x ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ)
Proof (Lean source)
lemma posteriorMean_mem_gridInterval (c : RatContrast K) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (hn : 0 < n) (r : AllocVec K n) (x : ObsVec r) : (rationalOrbitModel c).posteriorMean (rationalPriorOf nu hnu) r x ∈ Icc (-(hRat c : ℝ)) (hRat c : ℝ) := by classical let Mdl := rationalOrbitModel (n := n) c let prior := rationalPriorOf nu hnu by_cases hx : Mdl.predictiveMass prior r x = 0 · rw [posteriorMean, if_pos hx] have hh : (0 : ℝ) ≤ (hRat c : ℝ) := by exact_mod_cast (show 0 ≤ hRat c by unfold hRat LcRat; positivity) exact ⟨by linarith, hh⟩ · have hD : 0 < Mdl.predictiveMass prior r x := lt_of_le_of_ne (Mdl.predictiveMass_nonneg prior r x) (Ne.symm hx) rw [posteriorMean, if_neg hx] constructor · rw [le_div_iff₀ hD] unfold predictiveMass predictiveTarget rw [Finset.mul_sum] apply Finset.sum_le_sum intro m _ have hj : 0 ≤ prior.p m * Mdl.P m r x := mul_nonneg (prior.p_nonneg m) (Mdl.P_nonneg m r x) calc -(hRat c : ℝ) * (prior.p m * Mdl.P m r x) = (prior.p m * Mdl.P m r x) * -(hRat c : ℝ) := by ring _ ≤ (prior.p m * Mdl.P m r x) * Mdl.tau m := by exact mul_le_mul_of_nonneg_left (tauCount_mem_gridInterval c m hn).1 hj · rw [div_le_iff₀ hD] unfold predictiveMass predictiveTarget rw [Finset.mul_sum] apply Finset.sum_le_sum intro m _ have hj : 0 ≤ prior.p m * Mdl.P m r x := mul_nonneg (prior.p_nonneg m) (Mdl.P_nonneg m r x) calc (prior.p m * Mdl.P m r x) * Mdl.tau m ≤ (prior.p m * Mdl.P m r x) * (hRat c : ℝ) := by exact mul_le_mul_of_nonneg_left (tauCount_mem_gridInterval c m hn).2 hj _ = (hRat c : ℝ) * (prior.p m * Mdl.P m r x) := by ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.posteriorMean_mem_gridInterval · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:244
theorem lowerCertificate_eq_posteriorResidual_sInf

the stated side condition holds, the lower certificate equals posterior residual s inf.

Formal statement
K :
shared
n :
shared
c :
nu :
CountVec K n → ℚ
hnu :
= sInf (range ((rationalOrbitModel c).posteriorResidual (rationalPriorOf nu hnu)))
Proof (Lean source)
lemma lowerCertificate_eq_posteriorResidual_sInf (c : RatContrast K) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) : lowerCertificate c nu = sInf (range ((rationalOrbitModel c).posteriorResidual (rationalPriorOf nu hnu))) := by unfold lowerCertificate congr 1 ext v constructor · rintro ⟨r, rfl⟩ exact ⟨r, posteriorResidual_eq_allocationBayesRisk c nu hnu r⟩ · rintro ⟨r, rfl⟩ exact ⟨r, posteriorResidual_eq_allocationBayesRisk c nu hnu r⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lowerCertificate_eq_posteriorResidual_sInf · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:290
theorem orbitModel_minimax_eq_orbitGameValue

the orbit model minimax equals orbit game value.

Formal statement
K :
shared
n :
shared
c :
minimaxValue (risk (l := -Lc (ratContrastToReal c) / 2) (u := Lc (ratContrastToReal c) / 2) (rationalOrbitModel (n := n) c).P (rationalOrbitModel (n := n) c).tau)
Proof (Lean source)
lemma orbitModel_minimax_eq_orbitGameValue (c : RatContrast K) : minimaxValue (risk (l := -Lc (ratContrastToReal c) / 2) (u := Lc (ratContrastToReal c) / 2) (rationalOrbitModel (n := n) c).P (rationalOrbitModel (n := n) c).tau) = orbitGameValue K n (ratContrastToReal c) := by let e : OrbitProcedure K n (ratContrastToReal c) ≃ Procedure (fun r : AllocVec K n => ObsVec r) (-Lc (ratContrastToReal c) / 2) (Lc (ratContrastToReal c) / 2) := { toFun := fun q => ⟨q.1, q.2⟩ invFun := fun q => (q.design, q.decision) left_inv := fun _ => rfl right_inv := fun q => by cases q; rfl } unfold orbitGameValue minimaxValue rw [← e.iInf_comp] rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitModel_minimax_eq_orbitGameValue · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:306
theorem lowerCertificate_le_rhoN

the population size is positive, the stated side condition holds, the lower certificate is at most rho n.

Formal statement
K :
shared
n :
shared
c :
hn :
0 < n
nu :
CountVec K n → ℚ
hnu :
Proof (Lean source)
lemma lowerCertificate_le_rhoN (c : RatContrast K) (hn : 0 < n) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) : lowerCertificate c nu ≤ rhoN K n (ratContrastToReal c) := by classical have hK := rationalContrast_admissibleArmCount c have hKpos : 0 < K := by unfold AdmissibleArmCount at hK; omega letI : Nonempty (Arm K) := Fintype.card_pos_iff.mp (by simpa using hKpos) letI : Nonempty (AllocVec K n) := ⟨assignmentCounts (fun _ => choice inferInstance)⟩ letI : Nonempty (CountVec K n) := ⟨scheduleCounts (fun _ _ => false)⟩ have hlu : -Lc (ratContrastToReal c) / 2 ≤ Lc (ratContrastToReal c) / 2 := by have := Lc_pos (ratContrastToReal c) linarith rw [lowerCertificate_eq_posteriorResidual_sInf c nu hnu] calc sInf (range ((rationalOrbitModel (n := n) c).posteriorResidual (rationalPriorOf nu hnu))) ≤ minimaxValue (risk (l := -Lc (ratContrastToReal c) / 2) (u := Lc (ratContrastToReal c) / 2) (rationalOrbitModel (n := n) c).P (rationalOrbitModel (n := n) c).tau) := (rationalOrbitModel (n := n) c).sInf_posteriorResidual_le_minimaxValue (rationalPriorOf nu hnu) hlu _ = orbitGameValue K n (ratContrastToReal c) := orbitModel_minimax_eq_orbitGameValue (n := n) c _ = rhoN K n (ratContrastToReal c) := (exact_response_type_game K n (ratContrastToReal c) hK).2.2.2.1.symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lowerCertificate_le_rhoN · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:327
theorem gridBarycenter_eq_conditionalBarycenter

the delta condition holds, the stated side condition holds, the stated side condition holds, the stated side condition holds, the grid barycenter equals conditional barycenter.

Formal statement
K :
shared
n :
shared
M :
shared
c :
pi :
GridPi K n
w :
delta :
∀ r : AllocVec K n
if
then
hpi0 :
∀ r, 0 ≤ pi r
hpi1 :
∑ r, pi r = 1
hbar :
IsGridBarycenter c pi w delta
r :
x :
delta r x
= conditionalBarycenter (rationalGridDesignOf pi hpi0 hpi1) w (fun g => (gammaMC M c g : ℝ)) 0 r x
Proof (Lean source)
lemma gridBarycenter_eq_conditionalBarycenter (c : RatContrast K) (pi : GridPi K n) (w : GridWeight K n M) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ) (hpi0 : ∀ r, 0 ≤ pi r) (hpi1 : ∑ r, pi r = 1) (hbar : IsGridBarycenter c pi w delta) (r : AllocVec K n) (x : ObsVec r) : delta r x = Causalean.Stat.Minimax.FiniteSquaredLoss.conditionalBarycenter (rationalGridDesignOf pi hpi0 hpi1) w (fun g => (gammaMC M c g : ℝ)) 0 r x := by classical rw [hbar r x] unfold Causalean.Stat.Minimax.FiniteSquaredLoss.conditionalBarycenter rationalGridDesignOf by_cases hp : pi r = 0 · have hpr : ((pi r : ℚ) : ℝ) = 0 := by rw [hp]; norm_num have hnpos : ¬ 0 < pi r := by rw [hp]; exact lt_irrefl 0 rw [dif_neg hnpos, if_pos hpr] · have hpq : 0 < pi r := lt_of_le_of_ne (hpi0 r) (Ne.symm hp) have hpr : (0 : ℝ) < (pi r : ℝ) := by exact_mod_cast hpq rw [dif_pos hpq, if_neg (ne_of_gt hpr), Finset.sum_div]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridBarycenter_eq_conditionalBarycenter · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:359
theorem upperCertificate_le_gridObjective

the delta condition holds, the stated side condition holds, the stated side condition holds, the upper certificate is at most grid objective.

Formal statement
K :
shared
n :
shared
M :
shared
c :
pi :
GridPi K n
w :
u :
delta :
∀ r : AllocVec K n
if
then
nu :
CountVec K n → ℚ
hcert :
hbar :
IsGridBarycenter c pi w delta
upperCertificate c pi delta ≤ (u : ℝ)
Proof (Lean source)
lemma upperCertificate_le_gridObjective (c : RatContrast K) (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ) (nu : CountVec K n → ℚ) (hcert : ExactGridPrimalDualCertificate c pi w u nu) (hbar : IsGridBarycenter c pi w delta) : upperCertificate c pi delta ≤ (u : ℝ) := by classical rcases hcert with ⟨wQ, y, rfl, hpr, _hy, _hnu, _hu⟩ let piD := rationalGridDesignOf pi hpr.2.2.1 hpr.1 let wR : GridWeight K n M := rationalGridWeightToReal M wQ letI : Nonempty (CountVec K n) := ⟨scheduleCounts (fun _ _ => false)⟩ have hw : ∀ r x g, 0 ≤ wR r x g := by intro r x g dsimp [wR, rationalGridWeightToReal] exact_mod_cast hpr.2.2.2.1 r x g have hocc : ∀ r x, ∑ g, wR r x g = piD.p r := by intro r x dsimp [wR, piD, rationalGridDesignOf, rationalGridWeightToReal] exact_mod_cast hpr.2.1 r x unfold upperCertificate apply ciSup_le intro m have hbary := (rationalOrbitModel c).conditionalBarycenter_risk_le piD wR (fun g => (gammaMC M c g : ℝ)) 0 hw hocc m have hdelta (r : AllocVec K n) (x : ObsVec r) : delta r x = conditionalBarycenter piD wR (fun g => (gammaMC M c g : ℝ)) 0 r x := by simpa [piD, wR] using gridBarycenter_eq_conditionalBarycenter c pi (rationalGridWeightToReal M wQ) delta hpr.2.2.1 hpr.1 hbar r x calc (∑ r, (pi r : ℝ) * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * (delta r x - (tauCountRat c m : ℝ)) ^ 2) ≤ ∑ r, ∑ x : ObsVec r, ∑ g, (orbitLik m r x : ℝ) * wR r x g * ((gammaMC M c g : ℝ) - tauCount (ratContrastToReal c) m) ^ 2 := by simpa [piD, rationalGridDesignOf, rationalOrbitModel, hdelta, tauCountRat_cast] using hbary _ ≤ (u : ℝ) := by rw [← tauCountRat_cast] dsimp [wR, rationalGridWeightToReal] exact_mod_cast hpr.2.2.2.2 m
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.upperCertificate_le_gridObjective · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:382
theorem rhoN_le_upperCertificate

the grid resolution is positive, the delta condition holds, the stated side condition holds, the stated side condition holds, the rho n is at most upper certificate.

Formal statement
K :
shared
M :
shared
n :
shared
c :
hM :
0 < M
pi :
GridPi K n
w :
delta :
∀ r : AllocVec K n
if
then
hprimal :
∃ wQ : RationalGridWeight K n M,
∃ u : ℚ, w = rationalGridWeightToReal M wQ ∧ GridLPFeasible K n M c pi wQ u
hbar :
IsGridBarycenter c pi w delta
rhoN K n (ratContrastToReal c) ≤ upperCertificate c pi delta
Proof (Lean source)
lemma rhoN_le_upperCertificate (c : RatContrast K) (hM : 0 < M) (pi : GridPi K n) (w : GridWeight K n M) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ) (hprimal : ∃ wQ : RationalGridWeight K n M, ∃ u : ℚ, w = rationalGridWeightToReal M wQ ∧ GridLPFeasible K n M c pi wQ u) (hbar : IsGridBarycenter c pi w delta) : rhoN K n (ratContrastToReal c) ≤ upperCertificate c pi delta := by classical rcases hprimal with ⟨wQ, u, rfl, hpr⟩ have hK := rationalContrast_admissibleArmCount c have hKpos : 0 < K := by unfold AdmissibleArmCount at hK; omega letI : Nonempty (Arm K) := Fintype.card_pos_iff.mp (by simpa using hKpos) letI : Nonempty (AllocVec K n) := ⟨assignmentCounts (fun _ => choice inferInstance)⟩ letI : Nonempty (CountVec K n) := ⟨scheduleCounts (fun _ _ => false)⟩ let piD := rationalGridDesignOf pi hpr.2.2.1 hpr.1 let wR : GridWeight K n M := rationalGridWeightToReal M wQ have hw : ∀ r x g, 0 ≤ wR r x g := by intro r x g dsimp [wR, rationalGridWeightToReal] exact_mod_cast hpr.2.2.2.1 r x g have hocc : ∀ r x, ∑ g, wR r x g = piD.p r := by intro r x dsimp [wR, piD, rationalGridDesignOf, rationalGridWeightToReal] exact_mod_cast hpr.2.1 r x have hzero : (0 : ℝ) ∈ Icc (-Lc (ratContrastToReal c) / 2) (Lc (ratContrastToReal c) / 2) := by have := Lc_pos (ratContrastToReal c) constructor <;> linarith have hgamma (g : Fin (2 * M + 1)) : (gammaMC M c g : ℝ) ∈ Icc (-Lc (ratContrastToReal c) / 2) (Lc (ratContrastToReal c) / 2) := by simpa [hRat_cast, neg_div] using gammaMC_mem_gridInterval c hM g let q := barycenterProcedure piD wR (fun g => (gammaMC M c g : ℝ)) 0 hw hocc hzero hgamma have hdelta (r : AllocVec K n) (x : ObsVec r) : delta r x = (q.decision r x : ℝ) := by change delta r x = conditionalBarycenter piD wR (fun g => (gammaMC M c g : ℝ)) 0 r x simpa [piD, wR] using gridBarycenter_eq_conditionalBarycenter c pi (rationalGridWeightToReal M wQ) delta hpr.2.2.1 hpr.1 hbar r x calc rhoN K n (ratContrastToReal c) = orbitGameValue K n (ratContrastToReal c) := (exact_response_type_game K n (ratContrastToReal c) hK).2.2.2.1 _ = minimaxValue (risk (l := -Lc (ratContrastToReal c) / 2) (u := Lc (ratContrastToReal c) / 2) (rationalOrbitModel (n := n) c).P (rationalOrbitModel (n := n) c).tau) := (orbitModel_minimax_eq_orbitGameValue (n := n) c).symm _ ≤ worstCaseRisk (risk (rationalOrbitModel (n := n) c).P (rationalOrbitModel (n := n) c).tau) q := minimaxValue_le_worstCaseRisk_of_nonneg (fun q' m => risk_nonneg (rationalOrbitModel (n := n) c).P (rationalOrbitModel (n := n) c).tau (rationalOrbitModel (n := n) c).P_nonneg q' m) q _ = upperCertificate c pi delta := by unfold worstCaseRisk upperCertificate congr with m unfold risk apply Finset.sum_congr rfl intro r _ apply congrArg (fun z : ℝ => (pi r : ℝ) * z) apply Finset.sum_congr rfl intro x _ rw [← hdelta r x, tauCountRat_cast] rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rhoN_le_upperCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:429
theorem gridDualObjective_le_fixedGridBayesRisk

the dual vector is feasible, the grid dual objective is at most fixed grid bayes risk.

Formal statement
K :
shared
n :
shared
M :
shared
c :
hy :
r :
gsel :
ObsVec r → Fin (2 * M + 1)
≤ ∑ m, (y.risk m : ℝ) * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * ((gammaMC M c (gsel x) : ℝ) - (tauCountRat c m : ℝ)) ^ 2
Proof (Lean source)
lemma gridDualObjective_le_fixedGridBayesRisk (c : RatContrast K) (y : GridDualMultipliers K n M) (hy : GridDualFeasible c y) (r : AllocVec K n) (gsel : ObsVec r → Fin (2 * M + 1)) : gridDualObjective y ≤ ∑ m, (y.risk m : ℝ) * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * ((gammaMC M c (gsel x) : ℝ) - (tauCountRat c m : ℝ)) ^ 2 := by classical let alpha : ObsVec r → ℚ := fun x => y.occupancyUpper r x - y.occupancyLower r x have hx (x : ObsVec r) : -alpha x ≤ ∑ m, y.risk m * orbitLik m r x * (gammaMC M c (gsel x) - tauCountRat c m) ^ 2 := by have hs := hy.2.2.2.2.2.2.2.2 r x (gsel x) have hw := hy.2.2.2.2.1 r x (gsel x) dsimp [alpha] linarith have hsum := Finset.sum_le_sum (fun x (_ : x ∈ (Finset.univ : Finset (ObsVec r))) => hx x) have hnorm := hy.2.2.2.2.2.2.2.1 r have hpi := hy.2.2.2.1 r have hq : gridDualObjective y ≤ ∑ x, ∑ m, y.risk m * orbitLik m r x * (gammaMC M c (gsel x) - tauCountRat c m) ^ 2 := by calc gridDualObjective y = -(∑ x, (y.occupancyUpper r x - y.occupancyLower r x)) - y.piNonnegative r := by unfold gridDualObjective linarith _ ≤ -(∑ x, (y.occupancyUpper r x - y.occupancyLower r x)) := by linarith _ = ∑ x, -(y.occupancyUpper r x - y.occupancyLower r x) := by rw [Finset.sum_neg_distrib] _ ≤ ∑ x, ∑ m, y.risk m * orbitLik m r x * (gammaMC M c (gsel x) - tauCountRat c m) ^ 2 := hsum exact_mod_cast (show gridDualObjective y ≤ ∑ m, y.risk m * ∑ x : ObsVec r, orbitLik m r x * (gammaMC M c (gsel x) - tauCountRat c m) ^ 2 by calc gridDualObjective y ≤ ∑ x, ∑ m, y.risk m * orbitLik m r x * (gammaMC M c (gsel x) - tauCountRat c m) ^ 2 := hq _ = ∑ m, y.risk m * ∑ x : ObsVec r, orbitLik m r x * (gammaMC M c (gsel x) - tauCountRat c m) ^ 2 := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro m _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ ring)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridDualObjective_le_fixedGridBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:504
theorem gridObjective_le_lowerCertificate_add_mesh

the population size is positive, the grid resolution is positive, the stated side condition holds, the grid objective is at most lower certificate add mesh.

Formal statement
K :
shared
n :
shared
M :
shared
c :
hn :
0 < n
hM :
0 < M
pi :
GridPi K n
w :
u :
nu :
CountVec K n → ℚ
hcert :
(u : ℝ) ≤ lowerCertificate c nu + C0 (ratContrastToReal c) / (4 * (M : ℝ) ^ 2)
Proof (Lean source)
lemma gridObjective_le_lowerCertificate_add_mesh (c : RatContrast K) (hn : 0 < n) (hM : 0 < M) (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ) (hcert : ExactGridPrimalDualCertificate c pi w u nu) : (u : ℝ) ≤ lowerCertificate c nu + C0 (ratContrastToReal c) / (4 * (M : ℝ) ^ 2) := by classical rcases hcert with ⟨wQ, y, hw, hpr, hy, hnuEq, hu⟩ subst nu have hnu : IsRationalPrior y.risk := ⟨hy.2.2.2.2.2.1, hy.2.2.2.2.2.2.1⟩ let Mdl := rationalOrbitModel (n := n) c let prior := rationalPriorOf y.risk hnu let err : ℝ := (hRat c : ℝ) ^ 2 / (4 * (M : ℝ) ^ 2) have hper (r : AllocVec K n) : (u : ℝ) ≤ (allocationBayesRisk c y.risk r : ℝ) + err := by let gsel : ObsVec r → Fin (2 * M + 1) := fun x => choose (nearest_grid_error c M hM (Mdl.posteriorMean prior r x) (posteriorMean_mem_gridInterval c y.risk hnu hn r x)) have hgsel (x : ObsVec r) : |Mdl.posteriorMean prior r x - (gammaMC M c (gsel x) : ℝ)| ≤ (hRat c : ℝ) / (2 * M) := Classical.choose_spec (nearest_grid_error c M hM (Mdl.posteriorMean prior r x) (posteriorMean_mem_gridInterval c y.risk hnu hn r x)) have hdual := gridDualObjective_le_fixedGridBayesRisk c y hy r gsel rw [← hu] at hdual have hsquare := Mdl.squaredRisk_eq_posteriorResidual_add prior r (fun x => (gammaMC M c (gsel x) : ℝ)) have hround : ∑ x : ObsVec r, Mdl.predictiveMass prior r x * ((gammaMC M c (gsel x) : ℝ) - Mdl.posteriorMean prior r x) ^ 2 ≤ err := by calc _ ≤ ∑ x : ObsVec r, Mdl.predictiveMass prior r x * ((hRat c : ℝ) / (2 * M)) ^ 2 := by apply Finset.sum_le_sum intro x _ have habs := hgsel x rw [abs_sub_comm] at habs apply mul_le_mul_of_nonneg_left _ (Mdl.predictiveMass_nonneg prior r x) apply (sq_le_sq).2 have hhQ : (0 : ℚ) ≤ hRat c := by unfold hRat LcRat; positivity have hh : (0 : ℝ) ≤ (hRat c : ℝ) := by exact_mod_cast hhQ have hb : (0 : ℝ) ≤ (hRat c : ℝ) / (2 * M) := by positivity simpa [abs_of_nonneg hb] using habs _ = err := by rw [← Finset.sum_mul, Mdl.sum_predictiveMass] dsimp [err] field_simp ring have hrisk : ∑ m, prior.p m * ∑ x : ObsVec r, Mdl.P m r x * ((gammaMC M c (gsel x) : ℝ) - Mdl.tau m) ^ 2 ≤ (allocationBayesRisk c y.risk r : ℝ) + err := by rw [hsquare, posteriorResidual_eq_allocationBayesRisk c y.risk hnu r] simpa [add_comm] using (add_le_add_left hround (allocationBayesRisk c y.risk r : ℝ)) calc (u : ℝ) ≤ ∑ m, (y.risk m : ℝ) * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * ((gammaMC M c (gsel x) : ℝ) - (tauCountRat c m : ℝ)) ^ 2 := hdual _ ≤ (allocationBayesRisk c y.risk r : ℝ) + err := by simpa [prior, Mdl, rationalPriorOf, rationalOrbitModel, tauCountRat_cast] using hrisk have hne : ({v : ℝ | ∃ r : AllocVec K n, v = (allocationBayesRisk c y.risk r : ℝ)}).Nonempty := by let r : AllocVec K n := assignmentCounts (fun _ => (choice (show Nonempty (Arm K) from Fintype.card_pos_iff.mp (by have hK := rationalContrast_admissibleArmCount c unfold AdmissibleArmCount at hK simpa using (show 0 < K by omega))))) exact ⟨_, r, rfl⟩ have hinf : (u : ℝ) - err ≤ lowerCertificate c y.risk := by unfold lowerCertificate apply le_csInf hne rintro v ⟨r, rfl⟩ linarith [hper r] dsimp [err] at hinf ⊢ rw [hRat_sq_eq_C0] at hinf linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridObjective_le_lowerCertificate_add_mesh · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalGridCertificateFinite.lean:556
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.RationalLPBridge 41 declarations Exact finite-dimensional encoding of the rational grid program.

Exact finite-dimensional encoding of the rational grid program. The bridge uses rational LP attainment to show that the real infimum is attained at a rational feasible objective value.

def instDecidableEq_causalSmith

The inst decidable equals causal smith.

Definition (Lean source)
noncomputable local instance (priority := low) {α : Type} : DecidableEq α := Classical.decEq α
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instDecidableEq_causalSmith · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:14

The grid-program variable index is the disjoint union of the epigraph coordinate, allocation masses, and allocation–observation–action weights.

Definition (Lean source)
K n M :
GV K n M :
Type
PUnit ⊕ (AllocVec K n ⊕ (Σ r : AllocVec K n, ObsVec r × Fin (2 * M + 1)))
def gvEquiv

The gv equiv property holds.

Definition (Lean source)
K n M :
gvEquiv K n M :
GV K n M ≃ Fin (card (GV K n M))
Fintype.equivFin _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gvEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:24
def gvDecode

The gv decode property holds.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
x :
Fin (card (GV K n M)) → ℚ
gvDecode x :
GV K n M → ℚ
fun v => x (gvEquiv K n M v)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gvDecode · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:29
theorem gvDot_eq

the gv dot equals property holds.

Formal statement
K :
shared
n :
shared
M :
shared
a :
GV K n M → ℚ
x :
Fin (card (GV K n M)) → ℚ
dotProduct (fun j => a ((gvEquiv K n M).symm j)) x = ∑ v, a v * gvDecode x v
Proof (Lean source)
lemma gvDot_eq (a : GV K n M → ℚ) (x : Fin (card (GV K n M)) → ℚ) : dotProduct (fun j => a ((gvEquiv K n M).symm j)) x = ∑ v, a v * gvDecode x v := by unfold dotProduct gvDecode exact Fintype.sum_equiv (gvEquiv K n M).symm _ _ (fun _ => by simp)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gvDot_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:34
def objCoeff

The obj coeff property holds.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
objCoeff :
GV K n M → ℚ
clause 1
| .inl _ => 1
clause 2
| .inr _ => 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.objCoeff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:44
theorem sum_objCoeff

the sums obj coeff.

Formal statement
K :
shared
n :
shared
M :
shared
z :
GV K n M → ℚ
∑ v, objCoeff v * z v = z (.inl unit)
Proof (Lean source)
lemma sum_objCoeff (z : GV K n M → ℚ) : ∑ v, objCoeff v * z v = z (.inl unit) := by rw [Fintype.sum_sum_type] simp [objCoeff]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.sum_objCoeff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:50
inductive GR

The grid-program row index distinguishes normalization, nonnegativity, occupancy, and risk constraints.

Definition (Lean source)
inductive GR (K n M : ℕ) where | norm (lower : Bool) | occ (r : AllocVec K n) (x : ObsVec r) (lower : Bool) | piNonneg (r : AllocVec K n) | wNonneg (r : AllocVec K n) (x : ObsVec r) (g : Fin (2 * M + 1)) | risk (m : CountVec K n) deriving Fintype
instance instFintypeGR

The grid-program row index type is finite.

Definition (Lean source)
deriving Fintype
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeGR · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:64
def rowCoeff

The row coeff property holds.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
c :
rowCoeff c :
GR K n M → GV K n M → ℚ
clause 1
| .norm lower, .inr (.inl _) => if lower then -1 else 1
clause 2
| .occ r x lower, .inr (.inl r') => if r' = r then (if lower then 1 else -1) else 0
clause 3
| .occ r x lower, .inr (.inr ⟨r', (x', _)⟩)
=> if h : r' = r then if h ▸ x' = x then (if lower then -1 else 1) else 0 else 0
clause 4
| .piNonneg r, .inr (.inl r') => if r' = r then -1 else 0
clause 5
| .wNonneg r x g, .inr (.inr ⟨r', (x', g')⟩) => if h : r' = r then if h ▸ x' = x ∧
g' = g then -1 else 0 else 0
clause 6
| .risk m, .inl _ => -1
clause 7
| .risk m, .inr (.inr ⟨r, (x, g)⟩)
=> orbitLik m r x * (gammaMC M c g - tauCountRat c m) ^ 2
clause 8
| _, _ => 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rowCoeff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:70
def rowBound

The row bound property holds.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
rowBound :
GR K n M → ℚ
clause 1
| .norm false => 1
clause 2
| .norm true => -1
clause 3
| _ => 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rowBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:88
def gridProgram

The rational grid program minimizes its epigraph coordinate subject to normalization, nonnegativity, occupancy, and risk inequalities.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
c :
gridProgram c :
Program (GR K n M) (card (GV K n M))
clause 1
A i j := rowCoeff c i ((gvEquiv K n M).symm j)
clause 2
clause 3
c j := objCoeff ((gvEquiv K n M).symm j)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:95
def encodePoint

A paper-level primal point is encoded as a vector of rational grid-program variables.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
pi :
GridPi K n
w :
u :
encodePoint pi w u :
Fin (card (GV K n M)) → ℚ
fun j
=> match (gvEquiv K n M).symm j with | .inl _ => u | .inr (.inl r) => pi r | .inr (.inr ⟨r, (x, g)⟩) => w r x g
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.encodePoint · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:103
def decodeU

The decoded epigraph coordinate is the grid-program vector’s distinguished scalar entry.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
x :
Fin (card (GV K n M)) → ℚ
decodeU x :
gvDecode x (.inl unit)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decodeU · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:112
def decodePi

The decoded allocation mass reads the corresponding allocation coordinate of a grid-program vector.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
x :
Fin (card (GV K n M)) → ℚ
decodePi x :
GridPi K n
fun r => gvDecode x (.inr (.inl r))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decodePi · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:117
def decodeW

The decoded joint weight reads the corresponding allocation–observation–action coordinate of a grid-program vector.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
x :
Fin (card (GV K n M)) → ℚ
decodeW x :
fun r y g => gvDecode x (.inr (.inr ⟨r, (y, g)⟩))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decodeW · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:122
theorem dot_norm

the dot norm property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
lower :
dotProduct ((gridProgram c).A (.norm lower)) x
= if lower then -∑ r, decodePi x r else ∑ r, decodePi x r
Proof (Lean source)
lemma dot_norm (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) (lower : Bool) : dotProduct ((gridProgram c).A (.norm lower)) x = if lower then -∑ r, decodePi x r else ∑ r, decodePi x r := by change dotProduct (fun j => rowCoeff c (.norm lower) ((gvEquiv K n M).symm j)) x = _ rw [gvDot_eq, Fintype.sum_sum_type, Fintype.sum_sum_type] simp [rowCoeff, decodePi, gvDecode]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dot_norm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:127
theorem dot_piNonneg

the dot pi is nonnegative.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
r :
dotProduct ((gridProgram c).A (.piNonneg r)) x = -decodePi x r
Proof (Lean source)
lemma dot_piNonneg (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) (r : AllocVec K n) : dotProduct ((gridProgram c).A (.piNonneg r)) x = -decodePi x r := by change dotProduct (fun j => rowCoeff c (.piNonneg r) ((gvEquiv K n M).symm j)) x = _ rw [gvDot_eq, Fintype.sum_sum_type, Fintype.sum_sum_type] simp [rowCoeff, decodePi, gvDecode]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dot_piNonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:138
theorem dot_wNonneg

the dot w is nonnegative.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
r :
y :
g :
Fin (2 * M + 1)
dotProduct ((gridProgram c).A (.wNonneg r y g)) x = -decodeW x r y g
Proof (Lean source)
lemma dot_wNonneg (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) (r : AllocVec K n) (y : ObsVec r) (g : Fin (2 * M + 1)) : dotProduct ((gridProgram c).A (.wNonneg r y g)) x = -decodeW x r y g := by change dotProduct (fun j => rowCoeff c (.wNonneg r y g) ((gvEquiv K n M).symm j)) x = _ rw [gvDot_eq, Fintype.sum_sum_type, Fintype.sum_sum_type, Fintype.sum_sigma] simp only [Fintype.sum_prod_type] simp [rowCoeff, decodeW, gvDecode] change (∑ y' ∈ (Finset.univ : Finset (ObsVec r)), (∑ g' ∈ (Finset.univ : Finset (Fin (2 * M + 1))), if y' = y ∧ g' = g then -x (gvEquiv K n M (.inr (.inr ⟨r, (y', g')⟩))) else 0)) = _ calc _ = ∑ g' ∈ (Finset.univ : Finset (Fin (2 * M + 1))), if y = y ∧ g' = g then -x (gvEquiv K n M (.inr (.inr ⟨r, (y, g')⟩))) else 0 := by apply Finset.sum_eq_single y · intro y' _ hy simp [hy] · simp _ = (if y = y ∧ g = g then -x (gvEquiv K n M (.inr (.inr ⟨r, (y, g)⟩))) else 0) := by apply Finset.sum_eq_single g · intro g' _ hg simp [hg] · simp _ = _ := by simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dot_wNonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:148
theorem dot_occ

the dot occ property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
r :
y :
lower :
dotProduct ((gridProgram c).A (.occ r y lower)) x
= if lower then decodePi x r
- ∑ g, decodeW x r y g else ∑ g, decodeW x r y g
- decodePi x r
Proof (Lean source)
lemma dot_occ (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) (r : AllocVec K n) (y : ObsVec r) (lower : Bool) : dotProduct ((gridProgram c).A (.occ r y lower)) x = if lower then decodePi x r - ∑ g, decodeW x r y g else ∑ g, decodeW x r y g - decodePi x r := by change dotProduct (fun j => rowCoeff c (.occ r y lower) ((gvEquiv K n M).symm j)) x = _ rw [gvDot_eq, Fintype.sum_sum_type, Fintype.sum_sum_type, Fintype.sum_sigma] simp only [Fintype.sum_prod_type] simp [rowCoeff, decodePi, decodeW, gvDecode] cases lower <;> simp <;> ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dot_occ · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:179
theorem dot_risk

the dot risk property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
m :
dotProduct ((gridProgram c).A (.risk m)) x
= (∑ r, ∑ y, ∑ g, orbitLik m r y * decodeW x r y g * (gammaMC M c g - tauCountRat c m) ^ 2)
Proof (Lean source)
lemma dot_risk (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) (m : CountVec K n) : dotProduct ((gridProgram c).A (.risk m)) x = (∑ r, ∑ y, ∑ g, orbitLik m r y * decodeW x r y g * (gammaMC M c g - tauCountRat c m) ^ 2) - decodeU x := by change dotProduct (fun j => rowCoeff c (.risk m) ((gvEquiv K n M).symm j)) x = _ rw [gvDot_eq, Fintype.sum_sum_type, Fintype.sum_sum_type, Fintype.sum_sigma] simp only [Fintype.sum_prod_type] simp [rowCoeff, decodeW, decodeU, gvDecode] rw [sub_eq_add_neg, add_comm] congr 1 apply Finset.sum_congr rfl intro r _ apply Finset.sum_congr rfl intro y _ apply Finset.sum_congr rfl intro g _ ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dot_risk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:194
theorem decode_encode_u

the decode encode u property holds.

Formal statement
K :
shared
n :
shared
M :
shared
pi :
GridPi K n
w :
u :
gvDecode (encodePoint pi w u) (.inl unit) = u
Proof (Lean source)
lemma decode_encode_u (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ) : gvDecode (encodePoint pi w u) (.inl unit) = u := by simp [gvDecode, encodePoint]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decode_encode_u · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:216
theorem gridProgram_objective_encode

the grid program objective encode property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
pi :
GridPi K n
w :
u :
Proof (Lean source)
lemma gridProgram_objective_encode (c : RatContrast K) (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ) : (gridProgram c).objective (encodePoint pi w u) = u := by rw [objective] change dotProduct (fun j => objCoeff ((gvEquiv K n M).symm j)) (encodePoint pi w u) = u rw [gvDot_eq, sum_objCoeff] exact decode_encode_u pi w u
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_objective_encode · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:221
theorem gridProgram_objective

the grid program objective property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
Proof (Lean source)
lemma gridProgram_objective (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) : (gridProgram c).objective x = decodeU x := by rw [objective] change dotProduct (fun j => objCoeff ((gvEquiv K n M).symm j)) x = _ rw [gvDot_eq, sum_objCoeff] rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_objective · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:232
theorem gridProgram_feasible_iff

the grid program feasible if and only if property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
x :
Fin (card (GV K n M)) → ℚ
(gridProgram c).PrimalFeasible x
GridLPFeasible K n M c (decodePi x) (decodeW x) (decodeU x)
Proof (Lean source)
lemma gridProgram_feasible_iff (c : RatContrast K) (x : Fin (card (GV K n M)) → ℚ) : (gridProgram c).PrimalFeasible x ↔ GridLPFeasible K n M c (decodePi x) (decodeW x) (decodeU x) := by constructor · intro hx have hnormU := hx (.norm false) have hnormL := hx (.norm true) rw [dot_norm] at hnormU hnormL simp [gridProgram, rowBound] at hnormU hnormL refine ⟨le_antisymm hnormU (by linarith), ?_, ?_, ?_, ?_⟩ · intro r y have hu := hx (.occ r y false) have hl := hx (.occ r y true) rw [dot_occ] at hu hl simp [gridProgram, rowBound] at hu hl linarith · intro r have h := hx (.piNonneg r) rw [dot_piNonneg] at h simp [gridProgram, rowBound] at h linarith · intro r y g have h := hx (.wNonneg r y g) rw [dot_wNonneg] at h simp [gridProgram, rowBound] at h linarith · intro m have h := hx (.risk m) rw [dot_risk] at h simp [gridProgram, rowBound] at h linarith · intro h row cases row with | norm lower => rw [dot_norm] cases lower <;> simp [gridProgram, rowBound, h.1] <;> linarith | occ r y lower => rw [dot_occ] cases lower <;> simp [gridProgram, rowBound, h.2.1 r y] <;> linarith | piNonneg r => rw [dot_piNonneg] simp [gridProgram, rowBound] exact h.2.2.1 r | wNonneg r y g => rw [dot_wNonneg] simp [gridProgram, rowBound] exact h.2.2.2.1 r y g | risk m => rw [dot_risk] simp [gridProgram, rowBound] exact h.2.2.2.2 m
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_feasible_iff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:243
theorem decode_encode_pi

the decode encode pi property holds.

Formal statement
K :
shared
n :
shared
M :
shared
pi :
GridPi K n
w :
u :
decodePi (encodePoint pi w u) = pi
Proof (Lean source)
lemma decode_encode_pi (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ) : decodePi (encodePoint pi w u) = pi := by funext r simp [decodePi, gvDecode, encodePoint]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decode_encode_pi · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:298
theorem decode_encode_w

the decode encode w property holds.

Formal statement
K :
shared
n :
shared
M :
shared
pi :
GridPi K n
w :
u :
decodeW (encodePoint pi w u) = w
Proof (Lean source)
lemma decode_encode_w (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ) : decodeW (encodePoint pi w u) = w := by funext r y g simp [decodeW, gvDecode, encodePoint]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.decode_encode_w · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:305
theorem gridProgram_encode_feasible

the grid program encode feasible property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
pi :
GridPi K n
w :
u :
h :
GridLPFeasible K n M c pi w u
(gridProgram c).PrimalFeasible (encodePoint pi w u)
Proof (Lean source)
lemma gridProgram_encode_feasible (c : RatContrast K) {pi : GridPi K n} {w : RationalGridWeight K n M} {u : ℚ} (h : GridLPFeasible K n M c pi w u) : (gridProgram c).PrimalFeasible (encodePoint pi w u) := by rw [gridProgram_feasible_iff, decode_encode_pi, decode_encode_w] change GridLPFeasible K n M c pi w (gvDecode (encodePoint pi w u) (.inl unit)) rw [decode_encode_u] exact h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_encode_feasible · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:312
theorem gridLPFeasible_u_nonneg

the grid lpfeasible u is nonnegative.

Formal statement
K :
shared
n :
shared
M :
shared
c :
shared
pi :
GridPi K n
w :
u :
h :
GridLPFeasible K n M c pi w u
0 ≤ u
Proof (Lean source)
lemma gridLPFeasible_u_nonneg {pi : GridPi K n} {w : RationalGridWeight K n M} {u : ℚ} (h : GridLPFeasible K n M c pi w u) : 0 ≤ u := by let m₀ : CountVec K n := scheduleCounts (fun _ _ => false) calc 0 ≤ ∑ r, ∑ x, ∑ g, orbitLik m₀ r x * w r x g * (gammaMC M c g - tauCountRat c m₀) ^ 2 := by apply sum_nonneg intro r _ apply sum_nonneg intro x _ apply sum_nonneg intro g _ exact mul_nonneg (mul_nonneg (orbitLik_nonneg m₀ r x) (h.2.2.2.1 r x g)) (sq_nonneg _) _ ≤ u := h.2.2.2.2 m₀
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPFeasible_u_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:324
theorem gridLPFeasible_exists

the grid resolution is positive, the grid lpfeasible exists.

Formal statement
K :
shared
M :
shared
n :
shared
c :
hM :
0 < M
∃ (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ), GridLPFeasible K n M c pi w u
Proof (Lean source)
lemma gridLPFeasible_exists (c : RatContrast K) (hM : 0 < M) : ∃ (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ), GridLPFeasible K n M c pi w u := by classical have hK : K ≠ 0 := by intro hzero apply c.nonzero funext a exact elim0 (hzero ▸ a) letI : Nonempty (Arm K) := Fintype.card_pos_iff.mp (by simpa using Nat.pos_of_ne_zero hK) let r₀ : AllocVec K n := assignmentCounts (fun _ => choice inferInstance) let g₀ : Fin (2 * M + 1) := ⟨M, by omega⟩ let pi : GridPi K n := fun r => if r = r₀ then 1 else 0 let w : RationalGridWeight K n M := fun r _ g => if r = r₀ ∧ g = g₀ then 1 else 0 let risk : CountVec K n → ℚ := fun m => ∑ r, ∑ x, ∑ g, orbitLik m r x * w r x g * (gammaMC M c g - tauCountRat c m) ^ 2 let u : ℚ := ∑ m, risk m refine ⟨pi, w, u, ?_, ?_, ?_, ?_, ?_⟩ · simp [pi] · intro r x by_cases hr : r = r₀ · subst r simp [pi, w] · simp [pi, w, hr] · intro r dsimp [pi] split <;> norm_num · intro r x g dsimp [w] split <;> norm_num · intro m change risk m ≤ u apply Finset.single_le_sum · intro m' _ dsimp [risk] apply sum_nonneg intro r _ apply sum_nonneg intro x _ apply sum_nonneg intro g _ apply mul_nonneg · apply mul_nonneg (orbitLik_nonneg m' r x) dsimp [w] split <;> norm_num · exact sq_nonneg _ · exact Finset.mem_univ m
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPFeasible_exists · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:342
theorem gridProgram_bounded_below

the grid program bounded below property holds.

Formal statement
K n M :
c :
∃ l : ℚ,
∀ x : Fin (card (GV K n M)) → ℚ,
(gridProgram (n := n) (M := M) c).PrimalFeasible x → l
≤ (gridProgram (n := n) (M := M) c).objective x
Proof (Lean source)
lemma gridProgram_bounded_below (K n M : ℕ) (c : RatContrast K) : ∃ l : ℚ, ∀ x : Fin (card (GV K n M)) → ℚ, (gridProgram (n := n) (M := M) c).PrimalFeasible x → l ≤ (gridProgram (n := n) (M := M) c).objective x := by refine ⟨0, ?_⟩ intro x hx rw [gridProgram_objective] exact gridLPFeasible_u_nonneg ((gridProgram_feasible_iff c x).mp hx)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_bounded_below · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:395
theorem gridLP_rational_value_exists

the population size is positive, the grid resolution is positive, the grid lp rational value exists.

Formal statement
K n M :
c :
hn :
0 < n
hM :
0 < M
∃ q : ℚ, (q : ℝ) = gridLPValue K n M c hn hM
Proof (Lean source)
lemma gridLP_rational_value_exists (K n M : ℕ) (c : RatContrast K) (hn : 0 < n) (hM : 0 < M) : ∃ q : ℚ, (q : ℝ) = gridLPValue K n M c hn hM := by classical obtain ⟨pi₀, w₀, u₀, hfeas₀⟩ := gridLPFeasible_exists (n := n) c hM let P : Program (GR K n M) (card (GV K n M)) := gridProgram (n := n) (M := M) c have hne : ∃ x : Fin (card (GV K n M)) → ℚ, P.PrimalFeasible x := ⟨encodePoint pi₀ w₀ u₀, gridProgram_encode_feasible c hfeas₀⟩ obtain ⟨xStar, hxStar, hopt⟩ := exists_rational_primal_optimizer P hne (by simpa [P] using gridProgram_bounded_below K n M c) let q : ℚ := P.objective xStar have hqdecode : q = decodeU xStar := gridProgram_objective c xStar have hfeasStar : GridLPFeasible K n M c (decodePi xStar) (decodeW xStar) q := by rw [hqdecode] exact (gridProgram_feasible_iff c xStar).mp hxStar let S : Set ℝ := {v : ℝ | ∃ (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ), GridLPFeasible K n M c pi w u ∧ v = (u : ℝ)} have hSnonempty : S.Nonempty := by exact ⟨(u₀ : ℝ), pi₀, w₀, u₀, hfeas₀, rfl⟩ have hSbounded : BddBelow S := by refine ⟨0, ?_⟩ rintro v ⟨pi, w, u, hfeas, rfl⟩ exact_mod_cast gridLPFeasible_u_nonneg hfeas refine ⟨q, ?_⟩ change (q : ℝ) = sInf S apply le_antisymm · apply le_csInf hSnonempty rintro v ⟨pi, w, u, hfeas, rfl⟩ have hqle : q ≤ u := by dsimp [q] calc P.objective xStar ≤ P.objective (encodePoint pi w u) := hopt (encodePoint pi w u) (gridProgram_encode_feasible c hfeas) _ = u := by dsimp [P] exact gridProgram_objective_encode c pi w u exact_mod_cast hqle · apply csInf_le hSbounded exact ⟨decodePi xStar, decodeW xStar, q, hfeasStar, rfl⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLP_rational_value_exists · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:408
def gridLPValueRat

The exact rational representative supplied by rational LP attainment.

Definition (Lean source)
K n M :
c :
hn :
0 < n
hM :
0 < M
gridLPValueRat K n M c hn hM :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValueRat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:451
theorem gridLP_u_nonneg

Compatibility name for nonnegativity derived from a risk row.

Formal statement
K :
shared
n :
shared
M :
shared
c :
shared
pi :
GridPi K n
w :
u :
h :
GridLPFeasible K n M c pi w u
0 ≤ u
Proof (Lean source)
-- @node: gridLP_u_nonneg lemma gridLP_u_nonneg {pi : GridPi K n} {w : RationalGridWeight K n M} {u : ℚ} (h : GridLPFeasible K n M c pi w u) : 0 ≤ u := gridLPFeasible_u_nonneg h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLP_u_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:457
theorem gridLPValue_le_rat

the population size is positive, the grid resolution is positive, A rational optimizer coerces to a real feasible objective value.

Formal statement
n :
shared
M :
shared
K :
shared
hn :
0 < n
hM :
0 < M
gridLPValue K n M c hn hM ≤ (gridLPValueRat K n M c hn hM : ℝ)
Proof (Lean source)
-- @node: gridLPValue_le_rat lemma gridLPValue_le_rat (hn : 0 < n) (hM : 0 < M) : gridLPValue K n M c hn hM ≤ (gridLPValueRat K n M c hn hM : ℝ) := by exact le_of_eq (Classical.choose_spec (gridLP_rational_value_exists K n M c hn hM)).symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValue_le_rat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:463
theorem gridLP_dual_bound_real

the population size is positive, the grid resolution is positive, Rational dual multipliers lower-bound every real feasible point.

Formal statement
n :
shared
M :
shared
K :
shared
hn :
0 < n
hM :
0 < M
(gridLPValueRat K n M c hn hM : ℝ) ≤ gridLPValue K n M c hn hM
Proof (Lean source)
-- @node: gridLP_dual_bound_real lemma gridLP_dual_bound_real (hn : 0 < n) (hM : 0 < M) : (gridLPValueRat K n M c hn hM : ℝ) ≤ gridLPValue K n M c hn hM := by exact le_of_eq (Classical.choose_spec (gridLP_rational_value_exists K n M c hn hM))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLP_dual_bound_real · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:469
theorem gridLPValue_eq_rat

the population size is positive, the grid resolution is positive, the grid lpvalue equals rat.

Formal statement
n :
shared
M :
shared
K :
shared
hn :
0 < n
hM :
0 < M
gridLPValue K n M c hn hM = (gridLPValueRat K n M c hn hM : ℝ)
Proof (Lean source)
lemma gridLPValue_eq_rat (hn : 0 < n) (hM : 0 < M) : gridLPValue K n M c hn hM = (gridLPValueRat K n M c hn hM : ℝ) := by exact le_antisymm (gridLPValue_le_rat hn hM) (gridLP_dual_bound_real hn hM)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValue_eq_rat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:476
theorem gridProgram_optimal_primal_dual_exists

the population size is positive, the grid resolution is positive, Rational LP strong duality supplies a feasible primal/dual pair whose primal objective is exactly the real grid-program infimum.

Formal statement
n :
shared
M :
shared
K :
shared
hn :
0 < n
hM :
0 < M
∃ (x : Fin (card (GV K n M)) → ℚ) (y : GR K n M → ℚ),
conclusion 1
(gridProgram c).PrimalFeasible x
conclusion 2
(gridProgram c).DualFeasible y
conclusion 3
(gridProgram c).objective x = (gridProgram c).dualObjective y
conclusion 4
((gridProgram c).objective x : ℝ) = gridLPValue K n M c hn hM
Proof (Lean source)
lemma gridProgram_optimal_primal_dual_exists (hn : 0 < n) (hM : 0 < M) : ∃ (x : Fin (card (GV K n M)) → ℚ) (y : GR K n M → ℚ), (gridProgram c).PrimalFeasible x ∧ (gridProgram c).DualFeasible y ∧ (gridProgram c).objective x = (gridProgram c).dualObjective y ∧ ((gridProgram c).objective x : ℝ) = gridLPValue K n M c hn hM := by classical obtain ⟨pi₀, w₀, u₀, hfeas₀⟩ := gridLPFeasible_exists (n := n) c hM let P : Program (GR K n M) (card (GV K n M)) := gridProgram (n := n) (M := M) c have hne : ∃ x : Fin (card (GV K n M)) → ℚ, P.PrimalFeasible x := ⟨encodePoint pi₀ w₀ u₀, gridProgram_encode_feasible c hfeas₀⟩ obtain ⟨x, y, hx, hy, hduality, hopt⟩ := exists_rational_optimal_primal_dual P hne (by simpa [P] using gridProgram_bounded_below K n M c) let q : ℚ := P.objective x have hqdecode : q = decodeU x := gridProgram_objective c x have hfeas : GridLPFeasible K n M c (decodePi x) (decodeW x) q := by rw [hqdecode] exact (gridProgram_feasible_iff c x).mp hx let S : Set ℝ := {v : ℝ | ∃ (pi : GridPi K n) (w : RationalGridWeight K n M) (u : ℚ), GridLPFeasible K n M c pi w u ∧ v = (u : ℝ)} have hSne : S.Nonempty := ⟨(u₀ : ℝ), pi₀, w₀, u₀, hfeas₀, rfl⟩ have hSbdd : BddBelow S := by refine ⟨0, ?_⟩ rintro v ⟨pi, w, u, hu, rfl⟩ exact_mod_cast gridLPFeasible_u_nonneg hu have hqeq : (q : ℝ) = sInf S := by apply le_antisymm · apply le_csInf hSne rintro v ⟨pi, w, u, hu, rfl⟩ have hqu : q ≤ u := by dsimp [q] calc P.objective x ≤ P.objective (encodePoint pi w u) := hopt (encodePoint pi w u) (gridProgram_encode_feasible c hu) _ = u := by simpa [P] using gridProgram_objective_encode c pi w u exact_mod_cast hqu · apply csInf_le hSbdd exact ⟨decodePi x, decodeW x, q, hfeas, rfl⟩ refine ⟨x, y, hx, hy, hduality, ?_⟩ simpa [P, q, gridLPValue, gridLPValueRaw, S] using hqeq
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_optimal_primal_dual_exists · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:482
theorem dualRiskRow_nonneg

the dual vector is feasible, Risk-row dual multipliers are nonnegative.

Formal statement
K :
shared
n :
shared
M :
shared
c :
shared
y :
GR K n M → ℚ
hy :
(gridProgram c).DualFeasible y
m :
0 ≤ y (.risk m)
Proof (Lean source)
-- @node: dualRiskRow_nonneg lemma dualRiskRow_nonneg {y : GR K n M → ℚ} (hy : (gridProgram c).DualFeasible y) : ∀ m, 0 ≤ y (.risk m) := by exact fun m => hy.1 (.risk m)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dualRiskRow_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:526
theorem dualRiskRow_sum_eq_one

the dual vector is feasible, With no epigraph sign row, stationarity at u normalizes risk multipliers.

Formal statement
K :
shared
n :
shared
M :
shared
c :
shared
y :
GR K n M → ℚ
hy :
(gridProgram c).DualFeasible y
∑ m, y (.risk m) = 1
Proof (Lean source)
-- @node: dualRiskRow_sum_eq_one lemma dualRiskRow_sum_eq_one {y : GR K n M → ℚ} (hy : (gridProgram c).DualFeasible y) : ∑ m, y (.risk m) = 1 := by classical have hu := hy.2 (gvEquiv K n M (.inl unit)) simp only [gridProgram, gvEquiv, Equiv.symm_apply_apply] at hu have hsum : (∑ i : GR K n M, y i * rowCoeff c i (.inl unit)) = ∑ m : CountVec K n, y (.risk m) * (-1) := by have hrestrict : (∑ i : GR K n M, y i * rowCoeff c i (.inl unit)) = ∑ i ∈ Finset.univ.image GR.risk, y i * rowCoeff c i (.inl unit) := by symm apply Finset.sum_subset · exact Finset.image_subset_iff.mpr (fun _ _ => Finset.mem_univ _) · intro i _ hi cases i <;> simp_all [rowCoeff] rw [hrestrict, Finset.sum_image] · simp [rowCoeff] · intro a _ b _ hab injection hab rw [hsum] at hu simp [objCoeff] at hu linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dualRiskRow_sum_eq_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:533
theorem gridProgram_dualObjective_eq_normalization

The generic program's dual objective is the difference of the two normalization-row multipliers used by the paper-level decoder.

Formal statement
K :
shared
n :
shared
M :
shared
c :
y :
GR K n M → ℚ
Proof (Lean source)
-- @node: gridProgram_dualObjective_eq_normalization lemma gridProgram_dualObjective_eq_normalization (c : RatContrast K) (y : GR K n M → ℚ) : (gridProgram c).dualObjective y = y (.norm true) - y (.norm false) := by classical rw [dualObjective] have hrestrict : (∑ i : GR K n M, y i * (gridProgram c).b i) = ∑ i ∈ Finset.univ.image GR.norm, y i * (gridProgram c).b i := by symm apply Finset.sum_subset · exact Finset.image_subset_iff.mpr (fun _ _ => Finset.mem_univ _) · intro i _ hi cases i <;> simp_all [gridProgram, rowBound] rw [hrestrict, Finset.sum_image] · simp [gridProgram, rowBound] ring · intro a _ b _ hab injection hab
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridProgram_dualObjective_eq_normalization · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/RationalLPBridge.lean:561
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.ScoreDesign 5 declarations Contrast-score moments and the explicit clipped-shrinkage procedure.

Contrast-score moments and the explicit clipped-shrinkage procedure.

Minimum nonzero normalized response-type score spacing.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
lambdaC c :
sInf {v : ℝ | ∃ t : RespType K, (∑ a, c a * if t a then 1 else 0) ≠ 0 ∧ v = |∑ a, c a * if t a then 1 else 0| / (Lc c / 2)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lambdaC · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ScoreDesign.lean:13

The contrast spacing constant is the smallest nonzero absolute normalized response-type score.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
kappaC c :
A :
sqrt (lambdaC c) / 2 - lambdaC c / 16
B :
7 * lambdaC c / 16
min A B / 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.kappaC · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ScoreDesign.lean:19

Explicit clipped shrinkage applied to the normalized contrast score.

Definition (Lean source)
K n :
c :
Contrast ℝ K
shrinkageProcedure K n c :
Procedure K n c
(base.1, fun A y => let raw := centeredContrastScore c A y let h := Lc c / 2 let X := raw / h let b := (n : ℝ) ^ (-(1 / 3 : ℝ)) let eps := sqrt (lambdaC c) / 4 * b ⟨clip c (h * (X - eps * max (-b) (min X b))), clip_mem c _⟩)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.shrinkageProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ScoreDesign.lean:25
theorem lambdaC_pos_le_one

the lambda c is positive is at most one.

Formal statement
K :
shared
c :
Contrast ℝ K
conclusion 1
0 < lambdaC c
conclusion 2
lambdaC c ≤ 1
Proof (Lean source)
lemma lambdaC_pos_le_one (c : Contrast ℝ K) : 0 < lambdaC c ∧ lambdaC c ≤ 1 := by classical let score : RespType K → ℝ := fun t => (∑ a, c a * if t a then 1 else 0) let values : Set ℝ := {v | ∃ t : RespType K, score t ≠ 0 ∧ v = |score t| / (Lc c / 2)} have hfinite : values.Finite := by apply Set.Finite.subset (Set.finite_range fun t : RespType K => |score t| / (Lc c / 2)) rintro v ⟨t, -, rfl⟩ exact ⟨t, rfl⟩ obtain ⟨a, ha⟩ : ∃ a, c a ≠ 0 := by by_contra h apply c.nonzero funext a by_contra ha exact h ⟨a, ha⟩ let t : RespType K := fun b => b = a have hscore : score t = c a := by simp [score, t] have hmem : |c a| / (Lc c / 2) ∈ values := by refine ⟨t, ?_, ?_⟩ · simpa [hscore] using ha · simp [hscore] have hnonempty : values.Nonempty := ⟨_, hmem⟩ have hinf : sInf values ∈ values := hnonempty.csInf_mem hfinite have hallpos : ∀ v ∈ values, 0 < v := by rintro v ⟨tv, htv, rfl⟩ exact div_pos (abs_pos.mpr htv) (by positivity [Lc_pos c]) have hcoeff : |c a| ≤ Lc c / 2 := by have hsum : (∑ b ∈ Finset.univ.erase a, c b) = -c a := by have hzero := c.sum_zero rw [← Finset.add_sum_erase univ c (Finset.mem_univ a)] at hzero linarith have habs := Finset.abs_sum_le_sum_abs (s := Finset.univ.erase a) (f := c) rw [hsum, abs_neg] at habs have hLc : Lc c = |c a| + ∑ b ∈ Finset.univ.erase a, |c b| := by exact (Finset.add_sum_erase univ (fun b => |c b|) (Finset.mem_univ a)).symm rw [hLc] linarith have hresult : 0 < sInf values ∧ sInf values ≤ 1 := by constructor · exact hallpos _ hinf · calc sInf values ≤ |c a| / (Lc c / 2) := csInf_le ⟨0, fun v hv => le_of_lt (hallpos v hv)⟩ hmem _ ≤ 1 := (div_le_one (by positivity [Lc_pos c])).2 hcoeff simpa only [lambdaC, values, score] using hresult
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lambdaC_pos_le_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ScoreDesign.lean:36
theorem kappaC_pos

the kappa c is positive.

Formal statement
K :
shared
c :
Contrast ℝ K
0 < kappaC c
Proof (Lean source)
lemma kappaC_pos (c : Contrast ℝ K) : 0 < kappaC c := by rcases lambdaC_pos_le_one c with ⟨hlambda, hlambda_one⟩ have hsqrt_pos : 0 < sqrt (lambdaC c) := Real.sqrt_pos.2 hlambda have hsqrt_sq : (sqrt (lambdaC c)) ^ 2 = lambdaC c := by exact Real.sq_sqrt (le_of_lt hlambda) have hA : 0 < sqrt (lambdaC c) / 2 - lambdaC c / 16 := by nlinarith [Real.sqrt_nonneg (lambdaC c)] have hB : 0 < 7 * lambdaC c / 16 := by positivity simp only [kappaC] exact div_pos (lt_min hA hB) (by norm_num)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.kappaC_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ScoreDesign.lean:86
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.ShrinkageRisk 21 declarations Finite-sample risk improvement of the clipped contrast-score shrinkage rule.

Finite-sample risk improvement of the clipped contrast-score shrinkage rule.

def normalizedUpperUnitScore

The normalized upper unit score rescales a unit’s contrast-weighted inverse-probability score by the contrast norm.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
t :
a :
Arm K
normalizedUpperUnitScore c t a :
upperUnitScore c t a / (Lc c / 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedUpperUnitScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:17
def normalizedTypeScore

The normalized response-type score is the conditional mean of the normalized upper unit score over its treatment assignment.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
t :
normalizedTypeScore c t :
(∑ a, c a * if t a then 1 else 0) / (Lc c / 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedTypeScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:22
theorem normalizedUpperUnitScore_mem_Icc

the normalized upper unit score belongs to closed interval.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
a :
Arm K
normalizedUpperUnitScore c t a ∈ Icc (-1) 1
Proof (Lean source)
lemma normalizedUpperUnitScore_mem_Icc (c : Contrast ℝ K) (t : RespType K) (a : Arm K) : normalizedUpperUnitScore c t a ∈ Icc (-1) 1 := by classical by_cases hc : c a = 0 · simp [normalizedUpperUnitScore, upperUnitScore, qStar, hc] · have hq : qStar c a ≠ 0 := div_ne_zero (abs_ne_zero.mpr hc) (ne_of_gt (Lc_pos c)) have habs : |normalizedUpperUnitScore c t a| = 1 := by simp only [normalizedUpperUnitScore, upperUnitScore, hq, if_false] simp_rw [abs_div, abs_mul] have hhalf : |(if t a then (1 : ℝ) else 0) - 1 / 2| = 1 / 2 := by by_cases ht : t a <;> simp [ht] <;> norm_num rw [hhalf] simp only [qStar, abs_div, abs_abs, abs_of_pos (Lc_pos c)] norm_num field_simp [abs_ne_zero.mpr hc, ne_of_gt (Lc_pos c)] exact abs_le.mp habs.le
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedUpperUnitScore_mem_Icc · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:27
theorem normalizedUpperUnitScore_mean

the normalized upper unit score mean property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
Proof (Lean source)
lemma normalizedUpperUnitScore_mean (c : Contrast ℝ K) (t : RespType K) : (qStarDesign c).E (normalizedUpperUnitScore c t) = normalizedTypeScore c t := by rw [show normalizedUpperUnitScore c t = fun a => (Lc c / 2)⁻¹ * upperUnitScore c t a by funext a; simp [normalizedUpperUnitScore, div_eq_mul_inv, mul_comm]] rw [E_const_mul, upperUnitScore_mean] simp [normalizedTypeScore, div_eq_mul_inv, mul_comm]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedUpperUnitScore_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:47
theorem normalizedUpperUnitScore_secondMoment

the normalized upper unit score second moment property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
(qStarDesign c).E (fun a => normalizedUpperUnitScore c t a ^ 2) = 1
Proof (Lean source)
lemma normalizedUpperUnitScore_secondMoment (c : Contrast ℝ K) (t : RespType K) : (qStarDesign c).E (fun a => normalizedUpperUnitScore c t a ^ 2) = 1 := by have hh : Lc c / 2 ≠ 0 := by positivity [Lc_pos c] rw [show (fun a => normalizedUpperUnitScore c t a ^ 2) = fun a => (Lc c / 2)⁻¹ ^ 2 * upperUnitScore c t a ^ 2 by funext a; simp [normalizedUpperUnitScore, div_eq_mul_inv]; ring] rw [E_const_mul, upperUnitScore_secondMoment] unfold C0 field_simp [ne_of_gt (Lc_pos c)] norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedUpperUnitScore_secondMoment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:57
theorem lambdaC_le_abs_normalizedTypeScore

the stated side condition holds, the lambda c is at most abs normalized type score.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
ht :
Proof (Lean source)
lemma lambdaC_le_abs_normalizedTypeScore (c : Contrast ℝ K) (t : RespType K) (ht : normalizedTypeScore c t ≠ 0) : lambdaC c ≤ |normalizedTypeScore c t| := by let s := ∑ a, c a * if t a then 1 else 0 have hs : s ≠ 0 := by intro h apply ht rw [show normalizedTypeScore c t = s / (Lc c / 2) by rfl, h] norm_num unfold lambdaC apply csInf_le · refine ⟨0, ?_⟩ rintro v ⟨u, hu, rfl⟩ exact div_nonneg (abs_nonneg _) (by positivity [Lc_pos c]) · refine ⟨t, hs, ?_⟩ have hhpos : 0 < Lc c / 2 := by positivity [Lc_pos c] rw [show normalizedTypeScore c t = s / (Lc c / 2) by rfl, abs_div, abs_of_pos hhpos]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lambdaC_le_abs_normalizedTypeScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:71
theorem normalizedTypeScore_sq_lower

the normalized type score squared lower property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
Proof (Lean source)
lemma normalizedTypeScore_sq_lower (c : Contrast ℝ K) (t : RespType K) : lambdaC c * |normalizedTypeScore c t| ≤ normalizedTypeScore c t ^ 2 := by by_cases ht : normalizedTypeScore c t = 0 · simp [ht] · calc lambdaC c * |normalizedTypeScore c t| ≤ |normalizedTypeScore c t| * |normalizedTypeScore c t| := mul_le_mul_of_nonneg_right (lambdaC_le_abs_normalizedTypeScore c t ht) (abs_nonneg _) _ = normalizedTypeScore c t ^ 2 := by rw [← sq_abs, pow_two]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedTypeScore_sq_lower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:92
theorem normalizedScore_tail_bound

the population size is positive, the stated side condition holds, the normalized score tail bound property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule K n
hn :
0 < n
u :
hu :
0 ≤ u
D :
prodDesign (fun _ : Unit n => qStarDesign c)
X :
fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) (: Assign K n → ℝ)
θ :
(n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i)
D.Pr (fun A => |X A - θ| ≥ u) ≤ 2 * exp (-(n : ℝ) * u ^ 2 / 2)
Proof (Lean source)
lemma normalizedScore_tail_bound (c : Contrast ℝ K) (z : Schedule K n) (hn : 0 < n) (u : ℝ) (hu : 0 ≤ u) : let D := prodDesign (fun _ : Unit n => qStarDesign c) let X : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) let θ := (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) D.Pr (fun A => |X A - θ| ≥ u) ≤ 2 * exp (-(n : ℝ) * u ^ 2 / 2) := by classical dsimp only let D := prodDesign (fun _ : Unit n => qStarDesign c) let η : Unit n → ℝ := fun i => normalizedTypeScore c (z i) let Y : Unit n → Assign K n → ℝ := fun i A => normalizedUpperUnitScore c (z i) (A i) - η i have hindep : iIndepFun Y D.toMeasure := by have h := iIndepFun_prodDesign_eval (fun _ : Unit n => qStarDesign c) exact h.comp (fun i a => normalizedUpperUnitScore c (z i) a - η i) (fun _ => measurable_of_finite _) have hsubG : ∀ i : Unit n, HasSubgaussianMGF (Y i) 1 D.toMeasure := by intro i have hg := hasSubgaussianMGF_of_mem_Icc_of_integral_eq_zero (X := Y i) (a := -1 - η i) (b := 1 - η i) (D.aemeasurable_toMeasure _) (by filter_upwards [] with A rcases normalizedUpperUnitScore_mem_Icc c (z i) (A i) with ⟨hl, hr⟩ exact ⟨by dsimp [Y]; linarith, by dsimp [Y]; linarith⟩) (by rw [← D.E_eq_integral] dsimp [Y, η] rw [D.E_sub, D.E_const, E_prod_apply, normalizedUpperUnitScore_mean] ring) convert hg using 1 <;> norm_num have hsumG : HasSubgaussianMGF (fun A => ∑ i, Y i A) (∑ _i : Unit n, 1) D.toMeasure := by exact ProbabilityTheory.HasSubgaussianMGF.sum_of_iIndepFun hindep (c := fun _ => 1) (s := (Finset.univ : Finset (Unit n))) (fun i _ => hsubG i) have hsum_pos := hsumG.measure_ge_le (ε := (n : ℝ) * u) (mul_nonneg (Nat.cast_nonneg n) hu) have hsum_neg := hsumG.neg.measure_ge_le (ε := (n : ℝ) * u) (mul_nonneg (Nat.cast_nonneg n) hu) have hpos : D.Pr (fun A => u ≤ (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) - (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i)) ≤ exp (-(n : ℝ) * u ^ 2 / 2) := by rw [D.Pr_eq_measureReal] convert hsum_pos using 1 · congr 1 ext A simp only [Y, η, Finset.sum_sub_distrib] have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' field_simp [hnR] · congr 1 norm_num have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' field_simp [hnR] have hneg : D.Pr (fun A => u ≤ -((n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) - (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i))) ≤ exp (-(n : ℝ) * u ^ 2 / 2) := by rw [D.Pr_eq_measureReal] convert hsum_neg using 1 · congr 1 ext A simp only [Y, η, Finset.sum_sub_distrib, Pi.neg_apply] have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' field_simp [hnR] · congr 1 norm_num have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' field_simp [hnR] calc D.Pr (fun A => |(n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) - (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i)| ≥ u) ≤ D.Pr (fun A => u ≤ (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) - (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i)) + D.Pr (fun A => u ≤ -((n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) - (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i))) := by simp only [le_abs] exact D.Pr_or_le _ _ _ ≤ 2 * exp (-(n : ℝ) * u ^ 2 / 2) := by linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedScore_tail_bound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:105
theorem finiteDesign_cov_monotone_comp_nonneg

the stated side condition holds, the finite design cov monotone comp is nonnegative.

Formal statement
Ω :
Type*
D :
X :
Ω → ℝ
g :
ℝ → ℝ
hg :
0 ≤ D.Cov X (fun ω => g (X ω))
Proof (Lean source)
lemma finiteDesign_cov_monotone_comp_nonneg {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (X : Ω → ℝ) (g : ℝ → ℝ) (hg : Monotone g) : 0 ≤ D.Cov X (fun ω => g (X ω)) := by classical have hpair : 0 ≤ ∑ a, ∑ b, D.p a * D.p b * ((X a - X b) * (g (X a) - g (X b))) := by apply sum_nonneg intro a _ apply sum_nonneg intro b _ apply mul_nonneg (mul_nonneg (D.p_nonneg a) (D.p_nonneg b)) rcases le_total (X a) (X b) with h | h · exact mul_nonneg_of_nonpos_of_nonpos (sub_nonpos.mpr h) (sub_nonpos.mpr (hg h)) · exact mul_nonneg (sub_nonneg.mpr h) (sub_nonneg.mpr (hg h)) have hid : (∑ a, ∑ b, D.p a * D.p b * ((X a - X b) * (g (X a) - g (X b)))) = 2 * D.Cov X (fun ω => g (X ω)) := by rw [D.Cov_eq] unfold Causalean.Experimentation.DesignBased.FiniteDesign.E have hdiag : (∑ a, ∑ b, D.p a * D.p b * (X a * g (X a))) = ∑ a, D.p a * (X a * g (X a)) := by calc _ = ∑ a, (D.p a * (X a * g (X a))) * ∑ b, D.p b := by apply Finset.sum_congr rfl intro a _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro b _ ring _ = _ := by rw [D.p_sum]; simp have hcross₂ : (∑ a, ∑ b, D.p a * D.p b * (X a * g (X b))) = (∑ a, D.p a * X a) * ∑ b, D.p b * g (X b) := by calc _ = ∑ a, (D.p a * X a) * ∑ b, D.p b * g (X b) := by apply Finset.sum_congr rfl intro a _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro b _ ring _ = _ := by rw [Finset.sum_mul] have hcross₁ : (∑ a, ∑ b, D.p a * D.p b * (X b * g (X a))) = (∑ b, D.p b * X b) * ∑ a, D.p a * g (X a) := by rw [Finset.sum_comm] simpa [mul_comm] using hcross₂ have hdiag' : (∑ a, ∑ b, D.p a * D.p b * (X b * g (X b))) = ∑ b, D.p b * (X b * g (X b)) := by rw [Finset.sum_comm] simpa [mul_comm] using hdiag rw [show (∑ a, ∑ b, D.p a * D.p b * ((X a - X b) * (g (X a) - g (X b)))) = 2 * ((∑ a, D.p a * (X a * g (X a))) - (∑ a, D.p a * X a) * ∑ b, D.p b * g (X b)) by simp only [mul_sub, sub_mul, Finset.sum_sub_distrib] rw [hdiag, hcross₁, hcross₂, hdiag'] ring] rw [hid] at hpair linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteDesign_cov_monotone_comp_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:195
theorem finiteDesign_cov_perturbation_lower

the stated side condition holds, the stated side condition holds, the stated side condition holds, the finite design cov perturbation lower property holds.

Formal statement
Ω :
Type*
D :
X H :
Ω → ℝ
m δ :
hmean :
D.E X = m
hcenter :
∀ ω, |X ω - m| ≤ 2
hH :
∀ ω,
|H ω| ≤ ind (fun ω => δ ≤ |X ω - m|) ω
D.Var X - 2 * D.Pr (fun ω => δ ≤ |X ω - m|) ≤ D.Cov X (fun ω => X ω + H ω)
Proof (Lean source)
lemma finiteDesign_cov_perturbation_lower {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (X H : Ω → ℝ) (m δ : ℝ) (hmean : D.E X = m) (hcenter : ∀ ω, |X ω - m| ≤ 2) (hH : ∀ ω, |H ω| ≤ ind (fun ω => δ ≤ |X ω - m|) ω) : D.Var X - 2 * D.Pr (fun ω => δ ≤ |X ω - m|) ≤ D.Cov X (fun ω => X ω + H ω) := by classical have hEH : |D.E (fun ω => (X ω - m) * H ω)| ≤ 2 * D.Pr (fun ω => δ ≤ |X ω - m|) := by rw [show D.E (fun ω => (X ω - m) * H ω) = ∑ ω, D.p ω * ((X ω - m) * H ω) by rfl] calc |∑ ω, D.p ω * ((X ω - m) * H ω)| ≤ ∑ ω, |D.p ω * ((X ω - m) * H ω)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ ω, D.p ω * (2 * ind (fun ω => δ ≤ |X ω - m|) ω) := by apply Finset.sum_le_sum intro ω _ rw [abs_mul, abs_of_nonneg (D.p_nonneg ω), abs_mul] apply mul_le_mul_of_nonneg_left _ (D.p_nonneg ω) exact mul_le_mul (hcenter ω) (hH ω) (abs_nonneg _) (by norm_num) _ = 2 * D.Pr (fun ω => δ ≤ |X ω - m|) := by unfold Pr E rw [Finset.mul_sum] apply Finset.sum_congr rfl intro ω _ ring have hdecomp : D.Cov X (fun ω => X ω + H ω) = D.Var X + D.E (fun ω => (X ω - m) * H ω) := by rw [← D.Cov_self, D.Cov_eq, D.Cov_eq, hmean, D.E_add] rw [show D.E (fun z => X z * (X z + H z)) = D.E (fun z => X z * X z) + D.E (fun z => X z * H z) by rw [← D.E_add] apply D.E_congr intro z ring] rw [show D.E (fun ω => (X ω - m) * H ω) = D.E (fun ω => X ω * H ω) - m * D.E H by rw [← D.E_const_mul, ← D.E_sub] apply D.E_congr intro z ring] rw [hmean] ring rw [hdecomp] linarith [neg_abs_le (D.E (fun ω => (X ω - m) * H ω))]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteDesign_cov_perturbation_lower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:257
theorem normalizedTypeScore_mem_Icc

the normalized type score belongs to closed interval.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
normalizedTypeScore c t ∈ Icc (-1) 1
Proof (Lean source)
lemma normalizedTypeScore_mem_Icc (c : Contrast ℝ K) (t : RespType K) : normalizedTypeScore c t ∈ Icc (-1) 1 := by classical rw [← normalizedUpperUnitScore_mean] constructor · calc -1 = (qStarDesign c).E (fun _ => (-1 : ℝ)) := by simp _ ≤ (qStarDesign c).E (normalizedUpperUnitScore c t) := by unfold E apply Finset.sum_le_sum intro a _ exact mul_le_mul_of_nonneg_left (normalizedUpperUnitScore_mem_Icc c t a).1 ((qStarDesign c).p_nonneg a) · calc (qStarDesign c).E (normalizedUpperUnitScore c t) ≤ (qStarDesign c).E (fun _ => (1 : ℝ)) := by unfold E apply Finset.sum_le_sum intro a _ exact mul_le_mul_of_nonneg_left (normalizedUpperUnitScore_mem_Icc c t a).2 ((qStarDesign c).p_nonneg a) _ = 1 := by simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedTypeScore_mem_Icc · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:309

the clipped score monotone property holds.

Formal statement
b :
Monotone (fun x : ℝ => max (-b) (min x b))
Proof (Lean source)
lemma clippedScore_monotone (b : ℝ) : Monotone (fun x : ℝ => max (-b) (min x b)) := by intro x y hxy exact max_le_max (le_refl _) (min_le_min hxy (le_refl _))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clippedScore_monotone · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:334

the stated side condition holds, the clipped score abs is at most property holds.

Formal statement
b x :
hb :
0 ≤ b
|max (-b) (min x b)| ≤ b
Proof (Lean source)
lemma clippedScore_abs_le {b x : ℝ} (hb : 0 ≤ b) : |max (-b) (min x b)| ≤ b := by rw [abs_le] exact ⟨le_max_left _ _, max_le (neg_le_self hb) (min_le_right _ _)⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clippedScore_abs_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:340

the observed count satisfies its stated condition, the clipped score equals self.

Formal statement
b x :
hx :
|x| ≤ b
max (-b) (min x b) = x
Proof (Lean source)
lemma clippedScore_eq_self {b x : ℝ} (hx : |x| ≤ b) : max (-b) (min x b) = x := by rw [abs_le] at hx rw [min_eq_left hx.2, max_eq_right hx.1]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clippedScore_eq_self · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:346
theorem clippedScore_sub_abs_le Lemma clippedScore_sub_abs_le in the paper ↗

the stated side condition holds, the observed count satisfies its stated condition, the stated side condition holds, the clipped score sub abs is at most property holds.

Formal statement
b x :
hb :
0 ≤ b
hx :
|x| ≤ 1
hb1 :
b ≤ 1
|max (-b) (min x b) - x| ≤ 1
Proof (Lean source)
lemma clippedScore_sub_abs_le {b x : ℝ} (hb : 0 ≤ b) (hx : |x| ≤ 1) (hb1 : b ≤ 1) : |max (-b) (min x b) - x| ≤ 1 := by by_cases hl : x < -b · rw [min_eq_left (by linarith), max_eq_left hl.le, abs_of_nonneg (by linarith : 0 ≤ -b - x)] rw [abs_le] at hx linarith · by_cases hr : b < x · rw [min_eq_right hr.le, max_eq_right (by linarith), abs_of_nonpos (sub_nonpos.mpr hr.le)] rw [abs_le] at hx linarith · rw [clippedScore_eq_self (by rw [abs_le]; exact ⟨le_of_not_gt hl, le_of_not_gt hr⟩)] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clippedScore_sub_abs_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:352
theorem normalizedScore_mean_variance

the population size is positive, the normalized score mean variance property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule K n
hn :
0 < n
D :
prodDesign (fun _ : Unit n => qStarDesign c)
X :
fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) (: Assign K n → ℝ)
θ :
(n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i)
D.E X = θ
D.Var X = (n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * ∑ i, normalizedTypeScore c (z i) ^ 2
Proof (Lean source)
lemma normalizedScore_mean_variance (c : Contrast ℝ K) (z : Schedule K n) (hn : 0 < n) : let D := prodDesign (fun _ : Unit n => qStarDesign c) let X : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) let θ := (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) D.E X = θ ∧ D.Var X = (n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * ∑ i, normalizedTypeScore c (z i) ^ 2 := by classical dsimp only let D := prodDesign (fun _ : Unit n => qStarDesign c) let X : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) have hmean : D.E X = (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) := by dsimp [X, D] rw [E_const_mul, E_sum] simp_rw [E_prod_apply, normalizedUpperUnitScore_mean] refine ⟨hmean, ?_⟩ change D.Var X = _ rw [show X = fun A => ∑ i, (n : ℝ)⁻¹ * normalizedUpperUnitScore c (z i) (A i) by funext A simp only [X] rw [Finset.mul_sum], Var_prod_linear_comb] simp_rw [Var_eq, normalizedUpperUnitScore_secondMoment, normalizedUpperUnitScore_mean] have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' calc (∑ i, (n : ℝ)⁻¹ ^ 2 * (1 - normalizedTypeScore c (z i) ^ 2)) = (n : ℝ)⁻¹ ^ 2 * ((n : ℝ) - ∑ i, normalizedTypeScore c (z i) ^ 2) := by rw [show (n : ℝ) = ∑ _i : Unit n, (1 : ℝ) by simp, ← Finset.sum_sub_distrib, Finset.mul_sum] _ = _ := by field_simp [hnR]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedScore_mean_variance · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:369
theorem normalizedScore_bounds

the population size is positive, the normalized score bounds property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule K n
hn :
0 < n
X :
fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) (: Assign K n → ℝ)
θ :
(n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i)
A :
|X A| ≤ 1
|θ| ≤ 1
Proof (Lean source)
lemma normalizedScore_bounds (c : Contrast ℝ K) (z : Schedule K n) (hn : 0 < n) : let X : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) let θ := (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) (∀ A, |X A| ≤ 1) ∧ |θ| ≤ 1 := by classical dsimp only have hnR : (0 : ℝ) < n := by exact_mod_cast hn constructor · intro A rw [abs_le] constructor · calc -1 = (n : ℝ)⁻¹ * ∑ _i : Unit n, (-1 : ℝ) := by simp [hnR.ne'] _ ≤ (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) := by gcongr exact (normalizedUpperUnitScore_mem_Icc c (z _) (A _)).1 · calc (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) ≤ (n : ℝ)⁻¹ * ∑ _i : Unit n, (1 : ℝ) := by gcongr exact (normalizedUpperUnitScore_mem_Icc c (z _) (A _)).2 _ = 1 := by simp [hnR.ne'] · rw [abs_le] constructor · calc -1 = (n : ℝ)⁻¹ * ∑ _i : Unit n, (-1 : ℝ) := by simp [hnR.ne'] _ ≤ (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) := by gcongr exact (normalizedTypeScore_mem_Icc c (z _)).1 · calc (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) ≤ (n : ℝ)⁻¹ * ∑ _i : Unit n, (1 : ℝ) := by gcongr exact (normalizedTypeScore_mem_Icc c (z _)).2 _ = 1 := by simp [hnR.ne']
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.normalizedScore_bounds · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:413
theorem finiteDesign_mse_shrinkage_upper

the stated side condition holds, the stated side condition holds, the stated side condition holds, the finite design mse shrinkage upper property holds.

Formal statement
Ω :
Type*
D :
X :
Ω → ℝ
g :
ℝ → ℝ
θ eps b :
hmean :
D.E X = θ
heps :
0 ≤ eps
hg :
∀ x, |g x| ≤ b
D.mse (fun ω => X ω - eps * g (X ω)) θ
≤ D.Var X - 2 * eps * D.Cov X (fun ω => g (X ω)) + eps ^ 2 * b ^ 2
Proof (Lean source)
lemma finiteDesign_mse_shrinkage_upper {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (X : Ω → ℝ) (g : ℝ → ℝ) (θ eps b : ℝ) (hmean : D.E X = θ) (heps : 0 ≤ eps) (hg : ∀ x, |g x| ≤ b) : D.mse (fun ω => X ω - eps * g (X ω)) θ ≤ D.Var X - 2 * eps * D.Cov X (fun ω => g (X ω)) + eps ^ 2 * b ^ 2 := by classical have hEg : D.E (fun ω => g (X ω) ^ 2) ≤ b ^ 2 := by calc D.E (fun ω => g (X ω) ^ 2) ≤ D.E (fun _ => b ^ 2) := by unfold E apply Finset.sum_le_sum intro ω _ apply mul_le_mul_of_nonneg_left _ (D.p_nonneg ω) have hb : 0 ≤ b := (abs_nonneg (g (X ω))).trans (hg (X ω)) calc g (X ω) ^ 2 = |g (X ω)| ^ 2 := (sq_abs _).symm _ ≤ b ^ 2 := (sq_le_sq₀ (abs_nonneg _) hb).2 (hg (X ω)) _ = b ^ 2 := by simp rw [mse, Var_eq, Cov_eq, hmean] unfold E simp only [Finset.sum_sub_distrib, Finset.sum_add_distrib] have hmean' : (∑ ω, D.p ω * X ω) = θ := hmean have hid : (∑ ω, D.p ω * ((X ω - eps * g (X ω) - θ) ^ 2)) = (∑ ω, D.p ω * X ω ^ 2) - 2 * eps * (∑ ω, D.p ω * (X ω * g (X ω))) + 2 * eps * θ * (∑ ω, D.p ω * g (X ω)) + eps ^ 2 * (∑ ω, D.p ω * g (X ω) ^ 2) - θ ^ 2 := by calc (∑ ω, D.p ω * ((X ω - eps * g (X ω) - θ) ^ 2)) = ∑ ω, (D.p ω * X ω ^ 2 - 2 * eps * (D.p ω * (X ω * g (X ω))) + -2 * θ * (D.p ω * X ω) + 2 * eps * θ * (D.p ω * g (X ω)) + eps ^ 2 * (D.p ω * g (X ω) ^ 2) + D.p ω * θ ^ 2) := by apply Finset.sum_congr rfl intro ω _ ring _ = _ := by simp only [Finset.sum_sub_distrib, Finset.sum_add_distrib] have hcross : (∑ x, 2 * eps * (D.p x * (X x * g (X x)))) = 2 * eps * ∑ x, D.p x * (X x * g (X x)) := by rw [Finset.mul_sum] have hmeanSum : (∑ x, -2 * θ * (D.p x * X x)) = -2 * θ * ∑ x, D.p x * X x := by rw [Finset.mul_sum] have hgSum : (∑ x, 2 * eps * θ * (D.p x * g (X x))) = 2 * eps * θ * ∑ x, D.p x * g (X x) := by rw [show 2 * eps * θ = (2 * eps) * θ by ring, Finset.mul_sum] have hg2Sum : (∑ x, eps ^ 2 * (D.p x * g (X x) ^ 2)) = eps ^ 2 * ∑ x, D.p x * g (X x) ^ 2 := by rw [Finset.mul_sum] have hconst : (∑ ω, D.p ω * θ ^ 2) = θ ^ 2 := by rw [← Finset.sum_mul, D.p_sum, one_mul] rw [hcross, hmeanSum, hgSum, hg2Sum, hmean', hconst] ring rw [hid] have hscaled := mul_le_mul_of_nonneg_left hEg (sq_nonneg eps) unfold E at hscaled nlinarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteDesign_mse_shrinkage_upper · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:454
theorem shrunkenClippedScore_abs_le_one Lemma shrunkenClippedScore_abs_le_one in the paper ↗

the stated side condition holds, the stated side condition holds, the stated side condition holds, the stated side condition holds, the observed count satisfies its stated condition, the shrunken clipped score abs is at most one.

Formal statement
b eps x :
hb :
0 ≤ b
hb1 :
b ≤ 1
heps :
0 ≤ eps
heps1 :
eps ≤ 1
hx :
|x| ≤ 1
|x - eps * max (-b) (min x b)| ≤ 1
Proof (Lean source)
lemma shrunkenClippedScore_abs_le_one {b eps x : ℝ} (hb : 0 ≤ b) (hb1 : b ≤ 1) (heps : 0 ≤ eps) (heps1 : eps ≤ 1) (hx : |x| ≤ 1) : |x - eps * max (-b) (min x b)| ≤ 1 := by rw [abs_le] at hx ⊢ have heb : eps * b ≤ 1 := calc eps * b ≤ 1 * b := mul_le_mul_of_nonneg_right heps1 hb _ = b := one_mul b _ ≤ 1 := hb1 by_cases hl : x < -b · rw [min_eq_left (by linarith), max_eq_left hl.le] constructor <;> nlinarith [mul_nonneg heps hb] · by_cases hr : b < x · rw [min_eq_right hr.le, max_eq_right (by linarith)] constructor <;> nlinarith [mul_nonneg heps hb] · rw [clippedScore_eq_self (by rw [abs_le]; exact ⟨le_of_not_gt hl, le_of_not_gt hr⟩)] by_cases hx0 : 0 ≤ x · constructor <;> nlinarith [mul_nonneg heps hx0, mul_nonneg (sub_nonneg.mpr heps1) hx0] · have hnx : 0 ≤ -x := by linarith constructor <;> nlinarith [mul_nonneg heps hnx, mul_nonneg (sub_nonneg.mpr heps1) hnx]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.shrunkenClippedScore_abs_le_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:516
theorem shrinkagePowerIdentities Lemma shrinkagePowerIdentities in the paper ↗

the population size is positive, the shrinkage power identities property holds.

Formal statement
n :
hn :
0 < n
b :
(n : ℝ) ^ (-(1 / 3 : ℝ))
b / n = (n : ℝ) ^ (-(4 / 3 : ℝ))
b ^ 4 = (n : ℝ) ^ (-(4 / 3 : ℝ))
Proof (Lean source)
lemma shrinkagePowerIdentities (n : ℕ) (hn : 0 < n) : let b := (n : ℝ) ^ (-(1 / 3 : ℝ)) b / n = (n : ℝ) ^ (-(4 / 3 : ℝ)) ∧ b ^ 4 = (n : ℝ) ^ (-(4 / 3 : ℝ)) := by dsimp only have hnR : (0 : ℝ) < n := by exact_mod_cast hn constructor · rw [div_eq_mul_inv, ← Real.rpow_neg_one] rw [← Real.rpow_add hnR] congr 1 norm_num · rw [← Real.rpow_natCast] rw [← Real.rpow_mul hnR.le] congr 1 norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.shrinkagePowerIdentities · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:541
theorem shrinkageProcedure_risk_bound_of_tail

the population size is positive, the stated side condition holds, the shrinkage procedure risk bound when tail property holds.

Formal statement
K n :
c :
Contrast ℝ K
hn :
0 < n
htail :
4 * sqrt (lambdaC c) * (n : ℝ) * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8)
sqrt (lambdaC c) / 2 - lambdaC c / 16
worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c)
C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)))
Proof (Lean source)
lemma shrinkageProcedure_risk_bound_of_tail (K n : ℕ) (c : Contrast ℝ K) (hn : 0 < n) (htail : 4 * sqrt (lambdaC c) * (n : ℝ) * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) ≤ sqrt (lambdaC c) / 2 - lambdaC c / 16) : worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c) ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by classical let D := prodDesign (fun _ : Unit n => qStarDesign c) let b : ℝ := (n : ℝ) ^ (-(1 / 3 : ℝ)) let eps : ℝ := sqrt (lambdaC c) / 4 * b let g : ℝ → ℝ := fun x => max (-b) (min x b) have hlambda := (lambdaC_pos_le_one c).1 have hlambda_le := (lambdaC_pos_le_one c).2 have hsqrt0 : 0 ≤ sqrt (lambdaC c) := Real.sqrt_nonneg _ have hsqrt_le : sqrt (lambdaC c) ≤ 1 := by nlinarith [Real.sq_sqrt hlambda.le] have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hb0 : 0 ≤ b := Real.rpow_nonneg hnR.le _ have hb1 : b ≤ 1 := by dsimp [b] apply Real.rpow_le_one_of_one_le_of_nonpos · exact_mod_cast hn · norm_num have heps0 : 0 ≤ eps := mul_nonneg (div_nonneg hsqrt0 (by norm_num)) hb0 have heps1 : eps ≤ 1 / 4 := by dsimp [eps] have hmul : sqrt (lambdaC c) * b ≤ 1 := calc sqrt (lambdaC c) * b ≤ 1 * b := mul_le_mul_of_nonneg_right hsqrt_le hb0 _ = b := one_mul b _ ≤ 1 := hb1 nlinarith have hsqrt_sq : sqrt (lambdaC c) ^ 2 = lambdaC c := Real.sq_sqrt hlambda.le rcases shrinkagePowerIdentities n hn with ⟨hbdiv, hb4⟩ apply Causalean.Stat.worstCaseRisk_le intro z let X : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, normalizedUpperUnitScore c (z i) (A i) let θ : ℝ := (n : ℝ)⁻¹ * ∑ i, normalizedTypeScore c (z i) let Q : ℝ := ∑ i, normalizedTypeScore c (z i) ^ 2 have hmv := normalizedScore_mean_variance c z hn change D.E X = θ ∧ D.Var X = (n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * Q at hmv rcases hmv with ⟨hmean, hvar⟩ have hbounds := normalizedScore_bounds c z hn change (∀ A, |X A| ≤ 1) ∧ |θ| ≤ 1 at hbounds rcases hbounds with ⟨hX, htheta⟩ have hQ : lambdaC c * (n : ℝ) * |θ| ≤ Q := by calc lambdaC c * (n : ℝ) * |θ| = lambdaC c * |∑ i, normalizedTypeScore c (z i)| := by dsimp [θ] rw [abs_mul, abs_inv, abs_of_pos hnR] field_simp [hnR.ne'] _ ≤ lambdaC c * ∑ i, |normalizedTypeScore c (z i)| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ = ∑ i, lambdaC c * |normalizedTypeScore c (z i)| := by rw [Finset.mul_sum] _ ≤ Q := by dsimp [Q] exact Finset.sum_le_sum fun i _ => normalizedTypeScore_sq_lower c (z i) have hcov0 : 0 ≤ D.Cov X (fun A => g (X A)) := finiteDesign_cov_monotone_comp_nonneg D X g (clippedScore_monotone b) have hmse := finiteDesign_mse_shrinkage_upper D X g θ eps b hmean heps0 (fun x => clippedScore_abs_le hb0) have himprovement : D.mse (fun A => X A - eps * g (X A)) θ ≤ (n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by rw [hvar] at hmse by_cases hlocal : |θ| ≤ b / 2 · have htailprob := normalizedScore_tail_bound c z hn (b / 2) (div_nonneg hb0 (by norm_num)) change D.Pr (fun A => |X A - θ| ≥ b / 2) ≤ _ at htailprob have hexp : exp (-(n : ℝ) * (b / 2) ^ 2 / 2) = exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) := by congr 1 have hb2 : b ^ 2 = (n : ℝ) ^ (-(2 / 3 : ℝ)) := by dsimp [b] rw [← Real.rpow_natCast, ← Real.rpow_mul hnR.le] congr 1 norm_num have hpow : (n : ℝ) * b ^ 2 = (n : ℝ) ^ (1 / 3 : ℝ) := by calc (n : ℝ) * b ^ 2 = (n : ℝ) ^ (1 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by rw [hb2, Real.rpow_one] _ = (n : ℝ) ^ ((1 : ℝ) + -(2 / 3 : ℝ)) := (Real.rpow_add hnR _ _).symm _ = _ := by congr 1; norm_num rw [div_pow] nlinarith rw [hexp] at htailprob have hH : ∀ A, |g (X A) - X A| ≤ ind (fun A => b / 2 ≤ |X A - θ|) A := by intro A by_cases hfar : b / 2 ≤ |X A - θ| · simp [ind, hfar] exact clippedScore_sub_abs_le hb0 (hX A) hb1 · have hxlocal : |X A| ≤ b := by calc |X A| ≤ |X A - θ| + |θ| := by simpa only [sub_add_cancel] using (abs_add_le (X A - θ) θ) _ ≤ b := by linarith simp [ind, hfar, g, clippedScore_eq_self hxlocal] have hcov := finiteDesign_cov_perturbation_lower D X (fun A => g (X A) - X A) θ (b / 2) hmean (fun A => by calc |X A - θ| ≤ |X A| + |θ| := abs_sub _ _ _ ≤ 2 := by linarith [hX A, htheta]) hH have hcov : D.Var X - 2 * D.Pr (fun A => b / 2 ≤ |X A - θ|) ≤ D.Cov X (fun A => g (X A)) := by convert hcov using 1 congr 2 funext A ring have hQ0 : 0 ≤ Q := sum_nonneg fun _ _ => sq_nonneg _ have hcoef : 0 ≤ 1 - 2 * eps := by linarith have hApos : 0 < sqrt (lambdaC c) / 2 - lambdaC c / 16 := by nlinarith [hsqrt_sq] have htailScaled : 2 * sqrt (lambdaC c) * b * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) ≤ (sqrt (lambdaC c) / 2 - lambdaC c / 16) / 2 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by rw [← hbdiv] have := mul_le_mul_of_nonneg_left htail (div_nonneg hb0 (by positivity : (0 : ℝ) ≤ 2 * n)) field_simp [hnR.ne'] at this ⊢ nlinarith have hAhalf : kappaC c ≤ (sqrt (lambdaC c) / 2 - lambdaC c / 16) / 2 := by dsimp [kappaC] exact div_le_div_of_nonneg_right (min_le_left _ _) (by norm_num) have hpows : (sqrt (lambdaC c) / 4 * b) ^ 2 * b ^ 2 = lambdaC c / 16 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by calc (sqrt (lambdaC c) / 4 * b) ^ 2 * b ^ 2 = sqrt (lambdaC c) ^ 2 / 16 * b ^ 4 := by ring _ = _ := by rw [hsqrt_sq]; simpa [b] using (congrArg (fun x => lambdaC c / 16 * x) hb4) dsimp [eps] at hmse rw [hpows] at hmse have hcov' : (n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * Q - 4 * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) ≤ D.Cov X (fun A => g (X A)) := by linarith have hbase : D.mse (fun A => X A - eps * g (X A)) θ ≤ (n : ℝ)⁻¹ - (sqrt (lambdaC c) / 2 - lambdaC c / 16) * (n : ℝ) ^ (-(4 / 3 : ℝ)) + 2 * sqrt (lambdaC c) * b * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) := by have hcovmul : -2 * (sqrt (lambdaC c) / 4 * b) * D.Cov X (fun A => g (X A)) ≤ -2 * (sqrt (lambdaC c) / 4 * b) * ((n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * Q - 4 * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8)) := mul_le_mul_of_nonpos_left hcov' (by nlinarith [mul_nonneg hsqrt0 hb0]) have hdrop : 0 ≤ (1 - 2 * (sqrt (lambdaC c) / 4 * b)) * ((n : ℝ)⁻¹ ^ 2 * Q) := by apply mul_nonneg · simpa [eps] using hcoef · positivity have hstep : D.mse (fun A => X A - eps * g (X A)) θ ≤ (n : ℝ)⁻¹ - sqrt (lambdaC c) / 2 * (b / n) + 2 * sqrt (lambdaC c) * b * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) + lambdaC c / 16 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by dsimp [eps] at hcovmul hdrop hmse ⊢ calc _ ≤ (n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * Q - 2 * (sqrt (lambdaC c) / 4 * b) * D.Cov X (fun A => g (X A)) + lambdaC c / 16 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := hmse _ ≤ _ := by ring_nf at hcovmul hdrop ⊢ linarith rw [hbdiv] at hstep convert hstep using 1 <;> ring calc _ ≤ _ := hbase _ ≤ (n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by have hrpow0 : 0 ≤ (n : ℝ) ^ (-(4 / 3 : ℝ)) := Real.rpow_nonneg hnR.le _ nlinarith [mul_le_mul_of_nonneg_right hAhalf hrpow0] · have hthetaLarge : b / 2 < |θ| := lt_of_not_ge hlocal have hQscaled : lambdaC c / 2 * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ (n : ℝ)⁻¹ ^ 2 * Q := by rw [← hbdiv] have h := mul_le_mul_of_nonneg_left hthetaLarge.le (mul_nonneg hlambda.le hnR.le) have hraw : lambdaC c * (n : ℝ) * b / 2 ≤ Q := by nlinarith [hQ] calc lambdaC c / 2 * (b / (n : ℝ)) = (lambdaC c * (n : ℝ) * b / 2) / (n : ℝ) ^ 2 := by field_simp [hnR.ne'] _ ≤ Q / (n : ℝ) ^ 2 := by gcongr _ = (n : ℝ)⁻¹ ^ 2 * Q := by field_simp [hnR.ne'] have hB : kappaC c ≤ 7 * lambdaC c / 16 := by dsimp [kappaC] calc min _ _ / 2 ≤ (7 * lambdaC c / 16) / 2 := div_le_div_of_nonneg_right (min_le_right _ _) (by norm_num) _ ≤ 7 * lambdaC c / 16 := by nlinarith [hlambda] have hpows : (sqrt (lambdaC c) / 4 * b) ^ 2 * b ^ 2 = lambdaC c / 16 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by calc (sqrt (lambdaC c) / 4 * b) ^ 2 * b ^ 2 = sqrt (lambdaC c) ^ 2 / 16 * b ^ 4 := by ring _ = _ := by rw [hsqrt_sq]; simpa [b] using (congrArg (fun x => lambdaC c / 16 * x) hb4) dsimp [eps] at hmse rw [hpows] at hmse have hrpow0 : 0 ≤ (n : ℝ) ^ (-(4 / 3 : ℝ)) := Real.rpow_nonneg hnR.le _ have hBk := mul_le_mul_of_nonneg_right hB hrpow0 have hec := mul_nonneg heps0 hcov0 have hec' : 0 ≤ (sqrt (lambdaC c) / 4 * b) * D.Cov X (fun A => g (X A)) := by simpa [eps] using hec change D.mse (fun A => X A - (sqrt (lambdaC c) / 4 * b) * g (X A)) θ ≤ _ calc _ ≤ (n : ℝ)⁻¹ - (n : ℝ)⁻¹ ^ 2 * Q - 2 * (sqrt (lambdaC c) / 4 * b) * D.Cov X (fun A => g (X A)) + lambdaC c / 16 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := hmse _ ≤ (n : ℝ)⁻¹ - 7 * lambdaC c / 16 * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by nlinarith _ ≤ _ := by nlinarith have hunclipped (A : Assign K n) : (Lc c / 2) * (X A - eps * g (X A)) ∈ Icc (-Lc c / 2) (Lc c / 2) := by have hh : 0 ≤ Lc c / 2 := by positivity [Lc_pos c] have hnorm := shrunkenClippedScore_abs_le_one hb0 hb1 heps0 (by linarith : eps ≤ 1) (hX A) rw [abs_le] at hnorm constructor <;> nlinarith have hnormalized (A : Assign K n) : centeredContrastScore c A (obsOutcome z A) / (Lc c / 2) = X A := by have hh : Lc c / 2 ≠ 0 := by positivity [Lc_pos c] change ((n : ℝ)⁻¹ * ∑ i, upperUnitScore c (z i) (A i)) / (Lc c / 2) = (n : ℝ)⁻¹ * ∑ i, upperUnitScore c (z i) (A i) / (Lc c / 2) rw [← Finset.sum_div] -- … truncated; follow the source link for the rest …
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.shrinkageProcedure_risk_bound_of_tail · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/ShrinkageRisk.lean:560
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.SubsequentialLimits 2 declarations Stability of cluster sets under asymptotically vanishing perturbations.

Stability of cluster sets under asymptotically vanishing perturbations.

theorem clusterValue_iff_mapClusterPt Lemma clusterValue_iff_mapClusterPt in the paper ↗

For a real sequence, a point is the limit along a strictly increasing subsequence exactly when it is a mapped cluster point at infinity.

Formal statement
x :
ℕ → ℝ
a :
(∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (nhds a)) ↔ MapClusterPt a atTop x
Proof (Lean source)
lemma clusterValue_iff_mapClusterPt (x : ℕ → ℝ) (a : ℝ) : (∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (nhds a)) ↔ MapClusterPt a atTop x := isSubsequentialLimit_iff_mapClusterPt x a
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clusterValue_iff_mapClusterPt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/SubsequentialLimits.lean:11
theorem subsequentialLimitSet_nonempty_compact Lemma subsequentialLimitSet_nonempty_compact in the paper ↗

If a real sequence is eventually contained in a closed interval, then its set of limits along strictly increasing subsequences is nonempty and compact.

Formal statement
x :
ℕ → ℝ
a b :
hx :
∀ᶠ n in atTop, x n ∈ Icc a b
conclusion 1
∃ y : ℝ, ∃ φ : ℕ → ℕ,
Tendsto (x ∘ φ) atTop (nhds y)
conclusion 2
IsCompact {y : ℝ | ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (nhds y)}
Proof (Lean source)
lemma subsequentialLimitSet_nonempty_compact (x : ℕ → ℝ) (a b : ℝ) (hx : ∀ᶠ n in atTop, x n ∈ Icc a b) : (∃ y : ℝ, ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (nhds y)) ∧ IsCompact {y : ℝ | ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (x ∘ φ) atTop (nhds y)} := subsequentialLimitSet_nonempty_compact_of_eventually_mem_compact x isCompact_Icc hx
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.subsequentialLimitSet_nonempty_compact · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/SubsequentialLimits.lean:19
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.Symmetrization 22 declarations Simultaneous unit permutation and exact orbit-procedure correspondence.

Simultaneous unit permutation and exact orbit-procedure correspondence.

Simultaneous invariance of both the assignment law and estimator.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
IsInvariantProcedure c p :
Prop
clause 1
(σ : Equiv.Perm (Unit n)) A :
p.1.p (permuteAssign σ A) = p.1.p A
clause 2
(σ : Equiv.Perm (Unit n)) A y :
p.2 (permuteAssign σ A) (permuteObserved σ y) = p.2 A y
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsInvariantProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:11
def InvariantProcedure

A procedure is invariant when simultaneous relabeling of units leaves both its assignment probabilities and its estimates unchanged.

Definition (Lean source)
K n :
c :
Contrast ℝ K
InvariantProcedure K n c :
Type
{p : Procedure K n c // IsInvariantProcedure c p}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.InvariantProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:17

The design and estimator are the stated common-permutation averages.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p pbar :
Procedure K n c
IsPermutationAverage c p pbar :
Prop
clause 1
by classical letI := ofFinite (Perm (Unit n)) exact (∀ A, pbar.1.p A = (card (Perm (Unit n)) : ℝ)⁻¹ * ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A))
clause 2
A y :
(pbar.2 A y : ℝ)
= if h : 0 < ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) then clip c ((∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) * (p.2 (permuteAssign σ A) (permuteObserved σ y) : ℝ)) / ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A)) else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsPermutationAverage · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:21

The paper's averaged-permutation risk domination, not a pointwise comparison.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
q :
OrbitAverageDomination c p q :
Prop
by classical letI := ofFinite (Perm (Unit n)) exact ∀ z, orbitRisk c q (scheduleCounts z)
≤ (card (Perm (Unit n)) : ℝ)⁻¹ * ∑ σ : Perm (Unit n), labeledRisk c p (permuteSchedule σ z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.OrbitAverageDomination · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:38

Every labeled procedure has an averaged invariant representative.

Definition (Lean source)
K :
shared
n :
c :
Contrast ℝ K
LosslessSymmetrization n c :
Prop
by classical letI := ofFinite (Perm (Unit n)) exact ∀ p : Procedure K n c, ∃ (pbar : Procedure K n c) (q : OrbitProcedure K n c), IsInvariantProcedure c pbar ∧ IsPermutationAverage c p pbar ∧ (∀ z, labeledRisk c pbar z ≤ (card (Perm (Unit n)) : ℝ)⁻¹ * ∑ σ : Perm (Unit n), labeledRisk c p (permuteSchedule σ z)) ∧ OrbitAverageDomination c p q
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.LosslessSymmetrization · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:48

Explicit equations identifying an invariant labeled procedure with (π,δ).

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
q :
RealizesOrbitProcedure c p q :
Prop
clause 1
A :
clause 2
A y :
(p.2 A y : ℝ) = (q.2 (assignmentCounts A) (observedCounts A y) : ℝ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RealizesOrbitProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:61

Exact two-way identification of invariant labeled procedures with (π,δ).

Definition (Lean source)
K :
shared
n :
c :
Contrast ℝ K
ExactInvariantProcedureCorrespondence n c :
Prop
∃ e : InvariantProcedure K n c ≃ OrbitProcedure K n c,
clause 1
p :
clause 2
q :
RealizesOrbitProcedure c (e.symm q).1 q
clause 3
p z :
orbitRisk c (e p) (scheduleCounts z) = labeledRisk c p.1 z
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ExactInvariantProcedureCorrespondence · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:66
def allocationRepresentative

An allocation representative chooses a canonical labeled assignment for each allocation-count vector.

Definition (Lean source)
K :
shared
n :
shared
r :
allocationRepresentative r :
Assign K n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationRepresentative · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:73
theorem allocationRepresentative_spec

the allocation representative spec property holds.

Formal statement
K :
shared
n :
shared
r :
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.allocationRepresentative_spec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:77
def observationRepresentative

An observation representative chooses a canonical observed-outcome vector for each compatible allocation and success-count pair.

Definition (Lean source)
K :
shared
n :
shared
r :
x :
observationRepresentative r x :
(choose h, choose (Classical.choose_spec h))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observationRepresentative · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:82
theorem observationRepresentative_assignment

the observation representative assignment property holds.

Formal statement
K :
shared
n :
shared
r :
x :
Proof (Lean source)
lemma observationRepresentative_assignment (r : AllocVec K n) (x : ObsVec r) : assignmentCounts (observationRepresentative r x).1 = r := by exact (Classical.choose_spec (Classical.choose_spec (observedCounts_realizable r x))).1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observationRepresentative_assignment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:88
theorem observationRepresentative_counts

the observation representative counts property holds.

Formal statement
K :
shared
n :
shared
r :
x :
Proof (Lean source)
lemma observationRepresentative_counts (r : AllocVec K n) (x : ObsVec r) : (observedCounts (observationRepresentative r x).1 (observationRepresentative r x).2).1 = x.1 := by funext a apply Fin.ext exact (Classical.choose_spec (Classical.choose_spec (observedCounts_realizable r x))).2 a
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observationRepresentative_counts · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:93

Inflate an orbit procedure uniformly over each labeled allocation orbit.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
q :
orbitToInvariantProcedure c q :
by classical let D : FiniteDesign (Assign K n) := { p := fun A => q.1.p (assignmentCounts A) / allocationOrbitCard (assignmentCounts A) p_nonneg := fun A => div_nonneg (q.1.p_nonneg _) (Nat.cast_nonneg _) p_sum := by rw [← Finset.sum_fiberwise univ assignmentCounts (fun A => q.1.p (assignmentCounts A) / allocationOrbitCard (assignmentCounts A))] calc ∑ r : AllocVec K n, ∑ A : Assign K n with assignmentCounts A = r, q.1.p (assignmentCounts A) / allocationOrbitCard (assignmentCounts A) = ∑ r : AllocVec K n, q.1.p r := by apply Finset.sum_congr rfl intro r _ have hr : (allocationOrbitCard r : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (allocationOrbitCard_pos r)) rw [Finset.sum_congr rfl (fun A hA => by simp only [mem_filter] at hA rw [hA.2])] rw [Finset.sum_const, nsmul_eq_mul] have hcard : (Finset.univ.filter fun A : Assign K n => assignmentCounts A = r).card = allocationOrbitCard r := by unfold allocationOrbitCard simp only [Fintype.card_subtype] rw [hcard] norm_num exact mul_div_cancel₀ _ hr _ = 1 := q.1.p_sum } let est : Estimator K n c := fun A y
=> q.2 (assignmentCounts A) (observedCounts A y) refine ⟨(D, est), ?_⟩ constructor · intro σ A simp only [D] rw [assignmentCounts_permute] · intro σ A y simp only [est] have hA := assignmentCounts_permute A σ have hy := observedCounts_permute A y σ exact orbitEstimator_eq_of_counts c q.2 hA _ _ hy
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitToInvariantProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:119
theorem orbitToInvariantProcedure_realizes

the orbit to invariant procedure realizes property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
q :
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitToInvariantProcedure_realizes · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:164
def invariantToOrbitProcedure

Collapse an invariant labeled procedure to allocation and observation orbits.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
invariantToOrbitProcedure c p :
by classical let D : FiniteDesign (AllocVec K n) := { p := fun r => (allocationOrbitCard r : ℝ) * p.1.1.p (allocationRepresentative r) p_nonneg := fun r => mul_nonneg (Nat.cast_nonneg _) (p.1.1.p_nonneg _) p_sum := by calc ∑ r : AllocVec K n, (allocationOrbitCard r : ℝ) * p.1.1.p (allocationRepresentative r) = ∑ r : AllocVec K n, ∑ A : Assign K n with assignmentCounts A = r, p.1.1.p A := by apply Finset.sum_congr rfl intro r _ have hrep : assignmentCounts (allocationRepresentative r) = r := allocationRepresentative_spec r rw [Finset.sum_congr rfl (fun A hA => by simp only [mem_filter] at hA rw [invariant_design_eq_of_counts (c := c) p.1 p.2 (hA.2.trans hrep.symm)])] rw [Finset.sum_const, nsmul_eq_mul] congr 1 norm_num unfold allocationOrbitCard simp only [Fintype.card_subtype] _ = ∑ A : Assign K n, p.1.1.p A := Finset.sum_fiberwise univ assignmentCounts (fun A => p.1.1.p A) _ = 1 := p.1.1.p_sum } let est : OrbitEstimator K n c := fun r x
=> p.1.2 (observationRepresentative r x).1 (observationRepresentative r x).2 exact (D, est)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.invariantToOrbitProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:191
theorem invariantToOrbitProcedure_realizes

the invariant to orbit procedure realizes property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Proof (Lean source)
lemma invariantToOrbitProcedure_realizes (p : InvariantProcedure K n c) : RealizesOrbitProcedure c p.1 (invariantToOrbitProcedure c p) := by classical constructor · intro A have hcard : (allocationOrbitCard (assignmentCounts A) : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (allocationOrbitCard_pos (assignmentCounts A))) rw [show (invariantToOrbitProcedure c p).1.p (assignmentCounts A) = (allocationOrbitCard (assignmentCounts A) : ℝ) * p.1.1.p (allocationRepresentative (assignmentCounts A)) by simp [invariantToOrbitProcedure]] rw [mul_div_cancel_left₀ _ hcard] exact invariant_design_eq_of_counts (c := c) p.1 p.2 ((allocationRepresentative_spec (assignmentCounts A)).symm) · intro A y change (p.1.2 A y : ℝ) = (p.1.2 (observationRepresentative (assignmentCounts A) (observedCounts A y)).1 (observationRepresentative (assignmentCounts A) (observedCounts A y)).2 : ℝ) congr 1 apply invariant_estimator_eq_of_counts (c := c) p.1 p.2 · exact (observationRepresentative_assignment (assignmentCounts A) (observedCounts A y)).symm · exact (observationRepresentative_counts (assignmentCounts A) (observedCounts A y)).symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.invariantToOrbitProcedure_realizes · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:225
def invariantOrbitEquiv

The explicit equivalence between invariant labeled and orbit procedures.

Definition (Lean source)
K n :
c :
Contrast ℝ K
invariantOrbitEquiv K n c :
clause 2
clause 3
left_inv := orbitInvariant_left_inv c
clause 4
right_inv := orbitInvariant_right_inv c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.invariantOrbitEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:287
theorem exact_invariant_procedure_correspondence

the exact invariant procedure correspondence property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
Proof (Lean source)
lemma exact_invariant_procedure_correspondence : ExactInvariantProcedureCorrespondence n c := by refine ⟨invariantOrbitEquiv K n c, ?_, ?_, ?_⟩ · exact invariantToOrbitProcedure_realizes c · intro q exact orbitToInvariantProcedure_realizes c q · intro p z exact (labeledRisk_eq_orbitRisk_of_realizes c p.1 (invariantOrbitEquiv K n c p) ((invariantToOrbitProcedure_realizes c p).1) ((invariantToOrbitProcedure_realizes c p).2) z).symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exact_invariant_procedure_correspondence · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:295
def permutationAverageProcedure

The simultaneous permutation average appearing in the paper.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
permutationAverageProcedure c p :
Procedure K n c
by classical letI := ofFinite (Perm (Unit n)) let M : ℝ := card (Perm (Unit n)) have hMpos : 0 < M := by dsimp [M] positivity let D : FiniteDesign (Assign K n) := { p := fun A => M⁻¹ * ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) p_nonneg := fun A => mul_nonneg (inv_nonneg.mpr hMpos.le) (sum_nonneg fun _ _ => p.1.p_nonneg _) p_sum := by rw [← Finset.mul_sum] rw [Finset.sum_comm] have hσ : ∀ σ : Perm (Unit n), ∑ A : Assign K n, p.1.p (permuteAssign σ A) = 1 := by intro σ let e : Assign K n ≃ Assign K n := { toFun := permuteAssign σ invFun := permuteAssign σ.symm left_inv := fun A => by funext i; simp [permuteAssign] right_inv := fun A => by funext i; simp [permuteAssign] } simpa [e] using (e.sum_comp p.1.p).trans p.1.p_sum simp_rw [hσ] rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] change M⁻¹ * (M * 1) = 1 field_simp } let est : Estimator K n c := fun A y
=> if h : 0 < ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) then ⟨clip c ((∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) * (p.2 (permuteAssign σ A) (permuteObserved σ y) : ℝ)) / ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A)), clip_mem c _⟩ else ⟨0, by have hLc : 0 ≤ Lc c := sum_nonneg fun _ _ => abs_nonneg _ constructor <;> linarith⟩ exact (D, est)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.permutationAverageProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:325
theorem permutationAverageProcedure_spec

the permutation average procedure spec property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
Proof (Lean source)
lemma permutationAverageProcedure_spec (p : Procedure K n c) : IsPermutationAverage c p (permutationAverageProcedure c p) := by classical letI := ofFinite (Perm (Unit n)) constructor · intro A simp [permutationAverageProcedure] · intro A y simp only [permutationAverageProcedure] split <;> rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.permutationAverageProcedure_spec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:366
theorem permutationAverageProcedure_invariant

the permutation average procedure invariant property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
Proof (Lean source)
lemma permutationAverageProcedure_invariant (p : Procedure K n c) : IsInvariantProcedure c (permutationAverageProcedure c p) := by classical letI := ofFinite (Perm (Unit n)) constructor · intro τ A simp only [permutationAverageProcedure] congr 1 rw [show (∑ σ : Perm (Unit n), p.1.p (permuteAssign σ (permuteAssign τ A))) = ∑ σ : Perm (Unit n), p.1.p (permuteAssign (τ.trans σ) A) by apply Finset.sum_congr rfl intro σ _ rw [permuteAssign_comp]] exact Equiv.sum_comp (leftComposePerm τ) (fun σ => p.1.p (permuteAssign σ A)) · intro τ A y apply Subtype.ext simp only [permutationAverageProcedure] have hden : (∑ σ : Perm (Unit n), p.1.p (permuteAssign σ (permuteAssign τ A))) = ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) := by simp_rw [permuteAssign_comp] exact Equiv.sum_comp (leftComposePerm τ) (fun σ => p.1.p (permuteAssign σ A)) have hnum : (∑ σ : Perm (Unit n), p.1.p (permuteAssign σ (permuteAssign τ A)) * (p.2 (permuteAssign σ (permuteAssign τ A)) (permuteObserved σ (permuteObserved τ y)) : ℝ)) = ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) * (p.2 (permuteAssign σ A) (permuteObserved σ y) : ℝ) := by simp_rw [permuteAssign_comp, permuteObserved_comp] exact Equiv.sum_comp (leftComposePerm τ) (fun σ => p.1.p (permuteAssign σ A) * (p.2 (permuteAssign σ A) (permuteObserved σ y) : ℝ)) by_cases h : 0 < ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ (permuteAssign τ A)) · have h' : 0 < ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) := hden ▸ h simp only [dif_pos h, dif_pos h', Set.mem_Icc, Subtype.coe_mk] rw [hnum, hden] · have h' : ¬ 0 < ∑ σ : Perm (Unit n), p.1.p (permuteAssign σ A) := by intro hp exact h (hden.symm ▸ hp) simp only [dif_neg h, dif_neg h', Set.mem_Icc, Subtype.coe_mk]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.permutationAverageProcedure_invariant · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:378
theorem lossless_symmetrization

averaging any labeled procedure over unit permutations produces an invariant procedure without increasing worst-case risk, and invariant procedures correspond exactly to orbit procedures.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
Proof (Lean source)
lemma lossless_symmetrization : LosslessSymmetrization n c := by intro p let pbar := permutationAverageProcedure c p have hinv : IsInvariantProcedure c pbar := permutationAverageProcedure_invariant c p let pinv : InvariantProcedure K n c := ⟨pbar, hinv⟩ let q := invariantToOrbitProcedure c pinv refine ⟨pbar, q, hinv, permutationAverageProcedure_spec c p, labeledRisk_permutationAverage_le c p, ?_⟩ unfold OrbitAverageDomination intro z have hrisk : orbitRisk c q (scheduleCounts z) = labeledRisk c pbar z := (labeledRisk_eq_orbitRisk_of_realizes c pbar q ((invariantToOrbitProcedure_realizes c pinv).1) ((invariantToOrbitProcedure_realizes c pinv).2) z).symm rw [hrisk] exact labeledRisk_permutationAverage_le c p z
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lossless_symmetrization · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/Symmetrization.lean:611
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmFinitePosterior 9 declarations Finite-posterior bridge for the paper's effect-triple/binomial experiment.

Finite-posterior bridge for the paper's effect-triple/binomial experiment.

This identifies the generic native-real finite-design Bayes risk with the paper-local scalarBayesRisk; it is the finite endpoint needed by the smooth continuous-prior converse.

def instMeasurableSpaceEffectTriple

The effect triple space carries the discrete measurable structure.

Definition (Lean source)
noncomputable local instance (n : ℕ) : MeasurableSpace (EffectTriple n) := ⊤
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instMeasurableSpaceEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:18
theorem instMeasurableSingletonClassEffectTriple

every singleton in the effect triple space is measurable.

Formal statement
Proof (Lean source)
noncomputable local instance (n : ℕ) : MeasurableSingletonClass (EffectTriple n) := ⟨fun _ => MeasurableSet.of_discrete⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instMeasurableSingletonClassEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:20
def twoArmCountKernel

The count-observation kernel associated with the canonical two-arm score experiment.

Definition (Lean source)
n :
D :
twoArmCountKernel D :
Kernel (EffectTriple n) (Fin (n + 1))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCountKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:25
instance twoArmCountKernel_isMarkovKernel

The two arm count kernel construction is a Markov kernel.

Definition (Lean source)
noncomputable instance twoArmCountKernel_isMarkovKernel {n : ℕ} (D : FiniteDesign (Assign 2 n)) : IsMarkovKernel (twoArmCountKernel D) := by unfold twoArmCountKernel infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCountKernel_isMarkovKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:31
theorem twoArmCountKernel_mass

Singleton masses of the count kernel are the statistic masses of the score experiment.

Formal statement
n :
D :
theta :
x :
Fin (n + 1)
Proof (Lean source)
lemma twoArmCountKernel_mass {n : ℕ} (D : FiniteDesign (Assign 2 n)) (theta : EffectTriple n) (x : Fin (n + 1)) : kernelMass (twoArmCountKernel D) theta x = (twoArmScoreExperiment D).statisticMass theta x := by exact (twoArmScoreExperiment D).statisticKernel_singletonReal theta x
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCountKernel_mass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:39
theorem twoArmCount_statewiseSquaredLoss_eq_statisticRisk

Generic statewise squared loss is exactly the paper-local count-statistic risk.

Formal statement
n :
D :
T :
Fin (n + 1) → ℝ
theta :
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCount_statewiseSquaredLoss_eq_statisticRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:47
theorem twoArmCount_expectedLoss_eq_scalarPriorRisk_extend

Expected count-kernel loss agrees with scalar prior risk after extending a finite estimator.

Formal statement
n :
nu :
D :
T :
Fin (n + 1) → ℝ
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCount_expectedLoss_eq_scalarPriorRisk_extend · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:59
theorem twoArmCount_expectedLoss_eq_scalarPriorRisk_restrict

Restricting an arbitrary natural-number estimator to the finite count support preserves risk.

Formal statement
n :
nu :
D :
f :
ℕ → ℝ
nu.E (statewiseSquaredLoss (twoArmCountKernel D) (fun theta _x => effectTarget theta) (fun x : Fin (n + 1) => f (x : ℕ)))
Proof (Lean source)
lemma twoArmCount_expectedLoss_eq_scalarPriorRisk_restrict {n : ℕ} (nu : EffectPrior n) (D : FiniteDesign (Assign 2 n)) (f : ℕ → ℝ) : nu.E (statewiseSquaredLoss (twoArmCountKernel D) (fun theta _x => effectTarget theta) (fun x : Fin (n + 1) => f (x : ℕ))) = scalarPriorRisk nu f := by unfold FiniteDesign.E simp_rw [twoArmCount_statewiseSquaredLoss_eq_statisticRisk, twoArmScoreExperiment_statisticRisk_eq_scalar] unfold scalarPriorRisk apply Finset.sum_congr rfl intro theta _ congr 1 apply Finset.sum_congr rfl intro k hk have hk' : k ≤ (theta.1.2.2 : ℕ) := by simpa only [Finset.mem_range, Nat.lt_succ_iff] using hk have hbound : (theta.1.1 : ℕ) + k < n + 1 := by have ht := theta.2 omega rw [extendFinEstimator_of_lt _ hbound]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCount_expectedLoss_eq_scalarPriorRisk_restrict · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:73
theorem finiteDesignBayesRisk_twoArmCount_eq_scalarBayesRisk

The generic finite-posterior Bayes risk of the effect-triple/count kernel is exactly the paper's scalar Bayes risk.

Formal statement
n :
nu :
D :
Proof (Lean source)
lemma finiteDesignBayesRisk_twoArmCount_eq_scalarBayesRisk {n : ℕ} (nu : EffectPrior n) (D : FiniteDesign (Assign 2 n)) : finiteDesignBayesRisk nu (statewiseSquaredLoss (twoArmCountKernel D) (fun theta _x => effectTarget theta)) = scalarBayesRisk nu := by rw [scalarBayesRisk_eq_sInf_scalarPriorRisk] unfold finiteDesignBayesRisk change sInf (range (fun T : Fin (n + 1) → ℝ => nu.E (statewiseSquaredLoss (twoArmCountKernel D) (fun theta _x => effectTarget theta) T))) = _ congr 1 ext v constructor · rintro ⟨T, rfl⟩ exact ⟨extendFinEstimator T, twoArmCount_expectedLoss_eq_scalarPriorRisk_extend nu D T⟩ · rintro ⟨f, rfl⟩ exact ⟨fun x : Fin (n + 1) => f (x : ℕ), twoArmCount_expectedLoss_eq_scalarPriorRisk_restrict nu D f⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteDesignBayesRisk_twoArmCount_eq_scalarBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmFinitePosterior.lean:96
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmPosteriorCompatibility 23 declarations Finite effect-count and posterior compatibility algebra for the smooth two-arm prior.

Finite effect-count and posterior compatibility algebra for the smooth two-arm prior.

def instMeasurableSpaceEffectTriple_1

The effect triple 1 space carries the discrete measurable structure.

Definition (Lean source)
noncomputable local instance (n : ℕ) : MeasurableSpace (EffectTriple n) := ⊤
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instMeasurableSpaceEffectTriple_1 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:16
theorem instMeasurableSingletonClassEffectTriple_1

every singleton in the effect triple 1 space is measurable.

Formal statement
Proof (Lean source)
noncomputable local instance (n : ℕ) : MeasurableSingletonClass (EffectTriple n) := ⟨fun _ => MeasurableSet.of_discrete⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instMeasurableSingletonClassEffectTriple_1 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:18
theorem instNonemptyEffectTriple

the effect triple collection is nonempty.

Formal statement
∀ (n : ℕ), Nonempty (EffectTriple n)
Proof (Lean source)
noncomputable local instance (n : ℕ) : Nonempty (EffectTriple n) := ⟨⟨⟨⟨0, zero_lt_succ n⟩, ⟨⟨0, zero_lt_succ n⟩, ⟨n, Nat.lt_succ_self n⟩⟩⟩, by simp⟩⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instNonemptyEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:21
theorem twoArmScoreAverage_eq_count

The signed-score average depends only on the retained success count.

Formal statement
n :
s :
Unit n → Bool
twoArmScoreAverage s = (n : ℝ)⁻¹ * (2 * (scoreCount s : ℕ) - n)
Proof (Lean source)
-- @node: twoArmScoreAverage_eq_count lemma twoArmScoreAverage_eq_count {n : ℕ} (s : Unit n → Bool) : twoArmScoreAverage s = (n : ℝ)⁻¹ * (2 * (scoreCount s : ℕ) - n) := by unfold twoArmScoreAverage scoreCount congr 1 rw [show (∑ i, if s i then (1 : ℝ) else -1) = ∑ i, (2 * (if s i then (1 : ℝ) else 0) - 1) by apply Finset.sum_congr rfl intro i _ cases s i <;> norm_num] rw [Finset.sum_sub_distrib] rw [← Finset.mul_sum] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreAverage_eq_count · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:26
theorem twoArmPosteriorCompat_sum_prod_mul_apply Lemma twoArmPosteriorCompat_sum_prod_mul_apply in the paper ↗

the two arm posterior compat sums prod times evaluation.

Formal statement
I X :
q :
I → X → ℝ
h :
X → ℝ
i :
I
∑ r : I → X, (∏ j, q j (r j)) * h (r i)
= (∑ t, q i t * h t) * ∏ j ∈ Finset.univ.erase i, ∑ t, q j t
Proof (Lean source)
lemma twoArmPosteriorCompat_sum_prod_mul_apply {I X : Type*} [Fintype I] [DecidableEq I] [Fintype X] (q : I → X → ℝ) (h : X → ℝ) (i : I) : ∑ r : I → X, (∏ j, q j (r j)) * h (r i) = (∑ t, q i t * h t) * ∏ j ∈ Finset.univ.erase i, ∑ t, q j t := by rw [show (∑ r : I → X, (∏ j, q j (r j)) * h (r i)) = ∑ r : I → X, ∏ j, if j = i then q j (r j) * h (r j) else q j (r j) by apply Finset.sum_congr rfl intro r _ calc (∏ j, q j (r j)) * h (r i) = (∏ j, q j (r j)) * ∏ j, (if j = i then h (r j) else 1) := by simp [Finset.prod_ite_eq'] _ = ∏ j, q j (r j) * (if j = i then h (r j) else 1) := by rw [Finset.prod_mul_distrib] _ = _ := by apply Finset.prod_congr rfl intro j _ split <;> simp_all] let q' : I → X → ℝ := fun j t => if j = i then q j t * h t else q j t change (∑ r : I → X, ∏ j, q' j (r j)) = _ rw [← Fintype.prod_sum] dsimp [q'] rw [Finset.prod_eq_mul_prod_sdiff_singleton_of_mem (Finset.mem_univ i)] simp only [if_pos] congr 1 rw [Finset.sdiff_singleton_eq_erase] apply Finset.prod_congr rfl intro j hj have hji : j ≠ i := by simpa using hj simp [hji]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_sum_prod_mul_apply · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:43
theorem twoArmPosteriorCompat_marginal

the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, the two arm posterior compat marginal property holds.

Formal statement
n :
a θ :
ha1 :
a ≤ 1
:
|θ| ≤ a / 2
s :
Unit n → Bool
∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0)
Proof (Lean source)
lemma twoArmPosteriorCompat_marginal {n : ℕ} (a θ : ℝ) (ha1 : a ≤ 1) (hθ : |θ| ≤ a / 2) (s : Unit n → Bool) : ∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0) = twoArmBernoulliLikelihood θ s := by rw [show (∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0)) = ∑ r : Unit n → Bool × Bool, ∏ i, ((twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i) * (if (r i).1 = s i then 1 else 0)) by apply Finset.sum_congr rfl intro r _ by_cases hr : (fun i => (r i).1) = s · simp [hr, congrFun hr] · have hi : ∃ i, (r i).1 ≠ s i := by simpa only [Function.ne_iff] using hr obtain ⟨i, hi⟩ := hi simp only [hr, if_false, mul_zero] symm apply Finset.prod_eq_zero (Finset.mem_univ i) simp [hi]] let q : Unit n → (Bool × Bool) → ℝ := fun i t => (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p t * (if t.1 = s i then 1 else 0) change (∑ r : Unit n → Bool × Bool, ∏ i, q i (r i)) = _ rw [← Fintype.prod_sum] unfold twoArmBernoulliLikelihood apply Finset.prod_congr rfl intro i _ rw [show (∑ t : Bool × Bool, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p t * (if t.1 = s i then 1 else 0)) = ((twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).map (twoArmObservedScore 0)).p (s i) by simp [FiniteDesign.map_p, twoArmObservedScore]] rw [twoArmSmoothResponseType_score_mass] simp [twoArmBernoulliUnitDesign]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_marginal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:76
theorem twoArmPosteriorCompat_effectTarget

the two arm posterior compat effect target property holds.

Formal statement
n :
r :
Unit n → Bool × Bool
Proof (Lean source)
lemma twoArmPosteriorCompat_effectTarget {n : ℕ} (r : Unit n → Bool × Bool) : effectTarget (responseVectorEffectTriple r) = (n : ℝ)⁻¹ * ∑ i, twoArmResponseEffect (r i) := by rw [effectTarget_responseVectorEffectTriple] simp only [Finset.card_eq_sum_ones, Finset.sum_filter, twoArmResponseEffect] push_cast rw [div_eq_mul_inv, sub_mul, Finset.sum_mul, Finset.sum_mul, Finset.mul_sum, ← Finset.sum_sub_distrib] congr 1 funext i cases (r i).1 <;> cases (r i).2 <;> norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_effectTarget · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:124
theorem twoArmPosteriorCompat_mean_unit_posterior

the population size is positive, the parameter lies in the stated interval, the parameter lies in the stated interior interval, the two arm posterior compat mean unit posterior property holds.

Formal statement
n :
hn :
0 < n
a θ :
ha :
a ≤ 1 / 2
:
|θ| ≤ a / 2
s :
Unit n → Bool
(n : ℝ)⁻¹ * ∑ i, (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ))
Proof (Lean source)
lemma twoArmPosteriorCompat_mean_unit_posterior {n : ℕ} (hn : 0 < n) {a θ : ℝ} (ha : a ≤ 1 / 2) (hθ : |θ| ≤ a / 2) (s : Unit n → Bool) : (n : ℝ)⁻¹ * ∑ i, (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ)) = twoArmPosteriorTarget a θ s := by have hp : 1 + θ ≠ 0 := by have := (abs_le.mp hθ).1 linarith have hm : 1 - θ ≠ 0 := by have := (abs_le.mp hθ).2 linarith have hden : 1 - θ ^ 2 ≠ 0 := by rw [show 1 - θ ^ 2 = (1 + θ) * (1 - θ) by ring] exact mul_ne_zero hp hm unfold twoArmPosteriorTarget twoArmPosteriorWeight rw [twoArmScoreAverage_eq_count] rw [Finset.sum_ite] simp only [Finset.sum_const, nsmul_eq_mul] have hfalse : (Finset.univ.filter fun i => ¬s i).card = n - (scoreCount s : ℕ) := by have hpart := Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset (Unit n))) (p := fun i => s i) simp only [Finset.card_univ, Fintype.card_fin] at hpart change _ = n - (Finset.univ.filter fun i => s i).card omega rw [hfalse] have htrue : (Finset.univ.filter fun i => s i).card = (scoreCount s : ℕ) := rfl rw [htrue] have hk : (scoreCount s : ℕ) ≤ n := by exact Nat.le_of_lt_succ (scoreCount s).isLt push_cast [Nat.cast_sub hk] have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' field_simp [hp, hm, hden, hnR] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_mean_unit_posterior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:138
theorem twoArmPosteriorCompat_first_moment

the population size is positive, the parameter lies in the stated interval, the parameter lies in the stated interior interval, the two arm posterior compat first moment property holds.

Formal statement
n :
hn :
0 < n
a θ :
ha :
a ≤ 1 / 2
:
|θ| ≤ a / 2
s :
Unit n → Bool
∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0) * effectTarget (responseVectorEffectTriple r)
Proof (Lean source)
lemma twoArmPosteriorCompat_first_moment {n : ℕ} (hn : 0 < n) (a θ : ℝ) (ha : a ≤ 1 / 2) (hθ : |θ| ≤ a / 2) (s : Unit n → Bool) : ∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0) * effectTarget (responseVectorEffectTriple r) = twoArmBernoulliLikelihood θ s * twoArmPosteriorTarget a θ s := by have ha1 : a ≤ 1 := by linarith let P := twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ])) let q : Unit n → (Bool × Bool) → ℝ := fun i t => P.p t * (if t.1 = s i then 1 else 0) have hrewrite (r : Unit n → Bool × Bool) : (∏ i, P.p (r i)) * (if (fun i => (r i).1) = s then 1 else 0) = ∏ i, q i (r i) := by dsimp [q] by_cases hr : (fun i => (r i).1) = s · simp [congrFun hr] · have hi : ∃ i, (r i).1 ≠ s i := by simpa only [Function.ne_iff] using hr obtain ⟨i, hi⟩ := hi simp only [hr, if_false, mul_zero] symm apply Finset.prod_eq_zero (Finset.mem_univ i) simp [hi] simp_rw [show twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ])) = P by rfl] simp_rw [hrewrite, twoArmPosteriorCompat_effectTarget] rw [show (∑ r : Unit n → Bool × Bool, (∏ i, q i (r i)) * ((n : ℝ)⁻¹ * ∑ i, twoArmResponseEffect (r i))) = (n : ℝ)⁻¹ * ∑ i, ∑ r : Unit n → Bool × Bool, (∏ j, q j (r j)) * twoArmResponseEffect (r i) by simp_rw [Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro r _ ring] simp_rw [twoArmPosteriorCompat_sum_prod_mul_apply] have hunit (i : Unit n) : (∑ t, q i t * twoArmResponseEffect t) = (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith))).p (s i) * (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ)) := by rw [← twoArmSmoothResponseType_effect_score_mass a θ ha1 hθ 0 (s i)] apply Finset.sum_congr rfl intro t _ dsimp [q, P] simp [twoArmObservedScore] have hmarg (i : Unit n) : ∑ t, q i t = (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith))).p (s i) := by change ∑ t, P.p t * (if t.1 = s i then 1 else 0) = _ rw [show (∑ t, P.p t * (if t.1 = s i then 1 else 0)) = (P.map (twoArmObservedScore 0)).p (s i) by simp [FiniteDesign.map_p, twoArmObservedScore]] exact twoArmSmoothResponseType_score_mass a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ])) 0 (s i) simp_rw [hunit, hmarg] have hprod (i : Unit n) : (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith))).p (s i) * (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ)) * ∏ j ∈ Finset.univ.erase i, (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith))).p (s j) = twoArmBernoulliLikelihood θ s * (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ)) := by rw [twoArmBernoulliLikelihood] have hbern (j : Unit n) : (if s j then (1 + θ) / 2 else (1 - θ) / 2) = (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith))).p (s j) := by cases s j <;> simp [twoArmBernoulliUnitDesign] simp_rw [hbern] rw [← Finset.mul_prod_erase univ (fun j => (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith))).p (s j)) (Finset.mem_univ i)] ring simp_rw [hprod] rw [← Finset.mul_sum] calc (n : ℝ)⁻¹ * (twoArmBernoulliLikelihood θ s * ∑ i, (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ))) = twoArmBernoulliLikelihood θ s * ((n : ℝ)⁻¹ * ∑ i, (if s i then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ))) := by ring _ = _ := by rw [twoArmPosteriorCompat_mean_unit_posterior hn ha hθ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_first_moment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:174
theorem twoArmPosteriorCompat_square_completion

the population size is positive, the parameter lies in the stated interval, the parameter lies in the stated interior interval, the two arm posterior compat square completion property holds.

Formal statement
n :
hn :
0 < n
a θ :
ha :
a ≤ 1 / 2
:
|θ| ≤ a / 2
T :
Fin (n + 1) → ℝ
s :
Unit n → Bool
≤ ∑ r : Unit n → Bool × Bool, ((∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0)) * (T (scoreCount s) - effectTarget (responseVectorEffectTriple r)) ^ 2
Proof (Lean source)
lemma twoArmPosteriorCompat_square_completion {n : ℕ} (hn : 0 < n) (a θ : ℝ) (ha : a ≤ 1 / 2) (hθ : |θ| ≤ a / 2) (T : Fin (n + 1) → ℝ) (s : Unit n → Bool) : twoArmBernoulliLikelihood θ s * (T (scoreCount s) - twoArmPosteriorTarget a θ s) ^ 2 ≤ ∑ r : Unit n → Bool × Bool, ((∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0)) * (T (scoreCount s) - effectTarget (responseVectorEffectTriple r)) ^ 2 := by let P := twoArmSmoothResponseTypeDesign a θ (by linarith : a ≤ 1) (hθ.trans (by nlinarith [abs_nonneg θ])) let w : (Unit n → Bool × Bool) → ℝ := fun r => (∏ i, P.p (r i)) * (if (fun i => (r i).1) = s then 1 else 0) have hw0 (r : Unit n → Bool × Bool) : 0 ≤ w r := by dsimp [w] exact mul_nonneg (Finset.prod_nonneg fun i _ => P.p_nonneg (r i)) (by positivity) have hmarg : ∑ r, w r = twoArmBernoulliLikelihood θ s := by dsimp [w, P] exact twoArmPosteriorCompat_marginal a θ (by linarith) hθ s have hfirst : ∑ r, w r * effectTarget (responseVectorEffectTriple r) = twoArmBernoulliLikelihood θ s * twoArmPosteriorTarget a θ s := by dsimp [w, P] simpa only [mul_assoc] using twoArmPosteriorCompat_first_moment hn a θ ha hθ s have hcenter : ∑ r, w r * (twoArmPosteriorTarget a θ s - effectTarget (responseVectorEffectTriple r)) = 0 := by simp_rw [mul_sub] rw [Finset.sum_sub_distrib, ← Finset.sum_mul, hmarg, hfirst] ring have hid : (∑ r, w r * (T (scoreCount s) - effectTarget (responseVectorEffectTriple r)) ^ 2) = twoArmBernoulliLikelihood θ s * (T (scoreCount s) - twoArmPosteriorTarget a θ s) ^ 2 + ∑ r, w r * (twoArmPosteriorTarget a θ s - effectTarget (responseVectorEffectTriple r)) ^ 2 := by simp_rw [show ∀ r : Unit n → Bool × Bool, w r * (T (scoreCount s) - effectTarget (responseVectorEffectTriple r)) ^ 2 = w r * (T (scoreCount s) - twoArmPosteriorTarget a θ s) ^ 2 + w r * (twoArmPosteriorTarget a θ s - effectTarget (responseVectorEffectTriple r)) ^ 2 + 2 * (T (scoreCount s) - twoArmPosteriorTarget a θ s) * (w r * (twoArmPosteriorTarget a θ s - effectTarget (responseVectorEffectTriple r))) by intro r; ring] rw [Finset.sum_add_distrib, Finset.sum_add_distrib] rw [← Finset.sum_mul, hmarg] rw [← Finset.mul_sum, hcenter] ring rw [hid] exact le_add_of_nonneg_right (sum_nonneg fun r _ => mul_nonneg (hw0 r) (sq_nonneg _))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_square_completion · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:263
theorem twoArmPosteriorCompat_product_formula

the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, the two arm posterior compat product formula property holds.

Formal statement
n :
a θ :
ha1 :
a ≤ 1
:
|θ| ≤ a
r :
Unit n → Bool × Bool
∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (r i)
= ((a + θ) / 2) ^ (Finset.univ.filter fun i => (r i).1 && !(r i).2).card * ((a - θ) / 2) ^ (Finset.univ.filter fun i => !((r i).1) && (r i).2).card * ((1 - a) / 2) ^ (Finset.univ.filter fun i => (r i).1 = (r i).2).card
Proof (Lean source)
lemma twoArmPosteriorCompat_product_formula {n : ℕ} (a θ : ℝ) (ha1 : a ≤ 1) (hθ : |θ| ≤ a) (r : Unit n → Bool × Bool) : ∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (r i) = ((a + θ) / 2) ^ (Finset.univ.filter fun i => (r i).1 && !(r i).2).card * ((a - θ) / 2) ^ (Finset.univ.filter fun i => !((r i).1) && (r i).2).card * ((1 - a) / 2) ^ (Finset.univ.filter fun i => (r i).1 = (r i).2).card := by rw [show (∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (r i)) = ∏ i, if (r i).1 && !(r i).2 then (a + θ) / 2 else if !((r i).1) && (r i).2 then (a - θ) / 2 else (1 - a) / 2 by apply Finset.prod_congr rfl intro i _ cases h0 : (r i).1 <;> cases h1 : (r i).2 <;> simp [h0, h1, twoArmSmoothResponseTypeDesign]] rw [Finset.prod_ite] simp only [Finset.prod_const, Finset.card_filter, nsmul_eq_mul] rw [Finset.prod_ite] simp only [Finset.prod_const] have hneg : (Finset.univ.filter fun i => ¬((r i).1 && !(r i).2)).filter (fun i => !((r i).1) && (r i).2) = Finset.univ.filter (fun i => !((r i).1) && (r i).2) := by ext i cases h0 : (r i).1 <;> cases h1 : (r i).2 <;> simp [h0, h1] have hzero : (Finset.univ.filter fun i => ¬((r i).1 && !(r i).2)).filter (fun i => ¬(!((r i).1) && (r i).2)) = Finset.univ.filter (fun i => (r i).1 = (r i).2) := by ext i cases h0 : (r i).1 <;> cases h1 : (r i).2 <;> simp [h0, h1] rw [hneg, hzero] simp only [Finset.card_eq_sum_ones, Finset.sum_filter] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_product_formula · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:317
def twoArmPosteriorCompat_responseSchedule

The two arm posterior compat response schedule property holds.

Definition (Lean source)
n :
r :
Unit n → Bool × Bool
twoArmPosteriorCompat_responseSchedule r :
Schedule 2 n
fun i arm => if arm = 0 then (r i).1 else (r i).2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_responseSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:350
def twoArmPosteriorCompat_scheduleResponse

The two arm posterior compat schedule response property holds.

Definition (Lean source)
n :
z :
Schedule 2 n
twoArmPosteriorCompat_scheduleResponse z :
Unit n → Bool × Bool
fun i => (z i 0, z i 1)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_scheduleResponse · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:355
def twoArmPosteriorCompat_responseScheduleEquiv

The two arm posterior compat response schedule equiv property holds.

Definition (Lean source)
n :
twoArmPosteriorCompat_responseScheduleEquiv n :
(Unit n → Bool × Bool) ≃ Schedule 2 n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_responseScheduleEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:360
theorem twoArmPosteriorCompat_hasEffectTriple_iff

the two arm posterior compat has effect triple if and only if property holds.

Formal statement
n :
e :
r :
Unit n → Bool × Bool
Proof (Lean source)
lemma twoArmPosteriorCompat_hasEffectTriple_iff {n : ℕ} (e : EffectTriple n) (r : Unit n → Bool × Bool) : hasEffectTriple e (twoArmPosteriorCompat_responseSchedule r) ↔ responseVectorEffectTriple r = e := by constructor · intro h simp only [hasEffectTriple, twoArmPosteriorCompat_responseSchedule] at h apply Subtype.ext apply Prod.ext · apply Fin.ext exact h.1 · apply Prod.ext · apply Fin.ext exact h.2.1 · apply Fin.ext exact h.2.2 · intro h subst e exact ⟨rfl, rfl, rfl⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_hasEffectTriple_iff · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:373
theorem twoArmPosteriorCompat_product_eq_of_effectTriple_eq

the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, the stated side condition holds, the two arm posterior compat product equals when effect triple equals.

Formal statement
n :
a θ :
ha1 :
a ≤ 1
:
|θ| ≤ a
r t :
Unit n → Bool × Bool
∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (r i)
= ∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (t i)
Proof (Lean source)
lemma twoArmPosteriorCompat_product_eq_of_effectTriple_eq {n : ℕ} (a θ : ℝ) (ha1 : a ≤ 1) (hθ : |θ| ≤ a) {r t : Unit n → Bool × Bool} (h : responseVectorEffectTriple r = responseVectorEffectTriple t) : ∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (r i) = ∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 hθ).p (t i) := by rw [twoArmPosteriorCompat_product_formula a θ ha1 hθ r, twoArmPosteriorCompat_product_formula a θ ha1 hθ t] have hp := congrArg (fun e : EffectTriple n => (e.1.1 : ℕ)) h have hm := congrArg (fun e : EffectTriple n => (e.1.2.1 : ℕ)) h have hz := congrArg (fun e : EffectTriple n => (e.1.2.2 : ℕ)) h change (Finset.univ.filter fun i => (r i).1 && !(r i).2).card = (Finset.univ.filter fun i => (t i).1 && !(t i).2).card at hp change (Finset.univ.filter fun i => !((r i).1) && (r i).2).card = (Finset.univ.filter fun i => !((t i).1) && (t i).2).card at hm change (Finset.univ.filter fun i => (r i).1 = (r i).2).card = (Finset.univ.filter fun i => (t i).1 = (t i).2).card at hz rw [hp, hm, hz]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_product_eq_of_effectTriple_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:394
theorem twoArmPosteriorCompat_smoothEffect_canonical_mixture

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, the two arm posterior compat smooth effect canonical mixture property holds.

Formal statement
n :
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
:
|θ| ≤ a / 2
z :
Schedule 2 n
∑ e : EffectTriple n, (twoArmSmoothEffectDesign n a θ ha0 ha1).p e * canonicalScheduleKernel e z
= ∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p (twoArmPosteriorCompat_scheduleResponse z i)
Proof (Lean source)
lemma twoArmPosteriorCompat_smoothEffect_canonical_mixture {n : ℕ} (a θ : ℝ) (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (hθ : |θ| ≤ a / 2) (z : Schedule 2 n) : ∑ e : EffectTriple n, (twoArmSmoothEffectDesign n a θ ha0 ha1).p e * canonicalScheduleKernel e z = ∏ i, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p (twoArmPosteriorCompat_scheduleResponse z i) := by classical let r0 := twoArmPosteriorCompat_scheduleResponse z let e0 := responseVectorEffectTriple r0 let P := twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ])) have hrz : twoArmPosteriorCompat_responseSchedule r0 = z := by exact (twoArmPosteriorCompat_responseScheduleEquiv n).right_inv z have hz0 : hasEffectTriple e0 z := by rw [← hrz, twoArmPosteriorCompat_hasEffectTriple_iff] rw [Finset.sum_eq_single e0] · unfold twoArmSmoothEffectDesign rw [FiniteDesign.map_p] simp only [prodDesign_p] simp only [twoArmClampedParameter_eq hθ] rw [Finset.sum_mul] calc (∑ r : Unit n → Bool × Bool, (if responseVectorEffectTriple r = e0 then ∏ i, P.p (r i) else 0) * canonicalScheduleKernel e0 z) = ∑ r : Unit n → Bool × Bool, (∏ i, P.p (r0 i)) * canonicalScheduleKernel e0 (twoArmPosteriorCompat_responseSchedule r) := by apply Finset.sum_congr rfl intro r _ by_cases hr : responseVectorEffectTriple r = e0 · rw [if_pos hr] have hmass : (∏ i, P.p (r i)) = ∏ i, P.p (r0 i) := by apply twoArmPosteriorCompat_product_eq_of_effectTriple_eq a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ])) simpa [e0] using hr rw [hmass] have hzr : hasEffectTriple e0 (twoArmPosteriorCompat_responseSchedule r) := (twoArmPosteriorCompat_hasEffectTriple_iff e0 r).2 hr simp [canonicalScheduleKernel, hz0, hzr] · rw [if_neg hr] have hzr : ¬hasEffectTriple e0 (twoArmPosteriorCompat_responseSchedule r) := by simpa [twoArmPosteriorCompat_hasEffectTriple_iff] using hr simp [canonicalScheduleKernel, hzr] _ = (∏ i, P.p (r0 i)) * ∑ r : Unit n → Bool × Bool, canonicalScheduleKernel e0 (twoArmPosteriorCompat_responseSchedule r) := by rw [Finset.mul_sum] _ = ∏ i, P.p (r0 i) := by rw [Fintype.sum_equiv (twoArmPosteriorCompat_responseScheduleEquiv n) (fun r => canonicalScheduleKernel e0 (twoArmPosteriorCompat_responseSchedule r)) (fun z => canonicalScheduleKernel e0 z) (fun _ => rfl)] rw [canonicalScheduleKernel_sum, mul_one] _ = _ := by rfl · intro e _ he have hne : ¬hasEffectTriple e z := by intro hez have h1 := (twoArmPosteriorCompat_hasEffectTriple_iff e r0).1 (by simpa [hrz] using hez) have h0 := (twoArmPosteriorCompat_hasEffectTriple_iff e0 r0).1 (by simpa [hrz] using hz0) exact he (h1.symm.trans h0) simp [canonicalScheduleKernel, hne] · intro h exact (h (Finset.mem_univ e0)).elim
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_smoothEffect_canonical_mixture · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:413
def twoArmPosteriorCompat_zeroAssignDesign

The two arm posterior compat zero assign design property holds.

Definition (Lean source)
n :
twoArmPosteriorCompat_zeroAssignDesign n :
clause 1
p A := if A = (fun _ => 0) then 1 else 0
clause 2
p_nonneg A := by split_ifs <;> positivity
clause 3
p_sum := by simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_zeroAssignDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:479
theorem twoArmPosteriorCompat_zeroAssign_labeledRisk

the two arm posterior compat zero assign labeled risk property holds.

Formal statement
n :
f :
ℕ → ℝ
z :
Schedule 2 n
Proof (Lean source)
lemma twoArmPosteriorCompat_zeroAssign_labeledRisk {n : ℕ} (f : ℕ → ℝ) (z : Schedule 2 n) : labeledRisk twoArmContrast (twoArmPosteriorCompat_zeroAssignDesign n, scalarClippedEstimator f) z = (clip twoArmContrast (f (scoreCount (fun i => z i 0))) - tauC twoArmContrast z) ^ 2 := by unfold labeledRisk FiniteDesign.mse FiniteDesign.E twoArmPosteriorCompat_zeroAssignDesign rw [Finset.sum_eq_single (fun _ => 0)] · simp [scalarClippedEstimator, observedScore, obsOutcome, potentialOutcome, scoreCount, twoArmContrast, clip] · intro A _ hA simp [hA] · simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_zeroAssign_labeledRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:486
theorem twoArmPosteriorCompat_effectRisk_eq_responseRisk

the first arm count satisfies its stated condition, the parameter lies in the stated interval, the parameter lies in the stated interior interval, the two arm posterior compat effect risk equals response risk.

Formal statement
n :
a θ :
ha0 :
0 ≤ a
ha :
a ≤ 1 / 2
:
|θ| ≤ a / 2
f :
ℕ → ℝ
= ∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (clip twoArmContrast (f (scoreCount (fun i => (r i).1))) - effectTarget (responseVectorEffectTriple r)) ^ 2
Proof (Lean source)
lemma twoArmPosteriorCompat_effectRisk_eq_responseRisk {n : ℕ} (a θ : ℝ) (ha0 : 0 ≤ a) (ha : a ≤ 1 / 2) (hθ : |θ| ≤ a / 2) (f : ℕ → ℝ) : (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).E (statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e) (fun x => clip twoArmContrast (f x))) = ∑ r : Unit n → Bool × Bool, (∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (clip twoArmContrast (f (scoreCount (fun i => (r i).1))) - effectTarget (responseVectorEffectTriple r)) ^ 2 := by rw [show (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).E (statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e) (fun x => clip twoArmContrast (f x))) = (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).E (fun e => (twoArmScoreExperiment (twoArmPosteriorCompat_zeroAssignDesign n)).statisticRisk effectTarget (fun x => clip twoArmContrast (f x)) e) by apply Finset.sum_congr rfl intro e _ rw [twoArmCount_statewiseSquaredLoss_eq_statisticRisk]] simp_rw [← clippedFullRisk_eq_statisticRisk] simp_rw [twoArmScoreExperiment_fullRisk_eq_labeled] unfold FiniteDesign.E simp_rw [Finset.mul_sum] rw [Finset.sum_comm] calc (∑ z : Schedule 2 n, ∑ e : EffectTriple n, (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).p e * (canonicalScheduleKernel e z * labeledRisk twoArmContrast (twoArmPosteriorCompat_zeroAssignDesign n, scalarClippedEstimator f) z)) = ∑ z : Schedule 2 n, (∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (twoArmPosteriorCompat_scheduleResponse z i)) * labeledRisk twoArmContrast (twoArmPosteriorCompat_zeroAssignDesign n, scalarClippedEstimator f) z := by apply Finset.sum_congr rfl intro z _ rw [show (∑ e : EffectTriple n, (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).p e * (canonicalScheduleKernel e z * labeledRisk twoArmContrast (twoArmPosteriorCompat_zeroAssignDesign n, scalarClippedEstimator f) z)) = (∑ e : EffectTriple n, (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).p e * canonicalScheduleKernel e z) * labeledRisk twoArmContrast (twoArmPosteriorCompat_zeroAssignDesign n, scalarClippedEstimator f) z by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro e _ ring] rw [twoArmPosteriorCompat_smoothEffect_canonical_mixture (n := n) a θ ha0 (by linarith) hθ z] _ = _ := by apply Fintype.sum_equiv (twoArmPosteriorCompat_responseScheduleEquiv n).symm _ _ intro z rw [twoArmPosteriorCompat_zeroAssign_labeledRisk] let r := twoArmPosteriorCompat_scheduleResponse z have heff : tauC twoArmContrast (twoArmPosteriorCompat_responseSchedule r) = effectTarget (responseVectorEffectTriple r) := twoArmTau_eq_effectTriple ((twoArmPosteriorCompat_hasEffectTriple_iff _ r).2 rfl) have hrz : twoArmPosteriorCompat_responseSchedule r = z := (twoArmPosteriorCompat_responseScheduleEquiv n).right_inv z rw [← hrz, heff] have hsym : (twoArmPosteriorCompat_responseScheduleEquiv n).symm (twoArmPosteriorCompat_responseSchedule r) = r := by exact (twoArmPosteriorCompat_responseScheduleEquiv n).symm_apply_apply r rw [hsym] simp [r, twoArmPosteriorCompat_scheduleResponse, twoArmPosteriorCompat_responseSchedule, scoreCount]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_effectRisk_eq_responseRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:501
theorem twoArmPosteriorCompat_error_le_effectRisk

the population size is positive, the first arm count satisfies its stated condition, the parameter lies in the stated interval, the parameter lies in the stated interior interval, the two arm posterior compat error is at most effect risk.

Formal statement
n :
hn :
0 < n
a θ :
ha0 :
0 ≤ a
ha :
a ≤ 1 / 2
:
|θ| ≤ a / 2
f :
ℕ → ℝ
Proof (Lean source)
lemma twoArmPosteriorCompat_error_le_effectRisk {n : ℕ} (hn : 0 < n) (a θ : ℝ) (ha0 : 0 ≤ a) (ha : a ≤ 1 / 2) (hθ : |θ| ≤ a / 2) (f : ℕ → ℝ) : ∑ s : Unit n → Bool, twoArmBernoulliLikelihood θ s * (clip twoArmContrast (f (scoreCount s)) - twoArmPosteriorTarget a θ s) ^ 2 ≤ (twoArmSmoothEffectDesign n a θ ha0 (by linarith)).E (statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e) (fun x => clip twoArmContrast (f x))) := by rw [twoArmPosteriorCompat_effectRisk_eq_responseRisk a θ ha0 ha hθ f] calc _ ≤ ∑ s : Unit n → Bool, ∑ r : Unit n → Bool × Bool, ((∏ i, (twoArmSmoothResponseTypeDesign a θ (by linarith) (hθ.trans (by nlinarith [abs_nonneg θ]))).p (r i)) * (if (fun i => (r i).1) = s then 1 else 0)) * (clip twoArmContrast (f (scoreCount s)) - effectTarget (responseVectorEffectTriple r)) ^ 2 := by apply Finset.sum_le_sum intro s _ exact twoArmPosteriorCompat_square_completion hn a θ ha hθ (fun x => clip twoArmContrast (f x)) s _ = _ := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro r _ rw [Finset.sum_eq_single (fun i => (r i).1)] · simp · intro s _ hs simp [Ne.symm hs] · simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_error_le_effectRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:572

The smooth two-arm prior measure has the stated density on the parameter interval and is pushed forward to effect-count triples.

Definition (Lean source)
a :
twoArmPosteriorCompat_smoothPriorMeasure a :
(parameterMeasure (-1 / 2) (1 / 2)).withDensity (fun θ => ofReal (smoothPrior 0 (a / 2) θ))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_smoothPriorMeasure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:603
theorem twoArmPosteriorCompat_smoothPriorMeasure_isProbability

the parameter lies in the stated interval, the second arm count satisfies its stated condition, the two arm posterior compat smooth prior measure is probability property holds.

Formal statement
a :
ha :
0 < a
ha1 :
a ≤ 1
Proof (Lean source)
lemma twoArmPosteriorCompat_smoothPriorMeasure_isProbability (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1) : IsProbabilityMeasure (twoArmPosteriorCompat_smoothPriorMeasure a) := by apply IsProbabilityMeasure.mk unfold twoArmPosteriorCompat_smoothPriorMeasure rw [withDensity_apply _ MeasurableSet.univ] simp only [Measure.restrict_univ] rw [← ofReal_integral_eq_lintegral_ofReal (smoothPrior_integrable_parameterMeasure (by positivity : 0 < a / 2)) (Filter.Eventually.of_forall (smoothPrior_nonneg (by positivity : 0 < a / 2)))] rw [integral_smoothPrior_parameterMeasure (by positivity : 0 < a / 2) (by linarith) (by linarith)] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_smoothPriorMeasure_isProbability · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmPosteriorCompatibility.lean:611
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmScheduleKernel 36 declarations
theorem canonicalScheduleKernel_nonneg

the canonical schedule kernel is nonnegative.

Formal statement
n :
theta :
z :
Schedule 2 n
Proof (Lean source)
lemma canonicalScheduleKernel_nonneg {n : ℕ} (theta : EffectTriple n) (z : Schedule 2 n) : 0 ≤ canonicalScheduleKernel theta z := by classical unfold canonicalScheduleKernel split_ifs · positivity · exact le_rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalScheduleKernel_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:10
theorem canonicalScoreMass_sum

the canonical score mass sums.

Formal statement
n :
theta :
A :
Assign 2 n
∑ s : Unit n → Bool, ∑ z : Schedule 2 n, (if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel theta z else 0)
= 1
Proof (Lean source)
lemma canonicalScoreMass_sum {n : ℕ} (theta : EffectTriple n) (A : Assign 2 n) : ∑ s : Unit n → Bool, ∑ z : Schedule 2 n, (if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel theta z else 0) = 1 := by classical rw [Finset.sum_comm] calc (∑ z : Schedule 2 n, ∑ s : Unit n → Bool, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel theta z else 0) = ∑ z : Schedule 2 n, canonicalScheduleKernel theta z := by apply Finset.sum_congr rfl intro z _ simp _ = 1 := canonicalScheduleKernel_sum theta
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalScoreMass_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:20
def canonicalNuLift

The canonical nu lift property holds.

Definition (Lean source)
n :
nu :
canonicalNuLift nu :
FiniteDesign (Schedule 2 n)
clause 1
clause 2
p_nonneg z := sum_nonneg fun theta _ ↦ mul_nonneg (nu.p_nonneg theta) (canonicalScheduleKernel_nonneg theta z)
clause 3
p_sum := by rw [Finset.sum_comm] simp_rw [← Finset.mul_sum, canonicalScheduleKernel_sum, mul_one] exact nu.p_sum
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalNuLift · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:37
def scoreCount

The score count adds the positive-effect count to the number of successful zero-effect score bits.

Definition (Lean source)
n :
s :
Unit n → Bool
scoreCount s :
Fin (n + 1)
⟨(Finset.univ.filter fun i ↦ s i).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i ↦ s i) univ))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scoreCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:49
def twoArmScoreExperiment

The two-arm score experiment draws an effect-count triple from the prior and then draws its transformed score count from the induced binomial law.

Definition (Lean source)
n :
D :
twoArmScoreExperiment D :
FiniteUniformExperiment (EffectTriple n) PUnit.{1} (Assign 2 n × (Unit n → Bool)) (Fin (n + 1))
clause 1
allocations := {unit}
clause 2
allocations_nonempty := by simp
clause 3
observationMass theta _ obs := D.p obs.1 * ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z obs.1 i)
= obs.2 then canonicalScheduleKernel theta z else 0
clause 4
observationMass_nonneg theta _ obs := mul_nonneg (D.p_nonneg obs.1) (sum_nonneg fun z _ ↦ by split_ifs · exact canonicalScheduleKernel_nonneg theta z · exact le_rfl)
clause 5
observationMass_sum theta _ := by rw [Fintype.sum_prod_type] simp_rw [← Finset.mul_sum, canonicalScoreMass_sum] simpa using D.p_sum
clause 6
statistic _ obs := scoreCount obs.2
clause 7
fallbackObservation := (fun _ ↦ 0, fun _ ↦ false)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:57
theorem twoArmScoreExperiment_jointMass

the two arm score experiment joint mass property holds.

Formal statement
n :
D :
theta :
obs :
Assign 2 n × (Unit n → Bool)
(twoArmScoreExperiment D).jointMass theta (unit, obs)
= D.p obs.1 * ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z obs.1 i) = obs.2 then canonicalScheduleKernel theta z else 0
Proof (Lean source)
lemma twoArmScoreExperiment_jointMass {n : ℕ} (D : FiniteDesign (Assign 2 n)) (theta : EffectTriple n) (obs : Assign 2 n × (Unit n → Bool)) : (twoArmScoreExperiment D).jointMass theta (unit, obs) = D.p obs.1 * ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z obs.1 i) = obs.2 then canonicalScheduleKernel theta z else 0 := by simp [twoArmScoreExperiment, jointMass, uniformAllocationMass]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment_jointMass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:80
theorem twoArmCanonicalScore_mass_eq_statisticFactor

the two arm canonical score mass equals statistic factor.

Formal statement
n :
theta :
A :
Assign 2 n
s :
Unit n → Bool
(∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel theta z else 0)
= (∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (scoreCount s : ℕ) = (theta.1.1 : ℕ) + k then binomialHalf (theta.1.2.2 : ℕ) k else 0) / choose n (scoreCount s : ℕ)
Proof (Lean source)
lemma twoArmCanonicalScore_mass_eq_statisticFactor {n : ℕ} (theta : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) : (∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel theta z else 0) = (∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (scoreCount s : ℕ) = (theta.1.1 : ℕ) + k then binomialHalf (theta.1.2.2 : ℕ) k else 0) / choose n (scoreCount s : ℕ) := by let x := scoreCount s rw [← twoArmXMass_eq_binomial_sum theta A x] rw [← twoArmCanonicalConditionalScore_mass theta A x s] · apply Finset.sum_congr rfl intro z _ by_cases hs : (fun i ↦ twoArmS z A i) = s · have hx : twoArmX z A = x := by apply Fin.ext change (Finset.univ.filter fun i ↦ twoArmS z A i).card = (Finset.univ.filter fun i ↦ s i).card congr 1 ext i simp only [mem_filter, Finset.mem_univ, true_and] rw [congrFun hs i] simp [hs, hx] · simp [hs] · rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScore_mass_eq_statisticFactor · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:93
def twoArmScoreFactorization

The two arm score factorization property holds.

Definition (Lean source)
n :
D :
twoArmScoreFactorization D :
clause 1
carrierWeight sample := D.p sample.2.1 / choose n (scoreCount sample.2.2 : ℕ)
clause 2
carrierWeight_nonneg sample := div_nonneg (D.p_nonneg sample.2.1) (by positivity)
clause 3
statisticFactor theta x := ∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (x : ℕ)
= (theta.1.1 : ℕ) + k then binomialHalf (theta.1.2.2 : ℕ) k else 0
clause 4
statisticFactor_nonneg theta x := sum_nonneg fun k _ ↦ by split_ifs · unfold binomialHalf positivity · exact le_rfl
clause 5
jointMass_factor theta sample := by rcases sample with ⟨u, A, s⟩ cases u rw [twoArmScoreExperiment_jointMass] rw [twoArmCanonicalScore_mass_eq_statisticFactor] simp only [sampleStatistic, twoArmScoreExperiment] simp only [div_eq_mul_inv] ac_rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreFactorization · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:121
def scoreToObserved

A transformed score and treatment assignment determine the corresponding observed outcome.

Definition (Lean source)
n :
A :
Assign 2 n
s :
Unit n → Bool
scoreToObserved A s :
fun i ↦ if A i = 0 then s i else !(s i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scoreToObserved · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:148
theorem scoreToObserved_twoArmS

the score to observed two arm s property holds.

Formal statement
n :
z :
Schedule 2 n
A :
Assign 2 n
scoreToObserved A (fun i ↦ twoArmS z A i) = obsOutcome z A
Proof (Lean source)
lemma scoreToObserved_twoArmS {n : ℕ} (z : Schedule 2 n) (A : Assign 2 n) : scoreToObserved A (fun i ↦ twoArmS z A i) = obsOutcome z A := by funext i by_cases hA : A i = 0 · simp [scoreToObserved, twoArmS, obsOutcome, potentialOutcome, hA] · have hA1 : A i = 1 := Fin.eq_one_of_ne_zero _ hA simp [scoreToObserved, twoArmS, obsOutcome, potentialOutcome, hA, hA1]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scoreToObserved_twoArmS · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:153
def scoreFullEstimator

The score full estimator property holds.

Definition (Lean source)
n :
scoreFullEstimator est :
PUnit.{1} × (Assign 2 n × (Unit n → Bool)) → ℝ
fun sample ↦ est sample.2.1 (scoreToObserved sample.2.1 sample.2.2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scoreFullEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:163

The two-arm effect target is the positive-effect share minus the negative-effect share.

Definition (Lean source)
n :
theta :
effectTarget theta :
((((theta.1.1 : ℕ) : ℝ) - ((theta.1.2.1 : ℕ) : ℝ)) / n)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.effectTarget · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:170
theorem twoArmScoreExperiment_fullRisk_eq

the two arm score experiment full risk equals property holds.

Formal statement
n :
D :
theta :
= ∑ A : Assign 2 n, D.p A * ∑ z : Schedule 2 n, canonicalScheduleKernel theta z * ((est A (obsOutcome z A) : ℝ) - effectTarget theta) ^ 2
Proof (Lean source)
lemma twoArmScoreExperiment_fullRisk_eq {n : ℕ} (D : FiniteDesign (Assign 2 n)) (est : Estimator 2 n twoArmContrast) (theta : EffectTriple n) : (twoArmScoreExperiment D).fullRisk effectTarget (scoreFullEstimator est) theta = ∑ A : Assign 2 n, D.p A * ∑ z : Schedule 2 n, canonicalScheduleKernel theta z * ((est A (obsOutcome z A) : ℝ) - effectTarget theta) ^ 2 := by classical unfold fullRisk rw [Fintype.sum_prod_type] simp only [Finset.univ_unique, Finset.sum_singleton] rw [Fintype.sum_prod_type] simp only [scoreFullEstimator] simp_rw [jointMass, uniformAllocationMass, twoArmScoreExperiment] simp only [mem_singleton, ↓reduceIte, Finset.card_singleton, cast_one, inv_one, one_mul] change (∑ A : Assign 2 n, ∑ s : Unit n → Bool, (D.p A * ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel theta z else 0) * ((est A (scoreToObserved A s) : ℝ) - effectTarget theta) ^ 2) = _ apply Finset.sum_congr rfl intro A _ simp_rw [mul_assoc] rw [← Finset.mul_sum] congr 1 simp_rw [Finset.sum_mul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z _ rw [Finset.sum_eq_single (fun i ↦ twoArmS z A i)] · rw [scoreToObserved_twoArmS] simp · intro s _ hs simp [Ne.symm hs] · simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment_fullRisk_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:175
theorem twoArmScoreFactorization_fiberCarrierMass

the two arm score factorization fiber carrier mass property holds.

Formal statement
n :
D :
x :
Fin (n + 1)
Proof (Lean source)
lemma twoArmScoreFactorization_fiberCarrierMass {n : ℕ} (D : FiniteDesign (Assign 2 n)) (x : Fin (n + 1)) : (twoArmScoreFactorization D).fiberCarrierMass x = 1 := by classical unfold fiberCarrierMass rw [Fintype.sum_prod_type] simp only [Finset.univ_unique, Finset.sum_singleton] rw [Fintype.sum_prod_type] simp only [twoArmScoreFactorization, sampleStatistic, twoArmScoreExperiment] rw [Finset.sum_comm] have hx : (x : ℕ) ≤ n := Nat.le_of_lt_succ x.isLt have hchoose : (choose n (x : ℕ) : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hx).ne' calc (∑ s : Unit n → Bool, ∑ A : Assign 2 n, if scoreCount s = x then D.p A / choose n (scoreCount s : ℕ) else 0) = ∑ s : Unit n → Bool, if scoreCount s = x then (1 : ℝ) / choose n (x : ℕ) else 0 := by apply Finset.sum_congr rfl intro s _ by_cases hs : scoreCount s = x · simp only [hs, if_pos] rw [← Finset.sum_div, D.p_sum] · simp [hs] _ = (choose n (x : ℕ) : ℝ) / choose n (x : ℕ) := by rw [Finset.sum_ite, Finset.sum_const_zero, add_zero, Finset.sum_const, nsmul_eq_mul, ← Fintype.card_subtype] rw [show card {s : Unit n → Bool // scoreCount s = x} = choose n (x : ℕ) by rw [← twoArmScoreSupport_card n x] apply Fintype.card_congr exact Equiv.subtypeEquiv (Equiv.refl _) (by intro s rw [Fin.ext_iff] rfl)] rw [div_eq_mul_inv] simp change (choose n (x : ℕ) : ℝ) * (choose n (x : ℕ) : ℝ)⁻¹ = (choose n (x : ℕ) : ℝ) * (choose n (x : ℕ) : ℝ)⁻¹ rfl _ = 1 := div_self hchoose
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreFactorization_fiberCarrierMass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:216
theorem twoArmScoreExperiment_statisticMass

the two arm score experiment statistic mass property holds.

Formal statement
n :
D :
theta :
x :
Fin (n + 1)
= ∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (x : ℕ) = (theta.1.1 : ℕ)
+ k then binomialHalf (theta.1.2.2 : ℕ) k else 0
Proof (Lean source)
lemma twoArmScoreExperiment_statisticMass {n : ℕ} (D : FiniteDesign (Assign 2 n)) (theta : EffectTriple n) (x : Fin (n + 1)) : (twoArmScoreExperiment D).statisticMass theta x = ∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (x : ℕ) = (theta.1.1 : ℕ) + k then binomialHalf (theta.1.2.2 : ℕ) k else 0 := by rw [(twoArmScoreFactorization D).statisticMass_eq_factor_mul_fiberCarrierMass] rw [twoArmScoreFactorization_fiberCarrierMass] simp [twoArmScoreFactorization]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment_statisticMass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:265
theorem twoArmScoreExperiment_statisticRisk_eq

the two arm score experiment statistic risk equals property holds.

Formal statement
n :
D :
f :
Fin (n + 1) → ℝ
theta :
= ∑ x : Fin (n + 1), (∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (x : ℕ) = (theta.1.1 : ℕ) + k then binomialHalf (theta.1.2.2 : ℕ) k else 0) * (f x - effectTarget theta) ^ 2
Proof (Lean source)
lemma twoArmScoreExperiment_statisticRisk_eq {n : ℕ} (D : FiniteDesign (Assign 2 n)) (f : Fin (n + 1) → ℝ) (theta : EffectTriple n) : (twoArmScoreExperiment D).statisticRisk effectTarget f theta = ∑ x : Fin (n + 1), (∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), if (x : ℕ) = (theta.1.1 : ℕ) + k then binomialHalf (theta.1.2.2 : ℕ) k else 0) * (f x - effectTarget theta) ^ 2 := by classical have hrisk : (twoArmScoreExperiment D).statisticRisk effectTarget f theta = ∑ x : Fin (n + 1), (twoArmScoreExperiment D).statisticMass theta x * (f x - effectTarget theta) ^ 2 := by simp only [statisticRisk, statisticMass, Finset.sum_mul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z _ rw [Finset.sum_eq_single ((twoArmScoreExperiment D).sampleStatistic z)] · simp · intro x _ hx simp [Ne.symm hx] · simp rw [hrisk] simp_rw [twoArmScoreExperiment_statisticMass]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment_statisticRisk_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:278
theorem canonicalScheduleKernel_mul_sq_target

the canonical schedule kernel times squared target property holds.

Formal statement
n :
theta :
z :
Schedule 2 n
A :
Assign 2 n
canonicalScheduleKernel theta z * ((est A (obsOutcome z A) : ℝ) - effectTarget theta) ^ 2
= canonicalScheduleKernel theta z * ((est A (obsOutcome z A) : ℝ) - tauC twoArmContrast z) ^ 2
Proof (Lean source)
lemma canonicalScheduleKernel_mul_sq_target {n : ℕ} (theta : EffectTriple n) (z : Schedule 2 n) (A : Assign 2 n) (est : Estimator 2 n twoArmContrast) : canonicalScheduleKernel theta z * ((est A (obsOutcome z A) : ℝ) - effectTarget theta) ^ 2 = canonicalScheduleKernel theta z * ((est A (obsOutcome z A) : ℝ) - tauC twoArmContrast z) ^ 2 := by by_cases hz : hasEffectTriple theta z · rw [twoArmTau_eq_effectTriple hz] rfl · simp [canonicalScheduleKernel, hz]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalScheduleKernel_mul_sq_target · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:309
theorem twoArmScoreExperiment_fullRisk_eq_labeled

the two arm score experiment full risk equals labeled.

Formal statement
n :
D :
theta :
Proof (Lean source)
lemma twoArmScoreExperiment_fullRisk_eq_labeled {n : ℕ} (D : FiniteDesign (Assign 2 n)) (est : Estimator 2 n twoArmContrast) (theta : EffectTriple n) : (twoArmScoreExperiment D).fullRisk effectTarget (scoreFullEstimator est) theta = ∑ z : Schedule 2 n, canonicalScheduleKernel theta z * labeledRisk twoArmContrast (D, est) z := by rw [twoArmScoreExperiment_fullRisk_eq] simp_rw [Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z _ unfold labeledRisk mse E rw [Finset.mul_sum] apply Finset.sum_congr rfl intro A _ rw [canonicalScheduleKernel_mul_sq_target theta z A est] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment_fullRisk_eq_labeled · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:323
theorem canonicalNuLift_expectedRisk

the canonical nu lift expected risk property holds.

Formal statement
n :
nu :
D :
Proof (Lean source)
lemma canonicalNuLift_expectedRisk {n : ℕ} (nu : EffectPrior n) (D : FiniteDesign (Assign 2 n)) (est : Estimator 2 n twoArmContrast) : nu.E (fun theta ↦ (twoArmScoreExperiment D).fullRisk effectTarget (scoreFullEstimator est) theta) = (canonicalNuLift nu).E (fun z ↦ labeledRisk twoArmContrast (D, est) z) := by simp_rw [twoArmScoreExperiment_fullRisk_eq_labeled] unfold E change (∑ theta : EffectTriple n, nu.p theta * ∑ z : Schedule 2 n, canonicalScheduleKernel theta z * labeledRisk twoArmContrast (D, est) z) = ∑ z : Schedule 2 n, (∑ theta : EffectTriple n, nu.p theta * canonicalScheduleKernel theta z) * labeledRisk twoArmContrast (D, est) z simp_rw [Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z _ rw [Finset.sum_mul] apply Finset.sum_congr rfl intro theta _ ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalNuLift_expectedRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:345

A score-count estimator on the finite support is extended to all natural counts by using zero outside that support.

Definition (Lean source)
n :
g :
Fin (n + 1) → ℝ
extendFinEstimator g :
ℕ → ℝ
fun x ↦ if hx : x < n + 1 then g ⟨x, hx⟩ else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.extendFinEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:371
theorem extendFinEstimator_of_lt

the observed count satisfies its stated condition, the extend fin estimator when is less than property holds.

Formal statement
n x :
g :
Fin (n + 1) → ℝ
hx :
x < n + 1
extendFinEstimator g x = g ⟨x, hx⟩
Proof (Lean source)
lemma extendFinEstimator_of_lt {n x : ℕ} (g : Fin (n + 1) → ℝ) (hx : x < n + 1) : extendFinEstimator g x = g ⟨x, hx⟩ := by simp [extendFinEstimator, hx]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.extendFinEstimator_of_lt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:376
theorem twoArmScoreExperiment_statisticRisk_eq_scalar

the two arm score experiment statistic risk equals scalar.

Formal statement
n :
D :
g :
Fin (n + 1) → ℝ
theta :
= ∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), binomialHalf (theta.1.2.2 : ℕ) k * (extendFinEstimator g ((theta.1.1 : ℕ) + k) - effectTarget theta) ^ 2
Proof (Lean source)
lemma twoArmScoreExperiment_statisticRisk_eq_scalar {n : ℕ} (D : FiniteDesign (Assign 2 n)) (g : Fin (n + 1) → ℝ) (theta : EffectTriple n) : (twoArmScoreExperiment D).statisticRisk effectTarget g theta = ∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), binomialHalf (theta.1.2.2 : ℕ) k * (extendFinEstimator g ((theta.1.1 : ℕ) + k) - effectTarget theta) ^ 2 := by classical rw [twoArmScoreExperiment_statisticRisk_eq] simp_rw [Finset.sum_mul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro k hk have hk' : k ≤ (theta.1.2.2 : ℕ) := by simpa only [Finset.mem_range, Nat.lt_succ_iff] using hk have hbound : (theta.1.1 : ℕ) + k < n + 1 := by have ht := theta.2 omega rw [Finset.sum_eq_single ⟨(theta.1.1 : ℕ) + k, hbound⟩] · simp [extendFinEstimator, hbound] · intro x _ hx have hne : (x : ℕ) ≠ (theta.1.1 : ℕ) + k := by intro h exact hx (Fin.ext h) simp [hne] · simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreExperiment_statisticRisk_eq_scalar · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:382
theorem twoArmRaoBlackwellThroughX

the two arm rao blackwell through x property holds.

Formal statement
n :
nu :
Proof (Lean source)
lemma twoArmRaoBlackwellThroughX {n : ℕ} (nu : EffectPrior n) : RaoBlackwellThroughX nu (canonicalNuLift nu) := by intro D est let E : FiniteUniformExperiment (EffectTriple n) PUnit.{1} (Assign 2 n × (Unit n → Bool)) (Fin (n + 1)) := twoArmScoreExperiment D let F : E.SufficientFactorization := twoArmScoreFactorization D let g : Fin (n + 1) → ℝ := E.raoBlackwellEstimator F (scoreFullEstimator est) refine ⟨extendFinEstimator g, ?_⟩ rw [← canonicalNuLift_expectedRisk nu D est] change _ ≤ nu.E (E.fullRisk effectTarget (scoreFullEstimator est)) have hRB := E.priorRisk_raoBlackwellEstimator_le F nu effectTarget (scoreFullEstimator est) apply le_trans ?_ hRB unfold E apply Finset.sum_le_sum intro theta _ rw [twoArmScoreExperiment_statisticRisk_eq_scalar] rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRaoBlackwellThroughX · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:412
theorem twoArmLc_eq_two

the two arm contrast norm equals two.

Formal statement
Proof (Lean source)
lemma twoArmLc_eq_two : Lc twoArmContrast = 2 := by norm_num [Lc, twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmLc_eq_two · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:435
theorem effectTarget_mem_twoArmRange

the effect target belongs to two arm range.

Formal statement
n :
theta :
Proof (Lean source)
lemma effectTarget_mem_twoArmRange {n : ℕ} (theta : EffectTriple n) : effectTarget theta ∈ Icc (-Lc twoArmContrast / 2) (Lc twoArmContrast / 2) := by rw [twoArmLc_eq_two] norm_num only [neg_div, neg_neg, OfNat.ofNat_eq_ofNat, div_self (by norm_num : (2 : ℝ) ≠ 0)] cases n with | zero => have ht := theta.2 simp only [cast_zero, div_zero, effectTarget] constructor <;> norm_num | succ n => have ht := theta.2 have hp : (theta.1.1 : ℕ) ≤ n + 1 := by omega have hm : (theta.1.2.1 : ℕ) ≤ n + 1 := by omega have hnpos : (0 : ℝ) < n + 1 := by positivity have hpR : ((theta.1.1 : ℕ) : ℝ) ≤ n + 1 := by exact_mod_cast hp have hmR : ((theta.1.2.1 : ℕ) : ℝ) ≤ n + 1 := by exact_mod_cast hm constructor · dsimp [effectTarget] simp only [Nat.cast_add, cast_one] apply (le_div_iff₀ hnpos).2 linarith · dsimp [effectTarget] simp only [Nat.cast_add, cast_one] apply (div_le_iff₀ hnpos).2 linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.effectTarget_mem_twoArmRange · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:441
def observedScore

The observed score equals the outcome on the first arm and its complement on the second arm.

Definition (Lean source)
n :
A :
Assign 2 n
observedScore A y :
Unit n → Bool
fun i ↦ if A i = 0 then y i else !(y i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.observedScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:469
def scalarClippedEstimator

The scalar clipped estimator property holds.

Definition (Lean source)
n :
f :
ℕ → ℝ
scalarClippedEstimator f :
fun A y ↦ ⟨clip twoArmContrast (f ((Finset.univ.filter fun i ↦ observedScore A y i).card)), clip_mem twoArmContrast _⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarClippedEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:474
theorem scoreFullEstimator_scalarClipped

the score full estimator scalar clipped property holds.

Formal statement
n :
f :
ℕ → ℝ
sample :
PUnit.{1} × (Assign 2 n × (Unit n → Bool))
Proof (Lean source)
lemma scoreFullEstimator_scalarClipped {n : ℕ} (f : ℕ → ℝ) (sample : PUnit.{1} × (Assign 2 n × (Unit n → Bool))) : scoreFullEstimator (scalarClippedEstimator f) sample = clip twoArmContrast (f (scoreCount sample.2.2)) := by rcases sample with ⟨u, A, s⟩ cases u change clip twoArmContrast (f ((Finset.univ.filter fun i ↦ observedScore A (scoreToObserved A s) i).card)) = clip twoArmContrast (f ((Finset.univ.filter fun i ↦ s i).card)) congr 2 congr 1 ext i simp only [mem_filter, Finset.mem_univ, true_and] by_cases hA : A i = 0 · simp [observedScore, scoreToObserved, hA] · simp [observedScore, scoreToObserved, hA]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scoreFullEstimator_scalarClipped · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:481

Scalar prior risk averages squared error over effect-count triples and the induced binomial score count.

Definition (Lean source)
n :
nu :
f :
ℕ → ℝ
scalarPriorRisk nu f :
theta, nu.p theta * ∑ k ∈ range (((theta.1).2.2 : ℕ) + 1), binomialHalf ((theta.1).2.2 : ℕ) k * (f (((theta.1).1 : ℕ) + k) - effectTarget theta) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarPriorRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:501
theorem scalarPriorRisk_nonneg

the scalar prior risk is nonnegative.

Formal statement
n :
nu :
f :
ℕ → ℝ
0 ≤ scalarPriorRisk nu f
Proof (Lean source)
lemma scalarPriorRisk_nonneg {n : ℕ} (nu : EffectPrior n) (f : ℕ → ℝ) : 0 ≤ scalarPriorRisk nu f := by unfold scalarPriorRisk exact sum_nonneg fun theta _ ↦ mul_nonneg (nu.p_nonneg theta) (sum_nonneg fun k _ ↦ mul_nonneg (by unfold binomialHalf positivity) (sq_nonneg _))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarPriorRisk_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:509
theorem scalarBayesRisk_eq_sInf_scalarPriorRisk

the scalar bayes risk equals s inf scalar prior risk.

Formal statement
n :
nu :
scalarBayesRisk nu = sInf {v : ℝ | ∃ f : ℕ → ℝ, v = scalarPriorRisk nu f}
Proof (Lean source)
lemma scalarBayesRisk_eq_sInf_scalarPriorRisk {n : ℕ} (nu : EffectPrior n) : scalarBayesRisk nu = sInf {v : ℝ | ∃ f : ℕ → ℝ, v = scalarPriorRisk nu f} := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarBayesRisk_eq_sInf_scalarPriorRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:519
theorem clippedFullRisk_eq_statisticRisk

the clipped full risk equals statistic risk.

Formal statement
n :
D :
f :
ℕ → ℝ
theta :
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clippedFullRisk_eq_statisticRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:525
theorem clippedScalarPriorRisk_le

the clipped scalar prior risk is at most property holds.

Formal statement
n :
nu :
f :
ℕ → ℝ
scalarPriorRisk nu (fun x ↦ clip twoArmContrast (f x)) ≤ scalarPriorRisk nu f
Proof (Lean source)
lemma clippedScalarPriorRisk_le {n : ℕ} (nu : EffectPrior n) (f : ℕ → ℝ) : scalarPriorRisk nu (fun x ↦ clip twoArmContrast (f x)) ≤ scalarPriorRisk nu f := by unfold scalarPriorRisk apply Finset.sum_le_sum intro theta _ apply mul_le_mul_of_nonneg_left _ (nu.p_nonneg theta) apply Finset.sum_le_sum intro k _ apply mul_le_mul_of_nonneg_left _ · unfold binomialHalf positivity · change (clipIcc (-Lc twoArmContrast / 2) (Lc twoArmContrast / 2) (f ((theta.1.1 : ℕ) + k)) - effectTarget theta) ^ 2 ≤ _ exact clipIcc_sub_sq_le (effectTarget_mem_twoArmRange theta) _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clippedScalarPriorRisk_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:541
theorem canonicalNuLift_clippedRisk_le

the canonical nu lift clipped risk is at most property holds.

Formal statement
n :
nu :
D :
f :
ℕ → ℝ
Proof (Lean source)
lemma canonicalNuLift_clippedRisk_le {n : ℕ} (nu : EffectPrior n) (D : FiniteDesign (Assign 2 n)) (f : ℕ → ℝ) : (canonicalNuLift nu).E (fun z ↦ labeledRisk twoArmContrast (D, scalarClippedEstimator f) z) ≤ scalarPriorRisk nu f := by rw [← canonicalNuLift_expectedRisk] simp_rw [clippedFullRisk_eq_statisticRisk, twoArmScoreExperiment_statisticRisk_eq_scalar] calc nu.E (fun theta ↦ ∑ k ∈ range ((theta.1.2.2 : ℕ) + 1), binomialHalf (theta.1.2.2 : ℕ) k * (extendFinEstimator (fun x ↦ clip twoArmContrast (f x)) ((theta.1.1 : ℕ) + k) - effectTarget theta) ^ 2) = scalarPriorRisk nu (fun x ↦ clip twoArmContrast (f x)) := by unfold E scalarPriorRisk apply Finset.sum_congr rfl intro theta _ congr 1 apply Finset.sum_congr rfl intro k hk have hk' : k ≤ (theta.1.2.2 : ℕ) := by simpa only [Finset.mem_range, Nat.lt_succ_iff] using hk have hbound : (theta.1.1 : ℕ) + k < n + 1 := by have ht := theta.2 omega rw [extendFinEstimator_of_lt _ hbound] _ ≤ scalarPriorRisk nu f := clippedScalarPriorRisk_le nu f
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalNuLift_clippedRisk_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:561
theorem fullScheduleBayesRisk_canonicalNuLift_eq

the full schedule bayes risk canonical nu lift equals property holds.

Formal statement
n :
nu :
D :
Proof (Lean source)
lemma fullScheduleBayesRisk_canonicalNuLift_eq {n : ℕ} (nu : EffectPrior n) (D : FiniteDesign (Assign 2 n)) : fullScheduleBayesRisk (canonicalNuLift nu) D = scalarBayesRisk nu := by have hscalarBdd : BddBelow {v : ℝ | ∃ f : ℕ → ℝ, v = scalarPriorRisk nu f} := by refine ⟨0, ?_⟩ rintro v ⟨f, rfl⟩ exact scalarPriorRisk_nonneg nu f have hscalarNe : {v : ℝ | ∃ f : ℕ → ℝ, v = scalarPriorRisk nu f}.Nonempty := ⟨scalarPriorRisk nu (fun _ ↦ 0), ⟨fun _ ↦ 0, rfl⟩⟩ have hfullBdd : BddBelow {v : ℝ | ∃ est : Estimator 2 n twoArmContrast, v = (canonicalNuLift nu).E (fun z ↦ labeledRisk twoArmContrast (D, est) z)} := by refine ⟨0, ?_⟩ rintro v ⟨est, rfl⟩ exact sum_nonneg fun z _ ↦ mul_nonneg ((canonicalNuLift nu).p_nonneg z) (D.mse_nonneg _ _) have hfullNe : {v : ℝ | ∃ est : Estimator 2 n twoArmContrast, v = (canonicalNuLift nu).E (fun z ↦ labeledRisk twoArmContrast (D, est) z)}.Nonempty := ⟨(canonicalNuLift nu).E (fun z ↦ labeledRisk twoArmContrast (D, scalarClippedEstimator (fun _ ↦ 0)) z), ⟨scalarClippedEstimator (fun _ ↦ 0), rfl⟩⟩ unfold fullScheduleBayesRisk rw [scalarBayesRisk_eq_sInf_scalarPriorRisk] apply le_antisymm · apply le_csInf hscalarNe rintro v ⟨f, rfl⟩ exact (csInf_le hfullBdd ⟨scalarClippedEstimator f, rfl⟩).trans (canonicalNuLift_clippedRisk_le nu D f) · apply le_csInf hfullNe rintro v ⟨est, rfl⟩ obtain ⟨f, hf⟩ := twoArmRaoBlackwellThroughX nu D est exact (csInf_le hscalarBdd ⟨f, rfl⟩).trans hf
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fullScheduleBayesRisk_canonicalNuLift_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:592
theorem twoArmScalarPriorScheduleKernel Lemma 1 in the paper ↗

Every effect-triple prior has a complete-schedule lift whose Bayes risk is exactly the scalar binomial-experiment Bayes risk for every assignment law.

Formal statement
n :
nu :
∃ lift : FiniteDesign (Schedule 2 n),
conclusion 1
theta :
conclusion 2
conclusion 3
D :
Proof (Lean source)
lemma twoArmScalarPriorScheduleKernel {n : ℕ} (nu : EffectPrior n) : ∃ lift : FiniteDesign (Schedule 2 n), IsCanonicalNuLift nu lift ∧ (∀ theta : EffectTriple n, HasTwoArmScalarKernel theta) ∧ RaoBlackwellThroughX nu lift ∧ (∀ D : FiniteDesign (Assign 2 n), fullScheduleBayesRisk lift D = scalarBayesRisk nu) := by refine ⟨canonicalNuLift nu, ?_, ?_, ?_, ?_⟩ · intro z rfl · exact fun theta ↦ hasTwoArmScalarKernel_canonical theta · exact twoArmRaoBlackwellThroughX nu · exact fullScheduleBayesRisk_canonicalNuLift_eq nu
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScalarPriorScheduleKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernel.lean:631
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmScheduleKernelCore 14 declarations Exact transformed-score fibers for the canonical two-arm schedule prior.

Exact transformed-score fibers for the canonical two-arm schedule prior.

This module proves the binomial statistic law, its normalized boundary cases, and the state-independent uniform conditional score kernel used by the Rao--Blackwell assembly.

def twoArmScoreSupportEquiv

The two arm score support equiv property holds.

Definition (Lean source)
n x :
twoArmScoreSupportEquiv n x :
{s : Unit n → Bool // (Finset.univ.filter fun i ↦ s i).card = x} ≃ {P : Finset (Unit n) // P ∈ Finset.univ.powersetCard x}
clause 1
toFun s := ⟨Finset.univ.filter fun i ↦ s.1 i, by rw [Finset.mem_powersetCard] exact ⟨Finset.filter_subset _ _, s.2⟩⟩
clause 2
invFun P := ⟨fun i ↦ i ∈ P.1, by change (Finset.univ.filter fun i ↦ decide (i ∈ P.1) = true).card
= x rw [show (Finset.univ.filter fun i ↦ decide (i ∈ P.1) = true) = P.1 by ext i simp] exact (Finset.mem_powersetCard.mp P.2).2⟩
clause 3
left_inv s := by apply Subtype.ext funext i simp
clause 4
right_inv P := by apply Subtype.ext ext i simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreSupportEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:18
theorem twoArmScoreSupport_card

the two arm score support cardinality property holds.

Formal statement
n x :
card {s : Unit n → Bool // (Finset.univ.filter fun i ↦ s i).card = x}
= choose n x
Proof (Lean source)
lemma twoArmScoreSupport_card (n x : ℕ) : card {s : Unit n → Bool // (Finset.univ.filter fun i ↦ s i).card = x} = choose n x := by classical rw [Fintype.card_congr (twoArmScoreSupportEquiv n x)] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreSupport_card · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:41
theorem twoArmXMass_eq_sum_scoreMass

the two arm xmass equals sums score mass.

Formal statement
n :
θ :
A :
Assign 2 n
x :
Fin (n + 1)
(∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0)
= ∑ s : Unit n → Bool, if (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) then ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0 else 0
Proof (Lean source)
lemma twoArmXMass_eq_sum_scoreMass {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (x : Fin (n + 1)) : (∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) = ∑ s : Unit n → Bool, if (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) then ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0 else 0 := by classical rw [show (∑ s : Unit n → Bool, if (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) then ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0 else 0) = ∑ s : Unit n → Bool, ∑ z : Schedule 2 n, if (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0 by apply Finset.sum_congr rfl intro s _ by_cases hs : (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) · simp [hs] · simp [hs]] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z _ let sz := fun i ↦ twoArmS z A i have hx : twoArmX z A = x ↔ (Finset.univ.filter fun i ↦ sz i).card = (x : ℕ) := by rw [Fin.ext_iff] exact Iff.rfl by_cases hzx : twoArmX z A = x · rw [if_pos hzx] have hc : (Finset.univ.filter fun i ↦ sz i).card = (x : ℕ) := hx.mp hzx rw [Finset.sum_eq_single sz] · simp [sz, hc] · intro s _ hs have hne : (fun i ↦ twoArmS z A i) ≠ s := by intro h exact hs h.symm simp [hne] · simp · rw [if_neg hzx] have hc : (Finset.univ.filter fun i ↦ sz i).card ≠ (x : ℕ) := by exact fun h ↦ hzx (hx.mpr h) symm apply Finset.sum_eq_zero intro s _ by_cases hs : s = sz · subst s simp [hc] · have hne : (fun i ↦ twoArmS z A i) ≠ s := by intro h exact hs h.symm simp [hne]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmXMass_eq_sum_scoreMass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:50
theorem twoArmCanonicalScore_mass

the two arm canonical score mass property holds.

Formal statement
n :
θ :
A :
Assign 2 n
s :
Unit n → Bool
(∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)
= (card (TwoArmScoreScheduleFiber θ A s) : ℝ) / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ))
Proof (Lean source)
lemma twoArmCanonicalScore_mass {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) : (∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0) = (card (TwoArmScoreScheduleFiber θ A s) : ℝ) / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ)) := by classical rw [← twoArmCanonicalScoreFiber_mass (θ := θ) A s] apply Finset.sum_congr rfl intro z _ by_cases hs : (fun i ↦ twoArmS z A i) = s · by_cases ht : hasEffectTriple θ z · simp [hs, ht] · simp [hs, ht, canonicalScheduleKernel] · simp [hs]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScore_mass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:108
theorem twoArmCanonicalScore_mass_eq_binomial

the stated probability condition holds, the observed count satisfies its stated condition, the two arm canonical score mass equals binomial.

Formal statement
n :
θ :
A :
Assign 2 n
s :
Unit n → Bool
hp :
(θ.1.1 : ℕ) ≤ (Finset.univ.filter fun i ↦ s i).card
hx :
(Finset.univ.filter fun i ↦ s i).card ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ)
(∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)
= binomialHalf (θ.1.2.2 : ℕ) ((Finset.univ.filter fun i ↦ s i).card - (θ.1.1 : ℕ)) / choose n (Finset.univ.filter fun i ↦ s i).card
Proof (Lean source)
lemma twoArmCanonicalScore_mass_eq_binomial {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) (hp : (θ.1.1 : ℕ) ≤ (Finset.univ.filter fun i ↦ s i).card) (hx : (Finset.univ.filter fun i ↦ s i).card ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ)) : (∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0) = binomialHalf (θ.1.2.2 : ℕ) ((Finset.univ.filter fun i ↦ s i).card - (θ.1.1 : ℕ)) / choose n (Finset.univ.filter fun i ↦ s i).card := by classical rw [← twoArmCanonicalScoreFiber_mass_eq_binomial (θ := θ) A s hp hx] apply Finset.sum_congr rfl intro z _ by_cases hs : (fun i ↦ twoArmS z A i) = s · by_cases ht : hasEffectTriple θ z · simp [hs, ht] · simp [hs, ht, canonicalScheduleKernel] · simp [hs]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScore_mass_eq_binomial · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:128
theorem twoArmXMass_eq_binomial_of_support

the stated probability condition holds, the observed count satisfies its stated condition, the two arm xmass equals binomial when support.

Formal statement
n :
θ :
A :
Assign 2 n
x :
Fin (n + 1)
hp :
(θ.1.1 : ℕ) ≤ (x : ℕ)
hx :
(x : ℕ) ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ)
(∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0)
= binomialHalf (θ.1.2.2 : ℕ) ((x : ℕ) - (θ.1.1 : ℕ))
Proof (Lean source)
lemma twoArmXMass_eq_binomial_of_support {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (x : Fin (n + 1)) (hp : (θ.1.1 : ℕ) ≤ (x : ℕ)) (hx : (x : ℕ) ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ)) : (∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) = binomialHalf (θ.1.2.2 : ℕ) ((x : ℕ) - (θ.1.1 : ℕ)) := by classical rw [twoArmXMass_eq_sum_scoreMass] let b := binomialHalf (θ.1.2.2 : ℕ) ((x : ℕ) - (θ.1.1 : ℕ)) have hsum : (∑ s : Unit n → Bool, if (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) then ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0 else 0) = ∑ s : Unit n → Bool, if (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) then b / choose n (x : ℕ) else 0 := by apply Finset.sum_congr rfl intro s _ by_cases hs : (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) · simp only [hs, if_pos] rw [twoArmCanonicalScore_mass_eq_binomial θ A s] · simp [b, hs] · simpa [hs] using hp · simpa [hs] using hx · simp [hs] rw [hsum, Finset.sum_ite, Finset.sum_const_zero, add_zero, Finset.sum_const, nsmul_eq_mul] rw [← Fintype.card_subtype] rw [twoArmScoreSupport_card] have hxn : (x : ℕ) ≤ n := Nat.le_of_lt_succ x.isLt have hchoose : (choose n (x : ℕ) : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hxn).ne' dsimp [b] field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmXMass_eq_binomial_of_support · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:150
theorem twoArmCanonicalScore_mass_eq_zero_of_lt

the observed count satisfies its stated condition, the two arm canonical score mass equals zero when is less than.

Formal statement
n :
θ :
A :
Assign 2 n
s :
Unit n → Bool
hx :
(Finset.univ.filter fun i ↦ s i).card < (θ.1.1 : ℕ)
(∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)
= 0
Proof (Lean source)
lemma twoArmCanonicalScore_mass_eq_zero_of_lt {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) (hx : (Finset.univ.filter fun i ↦ s i).card < (θ.1.1 : ℕ)) : (∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0) = 0 := by rw [twoArmCanonicalScore_mass, twoArmScoreScheduleFiber_card] rw [Nat.choose_eq_zero_of_lt hx] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScore_mass_eq_zero_of_lt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:189
theorem twoArmCanonicalScore_mass_eq_zero_of_gt

the observed count satisfies its stated condition, the two arm canonical score mass equals zero when is greater than.

Formal statement
n :
θ :
A :
Assign 2 n
s :
Unit n → Bool
hx :
(θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) < (Finset.univ.filter fun i ↦ s i).card
(∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)
= 0
Proof (Lean source)
lemma twoArmCanonicalScore_mass_eq_zero_of_gt {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) (hx : (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) < (Finset.univ.filter fun i ↦ s i).card) : (∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0) = 0 := by have htrue : (Finset.univ.filter fun i ↦ s i).card ≤ n := by simpa using Finset.card_le_card (filter_subset (fun i ↦ s i) Finset.univ) have hfalse : (Finset.univ.filter fun i ↦ !(s i)).card = n - (Finset.univ.filter fun i ↦ s i).card := by have hpart := Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset (Unit n))) (p := fun i ↦ s i) simp only [Finset.card_univ, Fintype.card_fin] at hpart have heq : (Finset.univ.filter fun i ↦ !(s i)) = Finset.univ.filter fun i ↦ ¬ s i := by ext i cases hs : s i <;> simp [hs] rw [heq] omega have hm : n - (Finset.univ.filter fun i ↦ s i).card < (θ.1.2.1 : ℕ) := by have ht := θ.2 omega rw [twoArmCanonicalScore_mass, twoArmScoreScheduleFiber_card, hfalse] rw [Nat.choose_eq_zero_of_lt hm] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScore_mass_eq_zero_of_gt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:200
theorem twoArmXMass_eq_zero_of_outside

the stated side condition holds, the two arm xmass equals zero when outside.

Formal statement
n :
θ :
A :
Assign 2 n
x :
Fin (n + 1)
hout :
(x : ℕ) < (θ.1.1 : ℕ) ∨ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) < (x : ℕ)
(∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) = 0
Proof (Lean source)
lemma twoArmXMass_eq_zero_of_outside {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (x : Fin (n + 1)) (hout : (x : ℕ) < (θ.1.1 : ℕ) ∨ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) < (x : ℕ)) : (∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) = 0 := by classical rw [twoArmXMass_eq_sum_scoreMass] apply Finset.sum_eq_zero intro s _ by_cases hs : (Finset.univ.filter fun i ↦ s i).card = (x : ℕ) · rw [if_pos hs] rcases hout with hout | hout · exact twoArmCanonicalScore_mass_eq_zero_of_lt θ A s (by omega) · exact twoArmCanonicalScore_mass_eq_zero_of_gt θ A s (by omega) · simp [hs]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmXMass_eq_zero_of_outside · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:229
theorem twoArmXMass_eq_binomial_sum

the two arm xmass equals binomial sums.

Formal statement
n :
θ :
A :
Assign 2 n
x :
Fin (n + 1)
(∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0)
= ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), if (x : ℕ) = (θ.1.1 : ℕ)
+ k then binomialHalf (θ.1.2.2 : ℕ) k else 0
Proof (Lean source)
lemma twoArmXMass_eq_binomial_sum {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (x : Fin (n + 1)) : (∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) = ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), if (x : ℕ) = (θ.1.1 : ℕ) + k then binomialHalf (θ.1.2.2 : ℕ) k else 0 := by classical by_cases hp : (θ.1.1 : ℕ) ≤ (x : ℕ) · by_cases hx : (x : ℕ) ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) · rw [twoArmXMass_eq_binomial_of_support θ A x hp hx] rw [Finset.sum_eq_single ((x : ℕ) - (θ.1.1 : ℕ))] · have heq : (x : ℕ) = (θ.1.1 : ℕ) + ((x : ℕ) - (θ.1.1 : ℕ)) := by omega rw [if_pos heq] · intro k hk hne have hkne : (x : ℕ) ≠ (θ.1.1 : ℕ) + k := by intro h apply hne omega simp [hkne] · intro hnot exfalso apply hnot simp only [Finset.mem_range] omega · have hout : (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) < (x : ℕ) := by omega rw [twoArmXMass_eq_zero_of_outside θ A x (inr hout)] symm apply Finset.sum_eq_zero intro k hk have hklt : k ≤ (θ.1.2.2 : ℕ) := by simp only [Finset.mem_range] at hk omega have hne : (x : ℕ) ≠ (θ.1.1 : ℕ) + k := by omega simp [hne] · have hout : (x : ℕ) < (θ.1.1 : ℕ) := by omega rw [twoArmXMass_eq_zero_of_outside θ A x (inl hout)] symm apply Finset.sum_eq_zero intro k hk have hne : (x : ℕ) ≠ (θ.1.1 : ℕ) + k := by omega simp [hne]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmXMass_eq_binomial_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:248
theorem canonicalScheduleKernel_sum

the canonical schedule kernel sums.

Formal statement
n :
θ :
∑ z : Schedule 2 n, canonicalScheduleKernel θ z = 1
Proof (Lean source)
lemma canonicalScheduleKernel_sum {n : ℕ} (θ : EffectTriple n) : ∑ z : Schedule 2 n, canonicalScheduleKernel θ z = 1 := by classical let A : Assign 2 n := fun _ ↦ 0 rw [show (∑ z : Schedule 2 n, canonicalScheduleKernel θ z) = ∑ x : Fin (n + 1), ∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0 by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z _ rw [Finset.sum_eq_single (twoArmX z A)] · simp · intro x _ hx simp [Ne.symm hx] · simp] simp_rw [twoArmXMass_eq_binomial_sum] rw [Finset.sum_comm] have hkbound (k : ℕ) (hk : k ∈ range ((θ.1.2.2 : ℕ) + 1)) : (θ.1.1 : ℕ) + k < n + 1 := by have ht := θ.2 simp only [Finset.mem_range] at hk omega rw [show (∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), ∑ x : Fin (n + 1), if (x : ℕ) = (θ.1.1 : ℕ) + k then binomialHalf (θ.1.2.2 : ℕ) k else 0) = ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), binomialHalf (θ.1.2.2 : ℕ) k by apply Finset.sum_congr rfl intro k hk rw [Finset.sum_eq_single ⟨(θ.1.1 : ℕ) + k, hkbound k hk⟩] · simp · intro x _ hx have hne : (x : ℕ) ≠ (θ.1.1 : ℕ) + k := by intro h apply hx exact Fin.ext h simp [hne] · simp] unfold binomialHalf rw [← Finset.sum_div] have hchoose : (∑ i ∈ range ((θ.1.2.2 : ℕ) + 1), (choose (θ.1.2.2 : ℕ) i : ℝ)) = (2 ^ (θ.1.2.2 : ℕ) : ℕ) := by exact_mod_cast Nat.sum_range_choose (θ.1.2.2 : ℕ) rw [hchoose] norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalScheduleKernel_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:293
theorem twoArmCanonicalConditionalScore_mass

the stated side condition holds, the two arm canonical conditional score mass property holds.

Formal statement
n :
θ :
A :
Assign 2 n
x :
Fin (n + 1)
s :
Unit n → Bool
hsx :
(Finset.univ.filter fun i ↦ s i).card = (x : ℕ)
(∑ z : Schedule 2 n, if twoArmX z A = x ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)
= (∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) / choose n (x : ℕ)
Proof (Lean source)
lemma twoArmCanonicalConditionalScore_mass {n : ℕ} (θ : EffectTriple n) (A : Assign 2 n) (x : Fin (n + 1)) (s : Unit n → Bool) (hsx : (Finset.univ.filter fun i ↦ s i).card = (x : ℕ)) : (∑ z : Schedule 2 n, if twoArmX z A = x ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0) = (∑ z : Schedule 2 n, if twoArmX z A = x then canonicalScheduleKernel θ z else 0) / choose n (x : ℕ) := by classical have hleft : (∑ z : Schedule 2 n, if twoArmX z A = x ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0) = ∑ z : Schedule 2 n, if (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0 := by apply Finset.sum_congr rfl intro z _ by_cases hs : (fun i ↦ twoArmS z A i) = s · have hx : twoArmX z A = x := by rw [Fin.ext_iff] change (Finset.univ.filter fun i ↦ twoArmS z A i).card = (x : ℕ) simpa [hs] using hsx simp [hs, hx] · simp [hs] rw [hleft] by_cases hp : (θ.1.1 : ℕ) ≤ (x : ℕ) · by_cases hx : (x : ℕ) ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) · rw [twoArmCanonicalScore_mass_eq_binomial θ A s] · rw [twoArmXMass_eq_binomial_of_support θ A x hp hx] simp [hsx] · simpa [hsx] using hp · simpa [hsx] using hx · have hout : (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ) < (x : ℕ) := by omega rw [twoArmCanonicalScore_mass_eq_zero_of_gt θ A s (by omega)] rw [twoArmXMass_eq_zero_of_outside θ A x (inr hout)] simp · have hout : (x : ℕ) < (θ.1.1 : ℕ) := by omega rw [twoArmCanonicalScore_mass_eq_zero_of_lt θ A s (by omega)] rw [twoArmXMass_eq_zero_of_outside θ A x (inl hout)] simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalConditionalScore_mass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:342
theorem hasTwoArmScalarKernel_canonical Lemma hasTwoArmScalarKernel_canonical in the paper ↗

has two arm scalar kernel canonical.

Formal statement
n :
θ :
Proof (Lean source)
lemma hasTwoArmScalarKernel_canonical {n : ℕ} (θ : EffectTriple n) : HasTwoArmScalarKernel θ := by refine ⟨twoArmXMass_eq_binomial_sum θ, ?_, ?_⟩ · intro _A exact canonicalScheduleKernel_sum θ · intro A x s hs rw [← Finset.sum_div] exact twoArmCanonicalConditionalScore_mass θ A x s hs
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hasTwoArmScalarKernel_canonical · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:385
theorem twoArmTau_eq_effectTriple

the stated side condition holds, the two arm tau equals effect triple.

Formal statement
n :
Schedule 2 n
hz :
tauC twoArmContrast z = ((((θ.1.1 : ℕ) : ℝ) - ((θ.1.2.1 : ℕ) : ℝ)) / n)
Proof (Lean source)
lemma twoArmTau_eq_effectTriple {n : ℕ} {θ : EffectTriple n} {z : Schedule 2 n} (hz : hasEffectTriple θ z) : tauC twoArmContrast z = ((((θ.1.1 : ℕ) : ℝ) - ((θ.1.2.1 : ℕ) : ℝ)) / n) := by have hpoint (i : Unit n) : (∑ a, twoArmContrast a * if z i a then 1 else 0) = (if z i 0 && !(z i 1) then (1 : ℝ) else 0) - (if !(z i 0) && z i 1 then (1 : ℝ) else 0) := by cases h0 : z i 0 <;> cases h1 : z i 1 <;> simp [twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ, h0, h1] unfold tauC simp_rw [hpoint] rw [Finset.sum_sub_distrib] have hp : (∑ i : Unit n, if z i 0 && !(z i 1) then (1 : ℝ) else 0) = (Finset.univ.filter fun i ↦ z i 0 && !(z i 1)).card := by rw [Finset.sum_ite] simp have hm : (∑ i : Unit n, if !(z i 0) && z i 1 then (1 : ℝ) else 0) = (Finset.univ.filter fun i ↦ !(z i 0) && z i 1).card := by rw [Finset.sum_ite] simp rw [hp, hm, hz.1, hz.2.1] rw [div_eq_inv_mul]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmTau_eq_effectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmScheduleKernelCore.lean:396
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmSchedulePrior 33 declarations Lift of an arbitrary prior on two-arm effect-class triples to complete labeled binary schedules, together with the assignment-ancillary scalar kernel.

Lift of an arbitrary prior on two-arm effect-class triples to complete labeled binary schedules, together with the assignment-ancillary scalar kernel.

def EffectTriple

Two-arm effect-class counts (p_+,p_-,r_0) summing to n.

Definition (Lean source)
n :
EffectTriple n :
Type
{θ : Fin (n + 1) × Fin (n + 1) × Fin (n + 1) // (θ.1 : ℕ) + (θ.2.1 : ℕ) + (θ.2.2 : ℕ) = n}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.EffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:16
instance instFintypeEffectTriple

The effect triple collection has a finite enumeration.

Definition (Lean source)
instance (n : ℕ) : Fintype (EffectTriple n) := by unfold EffectTriple infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:21
def EffectPrior

An effect prior is a finite probability distribution over two-arm effect-count triples.

Definition (Lean source)
n :
EffectPrior n :
Type
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.EffectPrior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:26
def binomialHalf

Finite binomial (r,1/2) mass.

Definition (Lean source)
r k :
binomialHalf r k :
(Nat.choose r k : ℝ) / 2 ^ r
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.binomialHalf · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:30
def scalarBayesRisk

Scalar Bayes risk for X=p_+ + Binomial(r_0,1/2).

Definition (Lean source)
n :
nu :
scalarBayesRisk nu :
sInf {v : ℝ | ∃ f : ℕ → ℝ, v = ∑ θ, nu.p θ * ∑ k ∈ range (((θ.1).2.2 : ℕ) + 1), binomialHalf ((θ.1).2.2 : ℕ) k * (f (((θ.1).1 : ℕ) + k) - ((((θ.1).1 : ℕ) : ℝ) - (((θ.1).2.1 : ℕ) : ℝ)) / n) ^ 2}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:34
def fullScheduleBayesRisk

Bayes risk of the complete-schedule lift under a fixed arbitrary design.

Definition (Lean source)
n :
lift :
FiniteDesign (Schedule 2 n)
D :
fullScheduleBayesRisk lift D :
sInf {v : ℝ | ∃ est : Estimator 2 n twoArmContrast, v = lift.E (fun z => labeledRisk twoArmContrast (D, est) z)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fullScheduleBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:42
def twoArmS

The schedule statistic S_i=Y_i(1) on arm 1 and 1-Y_i(2) on arm 2.

Definition (Lean source)
n :
shared
z :
Schedule 2 n
A :
Assign 2 n
i :
twoArmS z A i :
if A i = 0 then z i 0 else !(z i 1)
def twoArmX

The observable scalar count, retained in its exact support.

Definition (Lean source)
n :
shared
z :
Schedule 2 n
A :
Assign 2 n
twoArmX z A :
Fin (n + 1)
⟨(Finset.univ.filter fun i => twoArmS z A i).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i => twoArmS z A i) univ))⟩
def hasEffectTriple

Has effect triple.

Definition (Lean source)
n :
shared
θ :
z :
Schedule 2 n
hasEffectTriple θ z :
Prop
clause 1
(Finset.univ.filter fun i => z i 0 && !(z i 1)).card = (θ.1.1 : ℕ)
clause 2
(Finset.univ.filter fun i => !(z i 0) && z i 1).card = (θ.1.2.1 : ℕ)
clause 3
(Finset.univ.filter fun i => z i 0 = z i 1).card = (θ.1.2.2 : ℕ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hasEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:61
theorem twoArmEffectClass_indicator_partition

The positive, negative, and zero-effect predicates partition the four two-arm response types pointwise.

Formal statement
n :
shared
z :
Schedule 2 n
i :
(if z i 0 && !(z i 1) then 1 else 0)
+ (if !(z i 0) && z i 1 then 1 else 0)
+ (if z i 0 = z i 1 then 1 else 0)
= 1
Proof (Lean source)
lemma twoArmEffectClass_indicator_partition (z : Schedule 2 n) (i : Unit n) : (if z i 0 && !(z i 1) then 1 else 0) + (if !(z i 0) && z i 1 then 1 else 0) + (if z i 0 = z i 1 then 1 else 0) = 1 := by cases h₀ : z i 0 <;> cases h₁ : z i 1 <;> simp [h₀, h₁]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmEffectClass_indicator_partition · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:68
theorem hasEffectTriple_counts_sum

A schedule in an effect-triple fiber has the advertised three class counts and those counts exhaust the population.

Formal statement
n :
Schedule 2 n
shared
h :
(Finset.univ.filter fun i => z i 0 && !(z i 1)).card
+ (Finset.univ.filter fun i => !(z i 0) && z i 1).card
+ (Finset.univ.filter fun i => z i 0 = z i 1).card
= n
Proof (Lean source)
lemma hasEffectTriple_counts_sum {θ : EffectTriple n} {z : Schedule 2 n} (h : hasEffectTriple θ z) : (Finset.univ.filter fun i => z i 0 && !(z i 1)).card + (Finset.univ.filter fun i => !(z i 0) && z i 1).card + (Finset.univ.filter fun i => z i 0 = z i 1).card = n := by rw [h.1, h.2.1, h.2.2] exact θ.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hasEffectTriple_counts_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:76
theorem twoArmS_of_positive_effect

A positive-effect response type contributes one to the transformed score under either assignment arm.

Formal statement
n :
shared
z :
Schedule 2 n
A :
Assign 2 n
i :
h :
z i 0 && !(z i 1)
twoArmS z A i = true
Proof (Lean source)
lemma twoArmS_of_positive_effect (z : Schedule 2 n) (A : Assign 2 n) (i : Unit n) (h : z i 0 && !(z i 1)) : twoArmS z A i = true := by have hz : z i 0 = true ∧ z i 1 = false := by simpa using h by_cases hA : A i = 0 · simpa [twoArmS, hA] using hz.1 · simpa [twoArmS, hA] using hz.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmS_of_positive_effect · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:86
theorem twoArmS_of_negative_effect

A negative-effect response type contributes zero to the transformed score under either assignment arm.

Formal statement
n :
shared
z :
Schedule 2 n
A :
Assign 2 n
i :
h :
!(z i 0) && z i 1
twoArmS z A i = false
Proof (Lean source)
lemma twoArmS_of_negative_effect (z : Schedule 2 n) (A : Assign 2 n) (i : Unit n) (h : !(z i 0) && z i 1) : twoArmS z A i = false := by have hz : z i 0 = false ∧ z i 1 = true := by simpa using h by_cases hA : A i = 0 · simpa [twoArmS, hA] using hz.1 · simpa [twoArmS, hA] using hz.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmS_of_negative_effect · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:95
theorem twoArmS_of_zero_effect

the stated side condition holds, On a zero-effect response type, assignment either preserves or flips its common fair bit, exactly as in the paper's schedule construction.

Formal statement
n :
shared
z :
Schedule 2 n
A :
Assign 2 n
i :
h :
z i 0 = z i 1
twoArmS z A i = if A i = 0 then z i 0 else !(z i 0)
Proof (Lean source)
lemma twoArmS_of_zero_effect (z : Schedule 2 n) (A : Assign 2 n) (i : Unit n) (h : z i 0 = z i 1) : twoArmS z A i = if A i = 0 then z i 0 else !(z i 0) := by by_cases hA : A i = 0 <;> simp [twoArmS, hA, h]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmS_of_zero_effect · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:104
def twoArmScheduleOfScoreChoices

Reconstruct the unique two-arm schedule from its positive and negative effect sets and its transformed score vector.

Definition (Lean source)
n :
shared
A :
Assign 2 n
s :
Unit n → Bool
P N :
twoArmScheduleOfScoreChoices A s P N :
Schedule 2 n
fun i a
=> if i ∈ P then a = 0 else if i ∈ N then a ≠ 0 else if A i = 0 then s i else !(s i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScheduleOfScoreChoices · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:111
theorem twoArmScheduleOfScoreChoices_score

the positive-effect set has the prescribed cardinality, the negative-effect set has the prescribed cardinality, Disjoint choices drawn respectively from the one and zero coordinates reconstruct a schedule with the prescribed transformed score.

Formal statement
n :
shared
A :
Assign 2 n
s :
Unit n → Bool
P N :
hP :
P ⊆ Finset.univ.filter fun i ↦ s i
hN :
N ⊆ Finset.univ.filter fun i ↦ !(s i)
(fun i ↦ twoArmS (twoArmScheduleOfScoreChoices A s P N) A i) = s
Proof (Lean source)
lemma twoArmScheduleOfScoreChoices_score (A : Assign 2 n) (s : Unit n → Bool) {P N : Finset (Unit n)} (hP : P ⊆ Finset.univ.filter fun i ↦ s i) (hN : N ⊆ Finset.univ.filter fun i ↦ !(s i)) : (fun i ↦ twoArmS (twoArmScheduleOfScoreChoices A s P N) A i) = s := by funext i by_cases hiP : i ∈ P · have hsi : s i = true := by have := hP hiP simpa using (Finset.mem_filter.mp this).2 by_cases hA : A i = 0 · simp [twoArmS, twoArmScheduleOfScoreChoices, hiP, hA, hsi] · have hA1 : A i = 1 := Fin.eq_one_of_ne_zero _ hA simp [twoArmS, twoArmScheduleOfScoreChoices, hiP, hA, hA1, hsi] · by_cases hiN : i ∈ N · have hsi : s i = false := by have := hN hiN simpa using (Finset.mem_filter.mp this).2 by_cases hA : A i = 0 · simp [twoArmS, twoArmScheduleOfScoreChoices, hiP, hiN, hA, hsi] · have hA1 : A i = 1 := Fin.eq_one_of_ne_zero _ hA simp [twoArmS, twoArmScheduleOfScoreChoices, hiP, hiN, hA, hA1, hsi] · by_cases hA : A i = 0 · simp [twoArmS, twoArmScheduleOfScoreChoices, hiP, hiN, hA] · have hA1 : A i = 1 := Fin.eq_one_of_ne_zero _ hA cases hs : s i <;> simp [twoArmS, twoArmScheduleOfScoreChoices, hiP, hiN, hA, hA1, hs]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScheduleOfScoreChoices_score · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:120
theorem twoArmScheduleOfScoreChoices_effects

the positive-effect set has the prescribed cardinality, the negative-effect set has the prescribed cardinality, The reconstructed schedule has positive set P, negative set N, and zero-effect set their complement.

Formal statement
n :
shared
A :
Assign 2 n
s :
Unit n → Bool
P N :
hP :
P ⊆ Finset.univ.filter fun i ↦ s i
hN :
N ⊆ Finset.univ.filter fun i ↦ !(s i)
conclusion 1
(Finset.univ.filter fun i ↦ twoArmScheduleOfScoreChoices A s P N i 0 && !(twoArmScheduleOfScoreChoices A s P N i 1))
= P
conclusion 2
(Finset.univ.filter fun i ↦ !(twoArmScheduleOfScoreChoices A s P N i 0) && twoArmScheduleOfScoreChoices A s P N i 1)
= N
conclusion 3
(Finset.univ.filter fun i ↦ twoArmScheduleOfScoreChoices A s P N i 0 = twoArmScheduleOfScoreChoices A s P N i 1)
= univ \ (P ∪ N)
Proof (Lean source)
lemma twoArmScheduleOfScoreChoices_effects (A : Assign 2 n) (s : Unit n → Bool) {P N : Finset (Unit n)} (hP : P ⊆ Finset.univ.filter fun i ↦ s i) (hN : N ⊆ Finset.univ.filter fun i ↦ !(s i)) : (Finset.univ.filter fun i ↦ twoArmScheduleOfScoreChoices A s P N i 0 && !(twoArmScheduleOfScoreChoices A s P N i 1)) = P ∧ (Finset.univ.filter fun i ↦ !(twoArmScheduleOfScoreChoices A s P N i 0) && twoArmScheduleOfScoreChoices A s P N i 1) = N ∧ (Finset.univ.filter fun i ↦ twoArmScheduleOfScoreChoices A s P N i 0 = twoArmScheduleOfScoreChoices A s P N i 1) = univ \ (P ∪ N) := by have hdisj : Disjoint P N := by apply Finset.disjoint_left.mpr intro i hiP hiN have hp := (Finset.mem_filter.mp (hP hiP)).2 have hn := (Finset.mem_filter.mp (hN hiN)).2 cases hs : s i <;> simp [hs] at hp hn constructor · ext i by_cases hiP : i ∈ P <;> by_cases hiN : i ∈ N · exact (Finset.disjoint_left.mp hdisj hiP hiN).elim · simp [twoArmScheduleOfScoreChoices, hiP, hiN] · simp [twoArmScheduleOfScoreChoices, hiP, hiN] · by_cases hA : A i = 0 <;> cases hs : s i <;> simp [twoArmScheduleOfScoreChoices, hiP, hiN, hA, hs] · constructor · ext i by_cases hiP : i ∈ P <;> by_cases hiN : i ∈ N · exact (Finset.disjoint_left.mp hdisj hiP hiN).elim · simp [twoArmScheduleOfScoreChoices, hiP, hiN] · simp [twoArmScheduleOfScoreChoices, hiP, hiN] · by_cases hA : A i = 0 <;> cases hs : s i <;> simp [twoArmScheduleOfScoreChoices, hiP, hiN, hA, hs] · ext i by_cases hiP : i ∈ P <;> by_cases hiN : i ∈ N · exact (Finset.disjoint_left.mp hdisj hiP hiN).elim · simp [twoArmScheduleOfScoreChoices, hiP, hiN] · simp [twoArmScheduleOfScoreChoices, hiP, hiN] · by_cases hA : A i = 0 <;> cases hs : s i <;> simp [twoArmScheduleOfScoreChoices, hiP, hiN, hA, hs]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScheduleOfScoreChoices_effects · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:150
def TwoArmScoreScheduleFiber

Schedules in one fixed effect-triple and transformed-score fiber.

Definition (Lean source)
n :
shared
θ :
A :
Assign 2 n
s :
Unit n → Bool
TwoArmScoreScheduleFiber θ A s :
Type
{z : Schedule 2 n // hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.TwoArmScoreScheduleFiber · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:198
def TwoArmScoreChoices

The two independent subset choices parametrizing a fixed score fiber.

Definition (Lean source)
n :
shared
θ :
s :
Unit n → Bool
TwoArmScoreChoices θ s :
Type
{P // P ∈ (Finset.univ.filter fun i ↦ s i).powersetCard (θ.1.1 : ℕ)} × {N // N ∈ (Finset.univ.filter fun i ↦ !(s i)).powersetCard (θ.1.2.1 : ℕ)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.TwoArmScoreChoices · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:203
instance instFintypeTwoArmScoreScheduleFiber

The two arm score schedule fiber collection has a finite enumeration.

Definition (Lean source)
noncomputable instance (θ : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) : Fintype (TwoArmScoreScheduleFiber θ A s) := by classical unfold TwoArmScoreScheduleFiber infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeTwoArmScoreScheduleFiber · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:208
instance instFintypeTwoArmScoreChoices

The two arm score choices collection has a finite enumeration.

Definition (Lean source)
noncomputable instance (θ : EffectTriple n) (s : Unit n → Bool) : Fintype (TwoArmScoreChoices θ s) := by classical unfold TwoArmScoreChoices infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeTwoArmScoreChoices · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:215
def twoArmScoreScheduleFiberEquiv

A fixed transformed-score fiber is exactly a pair of subset choices for the positive and negative effect classes.

Definition (Lean source)
n :
shared
θ :
A :
Assign 2 n
s :
Unit n → Bool
twoArmScoreScheduleFiberEquiv θ A s :
clause 1
toFun z := (⟨Finset.univ.filter fun i ↦ z.1 i 0 && !(z.1 i 1), by rw [Finset.mem_powersetCard] refine ⟨?_, z.2.1.1⟩ intro i hi rw [mem_filter] at hi ⊢ refine ⟨Finset.mem_univ _, ?_⟩ have hs := congrFun z.2.2 i rw [twoArmS_of_positive_effect z.1 A i hi.2] at hs exact hs.symm⟩, ⟨Finset.univ.filter fun i ↦ !(z.1 i 0) && z.1 i 1, by rw [Finset.mem_powersetCard] refine ⟨?_, z.2.1.2.1⟩ intro i hi rw [mem_filter] at hi ⊢ refine ⟨Finset.mem_univ _, ?_⟩ have hs := congrFun z.2.2 i rw [twoArmS_of_negative_effect z.1 A i hi.2] at hs simpa using hs.symm⟩)
clause 2
invFun q := ⟨twoArmScheduleOfScoreChoices A s q.1.1 q.2.1, by rcases Finset.mem_powersetCard.mp q.1.2 with ⟨hP, hcP⟩ rcases Finset.mem_powersetCard.mp q.2.2 with ⟨hN, hcN⟩ have he := twoArmScheduleOfScoreChoices_effects A s hP hN refine ⟨⟨?_, ?_, ?_⟩, twoArmScheduleOfScoreChoices_score A s hP hN⟩ · rw [he.1, hcP] · rw [he.2.1, hcN] · rw [he.2.2] have hsub : q.1.1 ∪ q.2.1 ⊆ (Finset.univ : Finset (Unit n)) := by simp rw [Finset.card_sdiff_of_subset hsub, Finset.card_union_of_disjoint] · rw [Finset.card_univ, Fintype.card_fin, hcP, hcN] have ht := θ.2 omega · apply Finset.disjoint_left.mpr intro i hiP hiN have hp := (Finset.mem_filter.mp (hP hiP)).2 have hn := (Finset.mem_filter.mp (hN hiN)).2 cases hs : s i · simp [hs] at hp · simp [hs] at hn ⟩
clause 3
left_inv z := by apply Subtype.ext funext i a fin_cases a <;> cases h0 : z.1 i 0 <;> cases h1 : z.1 i 1 all_goals have hs := congrFun z.2.2 i by_cases hA : A i
= 0 · simp [twoArmScheduleOfScoreChoices, twoArmS, h0, h1, hA] at hs ⊢ <;> assumption · have hA1 : A i = 1 := Fin.eq_one_of_ne_zero _ hA simp [twoArmScheduleOfScoreChoices, twoArmS, h0, h1, hA1] at hs ⊢ <;> assumption
clause 4
right_inv q := by rcases Finset.mem_powersetCard.mp q.1.2 with ⟨hP, _⟩ rcases Finset.mem_powersetCard.mp q.2.2 with ⟨hN, _⟩ apply Prod.ext · apply Subtype.ext exact (twoArmScheduleOfScoreChoices_effects A s hP hN).1 · apply Subtype.ext exact (twoArmScheduleOfScoreChoices_effects A s hP hN).2.1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreScheduleFiberEquiv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:223
theorem twoArmScoreScheduleFiber_card

The exact number of complete schedules producing a prescribed transformed score vector is the product of the two subset counts.

Formal statement
n :
shared
θ :
A :
Assign 2 n
s :
Unit n → Bool
= choose (Finset.univ.filter fun i ↦ s i).card (θ.1.1 : ℕ) * choose (Finset.univ.filter fun i ↦ !(s i)).card (θ.1.2.1 : ℕ)
Proof (Lean source)
lemma twoArmScoreScheduleFiber_card (θ : EffectTriple n) (A : Assign 2 n) (s : Unit n → Bool) : card (TwoArmScoreScheduleFiber θ A s) = choose (Finset.univ.filter fun i ↦ s i).card (θ.1.1 : ℕ) * choose (Finset.univ.filter fun i ↦ !(s i)).card (θ.1.2.1 : ℕ) := by rw [Fintype.card_congr (twoArmScoreScheduleFiberEquiv θ A s)] unfold TwoArmScoreChoices rw [Fintype.card_prod] simp only [TwoArmScoreChoices, Fintype.card_coe, Finset.card_powersetCard]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreScheduleFiber_card · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:290
theorem twoArmCanonicalDenominator_eq_choose Lemma twoArmCanonicalDenominator_eq_choose in the paper ↗

the stated side condition holds, The ordered-partition normalizer is the product of the two successive subset-choice counts, including all zero-count boundary cases.

Formal statement
n p m r :
h :
p + m + r = n
(Nat.factorial n : ℝ) / ((Nat.factorial p : ℝ) * Nat.factorial m * Nat.factorial r)
= (Nat.choose n p : ℝ) * Nat.choose (n - p) m
Proof (Lean source)
lemma twoArmCanonicalDenominator_eq_choose {n p m r : ℕ} (h : p + m + r = n) : (Nat.factorial n : ℝ) / ((Nat.factorial p : ℝ) * Nat.factorial m * Nat.factorial r) = (Nat.choose n p : ℝ) * Nat.choose (n - p) m := by have hp : p ≤ n := by omega have hm : m ≤ n - p := by omega rw [Nat.cast_choose ℝ hp, Nat.cast_choose ℝ hm] have hsub : n - p - m = r := by omega rw [hsub] field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalDenominator_eq_choose · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:302
theorem twoArmChooseFiber_identity Lemma twoArmChooseFiber_identity in the paper ↗

the stated side condition holds, the positive-effect count satisfies its stated condition, the residual count satisfies its stated condition, The factorial identity converting the score-fiber count into its binomial mass, on the exact support p ≤ x ≤ p+r.

Formal statement
n p m r x :
h :
p + m + r = n
hpx :
p ≤ x
hxr :
x ≤ p + r
(Nat.choose n x : ℝ) * Nat.choose x p * Nat.choose (n - x) m
= Nat.choose n p * Nat.choose (n - p) m * Nat.choose r (x - p)
Proof (Lean source)
lemma twoArmChooseFiber_identity {n p m r x : ℕ} (h : p + m + r = n) (hpx : p ≤ x) (hxr : x ≤ p + r) : (Nat.choose n x : ℝ) * Nat.choose x p * Nat.choose (n - x) m = Nat.choose n p * Nat.choose (n - p) m * Nat.choose r (x - p) := by have hx : x ≤ n := by omega have hm : m ≤ n - x := by omega have hp : p ≤ n := by omega have hmp : m ≤ n - p := by omega have hxp : x - p ≤ r := by omega rw [Nat.cast_choose ℝ hx, Nat.cast_choose ℝ hpx, Nat.cast_choose ℝ hm, Nat.cast_choose ℝ hp, Nat.cast_choose ℝ hmp, Nat.cast_choose ℝ hxp] have h1 : n - p = m + r := by omega have h2 : n - x = m + (r - (x - p)) := by omega rw [h1, h2] simp only [Nat.add_sub_cancel_left] field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmChooseFiber_identity · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:315
def canonicalScheduleKernel

The ordered-partition plus independent-fair-bit schedule kernel.

Definition (Lean source)
n :
shared
θ :
z :
Schedule 2 n
canonicalScheduleKernel θ z :
by classical exact if _h : hasEffectTriple θ z then 1 / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ)) else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.canonicalScheduleKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:334
theorem twoArmCanonicalScoreFiber_mass

The canonical kernel mass of one exact transformed-score vector is its score-fiber cardinality divided by the ordered-partition/fair-bit normalizer.

Formal statement
n :
shared
A :
Assign 2 n
s :
Unit n → Bool
(by classical exact ∑ z : Schedule 2 n, (if hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0))
= (card (TwoArmScoreScheduleFiber θ A s) : ℝ) / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ))
Proof (Lean source)
lemma twoArmCanonicalScoreFiber_mass {θ : EffectTriple n} (A : Assign 2 n) (s : Unit n → Bool) : (by classical exact ∑ z : Schedule 2 n, (if hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)) = (card (TwoArmScoreScheduleFiber θ A s) : ℝ) / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ)) := by classical simp only [canonicalScheduleKernel] rw [Finset.sum_ite] simp only [Finset.sum_const_zero, add_zero] have hsum : (∑ x ∈ (Finset.univ.filter fun z : Schedule 2 n ↦ hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s), if _h : hasEffectTriple θ x then 1 / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ)) else 0) = ∑ _x ∈ (Finset.univ.filter fun z : Schedule 2 n ↦ hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s), 1 / ((Nat.factorial n : ℝ) / (Nat.factorial (θ.1.1 : ℕ) * Nat.factorial (θ.1.2.1 : ℕ) * Nat.factorial (θ.1.2.2 : ℕ)) * 2 ^ (θ.1.2.2 : ℕ)) := by apply Finset.sum_congr rfl intro x hx simp only [mem_filter] at hx simp [hx.2.1] rw [hsum, Finset.sum_const, nsmul_eq_mul] rw [← Fintype.card_subtype (fun z : Schedule 2 n ↦ hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s)] change ((card (TwoArmScoreScheduleFiber θ A s) : ℕ) : ℝ) * _ = _ simp [div_eq_mul_inv]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScoreFiber_mass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:345
theorem twoArmX_eq_score_card

The scalar statistic is exactly the number of true coordinates in the transformed score vector.

Formal statement
n :
shared
z :
Schedule 2 n
A :
Assign 2 n
(twoArmX z A : ℕ) = (Finset.univ.filter fun i ↦ twoArmS z A i).card
Proof (Lean source)
lemma twoArmX_eq_score_card (z : Schedule 2 n) (A : Assign 2 n) : (twoArmX z A : ℕ) = (Finset.univ.filter fun i ↦ twoArmS z A i).card := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmX_eq_score_card · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:382
theorem twoArmCanonicalScoreFiber_mass_eq_binomial

the stated probability condition holds, the observed count satisfies its stated condition, On its exact support, the canonical mass of a fixed transformed-score vector is the binomial mass divided by the number of vectors with that score.

Formal statement
n :
shared
A :
Assign 2 n
s :
Unit n → Bool
hp :
(θ.1.1 : ℕ) ≤ (Finset.univ.filter fun i ↦ s i).card
hx :
(Finset.univ.filter fun i ↦ s i).card ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ)
(by classical exact ∑ z : Schedule 2 n, (if hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0))
= binomialHalf (θ.1.2.2 : ℕ) ((Finset.univ.filter fun i ↦ s i).card - (θ.1.1 : ℕ)) / choose n (Finset.univ.filter fun i ↦ s i).card
Proof (Lean source)
lemma twoArmCanonicalScoreFiber_mass_eq_binomial {θ : EffectTriple n} (A : Assign 2 n) (s : Unit n → Bool) (hp : (θ.1.1 : ℕ) ≤ (Finset.univ.filter fun i ↦ s i).card) (hx : (Finset.univ.filter fun i ↦ s i).card ≤ (θ.1.1 : ℕ) + (θ.1.2.2 : ℕ)) : (by classical exact ∑ z : Schedule 2 n, (if hasEffectTriple θ z ∧ (fun i ↦ twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)) = binomialHalf (θ.1.2.2 : ℕ) ((Finset.univ.filter fun i ↦ s i).card - (θ.1.1 : ℕ)) / Nat.choose n (Finset.univ.filter fun i ↦ s i).card := by classical let x := (Finset.univ.filter fun i ↦ s i).card let p := (θ.1.1 : ℕ) let m := (θ.1.2.1 : ℕ) let r := (θ.1.2.2 : ℕ) have hsum : p + m + r = n := θ.2 have hxn : x ≤ n := by dsimp [x] simpa using Finset.card_le_card (filter_subset (fun i ↦ s i) Finset.univ) have hchoose : (Nat.choose n x : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hxn).ne' have hfalse : (Finset.univ.filter fun i ↦ !(s i)).card = n - x := by have hpart := Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset (Unit n))) (p := fun i ↦ s i) simp only [Finset.card_univ, Fintype.card_fin] at hpart have heq : (Finset.univ.filter fun i ↦ !(s i)) = Finset.univ.filter fun i ↦ ¬ s i := by ext i cases hs : s i <;> simp [hs] rw [heq] omega rw [twoArmCanonicalScoreFiber_mass, twoArmScoreScheduleFiber_card] rw [hfalse] change ((Nat.choose x p * Nat.choose (n - x) m : ℕ) : ℝ) / ((Nat.factorial n : ℝ) / (Nat.factorial p * Nat.factorial m * Nat.factorial r) * 2 ^ r) = _ rw [Nat.cast_mul, twoArmCanonicalDenominator_eq_choose hsum] unfold binomialHalf change (Nat.choose x p : ℝ) * Nat.choose (n - x) m / ((Nat.choose n p : ℝ) * Nat.choose (n - p) m * 2 ^ r) = (Nat.choose r (x - p) : ℝ) / 2 ^ r / Nat.choose n x have hid := twoArmChooseFiber_identity hsum hp hx have hpN : p ≤ n := by omega have hmN : m ≤ n - p := by omega have hnp : (Nat.choose n p : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hpN).ne' have hnm : (Nat.choose (n - p) m : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hmN).ne' have hden : (Nat.choose n p : ℝ) * Nat.choose (n - p) m ≠ 0 := by exact mul_ne_zero hnp hnm field_simp [hchoose, hden] simpa [x, p, m, r, mul_assoc, mul_left_comm, mul_comm] using hid
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmCanonicalScoreFiber_mass_eq_binomial · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:389
def IsCanonicalNuLift

A lift is the actual ν-mixture of the canonical schedule kernels.

Definition (Lean source)
n :
shared
nu :
lift :
FiniteDesign (Schedule 2 n)
z :
IsCanonicalNuLift nu lift :
Prop
lift.p z = ∑ θ, nu.p θ * canonicalScheduleKernel θ z
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsCanonicalNuLift · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:445
def HasTwoArmScalarKernel

The paper's conditional binomial, assignment-ancillarity, and uniform-S claims.

Definition (Lean source)
n :
shared
θ :
HasTwoArmScalarKernel θ :
Prop
clause 1
A :
Assign 2 n
x :
Fin (n + 1)
∑ z : Schedule 2 n, (if twoArmX z A = x then canonicalScheduleKernel θ z else 0)
= ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), if (x : ℕ) = (θ.1.1 : ℕ)
+ k then binomialHalf (θ.1.2.2 : ℕ) k else 0
clause 2
A :
Assign 2 n
∑ z : Schedule 2 n, canonicalScheduleKernel θ z = 1
clause 3
A :
Assign 2 n
x :
Fin (n + 1)
s :
Unit n → Bool
(Finset.univ.filter fun i => s i).card = x
∑ z : Schedule 2 n, (if twoArmX z A = x ∧ (fun i => twoArmS z A i) = s then canonicalScheduleKernel θ z else 0)
= ∑ z : Schedule 2 n, (if twoArmX z A = x then canonicalScheduleKernel θ z else 0) / choose n x
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HasTwoArmScalarKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:450
def RaoBlackwellThroughX

Estimator-wise two-stage Rao--Blackwell domination through the scalar count.

Definition (Lean source)
n :
shared
nu :
lift :
FiniteDesign (Schedule 2 n)
D :
RaoBlackwellThroughX nu lift :
Prop
∃ f : ℕ → ℝ,
(∑ θ, nu.p θ * ∑ k ∈ range ((θ.1.2.2 : ℕ) + 1), binomialHalf (θ.1.2.2 : ℕ) k * (f ((θ.1.1 : ℕ) + k) - (((θ.1.1 : ℕ) : ℝ) - ((θ.1.2.1 : ℕ) : ℝ)) / n) ^ 2)
≤ lift.E (fun z => labeledRisk twoArmContrast (D, est) z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RaoBlackwellThroughX · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:468
theorem scalarBayesRisk_le_rho2_of_scheduleKernel

the schedule kernel has the stated scalar representation, Once a complete-schedule lift has the scalar Bayes risk for every assignment law, that scalar risk is a lower bound for the unrestricted two-arm minimax value.

Formal statement
n :
nu :
lift :
FiniteDesign (Schedule 2 n)
hkernel :
Proof (Lean source)
lemma scalarBayesRisk_le_rho2_of_scheduleKernel {n : ℕ} (nu : EffectPrior n) (lift : FiniteDesign (Schedule 2 n)) (hkernel : ∀ D : FiniteDesign (Assign 2 n), fullScheduleBayesRisk lift D = scalarBayesRisk nu) : scalarBayesRisk nu ≤ rho2 n := by let _ : Nonempty (Procedure 2 n twoArmContrast) := ⟨contrastWeightedProcedure 2 n twoArmContrast⟩ unfold rho2 rhoN apply le_minimaxValue intro p rw [← hkernel p.1] unfold fullScheduleBayesRisk have hbdd : BddBelow {v : ℝ | ∃ est : Estimator 2 n twoArmContrast, v = lift.E (fun z ↦ labeledRisk twoArmContrast (p.1, est) z)} := by refine ⟨0, ?_⟩ rintro v ⟨est, rfl⟩ exact sum_nonneg fun z _ ↦ mul_nonneg (lift.p_nonneg z) (p.1.mse_nonneg _ _) calc sInf {v : ℝ | ∃ est : Estimator 2 n twoArmContrast, v = lift.E (fun z ↦ labeledRisk twoArmContrast (p.1, est) z)} ≤ lift.E (fun z ↦ labeledRisk twoArmContrast p z) := csInf_le hbdd ⟨p.2, rfl⟩ _ ≤ worstCaseRisk (fun q z ↦ labeledRisk twoArmContrast q z) p := finiteDesign_expectedLoss_le_worstCaseRisk lift (fun q z ↦ labeledRisk twoArmContrast q z) (fun q z ↦ q.1.mse_nonneg _ _) p
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarBayesRisk_le_rho2_of_scheduleKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSchedulePrior.lean:481
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmSmoothKernel 9 declarations The measurable Markov-kernel form of the smooth scalar-to-effect-count design.

The measurable Markov-kernel form of the smooth scalar-to-effect-count design. This is the continuous-mixture input used by the finite posterior Bayes-risk bridge.

def smoothKernelEffectTripleMeasurableSpace

The smooth kernel effect triple space carries the discrete measurable structure.

Definition (Lean source)
noncomputable local instance smoothKernelEffectTripleMeasurableSpace (n : ℕ) : MeasurableSpace (EffectTriple n) := ⊤
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.smoothKernelEffectTripleMeasurableSpace · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:17
theorem smoothKernelEffectTripleMeasurableSingleton

the smooth kernel effect triple measurable singleton property holds.

Formal statement
Proof (Lean source)
noncomputable local instance smoothKernelEffectTripleMeasurableSingleton (n : ℕ) : MeasurableSingletonClass (EffectTriple n) := ⟨fun _ => MeasurableSet.of_discrete⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.smoothKernelEffectTripleMeasurableSingleton · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:20

The zero/zero/n effect-count triple witnesses nonemptiness.

Formal statement
∀ (n : ℕ), Nonempty (EffectTriple n)
Proof (Lean source)
noncomputable local instance effectTriple_nonempty (n : ℕ) : Nonempty (EffectTriple n) := ⟨⟨⟨⟨0, zero_lt_succ n⟩, ⟨⟨0, zero_lt_succ n⟩, ⟨n, Nat.lt_succ_self n⟩⟩⟩, by simp⟩⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.effectTriple_nonempty · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:26
theorem twoArmSmoothEffectDesign_p_measurable

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, Every effect-count atom of the clamped smooth response design depends measurably on the scalar parameter.

Formal statement
n :
a :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
e :
Measurable (fun θ : ℝ => (twoArmSmoothEffectDesign n a θ ha0 ha1).p e)
Proof (Lean source)
lemma twoArmSmoothEffectDesign_p_measurable {n : ℕ} {a : ℝ} (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (e : EffectTriple n) : Measurable (fun θ : ℝ => (twoArmSmoothEffectDesign n a θ ha0 ha1).p e) := by unfold twoArmSmoothEffectDesign simp only [FiniteDesign.map_p, prodDesign_p, twoArmSmoothResponseTypeDesign, twoArmClampedParameter] apply Finset.measurable_sum intro r _hr by_cases h : responseVectorEffectTriple r = e · simp only [h, if_true] apply Finset.measurable_prod intro i _hi cases h0 : (r i).1 <;> cases h1 : (r i).2 <;> simp [h0, h1] <;> fun_prop · simp [h]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothEffectDesign_p_measurable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:32

The smooth scalar response model as a measurable Markov kernel into finite effect-class counts. Clamping makes it a probability kernel for every real parameter.

Definition (Lean source)
n :
a :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
twoArmSmoothEffectKernel n a ha0 ha1 :
clause 1
clause 2
measurable' := by apply Measure.measurable_of_measurable_coe intro s _hs simp only [FiniteDesign.toMeasure_apply] apply measurable_sum intro e _he apply Measurable.mul_const exact ENNReal.measurable_ofReal.comp (twoArmSmoothEffectDesign_p_measurable ha0 ha1 e)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothEffectKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:49
instance twoArmSmoothEffectKernel_isMarkovKernel

The two arm smooth effect kernel construction is a Markov kernel.

Definition (Lean source)
noncomputable instance twoArmSmoothEffectKernel_isMarkovKernel (n : ℕ) (a : ℝ) (ha0 : 0 ≤ a) (ha1 : a ≤ 1) : IsMarkovKernel (twoArmSmoothEffectKernel n a ha0 ha1) := by refine ⟨?_⟩ intro θ change IsProbabilityMeasure (twoArmSmoothEffectDesign n a θ ha0 ha1).toMeasure infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothEffectKernel_isMarkovKernel · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:64
theorem twoArmSmoothEffectKernel_apply

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, At a fixed scalar parameter, the smooth effect kernel is exactly the measure induced by the paper-local finite effect-count design.

Formal statement
n :
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
Proof (Lean source)
lemma twoArmSmoothEffectKernel_apply (n : ℕ) (a θ : ℝ) (ha0 : 0 ≤ a) (ha1 : a ≤ 1) : twoArmSmoothEffectKernel n a ha0 ha1 θ = (twoArmSmoothEffectDesign n a θ ha0 ha1).toMeasure := rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothEffectKernel_apply · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:74
theorem twoArmSmoothEffectKernel_singletonReal

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, Singleton masses of the smooth effect kernel are the corresponding finite-design masses.

Formal statement
n :
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
e :
(twoArmSmoothEffectKernel n a ha0 ha1 θ).real {e}
= (twoArmSmoothEffectDesign n a θ ha0 ha1).p e
Proof (Lean source)
lemma twoArmSmoothEffectKernel_singletonReal (n : ℕ) (a θ : ℝ) (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (e : EffectTriple n) : (twoArmSmoothEffectKernel n a ha0 ha1 θ).real {e} = (twoArmSmoothEffectDesign n a θ ha0 ha1).p e := by classical change (twoArmSmoothEffectDesign n a θ ha0 ha1).toMeasure.real {e} = _ rw [show ({e} : Set (EffectTriple n)) = {x | x = e} by ext; simp] rw [FiniteDesign.toMeasure_real_setOf] unfold FiniteDesign.Pr FiniteDesign.E FiniteDesign.ind simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothEffectKernel_singletonReal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:81
theorem inducedFiniteDesign_twoArmSmoothEffect_p

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, The prior-induced finite effect-count design has the expected atomwise mixture formula.

Formal statement
n :
a :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
e :
= ∫ θ, (twoArmSmoothEffectDesign n a θ ha0 ha1).p e ∂π
Proof (Lean source)
lemma inducedFiniteDesign_twoArmSmoothEffect_p (n : ℕ) (a : ℝ) (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (π : Measure ℝ) [IsProbabilityMeasure π] (e : EffectTriple n) : (inducedFiniteDesign π (twoArmSmoothEffectKernel n a ha0 ha1)).p e = ∫ θ, (twoArmSmoothEffectDesign n a θ ha0 ha1).p e ∂π := by unfold inducedFiniteDesign simp_rw [twoArmSmoothEffectKernel_singletonReal]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.inducedFiniteDesign_twoArmSmoothEffect_p · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothKernel.lean:94
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmSmoothModel 43 declarations Paper-local analytic identities for the smooth two-arm prior.

Paper-local analytic identities for the smooth two-arm prior. These isolate the bandwidth and observation-dependent posterior-target calculations needed by the finite van Trees assembly.

The bandwidth used in the coarse two-arm converse.

Definition (Lean source)
n :
twoArmBandwidth n :
(n : ℝ) ^ (-(1 / 3 : ℝ))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBandwidth · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:18
theorem twoArmBandwidth_pos

the population size is positive, A positive population size gives a positive converse bandwidth.

Formal statement
n :
hn :
0 < n
Proof (Lean source)
lemma twoArmBandwidth_pos {n : ℕ} (hn : 0 < n) : 0 < twoArmBandwidth n := by unfold twoArmBandwidth positivity
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBandwidth_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:23
theorem twoArmBandwidth_le_half

the population size is positive, For n ≥ 8, the converse bandwidth is at most one half.

Formal statement
n :
hn :
8 ≤ n
twoArmBandwidth n ≤ 1 / 2
Proof (Lean source)
lemma twoArmBandwidth_le_half {n : ℕ} (hn : 8 ≤ n) : twoArmBandwidth n ≤ 1 / 2 := by have hnpos : 0 < n := by omega have hnR : 0 < (n : ℝ) := by positivity let a := twoArmBandwidth n have ha_pos : 0 < a := twoArmBandwidth_pos hnpos have ha3 : a ^ 3 = (n : ℝ)⁻¹ := by dsimp [a, twoArmBandwidth] rw [← Real.rpow_mul_natCast hnR.le (-(1 / 3 : ℝ)) 3] norm_num exact Real.rpow_neg_one (n : ℝ) have hninv : (n : ℝ)⁻¹ ≤ (8 : ℝ)⁻¹ := by exact (inv_le_inv₀ hnR (by norm_num)).2 (by exact_mod_cast hn) by_contra h have ha_gt : 1 / 2 < a := lt_of_not_ge h have ha_sq : (1 / 4 : ℝ) < a ^ 2 := by nlinarith [sq_nonneg (a - 1 / 2)] have ha_cube : (1 / 8 : ℝ) < a ^ 3 := by have ha_gt' : (2 : ℝ)⁻¹ < a := by simpa [one_div] using ha_gt calc (1 / 8 : ℝ) < a ^ 2 / 2 := by linarith _ < a ^ 2 * a := by exact mul_lt_mul_of_pos_left ha_gt' (sq_pos_of_pos ha_pos) _ = a ^ 3 := by ring norm_num at hninv rw [ha3] at ha_cube linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBandwidth_le_half · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:29
theorem twoArmBandwidth_sq

the population size is positive, Squaring the converse bandwidth gives the displayed n^(-2/3) term.

Formal statement
n :
hn :
0 < n
twoArmBandwidth n ^ 2 = (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
lemma twoArmBandwidth_sq {n : ℕ} (hn : 0 < n) : twoArmBandwidth n ^ 2 = (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hnR : 0 ≤ (n : ℝ) := by positivity unfold twoArmBandwidth rw [← Real.rpow_mul_natCast hnR (-(1 / 3 : ℝ)) 2] congr 1 ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBandwidth_sq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:59

The coefficient of the centered observed score in the posterior target.

Definition (Lean source)
a θ :
twoArmPosteriorWeight a θ :
(a - θ ^ 2) / (1 - θ ^ 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorWeight · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:69
theorem twoArmPosteriorWeight_bounds

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, On the smooth-prior support, the posterior weight lies between zero and the bandwidth.

Formal statement
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
:
|θ| ≤ a / 2
conclusion 1
conclusion 2
Proof (Lean source)
lemma twoArmPosteriorWeight_bounds {a θ : ℝ} (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (hθ : |θ| ≤ a / 2) : 0 ≤ twoArmPosteriorWeight a θ ∧ twoArmPosteriorWeight a θ ≤ a := by have hθsq : θ ^ 2 ≤ a ^ 2 / 4 := by have ha2 : 0 ≤ a / 2 := by positivity have hh : |θ| ^ 2 ≤ (a / 2) ^ 2 := (sq_le_sq₀ (abs_nonneg θ) ha2).2 hθ rw [sq_abs] at hh nlinarith have ha_sq_le : a ^ 2 ≤ a := by nlinarith have hnum : 0 ≤ a - θ ^ 2 := by nlinarith have hden : 0 < 1 - θ ^ 2 := by nlinarith constructor · exact div_nonneg hnum hden.le · unfold twoArmPosteriorWeight rw [div_le_iff₀ hden] nlinarith [sq_nonneg θ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorWeight_bounds · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:74
def twoArmScoreAverage

The average signed score corresponding to a binary score vector.

Definition (Lean source)
n :
s :
Unit n → Bool
twoArmScoreAverage s :
(n : ℝ)⁻¹ * ∑ i, if s i then 1 else -1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreAverage · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:94
def twoArmPosteriorTarget

Posterior mean of the finite-population effect given the signed score vector.

Definition (Lean source)
n :
a θ :
s :
Unit n → Bool
twoArmPosteriorTarget a θ s :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTarget · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:99
theorem twoArmPosteriorWeight_hasDerivAt

the parameter lies in the stated interior interval, Derivative of the posterior-weight coefficient inside the regular Bernoulli region.

Formal statement
a θ :
:
θ ^ 2 ≠ 1
HasDerivAt (twoArmPosteriorWeight a) (2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2) θ
Proof (Lean source)
lemma twoArmPosteriorWeight_hasDerivAt {a θ : ℝ} (hθ : θ ^ 2 ≠ 1) : HasDerivAt (twoArmPosteriorWeight a) (2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2) θ := by have hden : 1 - θ ^ 2 ≠ 0 := sub_ne_zero.mpr hθ.symm have h := ((hasDerivAt_const θ a).sub ((hasDerivAt_id θ).pow 2)).div ((hasDerivAt_const θ 1).sub ((hasDerivAt_id θ).pow 2)) hden have heq : (((fun _ : ℝ ↦ a) - id ^ 2) / ((fun _ : ℝ ↦ 1) - id ^ 2)) = twoArmPosteriorWeight a := by funext x rfl rw [heq] at h have hcoef : ((0 - 2 * θ) * (1 - θ ^ 2) - (a - θ ^ 2) * (0 - 2 * θ)) / (1 - θ ^ 2) ^ 2 = 2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2 := by ring simpa only [id_eq, Pi.sub_apply, Pi.pow_apply, Nat.cast_ofNat, Nat.reduceSub, pow_one, mul_one, hcoef] using h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorWeight_hasDerivAt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:105
theorem twoArmPosteriorTarget_hasDerivAt

the parameter lies in the stated interior interval, Derivative identity for the observation-dependent posterior target.

Formal statement
n :
a θ :
s :
Unit n → Bool
:
θ ^ 2 ≠ 1
HasDerivAt (fun t ↦ twoArmPosteriorTarget a t s) (1 - twoArmPosteriorWeight a θ + (2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2) * (twoArmScoreAverage s - θ)) θ
Proof (Lean source)
lemma twoArmPosteriorTarget_hasDerivAt {n : ℕ} {a θ : ℝ} (s : Unit n → Bool) (hθ : θ ^ 2 ≠ 1) : HasDerivAt (fun t ↦ twoArmPosteriorTarget a t s) (1 - twoArmPosteriorWeight a θ + (2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2) * (twoArmScoreAverage s - θ)) θ := by have h := (hasDerivAt_id θ).add ((twoArmPosteriorWeight_hasDerivAt (a := a) hθ).mul ((hasDerivAt_const θ (twoArmScoreAverage s)).sub (hasDerivAt_id θ))) change HasDerivAt (fun t ↦ twoArmPosteriorTarget a t s) (1 + ((2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2) * (twoArmScoreAverage s - θ) + twoArmPosteriorWeight a θ * (0 - 1))) θ at h convert h using 1 <;> ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTarget_hasDerivAt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:125
def twoArmSmoothResponseTypeDesign

One response type under the smooth two-arm prior at fixed scalar parameter. The two nonzero-effect types have masses (a±θ)/2, while each zero-effect type has mass (1-a)/2.

Definition (Lean source)
a θ :
ha1 :
a ≤ 1
:
|θ| ≤ a
twoArmSmoothResponseTypeDesign a θ ha1 hθ :
clause 1
p t := if t.1 && !(t.2) then (a + θ) / 2 else if !(t.1) && t.2 then (a - θ) / 2 else (1 - a) / 2
clause 2
p_nonneg t := by have hb := abs_le.mp hθ split_ifs <;> linarith
clause 3
p_sum := by rw [Fintype.sum_prod_type] simp ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothResponseTypeDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:141

The signed Bernoulli score extracted from one response type at a fixed arm.

Definition (Lean source)
A :
Fin 2
t :
twoArmObservedScore A t :
if A = 0 then t.1 else !t.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmObservedScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:158

The signed unit-level treatment effect carried by a two-arm response type.

Definition (Lean source)
t :
twoArmResponseEffect t :
(if t.1 then 1 else 0) - (if t.2 then 1 else 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmResponseEffect · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:163
def twoArmBernoulliUnitDesign

One signed Bernoulli score with mean θ.

Definition (Lean source)
θ :
:
|θ| ≤ 1
twoArmBernoulliUnitDesign θ hθ :
clause 1
p s := if s then (1 + θ) / 2 else (1 - θ) / 2
clause 2
p_nonneg s := by have hb := abs_le.mp hθ cases s <;> simp <;> linarith
clause 3
p_sum := by simp [Fintype.sum_bool] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliUnitDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:168
theorem twoArmSmoothResponseType_effect_score_mass

the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, The joint score/effect numerator under one smooth response type equals the Bernoulli score mass times its posterior mean effect, for either assigned arm.

Formal statement
a θ :
ha1 :
a ≤ 1
:
|θ| ≤ a / 2
A :
Fin 2
s :
∑ t : Bool × Bool, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p t * (if twoArmObservedScore A t = s then twoArmResponseEffect t else 0)
= (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith [abs_nonneg θ, ha1]))).p s * (if s then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ))
Proof (Lean source)
lemma twoArmSmoothResponseType_effect_score_mass (a θ : ℝ) (ha1 : a ≤ 1) (hθ : |θ| ≤ a / 2) (A : Fin 2) (s : Bool) : ∑ t : Bool × Bool, (twoArmSmoothResponseTypeDesign a θ ha1 (hθ.trans (by nlinarith [abs_nonneg θ]))).p t * (if twoArmObservedScore A t = s then twoArmResponseEffect t else 0) = (twoArmBernoulliUnitDesign θ (hθ.trans (by nlinarith [abs_nonneg θ, ha1]))).p s * (if s then (a + θ) / (1 + θ) else -(a - θ) / (1 - θ)) := by have hp : 1 + θ ≠ 0 := by have hlow := (abs_le.mp hθ).1 linarith have hm : 1 - θ ≠ 0 := by have hupp := (abs_le.mp hθ).2 linarith by_cases hA : A = 0 · subst A cases s <;> norm_num [twoArmSmoothResponseTypeDesign, twoArmObservedScore, twoArmBernoulliUnitDesign, twoArmResponseEffect, Fintype.sum_prod_type] <;> field_simp [hp, hm] <;> ring · have hA1 : A = 1 := Fin.eq_one_of_ne_zero A hA subst A cases s <;> norm_num [twoArmSmoothResponseTypeDesign, twoArmObservedScore, twoArmBernoulliUnitDesign, twoArmResponseEffect, Fintype.sum_prod_type] <;> field_simp [hp, hm] <;> ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothResponseType_effect_score_mass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:180
theorem twoArmSmoothResponseType_score_mass

the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, Pushing the smooth response-type law through either assigned arm gives the same Bernoulli score mass (1±θ)/2; this is the one-unit ancillarity identity used by the continuous-to-finite mixture bridge.

Formal statement
a θ :
ha1 :
a ≤ 1
:
|θ| ≤ a
A :
Fin 2
s :
= (twoArmBernoulliUnitDesign θ (hθ.trans (by linarith))).p s
Proof (Lean source)
lemma twoArmSmoothResponseType_score_mass (a θ : ℝ) (ha1 : a ≤ 1) (hθ : |θ| ≤ a) (A : Fin 2) (s : Bool) : ((twoArmSmoothResponseTypeDesign a θ ha1 hθ).map (twoArmObservedScore A)).p s = (twoArmBernoulliUnitDesign θ (hθ.trans (by linarith))).p s := by by_cases hA : A = 0 · subst A cases s <;> norm_num [twoArmSmoothResponseTypeDesign, twoArmObservedScore, Fintype.sum_prod_type, map, twoArmBernoulliUnitDesign] <;> ring · have hA1 : A = 1 := Fin.eq_one_of_ne_zero A hA subst A cases s <;> norm_num [twoArmSmoothResponseTypeDesign, twoArmObservedScore, Fintype.sum_prod_type, map, twoArmBernoulliUnitDesign] <;> ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothResponseType_score_mass · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:210
def responseVectorEffectTriple

Effect-class counts induced by a vector of four two-arm response types.

Definition (Lean source)
n :
r :
Unit n → Bool × Bool
responseVectorEffectTriple r :
by let pp := (Finset.univ.filter fun i => (r i).1 && !((r i).2)).card let pm := (Finset.univ.filter fun i => !((r i).1) && (r i).2).card let pz := (Finset.univ.filter fun i => (r i).1 = (r i).2).card refine ⟨⟨⟨pp, ?_⟩, ⟨⟨pm, ?_⟩, ⟨pz, ?_⟩⟩⟩, ?_⟩ · apply Nat.lt_succ_of_le simpa [pp] using Finset.card_le_card (filter_subset (fun i : Unit n => (r i).1 && !((r i).2)) Finset.univ) · apply Nat.lt_succ_of_le simpa [pm] using Finset.card_le_card (filter_subset (fun i : Unit n => !((r i).1) && (r i).2) Finset.univ) · apply Nat.lt_succ_of_le simpa [pz] using Finset.card_le_card (filter_subset (fun i : Unit n => (r i).1 = (r i).2) Finset.univ) · dsimp [pp, pm, pz] calc _
= (Finset.univ : Finset (Unit n)).card := by repeat rw [Finset.card_eq_sum_ones] simp_rw [Finset.sum_filter] rw [← Finset.sum_add_distrib, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i _ cases (r i).1 <;> cases (r i).2 <;> simp _ = n := by simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.responseVectorEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:230
theorem effectTarget_responseVectorEffectTriple

The target of the response-vector effect counts is its positive-minus-negative effect count divided by the population size.

Formal statement
n :
r :
Unit n → Bool × Bool
= (((((Finset.univ.filter fun i => (r i).1 && !((r i).2)).card : ℕ) : ℝ) - (((Finset.univ.filter fun i => !((r i).1) && (r i).2).card : ℕ) : ℝ)) / n)
Proof (Lean source)
lemma effectTarget_responseVectorEffectTriple {n : ℕ} (r : Unit n → Bool × Bool) : effectTarget (responseVectorEffectTriple r) = (((((Finset.univ.filter fun i => (r i).1 && !((r i).2)).card : ℕ) : ℝ) - (((Finset.univ.filter fun i => !((r i).1) && (r i).2).card : ℕ) : ℝ)) / n) := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.effectTarget_responseVectorEffectTriple · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:257

Projection of a scalar parameter onto the response-design validity interval.

Definition (Lean source)
a θ :
twoArmClampedParameter a θ :
max (-a / 2 : ℝ) (min θ (a / 2))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmClampedParameter · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:265
theorem twoArmClampedParameter_abs_le

the parameter lies in the stated interval, the two arm clamped parameter abs is at most property holds.

Formal statement
a θ :
ha :
0 ≤ a
|twoArmClampedParameter a θ| ≤ a / 2
Proof (Lean source)
lemma twoArmClampedParameter_abs_le {a θ : ℝ} (ha : 0 ≤ a) : |twoArmClampedParameter a θ| ≤ a / 2 := by rw [abs_le] unfold twoArmClampedParameter constructor · convert le_max_left (-a / 2 : ℝ) (min θ (a / 2)) using 1 <;> ring · exact max_le (by linarith) (min_le_right θ (a / 2))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmClampedParameter_abs_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:270
theorem twoArmClampedParameter_eq

the parameter lies in the stated interior interval, the two arm clamped parameter equals property holds.

Formal statement
a θ :
:
|θ| ≤ a / 2
Proof (Lean source)
lemma twoArmClampedParameter_eq {a θ : ℝ} (hθ : |θ| ≤ a / 2) : twoArmClampedParameter a θ = θ := by rw [abs_le] at hθ unfold twoArmClampedParameter rw [min_eq_left hθ.2] exact max_eq_right (by linarith)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmClampedParameter_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:280
def twoArmSmoothEffectDesign

The smooth scalar model's independent response vector, pushed to its finite effect-class counts.

Definition (Lean source)
n :
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
twoArmSmoothEffectDesign n a θ ha0 ha1 :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothEffectDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:289
def twoArmBernoulliVectorDesign

Independent signed Bernoulli scores for the n labeled units.

Definition (Lean source)
n :
θ :
:
|θ| ≤ 1
twoArmBernoulliVectorDesign n θ hθ :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliVectorDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:301
theorem twoArmBernoulliUnit_signed_mean

the parameter lies in the stated interior interval, The one-unit signed score has expectation θ.

Formal statement
θ :
:
|θ| ≤ 1
(twoArmBernoulliUnitDesign θ hθ).E (fun s ↦ if s then 1 else -1) = θ
Proof (Lean source)
lemma twoArmBernoulliUnit_signed_mean (θ : ℝ) (hθ : |θ| ≤ 1) : (twoArmBernoulliUnitDesign θ hθ).E (fun s ↦ if s then 1 else -1) = θ := by unfold E simp [twoArmBernoulliUnitDesign, Fintype.sum_bool] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliUnit_signed_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:308
theorem twoArmScoreAverage_mean

the population size is positive, the parameter lies in the stated interior interval, The average signed score in the finite Bernoulli experiment has expectation θ.

Formal statement
n :
hn :
0 < n
θ :
:
|θ| ≤ 1
Proof (Lean source)
lemma twoArmScoreAverage_mean {n : ℕ} (hn : 0 < n) (θ : ℝ) (hθ : |θ| ≤ 1) : (twoArmBernoulliVectorDesign n θ hθ).E twoArmScoreAverage = θ := by let D := fun _ : Unit n ↦ twoArmBernoulliUnitDesign θ hθ change (prodDesign D).E (fun s ↦ (n : ℝ)⁻¹ * ∑ i, if s i then 1 else -1) = θ rw [(prodDesign D).E_const_mul] rw [(prodDesign D).E_sum] have hi (i : Unit n) : (prodDesign D).E (fun s ↦ if s i then 1 else -1) = θ := by let g : Bool → ℝ := fun b ↦ if b then 1 else -1 change (prodDesign D).E (fun s ↦ g (s i)) = θ rw [E_prod_apply D i] exact twoArmBernoulliUnit_signed_mean θ hθ simp_rw [hi] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreAverage_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:317
def twoArmPosteriorTargetDeriv

The supplied derivative field for the observation-dependent posterior target.

Definition (Lean source)
n :
a θ :
s :
Unit n → Bool
twoArmPosteriorTargetDeriv a θ s :
1
+ (2 * θ * (a - 1) / (1 - θ ^ 2) ^ 2) * (twoArmScoreAverage s - θ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTargetDeriv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:339
theorem twoArmPosteriorTargetDeriv_mean

the population size is positive, the parameter lies in the stated interior interval, Averaging the target derivative removes its centered-score term.

Formal statement
n :
hn :
0 < n
a θ :
:
|θ| ≤ 1
Proof (Lean source)
lemma twoArmPosteriorTargetDeriv_mean {n : ℕ} (hn : 0 < n) (a θ : ℝ) (hθ : |θ| ≤ 1) : (twoArmBernoulliVectorDesign n θ hθ).E (twoArmPosteriorTargetDeriv a θ) = 1 - twoArmPosteriorWeight a θ := by let D := twoArmBernoulliVectorDesign n θ hθ unfold twoArmPosteriorTargetDeriv rw [D.E_add, D.E_sub, D.E_const, D.E_const (twoArmPosteriorWeight a θ)] rw [D.E_const_mul] rw [D.E_sub, twoArmScoreAverage_mean hn θ hθ, D.E_const θ] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTargetDeriv_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:346
def twoArmBernoulliLikelihood

Product likelihood of the signed Bernoulli score vector.

Definition (Lean source)
n :
θ :
s :
Unit n → Bool
twoArmBernoulliLikelihood θ s :
∏ i, if s i then (1 + θ) / 2 else (1 - θ) / 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihood · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:359
def twoArmBernoulliLikelihoodDeriv

The product-rule derivative of the signed Bernoulli likelihood.

Definition (Lean source)
n :
θ :
s :
Unit n → Bool
twoArmBernoulliLikelihoodDeriv θ s :
∑ i, (∏ j ∈ Finset.univ.erase i, if s j then (1 + θ) / 2 else (1 - θ) / 2) * (if s i then (1 : ℝ) / 2 else -1 / 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihoodDeriv · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:365
theorem twoArmBernoulliLikelihood_eq_design

the parameter lies in the stated interior interval, On the Bernoulli parameter space, the explicit likelihood is the product-design mass.

Formal statement
n :
θ :
:
|θ| ≤ 1
s :
Unit n → Bool
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihood_eq_design · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:373
theorem twoArmBernoulliLikelihood_nonneg

the parameter lies in the stated interior interval, Every signed Bernoulli vector has nonnegative mass for |θ| ≤ 1.

Formal statement
n :
θ :
:
|θ| ≤ 1
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmBernoulliLikelihood_nonneg {n : ℕ} {θ : ℝ} (hθ : |θ| ≤ 1) (s : Unit n → Bool) : 0 ≤ twoArmBernoulliLikelihood θ s := by rw [twoArmBernoulliLikelihood_eq_design θ hθ] exact (twoArmBernoulliVectorDesign n θ hθ).p_nonneg s
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihood_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:381
theorem twoArmBernoulliLikelihood_sum

the parameter lies in the stated interior interval, The signed Bernoulli vector likelihood is normalized.

Formal statement
n :
θ :
:
|θ| ≤ 1
∑ s : Unit n → Bool, twoArmBernoulliLikelihood θ s = 1
Proof (Lean source)
lemma twoArmBernoulliLikelihood_sum {n : ℕ} {θ : ℝ} (hθ : |θ| ≤ 1) : ∑ s : Unit n → Bool, twoArmBernoulliLikelihood θ s = 1 := by simp_rw [twoArmBernoulliLikelihood_eq_design θ hθ] exact (twoArmBernoulliVectorDesign n θ hθ).p_sum
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihood_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:388
theorem twoArmBernoulliLikelihood_hasDerivAt

The displayed product-rule field is the likelihood derivative.

Formal statement
n :
θ :
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmBernoulliLikelihood_hasDerivAt {n : ℕ} (θ : ℝ) (s : Unit n → Bool) : HasDerivAt (fun t => twoArmBernoulliLikelihood t s) (twoArmBernoulliLikelihoodDeriv θ s) θ := by let q : Unit n → ℝ → ℝ := fun i t => if s i then (1 + t) / 2 else (1 - t) / 2 let dq : Unit n → ℝ := fun i => if s i then 1 / 2 else -1 / 2 have hq : ∀ i ∈ (Finset.univ : Finset (Unit n)), HasDerivAt (q i) (dq i) θ := by intro i hi by_cases hs : s i · simp only [q, dq, hs, if_true] simpa using ((hasDerivAt_const θ 1).add (hasDerivAt_id θ)).div_const 2 · simp only [q, dq, hs, if_false] simpa using ((hasDerivAt_const θ 1).sub (hasDerivAt_id θ)).div_const 2 have h := HasDerivAt.finset_prod hq unfold twoArmBernoulliLikelihood twoArmBernoulliLikelihoodDeriv rw [show (fun t ↦ ∏ i, if s i then (1 + t) / 2 else (1 - t) / 2) = ∏ i, q i by funext t simp [q]] simpa only [q, dq, smul_eq_mul] using h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihood_hasDerivAt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:395
def twoArmBernoulliRawScore

The ordinary score of the signed Bernoulli product likelihood in its positive region.

Definition (Lean source)
n :
θ :
s :
Unit n → Bool
twoArmBernoulliRawScore θ s :
∑ i, if s i then 1 / (1 + θ) else -1 / (1 - θ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliRawScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:420
theorem twoArmBernoulliLikelihoodDeriv_eq_mul_score

the parameter lies in the stated interior interval, In the regular Bernoulli region, likelihood derivative equals likelihood times score.

Formal statement
n :
θ :
:
|θ| < 1
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmBernoulliLikelihoodDeriv_eq_mul_score {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) (s : Unit n → Bool) : twoArmBernoulliLikelihoodDeriv θ s = twoArmBernoulliLikelihood θ s * twoArmBernoulliRawScore θ s := by have hp : 0 < 1 + θ := by rw [abs_lt] at hθ; linarith have hm : 0 < 1 - θ := by rw [abs_lt] at hθ; linarith unfold twoArmBernoulliLikelihoodDeriv twoArmBernoulliLikelihood twoArmBernoulliRawScore rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi rw [← Finset.prod_erase_mul (Finset.univ : Finset (Unit n)) (fun j ↦ if s j then (1 + θ) / 2 else (1 - θ) / 2) hi] by_cases hs : s i · simp [hs] field_simp [hp.ne'] · simp [hs] field_simp [hm.ne']
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihoodDeriv_eq_mul_score · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:426
theorem twoArmBernoulliUnit_rawScore_mean

the parameter lies in the stated interior interval, The one-coordinate Bernoulli likelihood score is centered.

Formal statement
θ :
:
|θ| < 1
(twoArmBernoulliUnitDesign θ hθ.le).E (fun s ↦ if s then 1 / (1 + θ) else -1 / (1 - θ))
= 0
Proof (Lean source)
lemma twoArmBernoulliUnit_rawScore_mean {θ : ℝ} (hθ : |θ| < 1) : (twoArmBernoulliUnitDesign θ hθ.le).E (fun s ↦ if s then 1 / (1 + θ) else -1 / (1 - θ)) = 0 := by have hp : 1 + θ ≠ 0 := by rw [abs_lt] at hθ; linarith have hm : 1 - θ ≠ 0 := by rw [abs_lt] at hθ; linarith unfold E simp [twoArmBernoulliUnitDesign, Fintype.sum_bool] field_simp [hp, hm] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliUnit_rawScore_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:447
theorem twoArmBernoulliUnit_rawScore_var

the parameter lies in the stated interior interval, The one-coordinate Bernoulli likelihood score has information 1/(1-θ²).

Formal statement
θ :
:
|θ| < 1
(twoArmBernoulliUnitDesign θ hθ.le).Var (fun s ↦ if s then 1 / (1 + θ) else -1 / (1 - θ))
= 1 / (1 - θ ^ 2)
Proof (Lean source)
lemma twoArmBernoulliUnit_rawScore_var {θ : ℝ} (hθ : |θ| < 1) : (twoArmBernoulliUnitDesign θ hθ.le).Var (fun s ↦ if s then 1 / (1 + θ) else -1 / (1 - θ)) = 1 / (1 - θ ^ 2) := by have hp : 1 + θ ≠ 0 := by rw [abs_lt] at hθ; linarith have hm : 1 - θ ≠ 0 := by rw [abs_lt] at hθ; linarith have hden : 1 - θ ^ 2 ≠ 0 := by rw [show 1 - θ ^ 2 = (1 + θ) * (1 - θ) by ring] exact mul_ne_zero hp hm rw [Var_eq, twoArmBernoulliUnit_rawScore_mean hθ] unfold E simp [twoArmBernoulliUnitDesign, Fintype.sum_bool] field_simp [hp, hm, hden] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliUnit_rawScore_var · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:459
theorem twoArmBernoulliRawScore_sq_mean

the parameter lies in the stated interior interval, The independent n-coordinate score has Fisher information n/(1-θ²).

Formal statement
n :
θ :
:
|θ| < 1
(twoArmBernoulliVectorDesign n θ hθ.le).E (fun s ↦ twoArmBernoulliRawScore θ s ^ 2)
= (n : ℝ) / (1 - θ ^ 2)
Proof (Lean source)
lemma twoArmBernoulliRawScore_sq_mean {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) : (twoArmBernoulliVectorDesign n θ hθ.le).E (fun s ↦ twoArmBernoulliRawScore θ s ^ 2) = (n : ℝ) / (1 - θ ^ 2) := by let D := fun _ : Unit n ↦ twoArmBernoulliUnitDesign θ hθ.le let g : Bool → ℝ := fun s ↦ if s then 1 / (1 + θ) else -1 / (1 - θ) have hmean : (prodDesign D).E (fun s ↦ ∑ i, g (s i)) = 0 := by rw [(prodDesign D).E_sum] apply Finset.sum_eq_zero intro i hi rw [E_prod_apply] exact twoArmBernoulliUnit_rawScore_mean hθ have hvar := Var_prod_linear_comb D (fun _ ↦ (1 : ℝ)) (fun _ ↦ g) have hvar' : (prodDesign D).Var (fun s ↦ ∑ i, g (s i)) = ∑ i, (D i).Var g := by simpa only [one_mul, one_pow] using hvar dsimp [D, g] at hvar' simp_rw [twoArmBernoulliUnit_rawScore_var hθ] at hvar' simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hvar' rw [Var_eq, hmean] at hvar' norm_num at hvar' simpa [twoArmBernoulliVectorDesign, twoArmBernoulliRawScore, D, g, div_eq_mul_inv] using hvar'
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliRawScore_sq_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:477
theorem twoArmBernoulliLikelihood_pos

the parameter lies in the stated interior interval, Every score vector has strictly positive likelihood in the open Bernoulli region.

Formal statement
n :
θ :
:
|θ| < 1
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmBernoulliLikelihood_pos {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) (s : Unit n → Bool) : 0 < twoArmBernoulliLikelihood θ s := by rw [abs_lt] at hθ unfold twoArmBernoulliLikelihood apply Finset.prod_pos intro i hi split <;> linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihood_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:505
theorem twoArmBernoulli_guardedScore_eq_rawScore

the parameter lies in the stated interior interval, The promoted guarded likelihood score agrees with the ordinary product score.

Formal statement
n :
θ :
:
|θ| < 1
s :
Unit n → Bool
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulli_guardedScore_eq_rawScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:515
theorem twoArmBernoulli_fisherInformation

the parameter lies in the stated interior interval, The exact finite counting-measure Fisher information is n/(1-θ²).

Formal statement
n :
θ :
:
|θ| < 1
fisherInformation (X := Unit n → Bool) Measure.count (twoArmBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ
= (n : ℝ) / (1 - θ ^ 2)
Proof (Lean source)
lemma twoArmBernoulli_fisherInformation {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) : fisherInformation (X := Unit n → Bool) Measure.count (twoArmBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ = (n : ℝ) / (1 - θ ^ 2) := by rw [fisherInformation_count_eq_sum] simp_rw [twoArmBernoulli_guardedScore_eq_rawScore hθ] rw [← twoArmBernoulliRawScore_sq_mean hθ] unfold E apply Finset.sum_congr rfl intro s hs rw [← twoArmBernoulliLikelihood_eq_design θ hθ.le]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulli_fisherInformation · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:527
theorem twoArmPosteriorTargetDeriv_mean_lower

the population size is positive, the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, On the smooth-prior support, the averaged posterior-target derivative is at least 1-a.

Formal statement
n :
hn :
0 < n
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
:
|θ| ≤ a / 2
1 - a
≤ (twoArmBernoulliVectorDesign n θ ((hθ.trans (by nlinarith : a / 2 ≤ 1)))).E (twoArmPosteriorTargetDeriv a θ)
Proof (Lean source)
lemma twoArmPosteriorTargetDeriv_mean_lower {n : ℕ} (hn : 0 < n) {a θ : ℝ} (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (hθ : |θ| ≤ a / 2) : 1 - a ≤ (twoArmBernoulliVectorDesign n θ ((hθ.trans (by nlinarith : a / 2 ≤ 1)))).E (twoArmPosteriorTargetDeriv a θ) := by have hθone : |θ| ≤ 1 := hθ.trans (by nlinarith : a / 2 ≤ 1) rw [twoArmPosteriorTargetDeriv_mean hn a θ hθone] exact sub_le_sub_left (twoArmPosteriorWeight_bounds ha0 ha1 hθ).2 1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTargetDeriv_mean_lower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:542
theorem twoArmBernoulli_fisherInformation_upper

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, the parameter lies in the stated interior interval, On |θ| ≤ a/2, Bernoulli product information is bounded by its value at the edge of that interval.

Formal statement
n :
a θ :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
:
|θ| ≤ a / 2
fisherInformation (X := Unit n → Bool) Measure.count (twoArmBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ
≤ (n : ℝ) / (1 - a ^ 2 / 4)
Proof (Lean source)
lemma twoArmBernoulli_fisherInformation_upper {n : ℕ} {a θ : ℝ} (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (hθ : |θ| ≤ a / 2) : fisherInformation (X := Unit n → Bool) Measure.count (twoArmBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ ≤ (n : ℝ) / (1 - a ^ 2 / 4) := by have hθlt : |θ| < 1 := lt_of_le_of_lt hθ (by nlinarith) rw [twoArmBernoulli_fisherInformation hθlt] have hθsq : θ ^ 2 ≤ a ^ 2 / 4 := by have hs := sq_le_sq₀ (abs_nonneg θ) (by positivity : 0 ≤ a / 2) |>.2 hθ rw [sq_abs] at hs nlinarith have hdenθ : 0 < 1 - θ ^ 2 := by have := sq_lt_sq₀ (abs_nonneg θ) (by norm_num : (0 : ℝ) ≤ 1) |>.2 hθlt rw [sq_abs] at this nlinarith have hdena : 0 < 1 - a ^ 2 / 4 := by nlinarith [sq_nonneg a] exact div_le_div_of_nonneg_left (Nat.cast_nonneg n) hdena (by nlinarith : 1 - a ^ 2 / 4 ≤ 1 - θ ^ 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulli_fisherInformation_upper · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmSmoothModel.lean:553
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmVanTreesAssembly 5 declarations Assembly of the finite van Trees regularity record for the smooth two-arm model.

Assembly of the finite van Trees regularity record for the smooth two-arm model.

theorem finiteCountProduct_aestronglyMeasurable_of_sections Lemma finiteCountProduct_aestronglyMeasurable_of_sections in the paper ↗

every finite-coordinate section satisfies the stated regularity condition, Sectionwise measurability on a finite discrete carrier gives product almost-everywhere strong measurability.

Formal statement
μ :
f :
ℝ × X → ℝ
hf :
∀ x, AEStronglyMeasurable (fun θ => f (θ, x)) μ
AEStronglyMeasurable f (μ.prod Measure.count)
Proof (Lean source)
lemma finiteCountProduct_aestronglyMeasurable_of_sections {X : Type*} [Fintype X] [MeasurableSpace X] [MeasurableSingletonClass X] {μ : Measure ℝ} {f : ℝ × X → ℝ} (hf : ∀ x, AEStronglyMeasurable (fun θ => f (θ, x)) μ) : AEStronglyMeasurable f (μ.prod Measure.count) := by classical have hterm (x : X) : AEStronglyMeasurable (fun z : ℝ × X => (if z.2 = x then 1 else 0) * f (z.1, x)) (μ.prod Measure.count) := by apply AEStronglyMeasurable.mul · exact (show Measurable (fun z : ℝ × X => if z.2 = x then (1 : ℝ) else 0) by apply Measurable.ite · exact (measurableSet_singleton x).preimage measurable_snd · exact measurable_const · exact measurable_const).aestronglyMeasurable · exact (hf x).comp_fst have hsum := Finset.aestronglyMeasurable_sum (Finset.univ : Finset X) (fun x _hx => hterm x) apply hsum.congr filter_upwards with z simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteCountProduct_aestronglyMeasurable_of_sections · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesAssembly.lean:15
theorem twoArmScoreSqField_integrable

the parameter lies in the stated interval, The joint guarded-score square is integrable in the smooth two-arm model.

Formal statement
n :
a :
ha :
0 < a
Proof (Lean source)
lemma twoArmScoreSqField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) : Integrable (scoreSqField (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv) ((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))) := by let μ := (parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool)) have hp := twoArmPriorScoreField_integrable (n := n) a ha have hf := twoArmFisherScoreField_integrable (n := n) a ha have hc := twoArmScoreCrossField_integrable (n := n) a ha apply (hp.add (hf.add (hc.const_mul 2))).congr filter_upwards with z have hw0 : 0 ≤ smoothPrior 0 (a / 2) z.1 := smoothPrior_nonneg (by positivity) z.1 have hp0 : 0 ≤ twoArmRegularBernoulliLikelihood z.1 z.2 := twoArmRegularBernoulliLikelihood_nonneg z.1 z.2 by_cases hw : 0 < smoothPrior 0 (a / 2) z.1 · by_cases hlik : 0 < twoArmRegularBernoulliLikelihood z.1 z.2 · simp only [Pi.add_apply, Pi.mul_apply] rw [scoreSqField, jointScore_eq_add hw hlik] unfold jointDensity ring · have hpz : twoArmRegularBernoulliLikelihood z.1 z.2 = 0 := le_antisymm (le_of_not_gt hlik) hp0 simp [scoreSqField, jointScore, jointDensity, priorScore, likelihoodScore, hw, hlik, hpz] · have hwz : smoothPrior 0 (a / 2) z.1 = 0 := le_antisymm (le_of_not_gt hw) hw0 simp [scoreSqField, jointScore, jointDensity, priorScore, likelihoodScore, hw, hwz]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreSqField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesAssembly.lean:40
theorem twoArmErrorScoreField_integrable

the parameter lies in the stated interval, Estimator error times the joint guarded score is integrable by weighted Young's inequality and the two square-integrability results.

Formal statement
n :
a :
ha :
0 < a
T :
(Unit n → Bool) → ℝ
Proof (Lean source)
lemma twoArmErrorScoreField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) (T : (Unit n → Bool) → ℝ) : Integrable (errorScoreField (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv (twoArmPosteriorTarget a) T) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count) := by let μ := (parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool)) have he := twoArmErrorSqField_integrable (n := n) a ha T have hs := twoArmScoreSqField_integrable (n := n) a ha have hmem : ∀ᵐ z ∂μ, z.1 ∈ Icc (-1 / 2 : ℝ) (1 / 2) := by have hθ : ∀ᵐ θ ∂parameterMeasure (-1 / 2) (1 / 2), θ ∈ Icc (-1 / 2 : ℝ) (1 / 2) := by unfold parameterMeasure exact ae_restrict_mem measurableSet_Icc exact (Measure.quasiMeasurePreserving_fst.tendsto_ae.eventually hθ) have hEq : errorScoreField (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv (twoArmPosteriorTarget a) T =ᵐ[μ] fun z => (T z.2 - twoArmPosteriorTarget a z.1 z.2) * (smoothPriorDeriv 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 + smoothPrior 0 (a / 2) z.1 * twoArmBernoulliLikelihoodDeriv z.1 z.2) := by filter_upwards [hmem] with z hz apply errorScoreField_eq_numerator · exact smoothPrior_nonneg (by positivity) z.1 · exact twoArmRegularBernoulliLikelihood_nonneg z.1 z.2 · exact derivative_eq_zero_of_nonnegative_of_eq_zero (smoothPrior_nonneg (by positivity)) (hasDerivAt_smoothPrior (by positivity) z.1) · exact derivative_eq_zero_of_nonnegative_of_eq_zero (fun θ => twoArmRegularBernoulliLikelihood_nonneg θ z.2) (twoArmRegularBernoulliLikelihood_hasDerivAt (by rw [abs_lt] constructor <;> nlinarith [hz.1, hz.2]) z.2) have hnumSm : AEStronglyMeasurable (fun z : ℝ × (Unit n → Bool) => (T z.2 - twoArmPosteriorTarget a z.1 z.2) * (smoothPriorDeriv 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 + smoothPrior 0 (a / 2) z.1 * twoArmBernoulliLikelihoodDeriv z.1 z.2)) μ := by apply finiteCountProduct_aestronglyMeasurable_of_sections intro s have hgCont := (twoArmPosteriorTarget_absolutelyContinuous a s).continuousOn rw [uIcc_of_le (by norm_num : (-1 / 2 : ℝ) ≤ 1 / 2)] at hgCont have hg : AEStronglyMeasurable (fun θ => twoArmPosteriorTarget a θ s) (parameterMeasure (-1 / 2) (1 / 2)) := hgCont.aestronglyMeasurable measurableSet_Icc have hp : AEStronglyMeasurable (fun θ => twoArmRegularBernoulliLikelihood θ s) (parameterMeasure (-1 / 2) (1 / 2)) := (twoArmRegularBernoulliLikelihood_continuousOn s).aestronglyMeasurable measurableSet_Icc have hdwCont : Continuous (smoothPriorDeriv 0 (a / 2)) := by have heq : smoothPriorDeriv 0 (a / 2) = deriv (smoothPrior 0 (a / 2)) := by funext θ exact (hasDerivAt_smoothPrior (by positivity) θ).deriv.symm rw [heq] exact (smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous_deriv_one have hdpCont : Continuous (fun θ => twoArmBernoulliLikelihoodDeriv θ s) := by unfold twoArmBernoulliLikelihoodDeriv apply continuous_finsetSum univ intro i _hi apply Continuous.mul · apply continuous_finsetProd (Finset.univ.erase i) intro j _hj split <;> fun_prop · split <;> fun_prop have hT : AEStronglyMeasurable (fun _ : ℝ => T s) (parameterMeasure (-1 / 2) (1 / 2)) := aestronglyMeasurable_const have hw : AEStronglyMeasurable (smoothPrior 0 (a / 2)) (parameterMeasure (-1 / 2) (1 / 2)) := (smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.aestronglyMeasurable have hsm := (hT.sub hg).mul ((hdwCont.aestronglyMeasurable.mul hp).add (hw.mul hdpCont.aestronglyMeasurable)) apply hsm.congr filter_upwards with θ rfl apply Integrable.congr ((he.add hs).mono' hnumSm ?_) hEq.symm filter_upwards [hEq] with z hz rw [← hz] unfold errorScoreField errorSqField scoreSqField change ‖(T z.2 - twoArmPosteriorTarget a z.1 z.2) * jointScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z * jointDensity (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood z‖ ≤ _ · have hw : 0 ≤ smoothPrior 0 (a / 2) z.1 := smoothPrior_nonneg (by positivity) z.1 have hp : 0 ≤ twoArmRegularBernoulliLikelihood z.1 z.2 := twoArmRegularBernoulliLikelihood_nonneg z.1 z.2 have hq : 0 ≤ jointDensity (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood z := mul_nonneg hw hp rw [Real.norm_eq_abs, abs_mul, abs_mul, abs_of_nonneg hq] simp only [Pi.add_apply] have hyoung : |T z.2 - twoArmPosteriorTarget a z.1 z.2| * |jointScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z| ≤ (T z.2 - twoArmPosteriorTarget a z.1 z.2) ^ 2 + jointScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z ^ 2 := by nlinarith [sq_nonneg (|T z.2 - twoArmPosteriorTarget a z.1 z.2| - |jointScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z|), sq_abs (T z.2 - twoArmPosteriorTarget a z.1 z.2), sq_abs (jointScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z)] calc _ ≤ ((T z.2 - twoArmPosteriorTarget a z.1 z.2) ^ 2 + jointScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z ^ 2) * jointDensity (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood z := mul_le_mul_of_nonneg_right hyoung hq _ = _ := by change _ = errorSqField (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood (twoArmPosteriorTarget a) T z + scoreSqField (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z unfold errorSqField scoreSqField ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmErrorScoreField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesAssembly.lean:74
theorem twoArmDerivativeBalanceField_integrable

the parameter lies in the stated interval, The derivative-balance field is integrable because it is the error-score field minus the already integrable sensitivity field.

Formal statement
n :
a :
ha :
0 < a
T :
(Unit n → Bool) → ℝ
Proof (Lean source)
lemma twoArmDerivativeBalanceField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) (T : (Unit n → Bool) → ℝ) : Integrable (derivativeBalanceField (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv (twoArmPosteriorTarget a) (twoArmPosteriorTargetDeriv a) T) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count) := by have he := twoArmErrorScoreField_integrable (n := n) a ha T have hs := twoArmSensitivityField_integrable (n := n) a ha have hmem : ∀ᵐ z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))), z.1 ∈ Icc (-1 / 2 : ℝ) (1 / 2) := by have hθ : ∀ᵐ θ ∂parameterMeasure (-1 / 2) (1 / 2), θ ∈ Icc (-1 / 2 : ℝ) (1 / 2) := by unfold parameterMeasure exact ae_restrict_mem measurableSet_Icc exact Measure.quasiMeasurePreserving_fst.tendsto_ae.eventually hθ apply (he.sub hs).congr filter_upwards [hmem] with z hz have hw0 : 0 ≤ smoothPrior 0 (a / 2) z.1 := smoothPrior_nonneg (by positivity) z.1 have hp0 : 0 ≤ twoArmRegularBernoulliLikelihood z.1 z.2 := twoArmRegularBernoulliLikelihood_nonneg z.1 z.2 have hwzero : smoothPrior 0 (a / 2) z.1 = 0 → smoothPriorDeriv 0 (a / 2) z.1 = 0 := by exact derivative_eq_zero_of_nonnegative_of_eq_zero (smoothPrior_nonneg (by positivity)) (hasDerivAt_smoothPrior (by positivity) z.1) have hpzero : twoArmRegularBernoulliLikelihood z.1 z.2 = 0 → twoArmBernoulliLikelihoodDeriv z.1 z.2 = 0 := by exact derivative_eq_zero_of_nonnegative_of_eq_zero (fun θ => twoArmRegularBernoulliLikelihood_nonneg θ z.2) (twoArmRegularBernoulliLikelihood_hasDerivAt (by rw [abs_lt] constructor <;> nlinarith [hz.1, hz.2]) z.2) change errorScoreField (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv (twoArmPosteriorTarget a) T z - sensitivityField (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood (twoArmPosteriorTargetDeriv a) z = _ rw [errorScoreField_eq_numerator hw0 hp0 hwzero hpzero] simp only [derivativeBalanceField, sensitivityField, jointDensity] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmDerivativeBalanceField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesAssembly.lean:203
theorem twoArmFiniteVanTreesRegularity

the parameter lies in the stated interval, All finite-experiment regularity conditions for the smooth two-arm Bernoulli likelihood and its observation-dependent posterior target.

Formal statement
n :
a :
ha :
0 < a
T :
(Unit n → Bool) → ℝ
Proof (Lean source)
lemma twoArmFiniteVanTreesRegularity {n : ℕ} (a : ℝ) (ha : 0 < a) (T : (Unit n → Bool) → ℝ) : FiniteVanTreesModelRegularity (Unit n → Bool) (-1 / 2) (1 / 2) (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv (twoArmPosteriorTarget a) (twoArmPosteriorTargetDeriv a) T := by let hb := twoArmDerivativeBalanceField_integrable (n := n) a ha T let he := twoArmErrorScoreField_integrable (n := n) a ha T let hsen := twoArmSensitivityField_integrable (n := n) a ha let herr := twoArmErrorSqField_integrable (n := n) a ha T let hscore := twoArmScoreSqField_integrable (n := n) a ha let hp := twoArmPriorScoreField_integrable (n := n) a ha let hf := twoArmFisherScoreField_integrable (n := n) a ha let hc := twoArmScoreCrossField_integrable (n := n) a ha refine { hpnonneg := twoArmRegularBernoulliLikelihood_nonneg hpnorm := ?_ hpint := ?_ hdpint := ?_ hdiffUnder := ?_ hpAC := ?_ hgAC := ?_ hdp := twoArmRegularBernoulliLikelihood_hasDerivAt_ae hdg := twoArmPosteriorTarget_hasDerivAt_ae a hbalanceSm := hb.aestronglyMeasurable hbalanceInt := hb herrorScoreSm := he.aestronglyMeasurable herrorScoreInt := he hsensitivitySm := hsen.aestronglyMeasurable hsensitivityInt := hsen herrorSqSm := herr.aestronglyMeasurable herrorSqInt := herr hscoreSqSm := hscore.aestronglyMeasurable hscoreSqInt := hscore hpriorJointSqSm := hp.aestronglyMeasurable hpriorJointSqInt := hp hfisherSqSm := hf.aestronglyMeasurable hfisherSqInt := hf hcrossSm := hc.aestronglyMeasurable hcrossInt := hc } · intro θ hθ apply twoArmRegularBernoulliLikelihood_integral_eq_one rw [abs_le] constructor <;> nlinarith [hθ.1, hθ.2] · intro θ _ exact twoArmRegularBernoulliLikelihood_integrable_count θ · intro θ _ exact twoArmBernoulliLikelihoodDeriv_integrable_count θ · intro θ hθ apply twoArmRegularBernoulliIntegral_hasDerivAt rw [abs_lt] constructor <;> nlinarith [hθ.1, hθ.2] · filter_upwards with s exact twoArmRegularBernoulliLikelihood_absolutelyContinuous s · filter_upwards with s exact twoArmPosteriorTarget_absolutelyContinuous a s
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmFiniteVanTreesRegularity · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesAssembly.lean:249
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.Helpers.TwoArmVanTreesModel 27 declarations Regularized likelihood identities for the smooth two-arm van Trees model.

Regularized likelihood identities for the smooth two-arm van Trees model.

The clamp only controls the likelihood outside the ambient parameter interval; inside (-1,1) the model and its derivative are exactly the Bernoulli product likelihood used by the paper.

def twoArmRegularBernoulliLikelihood

The Bernoulli product likelihood with its scalar parameter clamped to [-1,1].

Definition (Lean source)
n :
θ :
s :
Unit n → Bool
twoArmRegularBernoulliLikelihood θ s :
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:19
theorem twoArmRegularBernoulliLikelihood_eq

the parameter lies in the stated interior interval, In the regular Bernoulli region the clamped likelihood is the ordinary product likelihood.

Formal statement
n :
θ :
:
|θ| ≤ 1
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_eq {n : ℕ} {θ : ℝ} (hθ : |θ| ≤ 1) (s : Unit n → Bool) : twoArmRegularBernoulliLikelihood θ s = twoArmBernoulliLikelihood θ s := by rw [twoArmRegularBernoulliLikelihood, twoArmClampedParameter_eq (by simpa using hθ)]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:25
theorem twoArmRegularBernoulliLikelihood_nonneg

The regularized product likelihood is nonnegative for every real parameter.

Formal statement
n :
θ :
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_nonneg {n : ℕ} (θ : ℝ) (s : Unit n → Bool) : 0 ≤ twoArmRegularBernoulliLikelihood θ s := by rw [twoArmRegularBernoulliLikelihood] exact twoArmBernoulliLikelihood_nonneg (by simpa using twoArmClampedParameter_abs_le (a := (2 : ℝ)) (θ := θ) (by norm_num)) s
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:33
theorem twoArmRegularBernoulliLikelihood_sum

the parameter lies in the stated interior interval, In the regular region the finite likelihood masses sum to one.

Formal statement
n :
θ :
:
|θ| ≤ 1
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_sum {n : ℕ} {θ : ℝ} (hθ : |θ| ≤ 1) : ∑ s : Unit n → Bool, twoArmRegularBernoulliLikelihood θ s = 1 := by simp_rw [twoArmRegularBernoulliLikelihood_eq hθ] exact twoArmBernoulliLikelihood_sum
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:42
theorem twoArmRegularBernoulliLikelihood_integral_eq_one

the parameter lies in the stated interior interval, In the regular region the likelihood has unit mass under counting measure.

Formal statement
n :
θ :
:
|θ| ≤ 1
∫ s : Unit n → Bool, twoArmRegularBernoulliLikelihood θ s ∂Measure.count = 1
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_integral_eq_one {n : ℕ} {θ : ℝ} (hθ : |θ| ≤ 1) : ∫ s : Unit n → Bool, twoArmRegularBernoulliLikelihood θ s ∂Measure.count = 1 := by exact finite_likelihood_normalization (twoArmRegularBernoulliLikelihood_sum hθ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_integral_eq_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:49
theorem twoArmRegularBernoulliLikelihood_integrable_count

Every section of the finite regularized likelihood is counting-measure integrable.

Formal statement
n :
θ :
Integrable (twoArmRegularBernoulliLikelihood (n := n) θ) Measure.count
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_integrable_count {n : ℕ} (θ : ℝ) : Integrable (twoArmRegularBernoulliLikelihood (n := n) θ) Measure.count := by rw [integrable_count_iff] apply summable_of_hasFiniteSupport exact Set.toFinite _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_integrable_count · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:56
theorem twoArmBernoulliLikelihoodDeriv_integrable_count

Every section of the displayed finite likelihood derivative is counting-measure integrable.

Formal statement
n :
θ :
Integrable (twoArmBernoulliLikelihoodDeriv (n := n) θ) Measure.count
Proof (Lean source)
lemma twoArmBernoulliLikelihoodDeriv_integrable_count {n : ℕ} (θ : ℝ) : Integrable (twoArmBernoulliLikelihoodDeriv (n := n) θ) Measure.count := by rw [integrable_count_iff] apply summable_of_hasFiniteSupport exact Set.toFinite _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmBernoulliLikelihoodDeriv_integrable_count · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:64
theorem twoArmRegularBernoulliLikelihood_hasDerivAt

the parameter lies in the stated interior interval, Inside (-1,1), the displayed product-rule field differentiates the regularized likelihood.

Formal statement
n :
θ :
:
|θ| < 1
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_hasDerivAt {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) (s : Unit n → Bool) : HasDerivAt (fun t => twoArmRegularBernoulliLikelihood t s) (twoArmBernoulliLikelihoodDeriv θ s) θ := by have heq : (fun t => twoArmRegularBernoulliLikelihood t s) =ᶠ[nhds θ] fun t => twoArmBernoulliLikelihood t s := by filter_upwards [Ioo_mem_nhds (by rw [abs_lt] at hθ; exact hθ.1) (by rw [abs_lt] at hθ; exact hθ.2)] with t ht exact twoArmRegularBernoulliLikelihood_eq ((abs_lt).2 ht).le s exact (twoArmBernoulliLikelihood_hasDerivAt θ s).congr_of_eventuallyEq heq
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_hasDerivAt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:72
theorem twoArmRegularBernoulliLikelihood_pos

the parameter lies in the stated interior interval, Every score vector has positive regularized likelihood in the open Bernoulli region.

Formal statement
n :
θ :
:
|θ| < 1
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_pos {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) (s : Unit n → Bool) : 0 < twoArmRegularBernoulliLikelihood θ s := by rw [twoArmRegularBernoulliLikelihood_eq hθ.le] exact twoArmBernoulliLikelihood_pos hθ s
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:85
theorem twoArmRegularBernoulliLikelihoodDeriv_sum_eq_zero

the parameter lies in the stated interior interval, The displayed derivative masses are centered in the open Bernoulli region.

Formal statement
n :
θ :
:
|θ| < 1
∑ s : Unit n → Bool, twoArmBernoulliLikelihoodDeriv θ s = 0
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihoodDeriv_sum_eq_zero {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) : ∑ s : Unit n → Bool, twoArmBernoulliLikelihoodDeriv θ s = 0 := by apply finite_derivative_centering · exact fun s => twoArmRegularBernoulliLikelihood_hasDerivAt hθ s · filter_upwards [Ioo_mem_nhds (by rw [abs_lt] at hθ; exact hθ.1) (by rw [abs_lt] at hθ; exact hθ.2)] with t ht exact twoArmRegularBernoulliLikelihood_sum ((abs_lt).2 ht).le
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihoodDeriv_sum_eq_zero · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:93
theorem twoArmRegularBernoulliLikelihoodDeriv_integral_eq_zero

the parameter lies in the stated interior interval, The counting integral of the displayed derivative vanishes in the regular region.

Formal statement
n :
θ :
:
|θ| < 1
∫ s : Unit n → Bool, twoArmBernoulliLikelihoodDeriv θ s ∂Measure.count = 0
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihoodDeriv_integral_eq_zero {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) : ∫ s : Unit n → Bool, twoArmBernoulliLikelihoodDeriv θ s ∂Measure.count = 0 := by rw [integral_count, twoArmRegularBernoulliLikelihoodDeriv_sum_eq_zero hθ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihoodDeriv_integral_eq_zero · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:104
theorem twoArmRegularBernoulliIntegral_hasDerivAt

the parameter lies in the stated interior interval, Differentiation passes through the finite counting integral in the regular region.

Formal statement
n :
θ :
:
|θ| < 1
HasDerivAt (fun t => ∫ s : Unit n → Bool, twoArmRegularBernoulliLikelihood t s ∂Measure.count) (∫ s : Unit n → Bool, twoArmBernoulliLikelihoodDeriv θ s ∂Measure.count) θ
Proof (Lean source)
lemma twoArmRegularBernoulliIntegral_hasDerivAt {n : ℕ} {θ : ℝ} (hθ : |θ| < 1) : HasDerivAt (fun t => ∫ s : Unit n → Bool, twoArmRegularBernoulliLikelihood t s ∂Measure.count) (∫ s : Unit n → Bool, twoArmBernoulliLikelihoodDeriv θ s ∂Measure.count) θ := by simp_rw [integral_count] exact hasDerivAt_finite_likelihood_sum (fun s => twoArmRegularBernoulliLikelihood_hasDerivAt hθ s)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliIntegral_hasDerivAt · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:111
theorem twoArmRegularBernoulliLikelihood_absolutelyContinuous

Every regularized Bernoulli likelihood section is absolutely continuous on the ambient parameter interval used by the smooth prior.

Formal statement
n :
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_absolutelyContinuous {n : ℕ} (s : Unit n → Bool) : AbsolutelyContinuousOnInterval (fun θ => twoArmRegularBernoulliLikelihood θ s) (-1 / 2) (1 / 2) := by apply ContDiffOn.absolutelyContinuousOnInterval apply (show ContDiff ℝ 1 (fun θ => twoArmBernoulliLikelihood θ s) by unfold twoArmBernoulliLikelihood induction (Finset.univ : Finset (Unit n)) using Finset.induction_on with | empty => simp; fun_prop | @insert i t hi iht => have hfactor : ContDiff ℝ 1 (fun θ : ℝ => if s i then (1 + θ) / 2 else (1 - θ) / 2) := by cases h : s i <;> simp [h] <;> fun_prop simpa only [Finset.prod_insert hi] using hfactor.mul iht).contDiffOn.congr intro θ hθ rw [uIcc_of_le (by norm_num : (-1 / 2 : ℝ) ≤ 1 / 2)] at hθ exact twoArmRegularBernoulliLikelihood_eq (by rw [abs_le] constructor <;> nlinarith [hθ.1, hθ.2]) s
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_absolutelyContinuous · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:122
theorem twoArmPosteriorTarget_absolutelyContinuous

The observation-dependent posterior target is absolutely continuous on the same ambient interval, which stays uniformly away from its poles.

Formal statement
n :
a :
s :
Unit n → Bool
AbsolutelyContinuousOnInterval (fun θ => twoArmPosteriorTarget a θ s) (-1 / 2) (1 / 2)
Proof (Lean source)
lemma twoArmPosteriorTarget_absolutelyContinuous {n : ℕ} (a : ℝ) (s : Unit n → Bool) : AbsolutelyContinuousOnInterval (fun θ => twoArmPosteriorTarget a θ s) (-1 / 2) (1 / 2) := by apply ContDiffOn.absolutelyContinuousOnInterval unfold twoArmPosteriorTarget twoArmPosteriorWeight apply ContDiffOn.add (by fun_prop) apply ContDiffOn.mul · apply ContDiffOn.div (by fun_prop) (by fun_prop) intro θ hθ rw [uIcc_of_le (by norm_num : (-1 / 2 : ℝ) ≤ 1 / 2)] at hθ rcases hθ with ⟨hlo, hhi⟩ nlinarith [sq_nonneg (θ - 1), sq_nonneg (θ + 1)] · fun_prop
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTarget_absolutelyContinuous · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:144
theorem finiteCountProduct_integrable_of_sections Lemma finiteCountProduct_integrable_of_sections in the paper ↗

every finite-coordinate section satisfies the stated regularity condition, A real field on an interval times a finite discrete carrier is integrable when each of its finitely many interval sections is integrable.

Formal statement
ell u :
f :
ℝ × X → ℝ
hf :
∀ x, Integrable (fun θ => f (θ, x)) (volume.restrict (Icc ell u))
Integrable f ((volume.restrict (Icc ell u)).prod Measure.count)
Proof (Lean source)
lemma finiteCountProduct_integrable_of_sections {X : Type*} [Fintype X] [MeasurableSpace X] [MeasurableSingletonClass X] {ell u : ℝ} {f : ℝ × X → ℝ} (hf : ∀ x, Integrable (fun θ => f (θ, x)) (volume.restrict (Icc ell u))) : Integrable f ((volume.restrict (Icc ell u)).prod Measure.count) := by classical have hmeas : AEStronglyMeasurable f ((volume.restrict (Icc ell u)).prod Measure.count) := by have hterm (x : X) : AEStronglyMeasurable (fun z : ℝ × X => (if z.2 = x then 1 else 0) * f (z.1, x)) ((volume.restrict (Icc ell u)).prod Measure.count) := by apply AEStronglyMeasurable.mul · exact (show Measurable (fun z : ℝ × X => if z.2 = x then (1 : ℝ) else 0) by apply Measurable.ite · exact (measurableSet_singleton x).preimage measurable_snd · exact measurable_const · exact measurable_const).aestronglyMeasurable · exact (hf x).aestronglyMeasurable.comp_fst have hsum := Finset.aestronglyMeasurable_sum (Finset.univ : Finset X) (fun x _hx => hterm x) have hsum' : AEStronglyMeasurable (fun z : ℝ × X => ∑ x, (if z.2 = x then 1 else 0) * f (z.1, x)) ((volume.restrict (Icc ell u)).prod Measure.count) := by apply hsum.congr filter_upwards with z exact Fintype.sum_apply z _ convert hsum' using 1 funext z simp rw [integrable_prod_iff' hmeas] constructor · filter_upwards with x exact hf x · rw [integrable_count_iff] apply summable_of_hasFiniteSupport exact Set.toFinite _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteCountProduct_integrable_of_sections · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:161
theorem finiteCountProduct_integrable_of_continuousSections Lemma finiteCountProduct_integrable_of_continuousSections in the paper ↗

every finite-coordinate section satisfies the stated regularity condition, Sectionwise continuity on a compact interval implies integrability over that interval times any finite discrete carrier.

Formal statement
ell u :
f :
ℝ × X → ℝ
hf :
∀ x, ContinuousOn (fun θ => f (θ, x)) (Icc ell u)
Integrable f ((volume.restrict (Icc ell u)).prod Measure.count)
Proof (Lean source)
lemma finiteCountProduct_integrable_of_continuousSections {X : Type*} [Fintype X] [MeasurableSpace X] [MeasurableSingletonClass X] {ell u : ℝ} {f : ℝ × X → ℝ} (hf : ∀ x, ContinuousOn (fun θ => f (θ, x)) (Icc ell u)) : Integrable f ((volume.restrict (Icc ell u)).prod Measure.count) := by apply finiteCountProduct_integrable_of_sections exact fun x => (hf x).integrableOn_Icc
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteCountProduct_integrable_of_continuousSections · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:202
theorem twoArmRegularBernoulliLikelihood_hasDerivAt_ae

The regularized product likelihood has the advertised derivative almost everywhere on the ambient parameter/counting product measure.

Formal statement
n :
∀ᵐ z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))), HasDerivAt (fun t => twoArmRegularBernoulliLikelihood t z.2) (twoArmBernoulliLikelihoodDeriv z.1 z.2) z.1
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_hasDerivAt_ae {n : ℕ} : ∀ᵐ z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))), HasDerivAt (fun t => twoArmRegularBernoulliLikelihood t z.2) (twoArmBernoulliLikelihoodDeriv z.1 z.2) z.1 := by have hmemθ : ∀ᵐ (θ : ℝ) ∂Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure (-1 / 2) (1 / 2), θ ∈ Icc (-1 / 2) (1 / 2) := by unfold parameterMeasure exact ae_restrict_mem measurableSet_Icc have hmem := (Measure.quasiMeasurePreserving_fst (μ := parameterMeasure (-1 / 2) (1 / 2)) (ν := (Measure.count : Measure (Unit n → Bool)))).tendsto_ae.eventually hmemθ filter_upwards [hmem] with z hz apply twoArmRegularBernoulliLikelihood_hasDerivAt rw [abs_lt] constructor <;> nlinarith [hz.1, hz.2]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_hasDerivAt_ae · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:212
theorem twoArmPosteriorTarget_hasDerivAt_ae

The supplied posterior-target derivative is valid almost everywhere on the ambient parameter/counting product measure.

Formal statement
n :
a :
∀ᵐ z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))), HasDerivAt (fun t => twoArmPosteriorTarget a t z.2) (twoArmPosteriorTargetDeriv a z.1 z.2) z.1
Proof (Lean source)
lemma twoArmPosteriorTarget_hasDerivAt_ae {n : ℕ} (a : ℝ) : ∀ᵐ z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))), HasDerivAt (fun t => twoArmPosteriorTarget a t z.2) (twoArmPosteriorTargetDeriv a z.1 z.2) z.1 := by have hmemθ : ∀ᵐ (θ : ℝ) ∂Causalean.Stat.Limit.ObservationDependentVanTrees.parameterMeasure (-1 / 2) (1 / 2), θ ∈ Icc (-1 / 2) (1 / 2) := by unfold parameterMeasure exact ae_restrict_mem measurableSet_Icc have hmem := (Measure.quasiMeasurePreserving_fst (μ := parameterMeasure (-1 / 2) (1 / 2)) (ν := (Measure.count : Measure (Unit n → Bool)))).tendsto_ae.eventually hmemθ filter_upwards [hmem] with z hz unfold twoArmPosteriorTargetDeriv apply twoArmPosteriorTarget_hasDerivAt nlinarith [hz.1, hz.2]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTarget_hasDerivAt_ae · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:232
theorem twoArmRegularBernoulliLikelihood_continuousOn

Each regularized Bernoulli likelihood section is continuous on the ambient parameter interval.

Formal statement
n :
s :
Unit n → Bool
ContinuousOn (fun θ => twoArmRegularBernoulliLikelihood θ s) (Icc (-1 / 2) (1 / 2))
Proof (Lean source)
lemma twoArmRegularBernoulliLikelihood_continuousOn {n : ℕ} (s : Unit n → Bool) : ContinuousOn (fun θ => twoArmRegularBernoulliLikelihood θ s) (Icc (-1 / 2) (1 / 2)) := by have h := (twoArmRegularBernoulliLikelihood_absolutelyContinuous s).continuousOn rw [uIcc_of_le (by norm_num : (-1 / 2 : ℝ) ≤ 1 / 2)] at h exact h
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularBernoulliLikelihood_continuousOn · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:252
theorem twoArmPosteriorTargetDeriv_continuousOn

The displayed posterior-target derivative is continuous on the ambient interval, which stays away from both poles.

Formal statement
n :
a :
s :
Unit n → Bool
ContinuousOn (fun θ => twoArmPosteriorTargetDeriv a θ s) (Icc (-1 / 2) (1 / 2))
Proof (Lean source)
lemma twoArmPosteriorTargetDeriv_continuousOn {n : ℕ} (a : ℝ) (s : Unit n → Bool) : ContinuousOn (fun θ => twoArmPosteriorTargetDeriv a θ s) (Icc (-1 / 2) (1 / 2)) := by unfold twoArmPosteriorTargetDeriv twoArmPosteriorWeight twoArmScoreAverage apply ContinuousOn.add · apply ContinuousOn.sub continuousOn_const apply ContinuousOn.div (by fun_prop) (by fun_prop) intro θ hθ rcases hθ with ⟨hlo, hhi⟩ nlinarith [sq_nonneg (θ - 1), sq_nonneg (θ + 1)] · apply ContinuousOn.mul · apply ContinuousOn.div (by fun_prop) (by fun_prop) intro θ hθ rcases hθ with ⟨hlo, hhi⟩ nlinarith [sq_nonneg (θ - 1), sq_nonneg (θ + 1)] · fun_prop
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTargetDeriv_continuousOn · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:262
theorem twoArmSensitivityField_integrable

the parameter lies in the stated interval, The smooth-prior sensitivity field is integrable over the ambient parameter interval and finite score carrier.

Formal statement
n :
a :
ha :
0 < a
Proof (Lean source)
lemma twoArmSensitivityField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) : Integrable (sensitivityField (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood (twoArmPosteriorTargetDeriv a)) ((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))) := by apply finiteCountProduct_integrable_of_continuousSections intro s unfold sensitivityField jointDensity convert (twoArmPosteriorTargetDeriv_continuousOn a s).mul ((smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.continuousOn.mul (twoArmRegularBernoulliLikelihood_continuousOn s)) using 1 ext θ rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSensitivityField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:282
theorem twoArmErrorSqField_integrable

the parameter lies in the stated interval, Every finite estimator gives an integrable smooth-prior squared-error field for the observation-dependent posterior target.

Formal statement
n :
a :
ha :
0 < a
T :
(Unit n → Bool) → ℝ
Proof (Lean source)
lemma twoArmErrorSqField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) (T : (Unit n → Bool) → ℝ) : Integrable (errorSqField (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood (twoArmPosteriorTarget a) T) ((parameterMeasure (-1 / 2) (1 / 2)).prod (Measure.count : Measure (Unit n → Bool))) := by apply finiteCountProduct_integrable_of_continuousSections intro s have hg := (twoArmPosteriorTarget_absolutelyContinuous a s).continuousOn rw [uIcc_of_le (by norm_num : (-1 / 2 : ℝ) ≤ 1 / 2)] at hg have he : ContinuousOn (fun θ => (T s - twoArmPosteriorTarget a θ s) ^ 2) (Icc (-1 / 2) (1 / 2)) := by fun_prop unfold errorSqField jointDensity convert he.mul ((smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.continuousOn.mul (twoArmRegularBernoulliLikelihood_continuousOn s)) using 1 ext θ rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmErrorSqField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:299
theorem twoArmRegularLikelihoodScore_continuousOn

On the ambient parameter interval, every guarded likelihood-score section is continuous because every Bernoulli product mass is strictly positive.

Formal statement
n :
s :
Unit n → Bool
Proof (Lean source)
lemma twoArmRegularLikelihoodScore_continuousOn {n : ℕ} (s : Unit n → Bool) : ContinuousOn (fun θ => likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s) (Icc (-1 / 2) (1 / 2)) := by have hp : ContinuousOn (fun θ => twoArmRegularBernoulliLikelihood (n := n) θ s) (Icc (-1 / 2) (1 / 2)) := twoArmRegularBernoulliLikelihood_continuousOn s have hdp : ContinuousOn (fun θ => twoArmBernoulliLikelihoodDeriv (n := n) θ s) (Icc (-1 / 2) (1 / 2)) := by unfold twoArmBernoulliLikelihoodDeriv apply Continuous.continuousOn apply continuous_finsetSum univ intro i _hi apply Continuous.mul · apply continuous_finsetProd (Finset.univ.erase i) intro j _hj split <;> fun_prop · split <;> fun_prop refine (hdp.div hp ?_).congr ?_ · intro θ hθ hzero exact (twoArmRegularBernoulliLikelihood_pos (by rw [abs_lt] constructor <;> nlinarith [hθ.1, hθ.2]) s).ne' hzero · intro θ hθ unfold likelihoodScore change (if 0 < twoArmRegularBernoulliLikelihood θ s then twoArmBernoulliLikelihoodDeriv θ s / twoArmRegularBernoulliLikelihood θ s else 0) = _ rw [if_pos (twoArmRegularBernoulliLikelihood_pos (by rw [abs_lt] constructor <;> nlinarith [hθ.1, hθ.2]) s)] rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmRegularLikelihoodScore_continuousOn · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:321
theorem twoArmFisherScoreField_integrable

the parameter lies in the stated interval, The smooth-prior weighted likelihood-score square is integrable on the ambient parameter interval times the finite score carrier.

Formal statement
n :
a :
ha :
0 < a
Integrable (fun z : ℝ × (Unit n → Bool) => smoothPrior 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 * (likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z.1 z.2) ^ 2) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count)
Proof (Lean source)
lemma twoArmFisherScoreField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) : Integrable (fun z : ℝ × (Unit n → Bool) => smoothPrior 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 * (likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z.1 z.2) ^ 2) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count) := by apply finiteCountProduct_integrable_of_continuousSections intro s apply ContinuousOn.mul · exact (smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.continuousOn.mul (twoArmRegularBernoulliLikelihood_continuousOn s) · exact (twoArmRegularLikelihoodScore_continuousOn s).pow 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmFisherScoreField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:359
theorem twoArmPriorScoreField_integrable_section

the parameter lies in the stated interval, Each finite score section of the lifted smooth-prior score square is integrable on the ambient parameter interval.

Formal statement
n :
a :
ha :
0 < a
s :
Unit n → Bool
Integrable (fun θ : ℝ => smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ) ^ 2) (parameterMeasure (-1 / 2) (1 / 2))
Proof (Lean source)
lemma twoArmPriorScoreField_integrable_section {n : ℕ} (a : ℝ) (ha : 0 < a) (s : Unit n → Bool) : Integrable (fun θ : ℝ => smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ) ^ 2) (parameterMeasure (-1 / 2) (1 / 2)) := by have hbase : Integrable (fun θ => smoothPrior 0 (a / 2) θ * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ) ^ 2) (parameterMeasure (-1 / 2) (1 / 2)) := smoothPrior_scoreSq_integrable (by positivity : 0 < a / 2) have hpSm : AEStronglyMeasurable (fun θ => twoArmRegularBernoulliLikelihood θ s) (parameterMeasure (-1 / 2) (1 / 2)) := by exact (twoArmRegularBernoulliLikelihood_continuousOn s).aestronglyMeasurable measurableSet_Icc have hpBound : ∀ᵐ θ ∂parameterMeasure (-1 / 2) (1 / 2), ‖twoArmRegularBernoulliLikelihood θ s‖ ≤ 1 := by have hmem : ∀ᵐ θ ∂parameterMeasure (-1 / 2) (1 / 2), θ ∈ Icc (-1 / 2) (1 / 2) := by unfold parameterMeasure exact ae_restrict_mem measurableSet_Icc filter_upwards [hmem] with θ hθ rw [Real.norm_eq_abs, abs_of_nonneg (twoArmRegularBernoulliLikelihood_nonneg θ s)] have hsum := twoArmRegularBernoulliLikelihood_sum (n := n) (θ := θ) (by rw [abs_le] constructor <;> nlinarith [hθ.1, hθ.2]) rw [← hsum] exact Finset.single_le_sum (fun x _ => twoArmRegularBernoulliLikelihood_nonneg θ x) (Finset.mem_univ s) change Integrable (fun θ => smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ ^ 2) (parameterMeasure (-1 / 2) (1 / 2)) simpa only [mul_assoc, mul_left_comm, mul_comm] using hbase.bdd_mul hpSm hpBound
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPriorScoreField_integrable_section · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:375
theorem twoArmPriorScoreField_integrable

the parameter lies in the stated interval, The smooth-prior weighted prior-score square is integrable after lifting to the finite Bernoulli score carrier.

Formal statement
n :
a :
ha :
0 < a
Integrable (fun z : ℝ × (Unit n → Bool) => smoothPrior 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) z.1) ^ 2) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count)
Proof (Lean source)
lemma twoArmPriorScoreField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) : Integrable (fun z : ℝ × (Unit n → Bool) => smoothPrior 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) z.1) ^ 2) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count) := by apply finiteCountProduct_integrable_of_sections exact twoArmPriorScoreField_integrable_section a ha
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPriorScoreField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:418
theorem twoArmScoreCrossField_integrable

the parameter lies in the stated interval, The smooth-prior weighted cross product of the prior and likelihood scores is integrable on the parameter--score product space.

Formal statement
n :
a :
ha :
0 < a
Integrable (fun z : ℝ × (Unit n → Bool) => smoothPrior 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) z.1 * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z.1 z.2)) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count)
Proof (Lean source)
lemma twoArmScoreCrossField_integrable {n : ℕ} (a : ℝ) (ha : 0 < a) : Integrable (fun z : ℝ × (Unit n → Bool) => smoothPrior 0 (a / 2) z.1 * twoArmRegularBernoulliLikelihood z.1 z.2 * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) z.1 * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv z.1 z.2)) ((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count) := by apply finiteCountProduct_integrable_of_sections intro s have hp := twoArmPriorScoreField_integrable_section (n := n) a ha s have hf : Integrable (fun θ => smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s ^ 2) (parameterMeasure (-1 / 2) (1 / 2)) := by apply (ContinuousOn.mul ((smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.continuousOn.mul (twoArmRegularBernoulliLikelihood_continuousOn s)) ((twoArmRegularLikelihoodScore_continuousOn s).pow 2)).integrableOn_Icc apply (hp.add hf).mono' · have hw : Measurable (smoothPrior 0 (a / 2)) := (smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.measurable have hdw : Measurable (smoothPriorDeriv 0 (a / 2)) := by unfold smoothPriorDeriv apply Measurable.ite · exact measurableSet_lt (by fun_prop) measurable_const · fun_prop · fun_prop have hps : Measurable (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2))) := by unfold priorScore apply Measurable.ite · exact measurableSet_lt measurable_const hw · exact hdw.div hw · exact measurable_const have hpSm : AEStronglyMeasurable (fun θ => twoArmRegularBernoulliLikelihood θ s) (parameterMeasure (-1 / 2) (1 / 2)) := (twoArmRegularBernoulliLikelihood_continuousOn s).aestronglyMeasurable measurableSet_Icc have hlikeSm : AEStronglyMeasurable (fun θ => likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s) (parameterMeasure (-1 / 2) (1 / 2)) := (twoArmRegularLikelihoodScore_continuousOn s).aestronglyMeasurable measurableSet_Icc convert (((hw.aestronglyMeasurable.mul hpSm).mul hps.aestronglyMeasurable).mul hlikeSm) using 1 ext θ simp only [Pi.mul_apply] ring · filter_upwards with θ change ‖smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s)‖ ≤ _ have hw : 0 ≤ smoothPrior 0 (a / 2) θ := smoothPrior_nonneg (by positivity) θ have hp0 : 0 ≤ twoArmRegularBernoulliLikelihood θ s := twoArmRegularBernoulliLikelihood_nonneg θ s rw [Real.norm_eq_abs] change abs (smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s)) ≤ smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ ^ 2 + smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s ^ 2 calc abs (smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s)) ≤ smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ ^ 2 + likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s ^ 2) := by rw [abs_mul, abs_of_nonneg (mul_nonneg hw hp0)] exact mul_le_mul_of_nonneg_left (by rw [abs_mul] nlinarith [sq_nonneg (|priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ| - |likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s|), sq_abs (priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ), sq_abs (likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s)]) (mul_nonneg hw hp0) _ = smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * priorScore (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) θ ^ 2 + smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s * likelihoodScore twoArmRegularBernoulliLikelihood twoArmBernoulliLikelihoodDeriv θ s ^ 2 := by ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmScoreCrossField_integrable · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/Helpers/TwoArmVanTreesModel.lean:430
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_attainment_and_k3_certified_converse 6 declarations Capstone: exact support-two saddle, universal order attainment, and certificates.

Capstone: exact support-two saddle, universal order attainment, and certificates.

def schedulePriorOfCountPrior

A prior on response-type counts induces a prior on labeled schedules by spreading each count-vector mass uniformly over its schedule orbit.

Definition (Lean source)
K :
shared
n :
shared
nu :
schedulePriorOfCountPrior nu :
FiniteDesign (Schedule K n)
clause 1
p z := nu.p (scheduleCounts z) / responseCountOrbitCard (scheduleCounts z)
clause 2
p_nonneg z := div_nonneg (nu.p_nonneg _) (Nat.cast_nonneg _)
clause 3
p_sum := by classical rw [← Finset.sum_fiberwise univ scheduleCounts (fun z => nu.p (scheduleCounts z) / responseCountOrbitCard (scheduleCounts z))] calc ∑ m : CountVec K n, ∑ z : Schedule K n with scheduleCounts z
= m, nu.p (scheduleCounts z) / responseCountOrbitCard (scheduleCounts z) = ∑ m : CountVec K n, nu.p m := by apply Finset.sum_congr rfl intro m _ rw [Finset.sum_congr rfl (fun z hz => by simp only [mem_filter] at hz rw [hz.2])] rw [Finset.sum_const, nsmul_eq_mul] letI := ofFinite {z : Schedule K n // scheduleCounts z = m} rw [← Fintype.card_subtype, ← Nat.card_eq_fintype_card, responseCountFiber_card] have hm : (responseCountOrbitCard m : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (responseCountOrbitCard_pos m)) exact mul_div_cancel₀ _ hm _ = 1 := nu.p_sum
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfCountPrior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_attainment_and_k3_certified_converse.lean:13
theorem schedulePriorOfCountPrior_E_count

the schedule prior when count prior e count property holds.

Formal statement
K :
shared
n :
shared
nu :
f :
CountVec K n → ℝ
(schedulePriorOfCountPrior nu).E (fun z => f (scheduleCounts z)) = nu.E f
Proof (Lean source)
lemma schedulePriorOfCountPrior_E_count (nu : FiniteDesign (CountVec K n)) (f : CountVec K n → ℝ) : (schedulePriorOfCountPrior nu).E (fun z => f (scheduleCounts z)) = nu.E f := by classical unfold E rw [← Finset.sum_fiberwise univ scheduleCounts (fun z => (schedulePriorOfCountPrior nu).p z * f (scheduleCounts z))] apply Finset.sum_congr rfl intro m _ calc _ = ∑ _z : Schedule K n with scheduleCounts _z = m, (nu.p m / responseCountOrbitCard m) * f m := by apply Finset.sum_congr rfl intro z hz simp only [mem_filter] at hz simp [schedulePriorOfCountPrior, hz.2] _ = _ := by rw [Finset.sum_const, nsmul_eq_mul] letI := ofFinite {z : Schedule K n // scheduleCounts z = m} rw [← Fintype.card_subtype, ← Nat.card_eq_fintype_card, responseCountFiber_card] have hm : (responseCountOrbitCard m : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (responseCountOrbitCard_pos m)) field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfCountPrior_E_count · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_attainment_and_k3_certified_converse.lean:44
theorem schedulePriorOfCountPrior_E_permute

the schedule prior when count prior e permute property holds.

Formal statement
K :
shared
n :
shared
nu :
sigma :
f :
Schedule K n → ℝ
Proof (Lean source)
lemma schedulePriorOfCountPrior_E_permute (nu : FiniteDesign (CountVec K n)) (sigma : Perm (Unit n)) (f : Schedule K n → ℝ) : (schedulePriorOfCountPrior nu).E (fun z => f (permuteSchedule sigma z)) = (schedulePriorOfCountPrior nu).E f := by classical unfold Causalean.Experimentation.DesignBased.FiniteDesign.E let e : Perm (Schedule K n) := { toFun := permuteSchedule sigma invFun := permuteSchedule sigma.symm left_inv := by intro z; funext i; simp [permuteSchedule] right_inv := by intro z; funext i; simp [permuteSchedule] } have hsum := Equiv.sum_comp e (fun z => (schedulePriorOfCountPrior nu).p z * f z) dsimp [e] at hsum simpa only [e, schedulePriorOfCountPrior, scheduleCounts_permute_eq] using hsum
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfCountPrior_E_permute · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_attainment_and_k3_certified_converse.lean:72
theorem orbitSaddle_labeledBayesLower

the stated side condition holds, the orbit saddle labeled bayes lower property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
shared
nu :
hlower :
∀ q, orbitGameValue K n c ≤ nu.E (fun m => orbitRisk c q m)
p :
Procedure K n c
orbitGameValue K n c ≤ (schedulePriorOfCountPrior nu).E (fun z => labeledRisk c p z)
Proof (Lean source)
lemma orbitSaddle_labeledBayesLower (nu : FiniteDesign (CountVec K n)) (hlower : ∀ q, orbitGameValue K n c ≤ nu.E (fun m => orbitRisk c q m)) (p : Procedure K n c) : orbitGameValue K n c ≤ (schedulePriorOfCountPrior nu).E (fun z => labeledRisk c p z) := by classical letI : Fintype (Perm (Unit n)) := ofFinite _ obtain ⟨pbar, q, _hinv, _havg, _hpbar, hdom⟩ := lossless_symmetrization c p calc orbitGameValue K n c ≤ nu.E (fun m => orbitRisk c q m) := hlower q _ = (schedulePriorOfCountPrior nu).E (fun z => orbitRisk c q (scheduleCounts z)) := by symm exact schedulePriorOfCountPrior_E_count nu _ _ ≤ (schedulePriorOfCountPrior nu).E (fun z => (card (Perm (Unit n)) : ℝ)⁻¹ * ∑ sigma : Perm (Unit n), labeledRisk c p (permuteSchedule sigma z)) := by unfold E apply Finset.sum_le_sum intro z _ exact mul_le_mul_of_nonneg_left (hdom z) ((schedulePriorOfCountPrior nu).p_nonneg z) _ = (schedulePriorOfCountPrior nu).E (fun z => labeledRisk c p z) := by rw [(schedulePriorOfCountPrior nu).E_const_mul] rw [(schedulePriorOfCountPrior nu).E_sum] rw [Finset.sum_congr rfl (fun sigma _ => schedulePriorOfCountPrior_E_permute nu sigma (fun z => labeledRisk c p z))] rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] have hcard : (card (Perm (Unit n)) : ℝ) ≠ 0 := by positivity field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.orbitSaddle_labeledBayesLower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_attainment_and_k3_certified_converse.lean:91

The attainment and three-arm certified converse scope property holds.

Definition (Lean source)
attainmentAndK3CertifiedConverseScope :
["the internal finite two-arm saddle does not specify the published scalar posterior mean or least-favorable prior", "the exact-rational calculations through n=5 are a finite three-arm showcase and do not infer a cross-n limit", "for support of size at least three, convergence of the normalized improvement is not determined", "for support of size at least three, the sharp second-order constant is not determined", "sharp second-order optimality of qStar is not determined", "convergence of finite-program optimizers or priors is not determined", "no analytic limiting feedback rule is determined", "no limiting Hamilton
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.attainmentAndK3CertifiedConverseScope · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_attainment_and_k3_certified_converse.lean:126
theorem attainment_and_k3_certified_converse Theorem 12 in the paper ↗

there are at least two treatment arms, the orbit game attains its saddle value, the universal second-order rate is achieved, and the certified three-arm converse establishes the stated strict separation.

Formal statement
K :
c :
Contrast ℝ K
n :
0 < n
(Sc c).card = 2
rhoN K n c = C0 c * rho2 n
∃ (q2 : OrbitProcedure 2 n twoArmContrast) (nu2 : FiniteDesign (CountVec 2 n)) (p2 : Procedure 2 n twoArmContrast) (prior2 : FiniteDesign (Schedule 2 n)) (pK : Procedure K n c) (priorK : FiniteDesign (Schedule K n)),
q2' :
orbitGameValue 2 n twoArmContrast ≤ nu2.E (fun m => orbitRisk twoArmContrast q2' m)
z :
priorK = prior2.map (embeddedSignSchedule c)
p2' :
rho2 n ≤ prior2.E (fun z => labeledRisk twoArmContrast p2' z)
z :
labeledRisk c pK z ≤ rhoN K n c
pK' :
rhoN K n c ≤ priorK.E (fun z => labeledRisk c pK' z)
C0 c * kappaC c ≤ liminf (fun n => secondOrderScale n * dN K c n) atTop
liminf (fun n => secondOrderScale n * dN K c n) atTop
limsup (fun n => secondOrderScale n * dN K c n) atTop
limsup (fun n => secondOrderScale n * dN K c n) atTop ≤ 43 * C0 c
∃ N : ℕ,
∀ n ≥ N,
worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c)
C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)))
q :
n M :
0 < n
0 < M
∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n M c q B U Rminus Rplus
∃ (cq : ℕ → RatContrast K) (B U Rminus Rplus : ℕ → ℝ),
a :
Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a))
Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0)
n :
0 < n
RealContrastTransferCertificate K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n)
Tendsto (fun n => secondOrderScale n * (Rplus n - Rminus n)) atTop (nhds 0)
q :
n :
0 < n
∃ B U Rminus Rplus : ℝ,
RealContrastTransferCertificate K n n c q B U Rminus Rplus
U - B ≤ C0 c / (4 * (n : ℝ) ^ 2)
n M :
0 < n
0 < M
∃ (pi : GridPi 3 n) (w : GridWeight 3 n M) (u : ℚ) (nu : CountVec 3 n → ℚ) (delta : ∀ r : AllocVec 3 n, ObsVec r → ℝ),
Proof (Lean source)
theorem attainment_and_k3_certified_converse (K : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) : let _deliveryScope : List String := attainmentAndK3CertifiedConverseScope (∀ n, 0 < n → (Sc c).card = 2 → rhoN K n c = C0 c * rho2 n ∧ ∃ (q2 : OrbitProcedure 2 n twoArmContrast) (nu2 : FiniteDesign (CountVec 2 n)) (p2 : Procedure 2 n twoArmContrast) (prior2 : FiniteDesign (Schedule 2 n)) (pK : Procedure K n c) (priorK : FiniteDesign (Schedule K n)), (∀ m, orbitRisk twoArmContrast q2 m ≤ orbitGameValue 2 n twoArmContrast) ∧ (∀ q2', orbitGameValue 2 n twoArmContrast ≤ nu2.E (fun m => orbitRisk twoArmContrast q2' m)) ∧ p2 = (orbitToInvariantProcedure twoArmContrast q2).1 ∧ (∀ z, prior2.p z = nu2.p (scheduleCounts z) / responseCountOrbitCard (scheduleCounts z)) ∧ pK = liftTwoArmProcedure c p2 ∧ priorK = prior2.map (embeddedSignSchedule c) ∧ (∀ z, labeledRisk twoArmContrast p2 z ≤ rho2 n) ∧ (∀ p2', rho2 n ≤ prior2.E (fun z => labeledRisk twoArmContrast p2' z)) ∧ (∀ z, labeledRisk c pK z ≤ rhoN K n c) ∧ (∀ pK', rhoN K n c ≤ priorK.E (fun z => labeledRisk c pK' z))) ∧ C0 c * kappaC c ≤ liminf (fun n => secondOrderScale n * dN K c n) atTopliminf (fun n => secondOrderScale n * dN K c n) atToplimsup (fun n => secondOrderScale n * dN K c n) atToplimsup (fun n => secondOrderScale n * dN K c n) atTop ≤ 43 * C0 c ∧ (∃ N : ℕ, ∀ n ≥ N, worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c) ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)))) ∧ (∀ (q : RatContrast K) (n M : ℕ), 0 < n → 0 < M → ∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n M c q B U Rminus Rplus) ∧ (∃ (cq : ℕ → RatContrast K) (B U Rminus Rplus : ℕ → ℝ), (∀ a, Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a))) ∧ Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0) ∧ (∀ n, 0 < n → RealContrastTransferCertificate K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n)) ∧ Tendsto (fun n => secondOrderScale n * (Rplus n - Rminus n)) atTop (nhds 0)) ∧ (∀ q : RatContrast K, ratContrastToReal q = c → ∀ n, 0 < n → ∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n n c q B U Rminus Rplus ∧ U - B ≤ C0 c / (4 * (n : ℝ) ^ 2)) ∧ (∀ n M, 0 < n → 0 < M → ∃ (pi : GridPi 3 n) (w : GridWeight 3 n M) (u : ℚ) (nu : CountVec 3 n → ℚ) (delta : ∀ r : AllocVec 3 n, ObsVec r → ℝ), ExactGridPrimalDualCertificate cDaggerQ pi w u nu ∧ IsGridBarycenter cDaggerQ pi w delta ∧ lowerCertificate cDaggerQ nu ≤ rhoNDagger n ∧ rhoNDagger n ≤ upperCertificate cDaggerQ pi delta ∧ upperCertificate cDaggerQ pi delta ≤ lowerCertificate cDaggerQ nu + 1 / (4 * (M : ℝ) ^ 2)) := by have huniv := universal_second_order_rate K c hK rcases huniv with ⟨_hlambdaPos, _hlambdaLe, _hkappaPos, _henvelope, ⟨N, _htail, hshrink⟩, hliminfLower, hliminfLe, hlimsupUpper, _hregular⟩ have htransfer := real_contrast_grid_certificate_transfer K c hK rcases htransfer with ⟨htransferFinite, htransferAsymptotic, htransferRational⟩ refine ⟨?_, hliminfLower, hliminfLe, hlimsupUpper, ⟨N, hshrink⟩, htransferFinite, htransferAsymptotic, ?_, ?_⟩ · intro n hn hsupport have hembedded := embedded_two_arm_converse K n c hK hn have hvalue : rhoN K n c = C0 c * rho2 n := (hembedded.2.2.2 hsupport).1 refine ⟨hvalue, ?_⟩ have hK2 : AdmissibleArmCount 2 := by norm_num [AdmissibleArmCount] obtain ⟨_hsymm, _hcorr, _htau, horbitValue, q2, nu2, hupper, hlower⟩ := exact_response_type_game 2 n twoArmContrast hK2 let p2 : Procedure 2 n twoArmContrast := (orbitToInvariantProcedure twoArmContrast q2).1 let prior2 := schedulePriorOfCountPrior nu2 let pK : Procedure K n c := liftTwoArmProcedure c p2 let priorK := prior2.map (embeddedSignSchedule c) have horbitRho : orbitGameValue 2 n twoArmContrast = rho2 n := by simpa [rho2] using horbitValue.symm have hp2upper (z : Schedule 2 n) : labeledRisk twoArmContrast p2 z ≤ rho2 n := by rw [show labeledRisk twoArmContrast p2 z = orbitRisk twoArmContrast q2 (scheduleCounts z) by exact labeledRisk_eq_orbitRisk_of_realizes twoArmContrast p2 q2 ((orbitToInvariantProcedure_realizes twoArmContrast q2).1) ((orbitToInvariantProcedure_realizes twoArmContrast q2).2) z] rw [← horbitRho] exact hupper _ have hprior2 (p : Procedure 2 n twoArmContrast) : rho2 n ≤ prior2.E (fun z => labeledRisk twoArmContrast p z) := by rw [← horbitRho] exact orbitSaddle_labeledBayesLower nu2 hlower p have hpKupper (z : Schedule K n) : labeledRisk c pK z ≤ rhoN K n c := by rw [show labeledRisk c pK z = signGroupScale c ^ 2 * labeledRisk twoArmContrast p2 (activeSchedule c z) by exact liftTwoArmProcedure_statewiseRisk c hsupport p2 z] rw [hvalue, ← signGroupScale_sq c] exact mul_le_mul_of_nonneg_left (hp2upper _) (sq_nonneg _) have hpriorK (p : Procedure K n c) : rhoN K n c ≤ priorK.E (fun z => labeledRisk c p z) := by have hpoint (z : Schedule 2 n) : labeledRisk twoArmContrast (inducedTwoArmProcedure c p) z ≤ (signGroupScale c)⁻¹ ^ 2 * labeledRisk c p (embeddedSignSchedule c z) := inducedTwoArmProcedure_statewiseRisk c p z have hE : prior2.E (fun z => labeledRisk twoArmContrast (inducedTwoArmProcedure c p) z) ≤ (signGroupScale c)⁻¹ ^ 2 * priorK.E (fun z => labeledRisk c p z) := by calc _ ≤ prior2.E (fun z => (signGroupScale c)⁻¹ ^ 2 * labeledRisk c p (embeddedSignSchedule c z)) := by unfold E apply Finset.sum_le_sum intro z _ exact mul_le_mul_of_nonneg_left (hpoint z) (prior2.p_nonneg z) _ = _ := by rw [prior2.E_const_mul] rw [show priorK.E (fun z => labeledRisk c p z) = prior2.E (fun z => labeledRisk c p (embeddedSignSchedule c z)) by simp [priorK, prior2, E_map]] have h := (hprior2 (inducedTwoArmProcedure c p)).trans hE rw [hvalue, ← signGroupScale_sq c] calc signGroupScale c ^ 2 * rho2 n ≤ signGroupScale c ^ 2 * ((signGroupScale c)⁻¹ ^ 2 * priorK.E (fun z => labeledRisk c p z)) := mul_le_mul_of_nonneg_left h (sq_nonneg _) _ = priorK.E (fun z => labeledRisk c p z) := by field_simp [(signGroupScale_pos c).ne'] exact ⟨q2, nu2, p2, prior2, pK, priorK, hupper, hlower, rfl, fun _ => rfl, rfl, rfl, hp2upper, hprior2, hpKupper, hpriorK⟩ · intro q hq n hn simpa [hq] using htransferRational q hq n hn · intro n M hn hM obtain ⟨pi, w, u, nu, delta, hcert, hbary, _hu, hlow, hrho, hupp, hlp, _hscale, _hlimit⟩ := k3_grid_certificate_sandwich n M hn hM exact ⟨pi, w, u, nu, delta, hcert, hbary, hlow, hrho, le_trans hupp hlp⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.attainment_and_k3_certified_converse · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_attainment_and_k3_certified_converse.lean:138
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_coarse_two_arm_minimax_lower 12 declarations Fully internal smooth-prior two-arm minimax lower bound.

Fully internal smooth-prior two-arm minimax lower bound.

def instMeasurableSpaceEffectTriple_2

The effect triple 2 space carries the discrete measurable structure.

Definition (Lean source)
noncomputable local instance (n : ℕ) : MeasurableSpace (EffectTriple n) := ⊤
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instMeasurableSpaceEffectTriple_2 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:18
theorem instMeasurableSingletonClassEffectTriple_2

every singleton in the effect triple 2 space is measurable.

Formal statement
Proof (Lean source)
noncomputable local instance (n : ℕ) : MeasurableSingletonClass (EffectTriple n) := ⟨fun _ => MeasurableSet.of_discrete⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instMeasurableSingletonClassEffectTriple_2 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:20
theorem instNonemptyEffectTriple_1

the effect triple 1 collection is nonempty.

Formal statement
∀ (n : ℕ), Nonempty (EffectTriple n)
Proof (Lean source)
noncomputable local instance (n : ℕ) : Nonempty (EffectTriple n) := ⟨⟨⟨⟨0, zero_lt_succ n⟩, ⟨⟨0, zero_lt_succ n⟩, ⟨n, Nat.lt_succ_self n⟩⟩⟩, by simp⟩⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instNonemptyEffectTriple_1 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:23
theorem twoArmSmoothMixedCountLoss_eq_inducedSquaredRisk

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, Mixing the smooth scalar-to-effect kernel and then evaluating count squared loss is exactly the squared risk under the induced finite effect-count prior.

Formal statement
n :
a :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
D :
T :
Fin (n + 1) → ℝ
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothMixedCountLoss_eq_inducedSquaredRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:29
theorem twoArmSmoothRealBayesRisk_eq_scalarBayesRisk

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, The continuous smooth-mixture Bayes risk is the paper's scalar binomial Bayes risk for the induced finite effect-count prior.

Formal statement
n :
a :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
D :
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothRealBayesRisk_eq_scalarBayesRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:46
theorem twoArmPosteriorTarget_eq_of_scoreCount_eq

the stated side condition holds, The observation-dependent posterior target is constant on every retained-count fiber.

Formal statement
n :
a θ :
s t :
Unit n → Bool
Proof (Lean source)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorTarget_eq_of_scoreCount_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:61
theorem twoArmSmoothVanTreesErrorLowerBound

the population size is positive, the parameter lies in the stated interval, the second arm count satisfies its stated condition, Every estimator of the signed Bernoulli score vector has smooth-prior posterior-target error at least the displayed finite van Trees fraction.

Formal statement
n :
hn :
0 < n
a :
ha :
0 < a
ha1 :
a ≤ 1 / 2
T :
(Unit n → Bool) → ℝ
(1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2)
≤ ∫ z, errorSqField (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood (twoArmPosteriorTarget a) T z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count)
Proof (Lean source)
lemma twoArmSmoothVanTreesErrorLowerBound {n : ℕ} (hn : 0 < n) (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1 / 2) (T : (Unit n → Bool) → ℝ) : (1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2) ≤ ∫ z, errorSqField (smoothPrior 0 (a / 2)) twoArmRegularBernoulliLikelihood (twoArmPosteriorTarget a) T z ∂((parameterMeasure (-1 / 2) (1 / 2)).prod Measure.count) := by let M := twoArmFiniteVanTreesRegularity a ha T open Causalean.Stat.Limit.ObservationDependentVanTrees in apply finite_vanTrees_lower_bound (by norm_num) M (smoothPrior_contDiff (by positivity : 0 < a / 2)) (support_smoothPrior_subset_Icc (ell := (-1 / 2 : ℝ)) (u := (1 / 2 : ℝ)) (c := 0) (a := a / 2) (by positivity) (by linarith) (by linarith)) (hasDerivAt_smoothPrior (by positivity)) (smoothPrior_nonneg (by positivity)) (integral_smoothPrior_parameterMeasure (by positivity) (by linarith) (by linarith)) (by filter_upwards with s have hu : smoothPrior 0 (a / 2) (1 / 2) = 0 := by rw [smoothPrior] simp only [sub_zero] rw [if_neg] norm_num linarith have hl : smoothPrior 0 (a / 2) (-1 / 2) = 0 := by rw [smoothPrior] simp only [sub_zero] rw [if_neg] norm_num linarith constructor · rw [hu] simp · rw [hl] simp) (smoothPrior_scoreSq_aestronglyMeasurable (by positivity)) (smoothPrior_scoreSq_integrable (by positivity)) (by linarith) ?_ ?_ (by rw [priorInformation_smoothPrior (by positivity : 0 < a / 2) (by linarith) (by linarith)] field_simp [ha.ne'] norm_num) ?_ · let PM := parameterMeasure (-1 / 2) (1 / 2) letI : IsFiniteMeasure PM := by dsimp [PM, parameterMeasure] infer_instance let w := smoothPrior 0 (a / 2) let p := twoArmRegularBernoulliLikelihood (n := n) let dg := twoArmPosteriorTargetDeriv (n := n) a have hprod := (twoArmFiniteVanTreesRegularity a ha T).hsensitivityInt rw [MeasureTheory.integral_prod _ hprod] calc 1 - a = ∫ θ, w θ * (1 - a) ∂PM := by rw [MeasureTheory.integral_mul_const, integral_smoothPrior_parameterMeasure (by positivity : 0 < a / 2) (by linarith) (by linarith), one_mul] _ ≤ _ := by apply MeasureTheory.integral_mono · exact (smoothPrior_integrable_parameterMeasure (by positivity : 0 < a / 2)).mul_const (1 - a) · exact hprod.integral_prod_left · intro θ dsimp [w, p, dg] rw [MeasureTheory.integral_count] simp only [sensitivityField, jointDensity] rw [show (∑ s : Unit n → Bool, twoArmPosteriorTargetDeriv a θ s * (smoothPrior 0 (a / 2) θ * twoArmRegularBernoulliLikelihood θ s)) = smoothPrior 0 (a / 2) θ * ∑ s : Unit n → Bool, twoArmPosteriorTargetDeriv a θ s * twoArmRegularBernoulliLikelihood θ s by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro s _ ring] by_cases hw : 0 < smoothPrior 0 (a / 2) θ · have hθ : |θ| < a / 2 := by simpa using (smoothPrior_pos_iff (by positivity : 0 < a / 2)).mp hw have hθone : |θ| ≤ 1 := hθ.le.trans (by linarith) simp_rw [twoArmRegularBernoulliLikelihood_eq hθone] rw [show (∑ s : Unit n → Bool, twoArmPosteriorTargetDeriv a θ s * twoArmBernoulliLikelihood θ s) = (twoArmBernoulliVectorDesign n θ hθone).E (twoArmPosteriorTargetDeriv a θ) by unfold FiniteDesign.E apply Finset.sum_congr rfl intro s _ rw [twoArmBernoulliLikelihood_eq_design θ hθone] ring] exact mul_le_mul_of_nonneg_left (twoArmPosteriorTargetDeriv_mean_lower hn ha.le (by linarith) hθ.le) hw.le · have hw0 : smoothPrior 0 (a / 2) θ = 0 := le_antisymm (le_of_not_gt hw) (smoothPrior_nonneg (by positivity) θ) simp [hw0] · have hweighted := M.hfisherSqInt.integral_prod_left have hweighted' : Integrable (fun θ => smoothPrior 0 (a / 2) θ * fisherInformation (Measure.count : Measure (Unit n → Bool)) (twoArmRegularBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ) (parameterMeasure (-1 / 2) (1 / 2)) := by apply hweighted.congr filter_upwards with θ rw [fisherInformation] simp_rw [MeasureTheory.integral_count] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro s _ ring apply average_fisherInformation_le (ell := (-1 / 2 : ℝ)) (u := (1 / 2 : ℝ)) (I := (n : ℝ) / (1 - a ^ 2 / 4)) (w := smoothPrior 0 (a / 2)) (p := twoArmRegularBernoulliLikelihood (n := n)) (dp := twoArmBernoulliLikelihoodDeriv (n := n)) (smoothPrior_nonneg (by positivity : 0 < a / 2)) (integral_smoothPrior_parameterMeasure (by positivity : 0 < a / 2) (by linarith) (by linarith)) (smoothPrior_integrable_parameterMeasure (by positivity : 0 < a / 2)) hweighted' intro θ hw have hθ : |θ| < a / 2 := by simpa using (smoothPrior_pos_iff (by positivity : 0 < a / 2)).mp hw have hθone : |θ| ≤ 1 := hθ.le.trans (by linarith) have hfi_eq : fisherInformation (Measure.count : Measure (Unit n → Bool)) (twoArmRegularBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ = fisherInformation (Measure.count : Measure (Unit n → Bool)) (twoArmBernoulliLikelihood (n := n)) (twoArmBernoulliLikelihoodDeriv (n := n)) θ := by unfold fisherInformation apply MeasureTheory.integral_congr_ae filter_upwards with s unfold likelihoodScore rw [twoArmRegularBernoulliLikelihood_eq hθone] rw [hfi_eq] exact twoArmBernoulli_fisherInformation_upper ha.le (by linarith) hθ.le · have hp : 0 < priorInformation (-1 / 2) (1 / 2) (smoothPrior 0 (a / 2)) (smoothPriorDeriv 0 (a / 2)) := by rw [priorInformation_smoothPrior (by positivity : 0 < a / 2) (by linarith) (by linarith)] positivity exact add_pos_of_pos_of_nonneg hp (MeasureTheory.integral_nonneg fun θ => mul_nonneg (smoothPrior_nonneg (by positivity) θ) (MeasureTheory.integral_nonneg fun _ => mul_nonneg (twoArmRegularBernoulliLikelihood_nonneg θ _) (sq_nonneg _)))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmSmoothVanTreesErrorLowerBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:69
theorem coarseTwoArmNumericalBound Lemma coarseTwoArmNumericalBound in the paper ↗

the population size is positive, The elementary n ≥ 8 estimate converting the smooth-prior fraction to the advertised coarse n^{-4/3} lower bound.

Formal statement
n :
hn :
8 ≤ n
(n : ℝ)⁻¹ - 43 * (n : ℝ) ^ (-(4 / 3 : ℝ))
≤ (1 - (n : ℝ) ^ (-(1 / 3 : ℝ))) ^ 2 / ((n : ℝ) / (1 - (n : ℝ) ^ (-(2 / 3 : ℝ)) / 4) + 40 * (n : ℝ) ^ (2 / 3 : ℝ))
Proof (Lean source)
lemma coarseTwoArmNumericalBound (n : ℕ) (hn : 8 ≤ n) : (n : ℝ)⁻¹ - 43 * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ (1 - (n : ℝ) ^ (-(1 / 3 : ℝ))) ^ 2 / ((n : ℝ) / (1 - (n : ℝ) ^ (-(2 / 3 : ℝ)) / 4) + 40 * (n : ℝ) ^ (2 / 3 : ℝ)) := by let a : ℝ := (n : ℝ) ^ (-(1 / 3 : ℝ)) have hnpos : 0 < n := by omega have hnR : 0 < (n : ℝ) := by positivity have ha_pos : 0 < a := by dsimp [a]; positivity have ha3 : a ^ 3 = (n : ℝ)⁻¹ := by dsimp [a] rw [← Real.rpow_mul_natCast hnR.le (-(1 / 3 : ℝ)) 3] norm_num exact Real.rpow_neg_one (n : ℝ) have ha_le : a ≤ 1 / 2 := by have hninv : (n : ℝ)⁻¹ ≤ (8 : ℝ)⁻¹ := by exact (inv_le_inv₀ hnR (by norm_num)).2 (by exact_mod_cast hn) by_contra h have ha_gt : 1 / 2 < a := lt_of_not_ge h have ha_sq : (1 / 4 : ℝ) < a ^ 2 := by nlinarith [sq_nonneg (a - 1 / 2)] have ha_cube : (1 / 8 : ℝ) < a ^ 3 := by have ha_gt' : (2 : ℝ)⁻¹ < a := by simpa [one_div] using ha_gt calc (1 / 8 : ℝ) < a ^ 2 / 2 := by linarith _ < a ^ 2 * a := by exact mul_lt_mul_of_pos_left ha_gt' (sq_pos_of_pos ha_pos) _ = a ^ 3 := by ring norm_num at hninv rw [ha3] at ha_cube linarith have ha2 : (n : ℝ) ^ (-(2 / 3 : ℝ)) = a ^ 2 := by dsimp [a] rw [← Real.rpow_mul_natCast hnR.le (-(1 / 3 : ℝ)) 2] congr 1 ring have hna : (n : ℝ) ^ (2 / 3 : ℝ) = (n : ℝ) * a := by dsimp [a] calc (n : ℝ) ^ (2 / 3 : ℝ) = (n : ℝ) ^ ((1 : ℝ) + -(1 / 3 : ℝ)) := by congr 1 <;> ring _ = (n : ℝ) ^ (1 : ℝ) * (n : ℝ) ^ (-(1 / 3 : ℝ)) := Real.rpow_add hnR _ _ _ = (n : ℝ) * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by rw [Real.rpow_one] have hden_pos : 0 < 1 - a ^ 2 / 4 := by nlinarith [sq_nonneg a] have hinv : (1 - a ^ 2 / 4)⁻¹ ≤ 1 + a := by rw [show (1 - a ^ 2 / 4)⁻¹ = 1 / (1 - a ^ 2 / 4) by rw [one_div], div_le_iff₀ hden_pos] nlinarith [sq_nonneg a] have hratio : 1 - 43 * a ≤ (1 - a) ^ 2 / (40 * a + (1 - a ^ 2 / 4)⁻¹) := by have hden2 : 0 < 40 * a + (1 - a ^ 2 / 4)⁻¹ := by positivity rw [le_div_iff₀ hden2] have hden_le : 40 * a + (1 - a ^ 2 / 4)⁻¹ ≤ 1 + 41 * a := by linarith by_cases h : 0 ≤ 1 - 43 * a · calc (1 - 43 * a) * (40 * a + (1 - a ^ 2 / 4)⁻¹) ≤ (1 - 43 * a) * (1 + 41 * a) := mul_le_mul_of_nonneg_left hden_le h _ ≤ (1 - a) ^ 2 := by nlinarith [sq_nonneg a] · have : (1 - 43 * a) * (40 * a + (1 - a ^ 2 / 4)⁻¹) ≤ 0 := mul_nonpos_of_nonpos_of_nonneg (le_of_not_ge h) hden2.le nlinarith [sq_nonneg (1 - a)] rw [ha2, hna] have hpow4 : (n : ℝ) ^ (-(4 / 3 : ℝ)) = (n : ℝ)⁻¹ * a := by dsimp [a] calc (n : ℝ) ^ (-(4 / 3 : ℝ)) = (n : ℝ) ^ ((-1 : ℝ) + -(1 / 3 : ℝ)) := by congr 1 <;> ring _ = (n : ℝ) ^ (-1 : ℝ) * (n : ℝ) ^ (-(1 / 3 : ℝ)) := Real.rpow_add hnR _ _ _ = (n : ℝ)⁻¹ * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by rw [Real.rpow_neg_one] rw [hpow4] have hden_eq : (n : ℝ) / (1 - a ^ 2 / 4) + 40 * ((n : ℝ) * a) = (n : ℝ) * (40 * a + (1 - a ^ 2 / 4)⁻¹) := by field_simp [hden_pos.ne'] ring rw [hden_eq] have hn_ne : (n : ℝ) ≠ 0 := ne_of_gt hnR calc (n : ℝ)⁻¹ - 43 * ((n : ℝ)⁻¹ * a) = (n : ℝ)⁻¹ * (1 - 43 * a) := by ring _ ≤ (n : ℝ)⁻¹ * ((1 - a) ^ 2 / (40 * a + (1 - a ^ 2 / 4)⁻¹)) := by gcongr _ = (1 - a) ^ 2 / ((n : ℝ) * (40 * a + (1 - a ^ 2 / 4)⁻¹)) := by field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.coarseTwoArmNumericalBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:244
theorem twoArmPosteriorCompat_fraction_le_mixedLoss

the population size is positive, the parameter lies in the stated interval, the second arm count satisfies its stated condition, the two arm posterior compat fraction is at most mixed loss.

Formal statement
n :
hn :
0 < n
a :
ha :
0 < a
ha1 :
a ≤ 1 / 2
f :
ℕ → ℝ
(1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2)
Proof (Lean source)
lemma twoArmPosteriorCompat_fraction_le_mixedLoss {n : ℕ} (hn : 0 < n) (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1 / 2) (f : ℕ → ℝ) : (1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2) ≤ mixedKernelLoss (twoArmPosteriorCompat_smoothPriorMeasure a) (twoArmSmoothEffectKernel n a ha.le (by linarith)) (statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e)) (fun x => clip twoArmContrast (f x)) := by let PM := parameterMeasure (-1 / 2) (1 / 2) let w := smoothPrior 0 (a / 2) let dens : ℝ → ENNReal := fun θ => ofReal (w θ) let π := twoArmPosteriorCompat_smoothPriorMeasure a let K := twoArmSmoothEffectKernel n a ha.le (by linarith) let loss := statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e) let Tc : Fin (n + 1) → ℝ := fun x => clip twoArmContrast (f x) letI : IsProbabilityMeasure π := twoArmPosteriorCompat_smoothPriorMeasure_isProbability a ha (by linarith) letI : IsFiniteMeasure PM := by dsimp [PM, parameterMeasure] infer_instance have hv := twoArmSmoothVanTreesErrorLowerBound hn a ha ha1 (fun s => Tc (scoreCount s)) apply hv.trans have herr : Integrable (errorSqField w twoArmRegularBernoulliLikelihood (twoArmPosteriorTarget a) (fun s => Tc (scoreCount s))) (PM.prod Measure.count) := by exact twoArmErrorSqField_integrable a ha _ rw [MeasureTheory.integral_prod _ herr] simp_rw [MeasureTheory.integral_count] have hdens : Measurable dens := by exact ENNReal.measurable_ofReal.comp (smoothPrior_contDiff (by positivity : 0 < a / 2)).continuous.measurable have htop : ∀ᵐ θ ∂PM, dens θ < ⊤ := Filter.Eventually.of_forall fun θ => by simp [dens] have hgπ : Integrable (kernelAverageLoss K loss Tc) π := Causalean.Stat.integrable_kernelAverageLoss π K loss Tc have hg : Integrable (fun θ => w θ * (twoArmSmoothEffectDesign n a θ ha.le (by linarith)).E (loss Tc)) PM := by have h := (integrable_withDensity_iff hdens htop).1 hgπ apply h.congr filter_upwards with θ change kernelAverageLoss K loss Tc θ * (dens θ).toReal = _ rw [kernelAverageLoss_eq_sum] dsimp only [K] simp_rw [twoArmSmoothEffectKernel_singletonReal] unfold FiniteDesign.E rw [ENNReal.toReal_ofReal (smoothPrior_nonneg (by positivity : 0 < a / 2) θ)] dsimp only [w] ring have hmixed : mixedKernelLoss (twoArmPosteriorCompat_smoothPriorMeasure a) (twoArmSmoothEffectKernel n a ha.le (by linarith)) loss Tc = ∫ θ, w θ * (twoArmSmoothEffectDesign n a θ ha.le (by linarith)).E (loss Tc) ∂PM := by unfold mixedKernelLoss twoArmPosteriorCompat_smoothPriorMeasure rw [integral_withDensity_eq_integral_toReal_smul hdens htop] apply MeasureTheory.integral_congr_ae filter_upwards with θ simp only [smul_eq_mul] rw [ENNReal.toReal_ofReal (smoothPrior_nonneg (by positivity : 0 < a / 2) θ)] change w θ * kernelAverageLoss K loss Tc θ = _ rw [kernelAverageLoss_eq_sum] dsimp only [K] simp_rw [twoArmSmoothEffectKernel_singletonReal] unfold FiniteDesign.E rfl rw [hmixed] refine MeasureTheory.integral_mono_of_nonneg ?_ hg ?_ · exact (show ∀ᵐ θ ∂PM, 0 ≤ ∑ s, errorSqField w twoArmRegularBernoulliLikelihood (twoArmPosteriorTarget a) (fun s => Tc (scoreCount s)) (θ, s) from Filter.Eventually.of_forall fun θ => by unfold errorSqField jointDensity exact sum_nonneg fun s _ => mul_nonneg (sq_nonneg _) (mul_nonneg (smoothPrior_nonneg (by positivity : 0 < a / 2) θ) (twoArmRegularBernoulliLikelihood_nonneg θ s))) · filter_upwards with θ by_cases hw : w θ = 0 · unfold errorSqField jointDensity simp [hw] · have hwpos : 0 < w θ := lt_of_le_of_ne (smoothPrior_nonneg (by positivity : 0 < a / 2) θ) (Ne.symm hw) have hθ : |θ| < a / 2 := by simpa [w] using (smoothPrior_pos_iff (by positivity : 0 < a / 2)).mp hwpos unfold errorSqField jointDensity rw [show (∑ s, (Tc (scoreCount s) - twoArmPosteriorTarget a θ s) ^ 2 * (w θ * twoArmRegularBernoulliLikelihood θ s)) = w θ * ∑ s, twoArmBernoulliLikelihood θ s * (Tc (scoreCount s) - twoArmPosteriorTarget a θ s) ^ 2 by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro s _ rw [twoArmRegularBernoulliLikelihood_eq (hθ.le.trans (by linarith : a / 2 ≤ 1))] ring] apply mul_le_mul_of_nonneg_left _ hwpos.le exact twoArmPosteriorCompat_error_le_effectRisk hn a θ ha.le ha1 hθ.le f
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_fraction_le_mixedLoss · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:336
theorem twoArmPosteriorCompat_mixedLoss_clip_le

the first arm count satisfies its stated condition, the second arm count satisfies its stated condition, the two arm posterior compat mixed loss clip is at most property holds.

Formal statement
n :
a :
ha0 :
0 ≤ a
ha1 :
a ≤ 1
T :
Fin (n + 1) → ℝ
Proof (Lean source)
lemma twoArmPosteriorCompat_mixedLoss_clip_le {n : ℕ} (a : ℝ) (ha0 : 0 ≤ a) (ha1 : a ≤ 1) (π : Measure ℝ) [IsProbabilityMeasure π] (T : Fin (n + 1) → ℝ) : mixedKernelLoss π (twoArmSmoothEffectKernel n a ha0 ha1) (statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e)) (fun x => clip twoArmContrast (T x)) ≤ mixedKernelLoss π (twoArmSmoothEffectKernel n a ha0 ha1) (statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e)) T := by let K := twoArmSmoothEffectKernel n a ha0 ha1 let loss := statewiseSquaredLoss (twoArmCountKernel (twoArmPosteriorCompat_zeroAssignDesign n)) (fun e _ => effectTarget e) unfold mixedKernelLoss apply MeasureTheory.integral_mono (integrable_kernelAverageLoss π K loss (fun x => clip twoArmContrast (T x))) (integrable_kernelAverageLoss π K loss T) intro θ rw [kernelAverageLoss_eq_sum, kernelAverageLoss_eq_sum] apply Finset.sum_le_sum intro e _ apply mul_le_mul_of_nonneg_left _ (by positivity) dsimp only [loss] unfold statewiseSquaredLoss apply Finset.sum_le_sum intro x _ apply mul_le_mul_of_nonneg_left _ (kernelMass_nonneg _ _ _) change (clipIcc (-Lc twoArmContrast / 2) (Lc twoArmContrast / 2) (T x) - effectTarget e) ^ 2 ≤ _ exact clipIcc_sub_sq_le (effectTarget_mem_twoArmRange e) _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_mixedLoss_clip_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:451
theorem twoArmPosteriorCompat_fraction_le_rho2

the population size is positive, the parameter lies in the stated interval, the second arm count satisfies its stated condition, the two arm posterior compat fraction is at most two-arm minimax risk.

Formal statement
n :
hn :
0 < n
a :
ha :
0 < a
ha1 :
a ≤ 1 / 2
(1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2) ≤ rho2 n
Proof (Lean source)
lemma twoArmPosteriorCompat_fraction_le_rho2 {n : ℕ} (hn : 0 < n) (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1 / 2) : (1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2) ≤ rho2 n := by let π := twoArmPosteriorCompat_smoothPriorMeasure a let K := twoArmSmoothEffectKernel n a ha.le (by linarith : a ≤ 1) let D := twoArmPosteriorCompat_zeroAssignDesign n let L := twoArmCountKernel D let target : EffectTriple n → Fin (n + 1) → ℝ := fun e _ => effectTarget e let loss := statewiseSquaredLoss L target let B := (1 - a) ^ 2 / ((n : ℝ) / (1 - a ^ 2 / 4) + 40 / a ^ 2) letI : IsProbabilityMeasure π := twoArmPosteriorCompat_smoothPriorMeasure_isProbability a ha (by linarith) have hlower : ∀ T : Fin (n + 1) → ℝ, B ≤ mixedKernelLoss π K loss T := by intro T let f : ℕ → ℝ := fun k => if hk : k < n + 1 then T ⟨k, hk⟩ else 0 have hclip := twoArmPosteriorCompat_fraction_le_mixedLoss hn a ha ha1 f have hmono := twoArmPosteriorCompat_mixedLoss_clip_le (n := n) a ha.le (by linarith : a ≤ 1) π (fun x : Fin (n + 1) => f x) have hf : (fun x : Fin (n + 1) => f x) = T := by funext x simp only [f, dif_pos x.isLt] dsimp only [B, K, loss, L, D, target] rw [hf] at hmono exact hclip.trans hmono have hreal : B ≤ realBayesRisk π K loss := by apply mixedIntegratedLowerBound_le_realBayesRisk π K L target (fun T => mixedKernelLoss π K loss T) B · intro T rfl · exact hlower have hscalar : B ≤ scalarBayesRisk (inducedFiniteDesign π K) := by rw [← twoArmSmoothRealBayesRisk_eq_scalarBayesRisk a ha.le (by linarith : a ≤ 1) π D] exact hreal obtain ⟨lift, _, _, _, hkernel⟩ := twoArmScalarPriorScheduleKernel (inducedFiniteDesign π K) exact hscalar.trans (scalarBayesRisk_le_rho2_of_scheduleKernel (inducedFiniteDesign π K) lift hkernel)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPosteriorCompat_fraction_le_rho2 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:486
theorem coarse_two_arm_minimax_lower Theorem 6 in the paper ↗

the population size is positive, the two-arm minimax risk obeys the stated finite-sample lower bound obtained from the smooth-prior Bayesian information inequality.

Formal statement
n :
hn :
8 ≤ n
conclusion 1
((1 - (n : ℝ) ^ (-(1 / 3 : ℝ))) ^ 2 / ((n : ℝ) / (1 - (n : ℝ) ^ (-(2 / 3 : ℝ)) / 4) + 40 * (n : ℝ) ^ (2 / 3 : ℝ)))
rho2 n
conclusion 2
(n : ℝ)⁻¹ - 43 * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ rho2 n
Proof (Lean source)
theorem coarse_two_arm_minimax_lower (n : ℕ) (hn : 8 ≤ n) : ((1 - (n : ℝ) ^ (-(1 / 3 : ℝ))) ^ 2 / ((n : ℝ) / (1 - (n : ℝ) ^ (-(2 / 3 : ℝ)) / 4) + 40 * (n : ℝ) ^ (2 / 3 : ℝ))) ≤ rho2 n ∧ (n : ℝ)⁻¹ - 43 * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ rho2 n := by let a : ℝ := (n : ℝ) ^ (-(1 / 3 : ℝ)) have hnpos : 0 < n := by omega have hnR : 0 < (n : ℝ) := by positivity have ha_pos : 0 < a := by dsimp [a]; positivity have ha3 : a ^ 3 = (n : ℝ)⁻¹ := by dsimp [a] rw [← Real.rpow_mul_natCast hnR.le (-(1 / 3 : ℝ)) 3] norm_num exact Real.rpow_neg_one (n : ℝ) have ha_le : a ≤ 1 / 2 := by have hninv : (n : ℝ)⁻¹ ≤ (8 : ℝ)⁻¹ := by exact (inv_le_inv₀ hnR (by norm_num)).2 (by exact_mod_cast hn) by_contra h have ha_gt : 1 / 2 < a := lt_of_not_ge h have ha_sq : (1 / 4 : ℝ) < a ^ 2 := by nlinarith [sq_nonneg (a - 1 / 2)] have ha_cube : (1 / 8 : ℝ) < a ^ 3 := by have ha_gt' : (2 : ℝ)⁻¹ < a := by simpa [one_div] using ha_gt calc (1 / 8 : ℝ) < a ^ 2 / 2 := by linarith _ < a ^ 2 * a := mul_lt_mul_of_pos_left ha_gt' (sq_pos_of_pos ha_pos) _ = a ^ 3 := by ring norm_num at hninv rw [ha3] at ha_cube linarith have ha2 : (n : ℝ) ^ (-(2 / 3 : ℝ)) = a ^ 2 := by dsimp [a] rw [← Real.rpow_mul_natCast hnR.le (-(1 / 3 : ℝ)) 2] congr 1 ring have hna : (n : ℝ) ^ (2 / 3 : ℝ) = (n : ℝ) * a := by dsimp [a] calc (n : ℝ) ^ (2 / 3 : ℝ) = (n : ℝ) ^ ((1 : ℝ) + -(1 / 3 : ℝ)) := by congr 1 <;> ring _ = (n : ℝ) ^ (1 : ℝ) * (n : ℝ) ^ (-(1 / 3 : ℝ)) := Real.rpow_add hnR _ _ _ = (n : ℝ) * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by rw [Real.rpow_one] have hainv2 : 1 / a ^ 2 = (n : ℝ) ^ (2 / 3 : ℝ) := by rw [hna] field_simp [ha_pos.ne', hnR.ne'] rw [ha3] exact (inv_mul_cancel₀ hnR.ne').symm have hfirst := twoArmPosteriorCompat_fraction_le_rho2 hnpos a ha_pos ha_le have hfirst' : (1 - (n : ℝ) ^ (-(1 / 3 : ℝ))) ^ 2 / ((n : ℝ) / (1 - (n : ℝ) ^ (-(2 / 3 : ℝ)) / 4) + 40 * (n : ℝ) ^ (2 / 3 : ℝ)) ≤ rho2 n := by rw [ha2, ← hainv2] rw [show (n : ℝ) ^ (-(1 / 3 : ℝ)) = a by rfl] simpa [div_eq_mul_inv] using hfirst exact ⟨hfirst', (coarseTwoArmNumericalBound n hn).trans hfirst'⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.coarse_two_arm_minimax_lower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_coarse_two_arm_minimax_lower.lean:530
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_contrast_risk_continuity 13 declarations Finite-sample Lipschitz continuity of square-root minimax risk.

Finite-sample Lipschitz continuity of square-root minimax risk.

The distance between two contrasts is the largest absolute difference between their response-type scores.

Definition (Lean source)
K :
c c' :
Contrast ℝ K
contrastDistance c c' :
(∑ a, |c a - c' a|) / 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrastDistance · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:10
theorem contrastTypeScore_sub_abs_le

the contrast type score sub abs is at most property holds.

Formal statement
K :
c c' :
Contrast ℝ K
t :
|∑ a, (c a - c' a) * if t a then 1 else 0| ≤ contrastDistance c c'
Proof (Lean source)
lemma contrastTypeScore_sub_abs_le {K : ℕ} (c c' : Contrast ℝ K) (t : RespType K) : |∑ a, (c a - c' a) * if t a then 1 else 0| ≤ contrastDistance c c' := by classical let s : Finset (Arm K) := Finset.univ.filter fun a => t a let sc : Finset (Arm K) := Finset.univ.filter fun a => ¬ t a have hzero : ∑ a, (c a - c' a) = 0 := by rw [Finset.sum_sub_distrib, c.sum_zero, c'.sum_zero, sub_self] have hpartition : s.sum (fun a => c a - c' a) + sc.sum (fun a => c a - c' a) = 0 := by calc s.sum (fun a => c a - c' a) + sc.sum (fun a => c a - c' a) = ∑ a, ((if a ∈ s then c a - c' a else 0) + if a ∈ sc then c a - c' a else 0) := by simp [Finset.sum_add_distrib] _ = ∑ a, (c a - c' a) := by apply Finset.sum_congr rfl intro a ha by_cases ht : t a <;> simp [s, sc, ht] _ = 0 := hzero have hsplit : s.sum (fun a => c a - c' a) = -sc.sum (fun a => c a - c' a) := by have := hpartition linarith have hs : |s.sum (fun a => c a - c' a)| ≤ s.sum (fun a => |c a - c' a|) := Finset.abs_sum_le_sum_abs _ _ have hsc : |s.sum (fun a => c a - c' a)| ≤ sc.sum (fun a => |c a - c' a|) := by rw [hsplit, abs_neg] exact Finset.abs_sum_le_sum_abs _ _ have htotal : s.sum (fun a => |c a - c' a|) + sc.sum (fun a => |c a - c' a|) = ∑ a, |c a - c' a| := by calc _ = ∑ a, ((if a ∈ s then |c a - c' a| else 0) + if a ∈ sc then |c a - c' a| else 0) := by simp [Finset.sum_add_distrib] _ = _ := by apply Finset.sum_congr rfl intro a ha by_cases ht : t a <;> simp [s, sc, ht] have hscore : (∑ a, (c a - c' a) * if t a then 1 else 0) = s.sum (fun a => c a - c' a) := by calc _ = ∑ a, if a ∈ s then c a - c' a else 0 := by apply Finset.sum_congr rfl intro a ha by_cases ht : t a <;> simp [s, ht] _ = _ := by simp rw [hscore, contrastDistance] linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrastTypeScore_sub_abs_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:15
theorem tauC_sub_abs_le_contrastDistance

the population size is positive, the tau c sub abs is at most contrast distance.

Formal statement
K n :
c c' :
Contrast ℝ K
z :
Schedule K n
hn :
1 ≤ n
|tauC c z - tauC c' z| ≤ contrastDistance c c'
Proof (Lean source)
lemma tauC_sub_abs_le_contrastDistance {K n : ℕ} (c c' : Contrast ℝ K) (z : Schedule K n) (hn : 1 ≤ n) : |tauC c z - tauC c' z| ≤ contrastDistance c c' := by have hnR : (0 : ℝ) < n := by exact_mod_cast (Nat.zero_lt_of_lt hn) have hpoint : ∀ i : Unit n, |∑ a, (c a - c' a) * if z i a then 1 else 0| ≤ contrastDistance c c' := fun i => contrastTypeScore_sub_abs_le c c' (z i) rw [tauC, tauC, ← mul_sub, ← Finset.sum_sub_distrib] simp only [← Finset.sum_sub_distrib, ← sub_mul] calc |(n : ℝ)⁻¹ * ∑ i, ∑ a, (c a - c' a) * if z i a then 1 else 0| = (n : ℝ)⁻¹ * |∑ i, ∑ a, (c a - c' a) * if z i a then 1 else 0| := by rw [abs_mul, abs_of_pos (inv_pos.mpr hnR)] _ ≤ (n : ℝ)⁻¹ * ∑ i, |∑ a, (c a - c' a) * if z i a then 1 else 0| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (n : ℝ)⁻¹ * ∑ _i : Unit n, contrastDistance c c' := by gcongr with i exact hpoint i _ = contrastDistance c c' := by simp [hnR.ne']
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauC_sub_abs_le_contrastDistance · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:65
theorem tauC_mem_naturalInterval

the population size is positive, the tau c belongs to natural interval.

Formal statement
K n :
c :
Contrast ℝ K
z :
Schedule K n
hn :
1 ≤ n
tauC c z ∈ Icc (-Lc c / 2) (Lc c / 2)
Proof (Lean source)
lemma tauC_mem_naturalInterval {K n : ℕ} (c : Contrast ℝ K) (z : Schedule K n) (hn : 1 ≤ n) : tauC c z ∈ Icc (-Lc c / 2) (Lc c / 2) := by let nc : Contrast ℝ K := { coeff := fun a => -c a nonzero := by intro h apply c.nonzero funext a have := congrFun h a simp only [Pi.zero_apply] at this ⊢ linarith sum_zero := by change ∑ a, -c a = 0 rw [Finset.sum_neg_distrib, c.sum_zero, neg_zero] } have h := tauC_sub_abs_le_contrastDistance c nc z hn have hdist : contrastDistance c nc = Lc c := by simp only [contrastDistance, nc, Lc] rw [show (∑ a, |c a - -c a|) = 2 * ∑ a, |c a| by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro a ha rw [show c a - -c a = 2 * c a by ring, abs_mul] norm_num] ring have htau : tauC nc z = -tauC c z := by simp only [tauC, nc, Finset.mul_sum, ← Finset.sum_neg_distrib] ring rw [htau, hdist, sub_neg_eq_add, ← two_mul, abs_mul] at h norm_num at h constructor <;> linarith [le_abs_self (tauC c z), neg_abs_le (tauC c z)]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauC_mem_naturalInterval · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:89
theorem finiteDesign_E_abs_le_sqrt_E_sq

the finite design e abs is at most sqrt e squared.

Formal statement
Ω :
Type*
D :
X :
Ω → ℝ
D.E (fun ω => |X ω|) ≤ sqrt (D.E fun ω => X ω ^ 2)
Proof (Lean source)
lemma finiteDesign_E_abs_le_sqrt_E_sq {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (X : Ω → ℝ) : D.E (fun ω => |X ω|) ≤ sqrt (D.E fun ω => X ω ^ 2) := by have hcs := Real.sum_sqrt_mul_sqrt_le (Finset.univ : Finset Ω) (fun ω => D.p_nonneg ω) (fun ω => mul_nonneg (D.p_nonneg ω) (sq_nonneg (X ω))) rw [D.p_sum, Real.sqrt_one, one_mul] at hcs simp only [Real.sqrt_mul (D.p_nonneg _), Real.sqrt_sq_eq_abs] at hcs rw [show D.E (fun ω => |X ω|) = ∑ ω, sqrt (D.p ω) * (sqrt (D.p ω) * |X ω|) by unfold E apply Finset.sum_congr rfl intro ω hω have hp := Real.sq_sqrt (D.p_nonneg ω) dsimp calc D.p ω * |X ω| = sqrt (D.p ω) ^ 2 * |X ω| := by rw [hp] _ = sqrt (D.p ω) * (sqrt (D.p ω) * |X ω|) := by ring] simpa only [E] using hcs
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteDesign_E_abs_le_sqrt_E_sq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:122
theorem finiteDesign_root_mse_triangle_const

the stated side condition holds, the finite design root mse triangle const property holds.

Formal statement
Ω :
Type*
D :
X :
Ω → ℝ
η :
:
0 ≤ η
sqrt (D.E fun ω => (|X ω| + η) ^ 2) ≤ sqrt (D.E fun ω => X ω ^ 2) + η
Proof (Lean source)
lemma finiteDesign_root_mse_triangle_const {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (X : Ω → ℝ) (η : ℝ) (hη : 0 ≤ η) : sqrt (D.E fun ω => (|X ω| + η) ^ 2) ≤ sqrt (D.E fun ω => X ω ^ 2) + η := by have habs := finiteDesign_E_abs_le_sqrt_E_sq D X have hEX : 0 ≤ D.E (fun ω => X ω ^ 2) := D.E_nonneg fun _ => sq_nonneg _ have hbound : D.E (fun ω => (|X ω| + η) ^ 2) ≤ (sqrt (D.E fun ω => X ω ^ 2) + η) ^ 2 := by rw [show D.E (fun ω => (|X ω| + η) ^ 2) = D.E (fun ω => X ω ^ 2) + 2 * η * D.E (fun ω => |X ω|) + η ^ 2 by calc _ = D.E (fun ω => X ω ^ 2 + (2 * η * |X ω| + η ^ 2)) := D.E_congr (fun ω => by nlinarith [sq_abs (X ω)]) _ = _ := by rw [D.E_add, D.E_add, D.E_const_mul, D.E_const]; ring] rw [add_sq, Real.sq_sqrt hEX] nlinarith exact Real.sqrt_le_iff.mpr ⟨by positivity, hbound⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.finiteDesign_root_mse_triangle_const · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:144
theorem clip_sq_dist_le

the dual vector is feasible, the clip squared dist is at most property holds.

Formal statement
K :
c :
Contrast ℝ K
x y :
hy :
y ∈ Icc (-Lc c / 2) (Lc c / 2)
(clip c x - y) ^ 2 ≤ (x - y) ^ 2
Proof (Lean source)
lemma clip_sq_dist_le {K : ℕ} (c : Contrast ℝ K) (x y : ℝ) (hy : y ∈ Icc (-Lc c / 2) (Lc c / 2)) : (clip c x - y) ^ 2 ≤ (x - y) ^ 2 := by have hI : -Lc c / 2 ≤ Lc c / 2 := by have : 0 ≤ Lc c := sum_nonneg fun _ _ => abs_nonneg _ linarith by_cases hlo : x < -Lc c / 2 · rw [clip, min_eq_right (le_trans (le_of_lt hlo) hI), max_eq_left (le_of_lt hlo)] have h1 : 0 ≤ y - (-Lc c / 2) := by linarith [hy.1] have h2 : y - (-Lc c / 2) ≤ y - x := by linarith nlinarith [mul_self_le_mul_self h1 h2] · have hlo' : -Lc c / 2 ≤ x := le_of_not_gt hlo by_cases hhi : x ≤ Lc c / 2 · rw [clip, min_eq_right hhi, max_eq_right hlo'] · have hhi' : Lc c / 2 < x := lt_of_not_ge hhi rw [clip, min_eq_left (le_of_lt hhi'), max_eq_right hI] have h1 : 0 ≤ Lc c / 2 - y := by linarith [hy.2] have h2 : Lc c / 2 - y ≤ x - y := by linarith nlinarith [mul_self_le_mul_self h1 h2]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clip_sq_dist_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:165
def transferProcedure

A procedure for one contrast transfers to another by applying the original procedure and clipping its output to the new contrast range.

Definition (Lean source)
K n :
c :
Contrast ℝ K
c' :
Contrast ℝ K
p :
Procedure K n c'
transferProcedure c p :
Procedure K n c
(p.1, fun A y => ⟨clip c (p.2 A y), clip_mem c _⟩)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.transferProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:187
theorem transferred_root_risk_le

the population size is positive, the transferred root risk is at most property holds.

Formal statement
K n :
c c' :
Contrast ℝ K
p :
Procedure K n c'
z :
Schedule K n
hn :
1 ≤ n
Proof (Lean source)
lemma transferred_root_risk_le {K n : ℕ} (c c' : Contrast ℝ K) (p : Procedure K n c') (z : Schedule K n) (hn : 1 ≤ n) : sqrt (labeledRisk c (transferProcedure c p) z) ≤ sqrt (labeledRisk c' p z) + contrastDistance c c' := by let η := contrastDistance c c' have hη : 0 ≤ η := by dsimp [η, contrastDistance] positivity let X : Assign K n → ℝ := fun A => (p.2 A (obsOutcome z A) : ℝ) - tauC c' z have htarget := tauC_sub_abs_le_contrastDistance c c' z hn have hmse : labeledRisk c (transferProcedure c p) z ≤ p.1.E (fun A => (|X A| + η) ^ 2) := by unfold labeledRisk mse unfold E apply Finset.sum_le_sum intro A hA apply mul_le_mul_of_nonneg_left _ (p.1.p_nonneg A) have hclip := clip_sq_dist_le c (p.2 A (obsOutcome z A)) (tauC c z) (tauC_mem_naturalInterval c z hn) have habs : |(p.2 A (obsOutcome z A) : ℝ) - tauC c z| ≤ |X A| + η := by calc _ = |X A + (tauC c' z - tauC c z)| := by simp [X] _ ≤ |X A| + |tauC c' z - tauC c z| := abs_add_le _ _ _ ≤ |X A| + η := by gcongr simpa [η, abs_sub_comm] using htarget have hsquare := mul_self_le_mul_self (abs_nonneg ((p.2 A (obsOutcome z A) : ℝ) - tauC c z)) habs rw [← pow_two, ← pow_two, sq_abs] at hsquare exact hclip.trans hsquare calc sqrt (labeledRisk c (transferProcedure c p) z) ≤ sqrt (p.1.E fun A => (|X A| + η) ^ 2) := Real.sqrt_le_sqrt hmse _ ≤ sqrt (p.1.E fun A => X A ^ 2) + η := finiteDesign_root_mse_triangle_const p.1 X η hη _ = sqrt (labeledRisk c' p z) + contrastDistance c c' := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.transferred_root_risk_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:193

the stated side condition holds, the sqrt worst case risk equals property holds.

Formal statement
E Θ :
Type*
Nonempty Θ
risk :
E → Θ → ℝ
e :
E
hrisk :
∀ θ, 0 ≤ risk e θ
= worstCaseRisk (fun e θ => sqrt (risk e θ)) e
Proof (Lean source)
lemma sqrt_worstCaseRisk_eq {E Θ : Type*} [Nonempty Θ] [Fintype Θ] (risk : E → Θ → ℝ) (e : E) (hrisk : ∀ θ, 0 ≤ risk e θ) : sqrt (worstCaseRisk risk e) = worstCaseRisk (fun e θ => sqrt (risk e θ)) e := by unfold worstCaseRisk exact Real.sqrt_monotone.map_ciSup_of_continuousAt Real.continuous_sqrt.continuousAt (bdd := (Set.finite_range (risk e)).bddAbove)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.sqrt_worstCaseRisk_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:233
theorem sqrt_rhoN_eq_root_minimax

the sqrt rho n equals root minimax.

Formal statement
K n :
c :
Contrast ℝ K
sqrt (rhoN K n c)
= minimaxValue (fun (p : Procedure K n c) (z : Schedule K n) => sqrt (labeledRisk c p z))
Proof (Lean source)
lemma sqrt_rhoN_eq_root_minimax {K n : ℕ} (c : Contrast ℝ K) : sqrt (rhoN K n c) = Causalean.Stat.minimaxValue (fun (p : Procedure K n c) (z : Schedule K n) => sqrt (labeledRisk c p z)) := by letI : Nonempty (Procedure K n c) := ⟨contrastWeightedProcedure K n c⟩ unfold rhoN Causalean.Stat.minimaxValue have hbdd : BddBelow (range (fun p : Procedure K n c => worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) p)) := by refine ⟨0, ?_⟩ rintro _ ⟨p, rfl⟩ exact worstCaseRisk_nonneg (fun z => p.1.mse_nonneg _ _) rw [Real.sqrt_monotone.map_ciInf_of_continuousAt Real.continuous_sqrt.continuousAt (bdd := hbdd)] congr 1 funext p exact sqrt_worstCaseRisk_eq _ p (fun z => p.1.mse_nonneg _ _)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.sqrt_rhoN_eq_root_minimax · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:243
theorem root_minimax_one_sided_contrast_le

the population size is positive, the root minimax one sided contrast is at most property holds.

Formal statement
K n :
c c' :
Contrast ℝ K
hn :
1 ≤ n
sqrt (rhoN K n c) ≤ sqrt (rhoN K n c') + contrastDistance c c'
Proof (Lean source)
lemma root_minimax_one_sided_contrast_le (K n : ℕ) (c c' : Contrast ℝ K) (hn : 1 ≤ n) : sqrt (rhoN K n c) ≤ sqrt (rhoN K n c') + contrastDistance c c' := by rw [sqrt_rhoN_eq_root_minimax c, sqrt_rhoN_eq_root_minimax c'] letI : Nonempty (Procedure K n c') := ⟨contrastWeightedProcedure K n c'⟩ apply sub_le_iff_le_add.mp apply Causalean.Stat.le_minimaxValue intro p have htransfer : worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => sqrt (labeledRisk c q z)) (transferProcedure c p) ≤ worstCaseRisk (fun (q : Procedure K n c') (z : Schedule K n) => sqrt (labeledRisk c' q z)) p + contrastDistance c c' := by apply worstCaseRisk_le intro z calc sqrt (labeledRisk c (transferProcedure c p) z) ≤ sqrt (labeledRisk c' p z) + contrastDistance c c' := transferred_root_risk_le c c' p z hn _ ≤ worstCaseRisk (fun (p : Procedure K n c') (z : Schedule K n) => sqrt (labeledRisk c' p z)) p + contrastDistance c c' := by gcongr have hbdd : BddAbove (range (fun z : Schedule K n => sqrt (labeledRisk c' p z))) := (Set.finite_range _).bddAbove exact le_worstCaseRisk (risk := fun (q : Procedure K n c') (z : Schedule K n) => sqrt (labeledRisk c' q z)) (e := p) hbdd z have hmin := minimaxValue_le_worstCaseRisk_of_nonneg (risk := fun (q : Procedure K n c) (z : Schedule K n) => sqrt (labeledRisk c q z)) (fun _ _ => Real.sqrt_nonneg _) (transferProcedure c p) linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.root_minimax_one_sided_contrast_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:263
theorem contrast_risk_continuity Theorem 8 in the paper ↗

there are at least two treatment arms, the population size is positive, the square root of finite-sample minimax risk is Lipschitz continuous in the contrast under the response-type score distance.

Formal statement
K n :
c c' :
Contrast ℝ K
hn :
1 ≤ n
|sqrt (rhoN K n c) - sqrt (rhoN K n c')| ≤ contrastDistance c c'
Proof (Lean source)
theorem contrast_risk_continuity (K n : ℕ) (c c' : Contrast ℝ K) (hK : AdmissibleArmCount K) (hn : 1 ≤ n) : |sqrt (rhoN K n c) - sqrt (rhoN K n c')| ≤ contrastDistance c c' := by rw [abs_le] have hsymm : contrastDistance c' c = contrastDistance c c' := by unfold contrastDistance congr 1 apply Finset.sum_congr rfl intro a ha exact abs_sub_comm (c' a) (c a) constructor · have h := root_minimax_one_sided_contrast_le K n c' c hn rw [hsymm] at h linarith · have h := root_minimax_one_sided_contrast_le K n c c' hn linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrast_risk_continuity · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_contrast_risk_continuity.lean:299
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_embedded_two_arm_converse 1 declarations Sign-group embedding of the unrestricted two-arm decision problem.

Sign-group embedding of the unrestricted two-arm decision problem.

theorem embedded_two_arm_converse Theorem 4 in the paper ↗

there are at least two treatment arms, the population size is positive, every multi-arm problem contains a scaled two-arm sign-group subproblem, yielding the stated two-arm minimax lower bound.

Formal statement
K n :
c :
Contrast ℝ K
hn :
0 < n
conclusion 1
C0 c * rho2 n ≤ rhoN K n c
conclusion 2
rhoN K n c ≤ C0 c / n
conclusion 3
8 ≤ n
0 ≤ dN K c n
dN K c n ≤ C0 c * ((n : ℝ)⁻¹ - rho2 n)
dN K c n ≤ 43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))
conclusion 4
(Sc c).card = 2
rhoN K n c = C0 c * rho2 n
dN K c n = C0 c * ((n : ℝ)⁻¹ - rho2 n)
Proof (Lean source)
theorem embedded_two_arm_converse (K n : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) (hn : 0 < n) : C0 c * rho2 n ≤ rhoN K n c ∧ rhoN K n c ≤ C0 c / n ∧ (8 ≤ n → 0 ≤ dN K c n ∧ dN K c n ≤ C0 c * ((n : ℝ)⁻¹ - rho2 n) ∧ dN K c n ≤ 43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))) ∧ ((Sc c).card = 2 → rhoN K n c = C0 c * rho2 n ∧ dN K c n = C0 c * ((n : ℝ)⁻¹ - rho2 n)) := by have hlow : C0 c * rho2 n ≤ rhoN K n c := embeddedTwoArmLowerBound K n c have hC0 : 0 ≤ C0 c := by unfold C0; positivity have hu : rhoN K n c ≤ C0 c / n := by unfold rhoN exact (minimaxValue_le_worstCaseRisk_of_nonneg (fun p z => p.1.mse_nonneg _ _) (contrastWeightedProcedure K n c)).trans (contrastWeightedProcedure_upperRisk K n c hn) have hsupp : (Sc c).card = 2 → rhoN K n c = C0 c * rho2 n := by intro hc exact le_antisymm (supportTwoUpperBound K n c hc) hlow refine ⟨hlow, hu, ?_, ?_⟩ · intro hn8 have hcoarse := (coarse_two_arm_minimax_lower n hn8).2 have hd0 : 0 ≤ dN K c n := by unfold dN linarith have hdmid : dN K c n ≤ C0 c * ((n : ℝ)⁻¹ - rho2 n) := by unfold dN rw [div_eq_mul_inv] linarith have hdlast : dN K c n ≤ 43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by calc dN K c n ≤ C0 c * ((n : ℝ)⁻¹ - rho2 n) := hdmid _ ≤ C0 c * (43 * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by gcongr linarith _ = 43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by ring exact ⟨hd0, hdmid, hdlast⟩ · intro hc have hrho := hsupp hc refine ⟨hrho, ?_⟩ unfold dN rw [hrho, div_eq_mul_inv] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embedded_two_arm_converse · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_embedded_two_arm_converse.lean:11
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_exact_response_type_game 1 declarations Exact lossless reduction of the labeled game to response-type orbits.

Exact lossless reduction of the labeled game to response-type orbits.

theorem exact_response_type_game Theorem 1 in the paper ↗

there are at least two treatment arms, the labeled finite-population minimax game and its response-type orbit game have exactly the same value.

Formal statement
K n :
c :
Contrast ℝ K
conclusion 1
conclusion 3
z :
Schedule K n
conclusion 4
rhoN K n c = orbitGameValue K n c
conclusion 5
Proof (Lean source)
theorem exact_response_type_game (K n : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) : LosslessSymmetrization n c ∧ ExactInvariantProcedureCorrespondence n c ∧ (∀ z : Schedule K n, tauC c z = tauCount c (scheduleCounts z)) ∧ rhoN K n c = orbitGameValue K n c ∧ HasOrbitSaddle n c := by exact ⟨lossless_symmetrization c, exact_invariant_procedure_correspondence c, tauC_eq_tauCount_scheduleCounts c, rhoN_eq_orbitGameValue K n c hK, finite_orbit_game_has_saddle c⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.exact_response_type_game · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_exact_response_type_game.lean:126
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_first_order_saddle 7 declarations First-order minimax constant and contrast-weighted upper procedure.

First-order minimax constant and contrast-weighted upper procedure.

def firstOrderUnitScore

The first-order unit score is the contrast-weighted inverse-probability score under the contrast-optimal assignment law.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
t :
a :
Arm K
firstOrderUnitScore c t a :
if qStar c a = 0 then 0 else c a * ((if t a then 1 else 0) - 1 / 2) / qStar c a
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.firstOrderUnitScore · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:15
theorem firstOrderUnitScore_mean

the first order unit score mean property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
(qStarDesign c).E (firstOrderUnitScore c t) = ∑ a, c a * (if t a then 1 else 0)
Proof (Lean source)
lemma firstOrderUnitScore_mean (c : Contrast ℝ K) (t : RespType K) : (qStarDesign c).E (firstOrderUnitScore c t) = ∑ a, c a * (if t a then 1 else 0) := by classical unfold E firstOrderUnitScore qStarDesign calc ∑ a, qStar c a * (if qStar c a = 0 then 0 else c a * ((if t a then 1 else 0) - 1 / 2) / qStar c a) = ∑ a, c a * ((if t a then 1 else 0) - 1 / 2) := by apply Finset.sum_congr rfl intro a _ by_cases hc : c a = 0 · simp [qStar, hc] · have hq : qStar c a ≠ 0 := div_ne_zero (abs_ne_zero.mpr hc) (ne_of_gt (Lc_pos c)) rw [if_neg hq] field_simp [hq] _ = ∑ a, c a * (if t a then 1 else 0) := by calc ∑ a, c a * ((if t a then (1 : ℝ) else 0) - 1 / 2) = ∑ a, (c a * (if t a then 1 else 0) - c a / 2) := by apply Finset.sum_congr rfl intro a _ ring _ = (∑ a, c a * (if t a then 1 else 0)) - ∑ a, c a / 2 := by rw [Finset.sum_sub_distrib] _ = ∑ a, c a * (if t a then 1 else 0) := by rw [← Finset.sum_div, c.sum_zero] norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.firstOrderUnitScore_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:21
theorem firstOrderUnitScore_secondMoment

the first order unit score second moment property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
t :
(qStarDesign c).E (fun a => firstOrderUnitScore c t a ^ 2) = C0 c
Proof (Lean source)
lemma firstOrderUnitScore_secondMoment (c : Contrast ℝ K) (t : RespType K) : (qStarDesign c).E (fun a => firstOrderUnitScore c t a ^ 2) = C0 c := by classical unfold E firstOrderUnitScore qStarDesign rw [C0] have hhalf (a : Arm K) : ((if t a then (1 : ℝ) else 0) - 1 / 2) ^ 2 = 1 / 4 := by by_cases ht : t a <;> simp [ht] <;> norm_num calc ∑ a, qStar c a * (if qStar c a = 0 then 0 else c a * ((if t a then 1 else 0) - 1 / 2) / qStar c a) ^ 2 = ∑ a, Lc c * |c a| / 4 := by apply Finset.sum_congr rfl intro a _ by_cases hc : c a = 0 · simp [qStar, hc] · have hq : qStar c a ≠ 0 := div_ne_zero (abs_ne_zero.mpr hc) (ne_of_gt (Lc_pos c)) rw [if_neg hq, div_pow, mul_pow, hhalf] simp only [qStar] field_simp [abs_ne_zero.mpr hc, ne_of_gt (Lc_pos c)] rw [sq_abs] _ = Lc c ^ 2 / 4 := by rw [← Finset.sum_div, ← Finset.mul_sum] simp only [Lc] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.firstOrderUnitScore_secondMoment · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:54
theorem contrastWeightedProcedure_risk

the population size is positive, the contrast weighted procedure risk property holds.

Formal statement
K n :
c :
Contrast ℝ K
hn :
0 < n
worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (contrastWeightedProcedure K n c)
C0 c / n
Proof (Lean source)
lemma contrastWeightedProcedure_risk (K n : ℕ) (c : Contrast ℝ K) (hn : 0 < n) : worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (contrastWeightedProcedure K n c) ≤ C0 c / n := by classical apply Causalean.Stat.worstCaseRisk_le intro z let D : FiniteDesign (Assign K n) := prodDesign (fun _ : Unit n => qStarDesign c) let raw : Assign K n → ℝ := fun A => (n : ℝ)⁻¹ * ∑ i, firstOrderUnitScore c (z i) (A i) have hraw : ∀ A, centeredContrastScore c A (obsOutcome z A) = raw A := by intro A rfl have htau : tauC c z ∈ Icc (-Lc c / 2) (Lc c / 2) := tauC_mem_naturalInterval c z hn have hunbiased : D.Unbiased raw (tauC c z) := by unfold Unbiased raw D tauC rw [E_const_mul, E_sum] simp_rw [E_prod_apply, firstOrderUnitScore_mean] have hvar : D.Var raw ≤ C0 c / n := by have hrawSum : raw = fun A => ∑ i, (n : ℝ)⁻¹ * firstOrderUnitScore c (z i) (A i) := by funext A simp only [raw] rw [Finset.mul_sum] rw [hrawSum, Var_prod_linear_comb] calc ∑ i : Unit n, (n : ℝ)⁻¹ ^ 2 * (qStarDesign c).Var (firstOrderUnitScore c (z i)) ≤ ∑ _i : Unit n, (n : ℝ)⁻¹ ^ 2 * C0 c := by apply Finset.sum_le_sum intro i _ gcongr rw [Var_eq, firstOrderUnitScore_secondMoment] exact sub_le_self _ (sq_nonneg _) _ = C0 c / n := by simp field_simp unfold labeledRisk contrastWeightedProcedure change D.mse (fun A => clip c (centeredContrastScore c A (obsOutcome z A))) (tauC c z) ≤ C0 c / n calc D.mse (fun A => clip c (centeredContrastScore c A (obsOutcome z A))) (tauC c z) ≤ D.mse raw (tauC c z) := by unfold mse unfold E apply Finset.sum_le_sum intro A _ exact mul_le_mul_of_nonneg_left (by change (clip c (centeredContrastScore c A (obsOutcome z A)) - tauC c z) ^ 2 ≤ (raw A - tauC c z) ^ 2 rw [hraw A] exact clip_sq_dist_le c _ _ htau) (D.p_nonneg A) _ = D.Var raw := D.mse_eq_var_of_unbiased hunbiased _ ≤ C0 c / n := hvar
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrastWeightedProcedure_risk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:84
theorem contrast_has_admissible_arm_count

the contrast has admissible arm count property holds.

Formal statement
K :
shared
c :
Contrast ℝ K
Proof (Lean source)
lemma contrast_has_admissible_arm_count (c : Contrast ℝ K) : AdmissibleArmCount K := by unfold AdmissibleArmCount by_contra hK have hKle : K ≤ 1 := by omega interval_cases K · apply c.nonzero funext a exact Fin.elim0 a · apply c.nonzero funext a have ha : a = 0 := Fin.eq_zero a subst a simpa using c.sum_zero
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contrast_has_admissible_arm_count · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:148
theorem firstOrder_minimax_limit

the first order minimax limit property holds.

Formal statement
K :
c :
Contrast ℝ K
Tendsto (fun n : ℕ => (n : ℝ) * rhoN K n c) atTop (nhds (C0 c))
Proof (Lean source)
lemma firstOrder_minimax_limit (K : ℕ) (c : Contrast ℝ K) : Tendsto (fun n : ℕ => (n : ℝ) * rhoN K n c) atTop (nhds (C0 c)) := by have hC0 : 0 ≤ C0 c := by unfold C0; positivity have herr : Tendsto (fun n : ℕ => |(n : ℝ) * rhoN K n c - C0 c|) atTop (nhds 0) := by apply squeeze_zero' (g := fun n : ℕ => 43 * C0 c * (n : ℝ) ^ (-(1 / 3 : ℝ))) · exact Filter.Eventually.of_forall fun _ => abs_nonneg _ · filter_upwards [eventually_atTop.2 ⟨8, fun n hn => hn⟩] with n hn8 have hnpos : 0 < n := by omega have hd := (embedded_two_arm_converse K n c (contrast_has_admissible_arm_count c) hnpos).2.2.1 hn8 have hid : (n : ℝ) * rhoN K n c - C0 c = -(n : ℝ) * dN K c n := by unfold dN field_simp [hnpos.ne'] ring have hpow : (n : ℝ) * (n : ℝ) ^ (-(4 / 3 : ℝ)) = (n : ℝ) ^ (-(1 / 3 : ℝ)) := by calc (n : ℝ) * (n : ℝ) ^ (-(4 / 3 : ℝ)) = (n : ℝ) ^ (1 : ℝ) * (n : ℝ) ^ (-(4 / 3 : ℝ)) := by rw [Real.rpow_one] _ = (n : ℝ) ^ ((1 : ℝ) + -(4 / 3 : ℝ)) := (Real.rpow_add (Nat.cast_pos.mpr hnpos) _ _).symm _ = (n : ℝ) ^ (-(1 / 3 : ℝ)) := by congr 1 <;> ring rw [hid, abs_mul, abs_neg, abs_of_nonneg (Nat.cast_nonneg n), abs_of_nonneg hd.1] calc (n : ℝ) * dN K c n ≤ (n : ℝ) * (43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := mul_le_mul_of_nonneg_left hd.2.2 (Nat.cast_nonneg n) _ = 43 * C0 c * ((n : ℝ) * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by ring _ = 43 * C0 c * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by rw [hpow] · simpa using ((tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 1 / 3)).comp tendsto_natCast_atTop_atTop).const_mul (43 * C0 c) exact tendsto_iff_dist_tendsto_zero.2 (by simpa [Real.dist_eq] using herr)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.firstOrder_minimax_limit · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:164
theorem first_order_saddle Theorem 3 in the paper ↗

the contrast-weighted design and estimator attain the asymptotic first-order minimax constant, and the matching lower bound makes this constant a saddle value.

Formal statement
K :
c :
Contrast ℝ K
conclusion 1
Tendsto (fun n : ℕ => (n : ℝ) * rhoN K n c) atTop (nhds (C0 c))
conclusion 2
n :
0 < n
worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (contrastWeightedProcedure K n c)
C0 c / n
Proof (Lean source)
theorem first_order_saddle (K : ℕ) (c : Contrast ℝ K) : Tendsto (fun n : ℕ => (n : ℝ) * rhoN K n c) atTop (nhds (C0 c)) ∧ (∀ n, 0 < n → worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (contrastWeightedProcedure K n c) ≤ C0 c / n) := by constructor · exact firstOrder_minimax_limit K c · exact fun n hn => contrastWeightedProcedure_risk K n c hn
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.first_order_saddle · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_first_order_saddle.lean:203
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_k3_grid_certificate_sandwich 1 declarations Three-arm specialization of the exact rational certificate sandwich.

Three-arm specialization of the exact rational certificate sandwich.

theorem k3_grid_certificate_sandwich Theorem 10 in the paper ↗

the population size is positive, the grid resolution is positive, the three-arm specialization inherits the exact rational lower-and-upper grid certificate sandwich.

Formal statement
n M :
hn :
0 < n
hM :
0 < M
∃ (pi : GridPi 3 n) (w : GridWeight 3 n M) (u : ℚ) (nu : CountVec 3 n → ℚ) (delta : ∀ r : AllocVec 3 n, ObsVec r → ℝ),
conclusion 1
Mseq :
ℕ → ℕ
(∀ k, 0 < Mseq k)
Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0)
Tendsto (fun k => a k * (1 / (4 * (Mseq k : ℝ) ^ 2))) atTop (nhds 0)
conclusion 2
(a : PositiveSequence) (Mseq : ℕ → ℕ) (lower upper : ℕ → ℝ) C :
(∀ k, 0 < k → 0 < Mseq k ∧ lower k ≤ rhoNDagger k ∧ rhoNDagger k ≤ upper k ∧ upper k - lower k ≤ 1 / (4 * (Mseq k : ℝ) ^ 2))
Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0)
Tendsto (fun k => a k * dN 3 cDagger k) atTop (nhds C)
Tendsto (fun k => a k * (C0 cDagger / k - lower k)) atTop (nhds C)
Tendsto (fun k => a k * (C0 cDagger / k - upper k)) atTop (nhds C)
Proof (Lean source)
theorem k3_grid_certificate_sandwich (n M : ℕ) (hn : 0 < n) (hM : 0 < M) : ∃ (pi : GridPi 3 n) (w : GridWeight 3 n M) (u : ℚ) (nu : CountVec 3 n → ℚ) (delta : ∀ r : AllocVec 3 n, ObsVec r → ℝ), ExactGridPrimalDualCertificate cDaggerQ pi w u nu ∧ IsGridBarycenter cDaggerQ pi w delta ∧ (u : ℝ) = gridLPValueK3 n M hM ∧ lowerCertificate cDaggerQ nu ≤ rhoNDagger n ∧ rhoNDagger n ≤ upperCertificate cDaggerQ pi delta ∧ upperCertificate cDaggerQ pi delta ≤ gridLPValueK3 n M hM ∧ gridLPValueK3 n M hM ≤ lowerCertificate cDaggerQ nu + 1 / (4 * (M : ℝ) ^ 2) ∧ (∀ (a : PositiveSequence) (Mseq : ℕ → ℕ), (∀ k, 0 < Mseq k) → Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0) → Tendsto (fun k => a k * (1 / (4 * (Mseq k : ℝ) ^ 2))) atTop (nhds 0)) ∧ (∀ (a : PositiveSequence) (Mseq : ℕ → ℕ) (lower upper : ℕ → ℝ) C, (∀ k, 0 < k → 0 < Mseq k ∧ lower k ≤ rhoNDagger k ∧ rhoNDagger k ≤ upper k ∧ upper k - lower k ≤ 1 / (4 * (Mseq k : ℝ) ^ 2)) → Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0) → Tendsto (fun k => a k * dN 3 cDagger k) atTop (nhds C) → Tendsto (fun k => a k * (C0 cDagger / k - lower k)) atTop (nhds C) ∧ Tendsto (fun k => a k * (C0 cDagger / k - upper k)) atTop (nhds C)) := by obtain ⟨pi, w, u, nu, delta, hcert, hbary, hu, hlow, hrho, hupp, hlp, _hcount, _halloc, _hobs, hscale⟩ := rational_contrast_grid_certificate_sandwich 3 n M cDaggerQ hn hM have hC0 : C0 cDagger = 1 := by norm_num [C0, Lc, cDagger, ratContrastToReal, cDaggerQ, Fin.sum_univ_succ] have hC0q : C0 (ratContrastToReal cDaggerQ) = 1 := by simpa [cDagger] using hC0 refine ⟨pi, w, u, nu, delta, hcert, hbary, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ · simpa [gridLPValueK3, gridLPValue] using hu · simpa [rhoNDagger, cDagger] using hlow · simpa [rhoNDagger, cDagger] using hrho · simpa [gridLPValueK3, gridLPValue] using hupp · simpa [gridLPValueK3, gridLPValue, hC0q] using hlp · intro a Mseq hMseq hlim simpa [hC0q] using hscale.1 a Mseq hMseq hlim · intro a Mseq lower upper C hbounds hmesh htarget have hmesh4 : Tendsto (fun k => a k * (1 / (4 * (Mseq k : ℝ) ^ 2))) atTop (nhds 0) := by convert (hmesh.const_mul (1 / 4 : ℝ)) using 1 <;> ring have hkpos : ∀ᶠ k : ℕ in atTop, 0 < k := by exact eventually_atTop.2 ⟨1, fun k hk => by omega⟩ have hlerr : Tendsto (fun k => a k * (rhoNDagger k - lower k)) atTop (nhds 0) := by apply squeeze_zero' (g := fun k => a k * (1 / (4 * (Mseq k : ℝ) ^ 2))) · filter_upwards [hkpos] with k hk exact mul_nonneg (le_of_lt (a.2 k)) (sub_nonneg.mpr (hbounds k hk).2.1) · filter_upwards [hkpos] with k hk have hb := hbounds k hk have ha : 0 ≤ a k := le_of_lt (a.2 k) exact mul_le_mul_of_nonneg_left (by linarith [hb.2.1, hb.2.2.2]) ha · exact hmesh4 have huerr : Tendsto (fun k => a k * (upper k - rhoNDagger k)) atTop (nhds 0) := by apply squeeze_zero' (g := fun k => a k * (1 / (4 * (Mseq k : ℝ) ^ 2))) · filter_upwards [hkpos] with k hk exact mul_nonneg (le_of_lt (a.2 k)) (sub_nonneg.mpr (hbounds k hk).2.2.1) · filter_upwards [hkpos] with k hk have hb := hbounds k hk have ha : 0 ≤ a k := le_of_lt (a.2 k) exact mul_le_mul_of_nonneg_left (by linarith [hb.2.1, hb.2.2.2]) ha · exact hmesh4 constructor · convert htarget.add hlerr using 1 <;> simp [dN, rhoNDagger] funext k ring · convert htarget.sub huerr using 1 <;> simp [dN, rhoNDagger] funext k ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3_grid_certificate_sandwich · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_grid_certificate_sandwich.lean:11
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_k3_lp_certificate 3 declarations Finite exact-rational three-arm LP certificate.

Finite exact-rational three-arm LP certificate.

theorem k3TauCountRat_sq_le_one

the population size is positive, the three-arm tau count rat squared is at most one.

Formal statement
n :
hn :
0 < n
m :
(tauCountRat cDaggerQ m) ^ 2 ≤ 1
Proof (Lean source)
lemma k3TauCountRat_sq_le_one {n : ℕ} (hn : 0 < n) (m : CountVec 3 n) : (tauCountRat cDaggerQ m) ^ 2 ≤ 1 := by let s : RespType 3 → ℚ := fun t => ∑ a, cDaggerQ a * if t a then 1 else 0 have hs : ∀ t, -1 ≤ s t ∧ s t ≤ 1 := by intro t cases h0 : t 0 <;> cases h1 : t 1 <;> cases h2 : t 2 <;> norm_num [s, cDaggerQ, Fin.sum_univ_succ, h0, h1, h2] have hsum : (∑ t, (m.1 t : ℚ)) = n := by exact_mod_cast m.2 have hlo : -(n : ℚ) ≤ ∑ t, (m.1 t : ℚ) * s t := by calc -(n : ℚ) = ∑ t, (m.1 t : ℚ) * (-1) := by rw [← hsum]; simp _ ≤ ∑ t, (m.1 t : ℚ) * s t := sum_le_sum fun t _ => mul_le_mul_of_nonneg_left (hs t).1 (by positivity) have hhi : ∑ t, (m.1 t : ℚ) * s t ≤ n := by rw [← hsum] simpa only [mul_one] using sum_le_sum (fun t _ => mul_le_mul_of_nonneg_left (hs t).2 (by positivity)) have hnQ : (0 : ℚ) < n := by exact_mod_cast hn have htau : tauCountRat cDaggerQ m = (n : ℚ)⁻¹ * ∑ t, (m.1 t : ℚ) * s t := by rfl rw [htau] have hinv : (0 : ℚ) < (n : ℚ)⁻¹ := inv_pos.mpr hnQ have hl : -(1 : ℚ) ≤ (n : ℚ)⁻¹ * ∑ t, (m.1 t : ℚ) * s t := by have := mul_le_mul_of_nonneg_left hlo (le_of_lt hinv) field_simp at this ⊢ exact this have hu : (n : ℚ)⁻¹ * ∑ t, (m.1 t : ℚ) * s t ≤ 1 := by have := mul_le_mul_of_nonneg_left hhi (le_of_lt hinv) field_simp at this ⊢ exact this nlinarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3TauCountRat_sq_le_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_lp_certificate.lean:15
theorem gridLPValueK3_le_one

the population size is positive, the grid resolution is positive, the grid lpvalue three-arm is at most one.

Formal statement
n M :
hn :
0 < n
hM :
0 < M
gridLPValueK3 n M hM ≤ 1
Proof (Lean source)
lemma gridLPValueK3_le_one (n M : ℕ) (hn : 0 < n) (hM : 0 < M) : gridLPValueK3 n M hM ≤ 1 := by classical let r₀ : AllocVec 3 n := assignmentCounts (fun _ => 0) let g₀ : Fin (2 * M + 1) := ⟨M, by omega⟩ let pi : GridPi 3 n := fun r => if r = r₀ then 1 else 0 let w : RationalGridWeight 3 n M := fun r _ g => if r = r₀ ∧ g = g₀ then 1 else 0 have hg : gammaMC M cDaggerQ g₀ = 0 := by dsimp [g₀, gammaMC, hRat, LcRat, cDaggerQ] norm_num [Fin.sum_univ_succ] field_simp ring have hfeas : GridLPFeasible 3 n M cDaggerQ pi w 1 := by refine ⟨?_, ?_, ?_, ?_, ?_⟩ · simp [pi] · intro r x by_cases hr : r = r₀ · subst r simp [pi, w] · simp [pi, w, hr] · intro r dsimp [pi] split <;> norm_num · intro r x g dsimp [w] split <;> norm_num · intro m simp only [w] rw [sum_eq_single r₀] · calc ∑ x : ObsVec r₀, ∑ g, orbitLik m r₀ x * (if r₀ = r₀ ∧ g = g₀ then 1 else 0) * (gammaMC M cDaggerQ g - tauCountRat cDaggerQ m) ^ 2 = ∑ x : ObsVec r₀, orbitLik m r₀ x * tauCountRat cDaggerQ m ^ 2 := by apply sum_congr rfl intro x hx rw [sum_eq_single g₀] · simp [hg] · intro g _ hgne simp [hgne] · simp _ ≤ ∑ x : ObsVec r₀, orbitLik m r₀ x * 1 := by apply sum_le_sum intro x hx exact mul_le_mul_of_nonneg_left (k3TauCountRat_sq_le_one hn m) (orbitLik_nonneg m r₀ x) _ = 1 := by simpa using orbitLik_sum_obs m r₀ · intro r _ hr simp [hr] · simp unfold gridLPValueK3 gridLPValueRaw apply csInf_le · refine ⟨0, ?_⟩ rintro v ⟨pi', w', u', hu', rfl⟩ exact_mod_cast gridLP_u_nonneg hu' · exact ⟨pi, w, 1, hfeas, by norm_num⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gridLPValueK3_le_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_lp_certificate.lean:51
theorem k3_lp_certificate Proposition 1 in the paper ↗

the population size is positive, the grid resolution is positive, the exact three-arm linear program has the stated certified value and primal–dual witness.

Formal statement
n M :
hn :
0 < n
hM :
0 < M
conclusion 1
conclusion 2
gridLPValueK3 n M hM ≤ rhoNDagger n + 2 / (M : ℝ) + 1 / (M : ℝ) ^ 2
conclusion 3
0 ≤ gridLPValueK3 n M hM
conclusion 4
gridLPValueK3 n M hM ≤ 1
conclusion 5
∃ (pi : GridPi 3 n) (w : GridWeight 3 n (n ^ 2)) (u : ℚ), ∃ nu : CountVec 3 n → ℚ,
(u : ℝ) = gridLPValueK3 n (n ^ 2) (pow_pos hn)
conclusion 6
t :
∃ m : CountVec 3 n, 0 < (m.1 t : ℕ)
conclusion 7
Tendsto (fun k : ℕ => secondOrderScale k * (2 / (k : ℝ) ^ 2 + 1 / (k : ℝ) ^ 4)) atTop (nhds 0)
Proof (Lean source)
theorem k3_lp_certificate (n M : ℕ) (hn : 0 < n) (hM : 0 < M) : rhoNDagger n ≤ gridLPValueK3 n M hM ∧ gridLPValueK3 n M hM ≤ rhoNDagger n + 2 / (M : ℝ) + 1 / (M : ℝ) ^ 2 ∧ 0 ≤ gridLPValueK3 n M hM ∧ gridLPValueK3 n M hM ≤ 1 ∧ (∃ (pi : GridPi 3 n) (w : GridWeight 3 n (n ^ 2)) (u : ℚ), ∃ nu : CountVec 3 n → ℚ, ExactGridPrimalDualCertificate cDaggerQ pi w u nu ∧ (u : ℝ) = gridLPValueK3 n (n ^ 2) (pow_pos hn)) ∧ (∀ t : RespType 3, ∃ m : CountVec 3 n, 0 < (m.1 t : ℕ)) ∧ Tendsto (fun k : ℕ => secondOrderScale k * (2 / (k : ℝ) ^ 2 + 1 / (k : ℝ) ^ 4)) atTop (nhds 0) := by obtain ⟨pi, w, u, nu, delta, hcert, _hbary, hu, hlow, hrho, hupp, hlp, _hcount, _halloc, _hobs, _hscale⟩ := rational_contrast_grid_certificate_sandwich 3 n M cDaggerQ hn hM have hC0 : C0 (ratContrastToReal cDaggerQ) = 1 := by norm_num [C0, Lc, ratContrastToReal, cDaggerQ, Fin.sum_univ_succ] have hrhoGrid : rhoNDagger n ≤ gridLPValueK3 n M hM := by simpa [rhoNDagger, cDagger, gridLPValueK3, gridLPValue] using hrho.trans hupp have hgridRho : gridLPValueK3 n M hM ≤ rhoNDagger n + 2 / (M : ℝ) + 1 / (M : ℝ) ^ 2 := by have hmesh : gridLPValue 3 n M cDaggerQ hn hM ≤ rhoN 3 n (ratContrastToReal cDaggerQ) + 2 / (M : ℝ) + 1 / (M : ℝ) ^ 2 := by calc gridLPValue 3 n M cDaggerQ hn hM ≤ lowerCertificate cDaggerQ nu + 1 / (4 * (M : ℝ) ^ 2) := by simpa [hC0] using hlp _ ≤ rhoN 3 n (ratContrastToReal cDaggerQ) + 1 / (4 * (M : ℝ) ^ 2) := by gcongr _ ≤ rhoN 3 n (ratContrastToReal cDaggerQ) + 2 / (M : ℝ) + 1 / (M : ℝ) ^ 2 := by have hMR : (0 : ℝ) < M := by exact_mod_cast hM field_simp nlinarith simpa [rhoNDagger, cDagger, gridLPValueK3, gridLPValue] using hmesh have hrhoNonneg : 0 ≤ rhoNDagger n := by unfold rhoNDagger rhoN exact minimaxValue_nonneg fun p z => p.1.mse_nonneg _ _ have hgridNonneg : 0 ≤ gridLPValueK3 n M hM := hrhoNonneg.trans hrhoGrid obtain ⟨pi2, w2, u2, nu2, delta2, hcert2, _hbary2, hu2, _hlow2, _hrho2, _hupp2, _hlp2, _hcount2, _halloc2, _hobs2, _hscale2⟩ := rational_contrast_grid_certificate_sandwich 3 n (n ^ 2) cDaggerQ hn (pow_pos hn) refine ⟨hrhoGrid, hgridRho, hgridNonneg, gridLPValueK3_le_one n M hn hM, ?_⟩ refine ⟨?_, ?_, ?_⟩ · exact ⟨pi2, w2, u2, nu2, hcert2, by simpa [gridLPValueK3, gridLPValue] using hu2⟩ · intro t let z : Schedule 3 n := fun _ => t refine ⟨scheduleCounts z, ?_⟩ simp [scheduleCounts, rawScheduleCount, z, hn] · have h2 : Tendsto (fun x : ℝ => 2 * x ^ (-(2 / 3 : ℝ))) atTop (nhds 0) := by simpa using (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 2 / 3)).const_mul 2 have h8 : Tendsto (fun x : ℝ => x ^ (-(8 / 3 : ℝ))) atTop (nhds 0) := tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 8 / 3) have h := (h2.add h8).comp tendsto_natCast_atTop_atTop simpa only [Function.comp_apply, zero_add] using h.congr' (by filter_upwards [eventually_atTop.2 ⟨1, fun k hk => hk⟩] with k hk rw [secondOrderScale] have hkR : (0 : ℝ) < k := by exact_mod_cast hk have hfirst : (k : ℝ) ^ (4 / 3 : ℝ) * (2 / (k : ℝ) ^ 2) = 2 * (k : ℝ) ^ (-(2 / 3 : ℝ)) := by rw [div_eq_mul_inv] calc (k : ℝ) ^ (4 / 3 : ℝ) * (2 * ((k : ℝ) ^ 2)⁻¹) = 2 * ((k : ℝ) ^ (4 / 3 : ℝ) * ((k : ℝ) ^ 2)⁻¹) := by ring _ = 2 * ((k : ℝ) ^ (4 / 3 : ℝ) * (k : ℝ) ^ (-(2 : ℝ))) := by rw [Real.rpow_neg (le_of_lt hkR)] norm_num _ = 2 * (k : ℝ) ^ (-(2 / 3 : ℝ)) := by rw [← Real.rpow_add hkR] norm_num have hsecond : (k : ℝ) ^ (4 / 3 : ℝ) * (1 / (k : ℝ) ^ 4) = (k : ℝ) ^ (-(8 / 3 : ℝ)) := by rw [one_div, ← Real.rpow_natCast, ← Real.rpow_neg (le_of_lt hkR), ← Real.rpow_add hkR] norm_num change 2 * (k : ℝ) ^ (-(2 / 3 : ℝ)) + (k : ℝ) ^ (-(8 / 3 : ℝ)) = _ rw [mul_add, hfirst, hsecond])
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3_lp_certificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_lp_certificate.lean:111
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_k3_scalar_score_not_minimax_preserving 38 declarations Exact early diagnostic showing scalar sign-score compression loses information.

Exact early diagnostic showing scalar sign-score compression loses information.

def k3SignedScore

The three-arm signed score assigns the contrast coefficient to a response type according to its active outcome pattern.

Definition (Lean source)
n :
shared
A :
Assign 3 n
i :
k3SignedScore A y i :
(if 0 < cDagger (A i) then 1 else -1) * (2 * (if y i then 1 else 0) - 1)
def k3Mu

The three-arm mean level is the average signed score under a response-type distribution.

Definition (Lean source)
n :
shared
z :
Schedule 3 n
i :
k3Mu z i :
(if z i 0 then 1 else 0) - ((if z i 1 then 1 else 0) + (if z i 2 then 1 else 0)) / 2
def k3MeanLevel

The five possible scalar score means {-1,-1/2,0,1/2,1}.

Definition (Lean source)
j :
Fin 5
k3MeanLevel j :
(j : ℝ) / 2 - 1
def k3ScalarScoreRisk

Risk in the five-level scalar score experiment, distinct from the two-arm triple game.

Definition (Lean source)
n :
f :
(Fin n → Bool) → ℝ
mu :
Fin n → Fin 5
k3ScalarScoreRisk n f mu :
∑ s : Fin n → Bool, (∏ i, if s i then (1 + k3MeanLevel (mu i)) / 2 else (1 - k3MeanLevel (mu i)) / 2) * (f s - (n : ℝ)⁻¹ * ∑ i, k3MeanLevel (mu i)) ^ 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarScoreRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:23

Minimax value of the genuine five-level scalar score experiment.

Definition (Lean source)
n :
k3ScalarMinimaxValue n :
sInf {v : ℝ | ∃ f : (Fin n → Bool) → ℝ, v = ⨆ mu : Fin n → Fin 5, k3ScalarScoreRisk n f mu}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarMinimaxValue · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:31
def FeasibleK3ScalarTotal

Feasible absolute total of n five-level scalar means.

Definition (Lean source)
n :
M :
FeasibleK3ScalarTotal n M :
Prop
∃ mu : Fin n → Fin 5, |∑ i, k3MeanLevel (mu i)| = M
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.FeasibleK3ScalarTotal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:36
def scalarMomentMinimum

The scalar moment minimum is the least attainable second moment among distributions with the prescribed mean level.

Definition (Lean source)
n :
M :
scalarMomentMinimum n M :
sInf {Q : ℝ | ∃ mu : Fin n → Fin 5, |∑ i, k3MeanLevel (mu i)| = M ∧ Q = ∑ i, k3MeanLevel (mu i) ^ 2}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarMomentMinimum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:40
theorem k3MeanLevel_sq_ge_half_abs Lemma k3MeanLevel_sq_ge_half_abs in the paper ↗

the three-arm mean level squared is at least half abs.

Formal statement
j :
Fin 5
|k3MeanLevel j| / 2 ≤ k3MeanLevel j ^ 2
Proof (Lean source)
lemma k3MeanLevel_sq_ge_half_abs (j : Fin 5) : |k3MeanLevel j| / 2 ≤ k3MeanLevel j ^ 2 := by fin_cases j <;> norm_num [k3MeanLevel]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3MeanLevel_sq_ge_half_abs · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:46
theorem k3MeanLevel_sq_ge_three_abs_sub_one Lemma k3MeanLevel_sq_ge_three_abs_sub_one in the paper ↗

the three-arm mean level squared is at least three abs sub one.

Formal statement
j :
Fin 5
(3 * |k3MeanLevel j| - 1) / 2 ≤ k3MeanLevel j ^ 2
Proof (Lean source)
lemma k3MeanLevel_sq_ge_three_abs_sub_one (j : Fin 5) : (3 * |k3MeanLevel j| - 1) / 2 ≤ k3MeanLevel j ^ 2 := by fin_cases j <;> norm_num [k3MeanLevel]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3MeanLevel_sq_ge_three_abs_sub_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:52
theorem scalarMomentMinimum_wedge_lower Lemma scalarMomentMinimum_wedge_lower in the paper ↗

the grid resolution is positive, The two pointwise scalar inequalities give both branches of the local wedge.

Formal statement
n :
M :
(if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2) ≤ scalarMomentMinimum n M
Proof (Lean source)
lemma scalarMomentMinimum_wedge_lower (n : ℕ) (M : ℝ) (hM : FeasibleK3ScalarTotal n M) : (if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2) ≤ scalarMomentMinimum n M := by classical rcases hM with ⟨mu₀, hmu₀⟩ let S : Set ℝ := {Q : ℝ | ∃ mu : Fin n → Fin 5, |∑ i, k3MeanLevel (mu i)| = M ∧ Q = ∑ i, k3MeanLevel (mu i) ^ 2} have hSne : S.Nonempty := ⟨∑ i, k3MeanLevel (mu₀ i) ^ 2, mu₀, hmu₀, rfl⟩ have hbound : ∀ Q ∈ S, (if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2) ≤ Q := by rintro Q ⟨mu, htotal, rfl⟩ have habs : M ≤ ∑ i, |k3MeanLevel (mu i)| := by rw [← htotal] exact Finset.abs_sum_le_sum_abs _ _ split_ifs with hlocal · calc M / 2 ≤ (∑ i, |k3MeanLevel (mu i)|) / 2 := by linarith _ = ∑ i, |k3MeanLevel (mu i)| / 2 := by rw [Finset.sum_div] _ ≤ ∑ i, k3MeanLevel (mu i) ^ 2 := Finset.sum_le_sum fun i _ ↦ k3MeanLevel_sq_ge_half_abs (mu i) · calc (3 * M - n) / 2 ≤ (3 * (∑ i, |k3MeanLevel (mu i)|) - n) / 2 := by linarith _ = ∑ i, (3 * |k3MeanLevel (mu i)| - 1) / 2 := by rw [← Finset.sum_div, Finset.sum_sub_distrib] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin] rw [← Finset.mul_sum] ring _ ≤ ∑ i, k3MeanLevel (mu i) ^ 2 := Finset.sum_le_sum fun i _ ↦ k3MeanLevel_sq_ge_three_abs_sub_one (mu i) change _ ≤ sInf S exact le_csInf hSne hbound
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarMomentMinimum_wedge_lower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:58
theorem feasible_total_half_integer Lemma feasible_total_half_integer in the paper ↗

the grid resolution is positive, Every feasible total of five-level means is a nonnegative half-integer.

Formal statement
n :
M :
∃ k : ℕ,
conclusion 1
k ≤ 2 * n
conclusion 2
M = (k : ℝ) / 2
Proof (Lean source)
lemma feasible_total_half_integer (n : ℕ) (M : ℝ) (hM : FeasibleK3ScalarTotal n M) : ∃ k : ℕ, k ≤ 2 * n ∧ M = (k : ℝ) / 2 := by rcases hM with ⟨mu, hmu⟩ let t : ℤ := ∑ i, ((mu i : ℕ) : ℤ) - 2 * (n : ℤ) have hsum_le : ∑ i, (mu i : ℕ) ≤ 4 * n := by calc ∑ i, (mu i : ℕ) ≤ ∑ _i : Fin n, 4 := Finset.sum_le_sum fun i _ => Nat.le_pred_of_lt (mu i).isLt _ = 4 * n := by simp [mul_comm] have ht_bounds : -(2 * (n : ℤ)) ≤ t ∧ t ≤ 2 * (n : ℤ) := by dsimp [t] constructor · have : 0 ≤ ∑ i, ((mu i : ℕ) : ℤ) := by positivity omega · have hsum_le' : ∑ i, ((mu i : ℕ) : ℤ) ≤ 4 * (n : ℤ) := by exact_mod_cast hsum_le omega refine ⟨t.natAbs, ?_, ?_⟩ · have habs : |t| ≤ 2 * (n : ℤ) := (abs_le).2 ht_bounds apply Int.ofNat_le.mp rw [Int.natCast_natAbs] simpa using habs · rw [← hmu] have hsum : ∑ i, k3MeanLevel (mu i) = (t : ℝ) / 2 := by simp only [k3MeanLevel, Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin] dsimp [t] push_cast rw [← Finset.sum_div] ring rw [hsum, abs_div, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.feasible_total_half_integer · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:94

the low-level index satisfies its stated feasibility condition, Below the corner, half-level coordinates attain the scalar wedge.

Formal statement
n k :
hk :
k ≤ n
∃ mu : Fin n → Fin 5,
conclusion 1
(∑ i, k3MeanLevel (mu i)) = (k : ℝ) / 2
conclusion 2
(∑ i, k3MeanLevel (mu i) ^ 2) = (k : ℝ) / 4
Proof (Lean source)
lemma low_level_attainer (n k : ℕ) (hk : k ≤ n) : ∃ mu : Fin n → Fin 5, (∑ i, k3MeanLevel (mu i)) = (k : ℝ) / 2 ∧ (∑ i, k3MeanLevel (mu i) ^ 2) = (k : ℝ) / 4 := by induction n generalizing k with | zero => have : k = 0 := by omega subst k refine ⟨Fin.elim0, ?_, ?_⟩ <;> simp | succ n ih => cases k with | zero => refine ⟨fun _ => 2, ?_, ?_⟩ <;> simp [k3MeanLevel] | succ k => have hk' : k ≤ n := by omega obtain ⟨mu, hsum, hsq⟩ := ih k hk' refine ⟨Fin.cases 3 mu, ?_, ?_⟩ · rw [Fin.sum_univ_succ] simp only [Fin.cases_zero, Fin.cases_succ, hsum] norm_num [k3MeanLevel] ring · rw [Fin.sum_univ_succ] simp only [Fin.cases_zero, Fin.cases_succ, hsq] norm_num [k3MeanLevel] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.low_level_attainer · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:130

the high-level index satisfies its stated feasibility condition, Beyond the corner, a mixture of half-level and unit coordinates attains the wedge.

Formal statement
n l :
hl :
l ≤ n
∃ mu : Fin n → Fin 5,
conclusion 1
(∑ i, k3MeanLevel (mu i)) = (n : ℝ) - (l : ℝ) / 2
conclusion 2
(∑ i, k3MeanLevel (mu i) ^ 2) = (n : ℝ) - 3 * (l : ℝ) / 4
Proof (Lean source)
lemma high_level_attainer (n l : ℕ) (hl : l ≤ n) : ∃ mu : Fin n → Fin 5, (∑ i, k3MeanLevel (mu i)) = (n : ℝ) - (l : ℝ) / 2 ∧ (∑ i, k3MeanLevel (mu i) ^ 2) = (n : ℝ) - 3 * (l : ℝ) / 4 := by induction n generalizing l with | zero => have : l = 0 := by omega subst l refine ⟨Fin.elim0, ?_, ?_⟩ <;> simp | succ n ih => cases l with | zero => refine ⟨fun _ => 4, ?_, ?_⟩ <;> simp [k3MeanLevel] <;> ring | succ l => have hl' : l ≤ n := by omega obtain ⟨mu, hsum, hsq⟩ := ih l hl' refine ⟨Fin.cases 3 mu, ?_, ?_⟩ · rw [Fin.sum_univ_succ] simp only [Fin.cases_zero, Fin.cases_succ, hsum] norm_num [k3MeanLevel] ring · rw [Fin.sum_univ_succ] simp only [Fin.cases_zero, Fin.cases_succ, hsq] norm_num [k3MeanLevel] ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.high_level_attainer · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:158
theorem scalarMomentMinimum_wedge_upper Lemma scalarMomentMinimum_wedge_upper in the paper ↗

the grid resolution is positive, The explicit half-level/unit configurations attain the lower wedge bound.

Formal statement
n :
M :
scalarMomentMinimum n M ≤ if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2
Proof (Lean source)
lemma scalarMomentMinimum_wedge_upper (n : ℕ) (M : ℝ) (hM : FeasibleK3ScalarTotal n M) : scalarMomentMinimum n M ≤ if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2 := by obtain ⟨k, hk, hMk⟩ := feasible_total_half_integer n M hM have hbdd : BddBelow {Q : ℝ | ∃ mu : Fin n → Fin 5, |∑ i, k3MeanLevel (mu i)| = M ∧ Q = ∑ i, k3MeanLevel (mu i) ^ 2} := by refine ⟨0, ?_⟩ rintro Q ⟨mu, _, rfl⟩ positivity unfold scalarMomentMinimum by_cases hkn : k ≤ n · have hbranch : M ≤ (n : ℝ) / 2 := by rw [hMk] exact div_le_div_of_nonneg_right (by exact_mod_cast hkn) (by norm_num) rw [if_pos hbranch] obtain ⟨mu, hsum, hsq⟩ := low_level_attainer n k hkn apply csInf_le hbdd refine ⟨mu, ?_, ?_⟩ · rw [hsum, abs_of_nonneg (by positivity), hMk] · rw [hsq, hMk] ring · have hnk : n ≤ k := by omega let l := 2 * n - k have hl : l ≤ n := by dsimp [l]; omega have hkl : k = 2 * n - l := by dsimp [l]; omega have hl2 : l ≤ 2 * n := by omega have hbranch : ¬ M ≤ (n : ℝ) / 2 := by rw [hMk] apply not_le_of_gt exact div_lt_div_of_pos_right (by exact_mod_cast (show n < k by omega)) (by norm_num) rw [if_neg hbranch] obtain ⟨mu, hsum, hsq⟩ := high_level_attainer n l hl apply csInf_le hbdd refine ⟨mu, ?_, ?_⟩ · rw [hsum, abs_of_nonneg] · rw [hMk, hkl, Nat.cast_sub hl2] push_cast ring · have hlR : (l : ℝ) ≤ n := by exact_mod_cast hl linarith · rw [hsq, hMk, hkl, Nat.cast_sub hl2] push_cast ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarMomentMinimum_wedge_upper · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:186
theorem scalarMomentMinimum_wedge Lemma scalarMomentMinimum_wedge in the paper ↗

the grid resolution is positive, Exact scalar moment wedge over every feasible half-integer total.

Formal statement
n :
M :
scalarMomentMinimum n M = if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2
Proof (Lean source)
lemma scalarMomentMinimum_wedge (n : ℕ) (M : ℝ) (hM : FeasibleK3ScalarTotal n M) : scalarMomentMinimum n M = if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2 := by exact le_antisymm (scalarMomentMinimum_wedge_upper n M hM) (scalarMomentMinimum_wedge_lower n M hM)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scalarMomentMinimum_wedge · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:234
theorem k3SignedScore_mean

The signed score has the response-type mean stated in the scalar reduction.

Formal statement
n :
z :
Schedule 3 n
i :
D :
D.E (fun A => k3SignedScore A (obsOutcome z A) i) = k3Mu z i
Proof (Lean source)
lemma k3SignedScore_mean (n : ℕ) (z : Schedule 3 n) (i : Unit n) : let D := prodDesign (fun _ : Unit n => qStarDesign cDagger) D.E (fun A => k3SignedScore A (obsOutcome z A) i) = k3Mu z i := by open Causalean.Experimentation.DesignBased in dsimp let g : Arm 3 → ℝ := fun a => (if 0 < cDagger a then 1 else -1) * (2 * (if z i a then 1 else 0) - 1) have hmarg := FiniteDesign.E_prod_apply (D := fun _ : Unit n => qStarDesign cDagger) i g rw [show (fun A => k3SignedScore A (obsOutcome z A) i) = fun A => g (A i) by funext A rfl, hmarg] unfold FiniteDesign.E dsimp [g] cases h0 : z i 0 <;> cases h1 : z i 1 <;> cases h2 : z i 2 <;> norm_num [qStarDesign, qStar, cDagger, Lc, cDaggerQ, ratContrastToReal, k3Mu, Fin.sum_univ_succ, h0, h1, h2]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3SignedScore_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:243
theorem k3SignedScore_var

The signed score is unit-valued, so its variance is one minus its squared mean.

Formal statement
n :
z :
Schedule 3 n
i :
D :
D.Var (fun A => k3SignedScore A (obsOutcome z A) i) = 1 - k3Mu z i ^ 2
Proof (Lean source)
lemma k3SignedScore_var (n : ℕ) (z : Schedule 3 n) (i : Unit n) : let D := prodDesign (fun _ : Unit n => qStarDesign cDagger) D.Var (fun A => k3SignedScore A (obsOutcome z A) i) = 1 - k3Mu z i ^ 2 := by open Causalean.Experimentation.DesignBased in dsimp let g : Arm 3 → ℝ := fun a => (if 0 < cDagger a then 1 else -1) * (2 * (if z i a then 1 else 0) - 1) rw [show (fun A => k3SignedScore A (obsOutcome z A) i) = fun A => g (A i) by funext A rfl] rw [FiniteDesign.Var_prod_apply, FiniteDesign.Var_eq] have hEg : (qStarDesign cDagger).E g = k3Mu z i := by rw [← k3SignedScore_mean n z i] exact (FiniteDesign.E_prod_apply (D := fun _ : Unit n => qStarDesign cDagger) i g).symm rw [hEg] have hsq : (qStarDesign cDagger).E (fun a => g a ^ 2) = 1 := by rw [show (fun a => g a ^ 2) = fun _ => 1 by funext a by_cases hc : 0 < cDagger a <;> by_cases hy : z i a = true <;> norm_num [g, hc, hy]] exact FiniteDesign.E_const _ _ rw [hsq]
theorem tauC_cDagger_eq_k3Mu_average

The average signed-score mean is exactly the three-arm contrast target.

Formal statement
n :
z :
Schedule 3 n
tauC cDagger z = (∑ i, k3Mu z i) / n
Proof (Lean source)
lemma tauC_cDagger_eq_k3Mu_average (n : ℕ) (z : Schedule 3 n) : tauC cDagger z = (∑ i, k3Mu z i) / n := by unfold tauC rw [div_eq_inv_mul] congr 1 apply Finset.sum_congr rfl intro i _ cases h0 : z i 0 <;> cases h1 : z i 1 <;> cases h2 : z i 2 <;> norm_num [cDagger, cDaggerQ, ratContrastToReal, k3Mu, Fin.sum_univ_succ, h0, h1, h2]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauC_cDagger_eq_k3Mu_average · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:291
theorem k3SignedScore_average_mse

the population size is positive, Independence across units turns the signed-score variances into the exact average MSE.

Formal statement
n :
hn :
0 < n
z :
Schedule 3 n
D :
D.mse (fun A => (∑ i, k3SignedScore A (obsOutcome z A) i) / n) (tauC cDagger z)
= 1 / (n : ℝ) - (∑ i, k3Mu z i ^ 2) / (n : ℝ) ^ 2
Proof (Lean source)
lemma k3SignedScore_average_mse (n : ℕ) (hn : 0 < n) (z : Schedule 3 n) : let D := prodDesign (fun _ : Unit n => qStarDesign cDagger) D.mse (fun A => (∑ i, k3SignedScore A (obsOutcome z A) i) / n) (tauC cDagger z) = 1 / (n : ℝ) - (∑ i, k3Mu z i ^ 2) / (n : ℝ) ^ 2 := by open Causalean.Experimentation.DesignBased in dsimp let g : ∀ _ : Unit n, Arm 3 → ℝ := fun i a => (if 0 < cDagger a then 1 else -1) * (2 * (if z i a then 1 else 0) - 1) let est : Assign 3 n → ℝ := fun A => ∑ i, ((n : ℝ)⁻¹) * g i (A i) have hest : (fun A => (∑ i, k3SignedScore A (obsOutcome z A) i) / n) = est := by funext A dsimp [est, g] rw [Finset.sum_div] apply Finset.sum_congr rfl intro i _ unfold k3SignedScore simp only [obsOutcome, potentialOutcome] have hnR : (n : ℝ) ≠ 0 := by positivity field_simp rfl rw [hest] have hEi (i : Unit n) : (prodDesign (fun _ : Unit n => qStarDesign cDagger)).E (fun A => g i (A i)) = k3Mu z i := by rw [← k3SignedScore_mean n z i] apply FiniteDesign.E_congr intro A rfl have hunb : (prodDesign (fun _ : Unit n => qStarDesign cDagger)).Unbiased est (tauC cDagger z) := by unfold FiniteDesign.Unbiased est rw [FiniteDesign.E_sum] simp only [FiniteDesign.E_const_mul] calc ∑ i, (n : ℝ)⁻¹ * (prodDesign (fun _ : Unit n => qStarDesign cDagger)).E (fun A => g i (A i)) = ∑ i, (n : ℝ)⁻¹ * k3Mu z i := by apply Finset.sum_congr rfl intro i _ rw [hEi i] _ = (∑ i, k3Mu z i) / n := by rw [Finset.sum_div] apply Finset.sum_congr rfl intro i _ rw [div_eq_mul_inv] ring _ = tauC cDagger z := (tauC_cDagger_eq_k3Mu_average n z).symm rw [FiniteDesign.mse_eq_var_of_unbiased _ hunb] dsimp [est] rw [FiniteDesign.Var_prod_linear_comb] have hVi (i : Unit n) : (qStarDesign cDagger).Var (g i) = 1 - k3Mu z i ^ 2 := by rw [← k3SignedScore_var n z i] exact (FiniteDesign.Var_prod_apply (D := fun _ : Unit n => qStarDesign cDagger) i (g i)).symm simp_rw [hVi] have hnR : (n : ℝ) ≠ 0 := by positivity rw [← Finset.mul_sum, Finset.sum_sub_distrib] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin] field_simp ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3SignedScore_average_mse · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:304

The exact three-observation scalar rule from the finite minimax calculation.

Definition (Lean source)
s :
Fin 3 → Bool
k3ScalarRule s :
((3 - sqrt 3) / 6) * ∑ i, if s i then 1 else -1
theorem k3ScalarRule_mem_Icc

The exact scalar rule stays in the natural target interval.

Formal statement
s :
Fin 3 → Bool
k3ScalarRule s ∈ Icc (-1) 1
Proof (Lean source)
lemma k3ScalarRule_mem_Icc (s : Fin 3 → Bool) : k3ScalarRule s ∈ Icc (-1) 1 := by have hs : (sqrt 3) ^ 2 = 3 := Real.sq_sqrt (by norm_num) have hs0 : 0 ≤ sqrt 3 := Real.sqrt_nonneg 3 have hs1 : 1 ≤ sqrt 3 := by nlinarith have hs3 : sqrt 3 ≤ 3 := by nlinarith have ha0 : 0 ≤ (3 - sqrt 3) / 6 := by linarith have ha : (3 - sqrt 3) / 6 ≤ 1 / 3 := by linarith have hsum : |∑ i, (if s i then (1 : ℝ) else -1)| ≤ 3 := by calc |∑ i, (if s i then (1 : ℝ) else -1)| ≤ ∑ i, |if s i then (1 : ℝ) else -1| := Finset.abs_sum_le_sum_abs _ _ _ = ∑ _i : Fin 3, (1 : ℝ) := by apply Finset.sum_congr rfl intro i _ by_cases h : s i <;> simp [h] _ = 3 := by norm_num have habs : |k3ScalarRule s| ≤ 1 := by rw [k3ScalarRule, abs_mul, abs_of_nonneg ha0] nlinarith [abs_nonneg (∑ i, (if s i then (1 : ℝ) else -1))] exact abs_le.mp habs
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarRule_mem_Icc · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:376
def k3ScalarBoolDesign

The Bernoulli score law with mean equal to the selected five-level parameter.

Definition (Lean source)
j :
Fin 5
k3ScalarBoolDesign j :
clause 1
p b := if b then (1 + k3MeanLevel j) / 2 else (1 - k3MeanLevel j) / 2
clause 2
p_nonneg b := by fin_cases j <;> cases b <;> norm_num [k3MeanLevel]
clause 3
p_sum := by simp; ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarBoolDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:399
def k3ScalarProductDesign

Independent three-coordinate score law for a vector of scalar means.

Definition (Lean source)
mu :
Fin 3 → Fin 5
k3ScalarProductDesign mu :
prodDesign (fun i ↦ k3ScalarBoolDesign (mu i))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarProductDesign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:407
theorem k3ScalarBoolDesign_mean

the three-arm scalar bool design mean property holds.

Formal statement
j :
Fin 5
(k3ScalarBoolDesign j).E (fun b ↦ if b then (1 : ℝ) else -1) = k3MeanLevel j
Proof (Lean source)
lemma k3ScalarBoolDesign_mean (j : Fin 5) : (k3ScalarBoolDesign j).E (fun b ↦ if b then (1 : ℝ) else -1) = k3MeanLevel j := by fin_cases j <;> norm_num [k3ScalarBoolDesign, E, k3MeanLevel]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarBoolDesign_mean · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:414
theorem k3ScalarBoolDesign_var

the three-arm scalar bool design var property holds.

Formal statement
j :
Fin 5
(k3ScalarBoolDesign j).Var (fun b ↦ if b then (1 : ℝ) else -1) = 1 - k3MeanLevel j ^ 2
Proof (Lean source)
lemma k3ScalarBoolDesign_var (j : Fin 5) : (k3ScalarBoolDesign j).Var (fun b ↦ if b then (1 : ℝ) else -1) = 1 - k3MeanLevel j ^ 2 := by open Causalean.Experimentation.DesignBased in rw [FiniteDesign.Var_eq, k3ScalarBoolDesign_mean] fin_cases j <;> norm_num [k3ScalarBoolDesign, FiniteDesign.E, k3MeanLevel]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarBoolDesign_var · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:423
theorem k3ScalarRule_risk_le

The explicit linear scalar rule has risk at most 1 - sqrt 3 / 2 at every state.

Formal statement
mu :
Fin 3 → Fin 5
Proof (Lean source)
lemma k3ScalarRule_risk_le (mu : Fin 3 → Fin 5) : k3ScalarScoreRisk 3 k3ScalarRule mu ≤ 1 - sqrt 3 / 2 := by open Causalean.Experimentation.DesignBased in change (k3ScalarProductDesign mu).mse k3ScalarRule ((3 : ℝ)⁻¹ * ∑ i, k3MeanLevel (mu i)) ≤ _ let g : ∀ _ : Fin 3, Bool → ℝ := fun _ b ↦ if b then 1 else -1 let α : ℝ := (3 - sqrt 3) / 6 have hrule : k3ScalarRule = fun s ↦ ∑ i, α * g i (s i) := by funext s simp only [k3ScalarRule, α, g, Finset.mul_sum] rw [hrule, FiniteDesign.mse_eq_var_add_bias_sq] change (prodDesign (fun i ↦ k3ScalarBoolDesign (mu i))).Var (fun s ↦ ∑ i, α * g i (s i)) + _ ≤ _ rw [FiniteDesign.Var_prod_linear_comb] have hmean : (k3ScalarProductDesign mu).E (fun s ↦ ∑ i, α * g i (s i)) = α * ∑ i, k3MeanLevel (mu i) := by unfold k3ScalarProductDesign rw [FiniteDesign.E_sum] simp_rw [FiniteDesign.E_const_mul, FiniteDesign.E_prod_apply] simp only [g, k3ScalarBoolDesign_mean] rw [Finset.mul_sum] unfold FiniteDesign.bias rw [hmean] simp only [g] simp_rw [k3ScalarBoolDesign_var] have hcs : (∑ i, k3MeanLevel (mu i)) ^ 2 ≤ 3 * ∑ i, k3MeanLevel (mu i) ^ 2 := by simpa using (Finset.sum_mul_sq_le_sq_mul_sq (Finset.univ : Finset (Fin 3)) (fun _ ↦ (1 : ℝ)) (fun i ↦ k3MeanLevel (mu i))) have hs : (sqrt 3) ^ 2 = 3 := Real.sq_sqrt (by norm_num) dsimp [α] rw [← Finset.mul_sum, Finset.sum_sub_distrib] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_one] norm_num1 nlinarith [Real.sqrt_nonneg 3]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarRule_risk_le · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:433
theorem k3ScalarMinimaxValue_le_exact

The explicit scalar rule gives the upper half of the exact three-score minimax value.

Formal statement
k3ScalarMinimaxValue 3 ≤ 1 - sqrt 3 / 2
Proof (Lean source)
lemma k3ScalarMinimaxValue_le_exact : k3ScalarMinimaxValue 3 ≤ 1 - sqrt 3 / 2 := by have hbdd : BddBelow {v : ℝ | ∃ f : (Fin 3 → Bool) → ℝ, v = ⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 f mu} := by refine ⟨0, ?_⟩ rintro v ⟨f, rfl⟩ have hrisk : 0 ≤ k3ScalarScoreRisk 3 f (fun _ ↦ 0) := by unfold k3ScalarScoreRisk apply sum_nonneg intro s _ exact mul_nonneg (Finset.prod_nonneg fun i _ ↦ by by_cases h : s i <;> simp [k3MeanLevel, h]) (sq_nonneg _) exact hrisk.trans (le_ciSup (Set.finite_range _).bddAbove (fun _ ↦ 0)) unfold k3ScalarMinimaxValue calc sInf {v : ℝ | ∃ f : (Fin 3 → Bool) → ℝ, v = ⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 f mu} ≤ ⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 k3ScalarRule mu := csInf_le hbdd ⟨k3ScalarRule, rfl⟩ _ ≤ 1 - sqrt 3 / 2 := ciSup_le fun mu ↦ k3ScalarRule_risk_le mu
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarMinimaxValue_le_exact · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:473

Exact least-favorable weights on the five homogeneous scalar states.

Definition (Lean source)
j :
Fin 5
k3ScalarLeastFavorableWeight j :
![((-11 + 7 * sqrt 3) / 12), ((8 - 4 * sqrt 3) / 3), ((-5 + 3 * sqrt 3) / 2), ((8 - 4 * sqrt 3) / 3), ((-11 + 7 * sqrt 3) / 12)] j
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarLeastFavorableWeight · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:496

The three-arm scalar prior risk property holds.

Definition (Lean source)
f :
(Fin 3 → Bool) → ℝ
k3ScalarPriorRisk f :
∑ j : Fin 5, k3ScalarLeastFavorableWeight j * k3ScalarScoreRisk 3 f (fun _ ↦ j)

Coordinate equivalence used to evaluate the scalar three-coordinate certificate.

Definition (Lean source)
α :
Type*
fin3FunEquiv α :
(Fin 3 → α) ≃ α × α × α
clause 1
toFun f := (f 0, f 1, f 2)
clause 2
invFun p := ![p.1, p.2.1, p.2.2]
clause 3
left_inv f := by funext i; fin_cases i <;> rfl
clause 4
right_inv p := by rcases p with ⟨a, b, c⟩; rfl
theorem k3ScalarLeastFavorableWeight_nonneg

the three-arm scalar least favorable weight is nonnegative.

Formal statement
j :
Fin 5
Proof (Lean source)
lemma k3ScalarLeastFavorableWeight_nonneg (j : Fin 5) : 0 ≤ k3ScalarLeastFavorableWeight j := by have hsqrt : (sqrt 3) ^ 2 = 3 := Real.sq_sqrt (by norm_num) have hsqrt0 := Real.sqrt_nonneg 3 fin_cases j <;> norm_num [k3ScalarLeastFavorableWeight] <;> nlinarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarLeastFavorableWeight_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:519
theorem k3ScalarLeastFavorableWeight_sum

the three-arm scalar least favorable weight sums.

Formal statement
Proof (Lean source)
lemma k3ScalarLeastFavorableWeight_sum : ∑ j : Fin 5, k3ScalarLeastFavorableWeight j = 1 := by norm_num [k3ScalarLeastFavorableWeight, Fin.sum_univ_succ] ring_nf
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarLeastFavorableWeight_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:527
theorem k3ScalarPriorRisk_decomposition

Posterior square completion for the exact five-state scalar prior.

Formal statement
f :
(Fin 3 → Bool) → ℝ
+ ∑ s : Fin 3 → Bool, (∑ j : Fin 5, k3ScalarLeastFavorableWeight j * (∏ i : Fin 3, if s i then (1 + k3MeanLevel j) / 2 else (1 - k3MeanLevel j) / 2)) * (f s - k3ScalarRule s) ^ 2
Proof (Lean source)
lemma k3ScalarPriorRisk_decomposition (f : (Fin 3 → Bool) → ℝ) : k3ScalarPriorRisk f = k3ScalarPriorRisk k3ScalarRule + ∑ s : Fin 3 → Bool, (∑ j : Fin 5, k3ScalarLeastFavorableWeight j * (∏ i : Fin 3, if s i then (1 + k3MeanLevel j) / 2 else (1 - k3MeanLevel j) / 2)) * (f s - k3ScalarRule s) ^ 2 := by unfold k3ScalarPriorRisk k3ScalarScoreRisk simp_rw [Finset.mul_sum] rw [Finset.sum_comm] conv_rhs => lhs rw [Finset.sum_comm] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro s hs have hsqrt : (sqrt 3) ^ 2 = 3 := Real.sq_sqrt (by norm_num) cases h0 : s 0 <;> cases h1 : s 1 <;> cases h2 : s 2 <;> norm_num [Fin.sum_univ_succ, Fin.prod_univ_succ, k3ScalarLeastFavorableWeight, k3MeanLevel, k3ScalarRule, h0, h1, h2] <;> nlinarith [hsqrt]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarPriorRisk_decomposition · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:535
theorem k3ScalarRule_homogeneous_risk

the three-arm scalar rule homogeneous risk property holds.

Formal statement
j :
Fin 5
= ((3 - sqrt 3) / 6) ^ 2 * (3 * (1 - k3MeanLevel j ^ 2))
+ (3 * ((3 - sqrt 3) / 6) * k3MeanLevel j - k3MeanLevel j) ^ 2
Proof (Lean source)
lemma k3ScalarRule_homogeneous_risk (j : Fin 5) : k3ScalarScoreRisk 3 k3ScalarRule (fun _ ↦ j) = ((3 - sqrt 3) / 6) ^ 2 * (3 * (1 - k3MeanLevel j ^ 2)) + (3 * ((3 - sqrt 3) / 6) * k3MeanLevel j - k3MeanLevel j) ^ 2 := by have hsqrt : (sqrt 3) ^ 2 = 3 := Real.sq_sqrt (by norm_num) unfold k3ScalarScoreRisk rw [Fintype.sum_equiv (fin3FunEquiv Bool) _ (fun p ↦ ((if p.1 then (1 + k3MeanLevel j) / 2 else (1 - k3MeanLevel j) / 2) * (if p.2.1 then (1 + k3MeanLevel j) / 2 else (1 - k3MeanLevel j) / 2) * (if p.2.2 then (1 + k3MeanLevel j) / 2 else (1 - k3MeanLevel j) / 2)) * (k3ScalarRule ![p.1, p.2.1, p.2.2] - k3MeanLevel j) ^ 2)] · simp only [Fintype.sum_prod_type] fin_cases j <;> norm_num [k3MeanLevel, k3ScalarRule, Fin.sum_univ_succ] <;> nlinarith [hsqrt] · intro s cases h0 : s 0 <;> cases h1 : s 1 <;> cases h2 : s 2 <;> norm_num [fin3FunEquiv, Fin.sum_univ_succ, Fin.prod_univ_succ, k3ScalarRule, h0, h1, h2] <;> ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarRule_homogeneous_risk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:559
theorem k3ScalarPriorRisk_rule

the three-arm scalar prior risk rule property holds.

Formal statement
Proof (Lean source)
lemma k3ScalarPriorRisk_rule : k3ScalarPriorRisk k3ScalarRule = 1 - sqrt 3 / 2 := by have hsqrt : (sqrt 3) ^ 2 = 3 := Real.sq_sqrt (by norm_num) unfold k3ScalarPriorRisk simp_rw [k3ScalarRule_homogeneous_risk] norm_num [k3ScalarLeastFavorableWeight, k3MeanLevel, k3ScalarRule, Fin.sum_univ_succ] nlinarith [hsqrt]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarPriorRisk_rule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:582
theorem k3ScalarPriorRisk_lower

the three-arm scalar prior risk lower property holds.

Formal statement
f :
(Fin 3 → Bool) → ℝ
1 - sqrt 3 / 2 ≤ k3ScalarPriorRisk f
Proof (Lean source)
lemma k3ScalarPriorRisk_lower (f : (Fin 3 → Bool) → ℝ) : 1 - sqrt 3 / 2 ≤ k3ScalarPriorRisk f := by rw [k3ScalarPriorRisk_decomposition, k3ScalarPriorRisk_rule] apply le_add_of_nonneg_right apply sum_nonneg intro s hs apply mul_nonneg · apply sum_nonneg intro j hj apply mul_nonneg (k3ScalarLeastFavorableWeight_nonneg j) apply Finset.prod_nonneg intro i hi fin_cases j <;> cases s i <;> norm_num [k3MeanLevel] · positivity
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarPriorRisk_lower · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:593
theorem k3ScalarMinimaxValue_ge_exact

The exact prior gives the lower half of the scalar minimax calculation.

Formal statement
1 - sqrt 3 / 2 ≤ k3ScalarMinimaxValue 3
Proof (Lean source)
lemma k3ScalarMinimaxValue_ge_exact : 1 - sqrt 3 / 2 ≤ k3ScalarMinimaxValue 3 := by let S : Set ℝ := {v : ℝ | ∃ f : (Fin 3 → Bool) → ℝ, v = ⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 f mu} have hSne : S.Nonempty := ⟨⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 (fun _ ↦ 0) mu, fun _ ↦ 0, rfl⟩ change _ ≤ sInf S apply le_csInf hSne rintro v ⟨f, rfl⟩ calc 1 - sqrt 3 / 2 ≤ k3ScalarPriorRisk f := k3ScalarPriorRisk_lower f _ ≤ ⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 f mu := by unfold k3ScalarPriorRisk calc ∑ j : Fin 5, k3ScalarLeastFavorableWeight j * k3ScalarScoreRisk 3 f (fun _ ↦ j) ≤ ∑ j : Fin 5, k3ScalarLeastFavorableWeight j * (⨆ mu : Fin 3 → Fin 5, k3ScalarScoreRisk 3 f mu) := by apply Finset.sum_le_sum intro j hj exact mul_le_mul_of_nonneg_left (le_ciSup (Set.finite_range (fun mu : Fin 3 → Fin 5 ↦ k3ScalarScoreRisk 3 f mu)).bddAbove (fun _ ↦ j)) (k3ScalarLeastFavorableWeight_nonneg j) _ = _ := by rw [← Finset.sum_mul, k3ScalarLeastFavorableWeight_sum, one_mul]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3ScalarMinimaxValue_ge_exact · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:610
theorem k3_scalar_score_not_minimax_preserving Proposition 2 in the paper ↗

for the certified three-arm contrast, compressing the full data to the scalar signed score strictly increases the minimax risk.

Formal statement
conclusion 1
n :
0 < n
z :
Schedule 3 n
i :
D :
D.E (fun A => k3SignedScore A (obsOutcome z A) i) = k3Mu z i
D.Var (fun A => k3SignedScore A (obsOutcome z A) i) = 1 - k3Mu z i ^ 2
conclusion 2
n :
0 < n
z :
Schedule 3 n
D :
D.mse (fun A => (∑ i, k3SignedScore A (obsOutcome z A) i) / n) (tauC cDagger z)
= 1 / (n : ℝ) - (∑ i, k3Mu z i ^ 2) / (n : ℝ) ^ 2
conclusion 3
conclusion 4
(fullDataRuleRiskBound : ℝ) < (scalarBayesCertificate : ℝ)
conclusion 5
(scalarBayesCertificate : ℝ) < 1 - sqrt 3 / 2
conclusion 6
∃ fullRule : Estimator 3 3 cDagger,
worstCaseRisk (fun (p : Procedure 3 3 cDagger) (z : Schedule 3 3) => labeledRisk cDagger p z) (prodDesign (fun _ : Unit 3 => qStarDesign cDagger), fullRule)
= fullDataRuleRiskBound
conclusion 7
n :
M :
scalarMomentMinimum n M = if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2
Proof (Lean source)
theorem k3_scalar_score_not_minimax_preserving : (∀ n : ℕ, 0 < n → ∀ z : Schedule 3 n, ∀ i : Unit n, let D := prodDesign (fun _ : Unit n => qStarDesign cDagger) D.E (fun A => k3SignedScore A (obsOutcome z A) i) = k3Mu z i ∧ D.Var (fun A => k3SignedScore A (obsOutcome z A) i) = 1 - k3Mu z i ^ 2) ∧ (∀ n : ℕ, 0 < n → ∀ z : Schedule 3 n, let D := prodDesign (fun _ : Unit n => qStarDesign cDagger) D.mse (fun A => (∑ i, k3SignedScore A (obsOutcome z A) i) / n) (tauC cDagger z) = 1 / (n : ℝ) - (∑ i, k3Mu z i ^ 2) / (n : ℝ) ^ 2) ∧ k3ScalarMinimaxValue 3 = 1 - sqrt 3 / 2 ∧ (fullDataRuleRiskBound : ℝ) < (scalarBayesCertificate : ℝ) ∧ (scalarBayesCertificate : ℝ) < 1 - sqrt 3 / 2 ∧ (∃ fullRule : Estimator 3 3 cDagger, worstCaseRisk (fun (p : Procedure 3 3 cDagger) (z : Schedule 3 3) => labeledRisk cDagger p z) (prodDesign (fun _ : Unit 3 => qStarDesign cDagger), fullRule) = fullDataRuleRiskBound) ∧ (∀ n : ℕ, ∀ M : ℝ, FeasibleK3ScalarTotal n M → scalarMomentMinimum n M = if M ≤ (n : ℝ) / 2 then M / 2 else (3 * M - n) / 2) := by refine ⟨?_, ?_, ?_, k3_rational_separation.1, (by have hsqrt : sqrt 3 < (117787 : ℝ) / 68000 := by rw [Real.sqrt_lt' (by norm_num : (0 : ℝ) < 117787 / 68000)] norm_num norm_num [scalarBayesCertificate] linarith), ?_, ?_⟩ · intro n hn z i exact ⟨k3SignedScore_mean n z i, k3SignedScore_var n z i⟩ · intro n hn z exact k3SignedScore_average_mse n hn z · exact le_antisymm k3ScalarMinimaxValue_le_exact k3ScalarMinimaxValue_ge_exact · exact ⟨k3FullDataRule, k3FullDataRule_worstCaseRisk⟩ · intro n M hM exact scalarMomentMinimum_wedge n M hM
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.k3_scalar_score_not_minimax_preserving · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_k3_scalar_score_not_minimax_preserving.lean:640
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_multiarm_strict_extension 13 declarations Scope comparison: exact binary orbit games for every fixed arm count.

Scope comparison: exact binary orbit games for every fixed arm count.

def AmbientRealSchedule

A common carrier in which schedule domains with different arm counts can be compared.

Definition (Lean source)
n :
AmbientRealSchedule n :
Type
Fin n → ℕ → ℝ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.AmbientRealSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:11
def embedHullSchedule

Extend a two-arm bounded-outcome schedule by zero outside its two treatment arms.

Definition (Lean source)
n :
L U :
Y :
embedHullSchedule Y :
fun i a => if h : a < 2 then Y.1 i ⟨a, h⟩ else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embedHullSchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:14
def embedBinarySchedule

Extend a binary K-arm schedule by zero outside its treatment-arm domain.

Definition (Lean source)
K n :
z :
Schedule K n
embedBinarySchedule z :
fun i a => if h : a < K then if z i ⟨a, h⟩ then 1 else 0 else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.embedBinarySchedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:19

Hull's bounded two-arm schedule domain, embedded in a common real schedule space.

Definition (Lean source)
n :
L U :
HullBoundedScheduleDomain n L U :
range (embedHullSchedule (n := n) (L := L) (U := U))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.HullBoundedScheduleDomain · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:23

The present paper's binary K-arm schedule domain in the same ambient space.

Definition (Lean source)
K n :
BinaryScheduleDomain K n :
range (embedBinarySchedule (K := K) (n := n))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.BinaryScheduleDomain · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:27
theorem twoArmContrast_C0

the two arm contrast c0 property holds.

Formal statement
Proof (Lean source)
lemma twoArmContrast_C0 : C0 twoArmContrast = 1 := by norm_num [C0, Lc, twoArmContrast, ratContrastToReal, twoArmContrastQ, Fin.sum_univ_succ]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmContrast_C0 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:32
theorem twoArm_secondOrder_lower_witness

the two arm second order lower witness property holds.

Formal statement
∃ κ : ℝ,
conclusion 1
0 < κ
conclusion 2
∃ N : ℕ, ∀ n ≥ N, κ * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ dN 2 twoArmContrast n
Proof (Lean source)
lemma twoArm_secondOrder_lower_witness : ∃ κ : ℝ, 0 < κ ∧ ∃ N : ℕ, ∀ n ≥ N, κ * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ dN 2 twoArmContrast n := by have hu := universal_second_order_rate 2 twoArmContrast (by show 2 ≤ (2 : ℕ) omega) rcases hu with ⟨_, _, hk, _, ⟨N, _htail, hN⟩, _⟩ refine ⟨kappaC twoArmContrast, hk, N, ?_⟩ intro n hn have hrho : rhoN 2 n twoArmContrastworstCaseRisk (fun (p : Procedure 2 n twoArmContrast) (z : Schedule 2 n) => labeledRisk twoArmContrast p z) (shrinkageProcedure 2 n twoArmContrast) := by unfold rhoN apply minimaxValue_le_worstCaseRisk_of_nonneg intro p z exact p.1.mse_nonneg _ _ have hrisk := hrho.trans (hN n hn) unfold dN rw [twoArmContrast_C0] at hrisk ⊢ simp only [one_mul, one_div] at hrisk ⊢ linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArm_secondOrder_lower_witness · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:39
theorem hull_not_subset_binary

there are at least two treatment arms, the population size is positive, the stated side condition holds, the hull not subset binary property holds.

Formal statement
K n :
hK :
3 ≤ K
hn :
0 < n
L U :
hLU :
L < U
Proof (Lean source)
lemma hull_not_subset_binary (K n : ℕ) (hK : 3 ≤ K) (hn : 0 < n) (L U : ℝ) (hLU : L < U) : ¬ HullBoundedScheduleDomain n L U ⊆ BinaryScheduleDomain K n := by obtain ⟨v, hvL, hvU, hv0, hv1⟩ : ∃ v : ℝ, L ≤ v ∧ v ≤ U ∧ v ≠ 0 ∧ v ≠ 1 := by by_cases hL0 : L = 0 · by_cases hU1 : U = 1 · refine ⟨1 / 2, ?_⟩ subst L; subst U norm_num · by_cases hU0 : U = 0 · subst L; subst U; linarith · exact ⟨U, le_of_lt hLU, le_rfl, hU0, hU1⟩ · by_cases hL1 : L = 1 · by_cases hU0 : U = 0 · subst L; subst U; linarith · by_cases hU1 : U = 1 · subst L; subst U; linarith · exact ⟨U, le_of_lt hLU, le_rfl, hU0, hU1⟩ · exact ⟨L, le_rfl, le_of_lt hLU, hL0, hL1⟩ let Y : HullSchedule n L U := ⟨fun _ _ => v, fun _ _ => ⟨hvL, hvU⟩⟩ intro hsub obtain ⟨z, hz⟩ := hsub ⟨Y, rfl⟩ have heq := congrFun (congrFun hz (⟨0, hn⟩ : Fin n)) 0 simp [embedHullSchedule, embedBinarySchedule, Y] at heq let a0 : Arm K := ⟨0, by omega⟩ have hK0 : 0 < K := by omega cases hy : z ⟨0, hn⟩ a0 <;> simp [a0, hy, hK0] at heq · exact hv0 heq.symm · exact hv1 heq.symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hull_not_subset_binary · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:65
theorem twoArm_responseType_cases

Every two-arm binary response schedule is one of the four response types that remain separately indexed in the orbit likelihood.

Formal statement
t :
t
= (fun _ => false) ∨ t = twoArmNegativeEffectType ∨ t = twoArmPositiveEffectType ∨ t = (fun _ => true)
Proof (Lean source)
-- @node: twoArm_responseType_cases lemma twoArm_responseType_cases (t : RespType 2) : t = (fun _ => false) ∨ t = twoArmNegativeEffectType ∨ t = twoArmPositiveEffectType ∨ t = (fun _ => true) := by cases h0 : t 0 <;> cases h1 : t 1 · left funext a fin_cases a <;> simp [h0, h1] · right; left funext a fin_cases a <;> simp [twoArmNegativeEffectType, h0, h1] · right; right; left funext a fin_cases a <;> simp [twoArmPositiveEffectType, h0, h1] · right; right; right funext a fin_cases a <;> simp [h0, h1]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArm_responseType_cases · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:97
theorem twoArm_responseTypes_pairwise_distinct

The four two-arm response types are pairwise distinct.

Formal statement
t00 :
fun _ => false (: RespType 2)
t11 :
fun _ => true (: RespType 2)
t00 ≠ t01
t00 ≠ t10
t00 ≠ t11
t01 ≠ t10
t01 ≠ t11
t10 ≠ t11
Proof (Lean source)
-- @node: twoArm_responseTypes_pairwise_distinct lemma twoArm_responseTypes_pairwise_distinct : let t00 : RespType 2 := fun _ => false let t01 : RespType 2 := twoArmNegativeEffectType let t10 : RespType 2 := twoArmPositiveEffectType let t11 : RespType 2 := fun _ => true t00 ≠ t01 ∧ t00 ≠ t10 ∧ t00 ≠ t11 ∧ t01 ≠ t10 ∧ t01 ≠ t11 ∧ t10 ≠ t11 := by dsimp constructor · intro h; have := congrFun h 1; simp [twoArmNegativeEffectType] at this constructor · intro h; have := congrFun h 0; simp [twoArmPositiveEffectType] at this constructor · intro h; have := congrFun h 0; simp at this constructor · intro h have := congrFun h 0 simp [twoArmNegativeEffectType, twoArmPositiveEffectType] at this constructor · intro h; have := congrFun h 0; simp [twoArmNegativeEffectType] at this · intro h; have := congrFun h 1; simp [twoArmPositiveEffectType] at this
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArm_responseTypes_pairwise_distinct · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:116
theorem twoArm_tauCount_eq_effect_difference

the population size is positive, For the contrast (1,-1), only the positive- and negative-effect response types contribute to the orbit target.

Formal statement
n :
hn :
0 < n
m :
tauCount twoArmContrast m = (((pPlus m : ℕ) : ℝ) - ((pMinus m : ℕ) : ℝ)) / n
Proof (Lean source)
-- @node: twoArm_tauCount_eq_effect_difference lemma twoArm_tauCount_eq_effect_difference (n : ℕ) (hn : 0 < n) (m : CountVec 2 n) : tauCount twoArmContrast m = (((pPlus m : ℕ) : ℝ) - ((pMinus m : ℕ) : ℝ)) / n := by let t00 : RespType 2 := fun _ => false let t01 : RespType 2 := twoArmNegativeEffectType let t10 : RespType 2 := twoArmPositiveEffectType let t11 : RespType 2 := fun _ => true have huniv : (Finset.univ : Finset (RespType 2)) = {t00, t01, t10, t11} := by ext t simp only [Finset.mem_univ, Finset.mem_insert, mem_singleton, true_iff] simpa [t00, t01, t10, t11] using twoArm_responseType_cases t let f : RespType 2 → ℝ := fun t => (m.1 t : ℝ) * ∑ a, twoArmContrast a * if t a then 1 else 0 simp only [tauCount] change (n : ℝ)⁻¹ * ∑ t, f t = _ rw [huniv] rcases twoArm_responseTypes_pairwise_distinct with ⟨h01, h02, h03, h12, h13, h23⟩ have hc0 : twoArmContrast (0 : Fin 2) = 1 := by norm_num [twoArmContrast, ratContrastToReal, twoArmContrastQ] have hc1 : twoArmContrast (1 : Fin 2) = -1 := by change ((-1 : ℚ) : ℝ) = -1 norm_num simp [f, t00, t01, t10, t11, pPlus, pMinus, twoArmPositiveEffectType, twoArmNegativeEffectType, Fin.sum_univ_two, h01, h02, h03, h12, h13, h23, hc0, hc1] field_simp ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArm_tauCount_eq_effect_difference · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:140
def multiarmStrictExtensionScope

The multi-arm strict extension scope property holds.

Definition (Lean source)
multiarmStrictExtensionScope :
["no exact second-order constant or source-specific optimizer is delivered", "no bounded-outcome fixed-K-at-least-three extension is asserted", "no multi-arm scalar-nonrepresentability claim is asserted"]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.multiarmStrictExtensionScope · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:173
theorem multiarm_strict_extension Theorem 2 in the paper ↗

with at least three active contrast arms, the multi-arm response-schedule hull strictly contains the binary two-arm subclass while retaining the stated second-order lower witness.

Formal statement
conclusion 2
n :
0 < n
m :
tauCount twoArmContrast m = (((pPlus m : ℕ) : ℝ) - ((pMinus m : ℕ) : ℝ)) / n
conclusion 3
n (m : CountVec 2 n) (r : AllocVec 2 n) (x : ObsVec r) :
t00 :
fun _ => false (: RespType 2)
t11 :
fun _ => true (: RespType 2)
t00 ≠ t01
t00 ≠ t10
t00 ≠ t11
t01 ≠ t10
t01 ≠ t11
t10 ≠ t11
t :
t = t00 ∨ t = t01 ∨ t = t10 ∨ t = t11
orbitLik m r x
= ((∏ a, ((r.1 a : ℕ).factorial : ℚ)) / (n.factorial : ℚ)) * ∑ h ∈ contingencyFiber m r x, ∏ t, (((m.1 t : ℕ).factorial : ℚ) / (∏ a, ((h t a : ℕ).factorial : ℚ)))
conclusion 4
n :
8 ≤ n
dN 2 twoArmContrast n ≤ 43 * (n : ℝ) ^ (-(4 / 3 : ℝ))
conclusion 5
∃ κ : ℝ,
0 < κ
∃ N : ℕ, ∀ n ≥ N, κ * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ dN 2 twoArmContrast n
conclusion 6
K n (c : Contrast ℝ K) :
3 ≤ K
rhoN K n c = orbitGameValue K n c
card (RespType K) = 2 ^ K
conclusion 7
N L U (D : Causalean.Experimentation.DesignBased.FiniteDesign (Assign 2 N)) (est : HullEstimator N) :
(⨆ Y : HullSchedule N L U, hullRisk D est Y) ∈ {v : ℝ | ∃ (D' : FiniteDesign (Assign 2 N)) (est' : HullEstimator N), IsMeasurableHullEstimator est' ∧ v = ⨆ Y : HullSchedule N L U, hullRisk D' est' Y}
conclusion 8
K :
3 ≤ K
n :
0 < n
L U :
L < U
Proof (Lean source)
theorem multiarm_strict_extension : (∀ n, 0 < n → rhoN 2 n twoArmContrast = orbitGameValue 2 n twoArmContrastC0 twoArmContrast = 1) ∧ (∀ n, 0 < n → ∀ m : CountVec 2 n, tauCount twoArmContrast m = (((pPlus m : ℕ) : ℝ) - ((pMinus m : ℕ) : ℝ)) / n) ∧ (∀ n (m : CountVec 2 n) (r : AllocVec 2 n) (x : ObsVec r), let t00 : RespType 2 := fun _ => false let t01 : RespType 2 := twoArmNegativeEffectType let t10 : RespType 2 := twoArmPositiveEffectType let t11 : RespType 2 := fun _ => true t00 ≠ t01 ∧ t00 ≠ t10 ∧ t00 ≠ t11 ∧ t01 ≠ t10 ∧ t01 ≠ t11 ∧ t10 ≠ t11 ∧ (∀ t : RespType 2, t = t00 ∨ t = t01 ∨ t = t10 ∨ t = t11) ∧ orbitLik m r x = ((∏ a, ((r.1 a : ℕ).factorial : ℚ)) / (n.factorial : ℚ)) * ∑ h ∈ contingencyFiber m r x, ∏ t, (((m.1 t : ℕ).factorial : ℚ) / (∏ a, ((h t a : ℕ).factorial : ℚ)))) ∧ (∀ n, 8 ≤ n → dN 2 twoArmContrast n ≤ 43 * (n : ℝ) ^ (-(4 / 3 : ℝ))) ∧ (∃ κ : ℝ, 0 < κ ∧ ∃ N : ℕ, ∀ n ≥ N, κ * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ dN 2 twoArmContrast n) ∧ (∀ K n (c : Contrast ℝ K), 3 ≤ K → rhoN K n c = orbitGameValue K n c ∧ card (RespType K) = 2 ^ K) ∧ (∀ N L U (D : FiniteDesign (Assign 2 N)) (est : HullEstimator N), IsMeasurableHullEstimator est → (⨆ Y : HullSchedule N L U, hullRisk D est Y) ∈ {v : ℝ | ∃ (D' : FiniteDesign (Assign 2 N)) (est' : HullEstimator N), IsMeasurableHullEstimator est' ∧ v = ⨆ Y : HullSchedule N L U, hullRisk D' est' Y}) ∧ (∀ K, 3 ≤ K → ∀ n, 0 < n → ∀ L U : ℝ, L < U → ¬ HullBoundedScheduleDomain n L U ⊆ BinaryScheduleDomain K n) := by refine ⟨?_, twoArm_tauCount_eq_effect_difference, ?_, ?_, twoArm_secondOrder_lower_witness, ?_, ?_, ?_⟩ · intro n hn exact ⟨(exact_response_type_game 2 n twoArmContrast (by norm_num [AdmissibleArmCount])).2.2.2.1, twoArmContrast_C0⟩ · intro n m r x dsimp exact ⟨twoArm_responseTypes_pairwise_distinct.1, twoArm_responseTypes_pairwise_distinct.2.1, twoArm_responseTypes_pairwise_distinct.2.2.1, twoArm_responseTypes_pairwise_distinct.2.2.2.1, twoArm_responseTypes_pairwise_distinct.2.2.2.2.1, twoArm_responseTypes_pairwise_distinct.2.2.2.2.2, twoArm_responseType_cases, rfl⟩ · intro n hn have h := (embedded_two_arm_converse 2 n twoArmContrast (by norm_num [AdmissibleArmCount]) (by omega)).2.2.1 hn simpa [twoArmContrast_C0] using h.2.2 · intro K n c hK exact ⟨(exact_response_type_game K n c (by show 2 ≤ K omega)).2.2.2.1, by simp [RespType, Arm]⟩ · intro N L U D est hest exact ⟨D, est, hest, rfl⟩ · intro K hK n hn L U hLU exact hull_not_subset_binary K n hK hn L U hLU
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.multiarm_strict_extension · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_multiarm_strict_extension.lean:180
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_rational_contrast_grid_certificate_sandwich 5 declarations Exact rational primal/dual certificates and their asymptotic sandwich.

Exact rational primal/dual certificates and their asymptotic sandwich.

A choice, at every positive population size, of the exact primal/dual grid certificate and its barycenter procedure.

Definition (Lean source)
K :
shared
c :
Mseq :
ℕ → ℕ
pi :
∀ k, GridPi K k
w :
∀ k, GridWeight K k (Mseq k)
u :
ℕ → ℚ
nu :
∀ k
if
then
delta :
∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ
k :
0 < k
IsRationalGridCertificateSequence c Mseq pi w u nu delta :
Prop
clause 1
ExactGridPrimalDualCertificate c (pi k) (w k) (u k) (nu k)
clause 2
IsGridBarycenter c (pi k) (w k) (delta k)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsRationalGridCertificateSequence · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_rational_contrast_grid_certificate_sandwich.lean:11

The actual certificate gaps vanish at every scale dominated by the squared grid resolution; conditionally on a normalized minimax limit, both certificate improvements have the same limit. The final clause records explicitly the paper's universal a_n = n^(4/3), M_n = n specialization.

Definition (Lean source)
K :
shared
c :
RationalGridCertificateAsymptotics c :
Prop
clause 1
Mseq :
ℕ → ℕ
pi :
∀ k, GridPi K k
w :
∀ k, GridWeight K k (Mseq k)
u :
ℕ → ℚ
nu :
∀ k
if
then
delta :
∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ
IsRationalGridCertificateSequence c Mseq pi w u nu delta
(∀ k, 0 < k → 0 < Mseq k)
Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0)
Tendsto (fun k => a k * (upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k))) atTop (nhds 0)
C :
Tendsto (fun k => a k * dN K (ratContrastToReal c) k) atTop (nhds C)
Tendsto (fun k => a k * (C0 (ratContrastToReal c) / k - upperCertificate c (pi k) (delta k))) atTop (nhds C)
Tendsto (fun k => a k * (C0 (ratContrastToReal c) / k - lowerCertificate c (nu k))) atTop (nhds C)
clause 2
pi :
∀ k, GridPi K k
w :
∀ k, GridWeight K k k
u :
ℕ → ℚ
nu :
∀ k
if
then
delta :
∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ
IsRationalGridCertificateSequence c (fun k => k) pi w u nu delta
Tendsto (fun k => secondOrderScale k * (upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k))) atTop (nhds 0)
C :
Tendsto (fun k => secondOrderScale k * (C0 (ratContrastToReal c) / k - upperCertificate c (pi k) (delta k))) atTop (nhds C)
Tendsto (fun k => secondOrderScale k * (C0 (ratContrastToReal c) / k - lowerCertificate c (nu k))) atTop (nhds C)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RationalGridCertificateAsymptotics · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_rational_contrast_grid_certificate_sandwich.lean:23
theorem selectRationalGridCertificateSequence

the stated side condition holds, the select rational grid certificate sequence property holds.

Formal statement
K :
shared
c :
Mseq :
ℕ → ℕ
hMseq :
∀ k
if
0 < k
then
0 < Mseq k
∃ (pi : ∀ k, GridPi K k) (w : ∀ k, GridWeight K k (Mseq k)) (u : ℕ → ℚ) (nu : ∀ k, CountVec K k → ℚ) (delta : ∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ),
IsRationalGridCertificateSequence c Mseq pi w u nu delta
conclusion 1
k :
0 < k
rhoN K k (ratContrastToReal c) ≤ upperCertificate c (pi k) (delta k)
upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k)
C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2)
Proof (Lean source)
lemma selectRationalGridCertificateSequence (c : RatContrast K) (Mseq : ℕ → ℕ) (hMseq : ∀ k, 0 < k → 0 < Mseq k) : ∃ (pi : ∀ k, GridPi K k) (w : ∀ k, GridWeight K k (Mseq k)) (u : ℕ → ℚ) (nu : ∀ k, CountVec K k → ℚ) (delta : ∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ), IsRationalGridCertificateSequence c Mseq pi w u nu delta ∧ ∀ k, 0 < k → lowerCertificate c (nu k) ≤ rhoN K k (ratContrastToReal c) ∧ rhoN K k (ratContrastToReal c) ≤ upperCertificate c (pi k) (delta k) ∧ upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k) ≤ C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2) := by classical choose piP wP uP nuP hcertP huP using fun k : PositiveNat => exists_exact_grid_primal_dual_certificate c k.2 (hMseq k k.2) let pi : ∀ k, GridPi K k := fun k => if hk : 0 < k then piP ⟨k, hk⟩ else fun _ => 0 let w : ∀ k, GridWeight K k (Mseq k) := fun k => if hk : 0 < k then wP ⟨k, hk⟩ else fun _ _ _ => 0 let u : ℕ → ℚ := fun k => if hk : 0 < k then uP ⟨k, hk⟩ else 0 let nu : ∀ k, CountVec K k → ℚ := fun k => if hk : 0 < k then nuP ⟨k, hk⟩ else fun _ => 0 let delta : ∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ := fun k r x => if _h : 0 < pi k r then ∑ g, (gammaMC (Mseq k) c g : ℝ) * w k r x g / (pi k r : ℝ) else 0 refine ⟨pi, w, u, nu, delta, ?_, ?_⟩ · intro k hk have hcert := hcertP ⟨k, hk⟩ have hcert' : ExactGridPrimalDualCertificate c (pi k) (w k) (u k) (nu k) := by simpa [pi, w, u, nu, hk] using hcert refine ⟨hcert', ?_⟩ intro r x rfl · intro k hk have hcert := hcertP ⟨k, hk⟩ have hu := huP ⟨k, hk⟩ have hcert' : ExactGridPrimalDualCertificate c (pi k) (w k) (u k) (nu k) := by simpa [pi, w, u, nu, hk] using hcert have hu' : (u k : ℝ) = gridLPValue K k (Mseq k) c hk (hMseq k hk) := by rw [show u k = uP ⟨k, hk⟩ by simp [u, hk]] exact hu have hbar : IsGridBarycenter c (pi k) (w k) (delta k) := by intro r x rfl rcases hcert' with ⟨wQ, y, hw, hpr, hy, hnuEq, huDual⟩ have hcert'' : ExactGridPrimalDualCertificate c (pi k) (w k) (u k) (nu k) := ⟨wQ, y, hw, hpr, hy, hnuEq, huDual⟩ have hnu : IsRationalPrior (nu k) := by rw [hnuEq] exact ⟨hy.2.2.2.2.2.1, hy.2.2.2.2.2.2.1⟩ have hlower := lowerCertificate_le_rhoN c hk (nu k) hnu have hrho : rhoN K k (ratContrastToReal c) ≤ upperCertificate c (pi k) (delta k) := by apply rhoN_le_upperCertificate c (hMseq k hk) (pi k) (w k) (delta k) · exact ⟨wQ, u k, hw, hpr⟩ · exact hbar have hupper : upperCertificate c (pi k) (delta k) ≤ gridLPValue K k (Mseq k) c hk (hMseq k hk) := by rw [← hu'] exact upperCertificate_le_gridObjective c (pi k) (w k) (u k) (delta k) (nu k) hcert'' hbar have hmesh : gridLPValue K k (Mseq k) c hk (hMseq k hk) ≤ lowerCertificate c (nu k) + C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2) := by rw [← hu'] simpa using gridObjective_le_lowerCertificate_add_mesh c hk (hMseq k hk) (pi k) (w k) (u k) (nu k) hcert'' exact ⟨hlower, hrho, by linarith⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.selectRationalGridCertificateSequence · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_rational_contrast_grid_certificate_sandwich.lean:69
theorem rationalGridCertificateAsymptotics_proof

the rational grid certificate asymptotics proof property holds.

Formal statement
K :
shared
c :
Proof (Lean source)
lemma rationalGridCertificateAsymptotics_proof (c : RatContrast K) : RationalGridCertificateAsymptotics c := by classical have hfixed : ∀ (Mseq : ℕ → ℕ) (pi : ∀ k, GridPi K k) (w : ∀ k, GridWeight K k (Mseq k)) (u : ℕ → ℚ) (nu : ∀ k, CountVec K k → ℚ) (delta : ∀ k, ∀ r : AllocVec K k, ObsVec r → ℝ), IsRationalGridCertificateSequence c Mseq pi w u nu delta → ∀ (a : PositiveSequence), (∀ k, 0 < k → 0 < Mseq k) → Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0) → Tendsto (fun k => a k * (upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k))) atTop (nhds 0) ∧ ∀ C, Tendsto (fun k => a k * dN K (ratContrastToReal c) k) atTop (nhds C) → Tendsto (fun k => a k * (C0 (ratContrastToReal c) / k - upperCertificate c (pi k) (delta k))) atTop (nhds C) ∧ Tendsto (fun k => a k * (C0 (ratContrastToReal c) / k - lowerCertificate c (nu k))) atTop (nhds C) := by intro Mseq pi w u nu delta hseq a hMseq hmesh have hbounds : ∀ k, 0 < k → lowerCertificate c (nu k) ≤ rhoN K k (ratContrastToReal c) ∧ rhoN K k (ratContrastToReal c) ≤ upperCertificate c (pi k) (delta k) ∧ upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k) ≤ C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2) := by intro k hk rcases hseq k hk with ⟨hcert, hbar⟩ rcases hcert with ⟨wQ, y, hw, hpr, hy, hnuEq, huDual⟩ have hcert' : ExactGridPrimalDualCertificate c (pi k) (w k) (u k) (nu k) := ⟨wQ, y, hw, hpr, hy, hnuEq, huDual⟩ have hnu : IsRationalPrior (nu k) := by rw [hnuEq] exact ⟨hy.2.2.2.2.2.1, hy.2.2.2.2.2.2.1⟩ have hlower := lowerCertificate_le_rhoN c hk (nu k) hnu have hrho : rhoN K k (ratContrastToReal c) ≤ upperCertificate c (pi k) (delta k) := by apply rhoN_le_upperCertificate c (hMseq k hk) (pi k) (w k) (delta k) · exact ⟨wQ, u k, hw, hpr⟩ · exact hbar have hupper : upperCertificate c (pi k) (delta k) ≤ (u k : ℝ) := upperCertificate_le_gridObjective c (pi k) (w k) (u k) (delta k) (nu k) hcert' hbar have hmesh' : (u k : ℝ) ≤ lowerCertificate c (nu k) + C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2) := by simpa using gridObjective_le_lowerCertificate_add_mesh c hk (hMseq k hk) (pi k) (w k) (u k) (nu k) hcert' exact ⟨hlower, hrho, by linarith⟩ have hkpos : ∀ᶠ k : ℕ in atTop, 0 < k := eventually_atTop.2 ⟨1, fun k hk => by omega⟩ have hmeshC : Tendsto (fun k => a k * (C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2))) atTop (nhds 0) := by convert hmesh.const_mul (C0 (ratContrastToReal c) / 4) using 1 · funext k ring · norm_num have hgap : Tendsto (fun k => a k * (upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k))) atTop (nhds 0) := by apply squeeze_zero' (g := fun k => a k * (C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2))) · filter_upwards [hkpos] with k hk have hb := hbounds k hk exact mul_nonneg (le_of_lt (a.2 k)) (sub_nonneg.mpr (hb.1.trans hb.2.1)) · filter_upwards [hkpos] with k hk exact mul_le_mul_of_nonneg_left (hbounds k hk).2.2 (le_of_lt (a.2 k)) · exact hmeshC refine ⟨hgap, ?_⟩ intro C htarget have huerr : Tendsto (fun k => a k * (upperCertificate c (pi k) (delta k) - rhoN K k (ratContrastToReal c))) atTop (nhds 0) := by apply squeeze_zero' (g := fun k => a k * (upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k))) · filter_upwards [hkpos] with k hk exact mul_nonneg (le_of_lt (a.2 k)) (sub_nonneg.mpr (hbounds k hk).2.1) · filter_upwards [hkpos] with k hk have hb := hbounds k hk exact mul_le_mul_of_nonneg_left (by linarith [hb.1]) (le_of_lt (a.2 k)) · exact hgap have hlerr : Tendsto (fun k => a k * (rhoN K k (ratContrastToReal c) - lowerCertificate c (nu k))) atTop (nhds 0) := by apply squeeze_zero' (g := fun k => a k * (upperCertificate c (pi k) (delta k) - lowerCertificate c (nu k))) · filter_upwards [hkpos] with k hk exact mul_nonneg (le_of_lt (a.2 k)) (sub_nonneg.mpr (hbounds k hk).1) · filter_upwards [hkpos] with k hk have hb := hbounds k hk exact mul_le_mul_of_nonneg_left (by linarith [hb.2.1]) (le_of_lt (a.2 k)) · exact hgap constructor · convert htarget.sub huerr using 1 <;> simp [dN] funext k ring · convert htarget.add hlerr using 1 <;> simp [dN] funext k ring refine ⟨hfixed, ?_⟩ intro pi w u nu delta hseq let a : PositiveSequence := ⟨fun k => if k = 0 then 1 else secondOrderScale k, fun k => by change 0 < (if k = 0 then 1 else secondOrderScale k) split_ifs with hk · norm_num · unfold secondOrderScale exact Real.rpow_pos_of_pos (by exact_mod_cast Nat.pos_of_ne_zero hk) _⟩ have haeq : (a : ℕ → ℝ) =ᶠ[atTop] secondOrderScale := by filter_upwards [Ici_mem_atTop 1] with k hk simp [a, Nat.ne_of_gt (Nat.zero_lt_one.trans_le hk)] have hscale : Tendsto (fun k : ℕ => secondOrderScale k / (k : ℝ) ^ 2) atTop (nhds 0) := by have hp : Tendsto (fun k : ℕ => (k : ℝ) ^ (-(2 / 3 : ℝ))) atTop (nhds 0) := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 2 / 3)).comp tendsto_natCast_atTop_atTop apply hp.congr' filter_upwards [Ici_mem_atTop 1] with k hk have hkR : (0 : ℝ) < k := by exact_mod_cast hk unfold secondOrderScale rw [show (k : ℝ) ^ (2 : ℕ) = (k : ℝ) ^ (2 : ℝ) by exact (Real.rpow_natCast _ 2).symm, ← Real.rpow_sub hkR] norm_num have hamesh : Tendsto (fun k => a k / (k : ℝ) ^ 2) atTop (nhds 0) := hscale.congr' (haeq.div (Filter.Eventually.of_forall fun _ => rfl)).symm obtain ⟨hgap, hlimits⟩ := hfixed (fun k => k) pi w u nu delta hseq a (fun _ hk => hk) hamesh refine ⟨?_, ?_⟩ · exact hgap.congr' (haeq.mul (Filter.Eventually.of_forall fun _ => rfl)) · intro C htarget have htarget' : Tendsto (fun k => a k * dN K (ratContrastToReal c) k) atTop (nhds C) := htarget.congr' (haeq.mul (Filter.Eventually.of_forall fun _ => rfl)).symm obtain ⟨hupper, hlower⟩ := hlimits C htarget' exact ⟨ hupper.congr' (haeq.mul (Filter.Eventually.of_forall fun _ => rfl)), hlower.congr' (haeq.mul (Filter.Eventually.of_forall fun _ => rfl))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rationalGridCertificateAsymptotics_proof · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_rational_contrast_grid_certificate_sandwich.lean:140
theorem rational_contrast_grid_certificate_sandwich Theorem 7 in the paper ↗

the population size is positive, the grid resolution is positive, for a rational contrast, the finite grid lower and upper certificates sandwich the minimax excess risk and become asymptotically sharp as the mesh vanishes.

Formal statement
K n M :
c :
hn :
0 < n
hM :
0 < M
∃ (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ),
IsGridBarycenter c pi w delta
(u : ℝ) = gridLPValue K n M c hn hM
rhoN K n (ratContrastToReal c) ≤ upperCertificate c pi delta
upperCertificate c pi delta ≤ gridLPValue K n M c hn hM
gridLPValue K n M c hn hM ≤ lowerCertificate c nu + C0 (ratContrastToReal c) / (4 * M ^ 2)
card (CountVec K n) = choose (n + 2 ^ K - 1) (2 ^ K - 1)
card (AllocVec K n) = choose (n + K - 1) (K - 1)
(∑ r : AllocVec K n, card (ObsVec r)) = choose (n + 2 * K - 1) (2 * K - 1)
conclusion 1
Mseq :
ℕ → ℕ
(∀ k, 0 < Mseq k)
Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0)
Tendsto (fun k => a k * (C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2))) atTop (nhds 0)
Proof (Lean source)
theorem rational_contrast_grid_certificate_sandwich (K n M : ℕ) (c : RatContrast K) (hn : 0 < n) (hM : 0 < M) : ∃ (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ), ExactGridPrimalDualCertificate c pi w u nu ∧ IsGridBarycenter c pi w delta ∧ (u : ℝ) = gridLPValue K n M c hn hM ∧ lowerCertificate c nu ≤ rhoN K n (ratContrastToReal c) ∧ rhoN K n (ratContrastToReal c) ≤ upperCertificate c pi delta ∧ upperCertificate c pi delta ≤ gridLPValue K n M c hn hM ∧ gridLPValue K n M c hn hM ≤ lowerCertificate c nu + C0 (ratContrastToReal c) / (4 * M ^ 2) ∧ card (CountVec K n) = choose (n + 2 ^ K - 1) (2 ^ K - 1) ∧ card (AllocVec K n) = choose (n + K - 1) (K - 1) ∧ (∑ r : AllocVec K n, card (ObsVec r)) = choose (n + 2 * K - 1) (2 * K - 1) ∧ (∀ (a : PositiveSequence) (Mseq : ℕ → ℕ), (∀ k, 0 < Mseq k) → Tendsto (fun k => a k / (Mseq k : ℝ) ^ 2) atTop (nhds 0) → Tendsto (fun k => a k * (C0 (ratContrastToReal c) / (4 * (Mseq k : ℝ) ^ 2))) atTop (nhds 0)) ∧ RationalGridCertificateAsymptotics c := by classical obtain ⟨pi, w, u, nu, hcert, hu⟩ := exists_exact_grid_primal_dual_certificate c hn hM let delta : ∀ r : AllocVec K n, ObsVec r → ℝ := fun r x => if _h : 0 < pi r then ∑ g, (gammaMC M c g : ℝ) * w r x g / (pi r : ℝ) else 0 have hbar : IsGridBarycenter c pi w delta := by intro r x rfl rcases hcert with ⟨wQ, y, hw, hpr, hy, hnuEq, huDual⟩ have hcert' : ExactGridPrimalDualCertificate c pi w u nu := ⟨wQ, y, hw, hpr, hy, hnuEq, huDual⟩ have hnu : IsRationalPrior nu := by rw [hnuEq] exact ⟨hy.2.2.2.2.2.1, hy.2.2.2.2.2.2.1⟩ have hlower : lowerCertificate c nu ≤ rhoN K n (ratContrastToReal c) := lowerCertificate_le_rhoN c hn nu hnu have hrho : rhoN K n (ratContrastToReal c) ≤ upperCertificate c pi delta := by apply rhoN_le_upperCertificate c hM pi w delta · exact ⟨wQ, u, hw, hpr⟩ · exact hbar have hupper : upperCertificate c pi delta ≤ gridLPValue K n M c hn hM := by rw [← hu] exact upperCertificate_le_gridObjective c pi w u delta nu hcert' hbar have hmesh : gridLPValue K n M c hn hM ≤ lowerCertificate c nu + C0 (ratContrastToReal c) / (4 * M ^ 2) := by rw [← hu] simpa using gridObjective_le_lowerCertificate_add_mesh c hn hM pi w u nu hcert' have hK := rationalContrast_admissibleArmCount c refine ⟨pi, w, u, nu, delta, hcert', hbar, hu, hlower, hrho, hupper, hmesh, response_count_cardinality, allocation_count_cardinality hK, allocation_observation_cardinality hK, ?_, ?_⟩ · intro a Mseq _hMseq hlim have hmul := hlim.const_mul (C0 (ratContrastToReal c) / 4) convert hmul using 1 · funext k ring · norm_num · exact rationalGridCertificateAsymptotics_proof c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rational_contrast_grid_certificate_sandwich · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_rational_contrast_grid_certificate_sandwich.lean:284
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_real_contrast_grid_certificate_transfer 18 declarations Transfer of exact rational finite-program certificates to real contrasts.

Transfer of exact rational finite-program certificates to real contrasts.

The full-data rule uses exactly pi's uniform allocation-orbit lift and the projection of the same upstream barycenter delta.

Definition (Lean source)
K n :
c :
Contrast ℝ K
pi :
GridPi K n
delta :
∀ r : AllocVec K n
if
then
p :
Procedure K n c
Rplus :
IsProjectedUpperProcedureCertificate K n c pi delta p Rplus :
Prop
clause 1
A :
clause 2
A y :
(p.2 A y : ℝ) = clip c (delta (assignmentCounts A) (observedCounts A y))
clause 3
worstCaseRisk (fun (q : Procedure K n c) (z : Schedule K n) => labeledRisk c q z) p
≤ Rplus
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsProjectedUpperProcedureCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:13

Cardinality of the labeled-schedule orbit having response counts m.

Definition (Lean source)
K :
shared
n :
shared
m :
responseCountOrbitCard m :
by exact card {z : Schedule K n // scheduleCounts z = m}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.responseCountOrbitCard · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:25
theorem responseCountOrbitCard_pos

the response count orbit cardinality is positive.

Formal statement
K :
shared
n :
shared
m :
Proof (Lean source)
lemma responseCountOrbitCard_pos (m : CountVec K n) : 0 < responseCountOrbitCard m := by obtain ⟨z, hz⟩ := exists_fun_card_fiber_eq (C := RespType K) (fun t => (m.1 t : ℕ)) m.2 have hm : scheduleCounts z = m := by apply Subtype.ext funext t apply Fin.ext simpa [scheduleCounts, rawScheduleCount] using hz t unfold responseCountOrbitCard letI : Nonempty {z : Schedule K n // scheduleCounts z = m} := ⟨⟨z, hm⟩⟩ exact Nat.card_pos (α := {z : Schedule K n // scheduleCounts z = m})
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.responseCountOrbitCard_pos · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:31
theorem responseCountFiber_card

the response count fiber cardinality property holds.

Formal statement
K :
shared
n :
shared
m :
card {z : Schedule K n // scheduleCounts z = m} = responseCountOrbitCard m
Proof (Lean source)
lemma responseCountFiber_card (m : CountVec K n) : card {z : Schedule K n // scheduleCounts z = m} = responseCountOrbitCard m := by rfl
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.responseCountFiber_card · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:46
theorem scheduleCounts_permute_eq

the schedule counts permute equals property holds.

Formal statement
n :
shared
K :
shared
sigma :
z :
Schedule K n
Proof (Lean source)
lemma scheduleCounts_permute_eq (sigma : Perm (Unit n)) (z : Schedule K n) : scheduleCounts (permuteSchedule sigma z) = scheduleCounts z := by apply Subtype.ext funext t apply Fin.ext change (Finset.univ.filter fun i => z (sigma.symm i) = t).card = (Finset.univ.filter fun i => z i = t).card let e : {i : Unit n // z i = t} ≃ {i : Unit n // z (sigma.symm i) = t} := { toFun := fun i => ⟨sigma i.1, by simpa using i.2⟩ invFun := fun i => ⟨sigma.symm i.1, i.2⟩ left_inv := by intro i; apply Subtype.ext; exact sigma.symm_apply_apply i.1 right_inv := by intro i; apply Subtype.ext; exact sigma.apply_symm_apply i.1 } simpa only [Fintype.card_subtype] using Fintype.card_congr e |>.symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scheduleCounts_permute_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:53
def schedulePriorOfRationalPrior

A rational prior on response-count orbits induces a labeled schedule prior by spreading each orbit mass uniformly over its schedules.

Definition (Lean source)
K :
shared
n :
shared
nu :
CountVec K n → ℚ
hnu :
schedulePriorOfRationalPrior nu hnu :
FiniteDesign (Schedule K n)
clause 1
p z := (nu (scheduleCounts z) : ℝ) / responseCountOrbitCard (scheduleCounts z)
clause 2
p_nonneg z := div_nonneg (by exact_mod_cast hnu.1 (scheduleCounts z)) (Nat.cast_nonneg _)
clause 3
p_sum := by classical rw [← Finset.sum_fiberwise univ scheduleCounts (fun z => (nu (scheduleCounts z) : ℝ) / responseCountOrbitCard (scheduleCounts z))] calc ∑ m : CountVec K n, ∑ z : Schedule K n with scheduleCounts z
= m, (nu (scheduleCounts z) : ℝ) / responseCountOrbitCard (scheduleCounts z) = ∑ m : CountVec K n, (nu m : ℝ) := by apply Finset.sum_congr rfl intro m _ rw [Finset.sum_congr rfl (fun z hz => by simp only [mem_filter] at hz rw [hz.2])] rw [Finset.sum_const, nsmul_eq_mul] letI := ofFinite {z : Schedule K n // scheduleCounts z = m} rw [← Fintype.card_subtype, ← Nat.card_eq_fintype_card, responseCountFiber_card] have hm : (responseCountOrbitCard m : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (responseCountOrbitCard_pos m)) exact mul_div_cancel₀ _ hm _ = 1 := by exact_mod_cast hnu.2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfRationalPrior · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:70
theorem schedulePriorOfRationalPrior_permute

the stated side condition holds, the schedule prior when rational prior permute property holds.

Formal statement
K :
shared
n :
shared
nu :
CountVec K n → ℚ
hnu :
sigma :
z :
Schedule K n
Proof (Lean source)
lemma schedulePriorOfRationalPrior_permute (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (sigma : Perm (Unit n)) (z : Schedule K n) : (schedulePriorOfRationalPrior nu hnu).p (permuteSchedule sigma z) = (schedulePriorOfRationalPrior nu hnu).p z := by simp [schedulePriorOfRationalPrior, scheduleCounts_permute_eq]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfRationalPrior_permute · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:102
theorem schedulePriorOfRationalPrior_E_permute

the stated side condition holds, the schedule prior when rational prior e permute property holds.

Formal statement
K :
shared
n :
shared
nu :
CountVec K n → ℚ
hnu :
sigma :
f :
Schedule K n → ℝ
(schedulePriorOfRationalPrior nu hnu).E (fun z => f (permuteSchedule sigma z))
Proof (Lean source)
lemma schedulePriorOfRationalPrior_E_permute (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (sigma : Perm (Unit n)) (f : Schedule K n → ℝ) : (schedulePriorOfRationalPrior nu hnu).E (fun z => f (permuteSchedule sigma z)) = (schedulePriorOfRationalPrior nu hnu).E f := by classical unfold Causalean.Experimentation.DesignBased.FiniteDesign.E let e : Perm (Schedule K n) := { toFun := permuteSchedule sigma invFun := permuteSchedule sigma.symm left_inv := by intro z funext i change z (sigma.symm (sigma i)) = z i rw [sigma.symm_apply_apply] right_inv := by intro z funext i change z (sigma (sigma.symm i)) = z i rw [sigma.apply_symm_apply] } have hsum := Equiv.sum_comp e (fun z => (schedulePriorOfRationalPrior nu hnu).p z * f z) dsimp [e] at hsum simpa only [e, schedulePriorOfRationalPrior_permute] using hsum
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfRationalPrior_E_permute · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:111
theorem schedulePriorOfRationalPrior_E_count

the stated side condition holds, the schedule prior when rational prior e count property holds.

Formal statement
K :
shared
n :
shared
nu :
CountVec K n → ℚ
hnu :
f :
CountVec K n → ℝ
(schedulePriorOfRationalPrior nu hnu).E (fun z => f (scheduleCounts z))
= ∑ m, (nu m : ℝ) * f m
Proof (Lean source)
lemma schedulePriorOfRationalPrior_E_count (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (f : CountVec K n → ℝ) : (schedulePriorOfRationalPrior nu hnu).E (fun z => f (scheduleCounts z)) = ∑ m, (nu m : ℝ) * f m := by classical unfold E rw [← Finset.sum_fiberwise univ scheduleCounts (fun z => (schedulePriorOfRationalPrior nu hnu).p z * f (scheduleCounts z))] apply Finset.sum_congr rfl intro m _ calc _ = ∑ _z : Schedule K n with scheduleCounts _z = m, (nu m : ℝ) / responseCountOrbitCard m * f m := by apply Finset.sum_congr rfl intro z hz simp only [mem_filter] at hz simp [schedulePriorOfRationalPrior, hz.2] _ = _ := by rw [Finset.sum_const, nsmul_eq_mul] letI := ofFinite {z : Schedule K n // scheduleCounts z = m} rw [← Fintype.card_subtype, ← Nat.card_eq_fintype_card, responseCountFiber_card] have hm : (responseCountOrbitCard m : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (responseCountOrbitCard_pos m)) field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.schedulePriorOfRationalPrior_E_count · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:138
theorem lowerCertificate_le_schedulePriorRisk

the population size is positive, the stated side condition holds, the lower certificate is at most schedule prior risk.

Formal statement
K :
shared
n :
shared
q :
hn :
0 < n
nu :
CountVec K n → ℚ
hnu :
p :
Procedure K n (ratContrastToReal q)
Proof (Lean source)
lemma lowerCertificate_le_schedulePriorRisk (q : RatContrast K) (hn : 0 < n) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (p : Procedure K n (ratContrastToReal q)) : lowerCertificate q nu ≤ (schedulePriorOfRationalPrior nu hnu).E (fun z => labeledRisk (ratContrastToReal q) p z) := by classical have hK := rationalContrast_admissibleArmCount q have hKpos : 0 < K := by unfold AdmissibleArmCount at hK; omega letI : Nonempty (Arm K) := Fintype.card_pos_iff.mp (by simpa using hKpos) letI : Nonempty (AllocVec K n) := ⟨assignmentCounts (fun _ => choice inferInstance)⟩ letI : Fintype (Perm (Unit n)) := ofFinite _ obtain ⟨pbar, qo, _hinv, _havg, _hpbar, hdom⟩ := lossless_symmetrization (ratContrastToReal q) p let qo' : Procedure (fun r : AllocVec K n => ObsVec r) (-Lc (ratContrastToReal q) / 2) (Lc (ratContrastToReal q) / 2) := ⟨qo.1, qo.2⟩ have horbit : lowerCertificate q nu ≤ ∑ m, (nu m : ℝ) * orbitRisk (ratContrastToReal q) qo m := by rw [lowerCertificate_eq_posteriorResidual_sInf q nu hnu] simpa [rationalPriorOf, rationalOrbitModel, orbitRisk, tauCountRat_cast, risk, qo'] using (rationalOrbitModel (n := n) q).sInf_posteriorResidual_le_priorRisk (rationalPriorOf nu hnu) qo' calc lowerCertificate q nu ≤ (schedulePriorOfRationalPrior nu hnu).E (fun z => orbitRisk (ratContrastToReal q) qo (scheduleCounts z)) := by simpa [schedulePriorOfRationalPrior_E_count] using horbit _ ≤ (schedulePriorOfRationalPrior nu hnu).E (fun z => (card (Perm (Unit n)) : ℝ)⁻¹ * ∑ sigma : Perm (Unit n), labeledRisk (ratContrastToReal q) p (permuteSchedule sigma z)) := by unfold E apply Finset.sum_le_sum intro z _ apply mul_le_mul_of_nonneg_left · change orbitRisk (ratContrastToReal q) qo (scheduleCounts z) ≤ _ simpa only [] using hdom z · exact ((schedulePriorOfRationalPrior nu hnu).p_nonneg z) _ = (schedulePriorOfRationalPrior nu hnu).E (fun z => labeledRisk (ratContrastToReal q) p z) := by rw [(schedulePriorOfRationalPrior nu hnu).E_const_mul] rw [(schedulePriorOfRationalPrior nu hnu).E_sum] rw [Finset.sum_congr rfl (fun sigma _ => schedulePriorOfRationalPrior_E_permute nu hnu sigma (fun z => labeledRisk (ratContrastToReal q) p z))] rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] have hcard : (card (Perm (Unit n)) : ℝ) ≠ 0 := by positivity field_simp
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lowerCertificate_le_schedulePriorRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:167
theorem lowerCertificate_nonneg

the stated side condition holds, the lower certificate is nonnegative.

Formal statement
K :
shared
n :
shared
q :
nu :
CountVec K n → ℚ
hnu :
0 ≤ lowerCertificate q nu
Proof (Lean source)
lemma lowerCertificate_nonneg (q : RatContrast K) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) : 0 ≤ lowerCertificate q nu := by have hK := rationalContrast_admissibleArmCount q have hKpos : 0 < K := by unfold AdmissibleArmCount at hK; omega letI : Nonempty (Arm K) := Fintype.card_pos_iff.mp (by simpa using hKpos) letI : Nonempty (AllocVec K n) := ⟨assignmentCounts (fun _ => choice inferInstance)⟩ rw [lowerCertificate_eq_posteriorResidual_sInf q nu hnu] apply le_csInf · exact Set.range_nonempty _ · rintro _ ⟨r, rfl⟩ exact (rationalOrbitModel q).posteriorResidual_nonneg (rationalPriorOf nu hnu) r
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.lowerCertificate_nonneg · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:224
theorem transferredSchedulePrior_lowerBound

the population size is positive, the stated side condition holds, the transferred schedule prior lower bound property holds.

Formal statement
K :
shared
n :
shared
c :
Contrast ℝ K
q :
hn :
0 < n
nu :
CountVec K n → ℚ
hnu :
p :
Procedure K n c
Proof (Lean source)
lemma transferredSchedulePrior_lowerBound (c : Contrast ℝ K) (q : RatContrast K) (hn : 0 < n) (nu : CountVec K n → ℚ) (hnu : IsRationalPrior nu) (p : Procedure K n c) : (max 0 (sqrt (lowerCertificate q nu) - contrastDistance c (ratContrastToReal q))) ^ 2 ≤ (schedulePriorOfRationalPrior nu hnu).E (fun z => labeledRisk c p z) := by let prior := schedulePriorOfRationalPrior nu hnu let eta := contrastDistance c (ratContrastToReal q) let V := prior.E (fun z => labeledRisk c p z) have heta : 0 ≤ eta := by unfold eta contrastDistance; positivity have hV : 0 ≤ V := prior.E_nonneg (fun z => p.1.mse_nonneg _ _) have hroot (z : Schedule K n) : sqrt (labeledRisk (ratContrastToReal q) (transferProcedure (ratContrastToReal q) p) z) ≤ sqrt (labeledRisk c p z) + eta := by have hsymm : contrastDistance (ratContrastToReal q) c = eta := by unfold eta contrastDistance congr 1 apply Finset.sum_congr rfl intro a _ exact abs_sub_comm _ _ simpa [hsymm] using transferred_root_risk_le (ratContrastToReal q) c p z hn have hpoint (z : Schedule K n) : labeledRisk (ratContrastToReal q) (transferProcedure (ratContrastToReal q) p) z ≤ labeledRisk c p z + 2 * eta * sqrt (labeledRisk c p z) + eta ^ 2 := by have hc0 : 0 ≤ labeledRisk c p z := p.1.mse_nonneg _ _ have hq0 : 0 ≤ labeledRisk (ratContrastToReal q) (transferProcedure (ratContrastToReal q) p) z := (transferProcedure (ratContrastToReal q) p).1.mse_nonneg _ _ have hsqc := Real.sq_sqrt hc0 have hsqq := Real.sq_sqrt hq0 nlinarith [hroot z, Real.sqrt_nonneg (labeledRisk c p z), Real.sqrt_nonneg (labeledRisk (ratContrastToReal q) (transferProcedure (ratContrastToReal q) p) z)] have hsqrtE : prior.E (fun z => sqrt (labeledRisk c p z)) ≤ sqrt V := by have hcs := finiteDesign_E_abs_le_sqrt_E_sq prior (fun z => sqrt (labeledRisk c p z)) have habs (z : Schedule K n) : |sqrt (labeledRisk c p z)| = sqrt (labeledRisk c p z) := abs_of_nonneg (Real.sqrt_nonneg _) rw [show prior.E (fun z => sqrt (labeledRisk c p z) ^ 2) = V by apply prior.E_congr intro z exact Real.sq_sqrt (p.1.mse_nonneg _ _)] at hcs simpa only [habs] using hcs have htransfer : prior.E (fun z => labeledRisk (ratContrastToReal q) (transferProcedure (ratContrastToReal q) p) z) ≤ (sqrt V + eta) ^ 2 := by calc _ ≤ prior.E (fun z => labeledRisk c p z + 2 * eta * sqrt (labeledRisk c p z) + eta ^ 2) := by unfold E apply Finset.sum_le_sum intro z _ exact mul_le_mul_of_nonneg_left (hpoint z) (prior.p_nonneg z) _ = V + 2 * eta * prior.E (fun z => sqrt (labeledRisk c p z)) + eta ^ 2 := by rw [prior.E_add, prior.E_add, prior.E_const_mul, prior.E_const] _ ≤ V + 2 * eta * sqrt V + eta ^ 2 := by gcongr _ = (sqrt V + eta) ^ 2 := by nlinarith [Real.sq_sqrt hV] have hB : lowerCertificate q nu ≤ (sqrt V + eta) ^ 2 := (lowerCertificate_le_schedulePriorRisk q hn nu hnu (transferProcedure (ratContrastToReal q) p)).trans htransfer by_cases hB0 : lowerCertificate q nu ≤ 0 · have hsqrt : sqrt (lowerCertificate q nu) = 0 := Real.sqrt_eq_zero_of_nonpos hB0 change (max 0 (sqrt (lowerCertificate q nu) - eta)) ^ 2 ≤ V rw [hsqrt] simp [heta, hV] · have hBpos : 0 < lowerCertificate q nu := lt_of_not_ge hB0 have hsqrt_le : sqrt (lowerCertificate q nu) ≤ sqrt V + eta := by apply (Real.sqrt_le_iff).2 constructor · positivity · simpa [Real.sq_sqrt hBpos.le] using hB by_cases hsub : sqrt (lowerCertificate q nu) - eta ≤ 0 · change (max 0 (sqrt (lowerCertificate q nu) - eta)) ^ 2 ≤ V rw [max_eq_left hsub] simpa using hV · rw [max_eq_right (le_of_not_ge hsub)] change (sqrt (lowerCertificate q nu) - eta) ^ 2 ≤ V nlinarith [Real.sq_sqrt hV]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.transferredSchedulePrior_lowerBound · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:239
theorem projectedUpperProcedureCertificate

the population size is positive, the grid resolution is positive, the delta condition holds, the stated side condition holds, the stated side condition holds, the projected upper procedure certificate property holds.

Formal statement
K :
shared
n :
shared
M :
shared
c :
Contrast ℝ K
q :
hn :
0 < n
hM :
0 < M
pi :
GridPi K n
w :
u :
nu :
CountVec K n → ℚ
delta :
∀ r : AllocVec K n
if
then
hcert :
hbar :
IsGridBarycenter q pi w delta
∃ p : Procedure K n c,
Proof (Lean source)
lemma projectedUpperProcedureCertificate (c : Contrast ℝ K) (q : RatContrast K) (hn : 0 < n) (hM : 0 < M) (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ) (hcert : ExactGridPrimalDualCertificate q pi w u nu) (hbar : IsGridBarycenter q pi w delta) : ∃ p : Procedure K n c, IsProjectedUpperProcedureCertificate K n c pi delta p ((sqrt (upperCertificate q pi delta) + contrastDistance c (ratContrastToReal q)) ^ 2) := by classical rcases hcert with ⟨wQ, y, hw, hpr, hy, hnu, hu⟩ subst w let piD := rationalGridDesignOf pi hpr.2.2.1 hpr.1 let wR : GridWeight K n M := rationalGridWeightToReal M wQ have hwR : ∀ r x g, 0 ≤ wR r x g := by intro r x g dsimp [wR, rationalGridWeightToReal] exact_mod_cast hpr.2.2.2.1 r x g have hocc : ∀ r x, ∑ g, wR r x g = piD.p r := by intro r x dsimp [wR, piD, rationalGridDesignOf, rationalGridWeightToReal] exact_mod_cast hpr.2.1 r x have hzero : (0 : ℝ) ∈ Icc (-Lc (ratContrastToReal q) / 2) (Lc (ratContrastToReal q) / 2) := by have hL := Lc_pos (ratContrastToReal q) constructor <;> linarith have hgamma (g : Fin (2 * M + 1)) : (gammaMC M q g : ℝ) ∈ Icc (-Lc (ratContrastToReal q) / 2) (Lc (ratContrastToReal q) / 2) := by simpa [hRat_cast, neg_div] using gammaMC_mem_gridInterval q hM g let qoFS := barycenterProcedure piD wR (fun g => (gammaMC M q g : ℝ)) 0 hwR hocc hzero hgamma let qo : OrbitProcedure K n (ratContrastToReal q) := (qoFS.design, qoFS.decision) have hdelta (r : AllocVec K n) (x : ObsVec r) : delta r x = (qo.2 r x : ℝ) := by change delta r x = (qoFS.decision r x : ℝ) change delta r x = conditionalBarycenter piD wR (fun g => (gammaMC M q g : ℝ)) 0 r x simpa [piD, wR] using gridBarycenter_eq_conditionalBarycenter q pi (rationalGridWeightToReal M wQ) delta hpr.2.2.1 hpr.1 hbar r x let pRat : Procedure K n (ratContrastToReal q) := (orbitToInvariantProcedure (ratContrastToReal q) qo).1 let p : Procedure K n c := transferProcedure c pRat refine ⟨p, ?_, ?_, ?_⟩ · intro A change pRat.1.p A = (pi (assignmentCounts A) : ℝ) / allocationOrbitCard (assignmentCounts A) rw [(orbitToInvariantProcedure_realizes (ratContrastToReal q) qo).1 A] change piD.p (assignmentCounts A) / allocationOrbitCard (assignmentCounts A) = _ rfl · intro A obs change clip c (pRat.2 A obs) = clip c (delta (assignmentCounts A) (observedCounts A obs)) congr 1 rw [(orbitToInvariantProcedure_realizes (ratContrastToReal q) qo).2 A obs] exact (hdelta _ _).symm · apply Causalean.Stat.worstCaseRisk_le intro z have hriskEq : labeledRisk (ratContrastToReal q) pRat z = orbitRisk (ratContrastToReal q) qo (scheduleCounts z) := labeledRisk_eq_orbitRisk_of_realizes (ratContrastToReal q) pRat qo (orbitToInvariantProcedure_realizes (ratContrastToReal q) qo).1 (orbitToInvariantProcedure_realizes (ratContrastToReal q) qo).2 z have horbit : orbitRisk (ratContrastToReal q) qo (scheduleCounts z) ≤ upperCertificate q pi delta := by unfold upperCertificate have hle := le_ciSup (Set.finite_range (fun m : CountVec K n => ∑ r, (pi r : ℝ) * ∑ x : ObsVec r, (orbitLik m r x : ℝ) * (delta r x - (tauCountRat q m : ℝ)) ^ 2)).bddAbove (scheduleCounts z) apply le_trans ?_ hle unfold orbitRisk apply le_of_eq apply Finset.sum_congr rfl intro r _ change (pi r : ℝ) * (∑ x, (orbitLik (scheduleCounts z) r x : ℝ) * ((qo.2 r x : ℝ) - tauCount (ratContrastToReal q) (scheduleCounts z)) ^ 2) = _ congr 1 apply Finset.sum_congr rfl intro x _ rw [← hdelta, tauCountRat_cast] have hroot := transferred_root_risk_le c (ratContrastToReal q) pRat z hn have hrat0 : 0 ≤ labeledRisk (ratContrastToReal q) pRat z := pRat.1.mse_nonneg _ _ have hriskRat : labeledRisk (ratContrastToReal q) pRat z ≤ upperCertificate q pi delta := by rw [hriskEq]; exact horbit have hU0 : 0 ≤ upperCertificate q pi delta := hrat0.trans hriskRat have hsqrt : sqrt (labeledRisk c p z) ≤ sqrt (upperCertificate q pi delta) + contrastDistance c (ratContrastToReal q) := by calc _ ≤ sqrt (labeledRisk (ratContrastToReal q) pRat z) + contrastDistance c (ratContrastToReal q) := hroot _ ≤ sqrt (upperCertificate q pi delta) + contrastDistance c (ratContrastToReal q) := by gcongr have hc0 : 0 ≤ labeledRisk c p z := p.1.mse_nonneg _ _ nlinarith [Real.sq_sqrt hc0, Real.sq_sqrt hU0, Real.sqrt_nonneg (labeledRisk c p z), Real.sqrt_nonneg (upperCertificate q pi delta)]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.projectedUpperProcedureCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:327

The schedule prior is exactly the uniform-within-orbit lift of the same upstream rational response-count prior nu, and gives the all-procedure bound.

Definition (Lean source)
K n :
c :
Contrast ℝ K
nu :
CountVec K n → ℚ
prior :
FiniteDesign (Schedule K n)
Rminus :
IsTransferredPriorCertificate K n c nu prior Rminus :
Prop
clause 1
z :
prior.p z = (nu (scheduleCounts z) : ℝ) / responseCountOrbitCard (scheduleCounts z)
clause 2
p :
Procedure K n c
Rminus ≤ prior.E (fun z => labeledRisk c p z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.IsTransferredPriorCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:433

One exact rational program together with its transferred real-contrast endpoints.

Definition (Lean source)
K n M :
c :
Contrast ℝ K
q :
B U Rminus Rplus :
RealContrastTransferCertificate K n M c q B U Rminus Rplus :
Prop
∃ (pi : GridPi K n) (w : GridWeight K n M) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ) (upperProcedure : Procedure K n c) (schedulePrior : FiniteDesign (Schedule K n)),
clause 1
clause 2
IsGridBarycenter q pi w delta
clause 3
clause 4
U = upperCertificate q pi delta
clause 5
(u : ℝ) = gridLPValueRaw K n M q
clause 6
clause 7
rhoN K n (ratContrastToReal q) ≤ upperCertificate q pi delta
clause 8
upperCertificate q pi delta ≤ (u : ℝ)
clause 9
(u : ℝ) ≤ lowerCertificate q nu + C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2)
clause 10
Rminus = (max 0 (sqrt B - contrastDistance c (ratContrastToReal q))) ^ 2
clause 11
Rplus = (sqrt U + contrastDistance c (ratContrastToReal q)) ^ 2
clause 12
Rminus ≤ rhoN K n c
clause 13
rhoN K n c ≤ Rplus
clause 14
Rplus - Rminus
≤ 5 * C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2)
+ 4 * sqrt (C0 (ratContrastToReal q)) * contrastDistance c (ratContrastToReal q) * (n : ℝ) ^ (-(1 / 2 : ℝ))
clause 15
IsProjectedUpperProcedureCertificate K n c pi delta upperProcedure Rplus
clause 16
IsTransferredPriorCertificate K n c nu schedulePrior Rminus
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RealContrastTransferCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:443
theorem fixedRealContrastTransferCertificate

the population size is positive, the grid resolution is positive, the fixed real contrast transfer certificate property holds.

Formal statement
K n M :
c :
Contrast ℝ K
q :
hn :
0 < n
hM :
0 < M
∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n M c q B U Rminus Rplus
Proof (Lean source)
lemma fixedRealContrastTransferCertificate (K n M : ℕ) (c : Contrast ℝ K) (q : RatContrast K) (hn : 0 < n) (hM : 0 < M) : ∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n M c q B U Rminus Rplus := by classical obtain ⟨pi, w, u, nu, delta, hcert, hbar, hu, hBρ, hρU, hUu, huB, _hcM, _hcR, _hcRX, _hasymp⟩ := rational_contrast_grid_certificate_sandwich K n M q hn hM have hnu : IsRationalPrior nu := by rcases hcert with ⟨wQ, y, hw, hpr, hy, hnu, huy⟩ rw [hnu] exact ⟨hy.2.2.2.2.2.1, hy.2.2.2.2.2.2.1⟩ let B := lowerCertificate q nu let U := upperCertificate q pi delta let eta := contrastDistance c (ratContrastToReal q) let Rminus := (max 0 (sqrt B - eta)) ^ 2 let Rplus := (sqrt U + eta) ^ 2 obtain ⟨upperProcedure, hupper⟩ := projectedUpperProcedureCertificate c q hn hM pi w u nu delta hcert hbar let prior := schedulePriorOfRationalPrior nu hnu have hlowerAll : ∀ p : Procedure K n c, Rminus ≤ prior.E (fun z => labeledRisk c p z) := by intro p exact transferredSchedulePrior_lowerBound c q hn nu hnu p have hRminus : Rminus ≤ rhoN K n c := by letI : Nonempty (Procedure K n c) := ⟨upperProcedure⟩ unfold rhoN apply le_minimaxValue intro p calc Rminus ≤ prior.E (fun z => labeledRisk c p z) := hlowerAll p _ ≤ worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) p := by unfold E calc _ ≤ ∑ z, prior.p z * worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) p := by apply Finset.sum_le_sum intro z _ apply mul_le_mul_of_nonneg_left · exact le_worstCaseRisk (Set.finite_range _).bddAbove z · exact prior.p_nonneg z _ = _ := by rw [← Finset.sum_mul, prior.p_sum, one_mul] have hRplus : rhoN K n c ≤ Rplus := (minimaxValue_le_worstCaseRisk_of_nonneg (fun p z => p.1.mse_nonneg _ _) upperProcedure).trans hupper.2.2 have hB0 : 0 ≤ B := lowerCertificate_nonneg q nu hnu have hU0 : 0 ≤ U := hB0.trans (hBρ.trans hρU) have heta0 : 0 ≤ eta := by unfold eta contrastDistance; positivity have hC0 : 0 ≤ C0 (ratContrastToReal q) := by unfold C0; positivity have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hρbound := (embedded_two_arm_converse K n (ratContrastToReal q) (rationalContrast_admissibleArmCount q) hn).2.1 have hgap : U - B ≤ C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) := by dsimp [U, B] linarith have hsqrtU : sqrt U ≤ sqrt (C0 (ratContrastToReal q)) * (n : ℝ) ^ (-(1 / 2 : ℝ)) + sqrt (C0 (ratContrastToReal q)) / (2 * M) := by let a := sqrt (C0 (ratContrastToReal q)) * (n : ℝ) ^ (-(1 / 2 : ℝ)) let b := sqrt (C0 (ratContrastToReal q)) / (2 * M) have hUbd : U ≤ C0 (ratContrastToReal q) / n + C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) := by linarith have ha0 : 0 ≤ a := by dsimp [a]; positivity have hb0 : 0 ≤ b := by dsimp [b]; positivity have haSq : a ^ 2 = C0 (ratContrastToReal q) / n := by dsimp [a] rw [mul_pow, Real.sq_sqrt hC0] have hp : ((n : ℝ) ^ (-(1 / 2 : ℝ))) ^ 2 = (n : ℝ)⁻¹ := by rw [← Real.rpow_natCast] rw [← Real.rpow_mul hnR.le] norm_num exact Real.rpow_neg_one _ rw [hp, div_eq_mul_inv] have hbSq : b ^ 2 = C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) := by dsimp [b] rw [div_pow, Real.sq_sqrt hC0] ring apply (Real.sqrt_le_iff).2 constructor · positivity · rw [add_sq, haSq, hbSq] nlinarith have hwidth : Rplus - Rminus ≤ 5 * C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) + 4 * sqrt (C0 (ratContrastToReal q)) * eta * (n : ℝ) ^ (-(1 / 2 : ℝ)) + 3 * eta ^ 2 := by have hsB := Real.sq_sqrt hB0 have hsU := Real.sq_sqrt hU0 have hmax : B - (max 0 (sqrt B - eta)) ^ 2 ≤ 2 * eta * sqrt B + eta ^ 2 := by by_cases h : sqrt B - eta ≤ 0 · rw [max_eq_left h] nlinarith [Real.sqrt_nonneg B] · rw [max_eq_right (le_of_not_ge h)] nlinarith have hsqrtB : sqrt B ≤ sqrt U := Real.sqrt_le_sqrt (hBρ.trans hρU) have hsqrtC : (sqrt (C0 (ratContrastToReal q))) ^ 2 = C0 (ratContrastToReal q) := Real.sq_sqrt hC0 have hcross : 2 * sqrt (C0 (ratContrastToReal q)) * eta / M ≤ C0 (ratContrastToReal q) / (M : ℝ) ^ 2 + eta ^ 2 := by have hMpos : (0 : ℝ) < M := by exact_mod_cast hM have hsq := sq_nonneg (sqrt (C0 (ratContrastToReal q)) / M - eta) have hdivsq : (sqrt (C0 (ratContrastToReal q)) / M) ^ 2 = C0 (ratContrastToReal q) / (M : ℝ) ^ 2 := by rw [div_pow, hsqrtC] rw [show (sqrt (C0 (ratContrastToReal q)) / M - eta) ^ 2 = (sqrt (C0 (ratContrastToReal q)) / M) ^ 2 - 2 * (sqrt (C0 (ratContrastToReal q)) / M) * eta + eta ^ 2 by ring, hdivsq] at hsq have hxy : 2 * (sqrt (C0 (ratContrastToReal q)) / M) * eta ≤ (sqrt (C0 (ratContrastToReal q)) / M) ^ 2 + eta ^ 2 := by nlinarith calc _ = 2 * (sqrt (C0 (ratContrastToReal q)) / M) * eta := by ring _ ≤ (sqrt (C0 (ratContrastToReal q)) / M) ^ 2 + eta ^ 2 := hxy _ = _ := by rw [hdivsq] dsimp [Rplus, Rminus] have hpre : (sqrt U + eta) ^ 2 - (max 0 (sqrt B - eta)) ^ 2 ≤ C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) + 4 * eta * sqrt U + 2 * eta ^ 2 := by nlinarith have hrootTerm : 4 * eta * sqrt U ≤ 4 * sqrt (C0 (ratContrastToReal q)) * eta * (n : ℝ) ^ (-(1 / 2 : ℝ)) + 2 * sqrt (C0 (ratContrastToReal q)) * eta / M := by have h4eta : 0 ≤ 4 * eta := mul_nonneg (by norm_num) heta0 have hm := mul_le_mul_of_nonneg_left hsqrtU h4eta calc _ ≤ 4 * eta * (sqrt (C0 (ratContrastToReal q)) * (n : ℝ) ^ (-(1 / 2 : ℝ)) + sqrt (C0 (ratContrastToReal q)) / (2 * M)) := hm _ = _ := by ring have hcoef : C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) + C0 (ratContrastToReal q) / (M : ℝ) ^ 2 = 5 * C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) := by field_simp ring calc _ ≤ C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) + 4 * eta * sqrt U + 2 * eta ^ 2 := hpre _ ≤ C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) + (4 * sqrt (C0 (ratContrastToReal q)) * eta * (n : ℝ) ^ (-(1 / 2 : ℝ)) + 2 * sqrt (C0 (ratContrastToReal q)) * eta / M) + 2 * eta ^ 2 := by linarith _ ≤ _ := by linarith [hcross, hcoef] refine ⟨B, U, Rminus, Rplus, pi, w, u, nu, delta, upperProcedure, prior, hcert, hbar, rfl, rfl, ?_, hBρ, hρU, ?_, ?_, rfl, rfl, hRminus, hRplus, hwidth, hupper, ?_⟩ · simpa [gridLPValue] using hu · exact hUu.trans_eq hu.symm · exact hu ▸ huB · exact ⟨fun z => rfl, hlowerAll⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.fixedRealContrastTransferCertificate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:472
theorem realContrastTransferCertificate_bounds

the real contrast transfer certificate bounds property holds.

Formal statement
K n M :
c :
Contrast ℝ K
q :
B U Rminus Rplus :
h :
RealContrastTransferCertificate K n M c q B U Rminus Rplus
conclusion 1
0 ≤ Rplus - Rminus
conclusion 2
Rplus - Rminus
≤ 5 * C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2)
+ 4 * sqrt (C0 (ratContrastToReal q)) * contrastDistance c (ratContrastToReal q) * (n : ℝ) ^ (-(1 / 2 : ℝ))
conclusion 3
U - B ≤ C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2)
Proof (Lean source)
lemma realContrastTransferCertificate_bounds (K n M : ℕ) (c : Contrast ℝ K) (q : RatContrast K) (B U Rminus Rplus : ℝ) (h : RealContrastTransferCertificate K n M c q B U Rminus Rplus) : 0 ≤ Rplus - Rminus ∧ Rplus - Rminus ≤ 5 * C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) + 4 * sqrt (C0 (ratContrastToReal q)) * contrastDistance c (ratContrastToReal q) * (n : ℝ) ^ (-(1 / 2 : ℝ)) + 3 * contrastDistance c (ratContrastToReal q) ^ 2 ∧ U - B ≤ C0 (ratContrastToReal q) / (4 * (M : ℝ) ^ 2) := by rcases h with ⟨pi, w, u, nu, delta, p, prior, _hcert, _hbar, hB, hU, _huval, _hBρ, _hρU, hUu, huB, _hRmDef, _hRpDef, hRm, hRp, hwidth, _hp, _hprior⟩ refine ⟨by linarith, hwidth, ?_⟩ rw [hU, hB] linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.realContrastTransferCertificate_bounds · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:630
theorem real_contrast_grid_certificate_transfer Theorem 9 in the paper ↗

there are at least two treatment arms, exact rational grid certificates transfer to every real contrast with the stated approximation error bounds.

Formal statement
K :
c :
Contrast ℝ K
conclusion 1
q :
n M :
0 < n
0 < M
∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n M c q B U Rminus Rplus
conclusion 2
∃ (cq : ℕ → RatContrast K) (B U Rminus Rplus : ℕ → ℝ),
a :
Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a))
Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0)
n :
0 < n
RealContrastTransferCertificate K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n)
Tendsto (fun n => secondOrderScale n * (Rplus n - Rminus n)) atTop (nhds 0)
conclusion 3
q :
n :
0 < n
∃ B U Rminus Rplus : ℝ,
RealContrastTransferCertificate K n n c q B U Rminus Rplus
U - B ≤ C0 c / (4 * (n : ℝ) ^ 2)
Proof (Lean source)
theorem real_contrast_grid_certificate_transfer (K : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) : (∀ (q : RatContrast K) (n M : ℕ), 0 < n → 0 < M → ∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n M c q B U Rminus Rplus) ∧ (∃ (cq : ℕ → RatContrast K) (B U Rminus Rplus : ℕ → ℝ), (∀ a, Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a))) ∧ Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0) ∧ (∀ n, 0 < n → RealContrastTransferCertificate K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n)) ∧ Tendsto (fun n => secondOrderScale n * (Rplus n - Rminus n)) atTop (nhds 0)) ∧ (∀ q : RatContrast K, ratContrastToReal q = c → ∀ n, 0 < n → ∃ B U Rminus Rplus : ℝ, RealContrastTransferCertificate K n n c q B U Rminus Rplus ∧ U - B ≤ C0 c / (4 * (n : ℝ) ^ 2)) := by classical have hLc : 0 < Lc c := Lc_pos c let eps : ℕ → ℝ := fun n => if n = 0 then Lc c / 4 else min (Lc c / 4) ((n : ℝ) ^ (-3 : ℝ)) have hepspos (n : ℕ) : 0 < eps n := by dsimp [eps] split_ifs with hn · positivity · apply lt_min · positivity · exact Real.rpow_pos_of_pos (by exact_mod_cast Nat.pos_of_ne_zero hn) _ have hepslt (n : ℕ) : eps n < Lc c / 2 := by calc eps n ≤ Lc c / 4 := by dsimp [eps] split_ifs <;> simp _ < Lc c / 2 := by linarith choose cq hcq using fun n => exists_ratContrast_close K c hK (eps n) (hepspos n) (hepslt n) have hdistPow : ∀ᶠ n : ℕ in atTop, contrastDistance c (ratContrastToReal (cq n)) ≤ (n : ℝ) ^ (-3 : ℝ) := by filter_upwards [Ici_mem_atTop 1] with n hn have hnpos : 0 < n := lt_of_lt_of_le Nat.zero_lt_one hn exact (hcq n).trans (by simp [eps, ne_of_gt hnpos]) have hpow3 : Tendsto (fun n : ℕ => (n : ℝ) ^ (-3 : ℝ)) atTop (nhds 0) := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 3)).comp tendsto_natCast_atTop_atTop have hdist0 : Tendsto (fun n => contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hpow3 · exact Filter.Eventually.of_forall fun n => by unfold contrastDistance positivity · exact hdistPow have hcoord (a : Arm K) : Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a)) := by rw [tendsto_iff_dist_tendsto_zero] have hu : Tendsto (fun n => 2 * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0) := by simpa using hdist0.const_mul 2 apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu · exact Filter.Eventually.of_forall fun _ => abs_nonneg _ · exact Filter.Eventually.of_forall fun n => by simpa [Real.dist_eq, abs_sub_comm] using coordinate_le_two_contrastDistance c (ratContrastToReal (cq n)) a have hetaScaled : Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0) := by have hp : Tendsto (fun n : ℕ => (n : ℝ) ^ (-(13 / 6 : ℝ))) atTop (nhds 0) := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 13 / 6)).comp tendsto_natCast_atTop_atTop apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hp · filter_upwards [Ici_mem_atTop 1] with n hn exact mul_nonneg (Real.rpow_nonneg (le_of_lt (by exact_mod_cast hn : (0 : ℝ) < n)) _) (by unfold contrastDistance; positivity) · filter_upwards [hdistPow, Ici_mem_atTop 1] with n hd hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn calc (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n)) ≤ (n : ℝ) ^ (5 / 6 : ℝ) * (n : ℝ) ^ (-3 : ℝ) := by gcongr _ = (n : ℝ) ^ (-(13 / 6 : ℝ)) := by rw [← Real.rpow_add hnR] norm_num choose Bp Up Rmp Rpp hcertp using fun m : PositiveNat => fixedRealContrastTransferCertificate K m m c (cq m) m.2 m.2 let B : ℕ → ℝ := fun n => if hn : 0 < n then Bp ⟨n, hn⟩ else 0 let U : ℕ → ℝ := fun n => if hn : 0 < n then Up ⟨n, hn⟩ else 0 let Rminus : ℕ → ℝ := fun n => if hn : 0 < n then Rmp ⟨n, hn⟩ else 0 let Rplus : ℕ → ℝ := fun n => if hn : 0 < n then Rpp ⟨n, hn⟩ else 0 have hcert (n : ℕ) (hn : 0 < n) : RealContrastTransferCertificate K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n) := by simpa [B, U, Rminus, Rplus, hn] using hcertp ⟨n, hn⟩ have hLcconv : Tendsto (fun n => Lc (ratContrastToReal (cq n))) atTop (nhds (Lc c)) := by unfold Lc simpa using tendsto_finset_sum univ (fun a _ => (hcoord a).abs) have hCconv : Tendsto (fun n => C0 (ratContrastToReal (cq n))) atTop (nhds (C0 c)) := by unfold C0 exact (hLcconv.pow 2).div_const 4 have hsqrtCconv : Tendsto (fun n => sqrt (C0 (ratContrastToReal (cq n)))) atTop (nhds (sqrt (C0 c))) := hCconv.sqrt have hscale2 : Tendsto (fun n : ℕ => secondOrderScale n / (n : ℝ) ^ 2) atTop (nhds 0) := by have hp : Tendsto (fun n : ℕ => (n : ℝ) ^ (-(2 / 3 : ℝ))) atTop (nhds 0) := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 2 / 3)).comp tendsto_natCast_atTop_atTop apply hp.congr' filter_upwards [Ici_mem_atTop 1] with n hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn unfold secondOrderScale calc (n : ℝ) ^ (-(2 / 3 : ℝ)) = (n : ℝ) ^ (4 / 3 - 2 : ℝ) := by norm_num _ = (n : ℝ) ^ (4 / 3 : ℝ) / (n : ℝ) ^ (2 : ℝ) := Real.rpow_sub hnR _ _ _ = (n : ℝ) ^ (4 / 3 : ℝ) / (n : ℝ) ^ (2 : ℕ) := by congr 1 exact Real.rpow_natCast _ 2 have hterm1 : Tendsto (fun n => secondOrderScale n * (5 * C0 (ratContrastToReal (cq n)) / (4 * (n : ℝ) ^ 2))) atTop (nhds 0) := by have h := (hCconv.const_mul (5 / 4 : ℝ)).mul hscale2 have h0 : Tendsto (fun n => (5 / 4 : ℝ) * C0 (ratContrastToReal (cq n)) * (secondOrderScale n / (n : ℝ) ^ 2)) atTop (nhds 0) := by simpa using h convert h0 using 1 funext n ring have hterm2 : Tendsto (fun n => secondOrderScale n * (4 * sqrt (C0 (ratContrastToReal (cq n))) * contrastDistance c (ratContrastToReal (cq n)) * (n : ℝ) ^ (-(1 / 2 : ℝ)))) atTop (nhds 0) := by have h := (hsqrtCconv.const_mul 4).mul hetaScaled have h0 : Tendsto (fun n => 4 * sqrt (C0 (ratContrastToReal (cq n))) * ((n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n)))) atTop (nhds 0) := by simpa using h apply h0.congr' filter_upwards [Ici_mem_atTop 1] with n hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn unfold secondOrderScale rw [show (n : ℝ) ^ (4 / 3 : ℝ) * (4 * sqrt (C0 (ratContrastToReal (cq n))) * contrastDistance c (ratContrastToReal (cq n)) * (n : ℝ) ^ (-(1 / 2 : ℝ))) = 4 * sqrt (C0 (ratContrastToReal (cq n))) * ((n : ℝ) ^ (4 / 3 : ℝ) * (n : ℝ) ^ (-(1 / 2 : ℝ)) * contrastDistance c (ratContrastToReal (cq n))) by ring, ← Real.rpow_add hnR] norm_num have hterm3 : Tendsto (fun n => secondOrderScale n * (3 * contrastDistance c (ratContrastToReal (cq n)) ^ 2)) atTop (nhds 0) := by have hp : Tendsto (fun n : ℕ => 3 * (n : ℝ) ^ (-(14 / 3 : ℝ))) atTop (nhds 0) := by simpa using ((tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 14 / 3)).comp tendsto_natCast_atTop_atTop).const_mul 3 apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hp · filter_upwards [Ici_mem_atTop 1] with n hn exact mul_nonneg (by unfold secondOrderScale; positivity) (mul_nonneg (by norm_num) (sq_nonneg _)) · filter_upwards [hdistPow, Ici_mem_atTop 1] with n hd hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hsquare : contrastDistance c (ratContrastToReal (cq n)) ^ 2 ≤ ((n : ℝ) ^ (-3 : ℝ)) ^ 2 := (sq_le_sq₀ (by unfold contrastDistance; positivity) (Real.rpow_nonneg hnR.le _)).2 hd calc secondOrderScale n * (3 * contrastDistance c (ratContrastToReal (cq n)) ^ 2) ≤ secondOrderScale n * (3 * ((n : ℝ) ^ (-3 : ℝ)) ^ 2) := by exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hsquare (by norm_num)) (by unfold secondOrderScale; positivity) _ = 3 * (n : ℝ) ^ (-(14 / 3 : ℝ)) := by unfold secondOrderScale rw [← Real.rpow_natCast] rw [← Real.rpow_mul hnR.le] norm_num only [Nat.cast_ofNat] rw [show (n : ℝ) ^ (4 / 3 : ℝ) * (3 * (n : ℝ) ^ (-6 : ℝ)) = 3 * ((n : ℝ) ^ (4 / 3 : ℝ) * (n : ℝ) ^ (-6 : ℝ)) by ring, ← Real.rpow_add hnR] norm_num have hwidth : Tendsto (fun n => secondOrderScale n * (Rplus n - Rminus n)) atTop (nhds 0) := by have hup := hterm1.add (hterm2.add hterm3) have hup0 : Tendsto (fun n => secondOrderScale n * (5 * C0 (ratContrastToReal (cq n)) / (4 * (n : ℝ) ^ 2)) + (secondOrderScale n * (4 * sqrt (C0 (ratContrastToReal (cq n))) * contrastDistance c (ratContrastToReal (cq n)) * (n : ℝ) ^ (-(1 / 2 : ℝ))) + secondOrderScale n * (3 * contrastDistance c (ratContrastToReal (cq n)) ^ 2))) atTop (nhds 0) := by simpa using hup apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hup0 · filter_upwards [Ici_mem_atTop 1] with n hn have hb := (realContrastTransferCertificate_bounds K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n) (hcert n hn)).1 exact mul_nonneg (by unfold secondOrderScale; positivity) hb · filter_upwards [Ici_mem_atTop 1] with n hn have hb := (realContrastTransferCertificate_bounds K n n c (cq n) (B n) (U n) (Rminus n) (Rplus n) (hcert n hn)).2.1 have hs : 0 ≤ secondOrderScale n := by unfold secondOrderScale; positivity have := mul_le_mul_of_nonneg_left hb hs linarith refine ⟨?_, ⟨cq, B, U, Rminus, Rplus, hcoord, hetaScaled, hcert, hwidth⟩, ?_⟩ · intro q n M hn hM exact fixedRealContrastTransferCertificate K n M c q hn hM · intro q hq n hn obtain ⟨B, U, Rminus, Rplus, hcert⟩ := fixedRealContrastTransferCertificate K n n c q hn hn refine ⟨B, U, Rminus, Rplus, hcert, ?_⟩ have hgap := (realContrastTransferCertificate_bounds K n n c q B U Rminus Rplus hcert).2.2 simpa [hq] using hgap
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.real_contrast_grid_certificate_transfer · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_real_contrast_grid_certificate_transfer.lean:651
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_second_order_rate_and_certificate_frontier 14 declarations Established second-order rate and the finite-program certificate frontier.

Established second-order rate and the finite-program certificate frontier.

The open-frontier record lists the second-order and certificate questions not settled by this development.

Definition (Lean source)
secondOrderRateAndCertificateOpenFrontier :
["convergence of the normalized improvement is not determined", "the sharp limit and exact subsequential-limit set are not determined", "slow variation in the nonconvergent branch is not determined", "sharp second-order optimality of qStar is not determined", "convergence of optimizers or least-favorable priors is not determined", "no limiting face-corner HJB, cone-spectral, separable, or other operator is determined"]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.secondOrderRateAndCertificateOpenFrontier · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:14

A real number is a cluster value of a sequence when some subsequence converges to it.

Definition (Lean source)
x :
ℕ → ℝ
a :
ClusterValue x a :
Prop
∃ φ : ℕ → ℕ,
clause 1
clause 2
Tendsto (x ∘ φ) atTop (nhds a)

A positive sequence is slowly varying when its ratio at every fixed positive rescaling of the index converges to one.

Definition (Lean source)
SlowlyVarying x :
Prop

Slow variation for the actual normalized improvement, requiring positivity only eventually.

Definition (Lean source)
x :
ℕ → ℝ
SlowlyVaryingEventuallyPositive x :
Prop
clause 1
∀ᶠ n in atTop, 0 < x n
clause 2
t :
0 < t
Tendsto (fun n : ℕ => x ⌊t * (n : ℝ)⌋₊ / x n) atTop (nhds 1)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.SlowlyVaryingEventuallyPositive · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:30

Two real sequences are asymptotically coincident when the absolute difference between their terms converges to zero.

Definition (Lean source)
x y :
ℕ → ℝ
AsymptoticallyCoincident x y :
Prop
Tendsto (fun n => |x n - y n|) atTop (nhds 0)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.AsymptoticallyCoincident · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:36
def secondOrderScalePositive

The positive second-order scale replaces the zero-index value of the regularly varying scale by one.

Definition (Lean source)
secondOrderScalePositive :
⟨fun n
=> if n = 0 then 1 else secondOrderScale n, fun n => by dsimp split_ifs with hn · positivity · unfold secondOrderScale exact Real.rpow_pos_of_pos (by exact_mod_cast Nat.pos_of_ne_zero hn) _⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.secondOrderScalePositive · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:41
def eventuallyPositivePatch

The eventual-positivity patch replaces nonpositive terms of a real sequence by one.

Definition (Lean source)
x :
ℕ → ℝ
eventuallyPositivePatch x :
⟨fun n => if 0 < x n then x n else 1, fun n => by dsimp split_ifs <;> positivity⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.eventuallyPositivePatch · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:51
theorem eventuallyPositivePatch_eventually_eq

the observed count satisfies its stated condition, the eventually positive patch eventually equals property holds.

Formal statement
x :
ℕ → ℝ
hx :
∀ᶠ n in atTop, 0 < x n
(eventuallyPositivePatch x : ℕ → ℝ) =ᶠ[atTop] x
Proof (Lean source)
lemma eventuallyPositivePatch_eventually_eq (x : ℕ → ℝ) (hx : ∀ᶠ n in atTop, 0 < x n) : (eventuallyPositivePatch x : ℕ → ℝ) =ᶠ[atTop] x := hx.mono fun n hn => by simp [eventuallyPositivePatch, hn]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.eventuallyPositivePatch_eventually_eq · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:58
theorem secondOrderScalePositive_regularlyVarying

the second order scale positive regularly varying property holds.

Formal statement
Proof (Lean source)
lemma secondOrderScalePositive_regularlyVarying : RegularlyVarying secondOrderScalePositive (4 / 3) := by intro t ht have hfloor := tendsto_nat_floor_mul_atTop t ht have heq : (fun n : ℕ => secondOrderScalePositive ⌊t * (n : ℝ)⌋₊ / secondOrderScalePositive n) =ᶠ[atTop] (fun n : ℕ => (((⌊t * (n : ℝ)⌋₊ : ℕ) : ℝ) / n) ^ (4 / 3 : ℝ)) := by filter_upwards [Ici_mem_atTop 1, hfloor.eventually (Ici_mem_atTop 1)] with n hn hfn have hn0 : n ≠ 0 := Nat.ne_of_gt (Nat.zero_lt_one.trans_le hn) have hfn0 : ⌊t * (n : ℝ)⌋₊ ≠ 0 := Nat.ne_of_gt hfn simp only [secondOrderScalePositive, hn0, hfn0, ↓reduceIte] unfold secondOrderScale rw [Real.div_rpow (Nat.cast_nonneg _) (Nat.cast_nonneg _)] have hbase : Tendsto (fun n : ℕ => ((⌊t * (n : ℝ)⌋₊ : ℕ) : ℝ) / n) atTop (nhds t) := by change Tendsto ((fun x : ℝ => (⌊t * x⌋₊ : ℝ) / x) ∘ fun n : ℕ => (n : ℝ)) atTop (nhds t) exact (tendsto_nat_floor_mul_div_atTop ht.le).comp tendsto_natCast_atTop_atTop exact (hbase.rpow_const (inl ht.ne')).congr' heq.symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.secondOrderScalePositive_regularlyVarying · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:65
theorem regularlyVarying_div

the parameter lies in the stated interval, the stated side condition holds, the regularly varying divided by property holds.

Formal statement
α β :
ha :
hb :
RegularlyVarying (⟨fun n => a n / b n, fun n => div_pos (a.2 n) (b.2 n)⟩ : PositiveSequence) (α - β)
Proof (Lean source)
lemma regularlyVarying_div (a b : PositiveSequence) (α β : ℝ) (ha : RegularlyVarying a α) (hb : RegularlyVarying b β) : RegularlyVarying (⟨fun n => a n / b n, fun n => div_pos (a.2 n) (b.2 n)⟩ : PositiveSequence) (α - β) := by intro t ht have h := (ha t ht).div (hb t ht) (ne_of_gt (Real.rpow_pos_of_pos ht β)) convert h using 1 · funext n change (a ⌊t * (n : ℝ)⌋₊ / b ⌊t * (n : ℝ)⌋₊) / (a n / b n) = (a ⌊t * (n : ℝ)⌋₊ / a n) / (b ⌊t * (n : ℝ)⌋₊ / b n) field_simp [ne_of_gt (a.2 n), ne_of_gt (b.2 n), ne_of_gt (a.2 ⌊t * (n : ℝ)⌋₊), ne_of_gt (b.2 ⌊t * (n : ℝ)⌋₊)] <;> ring · rw [Real.rpow_sub ht]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.regularlyVarying_div · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:90
theorem asymptoticallyCoincident_of_scaled_sandwich

the stated side condition holds, the stated side condition holds, the stated side condition holds, the asymptotically coincident when scaled sandwich property holds.

Formal statement
scale center lower value upper :
ℕ → ℝ
hscale :
∀ n, 0 ≤ scale n
hord :
∀ᶠ n in atTop, lower n ≤ value n ∧ value n ≤ upper n
hwidth :
Tendsto (fun n => scale n * (upper n - lower n)) atTop (nhds 0)
conclusion 1
AsymptoticallyCoincident (fun n => scale n * (center n - lower n)) (fun n => scale n * (center n - value n))
conclusion 2
AsymptoticallyCoincident (fun n => scale n * (center n - upper n)) (fun n => scale n * (center n - value n))
Proof (Lean source)
lemma asymptoticallyCoincident_of_scaled_sandwich (scale center lower value upper : ℕ → ℝ) (hscale : ∀ n, 0 ≤ scale n) (hord : ∀ᶠ n in atTop, lower n ≤ value n ∧ value n ≤ upper n) (hwidth : Tendsto (fun n => scale n * (upper n - lower n)) atTop (nhds 0)) : AsymptoticallyCoincident (fun n => scale n * (center n - lower n)) (fun n => scale n * (center n - value n)) ∧ AsymptoticallyCoincident (fun n => scale n * (center n - upper n)) (fun n => scale n * (center n - value n)) := by constructor · apply squeeze_zero' (g := fun n => scale n * (upper n - lower n)) · exact Filter.Eventually.of_forall fun n => abs_nonneg _ · filter_upwards [hord] with n hn rw [abs_of_nonneg] · nlinarith [hscale n] · nlinarith [hscale n] · exact hwidth · apply squeeze_zero' (g := fun n => scale n * (upper n - lower n)) · exact Filter.Eventually.of_forall fun n => abs_nonneg _ · filter_upwards [hord] with n hn rw [abs_of_nonpos] · nlinarith [hscale n] · nlinarith [hscale n] · exact hwidth
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.asymptoticallyCoincident_of_scaled_sandwich · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:108
theorem secondOrderScale_mesh_tendsto_zero

the second order scale mesh converges zero.

Formal statement
C :
Tendsto (fun n : ℕ => secondOrderScale n * (C / (4 * (n : ℝ) ^ 2))) atTop (nhds 0)
Proof (Lean source)
lemma secondOrderScale_mesh_tendsto_zero (C : ℝ) : Tendsto (fun n : ℕ => secondOrderScale n * (C / (4 * (n : ℝ) ^ 2))) atTop (nhds 0) := by have hp : Tendsto (fun n : ℕ => (n : ℝ) ^ (-(2 / 3 : ℝ))) atTop (nhds 0) := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 2 / 3)).comp tendsto_natCast_atTop_atTop have heq : (fun n : ℕ => secondOrderScale n * (C / (4 * (n : ℝ) ^ 2))) =ᶠ[atTop] (fun n => (C / 4) * (n : ℝ) ^ (-(2 / 3 : ℝ))) := by filter_upwards [Ici_mem_atTop 1] with n hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn unfold secondOrderScale calc (n : ℝ) ^ (4 / 3 : ℝ) * (C / (4 * (n : ℝ) ^ 2)) = (C / 4) * ((n : ℝ) ^ (4 / 3 : ℝ) / (n : ℝ) ^ (2 : ℝ)) := by rw [show (n : ℝ) ^ (2 : ℕ) = (n : ℝ) ^ (2 : ℝ) by exact (Real.rpow_natCast _ 2).symm] ring _ = (C / 4) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by rw [← Real.rpow_sub hnR] norm_num have hlim : Tendsto (fun n : ℕ => (C / 4) * (n : ℝ) ^ (-(2 / 3 : ℝ))) atTop (nhds 0) := by simpa using hp.const_mul (C / 4) exact hlim.congr' heq.symm
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.secondOrderScale_mesh_tendsto_zero · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:138

A rational certificate cluster is a subsequential limit of scaled exact rational lower and upper grid certificates whose mesh error vanishes.

Definition (Lean source)
K :
q :
grid procedure prior :
ℕ → ℝ
n :
hn :
0 < n
RationalCertificateCluster K q grid procedure prior :
Prop
∃ (pi : GridPi K n) (w : GridWeight K n n) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ),
clause 1
clause 2
IsGridBarycenter q pi w delta
clause 3
grid n = secondOrderScale n * (C0 (ratContrastToReal q) / n - gridLPValue K n n q hn hn)
clause 4
procedure n
clause 5
prior n = secondOrderScale n * (C0 (ratContrastToReal q) / n - lowerCertificate q nu)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RationalCertificateCluster · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:164
theorem second_order_rate_and_certificate_frontier Theorem 11 in the paper ↗

there are at least two treatment arms, the contrast has at least three active arms, the scaled second-order excess risk has a nonempty compact cluster set bounded away from zero and above by the stated constant; any convergent positive regularly varying normalization has exponent four thirds, while the exact grid-certificate identification remains an explicit open frontier.

Formal statement
K :
c :
Contrast ℝ K
hsupport :
3 ≤ (Sc c).card
0 < liminf (fun n => secondOrderScale n * dN K c n) atTop
liminf (fun n => secondOrderScale n * dN K c n) atTop
limsup (fun n => secondOrderScale n * dN K c n) atTop
limsup (fun n => secondOrderScale n * dN K c n) atTop ≤ 43 * C0 c
∃ a : ℝ, ClusterValue (fun n => secondOrderScale n * dN K c n) a
IsCompact {a : ℝ | ClusterValue (fun n => secondOrderScale n * dN K c n) a}
(a : PositiveSequence) β C :
0 < C
Tendsto (fun n => a n * dN K c n) atTop (nhds C)
β = 4 / 3
(∃ (a : PositiveSequence) (C : ℝ), RegularlyVarying a (4 / 3) ∧ 0 < C ∧ Tendsto (fun n => a n * dN K c n) atTop (nhds C))
∃ grid procedure prior : ℕ → ℝ,
RationalCertificateCluster K q grid procedure prior
AsymptoticallyCoincident grid (fun n => secondOrderScale n * dN K c n)
∃ (cq : ℕ → RatContrast K) (B U lower upper : ℕ → ℝ),
a :
Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a))
Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0)
n :
0 < n
∃ (pi : GridPi K n) (w : GridWeight K n n) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ),
IsGridBarycenter (cq n) pi w delta
B n = lowerCertificate (cq n) nu
U n = upperCertificate (cq n) pi delta
lower n = (max 0 (sqrt (B n) - contrastDistance c (ratContrastToReal (cq n)))) ^ 2
upper n = (sqrt (U n) + contrastDistance c (ratContrastToReal (cq n))) ^ 2
lower n ≤ rhoN K n c
rhoN K n c ≤ upper n
AsymptoticallyCoincident (fun n => secondOrderScale n * (C0 c / n - lower n)) (fun n => secondOrderScale n * dN K c n)
AsymptoticallyCoincident (fun n => secondOrderScale n * (C0 c / n - upper n)) (fun n => secondOrderScale n * dN K c n)
∃ fullRule : Estimator 3 3 cDagger,
worstCaseRisk (fun (p : Procedure 3 3 cDagger) (z : Schedule 3 3) => labeledRisk cDagger p z) (prodDesign (fun _ : Unit 3 => qStarDesign cDagger), fullRule) < k3ScalarMinimaxValue 3
Proof (Lean source)
theorem second_order_rate_and_certificate_frontier (K : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) (hsupport : 3 ≤ (Sc c).card) : let _openFrontier : List String := secondOrderRateAndCertificateOpenFrontier 0 < liminf (fun n => secondOrderScale n * dN K c n) atTopliminf (fun n => secondOrderScale n * dN K c n) atToplimsup (fun n => secondOrderScale n * dN K c n) atToplimsup (fun n => secondOrderScale n * dN K c n) atTop ≤ 43 * C0 c ∧ (∃ a : ℝ, ClusterValue (fun n => secondOrderScale n * dN K c n) a) ∧ IsCompact {a : ℝ | ClusterValue (fun n => secondOrderScale n * dN K c n) a} ∧ (∀ (a : PositiveSequence) β C, RegularlyVarying a β → 0 < C → Tendsto (fun n => a n * dN K c n) atTop (nhds C) → β = 4 / 3) ∧ ((∃ (a : PositiveSequence) (C : ℝ), RegularlyVarying a (4 / 3) ∧ 0 < C ∧ Tendsto (fun n => a n * dN K c n) atTop (nhds C)) ↔ SlowlyVaryingEventuallyPositive (fun n => secondOrderScale n * dN K c n)) ∧ (∀ (q : RatContrast K), ratContrastToReal q = c → ∃ grid procedure prior : ℕ → ℝ, RationalCertificateCluster K q grid procedure prior ∧ AsymptoticallyCoincident grid (fun n => secondOrderScale n * dN K c n) ∧ AsymptoticallyCoincident procedure grid ∧ AsymptoticallyCoincident prior grid) ∧ (∃ (cq : ℕ → RatContrast K) (B U lower upper : ℕ → ℝ), (∀ a, Tendsto (fun n => ratContrastToReal (cq n) a) atTop (nhds (c a))) ∧ Tendsto (fun n : ℕ => (n : ℝ) ^ (5 / 6 : ℝ) * contrastDistance c (ratContrastToReal (cq n))) atTop (nhds 0) ∧ (∀ n, 0 < n → ∃ (pi : GridPi K n) (w : GridWeight K n n) (u : ℚ) (nu : CountVec K n → ℚ) (delta : ∀ r : AllocVec K n, ObsVec r → ℝ), ExactGridPrimalDualCertificate (cq n) pi w u nu ∧ IsGridBarycenter (cq n) pi w delta ∧ B n = lowerCertificate (cq n) nu ∧ U n = upperCertificate (cq n) pi delta ∧ lower n = (max 0 (sqrt (B n) - contrastDistance c (ratContrastToReal (cq n)))) ^ 2 ∧ upper n = (sqrt (U n) + contrastDistance c (ratContrastToReal (cq n))) ^ 2 ∧ lower n ≤ rhoN K n c ∧ rhoN K n c ≤ upper n) ∧ AsymptoticallyCoincident (fun n => secondOrderScale n * (C0 c / n - lower n)) (fun n => secondOrderScale n * dN K c n) ∧ AsymptoticallyCoincident (fun n => secondOrderScale n * (C0 c / n - upper n)) (fun n => secondOrderScale n * dN K c n)) ∧ (∃ fullRule : Estimator 3 3 cDagger, worstCaseRisk (fun (p : Procedure 3 3 cDagger) (z : Schedule 3 3) => labeledRisk cDagger p z) (prodDesign (fun _ : Unit 3 => qStarDesign cDagger), fullRule) < k3ScalarMinimaxValue 3) := by classical rcases universal_second_order_rate K c hK with ⟨_hlambda, _hlambdaOne, hkappa, _henvelope, hriskExists, hliminf, hliminfSup, hlimsup, hindex⟩ let x : ℕ → ℝ := fun n => secondOrderScale n * dN K c n have hC0 : 0 < C0 c := by unfold C0 positivity [Lc_pos c] have hxlower : ∀ᶠ n in atTop, C0 c * kappaC c ≤ x n := by rcases hriskExists with ⟨N, _htail, hrisk⟩ filter_upwards [Ici_mem_atTop (max N 1)] with n hn have hnN : N ≤ n := (le_max_left N 1).trans hn have hnpos : 0 < n := lt_of_lt_of_le Nat.zero_lt_one ((le_max_right N 1).trans hn) have hrho : rhoN K n c ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := (minimaxValue_le_worstCaseRisk_of_nonneg (fun p z => p.1.mse_nonneg _ _) (shrinkageProcedure K n c)).trans (hrisk n hnN) have hd : C0 c * kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ dN K c n := by unfold dN have := sub_le_sub_left hrho (C0 c / (n : ℝ)) convert this using 1 <;> ring have hs0 : 0 ≤ secondOrderScale n := by unfold secondOrderScale positivity have hm := mul_le_mul_of_nonneg_left hd hs0 dsimp [x] calc C0 c * kappaC c = (secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ))) * (C0 c * kappaC c) := by rw [secondOrderScale_mul_inverse n hnpos, one_mul] _ = secondOrderScale n * (C0 c * kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by ring _ ≤ secondOrderScale n * dN K c n := hm have hxupper : ∀ᶠ n in atTop, x n ≤ 43 * C0 c := by filter_upwards [Ici_mem_atTop 8] with n hn have hn8 : 8 ≤ n := hn have hnpos : 0 < n := Nat.zero_lt_of_lt hn8 have hd := ((embedded_two_arm_converse K n c hK hnpos).2.2.1 hn8).2.2 have hs0 : 0 ≤ secondOrderScale n := by unfold secondOrderScale positivity have hm := mul_le_mul_of_nonneg_left hd hs0 dsimp [x] calc secondOrderScale n * dN K c n ≤ secondOrderScale n * (43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := hm _ = 43 * C0 c := by rw [show secondOrderScale n * (43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))) = (43 * C0 c) * (secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ))) by ring, secondOrderScale_mul_inverse n hnpos, mul_one] have hxpos : ∀ᶠ n in atTop, 0 < x n := hxlower.mono fun _ hn => (mul_pos hC0 hkappa).trans_le hn have hxIcc : ∀ᶠ n in atTop, x n ∈ Icc (C0 c * kappaC c) (43 * C0 c) := hxlower.and hxupper obtain ⟨hcluster, hcompact⟩ := subsequentialLimitSet_nonempty_compact x (C0 c * kappaC c) (43 * C0 c) hxIcc refine ⟨(mul_pos hC0 hkappa).trans_le hliminf, hliminfSup, hlimsup, ?_, ?_, hindex, ?_, ?_, ?_, ?_⟩ · simpa [ClusterValue, x] using hcluster · simpa [ClusterValue, x] using hcompact · constructor · rintro ⟨a, C, ha, hC, hconv⟩ refine ⟨hxpos, ?_⟩ intro t ht let p : ℕ → ℝ := fun n => a n * dN K c n have hmap := tendsto_nat_floor_mul_atTop t ht have hpRatio : Tendsto (fun n : ℕ => p ⌊t * (n : ℝ)⌋₊ / p n) atTop (nhds 1) := by have h := (hconv.comp hmap).div hconv hC.ne' change Tendsto (((fun n => a n * dN K c n) ∘ fun n : ℕ => ⌊t * (n : ℝ)⌋₊) / fun n => a n * dN K c n) atTop (nhds 1) simpa [p, hC.ne'] using h have hratio := ((secondOrderScalePositive_regularlyVarying t ht).mul hpRatio).div (ha t ht) (ne_of_gt (Real.rpow_pos_of_pos ht (4 / 3))) have heq : (fun n : ℕ => x ⌊t * (n : ℝ)⌋₊ / x n) =ᶠ[atTop] (fun n => (secondOrderScalePositive ⌊t * (n : ℝ)⌋₊ / secondOrderScalePositive n) * (p ⌊t * (n : ℝ)⌋₊ / p n) / (a ⌊t * (n : ℝ)⌋₊ / a n)) := by filter_upwards [Ici_mem_atTop 1, hmap.eventually (Ici_mem_atTop 1), hxpos, hmap.eventually hxpos] with n hn hfn hxn hxf have hn0 : n ≠ 0 := Nat.ne_of_gt (Nat.zero_lt_one.trans_le hn) have hfn0 : ⌊t * (n : ℝ)⌋₊ ≠ 0 := Nat.ne_of_gt (Nat.zero_lt_one.trans_le hfn) have hdn : dN K c n ≠ 0 := by intro hd simp [x, hd] at hxn have hdf : dN K c ⌊t * (n : ℝ)⌋₊ ≠ 0 := by intro hd simp [x, hd] at hxf simp only [secondOrderScalePositive, hn0, hfn0, ↓reduceIte] dsimp [x, p] field_simp [ne_of_gt (a.2 n), ne_of_gt (a.2 ⌊t * (n : ℝ)⌋₊), hdn, hdf] <;> ring change Tendsto (fun n : ℕ => x ⌊t * (n : ℝ)⌋₊ / x n) atTop (nhds 1) convert hratio.congr' heq.symm using 1 simp only [mul_one, div_self (ne_of_gt (Real.rpow_pos_of_pos ht (4 / 3)))] · intro hslow let b : PositiveSequence := eventuallyPositivePatch x have hbEq : (b : ℕ → ℝ) =ᶠ[atTop] x := eventuallyPositivePatch_eventually_eq x hslow.1 have hbslow : RegularlyVarying b 0 := by intro t ht have hmap := tendsto_nat_floor_mul_atTop t ht have hratioEq : (fun n : ℕ => b ⌊t * (n : ℝ)⌋₊ / b n) =ᶠ[atTop] (fun n : ℕ => x ⌊t * (n : ℝ)⌋₊ / x n) := (hbEq.comp_tendsto hmap).div hbEq simpa using (hslow.2 t ht).congr' hratioEq.symm let a : PositiveSequence := ⟨fun n => secondOrderScalePositive n / b n, fun n => div_pos (secondOrderScalePositive.2 n) (b.2 n)⟩ have ha : RegularlyVarying a (4 / 3) := by simpa [a] using regularlyVarying_div secondOrderScalePositive b (4 / 3) 0 secondOrderScalePositive_regularlyVarying hbslow refine ⟨a, 1, ha, by norm_num, ?_⟩ apply tendsto_const_nhds.congr' filter_upwards [Ici_mem_atTop 1, hslow.1, hbEq] with n hn hxn hbn have hn0 : n ≠ 0 := Nat.ne_of_gt (Nat.zero_lt_one.trans_le hn) have hspos : 0 < secondOrderScale n := by have hnR : (0 : ℝ) < n := by exact_mod_cast (Nat.zero_lt_one.trans_le hn) unfold secondOrderScale exact Real.rpow_pos_of_pos hnR _ have hdn : dN K c n ≠ 0 := by intro hd simp [x, hd] at hxn change 1 = (secondOrderScalePositive n / b n) * dN K c n simp only [secondOrderScalePositive, hn0, ↓reduceIte] rw [hbn] dsimp [x] field_simp [hspos.ne', hdn] · intro q hq choose pi w u nu delta hpd hbar hu hBρ hρU hUu huB hcount halloc hobs hasymp using fun m : PositiveNat => rational_contrast_grid_certificate_sandwich K m m q m.2 m.2 let grid : ℕ → ℝ := fun n => if hn : 0 < n then secondOrderScale n * (C0 (ratContrastToReal q) / n - (u ⟨n, hn⟩ : ℝ)) else 0 let procedure : ℕ → ℝ := fun n => if hn : 0 < n then secondOrderScale n * (C0 (ratContrastToReal q) / n - upperCertificate q (pi ⟨n, hn⟩) (delta ⟨n, hn⟩)) else 0 let prior : ℕ → ℝ := fun n => if hn : 0 < n then secondOrderScale n * (C0 (ratContrastToReal q) / n - lowerCertificate q (nu ⟨n, hn⟩)) else 0 refine ⟨grid, procedure, prior, ?_, ?_⟩ · intro n hn let m : PositiveNat := ⟨n, hn⟩ refine ⟨pi m, w m, u m, nu m, delta m, hpd m, hbar m, ?_, ?_, ?_⟩ · simp only [grid, hn, ↓reduceDIte] rw [hu m] · simp [procedure, hn, m] · simp [prior, hn, m] · let B : ℕ → ℝ := fun n => if hn : 0 < n then lowerCertificate q (nu ⟨n, hn⟩) else 0 let U : ℕ → ℝ := fun n => if hn : 0 < n then upperCertificate q (pi ⟨n, hn⟩) (delta ⟨n, hn⟩) else 0 let T : ℕ → ℝ := fun n => if hn : 0 < n then (u ⟨n, hn⟩ : ℝ) else 0 let r : ℕ → ℝ := fun n => rhoN K n (ratContrastToReal q) have hordBT : ∀ᶠ n in atTop, B n ≤ r n ∧ r n ≤ T n := by filter_upwards [Ici_mem_atTop 1] with n hn have hnpos : 0 < n := Nat.zero_lt_one.trans_le hn let m : PositiveNat := ⟨n, hnpos⟩ have htop : rhoN K n (ratContrastToReal q) ≤ (u m : ℝ) := by rw [hu m] exact (hρU m).trans (hUu m) simpa [B, T, r, hnpos, m] using intro (hBρ m) htop have hmesh := secondOrderScale_mesh_tendsto_zero (C0 (ratContrastToReal q)) have hwidthBT : Tendsto (fun n => secondOrderScale n * (T n - B n)) atTop (nhds 0) := by apply squeeze_zero' (g := fun n => secondOrderScale n * (C0 (ratContrastToReal q) / (4 * (n : ℝ) ^ 2))) · filter_upwards [hordBT] with n hn exact mul_nonneg (by unfold secondOrderScale; positivity) (sub_nonneg.mpr (hn.1.trans hn.2)) · filter_upwards [Ici_mem_atTop 1] with n hn have hnpos : 0 < n := Nat.zero_lt_one.trans_le hn let m : PositiveNat := ⟨n, hnpos⟩ have hh : secondOrderScale n * ((u m : ℝ) - lowerCertificate q (nu m)) ≤ secondOrderScale n * (C0 (ratContrastToReal q) / (4 * (n : ℝ) ^ 2)) := by rw [hu m] exact mul_le_mul_of_nonneg_left (by linarith [huB m]) (by unfold secondOrderScale; positivity) -- … truncated; follow the source link for the rest …
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.second_order_rate_and_certificate_frontier · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_second_order_rate_and_certificate_frontier.lean:181
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.T_universal_second_order_rate 6 declarations Universal n^{-4/3} second-order improvement.

Universal n^{-4/3} second-order improvement.

A positive sequence is regularly varying with exponent beta when its value at every fixed positive rescaling is asymptotic to the rescaling factor raised to beta times its original value.

Definition (Lean source)
a :
ℕ → ℝ
β :
x :
0 < x
RegularlyVarying a β :
Prop
Tendsto (fun n : ℕ => a ⌊ x * (n : ℝ) ⌋₊ / a n) atTop (nhds (x ^ β))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RegularlyVarying · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_universal_second_order_rate.lean:12
theorem dyadic_ratio_limit_eq_one Lemma dyadic_ratio_limit_eq_one in the paper ↗

the comparison sequence is eventually positive, the ratio sequence is positive, the stated dyadic bounds hold, the dyadic ratio converges to one, A positive sequence bounded above and away from zero cannot have a non-unit doubling-ratio limit.

Formal statement
b :
ℕ → ℝ
r :
hbpos :
∀ n, 0 < b n
hrpos :
0 < r
hbounds :
∃ l u : ℝ, 0 < l ∧ ∀ᶠ n in atTop, l ≤ b n ∧ b n ≤ u
hratio :
Tendsto (fun n => b (2 * n) / b n) atTop (nhds r)
r = 1
Proof (Lean source)
-- @node: dyadic_ratio_limit_eq_one lemma dyadic_ratio_limit_eq_one (b : ℕ → ℝ) (r : ℝ) (hbpos : ∀ n, 0 < b n) (hrpos : 0 < r) (hbounds : ∃ l u : ℝ, 0 < l ∧ ∀ᶠ n in atTop, l ≤ b n ∧ b n ≤ u) (hratio : Tendsto (fun n => b (2 * n) / b n) atTop (nhds r)) : r = 1 := by let u : ℕ → ℝ := fun k => log (b (2 ^ k)) have hpow : Tendsto (fun k : ℕ => 2 ^ k) atTop atTop := tendsto_pow_atTop_atTop_of_one_lt (by norm_num) have hratio' : Tendsto (fun k => b (2 * 2 ^ k) / b (2 ^ k)) atTop (nhds r) := hratio.comp hpow have hdiff : Tendsto (fun k => u (k + 1) - u k) atTop (nhds (log r)) := by have hlog := hratio'.log hrpos.ne' convert hlog using 1 · funext k simp only [u, pow_succ'] rw [Real.log_div (hbpos _).ne' (hbpos _).ne'] have hces := hdiff.cesaro rcases hbounds with ⟨l, v, hl, hbds⟩ have hbds' : ∀ᶠ k in atTop, l ≤ b (2 ^ k) ∧ b (2 ^ k) ≤ v := hpow.eventually hbds have hulow : ∀ᶠ k in atTop, log l ≤ u k := by filter_upwards [hbds'] with k hk exact Real.log_le_log hl hk.1 have huhi : ∀ᶠ k in atTop, u k ≤ log v := by filter_upwards [hbds'] with k hk exact Real.log_le_log (hbpos _) hk.2 have havg0 : Tendsto (fun n : ℕ => (n : ℝ)⁻¹ * ∑ i ∈ range n, (u (i + 1) - u i)) atTop (nhds 0) := by have hlow' : ∀ᶠ k in atTop, log l - u 0 ≤ u k - u 0 := hulow.mono (fun _ hk => sub_le_sub_right hk _) have hhi' : ∀ᶠ k in atTop, u k - u 0 ≤ log v - u 0 := huhi.mono (fun _ hk => sub_le_sub_right hk _) have hquot : Tendsto (fun n : ℕ => (u n - u 0) / (n : ℝ)) atTop (nhds 0) := tendsto_bdd_div_atTop_nhds_zero hlow' hhi' tendsto_natCast_atTop_atTop convert hquot using 1 funext n rw [Finset.sum_range_sub] simp [div_eq_mul_inv, mul_comm] have : log r = 0 := tendsto_nhds_unique hces havg0 exact Real.eq_one_of_pos_of_log_eq_zero hrpos this
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.dyadic_ratio_limit_eq_one · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_universal_second_order_rate.lean:17
theorem shrinkage_tail_prefactor_tendsto_zero Lemma shrinkage_tail_prefactor_tendsto_zero in the paper ↗

The polynomial prefactor in the local shrinkage tail error is dominated by the stretched-exponential decay.

Formal statement
Tendsto (fun n : ℕ => (n : ℝ) * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8)) atTop (nhds 0)
Proof (Lean source)
-- @node: shrinkage_tail_prefactor_tendsto_zero lemma shrinkage_tail_prefactor_tendsto_zero : Tendsto (fun n : ℕ => (n : ℝ) * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8)) atTop (nhds 0) := by let t : ℕ → ℝ := fun n => (n : ℝ) ^ (1 / 3 : ℝ) have ht : Tendsto t atTop atTop := (tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 3)).comp tendsto_natCast_atTop_atTop have h := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero (3 : ℝ) (1 / 8 : ℝ) (by norm_num)).comp ht apply h.congr' filter_upwards [Ici_mem_atTop 1] with n hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn dsimp [t] rw [← Real.rpow_mul hnR.le] congr 1 · norm_num · ring
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.shrinkage_tail_prefactor_tendsto_zero · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_universal_second_order_rate.lean:58
theorem secondOrderScale_mul_inverse

the population size is positive, The second-order scale exactly cancels its reciprocal power at positive sample sizes.

Formal statement
n :
hn :
0 < n
secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ)) = 1
Proof (Lean source)
-- @node: secondOrderScale_mul_inverse lemma secondOrderScale_mul_inverse (n : ℕ) (hn : 0 < n) : secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ)) = 1 := by have hnR : (0 : ℝ) < n := by exact_mod_cast hn unfold secondOrderScale rw [← Real.rpow_add hnR] norm_num
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.secondOrderScale_mul_inverse · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_universal_second_order_rate.lean:77
theorem minimaxEnvelopeBound_of_contrastWeightedProcedure

The contrast-weighted procedure supplies the minimax envelope, including the degenerate zero-unit experiment.

Formal statement
K :
c :
Contrast ℝ K
Proof (Lean source)
lemma minimaxEnvelopeBound_of_contrastWeightedProcedure (K : ℕ) (c : Contrast ℝ K) : MinimaxEnvelopeBound K c := by intro n by_cases hn : n = 0 · subst n have hLc : 0 ≤ Lc c := sum_nonneg fun _ _ => abs_nonneg _ have hclip : clip c 0 = 0 := by unfold clip rw [min_eq_right (by linarith), max_eq_right (by linarith)] have hzero : labeledRisk c (contrastWeightedProcedure K 0 c) (fun i => elim0 i) = 0 := by simp [labeledRisk, mse, tauC, contrastWeightedProcedure, centeredContrastScore, hclip] calc rhoN K 0 c ≤ worstCaseRisk (fun (p : Procedure K 0 c) (z : Schedule K 0) => labeledRisk c p z) (contrastWeightedProcedure K 0 c) := minimaxValue_le_worstCaseRisk_of_nonneg (fun p z => p.1.mse_nonneg _ _) _ _ ≤ 0 := by apply Causalean.Stat.worstCaseRisk_le intro z have hz : z = fun i => elim0 i := by funext i exact elim0 i simpa [hz] using hzero.le _ = C0 c / ((0 : ℕ) : ℝ) := by simp · exact (minimaxValue_le_worstCaseRisk_of_nonneg (fun p z => p.1.mse_nonneg _ _) (contrastWeightedProcedure K n c)).trans (contrastWeightedProcedure_upperRisk K n c (Nat.pos_of_ne_zero hn))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.minimaxEnvelopeBound_of_contrastWeightedProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_universal_second_order_rate.lean:87
theorem universal_second_order_rate Theorem 5 in the paper ↗

there are at least two treatment arms, the contrast-score shrinkage procedure improves on the first-order risk by order n4/3n^{-4/3} uniformly over response schedules.

Formal statement
K :
c :
Contrast ℝ K
conclusion 1
0 < lambdaC c
conclusion 2
lambdaC c ≤ 1
conclusion 3
0 < kappaC c
conclusion 4
conclusion 5
∃ N : ℕ,
m :
N ≤ m
4 * sqrt (lambdaC c) * (m : ℝ) * exp (-(m : ℝ) ^ (1 / 3 : ℝ) / 8)
sqrt (lambdaC c) / 2 - lambdaC c / 16
n ≥ N :
worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c)
C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)))
conclusion 6
C0 c * kappaC c ≤ liminf (fun n => secondOrderScale n * dN K c n) atTop
conclusion 7
liminf (fun n => secondOrderScale n * dN K c n) atTop
limsup (fun n => secondOrderScale n * dN K c n) atTop
conclusion 8
limsup (fun n => secondOrderScale n * dN K c n) atTop ≤ 43 * C0 c
conclusion 9
(a : PositiveSequence) β C :
0 < C
Tendsto (fun n => a n * dN K c n) atTop (nhds C)
β = 4 / 3
Proof (Lean source)
theorem universal_second_order_rate (K : ℕ) (c : Contrast ℝ K) (hK : AdmissibleArmCount K) : 0 < lambdaC c ∧ lambdaC c ≤ 1 ∧ 0 < kappaC c ∧ MinimaxEnvelopeBound K c ∧ (∃ N : ℕ, (∀ m : ℕ, N ≤ m → 4 * sqrt (lambdaC c) * (m : ℝ) * exp (-(m : ℝ) ^ (1 / 3 : ℝ) / 8) ≤ sqrt (lambdaC c) / 2 - lambdaC c / 16) ∧ ∀ n ≥ N, worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c) ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)))) ∧ C0 c * kappaC c ≤ liminf (fun n => secondOrderScale n * dN K c n) atTopliminf (fun n => secondOrderScale n * dN K c n) atToplimsup (fun n => secondOrderScale n * dN K c n) atToplimsup (fun n => secondOrderScale n * dN K c n) atTop ≤ 43 * C0 c ∧ (∀ (a : PositiveSequence) β C, RegularlyVarying a β → 0 < C → Tendsto (fun n => a n * dN K c n) atTop (nhds C) → β = 4 / 3) := by rcases lambdaC_pos_le_one c with ⟨hlambda, hlambda1⟩ have hkappa := kappaC_pos c have hA : 0 < sqrt (lambdaC c) / 2 - lambdaC c / 16 := by have hs := Real.sq_sqrt hlambda.le nlinarith [Real.sqrt_nonneg (lambdaC c)] have htail0 : Tendsto (fun n : ℕ => 4 * sqrt (lambdaC c) * ((n : ℝ) * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8))) atTop (nhds 0) := by simpa using (shrinkage_tail_prefactor_tendsto_zero.const_mul (4 * sqrt (lambdaC c))) have htailEv : ∀ᶠ n : ℕ in atTop, 4 * sqrt (lambdaC c) * (n : ℝ) * exp (-(n : ℝ) ^ (1 / 3 : ℝ) / 8) ≤ sqrt (lambdaC c) / 2 - lambdaC c / 16 := by have hev := (tendsto_order.1 htail0).2 _ hA filter_upwards [hev] with n hn simpa [mul_assoc] using hn.le obtain ⟨N0, hN0⟩ := eventually_atTop.1 htailEv let N := max N0 1 have hNpos : 0 < N := lt_of_lt_of_le Nat.zero_lt_one (le_max_right _ _) have hrisk : ∀ n ≥ N, worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c) ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by intro n hn apply shrinkageProcedure_risk_bound_of_tail K n c (hNpos.trans_le hn) exact hN0 n ((le_max_left _ _).trans hn) have hthresholdWitness : ∃ N : ℕ, (∀ m : ℕ, N ≤ m → 4 * sqrt (lambdaC c) * (m : ℝ) * exp (-(m : ℝ) ^ (1 / 3 : ℝ) / 8) ≤ sqrt (lambdaC c) / 2 - lambdaC c / 16) ∧ ∀ n ≥ N, worstCaseRisk (fun (p : Procedure K n c) (z : Schedule K n) => labeledRisk c p z) (shrinkageProcedure K n c) ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by exact ⟨N, fun m hm => hN0 m ((le_max_left N0 1).trans hm), hrisk⟩ let f : ℕ → ℝ := fun n => secondOrderScale n * dN K c n have hflower : ∀ᶠ n in atTop, C0 c * kappaC c ≤ f n := by filter_upwards [Ici_mem_atTop N] with n hn have hnpos := hNpos.trans_le hn have hrho : rhoN K n c ≤ C0 c * ((n : ℝ)⁻¹ - kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by exact (minimaxValue_le_worstCaseRisk_of_nonneg (fun p z => p.1.mse_nonneg _ _) (shrinkageProcedure K n c)).trans (hrisk n hn) have hd : C0 c * kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ)) ≤ dN K c n := by have hsub := sub_le_sub_left hrho (C0 c / (n : ℝ)) unfold dN convert hsub using 1 <;> ring have hs0 : 0 ≤ secondOrderScale n := by unfold secondOrderScale positivity have hm := mul_le_mul_of_nonneg_left hd hs0 dsimp [f] calc C0 c * kappaC c = (secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ))) * (C0 c * kappaC c) := by rw [secondOrderScale_mul_inverse n hnpos, one_mul] _ = secondOrderScale n * (C0 c * kappaC c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := by ring _ ≤ secondOrderScale n * dN K c n := hm have hfupper : ∀ᶠ n in atTop, f n ≤ 43 * C0 c := by filter_upwards [Ici_mem_atTop 8] with n hn have hn8 : 8 ≤ n := hn have hnpos : 0 < n := by omega have hc := (embedded_two_arm_converse K n c hK hnpos).2.2.1 hn8 have hd := hc.2.2 have hs0 : 0 ≤ secondOrderScale n := by unfold secondOrderScale; positivity have hm := mul_le_mul_of_nonneg_left hd hs0 dsimp [f] calc secondOrderScale n * dN K c n ≤ secondOrderScale n * (43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))) := hm _ = 43 * C0 c := by rw [show secondOrderScale n * (43 * C0 c * (n : ℝ) ^ (-(4 / 3 : ℝ))) = (43 * C0 c) * (secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ))) by ring, secondOrderScale_mul_inverse n hnpos, mul_one] have hf_bdd_above : IsBoundedUnder (· ≤ ·) atTop f := isBoundedUnder_of_eventually_le hfupper have hf_bdd_below : IsBoundedUnder (· ≥ ·) atTop f := isBoundedUnder_of_eventually_ge hflower have hli : C0 c * kappaC c ≤ liminf f atTop := le_liminf_of_le (hf_bdd_above.isCoboundedUnder_ge) hflower have hls : limsup f atTop ≤ 43 * C0 c := limsup_le_of_le (hf_bdd_below.isCoboundedUnder_le) hfupper have hil : liminf f atToplimsup f atTop := liminf_le_limsup hf_bdd_above hf_bdd_below refine ⟨hlambda, hlambda1, hkappa, minimaxEnvelopeBound_of_contrastWeightedProcedure K c, hthresholdWitness, hli, hil, hls, ?_⟩ intro a β C hreg hC hconv have hC0 : 0 < C0 c := by unfold C0 positivity [Lc_pos c] let b : ℕ → ℝ := fun n => if n = 0 then 1 else a n * (n : ℝ) ^ (-(4 / 3 : ℝ)) have hbpos : ∀ n, 0 < b n := by intro n by_cases hn : n = 0 · simp [b, hn] · simp only [b, hn, ↓reduceIte] exact mul_pos (a.2 n) (Real.rpow_pos_of_pos (by exact_mod_cast Nat.pos_of_ne_zero hn) _) have hprod : ∀ᶠ n in atTop, b n * f n = a n * dN K c n := by filter_upwards [Ici_mem_atTop 1] with n hn have hnpos : 0 < n := hn simp only [b, ne_of_gt hnpos, ↓reduceIte, f] rw [show (a : ℕ → ℝ) n * (n : ℝ) ^ (-(4 / 3 : ℝ)) * (secondOrderScale n * dN K c n) = a n * dN K c n * (secondOrderScale n * (n : ℝ) ^ (-(4 / 3 : ℝ))) by ring, secondOrderScale_mul_inverse n hnpos, mul_one] have hqbounds : ∀ᶠ n in atTop, C / 2 ≤ a n * dN K c n ∧ a n * dN K c n ≤ 2 * C := by have hl := (tendsto_order.1 hconv).1 (C / 2) (by linarith) have hu := (tendsto_order.1 hconv).2 (2 * C) (by linarith) exact hl.and hu |>.mono (fun _ h => ⟨h.1.le, h.2.le⟩) have hbbounds : ∀ᶠ n in atTop, C / (2 * (43 * C0 c)) ≤ b n ∧ b n ≤ (2 * C) / (C0 c * kappaC c) := by filter_upwards [hflower, hfupper, hqbounds, hprod] with n hfl hfu hq hp have hb := (hbpos n).le have hlowden : 0 < C0 c * kappaC c := mul_pos hC0 hkappa have hupden : 0 < 2 * (43 * C0 c) := by positivity constructor · rw [← hp] at hq apply (div_le_iff₀ hupden).2 nlinarith · rw [← hp] at hq apply (le_div_iff₀ hlowden).2 nlinarith have haRatio := hreg 2 (by norm_num) have haRatio' : Tendsto (fun n : ℕ => a (2 * n) / a n) atTop (nhds ((2 : ℝ) ^ β)) := by convert haRatio using 1 funext n congr 2 have hcast : (2 : ℝ) * (n : ℝ) = ((2 * n : ℕ) : ℝ) := by norm_num rw [hcast, Nat.floor_natCast] have hbratio : Tendsto (fun n => b (2 * n) / b n) atTop (nhds ((2 : ℝ) ^ (β - 4 / 3))) := by have hmul := haRatio'.mul_const ((2 : ℝ) ^ (-(4 / 3 : ℝ))) have hmul' : Tendsto (fun n => b (2 * n) / b n) atTop (nhds ((2 : ℝ) ^ β * (2 : ℝ) ^ (-(4 / 3 : ℝ)))) := by apply hmul.congr' filter_upwards [Ici_mem_atTop 1] with n hn have hnpos : 0 < n := hn have h2npos : 0 < 2 * n := by omega simp only [b, ne_of_gt hnpos, ne_of_gt h2npos, ↓reduceIte] have hnR : (0 : ℝ) < n := by exact_mod_cast hnpos rw [show ((2 * n : ℕ) : ℝ) = (2 : ℝ) * n by norm_num, Real.mul_rpow (by norm_num : (0 : ℝ) ≤ 2) hnR.le] field_simp [ne_of_gt (a.2 n), ne_of_gt (Real.rpow_pos_of_pos hnR _)] convert hmul' using 1 rw [← Real.rpow_add (by norm_num : (0 : ℝ) < 2)] congr 1 have hrpos : 0 < (2 : ℝ) ^ (β - 4 / 3) := Real.rpow_pos_of_pos (by norm_num) _ have hbindex := dyadic_ratio_limit_eq_one b ((2 : ℝ) ^ (β - 4 / 3)) hbpos hrpos ⟨C / (2 * (43 * C0 c)), (2 * C) / (C0 c * kappaC c), by positivity, hbbounds⟩ hbratio have hexp : β - 4 / 3 = 0 := by apply (Real.strictMono_rpow_of_base_gt_one (by norm_num : (1 : ℝ) < 2)).injective simpa using hbindex linarith
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.universal_second_order_rate · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/T_universal_second_order_rate.lean:120
CausalSmith.Experimentation.EXP_MultiarmSecondorderMinimaxFrontier_Research.World 58 declarations Shared finite-population objects for the multi-arm second-order minimax frontier.

Shared finite-population objects for the multi-arm second-order minimax frontier.

The paper works with complete binary response schedules and arbitrary finite assignment designs. This module contains only the common carriers and exact finite-sum constructions; theorem claims live in the planned theorem files.

The treatment-arm set in a KK-arm experiment consists of the KK arm labels.

Definition (Lean source)
K :
Arm K :
Type
Fin K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Arm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:19

The unit set in a population of size nn consists of the nn unit labels.

Definition (Lean source)
n :
Unit n :
Type
Fin n
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Unit · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:21

A binary response type assigns a potential-outcome bit to every treatment arm.

Definition (Lean source)
K :
RespType K :
Type
Arm K → Bool
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RespType · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:23

A complete binary response schedule assigns a response type to every unit.

Definition (Lean source)
K n :
Schedule K n :
Type
Unit n → RespType K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Schedule · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:25

An assignment allocates one treatment arm to every unit.

Definition (Lean source)
K n :
Assign K n :
Type
Unit n → Arm K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Assign · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:27
def ObservedOutcome

An observed-outcome vector records one binary outcome for every unit.

Definition (Lean source)
n :
ObservedOutcome n :
Type
Unit n → Bool
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ObservedOutcome · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:29

A nonzero, zero-sum contrast.

Definition (Lean source)
F :
K :
coeff :
Arm K → F
nonzero :
coeff ≠ 0
sum_zero :
∑ a, coeff a = 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Contrast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:32
instance instCoeFunContrastForallArm

The contrast forall arm object can be evaluated as its underlying function.

Definition (Lean source)
instance {F K} [AddCommMonoid F] : CoeFun (Contrast F K) (fun _ => Arm K → F) := ⟨Contrast.coeff⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instCoeFunContrastForallArm · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:38
def AdmissibleArmCount

The paper's standing arm-count domain.

Definition (Lean source)
K :
AdmissibleArmCount K :
Prop
2 ≤ K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.AdmissibleArmCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:42
def PositiveNat

Positive natural indices used by the paper's finite-population LPs.

Definition (Lean source)
PositiveNat :
Type
{m : ℕ // 0 < m}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PositiveNat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:46
instance instCoePositiveNatNat

A positive nat nat value has its natural numerical representation.

Definition (Lean source)
instance : Coe PositiveNat ℕ := ⟨Subtype.val⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instCoePositiveNatNat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:49
def RealContrast

Real nonzero zero-sum contrasts, as opposed to the generic algebraic helper.

Definition (Lean source)
K :
RealContrast K :
Type
Contrast ℝ K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RealContrast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:52

The active support of a contrast.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
Sc c :
Finset.univ.filter fun a => c a ≠ 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Sc · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:61
def Lc

The contrast ℓ1 norm.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
Lc c :
∑ a, |c a|
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Lc · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:66
def qStar

Contrast-weighted arm allocation.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
a :
Arm K
qStar c a :
|c a| / Lc c
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.qStar · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:70
def potentialOutcome

The fixed potential outcome of unit i under arm a.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
i :
a :
Arm K
potentialOutcome z i a :
z i a
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.potentialOutcome · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:74
def obsOutcome

Observed outcomes under a realized assignment.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
A :
Assign K n
obsOutcome z A :
fun i => potentialOutcome z i (A i)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.obsOutcome · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:78

The finite-population contrast target.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
z :
Schedule K n
tauC c z :
((n : ℝ)⁻¹) * ∑ i, ∑ a, c a * if z i a then 1 else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauC · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:83
def clip

Clipping to the natural contrast range.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
x :
clip c x :
max (-Lc c / 2) (min (Lc c / 2) x)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clip · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:88
theorem clip_mem

the clipped estimate lies in the natural closed interval from minus one half to one half of the contrast norm.

Formal statement
K :
shared
c :
Contrast ℝ K
x :
clip c x ∈ Icc (-Lc c / 2) (Lc c / 2)
Proof (Lean source)
lemma clip_mem (c : Contrast ℝ K) (x : ℝ) : clip c x ∈ Icc (-Lc c / 2) (Lc c / 2) := by have hLc : 0 ≤ Lc c := sum_nonneg fun _ _ => abs_nonneg _ constructor · exact le_max_left _ _ · apply max_le · rw [neg_div] exact neg_le_self (div_nonneg hLc (by norm_num)) · exact min_le_left _ _
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.clip_mem · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:92

An arbitrary clipped, possibly biased estimator.

Definition (Lean source)
K n :
c :
Contrast ℝ K
Estimator K n c :
Type
Assign K n → ObservedOutcome n → Icc (-Lc c / 2) (Lc c / 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Estimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:103

A decision procedure pairs an arbitrary assignment law and a clipped estimator.

Definition (Lean source)
K n :
c :
Contrast ℝ K
Procedure K n c :
Type
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Procedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:108

Design-based squared error of a procedure at a fixed schedule.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
shared
p :
Procedure K n c
z :
Schedule K n
labeledRisk c p z :
p.1.mse (fun A => p.2 A (obsOutcome z A)) (tauC c z)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.labeledRisk · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:113

First-order risk constant.

Definition (Lean source)
K :
shared
c :
Contrast ℝ K
C0 c :
Lc c ^ 2 / 4
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.C0 · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:118

A response-type count vector with total population size n.

Definition (Lean source)
K n :
CountVec K n :
Type
{m : RespType K → Fin (n + 1) // ∑ t, (m t : ℕ) = n}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.CountVec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:122

An arm-allocation count vector with total population size n.

Definition (Lean source)
K n :
AllocVec K n :
Type
{r : Arm K → Fin (n + 1) // ∑ a, (r a : ℕ) = n}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.AllocVec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:128

Arm-specific observed-success counts compatible with r.

Definition (Lean source)
K n :
r :
ObsVec r :
Type
{x : Arm K → Fin (n + 1) // ∀ a, (x a : ℕ) ≤ (r.1 a : ℕ)}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ObsVec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:134
def Contingency

A response-type by arm contingency table.

Definition (Lean source)
K n :
Contingency K n :
Type
RespType K → Arm K → Fin (n + 1)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.Contingency · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:139
instance instFintypeCountVec

The count vec collection has a finite enumeration.

Definition (Lean source)
instance (K n : ℕ) : Fintype (CountVec K n) := by unfold CountVec infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeCountVec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:143
instance instFintypeAllocVec

The alloc vec collection has a finite enumeration.

Definition (Lean source)
instance (K n : ℕ) : Fintype (AllocVec K n) := by unfold AllocVec infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeAllocVec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:148
instance instFintypeObsVec

The obs vec collection has a finite enumeration.

Definition (Lean source)
instance {K n : ℕ} (r : AllocVec K n) : Fintype (ObsVec r) := by unfold ObsVec infer_instance
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instFintypeObsVec · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:153

The exact feasible contingency-table fiber.

Definition (Lean source)
K :
shared
n :
shared
m :
r :
x :
contingencyFiber m r x :
Finset.univ.filter fun h => (∀ t, ∑ a, (h t a : ℕ) = (m.1 t : ℕ)) ∧
(∀ a, ∑ t, (h t a : ℕ) = (r.1 a : ℕ)) ∧
(∀ a, ∑ t with t a = true, (h t a : ℕ) = (x.1 a : ℕ))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.contingencyFiber · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:158

Orbit form of the contrast target.

Definition (Lean source)
K :
shared
n :
shared
c :
Contrast ℝ K
m :
tauCount c m :
((n : ℝ)⁻¹) * ∑ t, (m.1 t : ℝ) * ∑ a, c a * if t a then 1 else 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.tauCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:167
def rawScheduleCount

The raw schedule count is the number of units having a specified response type.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
t :
rawScheduleCount z t :
Fin (n + 1)
⟨(Finset.univ.filter fun i => z i = t).card, Nat.lt_succ_iff.mpr (by simpa using Finset.card_le_card (filter_subset (fun i => z i = t) univ))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawScheduleCount · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:172
theorem rawScheduleCount_sum

the raw schedule count sums.

Formal statement
K :
shared
n :
shared
z :
Schedule K n
∑ t, ((rawScheduleCount z t : Fin (n + 1)) : ℕ) = n
Proof (Lean source)
lemma rawScheduleCount_sum (z : Schedule K n) : ∑ t, ((rawScheduleCount z t : Fin (n + 1)) : ℕ) = n := by symm simpa [rawScheduleCount] using (Finset.card_eq_sum_card_fiberwise (s := (Finset.univ : Finset (Unit n))) (t := (Finset.univ : Finset (RespType K))) (f := z) (by simp))
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rawScheduleCount_sum · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:178

The response-type orbit of a labeled schedule.

Definition (Lean source)
K :
shared
n :
shared
z :
Schedule K n
scheduleCounts z :
⟨rawScheduleCount z, rawScheduleCount_sum z⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.scheduleCounts · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:186
def OrbitEstimator

An invariant estimator is indexed by allocation and success-count orbits.

Definition (Lean source)
K n :
c :
Contrast ℝ K
OrbitEstimator K n c :
Type
∀ r : AllocVec K n
if
then
Icc (-Lc c / 2) (Lc c / 2)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.OrbitEstimator · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:193

An orbit procedure is a mixture over allocation orbits and an invariant estimator.

Definition (Lean source)
K n :
c :
Contrast ℝ K
OrbitProcedure K n c :
Type
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.OrbitProcedure · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:198

Rational contrasts used by the exact grid programs.

Definition (Lean source)
K :
RatContrast K :
Type
Contrast ℚ K
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RatContrast · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:203
theorem ratContrast_nonzero_real

the rat contrast nonzero real property holds.

Formal statement
K :
shared
c :
(fun a => (c a : ℝ)) ≠ 0
Proof (Lean source)
lemma ratContrast_nonzero_real (c : RatContrast K) : (fun a => (c a : ℝ)) ≠ 0 := by intro h apply c.nonzero funext a have ha := congrFun h a norm_num at ha ⊢ exact ha
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ratContrast_nonzero_real · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:206
theorem ratContrast_sum_zero_real

the rat contrast sums zero real.

Formal statement
K :
shared
c :
∑ a, (c a : ℝ) = 0
Proof (Lean source)
lemma ratContrast_sum_zero_real (c : RatContrast K) : ∑ a, (c a : ℝ) = 0 := by rw [← Rat.cast_sum univ] norm_num [c.sum_zero]
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ratContrast_sum_zero_real · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:216

A rational contrast is embedded into the real contrast space by interpreting each coefficient as a real number.

Definition (Lean source)
K :
shared
c :
ratContrastToReal c :
Contrast ℝ K
clause 1
coeff a := c a
clause 2
clause 3
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.ratContrastToReal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:222
def LcRat

Rational ℓ1 norm and half-range.

Definition (Lean source)
K :
shared
c :
LcRat c :
∑ a, |c a|
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.LcRat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:228
def hRat

The rational half-range is one half of the rational contrast norm.

Definition (Lean source)
K :
shared
c :
hRat c :
LcRat c / 2
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.hRat · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:230
def gammaMC

Contrast-scaled rational action grid.

Definition (Lean source)
K :
shared
M :
c :
j :
Fin (2 * M + 1)
gammaMC M c j :
-hRat c + (j : ℚ) * hRat c / M
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.gammaMC · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:237

A rational grid design assigns a rational mass to every allocation-count vector.

Definition (Lean source)
K n :
GridPi K n :
Type
AllocVec K n → ℚ
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridPi · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:245

A grid weight assigns a real joint design-and-action mass to every allocation count, compatible success count, and grid action.

Definition (Lean source)
K n M :
GridWeight K n M :
Type
∀ r : AllocVec K n
if
and
Fin (2 * M + 1)
then
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridWeight · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:247
def RationalGridWeight

Rational coordinates used to certify a paper-facing real grid weight.

Definition (Lean source)
K n M :
RationalGridWeight K n M :
Type
∀ r : AllocVec K n
if
and
Fin (2 * M + 1)
then
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RationalGridWeight · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:252
def rationalGridWeightToReal

Coordinatewise cast from an exact rational certificate to the paper-facing weight.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
w :
rationalGridWeightToReal M w :
fun r x g => (w r x g : ℝ)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rationalGridWeightToReal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:256

Every joint design--action coordinate lies in the paper's unit interval.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
w :
r x g :
GridWeightInRange M w :
Prop
clause 1
0 ≤ w r x g
clause 2
w r x g ≤ 1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.GridWeightInRange · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:260

The rational certificate representation only needs the sign row explicitly; the occupancy equations and simplex constraint imply the upper bound.

Definition (Lean source)
K :
shared
n :
shared
M :
shared
w :
r x g :
RationalGridWeightNonnegative M w :
Prop
0 ≤ w r x g
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.RationalGridWeightNonnegative · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:265

The two-arm response type (1,0).

Definition (Lean source)
twoArmPositiveEffectType :
fun a => a == 0
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmPositiveEffectType · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:271

The two-arm response type (0,1).

Definition (Lean source)
twoArmNegativeEffectType :
fun a => a == 1
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.twoArmNegativeEffectType · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:274

The positive-effect coordinate of the full four-count orbit vector.

Definition (Lean source)
n :
shared
m :
pPlus m :
Fin (n + 1)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.pPlus · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:277

The negative-effect coordinate of the full four-count orbit vector.

Definition (Lean source)
n :
shared
m :
pMinus m :
Fin (n + 1)
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.pMinus · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:281
def rZero

The zero-effect count, represented as the complement of the two distinct effect coordinates in the complete four-count orbit vector.

Definition (Lean source)
n :
shared
m :
rZero m :
Fin (n + 1)
⟨n
- (pPlus m : ℕ)
- (pMinus m : ℕ), Nat.lt_succ_of_le ((Nat.sub_le _ (pMinus m : ℕ)).trans (Nat.sub_le n (pPlus m : ℕ)))⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.rZero · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:285

Positive normalizers used in conditional second-order statements.

Definition (Lean source)
PositiveSequence :
Type
{a : ℕ → ℝ // ∀ n, 0 < a n}
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.PositiveSequence · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:294
instance instCoeFunPositiveSequenceForallNatReal

The positive sequence forall nat real object can be evaluated as its underlying function.

Definition (Lean source)
instance : CoeFun PositiveSequence (fun _ => ℕ → ℝ) := ⟨fun a => a.1⟩
CausalSmith.Experimentation.MultiarmSecondorderMinimaxFrontier.instCoeFunPositiveSequenceForallNatReal · CausalSmith/Experimentation/EXP_MultiarmSecondorderMinimaxFrontier_Research/World.lean:298