Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - perf(FunLike.Basic): beta reduce CoeFun.coe #7905

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Archive/Sensitivity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ theorem huang_degree_theorem (H : Set (Q m.succ)) (hH : Card H ≥ 2 ^ m + 1) :
|(coeffs y).sum fun (i : Q m.succ) (a : ℝ) =>
a • (ε q ∘ f m.succ ∘ fun i : Q m.succ => e i) i| := by
erw [(f m.succ).map_finsupp_total, (ε q).map_finsupp_total, Finsupp.total_apply]
rfl
_ ≤ ∑ p in (coeffs y).support, |coeffs y p * (ε q <| f m.succ <| e p)| :=
(norm_sum_le _ fun p => coeffs y p * _)
_ = ∑ p in (coeffs y).support, |coeffs y p| * ite (p ∈ q.adjacent) 1 0 := by
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Algebra/RestrictScalars.lean
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ theorem RestrictScalars.ringEquiv_map_smul (r : R) (x : RestrictScalars R S A) :
instance RestrictScalars.algebra : Algebra R (RestrictScalars R S A) :=
{ (algebraMap S A).comp (algebraMap R S) with
smul := (· • ·)
commutes' := fun _ _ ↦ Algebra.commutes' _ _
smul_def' := fun _ _ ↦ Algebra.smul_def' _ _ }
commutes' := fun _ _ ↦ Algebra.commutes' (A := A) _ _
smul_def' := fun _ _ ↦ Algebra.smul_def' (A := A) _ _ }

@[simp]
theorem RestrictScalars.ringEquiv_algebraMap (r : R) :
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ instance mulAction : MulAction S <| (restrictScalars f).obj ⟨S⟩ →ₗ[R] M

instance distribMulAction : DistribMulAction S <| (restrictScalars f).obj ⟨S⟩ →ₗ[R] M :=
{ CoextendScalars.mulAction f _ with
smul_add := fun s g h => LinearMap.ext fun t : S => by simp
smul_zero := fun s => LinearMap.ext fun t : S => by simp }
smul_add := fun s g h => LinearMap.ext fun _ : S => by simp
smul_zero := fun s => LinearMap.ext fun _ : S => by simp }
#align category_theory.Module.coextend_scalars.distrib_mul_action ModuleCat.CoextendScalars.distribMulAction

/-- `S` acts on Hom(S, M) by `s • g = x ↦ g (x • s)`, this action defines an `S`-module structure on
Expand Down Expand Up @@ -586,8 +586,7 @@ def HomEquiv.toRestrictScalars {X Y} (g : (extendScalars f).obj X ⟶ Y) :
letI : Module R S := Module.compHom S f
letI : Module R Y := Module.compHom Y f
dsimp
rw [RestrictScalars.smul_def, ← LinearMap.map_smul]
erw [tmul_smul]
erw [RestrictScalars.smul_def, ← LinearMap.map_smul, tmul_smul]
congr
#align category_theory.Module.extend_restrict_scalars_adj.hom_equiv.to_restrict_scalars ModuleCat.ExtendRestrictScalarsAdj.HomEquiv.toRestrictScalars

Expand Down Expand Up @@ -658,6 +657,7 @@ def homEquiv {X Y} :
change S at x
dsimp
erw [← LinearMap.map_smul, ExtendScalars.smul_tmul, mul_one x]
rfl
· rw [map_add, map_add, ih1, ih2]
right_inv g := by
letI m1 : Module R S := Module.compHom S f; letI m2 : Module R Y := Module.compHom Y f
Expand Down
5 changes: 1 addition & 4 deletions Mathlib/Algebra/DirectLimit.lean
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ theorem of.zero_exact_aux2 {x : FreeCommRing (Σi, G i)} {s t} (hxs : IsSupporte
dsimp only
-- porting note: Lean 3 could get away with far fewer hints for inputs in the line below
have := DirectedSystem.map_map (fun i j h => f' i j h) (hj p hps) hjk
dsimp only at this
rw [this]
· rintro x y ihx ihy
rw [(restriction _).map_add, (FreeCommRing.lift _).map_add, (f' j k hjk).map_add, ihx, ihy,
Expand Down Expand Up @@ -529,7 +528,6 @@ theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : FreeCom
restriction_of, dif_pos, lift_of, lift_of]
dsimp only
have := DirectedSystem.map_map (fun i j h => f' i j h) hij (le_refl j : j ≤ j)
dsimp only at this
rw [this]
exact sub_self _
exacts [Or.inr rfl, Or.inl rfl]
Expand All @@ -539,8 +537,7 @@ theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : FreeCom
-- porting note: the Lean3 proof contained `rw [restriction_of]`, but this
-- lemma does not seem to work here
· rw [RingHom.map_sub, RingHom.map_sub]
erw [lift_of, dif_pos rfl, RingHom.map_one, RingHom.map_one, lift_of,
RingHom.map_one, sub_self]
erw [lift_of, dif_pos rfl, RingHom.map_one, lift_of, RingHom.map_one, sub_self]
· refine'
⟨i, {⟨i, x + y⟩, ⟨i, x⟩, ⟨i, y⟩}, _,
isSupported_sub (isSupported_of.2 <| Or.inl rfl)
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Group/Hom/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ theorem map_pow [Monoid G] [Monoid H] [MonoidHomClass F G H] (f : F) (a : G) :
theorem map_zpow' [DivInvMonoid G] [DivInvMonoid H] [MonoidHomClass F G H]
(f : F) (hf : ∀ x : G, f x⁻¹ = (f x)⁻¹) (a : G) : ∀ n : ℤ, f (a ^ n) = f a ^ n
| (n : ℕ) => by rw [zpow_ofNat, map_pow, zpow_ofNat]
| Int.negSucc n => by rw [zpow_negSucc, hf, map_pow, ← zpow_negSucc, ← zpow_negSucc]
| Int.negSucc n => by rw [zpow_negSucc, hf, map_pow, ← zpow_negSucc]
#align map_zpow' map_zpow'
#align map_zsmul' map_zsmul'

Expand Down
3 changes: 1 addition & 2 deletions Mathlib/Algebra/Homology/ModuleCat.lean
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ example (f g : C ⟶ D) (h : Homotopy f g) (i : ι) :
erw [LinearMap.add_apply]
rw [LinearMap.add_apply, prevD_eq_toPrev_dTo, dNext_eq_dFrom_fromNext]
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [comp_apply, comp_apply, comp_apply]
erw [comp_apply, comp_apply]
erw [x.2, map_zero]
dsimp
abel

end ModuleCat
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Module/Torsion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ variable (R M)

theorem torsion_gc :
@GaloisConnection (Submodule R M) (Ideal R)ᵒᵈ _ _ annihilator fun I =>
torsionBySet R M <| OrderDual.ofDual I :=
torsionBySet R M ↑(OrderDual.ofDual I) :=
fun _ _ =>
⟨fun h x hx => (mem_torsionBySet_iff _ _).mpr fun ⟨_, ha⟩ => mem_annihilator.mp (h ha) x hx,
fun h a ha => mem_annihilator.mpr fun _ hx => (mem_torsionBySet_iff _ _).mp (h hx) ⟨a, ha⟩⟩
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Order/Monoid/ToMulBot.lean
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ theorem toMulBot_zero : toMulBot (0 : WithZero (Multiplicative α)) = Multiplica

@[simp]
theorem toMulBot_coe (x : Multiplicative α) :
toMulBot ↑x = Multiplicative.ofAdd (Multiplicative.toAdd x : WithBot α) :=
toMulBot ↑x = Multiplicative.ofAdd (↑(Multiplicative.toAdd x) : WithBot α) :=
rfl
#align with_zero.to_mul_bot_coe WithZero.toMulBot_coe

Expand Down
5 changes: 3 additions & 2 deletions Mathlib/Algebra/Polynomial/BigOperators.lean
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,10 @@ theorem multiset_prod_X_sub_C_coeff_card_pred (t : Multiset R) (ht : 0 < Multise
nontriviality R
convert multiset_prod_X_sub_C_nextCoeff (by assumption)
rw [nextCoeff]; split_ifs with h
· rw [natDegree_multiset_prod_of_monic] at h <;> simp only [Multiset.mem_map] at *
· rw [natDegree_multiset_prod_of_monic] at h
swap
· rintro _ ⟨_, _, rfl⟩
· simp only [Multiset.mem_map]
rintro _ ⟨_, _, rfl⟩
apply monic_X_sub_C
simp_rw [Multiset.sum_eq_zero_iff, Multiset.mem_map] at h
contrapose! h
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Quaternion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ theorem im_sq : a.im ^ 2 = -normSq a.im := by
simp_rw [sq, ← star_mul_self, im_star, neg_mul, neg_neg]
#align quaternion.im_sq Quaternion.im_sq

theorem coe_normSq_add : (normSq (a + b) : ℍ[R]) = normSq a + a * star b + b * star a + normSq b :=
theorem coe_normSq_add : normSq (a + b) = normSq a + a * star b + b * star a + normSq b :=
by simp only [star_add, ← self_mul_star, mul_add, add_mul, add_assoc, add_left_comm]
#align quaternion.coe_norm_sq_add Quaternion.coe_normSq_add

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Ring/BooleanRing.lean
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ theorem toBoolAlg_add_add_mul (a b : α) : toBoolAlg (a + b + a * b) = toBoolAlg

@[simp]
theorem toBoolAlg_add (a b : α) : toBoolAlg (a + b) = toBoolAlg a ∆ toBoolAlg b :=
(ofBoolAlg_symmDiff _ _).symm
(ofBoolAlg_symmDiff a b).symm
#align to_boolalg_add toBoolAlg_add

/-- Turn a ring homomorphism from Boolean rings `α` to `β` into a bounded lattice homomorphism
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ def identityToΓSpec : 𝟭 LocallyRingedSpace.{u} ⟶ Γ.rightOp ⋙ Spec.toLoc
-- The next six lines were `rw [ContinuousMap.coe_mk, ContinuousMap.coe_mk]` before
-- leanprover/lean4#2644
have : (ContinuousMap.mk (toΓSpecFun Y) (toΓSpec_continuous _)) (f.val.base x)
= toΓSpecFun Y (f.val.base x) := by erw [ContinuousMap.coe_mk]; rfl
= toΓSpecFun Y (f.val.base x) := by rw [ContinuousMap.coe_mk]
erw [this]
have : (ContinuousMap.mk (toΓSpecFun X) (toΓSpec_continuous _)) x
= toΓSpecFun X x := by erw [ContinuousMap.coe_mk]
= toΓSpecFun X x := by rw [ContinuousMap.coe_mk]
erw [this]
dsimp [toΓSpecFun]
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/AlgebraicGeometry/PrimeSpectrum/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ theorem vanishingIdeal_strict_anti_mono_iff {s t : Set (PrimeSpectrum R)} (hs :
/-- The antitone order embedding of closed subsets of `Spec R` into ideals of `R`. -/
def closedsEmbedding (R : Type*) [CommRing R] :
(TopologicalSpace.Closeds <| PrimeSpectrum R)ᵒᵈ ↪o Ideal R :=
OrderEmbedding.ofMapLEIff (fun s => vanishingIdeal <| OrderDual.ofDual s) fun s _ =>
OrderEmbedding.ofMapLEIff (fun s => vanishingIdeal ↑(OrderDual.ofDual s)) fun s _ =>
(vanishingIdeal_anti_mono_iff s.2).symm
#align prime_spectrum.closeds_embedding PrimeSpectrum.closedsEmbedding

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/AlgebraicGeometry/Scheme.lean
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ lemma basicOpen_restrict (i : V ⟶ U) (f : X.presheaf.obj (op U)) :
theorem preimage_basicOpen {X Y : Scheme} (f : X ⟶ Y) {U : Opens Y.carrier}
(r : Y.presheaf.obj <| op U) :
(Opens.map f.1.base).obj (Y.basicOpen r) =
@Scheme.basicOpen X ((Opens.map f.1.base).obj U) (f.1.c.app _ r) :=
@Scheme.basicOpen X ((Opens.map f.1.base).obj U) (f.1.c.app (op U) r) :=
LocallyRingedSpace.preimage_basicOpen f r
#align algebraic_geometry.Scheme.preimage_basic_open AlgebraicGeometry.Scheme.preimage_basicOpen

Expand Down
4 changes: 2 additions & 2 deletions Mathlib/AlgebraicGeometry/Spec.lean
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def Spec.locallyRingedSpaceMap {R S : CommRingCat} (f : R ⟶ S) :
replace ha := (stalkIso S p).hom.isUnit_map ha
rw [← comp_apply, show localizationToStalk S p = (stalkIso S p).inv from rfl,
Iso.inv_hom_id, id_apply] at ha
-- Porting note : `R` had to be made explicit
-- Porting note : `f` had to be made explicit
replace ha := IsLocalRingHom.map_nonunit
(R := Localization.AtPrime (PrimeSpectrum.comap f p).asIdeal) _ ha
(f := (Localization.localRingHom (PrimeSpectrum.comap f p).asIdeal p.asIdeal f _)) _ ha
convert RingHom.isUnit_map (stalkIso R (PrimeSpectrum.comap f p)).inv ha
erw [← comp_apply, show stalkToFiberRingHom R _ = (stalkIso _ _).hom from rfl,
Iso.hom_inv_id, id_apply]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/AlgebraicGeometry/StructureSheaf.lean
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def localizationToStalk (x : PrimeSpectrum.Top R) :
@[simp]
theorem localizationToStalk_of (x : PrimeSpectrum.Top R) (f : R) :
localizationToStalk R x (algebraMap _ (Localization _) f) = toStalk R x f :=
IsLocalization.lift_eq _ f
IsLocalization.lift_eq (S := Localization x.asIdeal.primeCompl) _ f
#align algebraic_geometry.structure_sheaf.localization_to_stalk_of AlgebraicGeometry.StructureSheaf.localizationToStalk_of

@[simp]
Expand Down
1 change: 0 additions & 1 deletion Mathlib/Analysis/Calculus/AffineMap.lean
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ variable [NormedAddCommGroup W] [NormedSpace 𝕜 W]
theorem contDiff {n : ℕ∞} (f : V →A[𝕜] W) : ContDiff 𝕜 n f := by
rw [f.decomp]
apply f.contLinear.contDiff.add
simp only
exact contDiff_const
#align continuous_affine_map.cont_diff ContinuousAffineMap.contDiff

Expand Down
1 change: 0 additions & 1 deletion Mathlib/Analysis/Convex/Between.lean
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ theorem Sbtw.affineCombination_of_mem_affineSpan_pair [NoZeroDivisors R] [NoZero
rw [hr i his, sbtw_mul_sub_add_iff] at hs
change ∀ i ∈ s, w i = (r • (w₂ - w₁) + w₁) i at hr
rw [s.affineCombination_congr hr fun _ _ => rfl]
dsimp only
rw [← s.weightedVSub_vadd_affineCombination, s.weightedVSub_const_smul,
← s.affineCombination_vsub, ← lineMap_apply, sbtw_lineMap_iff, and_iff_left hs.2,
← @vsub_ne_zero V, s.affineCombination_vsub]
Expand Down
1 change: 0 additions & 1 deletion Mathlib/Analysis/Fourier/AddCircle.lean
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ theorem fourierCoeffOn_of_hasDerivAt {a b : ℝ} (hab : a < b) {f f' : ℝ →
conv => pattern (occs := 1 2 3) fourier _ _ * _ <;> (rw [mul_comm])
rw [integral_mul_deriv_eq_deriv_mul hf (fun x _ => has_antideriv_at_fourier_neg hT hn x) hf'
(((map_continuous (fourier (-n))).comp (AddCircle.continuous_mk' _)).intervalIntegrable _ _)]
dsimp only
have : ∀ u v w : ℂ, u * ((b - a : ℝ) / v * w) = (b - a : ℝ) / v * (u * w) := by intros; ring
conv in intervalIntegral _ _ _ _ => congr; ext; rw [this]
rw [(by ring : ((b - a : ℝ) : ℂ) / (-2 * π * I * n) = ((b - a : ℝ) : ℂ) * (1 / (-2 * π * I * n)))]
Expand Down
4 changes: 1 addition & 3 deletions Mathlib/Analysis/Fourier/FourierTransform.lean
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ theorem fourierIntegral_comp_add_right [MeasurableAdd V] (e : Multiplicative
ext1 w
dsimp only [fourierIntegral, Function.comp_apply]
conv in L _ => rw [← add_sub_cancel v v₀]
rw [integral_add_right_eq_self fun v : V => e[-L (v - v₀) w] • f v]
dsimp only
rw [← integral_smul]
rw [integral_add_right_eq_self fun v : V => e[-L (v - v₀) w] • f v, ← integral_smul]
congr 1 with v
rw [← smul_assoc, smul_eq_mul, ← Submonoid.coe_mul, ← e.map_mul, ← ofAdd_add, ←
LinearMap.neg_apply, ← sub_eq_add_neg, ← LinearMap.sub_apply, LinearMap.map_sub, neg_sub]
Expand Down
1 change: 0 additions & 1 deletion Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ theorem arg_mem_Ioc (z : ℂ) : arg z ∈ Set.Ioc (-π) π := by
rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos (arg z) (-π) with ⟨N, hN, -⟩
rw [two_mul, neg_add_cancel_left, ← two_mul, zsmul_eq_mul] at hN
rw [← abs_mul_cos_add_sin_mul_I z, ← cos_add_int_mul_two_pi _ N, ← sin_add_int_mul_two_pi _ N]
simp only [← ofReal_one, ← ofReal_bit0, ← ofReal_mul, ← ofReal_add, ofReal_int_cast]
have := arg_mul_cos_add_sin_mul_I (abs.pos hz) hN
push_cast at this
rwa [this]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/CategoryTheory/Limits/Opposites.lean
Original file line number Diff line number Diff line change
Expand Up @@ -790,14 +790,14 @@ noncomputable def pullbackIsoUnopPushout {X Y Z : C} (f : X ⟶ Z) (g : Y ⟶ Z)
theorem pullbackIsoUnopPushout_inv_fst {X Y Z : C} (f : X ⟶ Z) (g : Y ⟶ Z) [HasPullback f g]
[HasPushout f.op g.op] :
(pullbackIsoUnopPushout f g).inv ≫ pullback.fst = (pushout.inl : _ ⟶ pushout f.op g.op).unop :=
(IsLimit.conePointUniqueUpToIso_inv_comp _ _ _).trans (by simp)
(IsLimit.conePointUniqueUpToIso_inv_comp _ _ _).trans (by simp [unop_id (X := { unop := X })])
#align category_theory.limits.pullback_iso_unop_pushout_inv_fst CategoryTheory.Limits.pullbackIsoUnopPushout_inv_fst

@[reassoc (attr := simp)]
theorem pullbackIsoUnopPushout_inv_snd {X Y Z : C} (f : X ⟶ Z) (g : Y ⟶ Z) [HasPullback f g]
[HasPushout f.op g.op] :
(pullbackIsoUnopPushout f g).inv ≫ pullback.snd = (pushout.inr : _ ⟶ pushout f.op g.op).unop :=
(IsLimit.conePointUniqueUpToIso_inv_comp _ _ _).trans (by simp)
(IsLimit.conePointUniqueUpToIso_inv_comp _ _ _).trans (by simp [unop_id (X := { unop := Y })])
#align category_theory.limits.pullback_iso_unop_pushout_inv_snd CategoryTheory.Limits.pullbackIsoUnopPushout_inv_snd

@[reassoc (attr := simp)]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/CategoryTheory/SingleObj.lean
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ set_option linter.uppercaseLean3 false in
#align Mon.to_Cat_full MonCat.toCatFull

instance toCat_faithful : Faithful toCat where
map_injective h := by simpa [toCat] using h
map_injective h := by rwa [toCat, (SingleObj.mapHom _ _).apply_eq_iff_eq] at h
set_option linter.uppercaseLean3 false in
#align Mon.to_Cat_faithful MonCat.toCat_faithful

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Finset/Image.lean
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ variable {f : α ↪ β} {s : Finset α}

@[simp]
theorem mem_map {b : β} : b ∈ s.map f ↔ ∃ a ∈ s, f a = b :=
mem_map.trans <| by simp only [exists_prop]; rfl
Multiset.mem_map
#align finset.mem_map Finset.mem_map

--Porting note: Higher priority to apply before `mem_map`.
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Finsupp/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ section

variable [Zero M] [MonoidWithZero R] [MulActionWithZero R M]

@[simp]
@[simp, nolint simpNF] -- `simpNF` incorrectly complains the LHS doesn't simplify.
theorem single_smul (a b : α) (f : α → M) (r : R) : single a r b • f a = single a (r • f b) b := by
by_cases h : a = b <;> simp [h]
#align finsupp.single_smul Finsupp.single_smul
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Finsupp/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ theorem mapRange_apply {f : M → N} {hf : f 0 = 0} {g : α →₀ M} {a : α} :

@[simp]
theorem mapRange_zero {f : M → N} {hf : f 0 = 0} : mapRange f hf (0 : α →₀ M) = 0 :=
ext fun a => by simp only [hf, zero_apply, mapRange_apply]
ext fun _ => by simp only [hf, zero_apply, mapRange_apply]
#align finsupp.map_range_zero Finsupp.mapRange_zero

@[simp]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Finsupp/Pointwise.lean
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ instance pointwiseScalar [Semiring β] : SMul (α → β) (α →₀ β) where
#align finsupp.pointwise_scalar Finsupp.pointwiseScalar

@[simp]
theorem coe_pointwise_smul [Semiring β] (f : α → β) (g : α →₀ β) : FunLike.coe (f • g) = f • g :=
theorem coe_pointwise_smul [Semiring β] (f : α → β) (g : α →₀ β) : (f • g) = f • g :=
rfl
#align finsupp.coe_pointwise_smul Finsupp.coe_pointwise_smul

Expand Down
3 changes: 2 additions & 1 deletion Mathlib/Data/FunLike/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ namespace FunLike

variable {F α β} [i : FunLike F α β]

instance (priority := 100) hasCoeToFun : CoeFun F fun _ ↦ ∀ a : α, β a where coe := FunLike.coe
instance (priority := 100) hasCoeToFun : CoeFun F (fun _ ↦ ∀ a : α, β a) where
coe := @FunLike.coe _ _ β _ -- need to make explicit to beta reduce for non-dependent functions

#eval Lean.Elab.Command.liftTermElabM do
Std.Tactic.Coe.registerCoercion ``FunLike.coe
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Data/IsROrC/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,11 @@ noncomputable instance Real.isROrC : IsROrC ℝ where
mul_re_ax z w := by simp only [sub_zero, mul_zero, AddMonoidHom.zero_apply, AddMonoidHom.id_apply]
mul_im_ax z w := by simp only [add_zero, zero_mul, mul_zero, AddMonoidHom.zero_apply]
conj_re_ax z := by simp only [starRingEnd_apply, star_id_of_comm]
conj_im_ax z := by simp only [neg_zero, AddMonoidHom.zero_apply]
conj_im_ax _ := by simp only [neg_zero, AddMonoidHom.zero_apply]
conj_I_ax := by simp only [RingHom.map_zero, neg_zero]
norm_sq_eq_def_ax z := by simp only [sq, Real.norm_eq_abs, ← abs_mul, abs_mul_self z, add_zero,
mul_zero, AddMonoidHom.zero_apply, AddMonoidHom.id_apply]
mul_im_I_ax z := by simp only [mul_zero, AddMonoidHom.zero_apply]
mul_im_I_ax _ := by simp only [mul_zero, AddMonoidHom.zero_apply]
le_iff_re_im := (and_iff_left rfl).symm
#align real.is_R_or_C Real.isROrC

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/MvPolynomial/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ theorem eval₂_mem {f : R →+* S} {p : MvPolynomial σ R} {s : subS}
· subst h
rw [MvPolynomial.not_mem_support_iff.1 ha, map_zero]
exact zero_mem _
· rwa [if_neg h, zero_add] at this
· rwa [zero_add] at this
#align mv_polynomial.eval₂_mem MvPolynomial.eval₂_mem

theorem eval_mem {p : MvPolynomial σ S} {s : subS} (hs : ∀ i ∈ p.support, p.coeff i ∈ s) {v : σ → S}
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Nat/Factorization/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ theorem factorization_prime_le_iff_dvd {d n : ℕ} (hd : d ≠ 0) (hn : n ≠ 0)
(∀ p : ℕ, p.Prime → d.factorization p ≤ n.factorization p) ↔ d ∣ n := by
rw [← factorization_le_iff_dvd hd hn]
refine' ⟨fun h p => (em p.Prime).elim (h p) fun hp => _, fun h p _ => h p⟩
simp_rw [factorization_eq_zero_of_non_prime _ hp, le_refl]
simp_rw [factorization_eq_zero_of_non_prime _ hp]
#align nat.factorization_prime_le_iff_dvd Nat.factorization_prime_le_iff_dvd

theorem pow_succ_factorization_not_dvd {n p : ℕ} (hn : n ≠ 0) (hp : p.Prime) :
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Polynomial/RingDivision.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ theorem card_roots_le_map [IsDomain A] [IsDomain B] {p : A[X]} {f : A →+* B} (
theorem card_roots_le_map_of_injective [IsDomain A] [IsDomain B] {p : A[X]} {f : A →+* B}
(hf : Function.Injective f) : Multiset.card p.roots ≤ Multiset.card (p.map f).roots := by
by_cases hp0 : p = 0
· simp only [hp0, roots_zero, Polynomial.map_zero, Multiset.card_zero]; rfl
· simp only [hp0, roots_zero, Polynomial.map_zero, Multiset.card_zero]
exact card_roots_le_map ((Polynomial.map_ne_zero_iff hf).mpr hp0)
#align polynomial.card_roots_le_map_of_injective Polynomial.card_roots_le_map_of_injective

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/ZMod/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def chineseRemainder {m n : ℕ} (h : m.Coprime n) : ZMod (m * n) ≃+* ZMod m
let to_fun : ZMod (m * n) → ZMod m × ZMod n :=
ZMod.castHom (show m.lcm n ∣ m * n by simp [Nat.lcm_dvd_iff]) (ZMod m × ZMod n)
let inv_fun : ZMod m × ZMod n → ZMod (m * n) := fun x =>
if m * n = 0 then if m = 1 then RingHom.snd _ _ x else RingHom.fst _ _ x
if m * n = 0 then if m = 1 then RingHom.snd _ (ZMod n) x else RingHom.fst (ZMod m) _ x
else Nat.chineseRemainder h x.1.val x.2.val
have inv : Function.LeftInverse inv_fun to_fun ∧ Function.RightInverse inv_fun to_fun :=
if hmn0 : m * n = 0 then by
Expand Down
Loading