Theorem: Zsqrtd.norm_eq_zero_iff
File: Mathlib/NumberTheory/Zsqrtd/Basic.lean

tactic: constructor
state_before: d✝ d : ℤ
hd : d < 0
z : ℤ√d
⊢ z.norm = 0 ↔ z = 0
state_after: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
⊢ z.norm = 0 → z = 0

case mpr
d✝ d : ℤ
hd : d < 0
z : ℤ√d
⊢ z = 0 → z.norm = 0

tactic: intro h
state_before: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
⊢ z.norm = 0 → z = 0
state_after: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.norm = 0
⊢ z = 0

tactic: rw [norm_def, sub_eq_add_neg, mul_assoc] at h
state_before: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.norm = 0
⊢ z = 0
state_after: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
⊢ z = 0

tactic: have left := mul_self_nonneg z.re
state_before: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
⊢ z = 0
state_after: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
⊢ z = 0

tactic: have right := neg_nonneg.mpr (mul_nonpos_of_nonpos_of_nonneg hd.le (mul_self_nonneg z.im))
state_before: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
⊢ z = 0
state_after: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
⊢ z = 0

tactic: obtain ⟨ha, hb⟩ := (add_eq_zero_iff' left right).mp h
state_before: case mp
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
⊢ z = 0
state_after: case mp.intro
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : -(d * (z.im * z.im)) = 0
⊢ z = 0

tactic: ext <;> apply eq_zero_of_mul_self_eq_zero
state_before: case mp.intro
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : -(d * (z.im * z.im)) = 0
⊢ z = 0
state_after: case mp.intro.re.h
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : -(d * (z.im * z.im)) = 0
⊢ z.re * z.re = 0

case mp.intro.im.h
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : -(d * (z.im * z.im)) = 0
⊢ z.im * z.im = 0

tactic: exact ha
state_before: case mp.intro.re.h
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : -(d * (z.im * z.im)) = 0
⊢ z.re * z.re = 0
state_after: no goals

tactic: rw [neg_eq_zero, mul_eq_zero] at hb
state_before: case mp.intro.im.h
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : -(d * (z.im * z.im)) = 0
⊢ z.im * z.im = 0
state_after: case mp.intro.im.h
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : d = 0 ∨ z.im * z.im = 0
⊢ z.im * z.im = 0

tactic: exact hb.resolve_left hd.ne
state_before: case mp.intro.im.h
d✝ d : ℤ
hd : d < 0
z : ℤ√d
h : z.re * z.re + -(d * (z.im * z.im)) = 0
left : 0 ≤ z.re * z.re
right : 0 ≤ -(d * (z.im * z.im))
ha : z.re * z.re = 0
hb : d = 0 ∨ z.im * z.im = 0
⊢ z.im * z.im = 0
state_after: no goals

tactic: rintro rfl
state_before: case mpr
d✝ d : ℤ
hd : d < 0
z : ℤ√d
⊢ z = 0 → z.norm = 0
state_after: case mpr
d✝ d : ℤ
hd : d < 0
⊢ norm 0 = 0

tactic: exact norm_zero
state_before: case mpr
d✝ d : ℤ
hd : d < 0
⊢ norm 0 = 0
state_after: no goals