Stat.Inference
Inferential tooling: delta methods (scalar, functional, Hadamard), Wald/chi-squared statistics, and Slutsky ingredients.
AffineInversion 2 core · 4 supporting This module develops model-free geometry and expected-volume bounds for confidence sets obtained by inverting a scalar affine inequality over a finite-volume parameter region. ★ expectedRestrictedVolume_affineInversion_frontier_le
Affine test inversion
This module develops model-free geometry and expected-volume bounds for confidence sets obtained by inverting a scalar affine inequality over a finite-volume parameter region. The final result converts a mean-radius bound and a bad-slope probability into the capped inverse-square-root frontier rate.
Given a real parameter region, real-valued intercept, slope, and radius parameters, the affine-inversion acceptance set consists exactly of those parameter values in the region whose affine discrepancy is at most .
Affine-inversion frontier bound over a finite-volume region. Fix a probability space (Ω, Q), real-valued functions A, B, K on it, and a region of the line with finite Lebesgue measure. Suppose a nonnegative radius scale L, a positive centering level mu and a positive sample size n; suppose K is pointwise nonnegative and Q-integrable with Q-mean at most Kbar, and that the Q-probability that B deviates from mu by more than mu/2 is at most q. Suppose further a positive scale kappa, a nonnegative inflation factor inflation and nonnegative slack Y, with Kbar controlled by inflation · kappa and the bad-event contribution (vol region) · q controlled by Y / t, where t is defined as n · mu² / kappa. Then the Q-expected restricted volume of the affine-inversion set built from A, B and the shrinking radius L · √(K/n) is at most max(vol region, 4·√inflation·L + Y) · min(1, t^(-1/2)).
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
affineInversionSet_restrictedVolume_letheorem — Affine inversion has restricted volume at most the parameter-region volume and at most twice the radius divided by the nonzero slope.hypothesesconclusionrestrictedSetVolume region (affineInversionSet region A B r)Proof (Lean source)
theorem affineInversionSet_restrictedVolume_le (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B r : ℝ) (hB : B ≠ 0) (hr : 0 ≤ r) : restrictedSetVolume region (affineInversionSet region A B r) ≤ min (volume region).toReal (2 * r / |B|) := by have hAbsB : 0 < |B| := abs_pos.mpr hB apply le_min · unfold restrictedSetVolume exact ENNReal.toReal_mono hregionFinite (measure_mono Set.inter_subset_right) · have hsub : affineInversionSet region A B r ∩ region ⊆ Icc (A / B - r / |B|) (A / B + r / |B|) := by intro x hx have hscore := hx.1.2 change A / B - r / |B| ≤ x ∧ x ≤ A / B + r / |B| have hid : A - x * B = B * (A / B - x) := by field_simp [hB] rw [hid, abs_mul] at hscore have hx' : |A / B - x| ≤ r / |B| := by rw [le_div_iff₀ hAbsB] simpa [mul_comm] using hscore rw [abs_le] at hx' constructor <;> linarith unfold restrictedSetVolume calc (volume (affineInversionSet region A B r ∩ region)).toReal ≤ (volume (Icc (A / B - r / |B|) (A / B + r / |B|))).toReal := ENNReal.toReal_mono (by simp [Real.volume_Icc]) (measure_mono hsub) _ = 2 * r / |B| := by simp [Real.volume_Icc, ENNReal.toReal_ofReal, div_nonneg hr hAbsB.le] field_simp ring -
affineInversionSet_restrictedVolume_le_regiontheorem — Affine inversion is always bounded by the volume of its parameter region.hypothesesconclusionProof (Lean source)
theorem affineInversionSet_restrictedVolume_le_region (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B r : ℝ) : restrictedSetVolume region (affineInversionSet region A B r) ≤ (volume region).toReal := by unfold restrictedSetVolume exact ENNReal.toReal_mono hregionFinite (measure_mono Set.inter_subset_right) -
expectedRestrictedVolume_affineInversion_letheorem — Expected restricted volume for affine inversion is controlled by the mean radius and by the probability that the random slope is less than half its positive target value.hypothesesΩ :Type*Q :region :Set ℝhregionFinite :volume region ≠ ⊤A B K :Ω → ℝn :ℕL mu Kbar q :ℝhL :0 ≤ Lhmu :0 < muhn :0 < nhK :∀ w, 0 ≤ K whKint :Integrable K QhKbar :(∫ w, K w ∂Q) ≤ Kbarhbad :(Q {w | mu / 2 < |B w - mu|}).toReal ≤ qconclusionProof (Lean source)
theorem expectedRestrictedVolume_affineInversion_le {Ω : Type*} [MeasurableSpace Ω] (Q : Measure Ω) [IsProbabilityMeasure Q] (region : Set ℝ) (hregionFinite : volume region ≠ ⊤) (A B K : Ω → ℝ) (n : ℕ) (L mu Kbar q : ℝ) (hL : 0 ≤ L) (hmu : 0 < mu) (hn : 0 < n) (hK : ∀ w, 0 ≤ K w) (hKint : Integrable K Q) (hKbar : (∫ w, K w ∂Q) ≤ Kbar) (hbad : (Q {w | mu / 2 < |B w - mu|}).toReal ≤ q) : (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) ≤ 4 * L * sqrt (Kbar / n) / mu + (volume region).toReal * q := by let F : Ω → ℝ := fun w => restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) let S : Ω → ℝ := fun w => sqrt (K w / n) let c : ℝ := 4 * L / mu let d : ℝ := (volume region).toReal have hnR : 0 < (n : ℝ) := by exact_mod_cast hn have hSn : ∀ w, 0 ≤ K w / (n : ℝ) := fun w => div_nonneg (hK w) hnR.le have hKnInt : Integrable (fun w => K w / (n : ℝ)) Q := hKint.div_const _ have hSint : Integrable S Q := integrable_sqrt_of_nonneg _ hKnInt hSn have hc : 0 ≤ c := div_nonneg (mul_nonneg (by norm_num) hL) hmu.le have hd : 0 ≤ d := ENNReal.toReal_nonneg have hIntK_nonneg : 0 ≤ ∫ w, K w ∂Q := integral_nonneg_of_ae (Filter.Eventually.of_forall hK) have hKbar_nonneg : 0 ≤ Kbar := hIntK_nonneg.trans hKbar have hq : 0 ≤ q := ENNReal.toReal_nonneg.trans hbad have hright_nonneg : 0 ≤ 4 * L * sqrt (Kbar / (n : ℝ)) / mu + d * q := by positivity by_cases hFi : Integrable F Q · have hgood_pointwise : ∀ w, |B w - mu| ≤ mu / 2 → F w ≤ c * S w := by intro w hw have hBabs : mu / 2 ≤ |B w| := by have hrev := abs_sub_abs_le_abs_sub mu (B w) rw [abs_of_pos hmu, abs_sub_comm] at hrev linarith have hBpos : 0 < |B w| := (half_pos hmu).trans_le hBabs have hBne : B w ≠ 0 := abs_pos.mp hBpos have hr : 0 ≤ L * S w := mul_nonneg hL (Real.sqrt_nonneg _) have hlen : F w ≤ 2 * (L * S w) / |B w| := (affineInversionSet_restrictedVolume_le region hregionFinite (A w) (B w) (L * S w) hBne hr).trans (min_le_right _ _) have hdiv : 2 * (L * S w) / |B w| ≤ 2 * (L * S w) / (mu / 2) := div_le_div_of_nonneg_left (mul_nonneg (by positivity) hr) (half_pos hmu) hBabs calc F w ≤ 2 * (L * S w) / |B w| := hlen _ ≤ 2 * (L * S w) / (mu / 2) := hdiv _ = c * S w := by dsimp [c] field_simp ring let Fm : Ω → ℝ := hFi.aestronglyMeasurable.mk F let Sm : Ω → ℝ := hSint.aestronglyMeasurable.mk S let D : Set Ω := {w | c * Sm w < Fm w} have hFm : Measurable Fm := hFi.aestronglyMeasurable.measurable_mk have hSm : Measurable Sm := hSint.aestronglyMeasurable.measurable_mk have hD : MeasurableSet D := measurableSet_lt (hSm.const_mul c) hFm have hFeq : F =ᵐ[Q] Fm := hFi.aestronglyMeasurable.ae_eq_mk have hSeq : S =ᵐ[Q] Sm := hSint.aestronglyMeasurable.ae_eq_mk have hD_bad : D ≤ᵐ[Q] {w | mu / 2 < |B w - mu|} := by filter_upwards [hFeq, hSeq] with w hFw hSw hwD by_contra hwbad have hwgood : |B w - mu| ≤ mu / 2 := le_of_not_gt hwbad have hwle := hgood_pointwise w hwgood change c * Sm w < Fm w at hwD rw [← hFw, ← hSw] at hwD linarith have hDreal : (Q D).toReal ≤ q := (ENNReal.toReal_mono (by finiteness) (measure_mono_ae hD_bad)).trans hbad have hmajorant_int : Integrable (fun w => c * S w + D.indicator (fun _ => d) w) Q := (hSint.const_mul c).add ((integrable_const d).indicator hD) have hmajorant : F ≤ᵐ[Q] fun w => c * S w + D.indicator (fun _ => d) w := by filter_upwards [hFeq, hSeq] with w hFw hSw by_cases hwD : w ∈ D · simp only [Set.indicator_of_mem hwD] have hFd : F w ≤ d := affineInversionSet_restrictedVolume_le_region region hregionFinite _ _ _ have hSnonneg : 0 ≤ S w := Real.sqrt_nonneg _ nlinarith · simp only [indicator, hwD, if_false] have hwle : Fm w ≤ c * Sm w := le_of_not_gt hwD rw [← hFw, ← hSw] at hwle simpa using hwle have hJensen : (∫ w, S w ∂Q) ≤ sqrt ((∫ w, K w ∂Q) / (n : ℝ)) := by have hj := Real.strictConcaveOn_sqrt.concaveOn.le_map_integral Real.continuous_sqrt.continuousOn isClosed_Ici (Filter.Eventually.of_forall hSn) hKnInt hSint simpa [S, Function.comp_def, integral_div] using hj have hsqrt_mono : sqrt ((∫ w, K w ∂Q) / (n : ℝ)) ≤ sqrt (Kbar / (n : ℝ)) := Real.sqrt_le_sqrt (div_le_div_of_nonneg_right hKbar hnR.le) calc (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) = ∫ w, F w ∂Q := by rfl _ ≤ ∫ w, c * S w + D.indicator (fun _ => d) w ∂Q := integral_mono_ae hFi hmajorant_int hmajorant _ = c * (∫ w, S w ∂Q) + d * (Q D).toReal := by rw [integral_add (hSint.const_mul c) ((integrable_const d).indicator hD), integral_const_mul, integral_indicator_const d hD] simp only [smul_eq_mul, Measure.real] ring _ ≤ c * sqrt (Kbar / (n : ℝ)) + d * q := by gcongr exact hJensen.trans hsqrt_mono _ = 4 * L * sqrt (Kbar / (n : ℝ)) / mu + d * q := by dsimp [c] ring · rw [show (∫ w, restrictedSetVolume region (affineInversionSet region (A w) (B w) (L * sqrt (K w / n))) ∂Q) = 0 by exact integral_undef hFi] exact hright_nonneg -
inverseStrength_to_frontiertheorem — An inverse-root plus inverse-strength bound, capped by a nonnegative region volume, is bounded by the compact inverse-square-root frontier form.hypothesescap A B t :ℝhB :0 ≤ Bht :0 < tProof (Lean source)
theorem inverseStrength_to_frontier {cap A B t : ℝ} (hB : 0 ≤ B) (ht : 0 < t) : min cap (A / sqrt t + B / t) ≤ max cap (A + B) * min 1 (t ^ (-1 / 2 : ℝ)) := by by_cases ht1 : t ≤ 1 · rw [min_eq_left (Real.one_le_rpow_of_pos_of_le_one_of_nonpos ht ht1 (by norm_num))] simp only [mul_one] exact (min_le_left _ _).trans (le_max_left _ _) · have h1t : 1 ≤ t := le_of_not_ge ht1 rw [min_eq_right (Real.rpow_le_one_of_one_le_of_nonpos h1t (by norm_num))] have hsqrt : 0 < sqrt t := Real.sqrt_pos.2 ht have hsqrt_le_t : sqrt t ≤ t := by nlinarith [Real.sq_sqrt ht.le] have hBt : B / t ≤ B / sqrt t := div_le_div_of_nonneg_left hB hsqrt hsqrt_le_t have hsum : A / sqrt t + B / t ≤ (A + B) / sqrt t := by calc A / sqrt t + B / t ≤ A / sqrt t + B / sqrt t := add_le_add_right hBt _ _ = (A + B) / sqrt t := by ring calc min cap (A / sqrt t + B / t) ≤ A / sqrt t + B / t := min_le_right _ _ _ ≤ (A + B) / sqrt t := hsum _ = (A + B) * t ^ (-1 / 2 : ℝ) := by rw [show (-1 / 2 : ℝ) = -(1 / 2) by norm_num, Real.rpow_neg ht.le, ← Real.sqrt_eq_rpow] simp [div_eq_mul_inv] _ ≤ max cap (A + B) * t ^ (-1 / 2 : ℝ) := mul_le_mul_of_nonneg_right (le_max_right _ _) (Real.rpow_nonneg ht.le _)
ChiSquaredWald 3 core · 2 supporting This file identifies the Gaussian Wald quadratic form with a chi-squared law and then specializes multivariate Wald coverage to that limit. ★ gaussianLimit_waldForm_map★ wald_coverage_chiSq
This file identifies the Gaussian Wald quadratic form with a chi-squared law and
then specializes multivariate Wald coverage to that limit. It constructs the
inverse secondMomentInv of the second-moment operator from the positive square
root, proves the two-sided inverse identities
secondMomentInv_secondMomentLM and secondMomentLM_secondMomentInv, and uses
whitening in gaussianLimit_waldForm_map to show that
gaussianLimit hψ hvar pushed through S ↦ ⟪S, Σ⁻¹ S⟫ is
chiSqDist (Module.finrank ℝ E).
The final theorem Tendsto_dist.wald_coverage_chiSq plugs that chi-squared
limit into the generic ellipsoid-coverage theorem from
Causalean.Stat.Inference.WaldVec.
Let be a measure on a measurable sample space, and let a measurable function take values in a finite-dimensional real inner-product space equipped with its Borel σ-algebra. Given that function is measurable, its squared norm is integrable under , and its second-moment operator is injective, the inverse second-moment operator is the continuous linear map obtained by applying twice the inverse of the positive square root of that operator.
Definition (Lean source)
χ² identification of the Wald quadratic form. When the linear map induced by the asymptotic-variance operator Σ is injective, i.e. Σ is non-degenerate, the multivariate-CLT Gaussian limit, pushed through the Wald quadratic form S ↦ ⟪S, Σ⁻¹ S⟫, is exactly the χ²_d distribution, with d the dimension of the ambient space.
Formal statement
Proof (Lean source)
χ²-coverage of the Wald confidence ellipsoid. Suppose the Wald statistic sequence Wₙ is measurable at every sample size, d is a positive-integer degrees-of-freedom parameter, and Wₙ converges in distribution to the χ²_d law. If a coverage-probability sequence coverProb is asymptotically equivalent to the ellipsoid event {Wₙ ≤ c}, then coverProb converges to the χ²_d probability of (-∞, c].
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
secondMomentInv_secondMomentLMtheorem — Σ⁻¹ is a left inverse of Σ.hypothesesconclusionsecondMomentInv hψ hvar hinj (secondMomentLM hψ hvar x) = xProof (Lean source)
theorem secondMomentInv_secondMomentLM (hinj : Injective (secondMomentLM hψ hvar)) (x : E) : secondMomentInv hψ hvar hinj (secondMomentLM hψ hvar x) = x := by have hsig : secondMomentLM hψ hvar x = posSqrtEquiv hψ hvar hinj (posSqrtEquiv hψ hvar hinj x) := by rw [posSqrtEquiv_apply, posSqrtEquiv_apply, ← LinearMap.comp_apply, (secondMomentLM_isPositive hψ hvar).posSqrt_mul_self] rw [secondMomentInv_apply, hsig, (posSqrtEquiv hψ hvar hinj).symm_apply_apply, (posSqrtEquiv hψ hvar hinj).symm_apply_apply] -
secondMomentLM_secondMomentInvtheorem — Σ⁻¹ is a right inverse of Σ.hypothesesconclusionsecondMomentLM hψ hvar (secondMomentInv hψ hvar hinj x) = xProof (Lean source)
theorem secondMomentLM_secondMomentInv (hinj : Injective (secondMomentLM hψ hvar)) (x : E) : secondMomentLM hψ hvar (secondMomentInv hψ hvar hinj x) = x := by have hsig : ∀ z, secondMomentLM hψ hvar z = posSqrtEquiv hψ hvar hinj (posSqrtEquiv hψ hvar hinj z) := fun z => by rw [posSqrtEquiv_apply, posSqrtEquiv_apply, ← LinearMap.comp_apply, (secondMomentLM_isPositive hψ hvar).posSqrt_mul_self] rw [secondMomentInv_apply, hsig, (posSqrtEquiv hψ hvar hinj).apply_symm_apply, (posSqrtEquiv hψ hvar hinj).apply_symm_apply]
DeltaMethod 2 core · 0 supporting This file proves smooth delta-method results for asymptotically normal estimators. ★ deltaMethod_scalar★ deltaMethod
This file proves smooth delta-method results for asymptotically normal
estimators. The scalar theorem deltaMethod_scalar transforms
√n (Tn - t₀) ⇒ gaussianMeasure 0 σsq through a differentiable real map and
returns the Gaussian limit with variance parameter g' ^ 2 * σsq.
The multivariate theorem deltaMethod works at the probability-measure level:
if √n • (Tn - t₀) converges weakly to Q and g has Fréchet derivative Dg
at t₀, then the laws of √n • (g (Tn) - g t₀) converge to the pushforward
Q.toMeasure.map Dg. The proofs use the stochastic-order and tightness
utilities from Causalean.Stat.Limit.Convergence.
Scalar delta method. For a real-valued estimator sequence Tn of a target t₀, suppose the rescaled deviation √n(Tn − t₀) is measurable at every sample size and the rescaled image √n(g(Tn) − g(t₀)) is measurable at every sample size, where g is differentiable at t₀ with derivative g'. If the rescaled deviation converges in distribution to the project's Gaussian law with mean zero and variance σ², then the rescaled image converges in distribution to the same Gaussian wrapper with variance g'² · σ².
Formal statement
Proof (Lean source)
Multivariate delta method. Let Tn be a sequence of E-valued estimators of a target t₀, and let g : E → F be Fréchet-differentiable at t₀ with derivative Dg. Given that the rescaled deviations √n • (Tn − t₀) are measurable at every sample size and that their images √n • (g(Tn) − g(t₀)) are measurable at every sample size, if the laws of √n • (Tn − t₀) converge weakly to a probability measure Q on E, then the laws of √n • (g(Tn) − g(t₀)) converge weakly to the pushforward of Q along the linear map Dg.
Formal statement
Proof (Lean source)
FunctionalDelta 2 core · 7 supporting This file develops the directional functional delta method for max/min lattice functionals. ★ deltaMethod_max_tie★ deltaMethod_min_tie
This file develops the directional functional delta method for max/min lattice
functionals. It provides the reusable Slutsky lemma
isLittleOp_one_of_measure_ne_tendsto_zero, probability-measure instances for
Q.map max and Q.map min, exact tie identities sqrt_mul_max_sub and
sqrt_mul_min_sub, and derived measurability lemmas for the image statistics.
The headline theorems deltaMethod_max_tie and deltaMethod_min_tie cover the
binding case a = b: a joint CLT for √n • ((an,bn) - (a,a)) is pushed through
the continuous lattice functional, yielding the generally non-Gaussian laws
Q.map (fun z => max z.1 z.2) and Q.map (fun z => min z.1 z.2).
Directional delta method for max at a tie. Let ân, b̂n be two real-valued estimator sequences of a common value a. Suppose the joint rescaled deviation √n • ((ân, b̂n) − (a, a)) is measurable at every sample size and it converges in distribution to a probability measure Q on ℝ × ℝ. Then the rescaled deviation of the pointwise maximum, √n · (max(ân, b̂n) − a), converges in distribution to the pushforward of Q under the map (x, y) ↦ max(x, y).
Formal statement
Proof (Lean source)
Directional delta method for min at a tie. Let ân, b̂n be two real-valued estimator sequences of a common value a. Suppose the joint rescaled deviation √n • ((ân, b̂n) − (a, a)) is measurable at every sample size and it converges in distribution to a probability measure Q on ℝ × ℝ. Then the rescaled deviation of the pointwise minimum, √n · (min(ân, b̂n) − a), converges in distribution to the pushforward of Q under the map (x, y) ↦ min(x, y).
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
isLittleOp_one_of_measure_ne_tendsto_zerotheorem — If Yₙ and Xₙ agree except on an event of vanishing probability, then Yₙ − Xₙ = o_p(1). This is the device that handles the *off-diagonal* case of the directional delta method (where the lattice functional locally selects one coordinate, so the rescaled image equals that coordinate's marginal except when the estimated ordering is wrong — an event whose probability tends to 0).hypothesesconclusionIsLittleOp (fun n ω => Yn n ω - Xn n ω) (fun _ => (1 : ℝ)) μProof (Lean source)
theorem isLittleOp_one_of_measure_ne_tendsto_zero {Xn Yn : ℕ → Ω → ℝ} (h : Tendsto (fun n => μ {ω | Yn n ω ≠ Xn n ω}) atTop (𝓝 0)) : IsLittleOp (fun n ω => Yn n ω - Xn n ω) (fun _ => (1 : ℝ)) μ := by intro ε hε have hsub : ∀ n, {ω | ε * (1 : ℝ) < |Yn n ω - Xn n ω|} ⊆ {ω | Yn n ω ≠ Xn n ω} := by intro n ω hω simp only [Set.mem_setOf_eq] at hω ⊢ intro heq rw [heq, sub_self, abs_zero, mul_one] at hω exact absurd hω (not_lt.2 (le_of_lt hε)) refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds h (fun n => zero_le) (fun n => measure_mono (hsub n)) -
instIsProbabilityMeasure_map_maxinstance — For any probability law on ordered pairs of real numbers, the law of the larger coordinate is a probability law.parametersQ :Measure (ℝ × ℝ)instancegiven byMeasure.isProbabilityMeasure_map (continuous_fst.max continuous_snd).measurable.aemeasurable -
instIsProbabilityMeasure_map_mininstance — For any probability law on ordered pairs of real numbers, the law of the smaller coordinate is a probability law.parametersQ :Measure (ℝ × ℝ)instancegiven byMeasure.isProbabilityMeasure_map (continuous_fst.min continuous_snd).measurable.aemeasurable -
sqrt_mul_max_sublemma — The tie identity for max. √n (max âₙ b̂ₙ − a) = max (√n(âₙ−a)) (√n(b̂ₙ−a)) (no remainder).hypothesesΩ :sharedType u_1an bn :ℕ → Ω → ℝa :ℝn :ℕω :ΩProof (Lean source)
lemma sqrt_mul_max_sub (an bn : ℕ → Ω → ℝ) (a : ℝ) (n : ℕ) (ω : Ω) : sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a) = (fun z : ℝ × ℝ => max z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) := by have hsnn : (0 : ℝ) ≤ sqrt (n : ℝ) := Real.sqrt_nonneg _ simp only [Prod.fst_sub, Prod.snd_sub, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [← mul_max_of_nonneg _ _ hsnn] congr 1 rcases le_total (an n ω) (bn n ω) with h | h · rw [max_eq_right h, max_eq_right (by linarith)] · rw [max_eq_left h, max_eq_left (by linarith)] -
sqrt_mul_min_sublemma — The tie identity for min. Companion to sqrt_mul_max_sub.hypothesesΩ :sharedType u_1an bn :ℕ → Ω → ℝa :ℝn :ℕω :ΩProof (Lean source)
lemma sqrt_mul_min_sub (an bn : ℕ → Ω → ℝ) (a : ℝ) (n : ℕ) (ω : Ω) : sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a) = (fun z : ℝ × ℝ => min z.1 z.2) (sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) := by have hsnn : (0 : ℝ) ≤ sqrt (n : ℝ) := Real.sqrt_nonneg _ simp only [Prod.fst_sub, Prod.snd_sub, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [← mul_min_of_nonneg _ _ hsnn] congr 1 rcases le_total (an n ω) (bn n ω) with h | h · rw [min_eq_left h, min_eq_left (by linarith)] · rw [min_eq_right h, min_eq_right (by linarith)] -
maxStat_aemeasurablelemma — The image statistic √n (max âₙ b̂ₙ − a) is AEMeasurable for every n, *derived* from the joint rescaled deviation's measurability via sqrt_mul_max_sub — so deltaMethod_max_tie need not assume it.hypothesesan bn :ℕ → Ω → ℝa :ℝhSn_meas :∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μn :ℕconclusionProof (Lean source)
lemma maxStat_aemeasurable (an bn : ℕ → Ω → ℝ) (a : ℝ) (hSn_meas : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ) : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (max (an n ω) (bn n ω) - a)) μ := fun n => ((continuous_fst.max continuous_snd).measurable.comp_aemeasurable (hSn_meas n)).congr (Filter.Eventually.of_forall fun ω => (sqrt_mul_max_sub an bn a n ω).symm) -
minStat_aemeasurablelemma — The image statistic √n (min âₙ b̂ₙ − a) is AEMeasurable for every n, derived likewise via sqrt_mul_min_sub.hypothesesan bn :ℕ → Ω → ℝa :ℝhSn_meas :∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μn :ℕconclusionProof (Lean source)
lemma minStat_aemeasurable (an bn : ℕ → Ω → ℝ) (a : ℝ) (hSn_meas : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) • ((an n ω, bn n ω) - (a, a))) μ) : ∀ (n : ℕ), AEMeasurable (fun ω => sqrt (n : ℝ) * (min (an n ω) (bn n ω) - a)) μ := fun n => ((continuous_fst.min continuous_snd).measurable.comp_aemeasurable (hSn_meas n)).congr (Filter.Eventually.of_forall fun ω => (sqrt_mul_min_sub an bn a n ω).symm)
HadamardDeriv 5 core · 19 supporting This file defines Hadamard directional differentiability for maps between normed spaces and connects it to ordinary differentiability. ★ HasHadamardDirDerivAt★ hasHadamardDirDerivAt
Hadamard Directional Derivatives
This file defines Hadamard directional differentiability for maps between normed spaces and connects it to ordinary differentiability. It also develops the directional derivatives of maximum and minimum functionals that support delta-method arguments for nonsmooth statistical targets.
The central definition is HasHadamardDirDerivAt. The theorem
HasFDerivAt.hasHadamardDirDerivAt shows that ordinary Fréchet
differentiability implies Hadamard directional differentiability with the same
linear derivative. The declarations maxDirDeriv, minDirDeriv,
continuous_maxDirDeriv, continuous_minDirDeriv,
hasHadamardDirDerivAt_max, and hasHadamardDirDerivAt_min give the lattice
derivatives used by the functional delta-method file.
Given normed real vector spaces, a map between them, a proposed directional derivative, and a point, the Hadamard directional differentiability property at that point holds exactly when, for every direction, every sequence of directions converging to it, and every strictly positive real step-size sequence converging to zero,
Definition (Lean source)
Fréchet implies Hadamard. If the map φ is Fréchet-differentiable at the point θ, with continuous linear derivative L, then φ is Hadamard directionally differentiable at θ, with the same map L serving as its Hadamard directional derivative.
Formal statement
Proof (Lean source)
Given a first real coordinate and a second real coordinate, the directional derivative of the maximum functional at their pair sends a direction to when , to when , and to when .
Definition (Lean source)
Given a first real coordinate and a second real coordinate, the directional derivative of the minimum functional at their pair sends a direction to when , to when , and to when .
Definition (Lean source)
Given normed real vector spaces, a map between them and a point, the continuous Hadamard directional differentiability property at that point holds exactly when there exists a continuous directional derivative at that point and that derivative satisfies Hadamard directional differentiability.
Definition (Lean source)
19 supporting declarations (lemmas, instances)
-
continuous_maxDirDerivtheorem — The directional derivative of the maximum functional is continuous.Proof (Lean source)
@[fun_prop] theorem continuous_maxDirDeriv (a b : ℝ) : Continuous (maxDirDeriv a b) := by unfold maxDirDeriv split_ifs · exact continuous_fst · exact continuous_snd · exact continuous_fst.max continuous_snd -
continuous_minDirDerivtheorem — The directional derivative of the minimum functional is continuous.Proof (Lean source)
@[fun_prop] theorem continuous_minDirDeriv (a b : ℝ) : Continuous (minDirDeriv a b) := by unfold minDirDeriv split_ifs · exact continuous_fst · exact continuous_snd · exact continuous_fst.min continuous_snd -
hasHadamardDirDerivAt_maxtheorem — max is Hadamard directionally differentiable. At (a, b) the derivative is maxDirDeriv a b (linear off the diagonal, sublinear at a tie).hypothesesa b :ℝconclusionProof (Lean source)
theorem hasHadamardDirDerivAt_max (a b : ℝ) : HasHadamardDirDerivAt (fun z : ℝ × ℝ => max z.1 z.2) (maxDirDeriv a b) (a, b) := by intro h hn tn hhn htn htn_pos have hh1 : Tendsto (fun n => (hn n).1) atTop (𝓝 h.1) := (continuous_fst.tendsto h).comp hhn have hh2 : Tendsto (fun n => (hn n).2) atTop (𝓝 h.2) := (continuous_snd.tendsto h).comp hhn unfold maxDirDeriv split_ifs with hba hab · -- b < a : the first coordinate eventually dominates, derivative = h.1 have hmax_ab : max a b = a := max_eq_left (le_of_lt hba) have hg : Tendsto (fun n => (a + tn n * (hn n).1) - (b + tn n * (hn n).2)) atTop (𝓝 (a - b)) := by have h0 : Tendsto (fun n => tn n * ((hn n).1 - (hn n).2)) atTop (𝓝 0) := by simpa using htn.mul (hh1.sub hh2) have hsum := (tendsto_const_nhds (x := a - b)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, b + tn n * (hn n).2 ≤ a + tn n * (hn n).1 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < a - b by linarith))] with n hn_ev linarith refine hh1.congr' ?_ filter_upwards [hev] with n hge have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [max_eq_left hge, hmax_ab, show a + tn n * (hn n).1 - a = tn n * (hn n).1 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- a < b : the second coordinate eventually dominates, derivative = h.2 have hmax_ab : max a b = b := max_eq_right (le_of_lt hab) have hg : Tendsto (fun n => (b + tn n * (hn n).2) - (a + tn n * (hn n).1)) atTop (𝓝 (b - a)) := by have h0 : Tendsto (fun n => tn n * ((hn n).2 - (hn n).1)) atTop (𝓝 0) := by simpa using htn.mul (hh2.sub hh1) have hsum := (tendsto_const_nhds (x := b - a)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, a + tn n * (hn n).1 ≤ b + tn n * (hn n).2 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < b - a by linarith))] with n hn_ev linarith refine hh2.congr' ?_ filter_upwards [hev] with n hle have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [max_eq_right hle, hmax_ab, show b + tn n * (hn n).2 - b = tn n * (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- a = b : the tie case collapses to `max (hₙ.1) (hₙ.2) → max h.1 h.2` have hab_eq : a = b := le_antisymm (not_lt.1 hba) (not_lt.1 hab) have key : ∀ n, (tn n)⁻¹ • ((fun z : ℝ × ℝ => max z.1 z.2) ((a, b) + tn n • hn n) - max a b) = max (hn n).1 (hn n).2 := by intro n have htn_ne : tn n ≠ 0 := (htn_pos n).ne' have hpos := htn_pos n simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul, hab_eq] have e1 : max (b + tn n * (hn n).1) (b + tn n * (hn n).2) = b + tn n * max (hn n).1 (hn n).2 := by rcases le_total (hn n).1 (hn n).2 with hle | hle · rw [max_eq_right hle, max_eq_right (by nlinarith [hpos])] · rw [max_eq_left hle, max_eq_left (by nlinarith [hpos])] rw [e1, max_self, show b + tn n * max (hn n).1 (hn n).2 - b = tn n * max (hn n).1 (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] simp only [key] exact hh1.max hh2 -
hasHadamardDirDerivAt_mintheorem — min is Hadamard directionally differentiable. At (a, b) the derivative is minDirDeriv a b.hypothesesa b :ℝconclusionProof (Lean source)
theorem hasHadamardDirDerivAt_min (a b : ℝ) : HasHadamardDirDerivAt (fun z : ℝ × ℝ => min z.1 z.2) (minDirDeriv a b) (a, b) := by intro h hn tn hhn htn htn_pos have hh1 : Tendsto (fun n => (hn n).1) atTop (𝓝 h.1) := (continuous_fst.tendsto h).comp hhn have hh2 : Tendsto (fun n => (hn n).2) atTop (𝓝 h.2) := (continuous_snd.tendsto h).comp hhn unfold minDirDeriv split_ifs with hab hba · -- a < b : the first coordinate eventually dominates the min, derivative = h.1 have hmin_ab : min a b = a := min_eq_left (le_of_lt hab) have hg : Tendsto (fun n => (b + tn n * (hn n).2) - (a + tn n * (hn n).1)) atTop (𝓝 (b - a)) := by have h0 : Tendsto (fun n => tn n * ((hn n).2 - (hn n).1)) atTop (𝓝 0) := by simpa using htn.mul (hh2.sub hh1) have hsum := (tendsto_const_nhds (x := b - a)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, a + tn n * (hn n).1 ≤ b + tn n * (hn n).2 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < b - a by linarith))] with n hn_ev linarith refine hh1.congr' ?_ filter_upwards [hev] with n hle have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [min_eq_left hle, hmin_ab, show a + tn n * (hn n).1 - a = tn n * (hn n).1 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- b < a : the second coordinate eventually dominates the min, derivative = h.2 have hmin_ab : min a b = b := min_eq_right (le_of_lt hba) have hg : Tendsto (fun n => (a + tn n * (hn n).1) - (b + tn n * (hn n).2)) atTop (𝓝 (a - b)) := by have h0 : Tendsto (fun n => tn n * ((hn n).1 - (hn n).2)) atTop (𝓝 0) := by simpa using htn.mul (hh1.sub hh2) have hsum := (tendsto_const_nhds (x := a - b)).add h0 simp only [add_zero] at hsum refine hsum.congr ?_ intro n; ring have hev : ∀ᶠ n in atTop, b + tn n * (hn n).2 ≤ a + tn n * (hn n).1 := by filter_upwards [hg.eventually (eventually_gt_nhds (show (0:ℝ) < a - b by linarith))] with n hn_ev linarith refine hh2.congr' ?_ filter_upwards [hev] with n hge have htn_ne : tn n ≠ 0 := (htn_pos n).ne' simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul] rw [min_eq_right hge, hmin_ab, show b + tn n * (hn n).2 - b = tn n * (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] · -- a = b : tie case collapses to `min (hₙ.1) (hₙ.2) → min h.1 h.2` have hab_eq : a = b := le_antisymm (not_lt.1 hba) (not_lt.1 hab) have key : ∀ n, (tn n)⁻¹ • ((fun z : ℝ × ℝ => min z.1 z.2) ((a, b) + tn n • hn n) - min a b) = min (hn n).1 (hn n).2 := by intro n have htn_ne : tn n ≠ 0 := (htn_pos n).ne' have hpos := htn_pos n simp only [Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, smul_eq_mul, hab_eq] have e1 : min (b + tn n * (hn n).1) (b + tn n * (hn n).2) = b + tn n * min (hn n).1 (hn n).2 := by rcases le_total (hn n).1 (hn n).2 with hle | hle · rw [min_eq_left hle, min_eq_left (by nlinarith [hpos])] · rw [min_eq_right hle, min_eq_right (by nlinarith [hpos])] rw [e1, min_self, show b + tn n * min (hn n).1 (hn n).2 - b = tn n * min (hn n).1 (hn n).2 by ring, ← mul_assoc, inv_mul_cancel₀ htn_ne, one_mul] simp only [key] exact hh1.min hh2 -
comptheorem — If the outer map has a Hadamard directional derivative and the inner map has a Hadamard directional derivative, then their composition has the composed directional derivative.hypothesesE :sharedType u_1F :sharedType u_2G :f :E → Ff' :E → Fg :F → Gg' :F → Gx :Ehg :HasHadamardDirDerivAt g g' (f x)hf :HasHadamardDirDerivAt f f' xconclusionHasHadamardDirDerivAt (g ∘ f) (g' ∘ f') xProof (Lean source)
theorem HasHadamardDirDerivAt.comp {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] {f : E → F} {f' : E → F} {g : F → G} {g' : F → G} {x : E} (hg : HasHadamardDirDerivAt g g' (f x)) (hf : HasHadamardDirDerivAt f f' x) : HasHadamardDirDerivAt (g ∘ f) (g' ∘ f') x := by intro h hn tn hhn htn htn_pos let kn : ℕ → F := fun n => (tn n)⁻¹ • (f (x + tn n • hn n) - f x) have hkn : Tendsto kn atTop (nhds (f' h)) := hf h hn tn hhn htn htn_pos have hout := hg (f' h) kn tn hkn htn htn_pos apply hout.congr' filter_upwards [] with n have hne : tn n ≠ 0 := (htn_pos n).ne' have hrecover : f x + tn n • kn n = f (x + tn n • hn n) := by simp only [kn, smul_smul, mul_inv_cancel₀ hne, one_smul, add_sub_cancel] simp only [Function.comp_apply, hrecover, kn] -
comptheorem — If the outer map and the inner map are continuously Hadamard directionally differentiable, then their composition is too.hypothesesE :sharedType u_1F :sharedType u_2G :f :E → Fg :F → Gx :Ehg :HasContinuousHadamardDirDerivAt g (f x)hf :conclusionHasContinuousHadamardDirDerivAt (g ∘ f) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.comp {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] {f : E → F} {g : F → G} {x : E} (hg : HasContinuousHadamardDirDerivAt g (f x)) (hf : HasContinuousHadamardDirDerivAt f x) : HasContinuousHadamardDirDerivAt (g ∘ f) x := by rcases hg with ⟨g', hg'c, hg'⟩ rcases hf with ⟨f', hf'c, hf'⟩ exact ⟨g' ∘ f', hg'c.comp hf'c, HasHadamardDirDerivAt.comp hg' hf'⟩ -
of_hasFDerivAttheorem — If a map has a Fréchet derivative, then it is continuously Hadamard directionally differentiable.hypothesesconclusionProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.of_hasFDerivAt {f : E → F} {L : E →L[ℝ] F} {x : E} (hf : HasFDerivAt f L x) : HasContinuousHadamardDirDerivAt f x := ⟨fun h => L h, L.continuous, HasFDerivAt.hasHadamardDirDerivAt hf⟩ -
of_differentiableAttheorem — If a map is differentiable at a point, then it is continuously Hadamard directionally differentiable there.hypothesesconclusionProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.of_differentiableAt {f : E → F} {x : E} (hf : DifferentiableAt ℝ f x) : HasContinuousHadamardDirDerivAt f x := .of_hasFDerivAt hf.hasFDerivAt -
congr_of_eventuallyEqtheorem — If two maps agree near a point and one is continuously Hadamard directionally differentiable there, then the other has the same property.hypothesesconclusionProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.congr_of_eventuallyEq {f g : E → F} {x : E} (hfg : EventuallyEq (nhds x) f g) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt f x := by rcases hg with ⟨g', hg'c, hg'⟩ refine ⟨g', hg'c, ?_⟩ intro h hn tn hhn htn htn_pos have hxlim : Tendsto (fun n => x + tn n • hn n) atTop (nhds x) := by simpa using (tendsto_const_nhds (x := x)).add (htn.smul hhn) have hev := hxlim.eventually hfg have hfx : f x = g x := hfg.self_of_nhds apply (hg' h hn tn hhn htn htn_pos).congr' filter_upwards [hev] with n hnfg rw [hnfg, hfx] -
prodtheorem — If each component map is continuously Hadamard directionally differentiable, then their product-valued pairing has the same property.hypothesesE :sharedType u_1F :sharedType u_2G :f :E → Fg :E → Gx :Ehf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => (f y, g y)) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.prod {G : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G] {f : E → F} {g : E → G} {x : E} (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => (f y, g y)) x := by rcases hf with ⟨f', hf'c, hf'⟩ rcases hg with ⟨g', hg'c, hg'⟩ refine ⟨fun h => (f' h, g' h), hf'c.prodMk hg'c, ?_⟩ intro h hn tn hhn htn htn_pos have hf_lim := hf' h hn tn hhn htn htn_pos have hg_lim := hg' h hn tn hhn htn htn_pos change Tendsto (fun n => ((tn n)⁻¹ • (f (x + tn n • hn n) - f x), (tn n)⁻¹ • (g (x + tn n • hn n) - g x))) atTop (nhds (f' h, g' h)) exact hf_lim.prodMk_nhds hg_lim -
addtheorem — If two real-valued maps are continuously Hadamard directionally differentiable, then their pointwise sum has the same property.hypothesesE :sharedType u_1E → ℝEhf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => f y + g y) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.add {f g : E → ℝ} {x : E} (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => f y + g y) x := by have ho : HasContinuousHadamardDirDerivAt (fun z : ℝ × ℝ => z.1 + z.2) (f x, g x) := .of_differentiableAt (differentiableAt_fst.add differentiableAt_snd) change HasContinuousHadamardDirDerivAt ((fun z : ℝ × ℝ => z.1 + z.2) ∘ fun y => (f y, g y)) x exact HasContinuousHadamardDirDerivAt.comp (f := fun y => (f y, g y)) (g := fun z : ℝ × ℝ => z.1 + z.2) ho (hf.prod hg) -
subtheorem — If two real-valued maps are continuously Hadamard directionally differentiable, then their pointwise difference has the same property.hypothesesE :sharedType u_1E → ℝEhf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => f y - g y) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.sub {f g : E → ℝ} {x : E} (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => f y - g y) x := by have ho : HasContinuousHadamardDirDerivAt (fun z : ℝ × ℝ => z.1 - z.2) (f x, g x) := .of_differentiableAt (differentiableAt_fst.sub differentiableAt_snd) change HasContinuousHadamardDirDerivAt ((fun z : ℝ × ℝ => z.1 - z.2) ∘ fun y => (f y, g y)) x exact HasContinuousHadamardDirDerivAt.comp (f := fun y => (f y, g y)) (g := fun z : ℝ × ℝ => z.1 - z.2) ho (hf.prod hg) -
multheorem — If two real-valued maps are continuously Hadamard directionally differentiable, then their pointwise product has the same property.hypothesesE :sharedType u_1E → ℝEhf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => f y * g y) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.mul {f g : E → ℝ} {x : E} (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => f y * g y) x := by have ho : HasContinuousHadamardDirDerivAt (fun z : ℝ × ℝ => z.1 * z.2) (f x, g x) := .of_differentiableAt (differentiableAt_fst.mul differentiableAt_snd) change HasContinuousHadamardDirDerivAt ((fun z : ℝ × ℝ => z.1 * z.2) ∘ fun y => (f y, g y)) x exact HasContinuousHadamardDirDerivAt.comp (f := fun y => (f y, g y)) (g := fun z : ℝ × ℝ => z.1 * z.2) ho (hf.prod hg) -
divtheorem — If the denominator is nonzero and the numerator and denominator maps are continuously Hadamard directionally differentiable, then their pointwise quotient has the same property.hypothesesE :sharedType u_1E → ℝEhg0 :g x ≠ 0hf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => f y / g y) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.div {f g : E → ℝ} {x : E} (hg0 : g x ≠ 0) (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => f y / g y) x := by have ho : HasContinuousHadamardDirDerivAt (fun z : ℝ × ℝ => z.1 / z.2) (f x, g x) := .of_differentiableAt (differentiableAt_fst.mul (differentiableAt_snd.inv hg0)) change HasContinuousHadamardDirDerivAt ((fun z : ℝ × ℝ => z.1 / z.2) ∘ fun y => (f y, g y)) x exact HasContinuousHadamardDirDerivAt.comp (f := fun y => (f y, g y)) (g := fun z : ℝ × ℝ => z.1 / z.2) ho (hf.prod hg) -
finset_sumtheorem — If every map indexed by a finite set is continuously Hadamard directionally differentiable, then their pointwise finite sum has the same property.hypothesesE :sharedType u_1I :Type*s :Finset If :I → E → ℝx :Ehf :∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) xconclusionHasContinuousHadamardDirDerivAt (fun y => ∑ i ∈ s, f i y) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.finset_sum {I : Type*} (s : Finset I) {f : I → E → ℝ} {x : E} (hf : ∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) x) : HasContinuousHadamardDirDerivAt (fun y => ∑ i ∈ s, f i y) x := by classical induction s using Finset.induction_on with | empty => simp only [Finset.sum_empty] exact .of_differentiableAt (differentiableAt_const (c := (0 : ℝ))) | @insert a s ha ih => simp_rw [Finset.sum_insert ha] exact (hf a (mem_insert_self a s)).add (ih fun i hi => hf i (mem_insert_of_mem hi)) -
maxtheorem — If two real-valued maps are continuously Hadamard directionally differentiable, then their pointwise maximum has the same property.hypothesesE :sharedType u_1E → ℝEhf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => max (f y) (g y)) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.max {f g : E → ℝ} {x : E} (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => max (f y) (g y)) x := by have ho : HasContinuousHadamardDirDerivAt (fun z : ℝ × ℝ => max z.1 z.2) (f x, g x) := ⟨maxDirDeriv (f x) (g x), continuous_maxDirDeriv _ _, hasHadamardDirDerivAt_max _ _⟩ change HasContinuousHadamardDirDerivAt ((fun z : ℝ × ℝ => max z.1 z.2) ∘ fun y => (f y, g y)) x exact HasContinuousHadamardDirDerivAt.comp ho (hf.prod hg) -
mintheorem — If two real-valued maps are continuously Hadamard directionally differentiable, then their pointwise minimum has the same property.hypothesesE :sharedType u_1E → ℝEhf :hg :conclusionHasContinuousHadamardDirDerivAt (fun y => min (f y) (g y)) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.min {f g : E → ℝ} {x : E} (hf : HasContinuousHadamardDirDerivAt f x) (hg : HasContinuousHadamardDirDerivAt g x) : HasContinuousHadamardDirDerivAt (fun y => min (f y) (g y)) x := by have ho : HasContinuousHadamardDirDerivAt (fun z : ℝ × ℝ => min z.1 z.2) (f x, g x) := ⟨minDirDeriv (f x) (g x), continuous_minDirDeriv _ _, hasHadamardDirDerivAt_min _ _⟩ change HasContinuousHadamardDirDerivAt ((fun z : ℝ × ℝ => min z.1 z.2) ∘ fun y => (f y, g y)) x exact HasContinuousHadamardDirDerivAt.comp ho (hf.prod hg) -
finset_sup'theorem — If a finite index set is nonempty and every indexed map is continuously Hadamard directionally differentiable, then their pointwise finite supremum has the same property.hypothesesE :sharedType u_1I :Type*s :Finset Ihs :s.Nonemptyf :I → E → ℝx :Ehf :∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) xconclusionHasContinuousHadamardDirDerivAt (fun y => s.sup' hs (fun i => f i y)) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.finset_sup' {I : Type*} (s : Finset I) (hs : s.Nonempty) {f : I → E → ℝ} {x : E} (hf : ∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) x) : HasContinuousHadamardDirDerivAt (fun y => s.sup' hs (fun i => f i y)) x := by classical induction s using Finset.induction_on with | empty => simp at hs | @insert a s ha ih => by_cases hse : s.Nonempty · have ha' := hf a (mem_insert_self a s) have hs' : ∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) x := fun i hi => hf i (mem_insert_of_mem hi) have hi := ih hse hs' simpa only [Finset.sup'_insert hse] using HasContinuousHadamardDirDerivAt.max ha' hi · have hsempty : s = ∅ := Finset.not_nonempty_iff_eq_empty.mp hse subst s change HasContinuousHadamardDirDerivAt (fun y => ({a} : Finset I).sup' hs (fun i => f i y)) x simpa only [Finset.sup'_singleton] using hf a (mem_singleton_self a) -
finset_inf'theorem — If a finite index set is nonempty and every indexed map is continuously Hadamard directionally differentiable, then their pointwise finite infimum has the same property.hypothesesE :sharedType u_1I :Type*s :Finset Ihs :s.Nonemptyf :I → E → ℝx :Ehf :∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) xconclusionHasContinuousHadamardDirDerivAt (fun y => s.inf' hs (fun i => f i y)) xProof (Lean source)
theorem HasContinuousHadamardDirDerivAt.finset_inf' {I : Type*} (s : Finset I) (hs : s.Nonempty) {f : I → E → ℝ} {x : E} (hf : ∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) x) : HasContinuousHadamardDirDerivAt (fun y => s.inf' hs (fun i => f i y)) x := by classical induction s using Finset.induction_on with | empty => simp at hs | @insert a s ha ih => by_cases hse : s.Nonempty · have ha' := hf a (mem_insert_self a s) have hs' : ∀ i ∈ s, HasContinuousHadamardDirDerivAt (f i) x := fun i hi => hf i (mem_insert_of_mem hi) have hi := ih hse hs' simpa only [Finset.inf'_insert hse] using HasContinuousHadamardDirDerivAt.min ha' hi · have hsempty : s = ∅ := Finset.not_nonempty_iff_eq_empty.mp hse subst s change HasContinuousHadamardDirDerivAt (fun y => ({a} : Finset I).inf' hs (fun i => f i y)) x simpa only [Finset.inf'_singleton] using hf a (mem_singleton_self a)
RatioDeltaMethod 2 core · 1 supporting This file specializes the multivariate delta method to ratio statistics such as Wald-ratio and LATE estimands. ★ deltaMethod_ratio
This file specializes the multivariate delta method to ratio statistics such as
Wald-ratio and LATE estimands. It defines the closed-form derivative
ratioDeriv t₀ = (1 / b) • proj₀ - (a / b ^ 2) • proj₁ on
EuclideanSpace ℝ (Fin 2), proves hasFDerivAt_ratio for the map
v ↦ v 0 / v 1 when the denominator coordinate is nonzero, and instantiates
deltaMethod in deltaMethod_ratio.
For a two-dimensional real vector with coordinates , the ratio derivative is the linear map sending an increment to , namely the derivative of the ratio whenever is nonzero.
Definition (Lean source)
Ratio / quotient delta method. Let t₀ = (a, b) with b nonzero and let Tn n ω = (N̂ₙ, D̂ₙ) be a bivariate estimator sequence of t₀. Given that the rescaled deviation √n • (Tn − t₀) is measurable at every sample size and that the rescaled ratio √n • (Tn 0 / Tn 1 − a/b) is measurable at every sample size, if the laws of the rescaled deviation converge weakly to a probability measure Q on EuclideanSpace ℝ (Fin 2), then the laws of the rescaled ratio √n • (Tn 0 / Tn 1 − a/b) converge weakly to the pushforward of Q along the ratio derivative ratioDeriv t₀.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
hasFDerivAt_ratiotheorem — Fréchet derivative of the ratio map. On EuclideanSpace ℝ (Fin 2), the map v ↦ v 0 / v 1 is Fréchet-differentiable at any t₀ whose second coordinate is nonzero, with derivative ratioDeriv t₀.Proof (Lean source)
theorem hasFDerivAt_ratio {t₀ : EuclideanSpace ℝ (Fin 2)} (hb : t₀ 1 ≠ 0) : HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 0 / v 1) (ratioDeriv t₀) t₀ := by have h0 : HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 0) (EuclideanSpace.proj (𝕜 := ℝ) 0) t₀ := (EuclideanSpace.proj (𝕜 := ℝ) 0).hasFDerivAt have h1 : HasFDerivAt (fun v : EuclideanSpace ℝ (Fin 2) => v 1) (EuclideanSpace.proj (𝕜 := ℝ) 1) t₀ := (EuclideanSpace.proj (𝕜 := ℝ) 1).hasFDerivAt -- derivative of `v ↦ (v 1)⁻¹` by composing scalar `hasFDerivAt_inv` with `h1` have hinv := (hasFDerivAt_inv hb).comp t₀ h1 -- `x / y = x * y⁻¹` have heq : (fun v : EuclideanSpace ℝ (Fin 2) => v 0 / v 1) = (fun v : EuclideanSpace ℝ (Fin 2) => v 0 * (v 1)⁻¹) := by funext v; rw [div_eq_mul_inv] rw [heq] have hmul := h0.mul hinv refine hmul.congr_fderiv ?_ ext v simp only [ratioDeriv, ContinuousLinearMap.sub_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply, ContinuousLinearMap.comp_apply, ContinuousLinearMap.toSpanSingleton_apply, Function.comp_apply, smul_eq_mul] ring
Studentize 2 core · 3 supporting This file provides estimator-agnostic studentized CLT and Wald-interval coverage results. ★ div_tendsto_inProb_gaussian★ wald_coverage
This file provides estimator-agnostic studentized CLT and Wald-interval coverage
results. The portmanteau helper
Tendsto_dist.tendsto_measure_of_null_frontier converts convergence in
distribution into convergence of probabilities for continuity sets, while
gaussianMeasure_zero_one_singleton and
gaussianMeasure_zero_one_frontier_Icc record the boundary-null facts needed for
standard-normal intervals.
The main studentization theorem
Tendsto_dist.div_tendsto_inProb_gaussian proves that Xn / σ_hat ⇒ N(0,1)
from Xn ⇒ N(0, σ₀ ^ 2) and σ_hat →ₚ σ₀ > 0. The coverage theorem
Tendsto_dist.wald_coverage then transfers the limiting probability of
Sn ∈ Icc (-z) z to an abstract coverage sequence via a bridge hypothesis.
Generic studentized convergence. Let Xn be a real-valued rescaled-estimator sequence and σ_hat a variance-estimator sequence, with σ₀ a positive scale. Suppose Xn is measurable at every sample size and it converges in distribution to the project's Gaussian law with mean zero and variance σ₀², that σ_hat converges in probability to σ₀, and the studentized ratio Xn / σ_hat is measurable at every sample size. Then the studentized ratio Xn / σ_hat converges in distribution to the standard Gaussian law.
Formal statement
Proof (Lean source)
Generic Wald asymptotic coverage. Suppose a studentized statistic sequence Sn is measurable at every sample size and converges in distribution to the standard Gaussian law, and fix a positive half-width z. If a coverage-probability sequence coverProb is asymptotically equivalent to the studentized-interval event {Sn ∈ [-z, z]}, then coverProb converges to the standard-Gaussian probability of [-z, z].
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
tendsto_measure_of_null_frontiertheorem — Continuity-set form of portmanteau for the project's Tendsto_dist wrapper.hypothesesΩ :Xn :ℕ → Ω → ℝQ :hXn :∀ n, AEMeasurable (Xn n) μhX :Tendsto_dist Xn Q μ hXnE :Set ℝhE :Q (frontier E) = 0Proof (Lean source)
theorem Tendsto_dist.tendsto_measure_of_null_frontier {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {Xn : ℕ → Ω → ℝ} {Q : Measure ℝ} [IsProbabilityMeasure Q] (hXn : ∀ n, AEMeasurable (Xn n) μ) (hX : Tendsto_dist Xn Q μ hXn) {E : Set ℝ} (hE : Q (frontier E) = 0) : Tendsto (fun n => ((μ.map (Xn n)) E).toReal) atTop (𝓝 (Q E).toReal) := by simp only [causal_defs_simps] at hX let μs : ℕ → ProbabilityMeasure ℝ := fun n => ⟨μ.map (Xn n), Measure.isProbabilityMeasure_map (hXn n)⟩ let ν : ProbabilityMeasure ℝ := ⟨Q, inferInstance⟩ have hE' : ν (frontier E) = 0 := by change (Q (frontier E)).toNNReal = 0 simp [hE] have hpm := MeasureTheory.ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto (μs := μs) (μ := ν) hX (E := E) hE' have hreal := NNReal.continuous_coe.tendsto _ |>.comp hpm simpa [μs, ν, ENNReal.coe_toNNReal_eq_toReal, Function.comp_def] using hreal -
gaussianMeasure_zero_one_singletontheorem — The standard normal has no atom at any real point.Proof (Lean source)
theorem gaussianMeasure_zero_one_singleton (x : ℝ) : gaussianMeasure 0 1 ({x} : Set ℝ) = 0 := by haveI : NullSingletonClass (gaussianMeasure 0 1) := by unfold gaussianMeasure exact ProbabilityTheory.nullSingletonClass_gaussianReal (by norm_num) exact MeasureTheory.NullSingletonClass.measure_singleton x -
gaussianMeasure_zero_one_frontier_Icctheorem — The standard normal gives zero mass to the boundary of a symmetric closed interval.Proof (Lean source)
theorem gaussianMeasure_zero_one_frontier_Icc {z : ℝ} (hz : 0 < z) : gaussianMeasure 0 1 (frontier (Icc (-z) z)) = 0 := by have hle : -z ≤ z := by linarith rw [frontier_Icc hle] rw [show ({-z, z} : Set ℝ) = {-z} ∪ {z} by ext x; simp [or_comm]] exact le_antisymm (by calc gaussianMeasure 0 1 (({-z} : Set ℝ) ∪ {z}) ≤ gaussianMeasure 0 1 ({-z} : Set ℝ) + gaussianMeasure 0 1 ({z} : Set ℝ) := measure_union_le _ _ _ = 0 := by simp [gaussianMeasure_zero_one_singleton]) zero_le
VarianceEstimation 2 core · 3 supporting This file proves variance and covariance consistency tools for i.i.d. ★ sampleCov_entry_tendsto_inProb★ sqrt_var_tendsto_inProb
This file proves variance and covariance consistency tools for i.i.d. samples.
Inside IIDSample, sampleMean_mul_tendsto_inProb applies the WLLN to empirical
means of products, and sampleCov_entry_tendsto_inProb turns a square-integrable
vector influence function into entrywise covariance-matrix consistency for any
pair of continuous linear coordinate functionals.
The helper abs_apply_mul_le_norm_sq supplies the domination bound needed for
entrywise integrability. The final packaging lemmas Tendsto_inProb.sqrt and
sqrt_var_tendsto_inProb convert variance-estimator consistency into
standard-error consistency, the input expected by the studentized CLT.
Entrywise covariance-matrix consistency. For an i.i.d. sample S and two continuous linear coordinate functionals φ φ' : E →L[ℝ] ℝ, suppose a vector influence function ψ : X → E is measurable and has square-integrable norm along the sample. Then the empirical mean of the entry product φ(ψ·) · φ'(ψ·) converges in probability to the population integral ∫ x, φ(ψ x) · φ'(ψ x) ∂P.
Formal statement
Proof (Lean source)
Standard-error consistency from variance consistency. Fix a positive scale σ₀. If a variance-estimator sequence varhat converges in probability to σ₀², then the standard-error estimator √varhat converges in probability to σ₀. This is exactly the σ̂ →ₚ σ₀ input required by the generic studentized CLT Tendsto_dist.div_tendsto_inProb_gaussian; callers feed fun N ω => Real.sqrt (varhat N ω) to it.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
sampleMean_mul_tendsto_inProbtheorem — Empirical mean of a product. For two measurable real-valued statistics g₁, g₂ of an i.i.d. sample whose product is integrable, the empirical mean S.sampleMean (g₁ · g₂) N converges in probability to the population integral ∫ x, g₁ x * g₂ x ∂P. Direct application of the generic WLLN to the product g := fun x => g₁ x * g₂ x.hypothesesΩ :sharedType u_1X :sharedType u_2S :IIDSample Ω X μ Pg₁ g₂ :X → ℝhg₁_meas :Measurable g₁hg₂_meas :Measurable g₂hint :Integrable (fun ω => g₁ (S.Z 0 ω) * g₂ (S.Z 0 ω)) μconclusionTendsto_inProb (S.sampleMean (fun x => g₁ x * g₂ x)) (fun _ => ∫ x, g₁ x * g₂ x ∂P) μProof (Lean source)
theorem sampleMean_mul_tendsto_inProb (S : IIDSample Ω X μ P) [IsProbabilityMeasure P] {g₁ g₂ : X → ℝ} (hg₁_meas : Measurable g₁) (hg₂_meas : Measurable g₂) (hint : Integrable (fun ω => g₁ (S.Z 0 ω) * g₂ (S.Z 0 ω)) μ) : Tendsto_inProb (S.sampleMean (fun x => g₁ x * g₂ x)) (fun _ => ∫ x, g₁ x * g₂ x ∂P) μ := have hintP : Integrable (fun x => g₁ x * g₂ x) P := by have hint_map : Integrable (fun x => g₁ x * g₂ x) (μ.map (S.Z 0)) := (MeasureTheory.integrable_map_measure (hg₁_meas.mul hg₂_meas).aestronglyMeasurable (S.meas 0).aemeasurable).mpr (by simpa [Function.comp_def] using hint) rwa [S.law] at hint_map S.sampleMean_tendsto_inProb (hg₁_meas.mul hg₂_meas) hintP -
abs_apply_mul_le_norm_sqtheorem — The pointwise product of two functional-evaluations is dominated by a constant times ‖ψ x‖²: |φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖². Used to derive entrywise integrability of the product from the single hypothesis Integrable (fun x => ‖ψ x‖²) P.hypothesesX :sharedType u_2E :sharedType u_3φ φ' :E →L[ℝ] ℝψ :X → Ex :Xconclusion|φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2Proof (Lean source)
theorem abs_apply_mul_le_norm_sq (φ φ' : E →L[ℝ] ℝ) (ψ : X → E) (x : X) : |φ (ψ x) * φ' (ψ x)| ≤ (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2 := by rw [abs_mul] have hb1 : |φ (ψ x)| ≤ ‖φ‖ * ‖ψ x‖ := (Real.norm_eq_abs _).symm.le.trans (φ.le_opNorm (ψ x)) have hb2 : |φ' (ψ x)| ≤ ‖φ'‖ * ‖ψ x‖ := (Real.norm_eq_abs _).symm.le.trans (φ'.le_opNorm (ψ x)) calc |φ (ψ x)| * |φ' (ψ x)| ≤ (‖φ‖ * ‖ψ x‖) * (‖φ'‖ * ‖ψ x‖) := mul_le_mul hb1 hb2 (abs_nonneg _) (mul_nonneg (norm_nonneg _) (norm_nonneg _)) _ = (‖φ‖ * ‖φ'‖) * ‖ψ x‖ ^ 2 := by ring -
sqrttheorem — Square root preserves convergence in probability. If Vn →ₚ v₀ under μ, then √Vn →ₚ √v₀. Continuous mapping with the (everywhere continuous) Real.sqrt, via Tendsto_inProb.comp_continuousAt.hypothesesconclusionProof (Lean source)
theorem Tendsto_inProb.sqrt {Ω : Type*} [MeasurableSpace Ω] {Vn : ℕ → Ω → ℝ} {v₀ : ℝ} {μ : Measure Ω} (h : Tendsto_inProb Vn (fun _ => v₀) μ) : Tendsto_inProb (fun n ω => sqrt (Vn n ω)) (fun _ => sqrt v₀) μ := Tendsto_inProb.comp_continuousAt (Real.continuous_sqrt.continuousAt) h
WaldVec 2 core · 0 supporting This file reduces multivariate Wald ellipsoid coverage to scalar convergence of the Wald statistic. ★ wald_coverage_Iic★ wald_coverage_Iic_of_noAtoms
This file reduces multivariate Wald ellipsoid coverage to scalar convergence of
the Wald statistic. The theorem Tendsto_dist.wald_coverage_Iic says that if
Wn ⇒ χ, the limit has zero mass on the boundary of Iic c, and a coverage
sequence is asymptotically equivalent to the event {ω | Wn n ω ≤ c}, then the
coverage sequence converges to χ (Iic c).
The variant Tendsto_dist.wald_coverage_Iic_of_noAtoms discharges the
boundary-null hypothesis when the Wald-statistic limit law has no atoms. The
chi-squared specialization lives in Causalean.Stat.Inference.ChiSquaredWald,
which identifies the Gaussian quadratic-form limit.
Wald / confidence-ellipsoid asymptotic coverage. Suppose the scalar Wald statistic sequence Wₙ is measurable at every sample size and converges in distribution to a limit law χ, and that χ gives zero mass to the boundary frontier (Iic c) = {c}. If a real sequence coverProb is asymptotically equivalent to the ellipsoid event {ω | Wₙ ω ≤ c}, then coverProb converges to χ(Iic c).
Formal statement
Proof (Lean source)
Wald / ellipsoid coverage with an atomless limit. Suppose the scalar Wald statistic sequence Wₙ is measurable at every sample size and converges in distribution to a limit law χ with no atoms (which holds for any non-degenerate χ²_d, and more generally for any continuous limit). If a real sequence coverProb is asymptotically equivalent to the ellipsoid event {ω | Wₙ ω ≤ c}, then coverProb converges to χ(Iic c). The boundary-null hypothesis of wald_coverage_Iic is automatic here: frontier (Iic c) = {c} and χ {c} = 0.