Skip to content

Commit 3871d9a

Browse files
committed
chore: use inferInstanceAs in measure theory (leanprover-community#37206)
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
1 parent c660ea4 commit 3871d9a

6 files changed

Lines changed: 11 additions & 9 deletions

File tree

Mathlib/Logic/Encodable/Pi.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ variable {α : Type*}
3030

3131
/-- If `α` is encodable, then so is `Vector α n`. -/
3232
instance List.Vector.encodable [Encodable α] {n} : Encodable (List.Vector α n) :=
33-
Subtype.encodable
33+
inferInstanceAs <| Encodable (Subtype _)
3434

3535
/-- If `α` is countable, then so is `Vector α n`. -/
3636
instance List.Vector.countable [Countable α] {n} : Countable (List.Vector α n) :=
37-
Subtype.countable
37+
inferInstanceAs <| Countable (Subtype _)
3838

3939
/-- If `α` is encodable, then so is `Fin n → α`. -/
4040
instance finArrow [Encodable α] {n} : Encodable (Fin n → α) :=

Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,10 @@ instance Real.borelSpace : BorelSpace ℝ :=
701701
⟨rfl⟩
702702

703703
instance NNReal.measurableSpace : MeasurableSpace ℝ≥0 :=
704-
Subtype.instMeasurableSpace
704+
inferInstanceAs <| MeasurableSpace (Subtype _)
705705

706706
instance NNReal.borelSpace : BorelSpace ℝ≥0 :=
707-
Subtype.borelSpace _
707+
inferInstanceAs <| BorelSpace (Subtype _)
708708

709709
instance ENNReal.measurableSpace : MeasurableSpace ℝ≥0∞ :=
710710
borel ℝ≥0

Mathlib/MeasureTheory/Function/LpSpace/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ theorem coe_LpSubmodule : (LpSubmodule 𝕜 E p μ).toAddSubgroup = Lp E p μ :=
416416
rfl
417417

418418
instance instModule : Module 𝕜 (Lp E p μ) :=
419-
{ (LpSubmodule 𝕜 E p μ).module with }
419+
fast_instance% (LpSubmodule 𝕜 E p μ).module
420420

421421
theorem coeFn_smul (c : 𝕜) (f : Lp E p μ) : ⇑(c • f) =ᵐ[μ] c • ⇑f :=
422422
AEEqFun.coeFn_smul _ _

Mathlib/MeasureTheory/Measure/FiniteMeasure.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ theorem coeFn_smul [IsScalarTower R ℝ≥0 ℝ≥0] (c : R) (μ : FiniteMeasure
260260
funext; simp [← ENNReal.coe_inj, ENNReal.coe_smul]
261261

262262
set_option backward.isDefEq.respectTransparency false in
263-
instance instAddCommMonoid : AddCommMonoid (FiniteMeasure Ω) :=
263+
instance instAddCommMonoid : AddCommMonoid (FiniteMeasure Ω) := fast_instance%
264264
toMeasure_injective.addCommMonoid _ toMeasure_zero toMeasure_add fun _ _ ↦ toMeasure_smul _ _
265265

266266
/-- Coercion is an `AddMonoidHom`. -/
@@ -331,7 +331,8 @@ theorem restrict_nonzero_iff (μ : FiniteMeasure Ω) (A : Set Ω) : μ.restrict
331331
simp
332332

333333
/-- The type of finite measures is a measurable space when equipped with the Giry monad. -/
334-
instance : MeasurableSpace (FiniteMeasure Ω) := Subtype.instMeasurableSpace
334+
instance : MeasurableSpace (FiniteMeasure Ω) :=
335+
inferInstanceAs <| MeasurableSpace (Subtype _)
335336

336337
/-- The set of all finite measures is a measurable set in the Giry monad. -/
337338
lemma measurableSet_isFiniteMeasure : MeasurableSet { μ : Measure Ω | IsFiniteMeasure μ } := by

Mathlib/MeasureTheory/Measure/NullMeasurable.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ instance NullMeasurableSpace.instSubsingleton [h : Subsingleton α] :
8585
h
8686

8787
instance NullMeasurableSpace.instMeasurableSpace : MeasurableSpace (NullMeasurableSpace α μ) :=
88-
@eventuallyMeasurableSpace α inferInstance (ae μ) _
88+
fast_instance% @eventuallyMeasurableSpace α inferInstance (ae μ) _
8989

9090
/-- A set is called `NullMeasurableSet` if it can be approximated by a measurable set up to
9191
a set of null measure. -/

Mathlib/MeasureTheory/Measure/ProbabilityMeasure.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ theorem toFiniteMeasure_nonzero (μ : ProbabilityMeasure Ω) : μ.toFiniteMeasur
244244
simp [← FiniteMeasure.mass_nonzero_iff]
245245

246246
/-- The type of probability measures is a measurable space when equipped with the Giry monad. -/
247-
instance : MeasurableSpace (ProbabilityMeasure Ω) := Subtype.instMeasurableSpace
247+
instance : MeasurableSpace (ProbabilityMeasure Ω) :=
248+
inferInstanceAs <| MeasurableSpace (Subtype _)
248249

249250
lemma measurableSet_isProbabilityMeasure :
250251
MeasurableSet { μ : Measure Ω | IsProbabilityMeasure μ } := by

0 commit comments

Comments
 (0)