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] - chore: Rename coe_nat/coe_int/coe_rat to natCast/intCast/ratCast #11499

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c6c391c
chore: Rename `coe_nat`/`coe_int`/`coe_rat` to `natCast`/`intCast`/`…
YaelDillies Mar 20, 2024
573bc54
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Mar 20, 2024
2b644df
fix
YaelDillies Mar 20, 2024
cae3910
fix
YaelDillies Mar 20, 2024
1c1d7bb
fix
YaelDillies Mar 20, 2024
f8b923f
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Mar 21, 2024
a9c4076
deprecated aliases
YaelDillies Mar 21, 2024
93973c4
Eric's suggestions
YaelDillies Mar 21, 2024
37a8c94
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Mar 23, 2024
70abfc6
more
YaelDillies Mar 23, 2024
6db21b8
long lines
YaelDillies Mar 23, 2024
f61ffaf
long line
YaelDillies Mar 23, 2024
479034f
fix Data.Int.Defs
YaelDillies Mar 24, 2024
3de45fe
fix
YaelDillies Mar 24, 2024
e3dc637
fix Data.Int.GCD
YaelDillies Mar 24, 2024
6de98b7
fix
YaelDillies Mar 24, 2024
d617562
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Mar 28, 2024
6e8e1b8
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Mar 31, 2024
fdf9921
fix archive
YaelDillies Mar 31, 2024
41ddd05
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 2, 2024
032f6cd
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 2, 2024
ac9cb97
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 3, 2024
a9b8d5c
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 5, 2024
babff89
deprecated aliases
YaelDillies Apr 5, 2024
ea6f534
fix Data.Int.Cast.Lemmas
YaelDillies Apr 5, 2024
af95c0b
fix Data.Rat.Lemmas
YaelDillies Apr 5, 2024
78e4461
fix NumberTheory.Zsqrtd.Basic
YaelDillies Apr 5, 2024
f3443a6
fix NumberTheory.PellMatiyasevic
YaelDillies Apr 5, 2024
e8dfec1
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 6, 2024
bdbf757
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 7, 2024
163c391
Merge remote-tracking branch 'origin/master' into nat_cast_mem
YaelDillies Apr 7, 2024
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
2 changes: 1 addition & 1 deletion Archive/Imo/Imo2019Q4.lean
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ theorem upper_bound {k n : ℕ} (hk : k > 0)
have h2 : ∑ i in range n, i < k := by
suffices multiplicity 2 (k ! : ℤ) = ↑(∑ i in range n, i : ℕ) by
rw [← PartENat.coe_lt_coe, ← this]; change multiplicity ((2 : ℕ) : ℤ) _ < _
simp_rw [Int.coe_nat_multiplicity, multiplicity_two_factorial_lt hk.lt.ne.symm]
simp_rw [Int.natCast_multiplicity, multiplicity_two_factorial_lt hk.lt.ne.symm]
rw [h, multiplicity.Finset.prod Int.prime_two, Nat.cast_sum]
apply sum_congr rfl; intro i hi
rw [multiplicity_sub_of_gt, multiplicity_pow_self_of_prime Int.prime_two]
Expand Down
6 changes: 3 additions & 3 deletions Archive/Wiedijk100Theorems/BallotProblem.lean
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ theorem ballot_problem :
rw [ballot_problem' q p qp]
rw [ENNReal.toReal_div, ← Nat.cast_add, ← Nat.cast_add, ENNReal.toReal_nat,
ENNReal.toReal_sub_of_le, ENNReal.toReal_nat, ENNReal.toReal_nat]
exacts [Nat.cast_le.2 qp.le, ENNReal.nat_ne_top _]
exacts [Nat.cast_le.2 qp.le, ENNReal.natCast_ne_top _]
rwa [ENNReal.toReal_eq_toReal (measure_lt_top _ _).ne] at this
· simp only [Ne, ENNReal.div_eq_top, tsub_eq_zero_iff_le, Nat.cast_le, not_le,
add_eq_zero_iff, Nat.cast_eq_zero, ENNReal.add_eq_top, ENNReal.nat_ne_top, or_self_iff,
add_eq_zero_iff, Nat.cast_eq_zero, ENNReal.add_eq_top, ENNReal.natCast_ne_top, or_self_iff,
not_false_iff, and_true_iff]
push_neg
exact ⟨fun _ _ => by linarith, (lt_of_le_of_lt tsub_le_self (ENNReal.nat_ne_top p).lt_top).ne⟩
exact ⟨fun _ _ => by linarith, (tsub_le_self.trans_lt (ENNReal.natCast_ne_top p).lt_top).ne⟩
#align ballot.ballot_problem Ballot.ballot_problem

end Ballot
6 changes: 3 additions & 3 deletions Counterexamples/SorgenfreyLine.lean
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ instance : T5Space ℝₗ := by
_ ≤ x := (not_lt.1 fun hxy => (hYd y hy).le_bot ⟨⟨hle, hxy⟩, subset_closure hx⟩)
_ ≤ max x y := le_max_left _ _

theorem denseRange_coe_rat : DenseRange ((↑) : ℚ → ℝₗ) := by
theorem denseRange_ratCast : DenseRange ((↑) : ℚ → ℝₗ) := by
refine' dense_iff_inter_open.2 _
rintro U Uo ⟨x, hx⟩
rcases isOpen_iff.1 Uo _ hx with ⟨y, hxy, hU⟩
rcases exists_rat_btwn hxy with ⟨z, hxz, hzy⟩
exact ⟨z, hU ⟨hxz.le, hzy⟩, mem_range_self _⟩
#align counterexample.sorgenfrey_line.dense_range_coe_rat Counterexample.SorgenfreyLine.denseRange_coe_rat
#align counterexample.sorgenfrey_line.dense_range_coe_rat Counterexample.SorgenfreyLine.denseRange_ratCast

instance : SeparableSpace ℝₗ :=
⟨⟨_, countable_range _, denseRange_coe_rat⟩⟩
⟨⟨_, countable_range _, denseRange_ratCast⟩⟩

theorem isClosed_antidiagonal (c : ℝₗ) : IsClosed {x : ℝₗ × ℝₗ | x.1 + x.2 = c} :=
isClosed_singleton.preimage continuous_add
Expand Down
18 changes: 11 additions & 7 deletions Mathlib/Algebra/Algebra/Subalgebra/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ protected theorem nsmul_mem {x : A} (hx : x ∈ S) (n : ℕ) : n • x ∈ S :=
nsmul_mem hx n
#align subalgebra.nsmul_mem Subalgebra.nsmul_mem

protected theorem coe_nat_mem (n : ℕ) : (n : A) ∈ S :=
coe_nat_mem S n
#align subalgebra.coe_nat_mem Subalgebra.coe_nat_mem
protected theorem natCast_mem (n : ℕ) : (n : A) ∈ S :=
natCast_mem S n
#align subalgebra.coe_nat_mem Subalgebra.natCast_mem

protected theorem list_prod_mem {L : List A} (h : ∀ x ∈ L, x ∈ S) : L.prod ∈ S :=
list_prod_mem h
Expand Down Expand Up @@ -202,10 +202,14 @@ protected theorem zsmul_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Alg
zsmul_mem hx n
#align subalgebra.zsmul_mem Subalgebra.zsmul_mem

protected theorem coe_int_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
protected theorem intCast_mem {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
(S : Subalgebra R A) (n : ℤ) : (n : A) ∈ S :=
coe_int_mem S n
#align subalgebra.coe_int_mem Subalgebra.coe_int_mem
intCast_mem S n
#align subalgebra.coe_int_mem Subalgebra.intCast_mem

-- 2024-04-05
@[deprecated natCast_mem] alias coe_nat_mem := Subalgebra.natCast_mem
@[deprecated intCast_mem] alias coe_int_mem := Subalgebra.intCast_mem

/-- The projection from a subalgebra of `A` to an additive submonoid of `A`. -/
def toAddSubmonoid {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]
Expand Down Expand Up @@ -1431,7 +1435,7 @@ variable {R : Type*} [Semiring R]

/-- A subsemiring is an `ℕ`-subalgebra. -/
def subalgebraOfSubsemiring (S : Subsemiring R) : Subalgebra ℕ R :=
{ S with algebraMap_mem' := fun i => coe_nat_mem S i }
{ S with algebraMap_mem' := fun i => natCast_mem S i }
#align subalgebra_of_subsemiring subalgebraOfSubsemiring

@[simp]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/CharZero/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace WithTop
instance {R : Type*} [AddMonoidWithOne R] [CharZero R] :
CharZero (WithTop R) where
cast_injective m n h := by
rwa [← coe_nat, ← coe_nat n, coe_eq_coe, Nat.cast_inj] at h
rwa [← coe_natCast, ← coe_natCast n, coe_eq_coe, Nat.cast_inj] at h

end WithTop

Expand All @@ -198,7 +198,7 @@ namespace WithBot
instance {R : Type*} [AddMonoidWithOne R] [CharZero R] :
CharZero (WithBot R) where
cast_injective m n h := by
rwa [← coe_nat, ← coe_nat n, coe_eq_coe, Nat.cast_inj] at h
rwa [← coe_natCast, ← coe_natCast n, coe_eq_coe, Nat.cast_inj] at h

end WithBot

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Module/CharacterModule.lean
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ lemma eq_zero_of_ofSpanSingleton_apply_self (a : A)
AddCircle.coe_eq_zero_iff] at h
rcases h with ⟨n, hn⟩
apply_fun Rat.den at hn
rw [zsmul_one, Rat.coe_int_den, Rat.inv_coe_nat_den_of_pos] at hn
rw [zsmul_one, Rat.coe_int_den, Rat.inv_natCast_den_of_pos] at hn
· split_ifs at hn
· cases hn
· rwa [eq_comm, AddMonoid.addOrderOf_eq_one_iff] at hn
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Module/Torsion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ theorem isTorsion_iff_isTorsion_int [AddCommGroup M] :
refine' ⟨fun h x => _, fun h x => _⟩
· obtain ⟨n, h0, hn⟩ := (h x).exists_nsmul_eq_zero
exact
⟨⟨n, mem_nonZeroDivisors_of_ne_zero <| ne_of_gt <| Int.coe_nat_pos.mpr h0⟩,
⟨⟨n, mem_nonZeroDivisors_of_ne_zero <| ne_of_gt <| Int.natCast_pos.mpr h0⟩,
(natCast_zsmul _ _).trans hn⟩
· rw [isOfFinAddOrder_iff_nsmul_eq_zero]
obtain ⟨n, hn⟩ := @h x
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Order/Module/OrderedSMul.lean
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ instance Nat.orderedSMul [LinearOrderedCancelAddCommMonoid M] : OrderedSMul ℕ
instance Int.orderedSMul [LinearOrderedAddCommGroup M] : OrderedSMul ℤ M :=
OrderedSMul.mk'' fun n hn => by
cases n
· simp only [Int.ofNat_eq_coe, Int.coe_nat_pos, natCast_zsmul] at hn ⊢
· simp only [Int.ofNat_eq_coe, Int.natCast_pos, natCast_zsmul] at hn ⊢
exact strictMono_smul_left_of_pos hn
· cases (Int.negSucc_not_pos _).1 hn
#align int.ordered_smul Int.orderedSMul
Expand Down
34 changes: 22 additions & 12 deletions Mathlib/Algebra/Order/Monoid/WithTop.lean
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,19 @@ instance addMonoidWithOne : AddMonoidWithOne (WithTop α) :=
simp only -- Porting note: Had to add this...?
rw [Nat.cast_add_one, WithTop.coe_add, WithTop.coe_one] }

@[simp, norm_cast] lemma coe_nat (n : ℕ) : ((n : α) : WithTop α) = n := rfl
#align with_top.coe_nat WithTop.coe_nat
@[simp, norm_cast] lemma coe_natCast (n : ℕ) : ((n : α) : WithTop α) = n := rfl
#align with_top.coe_nat WithTop.coe_natCast

@[simp] lemma nat_ne_top (n : ℕ) : (n : WithTop α) ≠ ⊤ := coe_ne_top
#align with_top.nat_ne_top WithTop.nat_ne_top
@[simp] lemma natCast_ne_top (n : ℕ) : (n : WithTop α) ≠ ⊤ := coe_ne_top
#align with_top.nat_ne_top WithTop.natCast_ne_top

@[simp] lemma top_ne_nat (n : ℕ) : (⊤ : WithTop α) ≠ n := top_ne_coe
#align with_top.top_ne_nat WithTop.top_ne_nat
@[simp] lemma top_ne_natCast (n : ℕ) : (⊤ : WithTop α) ≠ n := top_ne_coe
#align with_top.top_ne_nat WithTop.top_ne_natCast

-- 2024-04-05
@[deprecated] alias coe_nat := coe_natCast
@[deprecated] alias nat_ne_top := natCast_ne_top
@[deprecated] alias top_ne_nat := top_ne_natCast

end AddMonoidWithOne

Expand Down Expand Up @@ -569,14 +574,19 @@ variable [AddMonoidWithOne α]

instance addMonoidWithOne : AddMonoidWithOne (WithBot α) := WithTop.addMonoidWithOne

@[norm_cast] lemma coe_nat (n : ℕ) : ((n : α) : WithBot α) = n := rfl
#align with_bot.coe_nat WithBot.coe_nat
@[norm_cast] lemma coe_natCast (n : ℕ) : ((n : α) : WithBot α) = n := rfl
#align with_bot.coe_nat WithBot.coe_natCast

@[simp] lemma natCast_ne_bot (n : ℕ) : (n : WithBot α) ≠ ⊥ := coe_ne_bot
#align with_bot.nat_ne_bot WithBot.natCast_ne_bot

@[simp] lemma nat_ne_bot (n : ℕ) : (n : WithBot α) ≠ := coe_ne_bot
#align with_bot.nat_ne_bot WithBot.nat_ne_bot
@[simp] lemma bot_ne_natCast (n : ℕ) : ( : WithBot α) ≠ n := bot_ne_coe
#align with_bot.bot_ne_nat WithBot.bot_ne_natCast

@[simp] lemma bot_ne_nat (n : ℕ) : (⊥ : WithBot α) ≠ n := bot_ne_coe
#align with_bot.bot_ne_nat WithBot.bot_ne_nat
-- 2024-04-05
@[deprecated] alias coe_nat := coe_natCast
@[deprecated] alias nat_ne_bot := natCast_ne_bot
@[deprecated] alias bot_ne_nat := bot_ne_natCast

end AddMonoidWithOne

Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Polynomial/Degree/CardPowDegree.lean
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open Polynomial
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
pow_pos (Int.coe_nat_pos.mpr card_pos) n
pow_pos (Int.natCast_pos.mpr card_pos) n
letI := Classical.decEq Fq;
{ toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
nonneg' := fun p => by
Expand Down Expand Up @@ -95,7 +95,7 @@ theorem cardPowDegree_nonzero (p : Fq[X]) (hp : p ≠ 0) :
theorem cardPowDegree_isEuclidean : IsEuclidean (cardPowDegree : AbsoluteValue Fq[X] ℤ) :=
have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
pow_pos (Int.coe_nat_pos.mpr card_pos) n
pow_pos (Int.natCast_pos.mpr card_pos) n
{ map_lt_map_iff' := fun {p q} => by
classical
show cardPowDegree p < cardPowDegree q ↔ degree p < degree q
Expand Down
7 changes: 5 additions & 2 deletions Mathlib/Algebra/Squarefree/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,11 @@ theorem squarefree_natAbs {n : ℤ} : Squarefree n.natAbs ↔ Squarefree n := by
#align int.squarefree_nat_abs Int.squarefree_natAbs

@[simp]
theorem squarefree_coe_nat {n : ℕ} : Squarefree (n : ℤ) ↔ Squarefree n := by
theorem squarefree_natCast {n : ℕ} : Squarefree (n : ℤ) ↔ Squarefree n := by
rw [← squarefree_natAbs, natAbs_ofNat]
#align int.squarefree_coe_nat Int.squarefree_coe_nat
#align int.squarefree_coe_nat Int.squarefree_natCast

-- 2024-04-05
@[deprecated] alias squarefree_coe_nat := squarefree_natCast

end Int
2 changes: 1 addition & 1 deletion Mathlib/Analysis/Analytic/Constructions.lean
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ lemma formalMultilinearSeries_geometric_radius (𝕜) [NontriviallyNormedField
Real.norm_of_nonneg (NNReal.coe_nonneg _), ← NNReal.coe_one,
NNReal.coe_lt_coe]
· refine le_of_forall_nnreal_lt (fun r hr ↦ ?_)
rw [← Nat.cast_one, ENNReal.coe_lt_coe_nat, Nat.cast_one] at hr
rw [← Nat.cast_one, ENNReal.coe_lt_natCast, Nat.cast_one] at hr
apply FormalMultilinearSeries.le_radius_of_isBigO
simp_rw [formalMultilinearSeries_geometric_apply_norm, one_mul]
refine isBigO_of_le atTop (fun n ↦ ?_)
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Analysis/Analytic/Meromorphic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ lemma order_eq_top_iff {f : 𝕜 → E} {x : 𝕜} (hf : MeromorphicAt f x) :
hf.order = ⊤ ↔ ∀ᶠ z in 𝓝[≠] x, f z = 0 := by
unfold order
by_cases h : hf.choose_spec.order = ⊤
· rw [h, WithTop.map_top, ← WithTop.coe_nat,
· rw [h, WithTop.map_top, ← WithTop.coe_natCast,
WithTop.top_sub_coe, eq_self, true_iff, eventually_nhdsWithin_iff]
rw [AnalyticAt.order_eq_top_iff] at h
filter_upwards [h] with z hf hz
Expand All @@ -170,7 +170,7 @@ lemma order_eq_int_iff {f : 𝕜 → E} {x : 𝕜} (hf : MeromorphicAt f x) (n :
∃ g : 𝕜 → E, AnalyticAt 𝕜 g x ∧ g x ≠ 0 ∧ ∀ᶠ z in 𝓝[≠] x, f z = (z - x) ^ n • g z := by
unfold order
by_cases h : hf.choose_spec.order = ⊤
· rw [h, WithTop.map_top, ← WithTop.coe_nat, WithTop.top_sub_coe,
· rw [h, WithTop.map_top, ← WithTop.coe_natCast, WithTop.top_sub_coe,
eq_false_intro WithTop.top_ne_coe, false_iff]
rw [AnalyticAt.order_eq_top_iff] at h
refine fun ⟨g, hg_an, hg_ne, hg_eq⟩ ↦ hg_ne ?_
Expand All @@ -182,7 +182,7 @@ lemma order_eq_int_iff {f : 𝕜 → E} {x : 𝕜} (hf : MeromorphicAt f x) (n :
rwa [hfz_eq hz, ← mul_smul, smul_eq_zero_iff_right] at hfz
exact mul_ne_zero (pow_ne_zero _ (sub_ne_zero.mpr hz)) (zpow_ne_zero _ (sub_ne_zero.mpr hz))
· obtain ⟨m, h⟩ := WithTop.ne_top_iff_exists.mp h
rw [← h, WithTop.map_coe, ← WithTop.coe_nat, ← WithTop.coe_sub, WithTop.coe_inj]
rw [← h, WithTop.map_coe, ← WithTop.coe_natCast, ← WithTop.coe_sub, WithTop.coe_inj]
obtain ⟨g, hg_an, hg_ne, hg_eq⟩ := (AnalyticAt.order_eq_nat_iff _ _).mp h.symm
replace hg_eq : ∀ᶠ (z : 𝕜) in 𝓝[≠] x, f z = (z - x) ^ (↑m - ↑hf.choose : ℤ) • g z := by
rw [eventually_nhdsWithin_iff]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/BoxIntegral/Integrability.lean
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ theorem HasIntegral.of_aeEq_zero {l : IntegrationParams} {I : Box ι} {f : (ι
clear_value m
lift m to ℝ≥0 using ne_top_of_lt this
rw [ENNReal.coe_toReal, ← NNReal.coe_nat_cast, ← NNReal.coe_mul, NNReal.coe_le_coe, ←
ENNReal.coe_le_coe, ENNReal.coe_mul, ENNReal.coe_nat, mul_comm]
ENNReal.coe_le_coe, ENNReal.coe_mul, ENNReal.coe_natCast, mul_comm]
exact (mul_le_mul_left' this.le _).trans ENNReal.mul_div_le
#align box_integral.has_integral_zero_of_ae_eq_zero BoxIntegral.HasIntegral.of_aeEq_zero

Expand Down
21 changes: 14 additions & 7 deletions Mathlib/Analysis/Normed/Group/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1854,14 +1854,18 @@ theorem le_norm_self (r : ℝ) : r ≤ ‖r‖ :=
#align real.le_norm_self Real.le_norm_self

-- Porting note (#10618): `simp` can prove this
theorem norm_coe_nat (n : ℕ) : ‖(n : ℝ)‖ = n :=
theorem norm_natCast (n : ℕ) : ‖(n : ℝ)‖ = n :=
abs_of_nonneg n.cast_nonneg
#align real.norm_coe_nat Real.norm_coe_nat
#align real.norm_coe_nat Real.norm_natCast

@[simp]
theorem nnnorm_coe_nat (n : ℕ) : ‖(n : ℝ)‖₊ = n :=
NNReal.eq <| norm_coe_nat _
#align real.nnnorm_coe_nat Real.nnnorm_coe_nat
theorem nnnorm_natCast (n : ℕ) : ‖(n : ℝ)‖₊ = n :=
NNReal.eq <| norm_natCast _
#align real.nnnorm_coe_nat Real.nnnorm_natCast

-- 2024-04-05
@[deprecated] alias norm_coe_nat := norm_natCast
@[deprecated] alias nnnorm_coe_nat := nnnorm_natCast

-- Porting note (#10618): `simp` can prove this
theorem norm_two : ‖(2 : ℝ)‖ = 2 :=
Expand Down Expand Up @@ -1922,8 +1926,11 @@ theorem norm_eq_abs (n : ℤ) : ‖n‖ = |(n : ℝ)| :=
#align int.norm_eq_abs Int.norm_eq_abs

@[simp]
theorem norm_coe_nat (n : ℕ) : ‖(n : ℤ)‖ = n := by simp [Int.norm_eq_abs]
#align int.norm_coe_nat Int.norm_coe_nat
theorem norm_natCast (n : ℕ) : ‖(n : ℤ)‖ = n := by simp [Int.norm_eq_abs]
#align int.norm_coe_nat Int.norm_natCast

-- 2024-04-05
@[deprecated] alias norm_coe_nat := norm_natCast

theorem _root_.NNReal.natCast_natAbs (n : ℤ) : (n.natAbs : ℝ≥0) = ‖n‖₊ :=
NNReal.eq <|
Expand Down
9 changes: 6 additions & 3 deletions Mathlib/Analysis/NormedSpace/Int.lean
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ theorem norm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖ = 1 := by
#align int.norm_coe_units Int.norm_coe_units

@[simp]
theorem nnnorm_coe_nat (n : ℕ) : ‖(n : ℤ)‖₊ = n :=
Real.nnnorm_coe_nat _
#align int.nnnorm_coe_nat Int.nnnorm_coe_nat
theorem nnnorm_natCast (n : ℕ) : ‖(n : ℤ)‖₊ = n :=
Real.nnnorm_natCast _
#align int.nnnorm_coe_nat Int.nnnorm_natCast

-- 2024-04-05
@[deprecated] alias nnnorm_coe_nat := nnnorm_natCast

@[simp]
theorem toNat_add_toNat_neg_eq_nnnorm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖₊ := by
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/NormedSpace/MatrixExponential.lean
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ theorem exp_neg (A : Matrix m m 𝔸) : exp 𝕂 (-A) = (exp 𝕂 A)⁻¹ := by

theorem exp_zsmul (z : ℤ) (A : Matrix m m 𝔸) : exp 𝕂 (z • A) = exp 𝕂 A ^ z := by
obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg
· rw [zpow_coe_nat, natCast_zsmul, exp_nsmul]
· rw [zpow_natCast, natCast_zsmul, exp_nsmul]
· have : IsUnit (exp 𝕂 A).det := (Matrix.isUnit_iff_isUnit_det _).mp (isUnit_exp _ _)
rw [Matrix.zpow_neg this, zpow_coe_nat, neg_smul, exp_neg, natCast_zsmul, exp_nsmul]
rw [Matrix.zpow_neg this, zpow_natCast, neg_smul, exp_neg, natCast_zsmul, exp_nsmul]
#align matrix.exp_zsmul Matrix.exp_zsmul

theorem exp_conj (U : Matrix m m 𝔸) (A : Matrix m m 𝔸) (hy : IsUnit U) :
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/NormedSpace/PiLp.lean
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ theorem antilipschitzWith_equiv_aux :
simp only [nsmul_eq_mul, Finset.card_univ, ENNReal.rpow_one, Finset.sum_const,
ENNReal.mul_rpow_of_nonneg _ _ nonneg, ← ENNReal.rpow_mul, cancel]
have : (Fintype.card ι : ℝ≥0∞) = (Fintype.card ι : ℝ≥0) :=
(ENNReal.coe_nat (Fintype.card ι)).symm
(ENNReal.coe_natCast (Fintype.card ι)).symm
rw [this, ENNReal.coe_rpow_of_nonneg _ nonneg]
#align pi_Lp.antilipschitz_with_equiv_aux PiLp.antilipschitzWith_equiv_aux

Expand Down Expand Up @@ -609,7 +609,7 @@ end Linfty
theorem norm_eq_of_nat {p : ℝ≥0∞} [Fact (1 ≤ p)] {β : ι → Type*}
[∀ i, SeminormedAddCommGroup (β i)] (n : ℕ) (h : p = n) (f : PiLp p β) :
‖f‖ = (∑ i, ‖f i‖ ^ n) ^ (1 / (n : ℝ)) := by
have := p.toReal_pos_iff_ne_top.mpr (ne_of_eq_of_ne h <| ENNReal.nat_ne_top n)
have := p.toReal_pos_iff_ne_top.mpr (ne_of_eq_of_ne h <| ENNReal.natCast_ne_top n)
simp only [one_div, h, Real.rpow_nat_cast, ENNReal.toReal_nat, eq_self_iff_true, Finset.sum_congr,
norm_eq_sum this]
#align pi_Lp.norm_eq_of_nat PiLp.norm_eq_of_nat
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/NormedSpace/ProdLp.lean
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ variable {p α β}

theorem prod_norm_eq_of_nat [Norm α] [Norm β] (n : ℕ) (h : p = n) (f : WithLp p (α × β)) :
‖f‖ = (‖f.fst‖ ^ n + ‖f.snd‖ ^ n) ^ (1 / (n : ℝ)) := by
have := p.toReal_pos_iff_ne_top.mpr (ne_of_eq_of_ne h <| ENNReal.nat_ne_top n)
have := p.toReal_pos_iff_ne_top.mpr (ne_of_eq_of_ne h <| ENNReal.natCast_ne_top n)
simp only [one_div, h, Real.rpow_nat_cast, ENNReal.toReal_nat, eq_self_iff_true, Finset.sum_congr,
prod_norm_eq_add this]

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/NormedSpace/lpSpace.lean
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ theorem _root_.nat_cast_memℓp_infty (n : ℕ) : Memℓp (n : ∀ i, B i) ∞ :
#align nat_cast_mem_ℓp_infty nat_cast_memℓp_infty

theorem _root_.int_cast_memℓp_infty (z : ℤ) : Memℓp (z : ∀ i, B i) ∞ :=
coe_int_mem (lpInftySubring B) z
intCast_mem (lpInftySubring B) z
#align int_cast_mem_ℓp_infty int_cast_memℓp_infty

@[simp]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/SpecialFunctions/Gamma/Beta.lean
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
conv at this => arg 1; intro n; rw [mul_comm]
rwa [← mul_one (GammaAux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this
simp_rw [add_assoc]
exact tendsto_coe_nat_div_add_atTop (1 + s)
exact tendsto_natCast_div_add_atTop (1 + s)
#align complex.Gamma_seq_tendsto_Gamma Complex.GammaSeq_tendsto_Gamma

end Complex
Expand Down Expand Up @@ -436,7 +436,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]
convert Tendsto.congr' ((eventually_ne_atTop 0).mp (eventually_of_forall fun n hn =>
(GammaSeq_mul z hn).symm)) (Tendsto.mul _ _)
· convert tendsto_coe_nat_div_add_atTop (1 - z) using 1; ext1 n; rw [add_sub_assoc]
· convert tendsto_natCast_div_add_atTop (1 - z) using 1; ext1 n; rw [add_sub_assoc]
· have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp
convert tendsto_const_nhds.div _ (div_ne_zero hs pi_ne)
rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel₀ _ pi_ne]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/SpecificLimits/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ algebra over `ℝ`, e.g., `ℂ`).

TODO: introduce a typeclass saying that `1 / n` tends to 0 at top, making it possible to get this
statement simultaneously on `ℚ`, `ℝ` and `ℂ`. -/
theorem tendsto_coe_nat_div_add_atTop {𝕜 : Type*} [DivisionRing 𝕜] [TopologicalSpace 𝕜]
theorem tendsto_natCast_div_add_atTop {𝕜 : Type*} [DivisionRing 𝕜] [TopologicalSpace 𝕜]
[CharZero 𝕜] [Algebra ℝ 𝕜] [ContinuousSMul ℝ 𝕜] [TopologicalDivisionRing 𝕜] (x : 𝕜) :
Tendsto (fun n : ℕ ↦ (n : 𝕜) / (n + x)) atTop (𝓝 1) := by
refine' Tendsto.congr' ((eventually_ne_atTop 0).mp (eventually_of_forall fun n hn ↦ _)) _
Expand All @@ -105,7 +105,7 @@ theorem tendsto_coe_nat_div_add_atTop {𝕜 : Type*} [DivisionRing 𝕜] [Topolo
refine' Iff.mpr tendsto_atTop' _
intros
simp_all only [comp_apply, map_inv₀, map_natCast]
#align tendsto_coe_nat_div_add_at_top tendsto_coe_nat_div_add_atTop
#align tendsto_coe_nat_div_add_at_top tendsto_natCast_div_add_atTop

/-! ### Powers -/

Expand Down
Loading
Loading