Skip to content

Commit 4b443f2

Browse files
grunwegYellPika
authored andcommitted
feat: use more fun_prop/measurability auto-parameters (leanprover-community#34577)
Inspired by review discussion in leanprover-community#34441.
1 parent f200f4b commit 4b443f2

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,9 @@ theorem ContinuousOn.measurable_piecewise {f g : α → γ} {s : Set α} [∀ j
519519
@[to_additive]
520520
instance (priority := 100) ContinuousMul.measurableMul [Mul γ] [ContinuousMul γ] :
521521
MeasurableMul γ where
522-
measurable_const_mul _ := (continuous_const.mul continuous_id).measurable
523-
measurable_mul_const _ := (continuous_id.mul continuous_const).measurable
524522

525523
instance (priority := 100) ContinuousSub.measurableSub [Sub γ] [ContinuousSub γ] :
526524
MeasurableSub γ where
527-
measurable_const_sub _ := (continuous_const.sub continuous_id).measurable
528-
measurable_sub_const _ := (continuous_id.sub continuous_const).measurable
529525

530526
@[to_additive]
531527
instance (priority := 100) ContinuousInv.measurableInv [Inv γ] [ContinuousInv γ] :
@@ -535,13 +531,11 @@ instance (priority := 100) ContinuousInv.measurableInv [Inv γ] [ContinuousInv
535531
instance (priority := 100) ContinuousConstSMul.toMeasurableConstSMul {M α} [TopologicalSpace α]
536532
[MeasurableSpace α] [BorelSpace α] [SMul M α] [ContinuousConstSMul M α] :
537533
MeasurableConstSMul M α where
538-
measurable_const_smul _ := (continuous_const_smul _).measurable
539534

540535
@[to_additive]
541536
instance (priority := 100) ContinuousSMul.toMeasurableSMul {M α} [TopologicalSpace M]
542537
[TopologicalSpace α] [MeasurableSpace M] [MeasurableSpace α] [OpensMeasurableSpace M]
543538
[BorelSpace α] [SMul M α] [ContinuousSMul M α] : MeasurableSMul M α where
544-
measurable_smul_const _ := (continuous_id.smul continuous_const).measurable
545539

546540
section Homeomorph
547541

Mathlib/MeasureTheory/Group/Arithmetic.lean

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ variable {α : Type*}
6060
/-- We say that a type has `MeasurableAdd` if `(c + ·)` and `(· + c)` are measurable functions.
6161
For a typeclass assuming measurability of `uncurry (· + ·)` see `MeasurableAdd₂`. -/
6262
class MeasurableAdd (M : Type*) [MeasurableSpace M] [Add M] : Prop where
63-
measurable_const_add : ∀ c : M, Measurable (c + ·)
64-
measurable_add_const : ∀ c : M, Measurable (· + c)
63+
measurable_const_add : ∀ c : M, Measurable (c + ·) := by intro; fun_prop
64+
measurable_add_const : ∀ c : M, Measurable (· + c) := by intro; fun_prop
6565

6666
export MeasurableAdd (measurable_const_add measurable_add_const)
6767

@@ -76,8 +76,8 @@ export MeasurableAdd₂ (measurable_add)
7676
For a typeclass assuming measurability of `uncurry (*)` see `MeasurableMul₂`. -/
7777
@[to_additive]
7878
class MeasurableMul (M : Type*) [MeasurableSpace M] [Mul M] : Prop where
79-
measurable_const_mul : ∀ c : M, Measurable (c * ·)
80-
measurable_mul_const : ∀ c : M, Measurable (· * c)
79+
measurable_const_mul : ∀ c : M, Measurable (c * ·) := by intro; fun_prop
80+
measurable_mul_const : ∀ c : M, Measurable (· * c) := by intro; fun_prop
8181

8282
export MeasurableMul (measurable_const_mul measurable_mul_const)
8383

@@ -138,8 +138,7 @@ theorem AEMeasurable.mul [MeasurableMul₂ M] (hf : AEMeasurable f μ) (hg : AEM
138138

139139
@[to_additive]
140140
instance (priority := 100) MeasurableMul₂.toMeasurableMul [MeasurableMul₂ M] :
141-
MeasurableMul M :=
142-
fun _ => measurable_const.mul measurable_id, fun _ => measurable_id.mul measurable_const⟩
141+
MeasurableMul M where
143142

144143
@[to_additive]
145144
instance Pi.measurableMul {ι : Type*} {α : ι → Type*} [∀ i, Mul (α i)]
@@ -214,8 +213,8 @@ end Pow
214213
/-- We say that a type has `MeasurableSub` if `(c - ·)` and `(· - c)` are measurable
215214
functions. For a typeclass assuming measurability of `uncurry (-)` see `MeasurableSub₂`. -/
216215
class MeasurableSub (G : Type*) [MeasurableSpace G] [Sub G] : Prop where
217-
measurable_const_sub : ∀ c : G, Measurable (c - ·)
218-
measurable_sub_const : ∀ c : G, Measurable (· - c)
216+
measurable_const_sub : ∀ c : G, Measurable (c - ·) := by intro; fun_prop
217+
measurable_sub_const : ∀ c : G, Measurable (· - c) := by intro; fun_prop
219218

220219
export MeasurableSub (measurable_const_sub measurable_sub_const)
221220

@@ -230,8 +229,8 @@ export MeasurableSub₂ (measurable_sub)
230229
For a typeclass assuming measurability of `uncurry (· / ·)` see `MeasurableDiv₂`. -/
231230
@[to_additive]
232231
class MeasurableDiv (G₀ : Type*) [MeasurableSpace G₀] [Div G₀] : Prop where
233-
measurable_const_div : ∀ c : G₀, Measurable (c / ·)
234-
measurable_div_const : ∀ c : G₀, Measurable (· / c)
232+
measurable_const_div : ∀ c : G₀, Measurable (c / ·) := by intro; fun_prop
233+
measurable_div_const : ∀ c : G₀, Measurable (· / c) := by intro; fun_prop
235234

236235
export MeasurableDiv (measurable_const_div measurable_div_const)
237236

@@ -447,7 +446,7 @@ class MeasurableConstVAdd (M α : Type*) [VAdd M α] [MeasurableSpace α] : Prop
447446
`x ↦ c • x` is a measurable function. -/
448447
@[to_additive]
449448
class MeasurableConstSMul (M α : Type*) [SMul M α] [MeasurableSpace α] : Prop where
450-
measurable_const_smul : ∀ c : M, Measurable (c • · : α → α)
449+
measurable_const_smul : ∀ c : M, Measurable (c • · : α → α) := by measurability
451450

452451
/-- We say that the action of `M` on `α` has `MeasurableVAdd` if for each `c` the map `x ↦ c +ᵥ x`
453452
is a measurable function and for each `x` the map `c ↦ c +ᵥ x` is a measurable function. -/
@@ -460,7 +459,7 @@ is a measurable function and for each `x` the map `c ↦ c • x` is a measurabl
460459
@[to_additive]
461460
class MeasurableSMul (M α : Type*) [SMul M α] [MeasurableSpace M] [MeasurableSpace α]
462461
extends MeasurableConstSMul M α where
463-
measurable_smul_const : ∀ x : α, Measurable (· • x : M → α)
462+
measurable_smul_const : ∀ x : α, Measurable (· • x : M → α) := by measurability
464463

465464
/-- We say that the action of `M` on `α` has `MeasurableVAdd₂` if the map
466465
`(c, x) ↦ c +ᵥ x` is a measurable function. -/
@@ -485,8 +484,6 @@ export MeasurableVAdd₂ (measurable_vadd)
485484
@[to_additive]
486485
instance measurableSMul_of_mul (M : Type*) [Mul M] [MeasurableSpace M] [MeasurableMul M] :
487486
MeasurableSMul M M where
488-
measurable_const_smul := measurable_id.const_mul
489-
measurable_smul_const := measurable_id.mul_const
490487

491488
@[to_additive]
492489
instance measurableSMul₂_of_mul (M : Type*) [Mul M] [MeasurableSpace M] [MeasurableMul₂ M] :
@@ -577,8 +574,6 @@ theorem AEMeasurable.smul [MeasurableSMul₂ M X] {μ : Measure α} (hf : AEMeas
577574
@[to_additive]
578575
instance (priority := 100) MeasurableSMul₂.toMeasurableSMul [MeasurableSMul₂ M X] :
579576
MeasurableSMul M X where
580-
measurable_const_smul _ := measurable_const.smul measurable_id
581-
measurable_smul_const _ := measurable_id.smul measurable_const
582577

583578
variable [MeasurableSMul M X]
584579

@@ -588,8 +583,7 @@ theorem Measurable.smul_const (hf : Measurable f) (y : X) : Measurable fun x =>
588583

589584
@[to_additive (attr := fun_prop)]
590585
theorem AEMeasurable.smul_const (hf : AEMeasurable f μ) (y : X) :
591-
AEMeasurable (fun x => f x • y) μ :=
592-
(MeasurableSMul.measurable_smul_const y).comp_aemeasurable hf
586+
AEMeasurable (fun x => f x • y) μ := by fun_prop
593587

594588
@[to_additive]
595589
instance Pi.measurableSMul {ι : Type*} {α : ι → Type*} [∀ i, SMul M (α i)]
@@ -769,7 +763,6 @@ nonrec instance MeasurableSMul₂.op {M α} [MeasurableSpace M] [MeasurableSpace
769763
@[to_additive]
770764
instance measurableSMul_opposite_of_mul {M : Type*} [Mul M] [MeasurableSpace M]
771765
[MeasurableMul M] : MeasurableSMul Mᵐᵒᵖ M where
772-
measurable_const_smul c := measurable_mul_const (unop c)
773766
measurable_smul_const x := measurable_mul_unop.const_mul x
774767

775768
@[to_additive]
@@ -887,8 +880,6 @@ variable [MeasurableSpace α] [Mul α] [Div α] [Inv α]
887880
@[to_additive] -- See note [lower instance priority]
888881
instance (priority := 100) DiscreteMeasurableSpace.toMeasurableMul [DiscreteMeasurableSpace α] :
889882
MeasurableMul α where
890-
measurable_const_mul _ := .of_discrete
891-
measurable_mul_const _ := .of_discrete
892883

893884
@[to_additive DiscreteMeasurableSpace.toMeasurableAdd₂] -- See note [lower instance priority]
894885
instance (priority := 100) DiscreteMeasurableSpace.toMeasurableMul₂
@@ -901,8 +892,6 @@ instance (priority := 100) DiscreteMeasurableSpace.toMeasurableInv [DiscreteMeas
901892
@[to_additive] -- See note [lower instance priority]
902893
instance (priority := 100) DiscreteMeasurableSpace.toMeasurableDiv [DiscreteMeasurableSpace α] :
903894
MeasurableDiv α where
904-
measurable_const_div _ := .of_discrete
905-
measurable_div_const _ := .of_discrete
906895

907896
@[to_additive DiscreteMeasurableSpace.toMeasurableSub₂] -- See note [lower instance priority]
908897
instance (priority := 100) DiscreteMeasurableSpace.toMeasurableDiv₂

0 commit comments

Comments
 (0)