Zulip Chat Archive

Stream: new members

Topic: p-adic metric in terms of p-adic norm


Giulio Caflisch (Sep 27 2024 at 11:32):

Hello everyone. I'm kind of new to lean and I wanted to ask following question:

I'm working on some small theorems to gain familiarity with analysis and p-adic numbers in Lean 4.
I want to prove the dummy lemma stating p^k tends to zero in the p-adic metric.
I wrote the following code:

import Mathlib

open Nat

variable (p : ) [Fact (Nat.Prime p)]

noncomputable def Padic.prime_powers :   ℚ_[p] :=
  fun k  (p : ℚ_[p])^k

noncomputable def log_base (b x : ) :  :=
  Real.log x / Real.log b

theorem Padic.prime_powers_tends_to_zero :
    Filter.Tendsto (Padic.prime_powers p) Filter.atTop (nhds (0 : ℚ_[p])) := by
  rw [Metric.tendsto_atTop]
  unfold Padic.prime_powers
  intros ε 
  let N := Nat.floor (- log_base p ε)
  use N
  intros n hn
  sorry

But somehow I cannot find a Theorem that works for me rewriting following goal

Dist.dist (p ^ n) 0 < ε

into its equivalent form involving the norm for metric spaces induced by a norm.

How can I do this?

Thanks in advance for your help!

Filippo A. E. Nuccio (Sep 27 2024 at 11:39):

Well, docs#dist_eq_norm works, so you can do rw [dist_eq_norm] to do one more step.

Giulio Caflisch (Sep 27 2024 at 12:12):

Thanks a lot, I don't know how I missed it

Johan Commelin (Sep 27 2024 at 14:23):

@Giulio Caflisch Do you know about rw?. It is a tactic that searches for useful rewrite lemmas. Near the top of its list of answers is

  rw [@_root_.dist_zero_right]

Giulio Caflisch (Sep 27 2024 at 15:05):

I know about rw? and simp?. I asked about the more general conversion from distance to norm of difference since I need it in another theorem where the distance is not with respect to 0 and there rw? did not answer anything useful at all.

Johan Commelin (Sep 27 2024 at 17:29):

Oh, that's unfortunate.

Johan Commelin (Sep 27 2024 at 17:32):

@loogle Dist.dist ?x ?y < ?ε ↔ ‖?x - ?y‖ < ?ε

loogle (Sep 27 2024 at 17:32):

:shrug: nothing found

Johan Commelin (Sep 27 2024 at 17:32):

Hmmmz... That's sad

Johan Commelin (Sep 27 2024 at 17:33):

Ooh, I'm being silly

Johan Commelin (Sep 27 2024 at 17:33):

@loogle Dist.dist ?x ?y = ‖?x - ?y‖

loogle (Sep 27 2024 at 17:33):

:search: dist_eq_norm, dist_eq_norm_sub, and 27 more

Johan Commelin (Sep 27 2024 at 17:33):

@Giulio Caflisch Voila: loogle is your friend


Last updated: May 02 2025 at 03:31 UTC