Theorem: padicNorm.add_eq_max_of_ne
File: Mathlib/NumberTheory/Padics/PadicNorm.lean

Proof steps:
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
state_after: case inr
p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
this :
  ∀ {p : ℕ} [hp : Fact (Nat.Prime p)] {q r : ℚ},
    padicNorm p q ≠ padicNorm p r →
      padicNorm p r < padicNorm p q → padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
hlt : ¬padicNorm p r < padicNorm p q
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)

p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
tactic: wlog hlt : padicNorm p r < padicNorm p q
state_before: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
state_after: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
tactic: have : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r) :=
    calc
      padicNorm p q = padicNorm p (q + r + (-r)) := by ring_nf
      _ ≤ max (padicNorm p (q + r)) (padicNorm p (-r)) := padicNorm.nonarchimedean
      _ = max (padicNorm p (q + r)) (padicNorm p r) := by simp
state_before: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
state_after: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
hnge : padicNorm p r ≤ padicNorm p (q + r)
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
tactic: have hnge : padicNorm p r ≤ padicNorm p (q + r) := by
    apply le_of_not_gt
    intro hgt
    rw [max_eq_right_of_lt hgt] at this
    exact not_lt_of_ge this hlt
state_before: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
hnge : padicNorm p r ≤ padicNorm p (q + r)
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
state_after: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
hnge : padicNorm p r ≤ padicNorm p (q + r)
this : padicNorm p q ≤ padicNorm p (q + r)
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
tactic: have : padicNorm p q ≤ padicNorm p (q + r) := by rwa [max_eq_left hnge] at this
state_before: p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
hnge : padicNorm p r ≤ padicNorm p (q + r)
this : padicNorm p q ≤ padicNorm p (q + r)
⊢ padicNorm p (q + r) = max (padicNorm p q) (padicNorm p r)
state_after: case a
p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
hnge : padicNorm p r ≤ padicNorm p (q + r)
this : padicNorm p q ≤ padicNorm p (q + r)
⊢ padicNorm p (q + r) ≤ max (padicNorm p q) (padicNorm p r)

case a
p✝ p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hne : padicNorm p q ≠ padicNorm p r
hlt : padicNorm p r < padicNorm p q
this✝ : padicNorm p q ≤ max (padicNorm p (q + r)) (padicNorm p r)
hnge : padicNorm p r ≤ padicNorm p (q + r)
this : padicNorm p q ≤ padicNorm p (q + r)
⊢ max (padicNorm p q) (padicNorm p r) ≤ padicNorm p (q + r)
tactic: apply _root_.le_antisymm