Skip to content

Commit 4d6abae

Browse files
committed
chore(Probability): remove 15/24 backward.isDefEq.respectTransparency options (#42733)
Remove 15 of the 24 `set_option backward.isDefEq.respectTransparency` (and `.types`) occurrences in `Mathlib/Probability`. See #42734 for 5 more. See #42735 for 1 more. See #42738 for 2 more in `Mathlib/Probability`. See #42739 for the last one.
1 parent 029c4bb commit 4d6abae

12 files changed

Lines changed: 38 additions & 56 deletions

File tree

Mathlib/Probability/Distributions/Binomial.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,13 @@ lemma binomial_real_self (n : ℕ) (p : I) :
127127
lemma map_cast_binomial_real_self [MeasurableSingletonClass R] [CharZero R] (n : ℕ) (p : I) :
128128
Bin(R, n, p).real {(n : R)} = p ^ n := by simp [map_cast_binomial_real_singleton]
129129

130-
set_option backward.isDefEq.respectTransparency.types false in
131130
@[simp]
132131
lemma binomial_one_eq_bernoulliMeasure (p : I) :
133132
Bin(1, p) = Ber(1, 0, p) := by
134133
refine ext_of_measureReal_singleton fun k ↦ ?_
135134
match k with
136135
| 0 | 1 => simp
137-
| k + 2 => simp [binomial_real_singleton]
136+
| k + 2 => simp [binomial_real_singleton, Nat.choose_eq_zero_of_lt]
138137

139138
lemma binomial_eq_sum_dirac (n : ℕ) (p : I) :
140139
Bin(n, p) =

Mathlib/Probability/Distributions/Fernique.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ lemma lintegral_closedBall_sdiff_exp_logRatio_mul_sq_le [IsProbabilityMeasure μ
377377
alias lintegral_closedBall_diff_exp_logRatio_mul_sq_le :=
378378
lintegral_closedBall_sdiff_exp_logRatio_mul_sq_le
379379

380-
set_option backward.isDefEq.respectTransparency.types false in
381380
open Metric in
382381
lemma lintegral_exp_mul_sq_norm_le_mul [IsProbabilityMeasure μ]
383382
(h_rot : (μ.prod μ).map (ContinuousLinearMap.rotation (-(π / 4))) = μ.prod μ)
@@ -421,7 +420,7 @@ lemma lintegral_exp_mul_sq_norm_le_mul [IsProbabilityMeasure μ]
421420
rw [← setLIntegral_univ]
422421
refine setLIntegral_congr ?_
423422
rw [← ae_iff_prob_eq_one ?_] at ha
424-
· rw [eventuallyEq_comm, ae_eq_univ]
423+
· refine (ae_eq_univ.2 ?_).symm
425424
change μ {x | ¬ x ∈ closedBall 0 a} = 0
426425
rw [← ae_iff]
427426
filter_upwards [ha] with x hx using by simp [hx]

Mathlib/Probability/Distributions/Gaussian/IsGaussianProcess/Basic.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,12 @@ lemma aemeasurable (hX : IsGaussianProcess X P) (t : T) : AEMeasurable (X t) P :
5252
AEMeasurable.of_map_ne_zero
5353
(hX.hasGaussianLaw {t}).isGaussian_map.toIsProbabilityMeasure.ne_zero |>.eval ⟨t, by simp⟩
5454

55-
set_option backward.isDefEq.respectTransparency false in
5655
/-- A modification of a Gaussian process is a Gaussian process. -/
5756
lemma congr (hX : IsGaussianProcess X P) (hXY : ∀ t, X t =ᵐ[P] Y t) :
5857
IsGaussianProcess Y P where
5958
hasGaussianLaw I := by
60-
constructor
61-
rw [map_restrict_eq_of_forall_ae_eq fun t ↦ (hXY t).symm]
62-
exact (hX.hasGaussianLaw I).isGaussian_map
59+
refine (hX.hasGaussianLaw I).congr ?_
60+
filter_upwards [ae_all_iff.2 fun i : I ↦ hXY i] with ω h using funext h
6361

6462
end Basic
6563

Mathlib/Probability/Distributions/Gaussian/Real.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ lemma gaussianReal_map_const_add (y : ℝ) :
325325
simp_rw [add_comm y]
326326
exact gaussianReal_map_add_const y
327327

328-
set_option backward.isDefEq.respectTransparency.types false in
329328
/-- The map of a Gaussian distribution by multiplication by a constant is a Gaussian. -/
330329
lemma gaussianReal_map_const_mul (c : ℝ) :
331330
(gaussianReal μ v).map (c * ·) = gaussianReal (c * μ) (.mk (c ^ 2) (sq_nonneg _) * v) := by
@@ -345,8 +344,7 @@ lemma gaussianReal_map_const_mul (c : ℝ) :
345344
· simp only [ne_eq, mul_eq_zero, hv, or_false]
346345
rw [← NNReal.coe_inj]
347346
simp [hc]
348-
simp only [e, Homeomorph.mulLeft₀,
349-
Equiv.mulLeft₀_symm_apply, Homeomorph.toMeasurableEquiv_coe, Homeomorph.homeomorph_mk_coe_symm,
347+
simp only [e, Homeomorph.toMeasurableEquiv_coe, Homeomorph.mulLeft₀_symm_apply,
350348
gaussianPDFReal_inv_mul hc]
351349
congr with x
352350
suffices |c⁻¹| * |c| = 1 by rw [← mul_assoc, this, one_mul]

Mathlib/Probability/Distributions/Uniform.lean

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,10 @@ theorem uniformOfFinset_apply_of_mem (ha : a ∈ s) : uniformOfFinset s hs a = (
236236

237237
theorem uniformOfFinset_apply_of_notMem (ha : a ∉ s) : uniformOfFinset s hs a = 0 := by simp [ha]
238238

239-
set_option backward.isDefEq.respectTransparency.types false in
240239
@[simp]
241-
theorem support_uniformOfFinset : (uniformOfFinset s hs).support = s :=
242-
Set.ext
243-
(by
244-
let ⟨a, ha⟩ := hs
245-
simp [mem_support_iff])
240+
theorem support_uniformOfFinset : (uniformOfFinset s hs).support = s := by
241+
ext a
242+
simp [mem_support_iff]
246243

247244
theorem mem_support_uniformOfFinset_iff (a : α) : a ∈ (uniformOfFinset s hs).support ↔ a ∈ s := by
248245
simp

Mathlib/Probability/IdentDistrib.lean

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ section UniformIntegrable
295295
variable {E : Type*} [MeasurableSpace E] [NormedAddCommGroup E] [BorelSpace E]
296296
{μ : Measure α} [IsFiniteMeasure μ]
297297

298-
set_option backward.isDefEq.respectTransparency false in
299298
/-- This lemma is superseded by `MemLp.uniformIntegrable_of_identDistrib` which only requires
300299
`AEStronglyMeasurable`. -/
301300
theorem MemLp.uniformIntegrable_of_identDistrib_aux {ι : Type*} {f : ι → α → E} {j : ι} {p : ℝ≥0∞}
@@ -304,21 +303,21 @@ theorem MemLp.uniformIntegrable_of_identDistrib_aux {ι : Type*} {f : ι → α
304303
refine uniformIntegrable_of' hp hp' hfmeas fun ε hε => ?_
305304
by_cases hι : Nonempty ι
306305
swap; · exact ⟨0, fun i => False.elim (hι <| Nonempty.intro i)⟩
307-
obtain ⟨C, hC₁, hC₂⟩ := hℒp.eLpNorm_indicator_norm_ge_pos_le (hfmeas _) hε
308-
refine ⟨⟨C, hC₁.le⟩, fun i => le_trans (le_of_eq ?_) hC₂⟩
309-
have : {x | (⟨C, hC₁.le⟩ : ℝ≥0) ≤ ‖f i x‖₊} = {x | C ≤ ‖f i x‖} := by
306+
obtain ⟨C, -, hC₂⟩ := hℒp.eLpNorm_indicator_norm_ge_pos_le (hfmeas _) hε
307+
refine ⟨C.toNNReal, fun i le_trans (le_of_eq ?_) hC₂⟩
308+
have : {x | C.toNNReal ≤ ‖f i x‖₊} = {x | C ≤ ‖f i x‖} := by
310309
ext x
311-
simp_rw [← norm_toNNReal]
312-
exact Real.le_toNNReal_iff_coe_le (norm_nonneg _)
310+
simp_rw [Set.mem_ofPred_eq, Real.toNNReal_le_iff_le_coe, coe_nnnorm]
313311
rw [this, ← eLpNorm_norm, ← eLpNorm_norm (Set.indicator _ _)]
314312
simp_rw [norm_indicator_eq_indicator_norm, coe_nnnorm]
315-
let F : E → ℝ := (fun x : E => if (⟨C, hC₁.le⟩ : ℝ≥0) ≤ ‖x‖₊ then ‖x‖ else 0)
313+
let F : E → ℝ := (fun x : E if C.toNNReal ≤ ‖x‖₊ then ‖x‖ else 0)
316314
have F_meas : Measurable F := by
317315
apply measurable_norm.indicator (measurableSet_le measurable_const measurable_nnnorm)
318316
have : ∀ k, (fun x ↦ Set.indicator {x | C ≤ ‖f k x‖} (fun a ↦ ‖f k a‖) x) = F ∘ f k := by
319317
intro k
320318
ext x
321-
simp only [Set.indicator, Set.mem_ofPred_eq]; norm_cast
319+
simp only [F, Set.indicator, Set.mem_ofPred_eq, Function.comp_apply,
320+
Real.toNNReal_le_iff_le_coe, coe_nnnorm]
322321
rw [this, this, ← eLpNorm_map_measure F_meas.aestronglyMeasurable (hf i).aemeasurable_fst,
323322
(hf i).map_eq, eLpNorm_map_measure F_meas.aestronglyMeasurable (hf j).aemeasurable_fst]
324323

Mathlib/Probability/Kernel/Disintegration/MeasurableStieltjes.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ lemma tendsto_defaultRatCDF_atBot : Tendsto defaultRatCDF atBot (𝓝 0) := by
191191
refine ⟨-1, fun q hq => (ite_eq_left (hq.trans_lt ?_)).symm⟩
192192
linarith
193193

194-
set_option backward.isDefEq.respectTransparency false in
195194
lemma iInf_rat_gt_defaultRatCDF (t : ℚ) :
196195
⨅ r : Ioi t, defaultRatCDF r = defaultRatCDF t := by
197196
simp only [defaultRatCDF]
@@ -205,8 +204,7 @@ lemma iInf_rat_gt_defaultRatCDF (t : ℚ) :
205204
· refine le_antisymm ?_ (le_ciInf fun x ↦ ?_)
206205
· obtain ⟨q, htq, hq_neg⟩ : ∃ q, t < q ∧ q < 0 := ⟨t / 2, by linarith, by linarith⟩
207206
refine (ciInf_le h_bdd ⟨q, htq⟩).trans ?_
208-
rw [ite_eq_left]
209-
rwa [Subtype.coe_mk]
207+
exact (ite_eq_left hq_neg).le
210208
· split_ifs
211209
exacts [le_rfl, zero_le_one]
212210
· refine le_antisymm ?_ ?_

Mathlib/Probability/Kernel/Disintegration/StandardBorel.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,11 @@ instance instIsMarkovKernelCondKernelUnitReal (κ : Kernel Unit (α × ℝ)) [Is
159159
rw [condKernelUnitReal]
160160
infer_instance
161161

162-
set_option backward.isDefEq.respectTransparency false in
163162
instance condKernelUnitReal.instIsCondKernel (κ : Kernel Unit (α × ℝ)) [IsFiniteKernel κ] :
164163
κ.IsCondKernel κ.condKernelUnitReal where
165-
disintegrate := by rw [condKernelUnitReal, compProd_toKernel]; ext; simp
164+
disintegrate := by
165+
rw [condKernelUnitReal]
166+
exact compProd_toKernel (isCondKernelCDF_condCDF (κ ()))
166167

167168
end Real
168169

Mathlib/Probability/Martingale/BorelCantelli.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,25 @@ protected lemma Submartingale.stoppedAbove [IsFiniteMeasure μ] (hf : Submarting
7575

7676
variable {r : ℝ} {R : ℝ≥0}
7777

78-
set_option backward.isDefEq.respectTransparency false in
7978
theorem stoppedAbove_le (hr : 0 ≤ r) (hf0 : f 0 = 0)
8079
(hbdd : ∀ᵐ ω ∂μ, ∀ i, |f (i + 1) ω - f i ω| ≤ R) (i : ℕ) :
8180
∀ᵐ ω ∂μ, stoppedAbove f r i ω ≤ r + R := by
8281
filter_upwards [hbdd] with ω hbddω
83-
rw [stoppedAbove, stoppedProcess, ENat.some_eq_natCast]
84-
by_cases h_zero : (min (i : ℕ∞) (leastGE f r ω)).untopA = 0
82+
rw [stoppedAbove, stoppedProcess]
83+
by_cases h_zero : (min (WithTop.some i) (leastGE f r ω)).untopA = 0
8584
· simp only [h_zero, hf0, Pi.zero_apply]
8685
positivity
8786
obtain ⟨k, hk⟩ := Nat.exists_eq_add_one_of_ne_zero h_zero
8887
rw [hk, add_comm r, ← sub_le_iff_le_add]
8988
have := notMem_of_lt_hittingAfter (?_ : k < leastGE f r ω)
9089
· simp only [bot_eq_zero, zero_le, Set.mem_Ici, not_le, forall_const] at this
9190
exact (sub_lt_sub_left this _).le.trans ((le_abs_self _).trans (hbddω _))
92-
· suffices (k : ℕ∞) < min (i : ℕ∞) (leastGE f r ω) from this.trans_le (min_le_right _ _)
93-
have h_top : min (i : ℕ∞) (leastGE f r ω) ≠ ⊤ :=
91+
· suffices WithTop.some k < min (WithTop.some i) (leastGE f r ω) from
92+
this.trans_le (min_le_right _ _)
93+
have h_top : min (WithTop.some i) (leastGE f r ω) ≠ ⊤ :=
9494
ne_top_of_le_ne_top (by simp) (min_le_left _ _)
95-
lift min (i : ℕ∞) (leastGE f r ω) to ℕ using h_top with p
96-
simp only [untopD_coe_enat, Nat.cast_lt, gt_iff_lt] at *
95+
lift min (WithTop.some i) (leastGE f r ω) to ℕ using h_top with p
96+
simp only [WithTop.untopD_coe, WithTop.coe_lt_coe, gt_iff_lt] at *
9797
lia
9898

9999
theorem Submartingale.eLpNorm_stoppedAbove_le [IsFiniteMeasure μ] (hf : Submartingale f ℱ μ)

Mathlib/Probability/Moments/ComplexMGF.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ section ext
313313

314314
variable {Ω' : Type*} {mΩ' : MeasurableSpace Ω'} {Y : Ω' → ℝ} {μ' : Measure Ω'}
315315

316-
set_option backward.isDefEq.respectTransparency.types false in
317316
/-- If the complex moment-generating functions of two random variables `X` and `Y` with respect to
318317
the finite measures `μ`, `μ'`, respectively, coincide, then `μ.map X = μ'.map Y`. In other words,
319318
complex moment-generating functions separate the distributions of random variables. -/
@@ -323,8 +322,9 @@ theorem _root_.MeasureTheory.Measure.ext_of_complexMGF_eq [IsFiniteMeasure μ]
323322
μ.map X = μ'.map Y := by
324323
have inner_ne_zero (x : ℝ) (h : x ≠ 0) : innerₗ ℝ x ≠ 0 :=
325324
DFunLike.ne_iff.mpr ⟨x, inner_self_ne_zero.mpr h⟩
325+
have h_cont : Continuous fun p : ℝ × ℝ ↦ innerₗ ℝ p.1 p.2 := continuous_inner
326326
apply MeasureTheory.ext_of_integral_char_eq continuous_probChar probChar_ne_one inner_ne_zero
327-
continuous_inner (fun w ↦ ?_)
327+
h_cont (fun w ↦ ?_)
328328
rw [funext_iff] at h
329329
specialize h (Multiplicative.toAdd w * I)
330330
simp_rw [complexMGF, mul_assoc, mul_comm I, ← mul_assoc] at h

0 commit comments

Comments
 (0)