Skip to content

Commit 17cb789

Browse files
committed
feat(NumberTheory/Padics): p-adic valuation of casts (#17544)
Lemmas about `Padic.valuation` applied to casts from various other rings to Qp
1 parent 6264905 commit 17cb789

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

Mathlib/NumberTheory/Padics/PadicNumbers.lean

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -945,16 +945,6 @@ def valuation : ℚ_[p] → ℤ :=
945945
theorem valuation_zero : valuation (0 : ℚ_[p]) = 0 :=
946946
dif_pos ((const_equiv p).2 rfl)
947947

948-
@[simp]
949-
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
950-
classical
951-
change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
952-
have h : ¬CauSeq.const (padicNorm p) 10 := by
953-
rw [← const_zero, const_equiv p]
954-
exact one_ne_zero
955-
rw [dif_neg h]
956-
simp
957-
958948
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
959949
refine Quotient.inductionOn' x fun f hf => ?_
960950
change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
@@ -969,27 +959,45 @@ theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.va
969959
simpa using hf'
970960

971961
@[simp]
972-
theorem valuation_p : valuation (p : ℚ_[p]) = 1 := by
973-
have h : (1 : ℝ) < p := mod_cast (Fact.out : p.Prime).one_lt
974-
refine neg_injective ((zpow_right_strictMono₀ h).injective <| (norm_eq_pow_val ?_).symm.trans ?_)
975-
· exact mod_cast (Fact.out : p.Prime).ne_zero
976-
· simp
962+
lemma valuation_ratCast (q : ℚ) : valuation (q : ℚ_[p]) = padicValRat p q := by
963+
rcases eq_or_ne q 0 with rfl | hq
964+
· simp only [Rat.cast_zero, valuation_zero, padicValRat.zero]
965+
refine neg_injective ((zpow_right_strictMono₀ (mod_cast hp.out.one_lt)).injective
966+
<| (norm_eq_pow_val (mod_cast hq)).symm.trans ?_)
967+
rw [padicNormE.eq_padicNorm, ← Rat.cast_natCast, ← Rat.cast_zpow, Rat.cast_inj]
968+
exact padicNorm.eq_zpow_of_nonzero hq
969+
970+
@[simp]
971+
lemma valuation_intCast (n : ℤ) : valuation (n : ℚ_[p]) = padicValInt p n := by
972+
rw [← Rat.cast_intCast, valuation_ratCast, padicValRat.of_int]
973+
974+
@[simp]
975+
lemma valuation_natCast (n : ℕ) : valuation (n : ℚ_[p]) = padicValNat p n := by
976+
rw [← Rat.cast_natCast, valuation_ratCast, padicValRat.of_nat]
977+
978+
-- See note [no_index around OfNat.ofNat]
979+
@[simp]
980+
lemma valuation_ofNat (n : ℕ) [n.AtLeastTwo] :
981+
valuation (no_index (OfNat.ofNat n : ℚ_[p])) = padicValNat p n :=
982+
valuation_natCast n
983+
984+
@[simp]
985+
lemma valuation_one : valuation (1 : ℚ_[p]) = 0 := by
986+
rw [← Nat.cast_one, valuation_natCast, padicValNat.one, cast_zero]
987+
988+
-- not @[simp], since simp can prove it
989+
lemma valuation_p : valuation (p : ℚ_[p]) = 1 := by
990+
rw [valuation_natCast, padicValNat_self, cast_one]
977991

978992
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
979993
min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
980994
by_cases hx : x = 0
981-
· rw [hx, zero_add]
982-
exact min_le_right _ _
983-
· by_cases hy : y = 0
984-
· rw [hy, add_zero]
985-
exact min_le_left _ _
986-
· have h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
987-
have hp_one : (1 : ℝ) < p := by
988-
rw [← Nat.cast_one, Nat.cast_lt]
989-
exact Nat.Prime.one_lt hp.elim
990-
rwa [norm_eq_pow_val hx, norm_eq_pow_val hy, norm_eq_pow_val hxy, le_max_iff,
991-
zpow_le_zpow_iff_right₀ hp_one, zpow_le_zpow_iff_right₀ hp_one, neg_le_neg_iff,
992-
neg_le_neg_iff, ← min_le_iff] at h_norm
995+
· simpa only [hx, zero_add] using min_le_right _ _
996+
by_cases hy : y = 0
997+
· simpa only [hy, add_zero] using min_le_left _ _
998+
have : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
999+
simpa only [norm_eq_pow_val hxy, norm_eq_pow_val hx, norm_eq_pow_val hy, le_max_iff,
1000+
zpow_le_zpow_iff_right₀ (mod_cast hp.out.one_lt : 1 < (p : ℝ)), neg_le_neg_iff, ← min_le_iff]
9931001

9941002
@[simp]
9951003
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :

0 commit comments

Comments
 (0)