Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 082350f

Browse files
committed
feat(number_theory/padics/padic_numbers): add is_fraction_ring instance (#16981)
`ℚ_[p]` is the fraction ring of `ℤ_[p]`.
1 parent 99d3129 commit 082350f

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

src/number_theory/padics/padic_integers.lean

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ instance : has_one ℤ_[p] := ⟨⟨1, by norm_num⟩⟩
112112
@[simp, norm_cast] lemma coe_one : ((1 : ℤ_[p]) : ℚ_[p]) = 1 := rfl
113113
@[simp, norm_cast] lemma coe_zero : ((0 : ℤ_[p]) : ℚ_[p]) = 0 := rfl
114114

115+
lemma coe_eq_zero (z : ℤ_[p]) : (z : ℚ_[p]) = 0 ↔ z = 0 :=
116+
⟨λ h, by {rw ← coe_zero at h, exact subtype.coe_inj.mp h}, λ h, by {rw h, exact coe_zero}⟩
117+
115118
instance : add_comm_group ℤ_[p] :=
116119
(by apply_instance : add_comm_group (subring p))
117120

@@ -531,4 +534,52 @@ instance : is_adic_complete (maximal_ideal ℤ_[p]) ℤ_[p] :=
531534

532535
end dvr
533536

537+
section fraction_ring
538+
539+
instance algebra : algebra ℤ_[p] ℚ_[p] := ring_hom.to_algebra (padic_int.coe.ring_hom)
540+
541+
@[simp] lemma algebra_map_apply (x : ℤ_[p]) : algebra_map ℤ_[p] ℚ_[p] x = x := rfl
542+
543+
instance is_fraction_ring : is_fraction_ring ℤ_[p] ℚ_[p] :=
544+
{ map_units := λ ⟨x, hx⟩,
545+
begin
546+
rw [set_like.coe_mk, algebra_map_apply, is_unit_iff_ne_zero, ne.def, padic_int.coe_eq_zero],
547+
exact mem_non_zero_divisors_iff_ne_zero.mp hx,
548+
end,
549+
surj := λ x,
550+
begin
551+
by_cases hx : ∥ x ∥ ≤ 1,
552+
{ use (⟨x, hx⟩, 1),
553+
rw [submonoid.coe_one, map_one, mul_one],
554+
refl, },
555+
{ set n := int.to_nat(- x.valuation) with hn,
556+
have hn_coe : (n : ℤ) = -x.valuation,
557+
{ rw [hn, int.to_nat_of_nonneg],
558+
rw right.nonneg_neg_iff,
559+
rw padic.norm_le_one_iff_val_nonneg at hx,
560+
exact le_of_lt (not_le.mp hx) },
561+
set a := x * p^n with ha,
562+
have ha_norm : ∥ a ∥ = 1,
563+
{ have hx : x ≠ 0,
564+
{ intro h0,
565+
rw [h0, norm_zero] at hx,
566+
exact hx (zero_le_one) },
567+
rw [ha, padic_norm_e.mul, ← zpow_coe_nat, padic_norm_e.norm_p_pow,
568+
padic.norm_eq_pow_val hx, ← zpow_add' , hn_coe, neg_neg, add_left_neg, zpow_zero],
569+
exact or.inl (nat.cast_ne_zero.mpr (ne_zero.ne p)), },
570+
use (⟨a, le_of_eq ha_norm⟩,
571+
⟨(p^n : ℤ_[p]), mem_non_zero_divisors_iff_ne_zero.mpr (ne_zero.ne _)⟩),
572+
simp only [set_like.coe_mk, map_pow, map_nat_cast, algebra_map_apply,
573+
padic_int.coe_pow, padic_int.coe_nat_cast, subtype.coe_mk] }
574+
end,
575+
eq_iff_exists := λ x y,
576+
begin
577+
rw [algebra_map_apply, algebra_map_apply, subtype.coe_inj],
578+
refine ⟨λ h, ⟨1, by rw h⟩, _⟩,
579+
rintro ⟨⟨c, hc⟩, h⟩,
580+
exact (mul_eq_mul_right_iff.mp h).resolve_right (mem_non_zero_divisors_iff_ne_zero.mp hc)
581+
end }
582+
583+
end fraction_ring
584+
534585
end padic_int

src/number_theory/padics/padic_numbers.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,5 +1021,14 @@ end
10211021
lemma norm_lt_pow_iff_norm_le_pow_sub_one (x : ℚ_[p]) (n : ℤ) : ∥x∥ < p ^ n ↔ ∥x∥ ≤ p ^ (n - 1) :=
10221022
by rw [norm_le_pow_iff_norm_lt_pow_add_one, sub_add_cancel]
10231023

1024+
lemma norm_le_one_iff_val_nonneg (x : ℚ_[p]) : ∥ x ∥ ≤ 10 ≤ x.valuation :=
1025+
begin
1026+
by_cases hx : x = 0,
1027+
{ simp only [hx, norm_zero, valuation_zero, zero_le_one, le_refl], },
1028+
{ rw [norm_eq_pow_val hx, ← zpow_zero (p : ℝ), zpow_le_iff_le
1029+
(nat.one_lt_cast.mpr (nat.prime.one_lt' p).1), right.neg_nonpos_iff],
1030+
apply_instance, }
1031+
end
1032+
10241033
end norm_le_iff
10251034
end padic

0 commit comments

Comments
 (0)