Skip to content

Commit 409fcdc

Browse files
committed
chore: golf using fun_prop (leanprover-community#34441)
The goal of this PR is to remove many explicit references to continuous(On)_const; to reduce the diff in leanprover-community#31607.
1 parent a541d53 commit 409fcdc

File tree

78 files changed

+186
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+186
-361
lines changed

Mathlib/Analysis/Analytic/Basic.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,7 @@ theorem HasFPowerSeriesWithinOnBall.tendstoLocallyUniformlyOn'
959959
(hf : HasFPowerSeriesWithinOnBall f p s x r) :
960960
TendstoLocallyUniformlyOn (fun n y => p.partialSum n (y - x)) f atTop
961961
(insert x s ∩ EMetric.ball (x : E) r) := by
962-
have A : ContinuousOn (fun y : E => y - x) (insert x s ∩ EMetric.ball (x : E) r) :=
963-
(continuous_id.sub continuous_const).continuousOn
962+
have A : ContinuousOn (fun y : E => y - x) (insert x s ∩ EMetric.ball (x : E) r) := by fun_prop
964963
convert hf.tendstoLocallyUniformlyOn.comp (fun y : E => y - x) _ A using 1
965964
· ext z
966965
simp

Mathlib/Analysis/Analytic/Inverse.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ lemma HasFPowerSeriesAt.eventually_hasSum_of_comp {f : E → F} {g : F → G}
621621
have : ∀ᶠ y in 𝓝 (0 : E), f (x + y) - f x ∈ EMetric.ball 0 q.radius := by
622622
have A : ContinuousAt (fun y ↦ f (x + y) - f x) 0 := by
623623
apply ContinuousAt.sub _ continuousAt_const
624-
exact hf.continuousAt.comp_of_eq (continuous_add_left x).continuousAt (by simp)
624+
exact hf.continuousAt.comp_of_eq (by fun_prop) (by simp)
625625
have B : EMetric.ball 0 q.radius ∈ 𝓝 (f (x + 0) - f x) := by
626626
simpa using EMetric.ball_mem_nhds _ hq
627627
exact A.preimage_mem_nhds B

Mathlib/Analysis/CStarAlgebra/Multiplier.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,7 @@ instance [CompleteSpace A] : CompleteSpace 𝓜(𝕜, A) := by
525525
rw [completeSpace_iff_isComplete_range isUniformEmbedding_toProdMulOpposite.isUniformInducing]
526526
apply IsClosed.isComplete
527527
simp only [range_toProdMulOpposite, Set.setOf_forall]
528-
refine isClosed_iInter fun x => isClosed_iInter fun y => isClosed_eq ?_ ?_
529-
· exact
530-
((ContinuousLinearMap.apply 𝕜 A _).continuous.comp <| continuous_unop.comp continuous_snd).mul
531-
continuous_const
532-
exact continuous_const.mul ((ContinuousLinearMap.apply 𝕜 A _).continuous.comp continuous_fst)
528+
exact isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ isClosed_eq (by fun_prop) (by fun_prop)
533529

534530
variable [StarRing A] [CStarRing A]
535531

Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ theorem y_le_one {D : ℝ} (x : E) (Dpos : 0 < D) : y D x ≤ 1 := by
382382
fun _ => zero_le_one
383383
refine ((w_compact_support E Dpos).convolutionExists_left _ ?_
384384
(locallyIntegrable_const (1 : ℝ)) x).integrable
385-
exact continuous_const.mul ((u_continuous E).comp (continuous_id.const_smul _))
385+
exact continuous_const.mul ((u_continuous E).comp (by fun_prop))
386386
have B : (w D ⋆[lsmul ℝ ℝ, μ] fun _ => (1 : ℝ)) x = 1 := by
387387
simp only [convolution, mul_one, lsmul_apply, smul_eq_mul, w_integral E Dpos]
388388
exact A.trans (le_of_eq B)
@@ -395,7 +395,7 @@ theorem y_pos_of_mem_ball {D : ℝ} {x : E} (Dpos : 0 < D) (D_lt_one : D < 1)
395395
have B : LocallyIntegrable (φ : E → ℝ) μ :=
396396
(locallyIntegrable_const _).indicator measurableSet_closedBall
397397
have C : Continuous (w D : E → ℝ) :=
398-
continuous_const.mul ((u_continuous E).comp (continuous_id.const_smul _))
398+
continuous_const.mul ((u_continuous E).comp (by fun_prop))
399399
exact (F_comp.convolutionExists_left (lsmul ℝ ℝ : ℝ →L[ℝ] ℝ →L[ℝ] ℝ) C B x).integrable
400400
· set z := (D / (1 + D)) • x with hz
401401
have B : 0 < 1 + D := by linarith

Mathlib/Analysis/Calculus/BumpFunction/InnerProduct.lean

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ noncomputable def ContDiffBumpBase.ofInnerProductSpace : ContDiffBumpBase E wher
3838
apply ContDiffAt.contDiffWithinAt
3939
rw [← sub_pos] at hR
4040
rcases eq_or_ne x 0 with rfl | hx
41-
· have A : ContinuousAt (fun p : ℝ × E ↦ (p.1 - ‖p.2‖) / (p.1 - 1)) (R, 0) :=
42-
(continuousAt_fst.sub continuousAt_snd.norm).div
43-
(continuousAt_fst.sub continuousAt_const) hR.ne'
41+
· have A : ContinuousAt (fun p : ℝ × E ↦ (p.1 - ‖p.2‖) / (p.1 - 1)) (R, 0) := by
42+
fun_prop (disch := positivity)
4443
have B : ∀ᶠ p in 𝓝 (R, (0 : E)), 1 ≤ (p.1 - ‖p.2‖) / (p.1 - 1) :=
4544
A.eventually <| le_mem_nhds <| (one_lt_div hR).2 <| sub_lt_sub_left (by simp) _
4645
refine (contDiffAt_const (c := 1)).congr_of_eventuallyEq <| B.mono fun _ ↦
4746
smoothTransition.one_of_one_le
48-
· refine smoothTransition.contDiffAt.comp _ (ContDiffAt.div ?_ ?_ hR.ne')
49-
· exact contDiffAt_fst.sub (contDiffAt_snd.norm ℝ hx)
50-
· exact contDiffAt_fst.sub contDiffAt_const
47+
· refine smoothTransition.contDiffAt.comp _ (ContDiffAt.div ?_ (by fun_prop) hR.ne')
48+
exact contDiffAt_fst.sub (contDiffAt_snd.norm ℝ hx)
5149
eq_one _ hR _ hx := smoothTransition.one_of_one_le <| (one_le_div <| sub_pos.2 hR).2 <|
5250
sub_le_sub_left hx _
5351
support R hR := by

Mathlib/Analysis/Calculus/MeanValue.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ theorem image_le_of_liminf_slope_right_le_deriv_boundary {f : ℝ → ℝ} {a b
151151
exact (lt_add_iff_pos_right _).2 hr
152152
exact hx
153153
intro x hx
154-
have : ContinuousWithinAt (fun r => B x + r * (x - a)) (Ioi 0) 0 :=
155-
continuousWithinAt_const.add (continuousWithinAt_id.mul continuousWithinAt_const)
154+
have : ContinuousWithinAt (fun r => B x + r * (x - a)) (Ioi 0) 0 := by fun_prop
156155
convert continuousWithinAt_const.closure_le _ this (Hr x hx) using 1 <;> simp
157156

158157
/-- General fencing theorem for continuous functions with an estimate on the derivative.

Mathlib/Analysis/Calculus/Rademacher.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ theorem integral_inv_smul_sub_mul_tendsto_integral_lineDeriv_mul'
162162
simp only [B, A, _root_.sub_self, smul_eq_mul, mul_zero, zero_mul, norm_zero]
163163
exact indicator_nonneg (fun y _hy ↦ by positivity) _
164164
· rw [integrable_indicator_iff K_compact.measurableSet]
165-
apply ContinuousOn.integrableOn_compact K_compact
166-
exact (Continuous.mul continuous_const hg.norm).continuousOn
165+
exact ContinuousOn.integrableOn_compact K_compact (by fun_prop)
167166
· filter_upwards [hf.ae_lineDifferentiableAt v] with x hx
168167
exact hx.hasLineDerivAt.tendsto_slope_zero_right.mul tendsto_const_nhds
169168

Mathlib/Analysis/Complex/CauchyIntegral.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,7 @@ theorem two_pi_I_inv_smul_circleIntegral_sub_inv_smul_of_differentiable_on_off_c
515515
refine mem_closure_iff_nhds.2 fun t ht => ?_
516516
-- TODO: generalize to any vector space over `ℝ`
517517
set g : ℝ → ℂ := fun x => w + ofReal x
518-
have : Tendsto g (𝓝 0) (𝓝 w) :=
519-
(continuous_const.add continuous_ofReal).tendsto' 0 w (add_zero _)
518+
have : Tendsto g (𝓝 0) (𝓝 w) := Continuous.tendsto' (by fun_prop) 0 w (add_zero _)
520519
rcases mem_nhds_iff_exists_Ioo_subset.1 (this <| inter_mem ht <| isOpen_ball.mem_nhds hw) with
521520
⟨l, u, hlu₀, hlu_sub⟩
522521
obtain ⟨x, hx⟩ : (Ioo l u \ g ⁻¹' s).Nonempty := by

Mathlib/Analysis/Complex/OpenMapping.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ theorem AnalyticAt.eventually_constant_or_nhds_le_map_nhds {z₀ : E} (hg : Anal
154154
have h7 := h1.eventually_constant_or_nhds_le_map_nhds_aux.resolve_left hrz
155155
rw [show gray z 0 = g z₀ by simp [gray, ray], ← map_compose] at h7
156156
refine h7.trans (map_mono ?_)
157-
have h10 : Continuous fun t : ℂ => z₀ + t • z :=
158-
continuous_const.add (continuous_id'.smul continuous_const)
157+
have h10 : Continuous fun t : ℂ => z₀ + t • z := by fun_prop
159158
simpa using h10.tendsto 0
160159

161160
/-- The *open mapping theorem* for holomorphic functions, global version: if a function `g : E → ℂ`

Mathlib/Analysis/Complex/PhragmenLindelof.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,7 @@ theorem right_half_plane_of_bounded_on_real (hd : DiffContOnCl ℂ f {z | 0 < z.
722722
-- Taking the limit as `ε → 0`, we obtain the required inequality.
723723
suffices ∀ᶠ ε : ℝ in 𝓝[<] 0, ‖exp (ε * z) • f z‖ ≤ C by
724724
refine le_of_tendsto (Tendsto.mono_left ?_ nhdsWithin_le_nhds) this
725-
apply ((continuous_ofReal.mul continuous_const).cexp.smul continuous_const).norm.tendsto'
726-
simp
725+
exact Continuous.tendsto' (by fun_prop) _ _ (by simp)
727726
filter_upwards [self_mem_nhdsWithin] with ε ε₀; change ε < 0 at ε₀
728727
set g : ℂ → E := fun z => exp (ε * z) • f z; change ‖g z‖ ≤ C
729728
replace hd : DiffContOnCl ℂ g {z : ℂ | 0 < z.re} :=

0 commit comments

Comments
 (0)