l3lab/ntp-mathlib huggingface dataset:
/-- `Padic.valuation` lifts the `p`-adic valuation on rationals to `ℚ_[p]`. -/
def valuation : ℚ_[p] → ℤ :=
  Quotient.lift (@PadicSeq.valuation p _) fun f g h ↦ by
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
f g : CauSeq ℚ (padicNorm p)
h : f ≈ g
⊢ PadicSeq.valuation f = PadicSeq.valuation g

Next tactic:
by_cases hf : f ≈ 0
/-- `Padic.valuation` lifts the `p`-adic valuation on rationals to `ℚ_[p]`. -/
def valuation : ℚ_[p] → ℤ :=
  Quotient.lift (@PadicSeq.valuation p _) fun f g h ↦ by
    by_cases hf : f ≈ 0
    · 

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
f g : CauSeq ℚ (padicNorm p)
h : f ≈ g
hf : f ≈ 0
⊢ PadicSeq.valuation f = PadicSeq.valuation g

Next tactic:
have hg : g ≈ 0 := Setoid.trans (Setoid.symm h) hf
/-- `Padic.valuation` lifts the `p`-adic valuation on rationals to `ℚ_[p]`. -/
def valuation : ℚ_[p] → ℤ :=
  Quotient.lift (@PadicSeq.valuation p _) fun f g h ↦ by
    by_cases hf : f ≈ 0
    · have hg : g ≈ 0 := Setoid.trans (Setoid.symm h) hf
      

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
f g : CauSeq ℚ (padicNorm p)
h : f ≈ g
hf : f ≈ 0
hg : g ≈ 0
⊢ PadicSeq.valuation f = PadicSeq.valuation g

Next tactic:
simp [hf, hg, PadicSeq.valuation]
/-- `Padic.valuation` lifts the `p`-adic valuation on rationals to `ℚ_[p]`. -/
def valuation : ℚ_[p] → ℤ :=
  Quotient.lift (@PadicSeq.valuation p _) fun f g h ↦ by
    by_cases hf : f ≈ 0
    · have hg : g ≈ 0 := Setoid.trans (Setoid.symm h) hf
      simp [hf, hg, PadicSeq.valuation]
    · 

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
f g : CauSeq ℚ (padicNorm p)
h : f ≈ g
hf : ¬f ≈ 0
⊢ PadicSeq.valuation f = PadicSeq.valuation g

Next tactic:
have hg : ¬g ≈ 0 := fun hg ↦ hf (Setoid.trans h hg)
/-- `Padic.valuation` lifts the `p`-adic valuation on rationals to `ℚ_[p]`. -/
def valuation : ℚ_[p] → ℤ :=
  Quotient.lift (@PadicSeq.valuation p _) fun f g h ↦ by
    by_cases hf : f ≈ 0
    · have hg : g ≈ 0 := Setoid.trans (Setoid.symm h) hf
      simp [hf, hg, PadicSeq.valuation]
    · have hg : ¬g ≈ 0 := fun hg ↦ hf (Setoid.trans h hg)
      

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
f g : CauSeq ℚ (padicNorm p)
h : f ≈ g
hf : ¬f ≈ 0
hg : ¬g ≈ 0
⊢ PadicSeq.valuation f = PadicSeq.valuation g

Next tactic:
rw [PadicSeq.val_eq_iff_norm_eq hf hg]
/-- `Padic.valuation` lifts the `p`-adic valuation on rationals to `ℚ_[p]`. -/
def valuation : ℚ_[p] → ℤ :=
  Quotient.lift (@PadicSeq.valuation p _) fun f g h ↦ by
    by_cases hf : f ≈ 0
    · have hg : g ≈ 0 := Setoid.trans (Setoid.symm h) hf
      simp [hf, hg, PadicSeq.valuation]
    · have hg : ¬g ≈ 0 := fun hg ↦ hf (Setoid.trans h hg)
      rw [PadicSeq.val_eq_iff_norm_eq hf hg]
      

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
f g : CauSeq ℚ (padicNorm p)
h : f ≈ g
hf : ¬f ≈ 0
hg : ¬g ≈ 0
⊢ PadicSeq.norm f = PadicSeq.norm g

Next tactic:
exact PadicSeq.norm_equiv h
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
⊢ valuation 1 = 0

Next tactic:
change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
⊢ (if h : const (padicNorm p) 1 ≈ 0 then (fun hf => 0) h
    else (fun hf => padicValRat p (↑(const (padicNorm p) 1) (PadicSeq.stationaryPoint hf))) h) =
    0

Next tactic:
have h : ¬CauSeq.const (padicNorm p) 1 ≈ 0 := by
    intro H
    erw [const_equiv p] at H
    exact one_ne_zero H
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
  have h : ¬CauSeq.const (padicNorm p) 1 ≈ 0 := by
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
⊢ ¬const (padicNorm p) 1 ≈ 0

Next tactic:
intro H
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
  have h : ¬CauSeq.const (padicNorm p) 1 ≈ 0 := by
    intro H
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
H : const (padicNorm p) 1 ≈ 0
⊢ False

Next tactic:
erw [const_equiv p] at H
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
  have h : ¬CauSeq.const (padicNorm p) 1 ≈ 0 := by
    intro H
    erw [const_equiv p] at H
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
H : 1 = 0
⊢ False

Next tactic:
exact one_ne_zero H
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
  have h : ¬CauSeq.const (padicNorm p) 1 ≈ 0 := by
    intro H
    erw [const_equiv p] at H
    exact one_ne_zero H
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
h : ¬const (padicNorm p) 1 ≈ 0
⊢ (if h : const (padicNorm p) 1 ≈ 0 then (fun hf => 0) h
    else (fun hf => padicValRat p (↑(const (padicNorm p) 1) (PadicSeq.stationaryPoint hf))) h) =
    0

Next tactic:
rw [dif_neg h]
@[simp]
theorem valuation_one : valuation (1 : ℚ_[p]) = 0 := by
  change dite (CauSeq.const (padicNorm p) 1 ≈ _) _ _ = _
  have h : ¬CauSeq.const (padicNorm p) 1 ≈ 0 := by
    intro H
    erw [const_equiv p] at H
    exact one_ne_zero H
  rw [dif_neg h]
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
h : ¬const (padicNorm p) 1 ≈ 0
⊢ (fun hf => padicValRat p (↑(const (padicNorm p) 1) (PadicSeq.stationaryPoint hf))) h = 0

Next tactic:
simp
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
⊢ x ≠ 0 → ‖x‖ = ↑p ^ (-valuation x)

Next tactic:
refine Quotient.inductionOn' x fun f hf => ?_
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
⊢ ‖Quotient.mk'' f‖ = ↑p ^ (-valuation (Quotient.mk'' f))

Next tactic:
change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
⊢ ↑(PadicSeq.norm f) = ↑p ^ (-PadicSeq.valuation f)

Next tactic:
rw [PadicSeq.norm_eq_pow_val]
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
⊢ ↑(↑p ^ (-PadicSeq.valuation f)) = ↑p ^ (-PadicSeq.valuation f)
p : ℕ hp : Fact (Nat.Prime p) x : ℚ_[p] f : CauSeq ℚ (padicNorm p) hf : Quotient.mk'' f ≠ 0 ⊢ ¬f ≈ 0

Next tactic:
change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
  · 

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
⊢ ↑(↑p ^ (-PadicSeq.valuation f)) = ↑p ^ (-PadicSeq.valuation f)

Next tactic:
rw [Rat.cast_zpow, Rat.cast_coe_nat]
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
  · rw [Rat.cast_zpow, Rat.cast_coe_nat]
  · 

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
⊢ ¬f ≈ 0

Next tactic:
apply CauSeq.not_limZero_of_not_congr_zero
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
  · rw [Rat.cast_zpow, Rat.cast_coe_nat]
  · apply CauSeq.not_limZero_of_not_congr_zero
    -- Porting note: was `contrapose! hf`
    

Proof state:
case hf
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
⊢ ¬f - 0 ≈ 0

Next tactic:
intro hf'
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
  · rw [Rat.cast_zpow, Rat.cast_coe_nat]
  · apply CauSeq.not_limZero_of_not_congr_zero
    -- Porting note: was `contrapose! hf`
    intro hf'
    

Proof state:
case hf
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
hf' : f - 0 ≈ 0
⊢ False

Next tactic:
apply hf
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
  · rw [Rat.cast_zpow, Rat.cast_coe_nat]
  · apply CauSeq.not_limZero_of_not_congr_zero
    -- Porting note: was `contrapose! hf`
    intro hf'
    apply hf
    

Proof state:
case hf
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
hf' : f - 0 ≈ 0
⊢ Quotient.mk'' f = 0

Next tactic:
apply Quotient.sound
theorem norm_eq_pow_val {x : ℚ_[p]} : x ≠ 0 → ‖x‖ = (p : ℝ) ^ (-x.valuation) := by
  refine Quotient.inductionOn' x fun f hf => ?_
  change (PadicSeq.norm _ : ℝ) = (p : ℝ) ^ (-PadicSeq.valuation _)
  rw [PadicSeq.norm_eq_pow_val]
  change ↑((p : ℚ) ^ (-PadicSeq.valuation f)) = (p : ℝ) ^ (-PadicSeq.valuation f)
  · rw [Rat.cast_zpow, Rat.cast_coe_nat]
  · apply CauSeq.not_limZero_of_not_congr_zero
    -- Porting note: was `contrapose! hf`
    intro hf'
    apply hf
    apply Quotient.sound
    

Proof state:
case hf.a
p : ℕ
hp : Fact (Nat.Prime p)
x : ℚ_[p]
f : CauSeq ℚ (padicNorm p)
hf : Quotient.mk'' f ≠ 0
hf' : f - 0 ≈ 0
⊢ f ≈ const (padicNorm p) 0

Next tactic:
simpa using hf'
@[simp]
theorem valuation_p : valuation (p : ℚ_[p]) = 1 := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
⊢ valuation ↑p = 1

Next tactic:
have h : (1 : ℝ) < p := mod_cast (Fact.out : p.Prime).one_lt
@[simp]
theorem valuation_p : valuation (p : ℚ_[p]) = 1 := by
  have h : (1 : ℝ) < p := mod_cast (Fact.out : p.Prime).one_lt
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
h : 1 < ↑p
⊢ valuation ↑p = 1

Next tactic:
refine' neg_injective ((zpow_strictMono h).injective <| (norm_eq_pow_val _).symm.trans _)
@[simp]
theorem valuation_p : valuation (p : ℚ_[p]) = 1 := by
  have h : (1 : ℝ) < p := mod_cast (Fact.out : p.Prime).one_lt
  refine' neg_injective ((zpow_strictMono h).injective <| (norm_eq_pow_val _).symm.trans _)
  · 

Proof state:
case refine'_1
p : ℕ
hp : Fact (Nat.Prime p)
h : 1 < ↑p
⊢ ↑p ≠ 0

Next tactic:
exact mod_cast (Fact.out : p.Prime).ne_zero
@[simp]
theorem valuation_p : valuation (p : ℚ_[p]) = 1 := by
  have h : (1 : ℝ) < p := mod_cast (Fact.out : p.Prime).one_lt
  refine' neg_injective ((zpow_strictMono h).injective <| (norm_eq_pow_val _).symm.trans _)
  · exact mod_cast (Fact.out : p.Prime).ne_zero
  · 

Proof state:
case refine'_2
p : ℕ
hp : Fact (Nat.Prime p)
h : 1 < ↑p
⊢ ‖↑p‖ = ↑p ^ (-1)

Next tactic:
simp
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
by_cases hx : x = 0
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · 

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : x = 0
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
rw [hx, zero_add]
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : x = 0
⊢ min (valuation 0) (valuation y) ≤ valuation y

Next tactic:
exact min_le_right _ _
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · 

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
by_cases hy : y = 0
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · 

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : y = 0
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
rw [hy, add_zero]
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · rw [hy, add_zero]
      

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : y = 0
⊢ min (valuation x) (valuation 0) ≤ valuation x

Next tactic:
exact min_le_left _ _
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · rw [hy, add_zero]
      exact min_le_left _ _
    · 

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
have h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · rw [hy, add_zero]
      exact min_le_left _ _
    · have h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
      

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
have hp_one : (1 : ℝ) < p := by
        rw [← Nat.cast_one, Nat.cast_lt]
        exact Nat.Prime.one_lt hp.elim
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · rw [hy, add_zero]
      exact min_le_left _ _
    · have h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
      have hp_one : (1 : ℝ) < p := by
        

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖
⊢ 1 < ↑p

Next tactic:
rw [← Nat.cast_one, Nat.cast_lt]
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · rw [hy, add_zero]
      exact min_le_left _ _
    · have h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
      have hp_one : (1 : ℝ) < p := by
        rw [← Nat.cast_one, Nat.cast_lt]
        

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖
⊢ 1 < p

Next tactic:
exact Nat.Prime.one_lt hp.elim
theorem valuation_map_add {x y : ℚ_[p]} (hxy : x + y ≠ 0) :
    min (valuation x) (valuation y) ≤ valuation (x + y : ℚ_[p]) := by
  by_cases hx : x = 0
  · rw [hx, zero_add]
    exact min_le_right _ _
  · by_cases hy : y = 0
    · rw [hy, add_zero]
      exact min_le_left _ _
    · have h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖ := padicNormE.nonarchimedean x y
      have hp_one : (1 : ℝ) < p := by
        rw [← Nat.cast_one, Nat.cast_lt]
        exact Nat.Prime.one_lt hp.elim
      

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hxy : x + y ≠ 0
hx : ¬x = 0
hy : ¬y = 0
h_norm : ‖x + y‖ ≤ max ‖x‖ ‖y‖
hp_one : 1 < ↑p
⊢ min (valuation x) (valuation y) ≤ valuation (x + y)

Next tactic:
rwa [norm_eq_pow_val hx, norm_eq_pow_val hy, norm_eq_pow_val hxy,
        zpow_le_max_iff_min_le hp_one] at h_norm
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
⊢ valuation (x * y) = valuation x + valuation y

Next tactic:
have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
⊢ valuation (x * y) = valuation x + valuation y

Next tactic:
have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    exact Nat.Prime.ne_one hp.elim
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
⊢ ↑p ≠ 1

Next tactic:
rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
⊢ ¬p = 1

Next tactic:
exact Nat.Prime.ne_one hp.elim
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    exact Nat.Prime.ne_one hp.elim
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
hp_ne_one : ↑p ≠ 1
⊢ valuation (x * y) = valuation x + valuation y

Next tactic:
have hp_pos : (0 : ℝ) < p := by
    rw [← Nat.cast_zero, Nat.cast_lt]
    exact Nat.Prime.pos hp.elim
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    exact Nat.Prime.ne_one hp.elim
  have hp_pos : (0 : ℝ) < p := by
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
hp_ne_one : ↑p ≠ 1
⊢ 0 < ↑p

Next tactic:
rw [← Nat.cast_zero, Nat.cast_lt]
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    exact Nat.Prime.ne_one hp.elim
  have hp_pos : (0 : ℝ) < p := by
    rw [← Nat.cast_zero, Nat.cast_lt]
    

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
hp_ne_one : ↑p ≠ 1
⊢ 0 < p

Next tactic:
exact Nat.Prime.pos hp.elim
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    exact Nat.Prime.ne_one hp.elim
  have hp_pos : (0 : ℝ) < p := by
    rw [← Nat.cast_zero, Nat.cast_lt]
    exact Nat.Prime.pos hp.elim
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : ‖x * y‖ = ‖x‖ * ‖y‖
hp_ne_one : ↑p ≠ 1
hp_pos : 0 < ↑p
⊢ valuation (x * y) = valuation x + valuation y

Next tactic:
rw [norm_eq_pow_val hx, norm_eq_pow_val hy, norm_eq_pow_val (mul_ne_zero hx hy), ←
    zpow_add₀ (ne_of_gt hp_pos), zpow_inj hp_pos hp_ne_one, ← neg_add, neg_inj] at h_norm
@[simp]
theorem valuation_map_mul {x y : ℚ_[p]} (hx : x ≠ 0) (hy : y ≠ 0) :
    valuation (x * y : ℚ_[p]) = valuation x + valuation y := by
  have h_norm : ‖x * y‖ = ‖x‖ * ‖y‖ := norm_mul x y
  have hp_ne_one : (p : ℝ) ≠ 1 := by
    rw [← Nat.cast_one, Ne.def, Nat.cast_inj]
    exact Nat.Prime.ne_one hp.elim
  have hp_pos : (0 : ℝ) < p := by
    rw [← Nat.cast_zero, Nat.cast_lt]
    exact Nat.Prime.pos hp.elim
  rw [norm_eq_pow_val hx, norm_eq_pow_val hy, norm_eq_pow_val (mul_ne_zero hx hy), ←
    zpow_add₀ (ne_of_gt hp_pos), zpow_inj hp_pos hp_ne_one, ← neg_add, neg_inj] at h_norm
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x ≠ 0
hy : y ≠ 0
h_norm : valuation (x * y) = valuation x + valuation y
hp_ne_one : ↑p ≠ 1
hp_pos : 0 < ↑p
⊢ valuation (x * y) = valuation x + valuation y

Next tactic:
exact h_norm
@[simp]
theorem AddValuation.map_zero : addValuationDef (0 : ℚ_[p]) = ⊤ := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
⊢ addValuationDef 0 = ⊤

Next tactic:
rw [addValuationDef, if_pos (Eq.refl _)]
@[simp]
theorem AddValuation.map_one : addValuationDef (1 : ℚ_[p]) = 0 := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
⊢ addValuationDef 1 = 0

Next tactic:
rw [addValuationDef, if_neg one_ne_zero, valuation_one, WithTop.coe_zero]
theorem AddValuation.map_mul (x y : ℚ_[p]) :
    addValuationDef (x * y : ℚ_[p]) = addValuationDef x + addValuationDef y := by
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
⊢ addValuationDef (x * y) = addValuationDef x + addValuationDef y

Next tactic:
simp only [addValuationDef]
theorem AddValuation.map_mul (x y : ℚ_[p]) :
    addValuationDef (x * y : ℚ_[p]) = addValuationDef x + addValuationDef y := by
  simp only [addValuationDef]
  

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
⊢ (if x * y = 0 then ⊤ else ↑(valuation (x * y))) =
    (if x = 0 then ⊤ else ↑(valuation x)) + if y = 0 then ⊤ else ↑(valuation y)

Next tactic:
by_cases hx : x = 0
theorem AddValuation.map_mul (x y : ℚ_[p]) :
    addValuationDef (x * y : ℚ_[p]) = addValuationDef x + addValuationDef y := by
  simp only [addValuationDef]
  by_cases hx : x = 0
  · 

Proof state:
case pos
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : x = 0
⊢ (if x * y = 0 then ⊤ else ↑(valuation (x * y))) =
    (if x = 0 then ⊤ else ↑(valuation x)) + if y = 0 then ⊤ else ↑(valuation y)

Next tactic:
rw [hx, if_pos (Eq.refl _), zero_mul, if_pos (Eq.refl _), WithTop.top_add]
theorem AddValuation.map_mul (x y : ℚ_[p]) :
    addValuationDef (x * y : ℚ_[p]) = addValuationDef x + addValuationDef y := by
  simp only [addValuationDef]
  by_cases hx : x = 0
  · rw [hx, if_pos (Eq.refl _), zero_mul, if_pos (Eq.refl _), WithTop.top_add]
  · 

Proof state:
case neg
p : ℕ
hp : Fact (Nat.Prime p)
x y : ℚ_[p]
hx : ¬x = 0
⊢ (if x * y = 0 then ⊤ else ↑(valuation (x * y))) =
    (if x = 0 then ⊤ else ↑(valuation x)) + if y = 0 then ⊤ else ↑(valuation y)

Next tactic:
by_cases hy : y = 0