[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
⊢ prod (map (fun r => X + ↑C r) s) = ∑ j in Finset.range (↑card s + 1), ↑C (esymm s j) * X ^ (↑card s - j)
[PROOFSTEP]
classical
rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind,
  Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
intro _ _
rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
intro s ht
rw [mem_powersetLen] at ht
dsimp
rw [prod_hom' s (Polynomial.C : R →+* R[X])]
simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
⊢ prod (map (fun r => X + ↑C r) s) = ∑ j in Finset.range (↑card s + 1), ↑C (esymm s j) * X ^ (↑card s - j)
[PROOFSTEP]
rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind,
  Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
⊢ ∀ (x : ℕ),
    x ∈ range (↑card s + 1) →
      sum
          (map ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s - t, t))
            (powersetLen x s)) =
        ↑C (esymm s x) * X ^ (↑card s - x)
[PROOFSTEP]
intro _ _
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s + 1)
⊢ sum
      (map ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s - t, t))
        (powersetLen x✝ s)) =
    ↑C (esymm s x✝) * X ^ (↑card s - x✝)
[PROOFSTEP]
rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s + 1)
⊢ ∀ (x : Multiset R),
    x ∈ powersetLen x✝ s →
      ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s - t, t)) x =
        ↑C (prod x) * X ^ (↑card s - x✝)
[PROOFSTEP]
intro s ht
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ∈ powersetLen x✝ s✝
⊢ ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s✝ - t, t)) s =
    ↑C (prod s) * X ^ (↑card s✝ - x✝)
[PROOFSTEP]
rw [mem_powersetLen] at ht
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ≤ s✝ ∧ ↑card s = x✝
⊢ ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s✝ - t, t)) s =
    ↑C (prod s) * X ^ (↑card s✝ - x✝)
[PROOFSTEP]
dsimp
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ≤ s✝ ∧ ↑card s = x✝
⊢ prod (map (fun r => X) (s✝ - s)) * prod (map (fun r => ↑C r) s) = ↑C (prod s) * X ^ (↑card s✝ - x✝)
[PROOFSTEP]
rw [prod_hom' s (Polynomial.C : R →+* R[X])]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ≤ s✝ ∧ ↑card s = x✝
⊢ prod (map (fun r => X) (s✝ - s)) * ↑C (prod (map (fun r => r) s)) = ↑C (prod s) * X ^ (↑card s✝ - x✝)
[PROOFSTEP]
simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ coeff (prod (map (fun r => X + ↑C r) s)) k = esymm s (↑card s - k)
[PROOFSTEP]
convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ esymm s (↑card s - k) = coeff (∑ j in Finset.range (↑card s + 1), ↑C (esymm s j) * X ^ (↑card s - j)) k
[PROOFSTEP]
simp_rw [finset_sum_coeff, coeff_C_mul_X_pow]
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ esymm s (↑card s - k) = ∑ x in Finset.range (↑card s + 1), if k = ↑card s - x then esymm s x else 0
[PROOFSTEP]
rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _]
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ esymm s (↑card s - k) = if k = ↑card s - (↑card s - k) then esymm s (↑card s - k) else 0
[PROOFSTEP]
rw [if_pos (Nat.sub_sub_self h).symm]
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ ∀ (b : (fun x => ℕ) s),
    b ∈ Finset.range (↑card s + 1) → b ≠ ↑card s - k → (if k = ↑card s - b then esymm s b else 0) = 0
[PROOFSTEP]
intro j hj1 hj2
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
j : ℕ
hj1 : j ∈ Finset.range (↑card s + 1)
hj2 : j ≠ ↑card s - k
⊢ (if k = ↑card s - j then esymm s j else 0) = 0
[PROOFSTEP]
suffices k ≠ card s - j by rw [if_neg this]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
j : ℕ
hj1 : j ∈ Finset.range (↑card s + 1)
hj2 : j ≠ ↑card s - k
this : k ≠ ↑card s - j
⊢ (if k = ↑card s - j then esymm s j else 0) = 0
[PROOFSTEP]
rw [if_neg this]
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
j : ℕ
hj1 : j ∈ Finset.range (↑card s + 1)
hj2 : j ≠ ↑card s - k
⊢ k ≠ ↑card s - j
[PROOFSTEP]
intro hn
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
j : ℕ
hj1 : j ∈ Finset.range (↑card s + 1)
hj2 : j ≠ ↑card s - k
hn : k = ↑card s - j
⊢ False
[PROOFSTEP]
rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
j : ℕ
hj1 : j ∈ Finset.range (↑card s + 1)
hj2 : j ≠ j
hn : k = ↑card s - j
⊢ False
[PROOFSTEP]
exact Ne.irrefl hj2
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ ↑card s - k ∈ Finset.range (↑card s + 1)
[PROOFSTEP]
rw [Finset.mem_range]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ ↑card s - k < ↑card s + 1
[PROOFSTEP]
exact Nat.sub_lt_succ (Multiset.card s) k
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
σ : Type u_2
s : Multiset σ
r : σ → R
k : ℕ
h : k ≤ ↑card s
⊢ coeff (prod (map (fun i => X + ↑C (r i)) s)) k = esymm (map r s) (↑card s - k)
[PROOFSTEP]
erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
σ : Type u_2
s : Multiset σ
r : σ → R
k : ℕ
h : k ≤ ↑card s
⊢ esymm (map r s) (↑card (map r s) - k) = esymm (map r s) (↑card s - k)
[PROOFSTEP]
rw [s.card_map r]
[GOAL]
case h
R : Type u_1
inst✝ : CommSemiring R
σ : Type u_2
s : Multiset σ
r : σ → R
k : ℕ
h : k ≤ ↑card s
⊢ k ≤ ↑card (map r s)
[PROOFSTEP]
rw [s.card_map r]
[GOAL]
case h
R : Type u_1
inst✝ : CommSemiring R
σ : Type u_2
s : Multiset σ
r : σ → R
k : ℕ
h : k ≤ ↑card s
⊢ k ≤ ↑card s
[PROOFSTEP]
assumption
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
σ : Type u_2
s : Finset σ
r : σ → R
k : ℕ
h : k ≤ Finset.card s
⊢ coeff (∏ i in s, (X + ↑C (r i))) k = ∑ t in Finset.powersetLen (Finset.card s - k) s, ∏ i in t, r i
[PROOFSTEP]
rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val]
[GOAL]
R : Type u_1
inst✝ : CommSemiring R
σ : Type u_2
s : Finset σ
r : σ → R
k : ℕ
h : k ≤ Finset.card s
⊢ ∑ t in Finset.powersetLen (↑card s.val - k) s, Finset.prod t r =
    ∑ t in Finset.powersetLen (Finset.card s - k) s, ∏ i in t, r i
[PROOFSTEP]
rfl
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
⊢ esymm (map Neg.neg s) k = (-1) ^ k * esymm s k
[PROOFSTEP]
rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetLen_map, Multiset.map_map, map_congr (Eq.refl _)]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
⊢ ∀ (x : Multiset R), x ∈ powersetLen k s → (prod ∘ map Neg.neg) x = (-1) ^ k * prod x
[PROOFSTEP]
intro x hx
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
x : Multiset R
hx : x ∈ powersetLen k s
⊢ (prod ∘ map Neg.neg) x = (-1) ^ k * prod x
[PROOFSTEP]
rw [(mem_powersetLen.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
x : Multiset R
hx : x ∈ powersetLen k s
⊢ (prod ∘ map Neg.neg) x = prod (map (Function.const R (-1)) x) * prod x
[PROOFSTEP]
nth_rw 3 [← map_id' x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
x : Multiset R
hx : x ∈ powersetLen k s
⊢ (prod ∘ map Neg.neg) x = prod (map (Function.const R (-1)) x) * prod (map (fun x => x) x)
[PROOFSTEP]
rw [← prod_map_mul, map_congr (Eq.refl _)]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
x : Multiset R
hx : x ∈ powersetLen k s
⊢ (prod ∘ map Neg.neg) x = prod (map ?m.852287 x)
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
x : Multiset R
hx : x ∈ powersetLen k s
⊢ ∀ (x_1 : R), x_1 ∈ x → Function.const R (-1) x_1 * x_1 = ?m.852287 x_1
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetLen k s ⊢ R → R
[PROOFSTEP]
rfl
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
x : Multiset R
hx : x ∈ powersetLen k s
⊢ ∀ (x_1 : R), x_1 ∈ x → Function.const R (-1) x_1 * x_1 = -x_1
[PROOFSTEP]
exact fun z _ => neg_one_mul z
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
⊢ prod (map (fun t => X - ↑C t) s) = ∑ j in Finset.range (↑card s + 1), (-1) ^ j * (↑C (esymm s j) * X ^ (↑card s - j))
[PROOFSTEP]
conv_lhs =>
  congr
  congr
  ext x
  rw [sub_eq_add_neg]
  rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
| prod (map (fun t => X - ↑C t) s)
[PROOFSTEP]
  congr
  congr
  ext x
  rw [sub_eq_add_neg]
  rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
| prod (map (fun t => X - ↑C t) s)
[PROOFSTEP]
  congr
  congr
  ext x
  rw [sub_eq_add_neg]
  rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
| prod (map (fun t => X - ↑C t) s)
[PROOFSTEP]
congr
[GOAL]
case a
R : Type u_1
inst✝ : CommRing R
s : Multiset R
| map (fun t => X - ↑C t) s
[PROOFSTEP]
congr
[GOAL]
case a.f
R : Type u_1
inst✝ : CommRing R
s : Multiset R
| fun t => X - ↑C t
case a.s R : Type u_1 inst✝ : CommRing R s : Multiset R | s
[PROOFSTEP]
ext x
[GOAL]
case a.f.h
R : Type u_1
inst✝ : CommRing R
s : Multiset R
x : R
| X - ↑C x
case a.s R : Type u_1 inst✝ : CommRing R s : Multiset R | s
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
case a.f.h
R : Type u_1
inst✝ : CommRing R
s : Multiset R
x : R
| X + -↑C x
case a.s R : Type u_1 inst✝ : CommRing R s : Multiset R | s
[PROOFSTEP]
rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
⊢ prod (map (fun x => X + ↑C (-x)) s) =
    ∑ j in Finset.range (↑card s + 1), (-1) ^ j * (↑C (esymm s j) * X ^ (↑card s - j))
[PROOFSTEP]
convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1
[GOAL]
case h.e'_2
R : Type u_1
inst✝ : CommRing R
s : Multiset R
⊢ prod (map (fun x => X + ↑C (-x)) s) = prod (map (fun r => X + ↑C r) (map (fun t => -t) s))
[PROOFSTEP]
rw [map_map]
[GOAL]
case h.e'_2
R : Type u_1
inst✝ : CommRing R
s : Multiset R
⊢ prod (map (fun x => X + ↑C (-x)) s) = prod (map ((fun r => X + ↑C r) ∘ fun t => -t) s)
[PROOFSTEP]
rfl
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommRing R
s : Multiset R
⊢ ∑ j in Finset.range (↑card s + 1), (-1) ^ j * (↑C (esymm s j) * X ^ (↑card s - j)) =
    ∑ j in Finset.range (↑card (map (fun t => -t) s) + 1),
      ↑C (esymm (map (fun t => -t) s) j) * X ^ (↑card (map (fun t => -t) s) - j)
[PROOFSTEP]
simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ coeff (prod (map (fun t => X - ↑C t) s)) k = (-1) ^ (↑card s - k) * esymm s (↑card s - k)
[PROOFSTEP]
conv_lhs =>
  congr
  congr
  congr
  ext x
  rw [sub_eq_add_neg]
  rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| coeff (prod (map (fun t => X - ↑C t) s)) k
[PROOFSTEP]
  congr
  congr
  congr
  ext x
  rw [sub_eq_add_neg]
  rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| coeff (prod (map (fun t => X - ↑C t) s)) k
[PROOFSTEP]
  congr
  congr
  congr
  ext x
  rw [sub_eq_add_neg]
  rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| coeff (prod (map (fun t => X - ↑C t) s)) k
[PROOFSTEP]
congr
[GOAL]
case a
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| prod (map (fun t => X - ↑C t) s)
case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ ↑card s | k
[PROOFSTEP]
congr
[GOAL]
case a.a
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| map (fun t => X - ↑C t) s
case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ ↑card s | k
[PROOFSTEP]
congr
[GOAL]
case a.a.f
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| fun t => X - ↑C t
case a.a.s
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| s
case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ ↑card s | k
[PROOFSTEP]
ext x
[GOAL]
case a.a.f.h
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
x : R
| X - ↑C x
case a.a.s
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| s
case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ ↑card s | k
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
case a.a.f.h
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
x : R
| X + -↑C x
case a.a.s
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
| s
case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ ↑card s | k
[PROOFSTEP]
rw [← map_neg C x]
[GOAL]
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ coeff (prod (map (fun x => X + ↑C (-x)) s)) k = (-1) ^ (↑card s - k) * esymm s (↑card s - k)
[PROOFSTEP]
convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1
[GOAL]
case h.e'_2
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ coeff (prod (map (fun x => X + ↑C (-x)) s)) k =
    coeff (prod (map (fun r => X + ↑C r) (map (fun t => -t) s))) ?convert_1
[PROOFSTEP]
rw [map_map]
[GOAL]
case h.e'_2
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ coeff (prod (map (fun x => X + ↑C (-x)) s)) k = coeff (prod (map ((fun r => X + ↑C r) ∘ fun t => -t) s)) ?convert_1
case convert_1 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ ↑card s ⊢ ℕ
[PROOFSTEP]
rfl
[GOAL]
case h.e'_3
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ (-1) ^ (↑card s - k) * esymm s (↑card s - k) = esymm (map (fun t => -t) s) (↑card (map (fun t => -t) s) - k)
[PROOFSTEP]
rw [esymm_neg, card_map]
[GOAL]
case convert_2
R : Type u_1
inst✝ : CommRing R
s : Multiset R
k : ℕ
h : k ≤ ↑card s
⊢ k ≤ ↑card (map (fun t => -t) s)
[PROOFSTEP]
rwa [card_map]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
⊢ coeff p k = leadingCoeff p * (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
[PROOFSTEP]
conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
| coeff p k
[PROOFSTEP]
rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
| coeff p k
[PROOFSTEP]
rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
| coeff p k
[PROOFSTEP]
rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
⊢ coeff (↑C (leadingCoeff p) * prod (map (fun a => X - ↑C a) (roots p))) k =
    leadingCoeff p * (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
[PROOFSTEP]
rw [coeff_C_mul, mul_assoc]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
⊢ leadingCoeff p * coeff (prod (map (fun a => X - ↑C a) (roots p))) k =
    leadingCoeff p * ((-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k))
[PROOFSTEP]
congr
[GOAL]
case e_a
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
⊢ coeff (prod (map (fun a => X - ↑C a) (roots p))) k = (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
[PROOFSTEP]
have : k ≤ card (roots p) := by rw [hroots]; exact h
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
⊢ k ≤ ↑card (roots p)
[PROOFSTEP]
rw [hroots]
[GOAL]
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
⊢ k ≤ natDegree p
[PROOFSTEP]
exact h
[GOAL]
case e_a
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
this : k ≤ ↑card (roots p)
⊢ coeff (prod (map (fun a => X - ↑C a) (roots p))) k = (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
[PROOFSTEP]
convert p.roots.prod_X_sub_C_coeff this using 3
[GOAL]
case h.e'_3.h.e'_5.h.e'_6
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
this : k ≤ ↑card (roots p)
⊢ natDegree p - k = ↑card (roots p) - k
[PROOFSTEP]
rw [hroots]
[GOAL]
case h.e'_3.h.e'_6.h.e'_4
R : Type u_1
inst✝¹ : CommRing R
inst✝ : IsDomain R
p : R[X]
hroots : ↑card (roots p) = natDegree p
k : ℕ
h : k ≤ natDegree p
this : k ≤ ↑card (roots p)
⊢ natDegree p - k = ↑card (roots p) - k
[PROOFSTEP]
rw [hroots]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
⊢ ∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i)) =
    ∑ j in range (Fintype.card σ + 1), ↑Polynomial.C (esymm σ R j) * Polynomial.X ^ (Fintype.card σ - j)
[PROOFSTEP]
let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R)
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
⊢ ∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i)) =
    ∑ j in range (Fintype.card σ + 1), ↑Polynomial.C (esymm σ R j) * Polynomial.X ^ (Fintype.card σ - j)
[PROOFSTEP]
have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
⊢ Fintype.card σ = ↑Multiset.card s
[PROOFSTEP]
rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
this : Fintype.card σ = ↑Multiset.card s
⊢ ∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i)) =
    ∑ j in range (Fintype.card σ + 1), ↑Polynomial.C (esymm σ R j) * Polynomial.X ^ (Fintype.card σ - j)
[PROOFSTEP]
simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
this : Fintype.card σ = ↑Multiset.card s
⊢ Multiset.prod (Multiset.map (fun x => Polynomial.X + ↑Polynomial.C (X x)) univ.val) =
    ∑ x in range (↑Multiset.card (Multiset.map (fun i => X i) univ.val) + 1),
      ↑Polynomial.C (Multiset.esymm (Multiset.map X univ.val) x) *
        Polynomial.X ^ (↑Multiset.card (Multiset.map (fun i => X i) univ.val) - x)
[PROOFSTEP]
convert Multiset.prod_X_add_C_eq_sum_esymm s
[GOAL]
case h.e'_2.h.e'_3
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
this : Fintype.card σ = ↑Multiset.card s
⊢ Multiset.map (fun x => Polynomial.X + ↑Polynomial.C (X x)) univ.val =
    Multiset.map (fun r => Polynomial.X + ↑Polynomial.C r) s
[PROOFSTEP]
simp_rw [Multiset.map_map, Function.comp_apply]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
h : k ≤ Fintype.card σ
⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i))) k = esymm σ R (Fintype.card σ - k)
[PROOFSTEP]
let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R)
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
h : k ≤ Fintype.card σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i))) k = esymm σ R (Fintype.card σ - k)
[PROOFSTEP]
have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
h : k ≤ Fintype.card σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
⊢ Fintype.card σ = ↑Multiset.card s
[PROOFSTEP]
rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
h : k ≤ Fintype.card σ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
this : Fintype.card σ = ↑Multiset.card s
⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i))) k = esymm σ R (Fintype.card σ - k)
[PROOFSTEP]
rw [this] at h ⊢
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
h : k ≤ ↑Multiset.card s
this : Fintype.card σ = ↑Multiset.card s
⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + ↑Polynomial.C (X i))) k = esymm σ R (↑Multiset.card s - k)
[PROOFSTEP]
rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
[GOAL]
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
h : k ≤ ↑Multiset.card s
this : Fintype.card σ = ↑Multiset.card s
⊢ Polynomial.coeff (Multiset.prod (Multiset.map (fun i => Polynomial.X + ↑Polynomial.C (X i)) univ.val)) k =
    Multiset.esymm (Multiset.map X univ.val) (↑Multiset.card s - k)
[PROOFSTEP]
convert Multiset.prod_X_add_C_coeff s h
[GOAL]
case h.e'_2.h.e'_3.h.e'_3
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
h : k ≤ ↑Multiset.card s
this : Fintype.card σ = ↑Multiset.card s
⊢ Multiset.map (fun i => Polynomial.X + ↑Polynomial.C (X i)) univ.val =
    Multiset.map (fun r => Polynomial.X + ↑Polynomial.C r) s
[PROOFSTEP]
dsimp
[GOAL]
case h.e'_2.h.e'_3.h.e'_3
R : Type u_1
σ : Type u_2
inst✝¹ : CommSemiring R
inst✝ : Fintype σ
k : ℕ
s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val
h : k ≤ ↑Multiset.card s
this : Fintype.card σ = ↑Multiset.card s
⊢ Multiset.map (fun i => Polynomial.X + ↑Polynomial.C (X i)) univ.val =
    Multiset.map (fun r => Polynomial.X + ↑Polynomial.C r) (Multiset.map (fun i => X i) univ.val)
[PROOFSTEP]
simp_rw [Multiset.map_map, Function.comp_apply]


[GOAL]
⊢ ∀ ⦃x : ℂ⦄, x ∈ {z | z.im ∈ Ioo (-π) π} → exp x ∈ {z | 0 < z.re} ∪ {z | z.im ≠ 0}
[PROOFSTEP]
rintro ⟨x, y⟩ ⟨h₁ : -π < y, h₂ : y < π⟩
[GOAL]
case mk.intro
x y : ℝ
h₁ : -π < y
h₂ : y < π
⊢ exp { re := x, im := y } ∈ {z | 0 < z.re} ∪ {z | z.im ≠ 0}
[PROOFSTEP]
refine' (not_or_of_imp fun hz => _).symm
[GOAL]
case mk.intro
x y : ℝ
h₁ : -π < y
h₂ : y < π
hz : (exp { re := x, im := y }).im = 0
⊢ exp { re := x, im := y } ∈ {z | 0 < z.re}
[PROOFSTEP]
obtain rfl : y = 0 := by
  rw [exp_im] at hz
  simpa [(Real.exp_pos _).ne', Real.sin_eq_zero_iff_of_lt_of_lt h₁ h₂] using hz
[GOAL]
x y : ℝ
h₁ : -π < y
h₂ : y < π
hz : (exp { re := x, im := y }).im = 0
⊢ y = 0
[PROOFSTEP]
rw [exp_im] at hz
[GOAL]
x y : ℝ
h₁ : -π < y
h₂ : y < π
hz : Real.exp { re := x, im := y }.re * Real.sin { re := x, im := y }.im = 0
⊢ y = 0
[PROOFSTEP]
simpa [(Real.exp_pos _).ne', Real.sin_eq_zero_iff_of_lt_of_lt h₁ h₂] using hz
[GOAL]
case mk.intro
x : ℝ
h₁ : -π < 0
h₂ : 0 < π
hz : (exp { re := x, im := 0 }).im = 0
⊢ exp { re := x, im := 0 } ∈ {z | 0 < z.re}
[PROOFSTEP]
rw [mem_setOf_eq, ← ofReal_def, exp_ofReal_re]
[GOAL]
case mk.intro
x : ℝ
h₁ : -π < 0
h₂ : 0 < π
hz : (exp { re := x, im := 0 }).im = 0
⊢ 0 < Real.exp x
[PROOFSTEP]
exact Real.exp_pos x
[GOAL]
z : ℂ
h : z ∈ {z | 0 < z.re} ∪ {z | z.im ≠ 0}
⊢ log z ∈ {z | z.im ∈ Ioo (-π) π}
[PROOFSTEP]
simp only [mem_setOf, log_im, mem_Ioo, neg_pi_lt_arg, arg_lt_pi_iff, true_and]
[GOAL]
z : ℂ
h : z ∈ {z | 0 < z.re} ∪ {z | z.im ≠ 0}
⊢ 0 ≤ z.re ∨ z.im ≠ 0
[PROOFSTEP]
exact h.imp_left le_of_lt
[GOAL]
x : ℂ
hx : x ∈ {z | 0 < z.re} ∪ {z | z.im ≠ 0}
⊢ x ≠ 0
[PROOFSTEP]
rintro rfl
[GOAL]
hx : 0 ∈ {z | 0 < z.re} ∪ {z | z.im ≠ 0}
⊢ False
[PROOFSTEP]
simp [lt_irrefl] at hx
[GOAL]
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ x ≠ 0
[PROOFSTEP]
rintro rfl
[GOAL]
h : 0 < 0.re ∨ 0.im ≠ 0
⊢ False
[PROOFSTEP]
simp [lt_irrefl] at h
[GOAL]
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
h0 : x ≠ 0
⊢ HasStrictDerivAt (↑expLocalHomeomorph) x (↑(LocalHomeomorph.symm expLocalHomeomorph) x)
[PROOFSTEP]
simpa [exp_log h0] using hasStrictDerivAt_exp (log x)
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ → ℂ
f' x : ℂ
h₁ : HasStrictDerivAt f f' x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasStrictDerivAt (fun t => log (f t)) (f' / f x) x
[PROOFSTEP]
rw [div_eq_inv_mul]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ → ℂ
f' x : ℂ
h₁ : HasStrictDerivAt f f' x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasStrictDerivAt (fun t => log (f t)) ((f x)⁻¹ * f') x
[PROOFSTEP]
exact (hasStrictDerivAt_log h₂).comp x h₁
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℝ → ℂ
x : ℝ
f' : ℂ
h₁ : HasStrictDerivAt f f' x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasStrictDerivAt (fun t => log (f t)) (f' / f x) x
[PROOFSTEP]
simpa only [div_eq_inv_mul] using (hasStrictFDerivAt_log_real h₂).comp_hasStrictDerivAt x h₁
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ → ℂ
f' x : ℂ
h₁ : HasDerivAt f f' x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasDerivAt (fun t => log (f t)) (f' / f x) x
[PROOFSTEP]
rw [div_eq_inv_mul]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ → ℂ
f' x : ℂ
h₁ : HasDerivAt f f' x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasDerivAt (fun t => log (f t)) ((f x)⁻¹ * f') x
[PROOFSTEP]
exact (hasStrictDerivAt_log h₂).hasDerivAt.comp x h₁
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℝ → ℂ
x : ℝ
f' : ℂ
h₁ : HasDerivAt f f' x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasDerivAt (fun t => log (f t)) (f' / f x) x
[PROOFSTEP]
simpa only [div_eq_inv_mul] using (hasStrictFDerivAt_log_real h₂).hasFDerivAt.comp_hasDerivAt x h₁
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ → ℂ
f' x : ℂ
s : Set ℂ
h₁ : HasDerivWithinAt f f' s x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasDerivWithinAt (fun t => log (f t)) (f' / f x) s x
[PROOFSTEP]
rw [div_eq_inv_mul]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ → ℂ
f' x : ℂ
s : Set ℂ
h₁ : HasDerivWithinAt f f' s x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasDerivWithinAt (fun t => log (f t)) ((f x)⁻¹ * f') s x
[PROOFSTEP]
exact (hasStrictDerivAt_log h₂).hasDerivAt.comp_hasDerivWithinAt x h₁
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℝ → ℂ
s : Set ℝ
x : ℝ
f' : ℂ
h₁ : HasDerivWithinAt f f' s x
h₂ : 0 < (f x).re ∨ (f x).im ≠ 0
⊢ HasDerivWithinAt (fun t => log (f t)) (f' / f x) s x
[PROOFSTEP]
simpa only [div_eq_inv_mul] using (hasStrictFDerivAt_log_real h₂).hasFDerivAt.comp_hasDerivWithinAt x h₁


[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
inst✝¹ : DivisionRing K
a b : K
A : Type u_4
inst✝ : DivisionRing A
m : ℚ
⊢ m • 1 = ↑m
[PROOFSTEP]
rw [Rat.smul_def, mul_one]
[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Semiring R
h : IsField R
src✝ : Semiring R := inst✝
a : R
ha : a ≠ 0
⊢ a * a⁻¹ = 1
[PROOFSTEP]
convert Classical.choose_spec (IsField.mul_inv_cancel h ha)
[GOAL]
case h.e'_2.h.e'_6
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Semiring R
h : IsField R
src✝ : Semiring R := inst✝
a : R
ha : a ≠ 0
⊢ a⁻¹ = choose (_ : ∃ b, a * b = 1)
[PROOFSTEP]
exact dif_neg ha
[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
⊢ ∀ (x : R), x ≠ 0 → ∃! y, x * y = 1
[PROOFSTEP]
intro x hx
[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
⊢ ∃! y, x * y = 1
[PROOFSTEP]
apply exists_unique_of_exists_of_unique
[GOAL]
case hex
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
⊢ ∃ x_1, x * x_1 = 1
[PROOFSTEP]
exact hf.mul_inv_cancel hx
[GOAL]
case hunique
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
⊢ ∀ (y₁ y₂ : R), x * y₁ = 1 → x * y₂ = 1 → y₁ = y₂
[PROOFSTEP]
intro y z hxy hxz
[GOAL]
case hunique
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
y z : R
hxy : x * y = 1
hxz : x * z = 1
⊢ y = z
[PROOFSTEP]
calc
  y = y * (x * z) := by rw [hxz, mul_one]
  _ = x * y * z := by rw [← mul_assoc, hf.mul_comm y x]
  _ = z := by rw [hxy, one_mul]
[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
y z : R
hxy : x * y = 1
hxz : x * z = 1
⊢ y = y * (x * z)
[PROOFSTEP]
rw [hxz, mul_one]
[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
y z : R
hxy : x * y = 1
hxz : x * z = 1
⊢ y * (x * z) = x * y * z
[PROOFSTEP]
rw [← mul_assoc, hf.mul_comm y x]
[GOAL]
α : Type u_1
β : Type u_2
K : Type u_3
R : Type u
inst✝ : Ring R
hf : IsField R
x : R
hx : x ≠ 0
y z : R
hxy : x * y = 1
hxz : x * z = 1
⊢ x * y * z = z
[PROOFSTEP]
rw [hxy, one_mul]


[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
n : ℕ
l : List α
⊢ countp.go p l n = n + countp.go p l 0
[PROOFSTEP]
induction' l with head tail ih generalizing n
[GOAL]
case nil
α : Type u_1
l : List α
p q : α → Bool
n✝ n : ℕ
⊢ countp.go p [] n = n + countp.go p [] 0
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
l : List α
p q : α → Bool
n✝ : ℕ
head : α
tail : List α
ih : ∀ {n : ℕ}, countp.go p tail n = n + countp.go p tail 0
n : ℕ
⊢ countp.go p (head :: tail) n = n + countp.go p (head :: tail) 0
[PROOFSTEP]
unfold countp.go
[GOAL]
case cons
α : Type u_1
l : List α
p q : α → Bool
n✝ : ℕ
head : α
tail : List α
ih : ∀ {n : ℕ}, countp.go p tail n = n + countp.go p tail 0
n : ℕ
⊢ (bif p head then countp.go p tail (n + 1) else countp.go p tail n) =
    n + bif p head then countp.go p tail (0 + 1) else countp.go p tail 0
[PROOFSTEP]
rw [ih (n := n + 1), ih (n := n), ih (n := 1)]
[GOAL]
case cons
α : Type u_1
l : List α
p q : α → Bool
n✝ : ℕ
head : α
tail : List α
ih : ∀ {n : ℕ}, countp.go p tail n = n + countp.go p tail 0
n : ℕ
⊢ (bif p head then n + 1 + countp.go p tail 0 else n + countp.go p tail 0) =
    n + bif p head then 1 + countp.go p tail 0 else countp.go p tail 0
[PROOFSTEP]
by_cases h : p head
[GOAL]
case pos
α : Type u_1
l : List α
p q : α → Bool
n✝ : ℕ
head : α
tail : List α
ih : ∀ {n : ℕ}, countp.go p tail n = n + countp.go p tail 0
n : ℕ
h : p head = true
⊢ (bif p head then n + 1 + countp.go p tail 0 else n + countp.go p tail 0) =
    n + bif p head then 1 + countp.go p tail 0 else countp.go p tail 0
[PROOFSTEP]
simp [h, add_assoc]
[GOAL]
case neg
α : Type u_1
l : List α
p q : α → Bool
n✝ : ℕ
head : α
tail : List α
ih : ∀ {n : ℕ}, countp.go p tail n = n + countp.go p tail 0
n : ℕ
h : ¬p head = true
⊢ (bif p head then n + 1 + countp.go p tail 0 else n + countp.go p tail 0) =
    n + bif p head then 1 + countp.go p tail 0 else countp.go p tail 0
[PROOFSTEP]
simp [h]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : p a = true
⊢ countp p (a :: l) = countp p l + 1
[PROOFSTEP]
have : countp.go p (a :: l) 0 = countp.go p l 1
[GOAL]
case this
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : p a = true
⊢ countp.go p (a :: l) 0 = countp.go p l 1
[PROOFSTEP]
change (bif _ then _ else _) = countp.go _ _ _
[GOAL]
case this
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : p a = true
⊢ (bif p a then countp.go p l (0 + 1) else countp.go p l 0) = countp.go p l 1
[PROOFSTEP]
rw [pa]
[GOAL]
case this
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : p a = true
⊢ (bif true then countp.go p l (0 + 1) else countp.go p l 0) = countp.go p l 1
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : p a = true
this : countp.go p (a :: l) 0 = countp.go p l 1
⊢ countp p (a :: l) = countp p l + 1
[PROOFSTEP]
unfold countp
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : p a = true
this : countp.go p (a :: l) 0 = countp.go p l 1
⊢ countp.go p (a :: l) 0 = countp.go p l 0 + 1
[PROOFSTEP]
rw [this, add_comm, List.countp_go_eq_add]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : ¬p a = true
⊢ countp p (a :: l) = countp p l
[PROOFSTEP]
change (bif _ then _ else _) = countp.go _ _ _
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : ¬p a = true
⊢ (bif p a then countp.go p l (0 + 1) else countp.go p l 0) = countp.go p l 0
[PROOFSTEP]
rw [Bool.of_not_eq_true pa]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
pa : ¬p a = true
⊢ (bif false then countp.go p l (0 + 1) else countp.go p l 0) = countp.go p l 0
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
⊢ countp p (a :: l) = countp p l + if p a = true then 1 else 0
[PROOFSTEP]
by_cases h : p a
[GOAL]
case pos
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
h : p a = true
⊢ countp p (a :: l) = countp p l + if p a = true then 1 else 0
[PROOFSTEP]
simp [h]
[GOAL]
case neg
α : Type u_1
l✝ : List α
p q : α → Bool
a : α
l : List α
h : ¬p a = true
⊢ countp p (a :: l) = countp p l + if p a = true then 1 else 0
[PROOFSTEP]
simp [h]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
l : List α
⊢ length l = countp p l + countp (fun a => decide ¬p a = true) l
[PROOFSTEP]
induction' l with x h ih
[GOAL]
case nil
α : Type u_1
l : List α
p q : α → Bool
⊢ length [] = countp p [] + countp (fun a => decide ¬p a = true) []
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
l : List α
p q : α → Bool
x : α
h : List α
ih : length h = countp p h + countp (fun a => decide ¬p a = true) h
⊢ length (x :: h) = countp p (x :: h) + countp (fun a => decide ¬p a = true) (x :: h)
[PROOFSTEP]
by_cases h : p x
[GOAL]
case pos
α : Type u_1
l : List α
p q : α → Bool
x : α
h✝ : List α
ih : length h✝ = countp p h✝ + countp (fun a => decide ¬p a = true) h✝
h : p x = true
⊢ length (x :: h✝) = countp p (x :: h✝) + countp (fun a => decide ¬p a = true) (x :: h✝)
[PROOFSTEP]
rw [countp_cons_of_pos _ _ h, countp_cons_of_neg _ _ _, length, ih]
[GOAL]
case pos
α : Type u_1
l : List α
p q : α → Bool
x : α
h✝ : List α
ih : length h✝ = countp p h✝ + countp (fun a => decide ¬p a = true) h✝
h : p x = true
⊢ countp p h✝ + countp (fun a => decide ¬p a = true) h✝ + 1 = countp p h✝ + 1 + countp (fun a => decide ¬p a = true) h✝
[PROOFSTEP]
ac_rfl
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
x : α
h✝ : List α
ih : length h✝ = countp p h✝ + countp (fun a => decide ¬p a = true) h✝
h : p x = true
⊢ ¬(decide ¬p x = true) = true
[PROOFSTEP]
simp only [h]
[GOAL]
case neg
α : Type u_1
l : List α
p q : α → Bool
x : α
h✝ : List α
ih : length h✝ = countp p h✝ + countp (fun a => decide ¬p a = true) h✝
h : ¬p x = true
⊢ length (x :: h✝) = countp p (x :: h✝) + countp (fun a => decide ¬p a = true) (x :: h✝)
[PROOFSTEP]
rw [countp_cons_of_pos (fun a => ¬p a) _ _, countp_cons_of_neg _ _ h, length, ih]
[GOAL]
case neg
α : Type u_1
l : List α
p q : α → Bool
x : α
h✝ : List α
ih : length h✝ = countp p h✝ + countp (fun a => decide ¬p a = true) h✝
h : ¬p x = true
⊢ countp p h✝ + countp (fun a => decide ¬p a = true) h✝ + 1 =
    countp p h✝ + (countp (fun a => decide ¬p a = true) h✝ + 1)
[PROOFSTEP]
ac_rfl
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
x : α
h✝ : List α
ih : length h✝ = countp p h✝ + countp (fun a => decide ¬p a = true) h✝
h : ¬p x = true
⊢ (fun a => decide ¬p a = true) x = true
[PROOFSTEP]
simp only [h]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
l : List α
⊢ countp p l = length (filter p l)
[PROOFSTEP]
induction' l with x l ih
[GOAL]
case nil
α : Type u_1
l : List α
p q : α → Bool
⊢ countp p [] = length (filter p [])
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
l✝ : List α
p q : α → Bool
x : α
l : List α
ih : countp p l = length (filter p l)
⊢ countp p (x :: l) = length (filter p (x :: l))
[PROOFSTEP]
by_cases h : p x
[GOAL]
case pos
α : Type u_1
l✝ : List α
p q : α → Bool
x : α
l : List α
ih : countp p l = length (filter p l)
h : p x = true
⊢ countp p (x :: l) = length (filter p (x :: l))
[PROOFSTEP]
rw [countp_cons_of_pos p l h, ih, filter_cons_of_pos l h, length]
[GOAL]
case neg
α : Type u_1
l✝ : List α
p q : α → Bool
x : α
l : List α
ih : countp p l = length (filter p l)
h : ¬p x = true
⊢ countp p (x :: l) = length (filter p (x :: l))
[PROOFSTEP]
rw [countp_cons_of_neg p l h, ih, filter_cons_of_neg l h]
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ countp p l ≤ length l
[PROOFSTEP]
simpa only [countp_eq_length_filter] using length_filter_le _ _
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
l₁ l₂ : List α
⊢ countp p (l₁ ++ l₂) = countp p l₁ + countp p l₂
[PROOFSTEP]
simp only [countp_eq_length_filter, filter_append, length_append]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
a : List α
l : List (List α)
⊢ countp p (join (a :: l)) = sum (map (countp p) (a :: l))
[PROOFSTEP]
rw [join, countp_append, map_cons, sum_cons, countp_join l]
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ 0 < countp p l ↔ ∃ a, a ∈ l ∧ p a = true
[PROOFSTEP]
simp only [countp_eq_length_filter, length_pos_iff_exists_mem, mem_filter, exists_prop]
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ countp p l = 0 ↔ ∀ (a : α), a ∈ l → ¬p a = true
[PROOFSTEP]
rw [← not_iff_not, ← Ne.def, ← pos_iff_ne_zero, countp_pos]
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ (∃ a, a ∈ l ∧ p a = true) ↔ ¬∀ (a : α), a ∈ l → ¬p a = true
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ countp p l = length l ↔ ∀ (a : α), a ∈ l → p a = true
[PROOFSTEP]
rw [countp_eq_length_filter, filter_length_eq_length]
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
l : List α
⊢ length (filter p l) < length l ↔ ∃ x, x ∈ l ∧ ¬p x = true
[PROOFSTEP]
simpa [length_eq_countp_add_countp p l, countp_eq_length_filter] using countp_pos (fun x => ¬p x) (l := l)
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
l₁ l₂ : List α
s : l₁ <+ l₂
⊢ countp p l₁ ≤ countp p l₂
[PROOFSTEP]
simpa only [countp_eq_length_filter] using length_le_of_sublist (s.filter p)
[GOAL]
α : Type u_1
l✝ : List α
p q : α → Bool
l : List α
⊢ countp p (filter q l) = countp (fun a => decide (p a = true ∧ q a = true)) l
[PROOFSTEP]
simp only [countp_eq_length_filter, filter_filter]
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ countp (fun x => true) l = length l
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
⊢ countp (fun x => false) l = 0
[PROOFSTEP]
simp
[GOAL]
α : Type u_2
l✝ : List α
p✝ q : α → Bool
β : Type u_1
p : β → Bool
f : α → β
a : α
l : List α
⊢ countp p (map f (a :: l)) = countp (p ∘ f) (a :: l)
[PROOFSTEP]
rw [map_cons, countp_cons, countp_cons, countp_map p f l]
[GOAL]
α : Type u_2
l✝ : List α
p✝ q : α → Bool
β : Type u_1
p : β → Bool
f : α → β
a : α
l : List α
⊢ (countp (p ∘ f) l + if p (f a) = true then 1 else 0) = countp (p ∘ f) l + if (p ∘ f) a = true then 1 else 0
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
l : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l → p x = true → q x = true
⊢ countp p l ≤ countp q l
[PROOFSTEP]
induction' l with a l ihl
[GOAL]
case nil
α : Type u_1
l : List α
p q : α → Bool
h✝ : ∀ (x : α), x ∈ l → p x = true → q x = true
h : ∀ (x : α), x ∈ [] → p x = true → q x = true
⊢ countp p [] ≤ countp q []
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
l✝ : List α
p q : α → Bool
h✝ : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
h : ∀ (x : α), x ∈ a :: l → p x = true → q x = true
⊢ countp p (a :: l) ≤ countp q (a :: l)
[PROOFSTEP]
rw [forall_mem_cons] at h
[GOAL]
case cons
α : Type u_1
l✝ : List α
p q : α → Bool
h✝ : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
h : (p a = true → q a = true) ∧ ∀ (x : α), x ∈ l → p x = true → q x = true
⊢ countp p (a :: l) ≤ countp q (a :: l)
[PROOFSTEP]
cases' h with ha hl
[GOAL]
case cons.intro
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
⊢ countp p (a :: l) ≤ countp q (a :: l)
[PROOFSTEP]
rw [countp_cons, countp_cons]
[GOAL]
case cons.intro
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
⊢ (countp p l + if p a = true then 1 else 0) ≤ countp q l + if q a = true then 1 else 0
[PROOFSTEP]
refine' _root_.add_le_add (ihl hl) _
[GOAL]
case cons.intro
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
⊢ (if p a = true then 1 else 0) ≤ if q a = true then 1 else 0
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
h✝¹ : p a = true
h✝ : q a = true
⊢ 1 ≤ 1
[PROOFSTEP]
simp only [le_rfl, _root_.zero_le]
[GOAL]
case neg
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
h✝¹ : p a = true
h✝ : ¬q a = true
⊢ 1 ≤ 0
[PROOFSTEP]
simp only [le_rfl, _root_.zero_le]
[GOAL]
case pos
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
h✝¹ : ¬p a = true
h✝ : q a = true
⊢ 0 ≤ 1
[PROOFSTEP]
simp only [le_rfl, _root_.zero_le]
[GOAL]
case neg
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
h✝¹ : ¬p a = true
h✝ : ¬q a = true
⊢ 0 ≤ 0
[PROOFSTEP]
simp only [le_rfl, _root_.zero_le]
[GOAL]
case neg
α : Type u_1
l✝ : List α
p q : α → Bool
h : ∀ (x : α), x ∈ l✝ → p x = true → q x = true
a : α
l : List α
ihl : (∀ (x : α), x ∈ l → p x = true → q x = true) → countp p l ≤ countp q l
ha : p a = true → q a = true
hl : ∀ (x : α), x ∈ l → p x = true → q x = true
h✝¹ : p a = true
h✝ : ¬q a = true
⊢ False
[PROOFSTEP]
exact absurd (ha ‹_›) ‹_›
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
⊢ count a (b :: l) = count a l + if a = b then 1 else 0
[PROOFSTEP]
conv =>
  simp [count, countp_cons]
  lhs
  simp only [eq_comm]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
| count a (b :: l) = count a l + if a = b then 1 else 0
[PROOFSTEP]
  simp [count, countp_cons]
  lhs
  simp only [eq_comm]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
| count a (b :: l) = count a l + if a = b then 1 else 0
[PROOFSTEP]
  simp [count, countp_cons]
  lhs
  simp only [eq_comm]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
| count a (b :: l) = count a l + if a = b then 1 else 0
[PROOFSTEP]
simp [count, countp_cons]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
| (if b = a then 1 else 0) = if a = b then 1 else 0
[PROOFSTEP]
lhs
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
| if b = a then 1 else 0
[PROOFSTEP]
simp only [eq_comm]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
⊢ count a (b :: l) = if a = b then succ (count a l) else count a l
[PROOFSTEP]
simp [count_cons']
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
⊢ (count a l + if a = b then 1 else 0) = if a = b then succ (count a l) else count a l
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
h✝ : a = b
⊢ count a l + 1 = succ (count a l)
[PROOFSTEP]
rfl
[GOAL]
case neg
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
l : List α
h✝ : ¬a = b
⊢ count a l + 0 = count a l
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a : α
l : List α
⊢ count a (a :: l) = count a l + 1
[PROOFSTEP]
simp [count_cons']
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
h : a ≠ b
l : List α
⊢ count a (b :: l) = count a l
[PROOFSTEP]
simp [count_cons']
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
h : a ≠ b
l : List α
⊢ a = b → False
[PROOFSTEP]
exact h
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
⊢ count a (List.tail (head :: tail)) =
    count a (head :: tail) - if a = get (head :: tail) { val := 0, isLt := h } then 1 else 0
[PROOFSTEP]
rw [count_cons']
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
⊢ count a (List.tail (head :: tail)) =
    (count a tail + if a = head then 1 else 0) - if a = get (head :: tail) { val := 0, isLt := h } then 1 else 0
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
h✝¹ : a = head
h✝ : a = get (head :: tail) { val := 0, isLt := h }
⊢ count a (List.tail (head :: tail)) = count a tail + 1 - 1
[PROOFSTEP]
simp at *
[GOAL]
case neg
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
h✝¹ : a = head
h✝ : ¬a = get (head :: tail) { val := 0, isLt := h }
⊢ count a (List.tail (head :: tail)) = count a tail + 1 - 0
[PROOFSTEP]
simp at *
[GOAL]
case pos
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
h✝¹ : ¬a = head
h✝ : a = get (head :: tail) { val := 0, isLt := h }
⊢ count a (List.tail (head :: tail)) = count a tail + 0 - 1
[PROOFSTEP]
simp at *
[GOAL]
case neg
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
h✝¹ : ¬a = head
h✝ : ¬a = get (head :: tail) { val := 0, isLt := h }
⊢ count a (List.tail (head :: tail)) = count a tail + 0 - 0
[PROOFSTEP]
simp at *
[GOAL]
case neg
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
h✝¹ : a = head
h✝ : ¬a = head
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case pos
α : Type u_1
l : List α
inst✝ : DecidableEq α
head : α
tail : List α
a : α
h : 0 < length (head :: tail)
h✝¹ : ¬a = head
h✝ : a = head
⊢ count a tail = count a tail - 1
[PROOFSTEP]
contradiction
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a : α
⊢ count a [a] = 1
[PROOFSTEP]
rw [count_cons]
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a : α
⊢ (if a = a then succ (count a []) else count a []) = 1
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a b : α
⊢ count a [b] = if a = b then 1 else 0
[PROOFSTEP]
rw [count_cons]
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a b : α
⊢ (if a = b then succ (count a []) else count a []) = if a = b then 1 else 0
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a : α
l : List α
⊢ count a (concat l a) = succ (count a l)
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a : α
l : List α
⊢ 0 < count a l ↔ a ∈ l
[PROOFSTEP]
simp only [count, countp_pos, beq_iff_eq, exists_eq_right]
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a : α
⊢ count a l = length l ↔ ∀ (b : α), b ∈ l → a = b
[PROOFSTEP]
simp_rw [count, countp_eq_length, beq_iff_eq, eq_comm]
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a b : α
n : ℕ
⊢ count a (replicate n b) = if a = b then n else 0
[PROOFSTEP]
split
[GOAL]
case inl
α : Type u_1
l : List α
inst✝ : DecidableEq α
a b : α
n : ℕ
h✝ : a = b
⊢ count a (replicate n b) = n
case inr α : Type u_1 l : List α inst✝ : DecidableEq α a b : α n : ℕ h✝ : ¬a = b ⊢ count a (replicate n b) = 0
[PROOFSTEP]
exacts [‹a = b› ▸ count_replicate_self _ _, count_eq_zero.2 <| mt eq_of_mem_replicate ‹a ≠ b›]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
l : List α
a : α
⊢ filter (fun x => x == a) l = replicate (count a l) a
[PROOFSTEP]
simp only [count, countp_eq_length_filter, eq_replicate, mem_filter, beq_iff_eq]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
l : List α
a : α
⊢ True ∧ ∀ (b : α), b ∈ l ∧ b = a → b = a
[PROOFSTEP]
exact ⟨trivial, fun _ h => h.2⟩
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
l : List α
a : α
⊢ filter (fun x => decide (a = x)) l = replicate (count a l) a
[PROOFSTEP]
simpa only [eq_comm] using filter_eq' l a
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
n : ℕ
a : α
h : replicate n a <+ l
⊢ n ≤ count a l
[PROOFSTEP]
simpa only [count_replicate_self] using h.count_le a
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
⊢ count a (filter p l) = count a l
[PROOFSTEP]
rw [count, countp_filter]
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
⊢ countp (fun a_1 => decide ((a_1 == a) = true ∧ p a_1 = true)) l = countp (fun x => x == a) l
[PROOFSTEP]
congr
[GOAL]
case e_p
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
⊢ (fun a_1 => decide ((a_1 == a) = true ∧ p a_1 = true)) = fun x => x == a
[PROOFSTEP]
funext b
[GOAL]
case e_p.h
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
b : α
⊢ decide ((b == a) = true ∧ p b = true) = (b == a)
[PROOFSTEP]
rw [Bool.beq_eq_decide_eq]
[GOAL]
case e_p.h
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
b : α
⊢ decide (decide (b = a) = true ∧ p b = true) = decide (b = a)
[PROOFSTEP]
by_cases hb : b = a
[GOAL]
case pos
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
b : α
hb : b = a
⊢ decide (decide (b = a) = true ∧ p b = true) = decide (b = a)
[PROOFSTEP]
simp [hb, h]
[GOAL]
case neg
α : Type u_1
l : List α
inst✝ : DecidableEq α
p : α → Bool
a : α
h : p a = true
b : α
hb : ¬b = a
⊢ decide (decide (b = a) = true ∧ p b = true) = decide (b = a)
[PROOFSTEP]
simp [hb]
[GOAL]
α✝ : Type ?u.43925
l✝ : List α✝
inst✝¹ : DecidableEq α✝
α : Type u_1
β : Type u_2
inst✝ : DecidableEq β
l : List α
f : α → List β
x : β
⊢ count x (List.bind l f) = sum (map (count x ∘ f) l)
[PROOFSTEP]
rw [List.bind, count_join, map_map]
[GOAL]
α✝ : Type ?u.44336
l✝ : List α✝
inst✝² : DecidableEq α✝
α : Type u_1
β : Type u_2
inst✝¹ : DecidableEq α
inst✝ : DecidableEq β
l : List α
f : α → β
hf : Function.Injective f
x : α
⊢ count (f x) (map f l) = count x l
[PROOFSTEP]
simp only [count, countp_map, (· ∘ ·), hf.beq_eq]
[GOAL]
α : Type u_2
l✝ : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : DecidableEq β
l : List α
f : α → β
x : α
⊢ count x l ≤ count (f x) (map f l)
[PROOFSTEP]
rw [count, count, countp_map]
[GOAL]
α : Type u_2
l✝ : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : DecidableEq β
l : List α
f : α → β
x : α
⊢ countp (fun x_1 => x_1 == x) l ≤ countp ((fun x_1 => x_1 == f x) ∘ f) l
[PROOFSTEP]
exact countp_mono_left <| by simp (config := { contextual := true })
[GOAL]
α : Type u_2
l✝ : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : DecidableEq β
l : List α
f : α → β
x : α
⊢ ∀ (x_1 : α), x_1 ∈ l → (x_1 == x) = true → ((fun x_2 => x_2 == f x) ∘ f) x_1 = true
[PROOFSTEP]
simp (config := { contextual := true })
[GOAL]
α : Type u_1
l : List α
inst✝ : DecidableEq α
a b : α
⊢ count a (List.erase [] b) = count a [] - if a = b then 1 else 0
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
⊢ count a (List.erase (c :: l) b) = count a (c :: l) - if a = b then 1 else 0
[PROOFSTEP]
rw [erase_cons]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
⊢ count a (if c = b then l else c :: List.erase l b) = count a (c :: l) - if a = b then 1 else 0
[PROOFSTEP]
by_cases hc : c = b
[GOAL]
case pos
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
hc : c = b
⊢ count a (if c = b then l else c :: List.erase l b) = count a (c :: l) - if a = b then 1 else 0
[PROOFSTEP]
rw [if_pos hc, hc, count_cons', Nat.add_sub_cancel]
[GOAL]
case neg
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
hc : ¬c = b
⊢ count a (if c = b then l else c :: List.erase l b) = count a (c :: l) - if a = b then 1 else 0
[PROOFSTEP]
rw [if_neg hc, count_cons', count_cons', count_erase a b l]
[GOAL]
case neg
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
hc : ¬c = b
⊢ ((count a l - if a = b then 1 else 0) + if a = c then 1 else 0) =
    (count a l + if a = c then 1 else 0) - if a = b then 1 else 0
[PROOFSTEP]
by_cases ha : a = b
[GOAL]
case pos
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
hc : ¬c = b
ha : a = b
⊢ ((count a l - if a = b then 1 else 0) + if a = c then 1 else 0) =
    (count a l + if a = c then 1 else 0) - if a = b then 1 else 0
[PROOFSTEP]
rw [← ha, eq_comm] at hc
[GOAL]
case pos
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
hc : ¬a = c
ha : a = b
⊢ ((count a l - if a = b then 1 else 0) + if a = c then 1 else 0) =
    (count a l + if a = c then 1 else 0) - if a = b then 1 else 0
[PROOFSTEP]
rw [if_pos ha, if_neg hc, add_zero, add_zero]
[GOAL]
case neg
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b c : α
l : List α
hc : ¬c = b
ha : ¬a = b
⊢ ((count a l - if a = b then 1 else 0) + if a = c then 1 else 0) =
    (count a l + if a = c then 1 else 0) - if a = b then 1 else 0
[PROOFSTEP]
rw [if_neg ha, tsub_zero, tsub_zero]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a : α
l : List α
⊢ count a (List.erase l a) = count a l - 1
[PROOFSTEP]
rw [count_erase, if_pos rfl]
[GOAL]
α : Type u_1
l✝ : List α
inst✝ : DecidableEq α
a b : α
ab : a ≠ b
l : List α
⊢ count a (List.erase l b) = count a l
[PROOFSTEP]
rw [count_erase, if_neg ab, tsub_zero]
[GOAL]
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a : α
f : α → β
hf : ∀ (a' : α), a' ≠ a → a' ∈ l → f a' = 1
⊢ prod (map f l) = f a ^ count a l
[PROOFSTEP]
induction' l with a' as h generalizing a
[GOAL]
case nil
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a✝ : α
f : α → β
hf✝ : ∀ (a' : α), a' ≠ a✝ → a' ∈ l → f a' = 1
a : α
hf : ∀ (a' : α), a' ≠ a → a' ∈ [] → f a' = 1
⊢ prod (map f []) = f a ^ count a []
[PROOFSTEP]
rw [map_nil, prod_nil, count_nil, _root_.pow_zero]
[GOAL]
case cons
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a✝ : α
f : α → β
hf✝ : ∀ (a' : α), a' ≠ a✝ → a' ∈ l → f a' = 1
a' : α
as : List α
h : ∀ (a : α), (∀ (a' : α), a' ≠ a → a' ∈ as → f a' = 1) → prod (map f as) = f a ^ count a as
a : α
hf : ∀ (a'_1 : α), a'_1 ≠ a → a'_1 ∈ a' :: as → f a'_1 = 1
⊢ prod (map f (a' :: as)) = f a ^ count a (a' :: as)
[PROOFSTEP]
specialize h a fun a' ha' hfa' => hf a' ha' (mem_cons_of_mem _ hfa')
[GOAL]
case cons
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a✝ : α
f : α → β
hf✝ : ∀ (a' : α), a' ≠ a✝ → a' ∈ l → f a' = 1
a' : α
as : List α
a : α
hf : ∀ (a'_1 : α), a'_1 ≠ a → a'_1 ∈ a' :: as → f a'_1 = 1
h : prod (map f as) = f a ^ count a as
⊢ prod (map f (a' :: as)) = f a ^ count a (a' :: as)
[PROOFSTEP]
rw [List.map_cons, List.prod_cons, count_cons, h]
[GOAL]
case cons
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a✝ : α
f : α → β
hf✝ : ∀ (a' : α), a' ≠ a✝ → a' ∈ l → f a' = 1
a' : α
as : List α
a : α
hf : ∀ (a'_1 : α), a'_1 ≠ a → a'_1 ∈ a' :: as → f a'_1 = 1
h : prod (map f as) = f a ^ count a as
⊢ f a' * f a ^ count a as = f a ^ if a = a' then succ (count a as) else count a as
[PROOFSTEP]
split_ifs with ha'
[GOAL]
case pos
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a✝ : α
f : α → β
hf✝ : ∀ (a' : α), a' ≠ a✝ → a' ∈ l → f a' = 1
a' : α
as : List α
a : α
hf : ∀ (a'_1 : α), a'_1 ≠ a → a'_1 ∈ a' :: as → f a'_1 = 1
h : prod (map f as) = f a ^ count a as
ha' : a = a'
⊢ f a' * f a ^ count a as = f a ^ succ (count a as)
[PROOFSTEP]
rw [ha', _root_.pow_succ]
[GOAL]
case neg
α : Type u_2
l : List α
inst✝¹ : DecidableEq α
β : Type u_1
inst✝ : Monoid β
a✝ : α
f : α → β
hf✝ : ∀ (a' : α), a' ≠ a✝ → a' ∈ l → f a' = 1
a' : α
as : List α
a : α
hf : ∀ (a'_1 : α), a'_1 ≠ a → a'_1 ∈ a' :: as → f a'_1 = 1
h : prod (map f as) = f a ^ count a as
ha' : ¬a = a'
⊢ f a' * f a ^ count a as = f a ^ count a as
[PROOFSTEP]
rw [hf a' (Ne.symm ha') (List.mem_cons_self a' as), one_mul]
[GOAL]
α : Type u_1
l : List α
inst✝¹ : DecidableEq α
inst✝ : Monoid α
a : α
h : ∀ (a' : α), a' ≠ a → a' ∈ l → a' = 1
⊢ prod l = prod (map id l)
[PROOFSTEP]
rw [map_id]


[GOAL]
n : ℕ
⊢ pair (unpair n).fst (unpair n).snd = n
[PROOFSTEP]
dsimp only [unpair]
[GOAL]
n : ℕ
⊢ pair
      (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n)
        else (sqrt n, n - sqrt n * sqrt n - sqrt n)).fst
      (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n)
        else (sqrt n, n - sqrt n * sqrt n - sqrt n)).snd =
    n
[PROOFSTEP]
let s := sqrt n
[GOAL]
n : ℕ
s : ℕ := sqrt n
⊢ pair
      (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n)
        else (sqrt n, n - sqrt n * sqrt n - sqrt n)).fst
      (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n)
        else (sqrt n, n - sqrt n * sqrt n - sqrt n)).snd =
    n
[PROOFSTEP]
have sm : s * s + (n - s * s) = n := add_tsub_cancel_of_le (sqrt_le _)
[GOAL]
n : ℕ
s : ℕ := sqrt n
sm : s * s + (n - s * s) = n
⊢ pair
      (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n)
        else (sqrt n, n - sqrt n * sqrt n - sqrt n)).fst
      (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n)
        else (sqrt n, n - sqrt n * sqrt n - sqrt n)).snd =
    n
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
n : ℕ
s : ℕ := sqrt n
sm : s * s + (n - s * s) = n
h : n - sqrt n * sqrt n < sqrt n
⊢ pair (n - sqrt n * sqrt n, sqrt n).fst (n - sqrt n * sqrt n, sqrt n).snd = n
[PROOFSTEP]
simp [pair, h, sm]
[GOAL]
case neg
n : ℕ
s : ℕ := sqrt n
sm : s * s + (n - s * s) = n
h : ¬n - sqrt n * sqrt n < sqrt n
⊢ pair (sqrt n, n - sqrt n * sqrt n - sqrt n).fst (sqrt n, n - sqrt n * sqrt n - sqrt n).snd = n
[PROOFSTEP]
have hl : n - s * s - s ≤ s := tsub_le_iff_left.mpr (tsub_le_iff_left.mpr <| by rw [← add_assoc]; apply sqrt_le_add)
[GOAL]
n : ℕ
s : ℕ := sqrt n
sm : s * s + (n - s * s) = n
h : ¬n - sqrt n * sqrt n < sqrt n
⊢ n ≤ s * s + (s + s)
[PROOFSTEP]
rw [← add_assoc]
[GOAL]
n : ℕ
s : ℕ := sqrt n
sm : s * s + (n - s * s) = n
h : ¬n - sqrt n * sqrt n < sqrt n
⊢ n ≤ s * s + s + s
[PROOFSTEP]
apply sqrt_le_add
[GOAL]
case neg
n : ℕ
s : ℕ := sqrt n
sm : s * s + (n - s * s) = n
h : ¬n - sqrt n * sqrt n < sqrt n
hl : n - s * s - s ≤ s
⊢ pair (sqrt n, n - sqrt n * sqrt n - sqrt n).fst (sqrt n, n - sqrt n * sqrt n - sqrt n).snd = n
[PROOFSTEP]
simp [pair, hl.not_lt, add_assoc, add_tsub_cancel_of_le (le_of_not_gt h), sm]
[GOAL]
n a b : ℕ
H : unpair n = (a, b)
⊢ pair a b = n
[PROOFSTEP]
simpa [H] using pair_unpair n
[GOAL]
a b : ℕ
⊢ unpair (pair a b) = (a, b)
[PROOFSTEP]
dsimp only [pair]
[GOAL]
a b : ℕ
⊢ unpair (if a < b then b * b + a else a * a + a + b) = (a, b)
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
a b : ℕ
h : a < b
⊢ unpair (b * b + a) = (a, b)
[PROOFSTEP]
show unpair (b * b + a) = (a, b)
[GOAL]
case pos
a b : ℕ
h : a < b
⊢ unpair (b * b + a) = (a, b)
[PROOFSTEP]
have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _))
[GOAL]
case pos
a b : ℕ
h : a < b
be : sqrt (b * b + a) = b
⊢ unpair (b * b + a) = (a, b)
[PROOFSTEP]
simp [unpair, be, add_tsub_cancel_right, h]
[GOAL]
case neg
a b : ℕ
h : ¬a < b
⊢ unpair (a * a + a + b) = (a, b)
[PROOFSTEP]
show unpair (a * a + a + b) = (a, b)
[GOAL]
case neg
a b : ℕ
h : ¬a < b
⊢ unpair (a * a + a + b) = (a, b)
[PROOFSTEP]
have ae : sqrt (a * a + (a + b)) = a := by
  rw [sqrt_add_eq]
  exact add_le_add_left (le_of_not_gt h) _
[GOAL]
a b : ℕ
h : ¬a < b
⊢ sqrt (a * a + (a + b)) = a
[PROOFSTEP]
rw [sqrt_add_eq]
[GOAL]
case h
a b : ℕ
h : ¬a < b
⊢ a + b ≤ a + a
[PROOFSTEP]
exact add_le_add_left (le_of_not_gt h) _
[GOAL]
case neg
a b : ℕ
h : ¬a < b
ae : sqrt (a * a + (a + b)) = a
⊢ unpair (a * a + a + b) = (a, b)
[PROOFSTEP]
simp [unpair, ae, Nat.not_lt_zero, add_assoc]
[GOAL]
n : ℕ
n1 : 1 ≤ n
⊢ (unpair n).fst < n
[PROOFSTEP]
let s := sqrt n
[GOAL]
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
⊢ (unpair n).fst < n
[PROOFSTEP]
simp [unpair]
[GOAL]
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
⊢ (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n) else (sqrt n, n - sqrt n * sqrt n - sqrt n)).fst <
    n
[PROOFSTEP]
by_cases h : n - s * s < s
[GOAL]
case pos
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
h : n - s * s < s
⊢ (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n) else (sqrt n, n - sqrt n * sqrt n - sqrt n)).fst <
    n
[PROOFSTEP]
simp [h]
[GOAL]
case neg
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
h : ¬n - s * s < s
⊢ (if n - sqrt n * sqrt n < sqrt n then (n - sqrt n * sqrt n, sqrt n) else (sqrt n, n - sqrt n * sqrt n - sqrt n)).fst <
    n
[PROOFSTEP]
simp [h]
[GOAL]
case pos
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
h : n - s * s < s
⊢ n - sqrt n * sqrt n < n
[PROOFSTEP]
exact lt_of_lt_of_le h (sqrt_le_self _)
[GOAL]
case neg
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
h : ¬n - s * s < s
⊢ sqrt n < n
[PROOFSTEP]
simp at h
[GOAL]
case neg
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
h : sqrt n ≤ n - sqrt n * sqrt n
⊢ sqrt n < n
[PROOFSTEP]
have s0 : 0 < s := sqrt_pos.2 n1
[GOAL]
case neg
n : ℕ
n1 : 1 ≤ n
s : ℕ := sqrt n
h : sqrt n ≤ n - sqrt n * sqrt n
s0 : 0 < s
⊢ sqrt n < n
[PROOFSTEP]
exact lt_of_le_of_lt h (tsub_lt_self n1 (mul_pos s0 s0))
[GOAL]
⊢ unpair 0 = 0
[PROOFSTEP]
rw [unpair]
[GOAL]
⊢ (let s := sqrt 0;
    if 0 - s * s < s then (0 - s * s, s) else (s, 0 - s * s - s)) =
    0
[PROOFSTEP]
simp
[GOAL]
⊢ (unpair 0).fst ≤ 0
[PROOFSTEP]
simp
[GOAL]
a b : ℕ
⊢ a ≤ pair a b
[PROOFSTEP]
simpa using unpair_left_le (pair a b)
[GOAL]
a b : ℕ
⊢ b ≤ pair a b
[PROOFSTEP]
by_cases h : a < b
[GOAL]
case pos
a b : ℕ
h : a < b
⊢ b ≤ pair a b
[PROOFSTEP]
simp [pair, h]
[GOAL]
case neg
a b : ℕ
h : ¬a < b
⊢ b ≤ pair a b
[PROOFSTEP]
simp [pair, h]
[GOAL]
case pos
a b : ℕ
h : a < b
⊢ b ≤ b * b + a
[PROOFSTEP]
exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
[GOAL]
n : ℕ
⊢ (unpair n).snd ≤ n
[PROOFSTEP]
simpa using right_le_pair n.unpair.1 n.unpair.2
[GOAL]
a₁ a₂ b : ℕ
h : a₁ < a₂
⊢ pair a₁ b < pair a₂ b
[PROOFSTEP]
by_cases h₁ : a₁ < b
[GOAL]
case pos
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
⊢ pair a₁ b < pair a₂ b
[PROOFSTEP]
simp [pair, h₁, add_assoc]
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : ¬a₁ < b
⊢ pair a₁ b < pair a₂ b
[PROOFSTEP]
simp [pair, h₁, add_assoc]
[GOAL]
case pos
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
⊢ b * b + a₁ < if a₂ < b then b * b + a₂ else a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
by_cases h₂ : a₂ < b
[GOAL]
case pos
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
h₂ : a₂ < b
⊢ b * b + a₁ < if a₂ < b then b * b + a₂ else a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
simp [pair, h₂, h]
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
h₂ : ¬a₂ < b
⊢ b * b + a₁ < if a₂ < b then b * b + a₂ else a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
simp [pair, h₂, h]
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
h₂ : ¬a₂ < b
⊢ b * b + a₁ < a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
simp at h₂
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
h₂ : b ≤ a₂
⊢ b * b + a₁ < a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
apply add_lt_add_of_le_of_lt
[GOAL]
case neg.h₁
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
h₂ : b ≤ a₂
⊢ b * b ≤ a₂ * a₂
case neg.h₂ a₁ a₂ b : ℕ h : a₁ < a₂ h₁ : a₁ < b h₂ : b ≤ a₂ ⊢ a₁ < a₂ + b
[PROOFSTEP]
exact mul_self_le_mul_self h₂
[GOAL]
case neg.h₂
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : a₁ < b
h₂ : b ≤ a₂
⊢ a₁ < a₂ + b
[PROOFSTEP]
exact Nat.lt_add_right _ _ _ h
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : ¬a₁ < b
⊢ a₁ * a₁ + (a₁ + b) < if a₂ < b then b * b + a₂ else a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
simp at h₁
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : b ≤ a₁
⊢ a₁ * a₁ + (a₁ + b) < if a₂ < b then b * b + a₂ else a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
simp [not_lt_of_gt (lt_of_le_of_lt h₁ h)]
[GOAL]
case neg
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : b ≤ a₁
⊢ a₁ * a₁ + (a₁ + b) < a₂ * a₂ + (a₂ + b)
[PROOFSTEP]
apply add_lt_add
[GOAL]
case neg.h₁
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : b ≤ a₁
⊢ a₁ * a₁ < a₂ * a₂
case neg.h₂ a₁ a₂ b : ℕ h : a₁ < a₂ h₁ : b ≤ a₁ ⊢ a₁ + b < a₂ + b
[PROOFSTEP]
exact mul_self_lt_mul_self h
[GOAL]
case neg.h₂
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : b ≤ a₁
⊢ a₁ + b < a₂ + b
[PROOFSTEP]
apply add_lt_add_right
[GOAL]
case neg.h₂.bc
a₁ a₂ b : ℕ
h : a₁ < a₂
h₁ : b ≤ a₁
⊢ a₁ < a₂
[PROOFSTEP]
assumption
[GOAL]
a b₁ b₂ : ℕ
h : b₁ < b₂
⊢ pair a b₁ < pair a b₂
[PROOFSTEP]
by_cases h₁ : a < b₁
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : a < b₁
⊢ pair a b₁ < pair a b₂
[PROOFSTEP]
simp [pair, h₁, add_assoc]
[GOAL]
case neg
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : ¬a < b₁
⊢ pair a b₁ < pair a b₂
[PROOFSTEP]
simp [pair, h₁, add_assoc]
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : a < b₁
⊢ b₁ * b₁ + a < if a < b₂ then b₂ * b₂ + a else a * a + (a + b₂)
[PROOFSTEP]
simp [pair, lt_trans h₁ h, h]
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : a < b₁
⊢ b₁ * b₁ < b₂ * b₂
[PROOFSTEP]
exact mul_self_lt_mul_self h
[GOAL]
case neg
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : ¬a < b₁
⊢ a * a + (a + b₁) < if a < b₂ then b₂ * b₂ + a else a * a + (a + b₂)
[PROOFSTEP]
by_cases h₂ : a < b₂
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : ¬a < b₁
h₂ : a < b₂
⊢ a * a + (a + b₁) < if a < b₂ then b₂ * b₂ + a else a * a + (a + b₂)
[PROOFSTEP]
simp [pair, h₂, h]
[GOAL]
case neg
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : ¬a < b₁
h₂ : ¬a < b₂
⊢ a * a + (a + b₁) < if a < b₂ then b₂ * b₂ + a else a * a + (a + b₂)
[PROOFSTEP]
simp [pair, h₂, h]
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₁ : ¬a < b₁
h₂ : a < b₂
⊢ a * a + (a + b₁) < b₂ * b₂ + a
[PROOFSTEP]
simp at h₁
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₂ : a < b₂
h₁ : b₁ ≤ a
⊢ a * a + (a + b₁) < b₂ * b₂ + a
[PROOFSTEP]
rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
[GOAL]
case pos
a b₁ b₂ : ℕ
h : b₁ < b₂
h₂ : a < b₂
h₁ : b₁ ≤ a
⊢ b₁ + a * a < b₂ * b₂
[PROOFSTEP]
rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
[GOAL]
case pos.h
a b₁ b₂ : ℕ
h : b₁ < b₂
h₂ : a < b₂
h₁ : b₁ ≤ a
⊢ b₁ ≤ a + a
[PROOFSTEP]
exact le_trans h₁ (Nat.le_add_left _ _)
[GOAL]
m n : ℕ
⊢ pair m n < (max m n + 1) ^ 2
[PROOFSTEP]
rw [pair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
[GOAL]
m n : ℕ
⊢ (if m < n then n * n + m else m * m + (m + n)) < max m n * max m n + (max m n + max m n + 1 ^ 2)
[PROOFSTEP]
cases' (lt_or_le m n) with h h
[GOAL]
case inl
m n : ℕ
h : m < n
⊢ (if m < n then n * n + m else m * m + (m + n)) < max m n * max m n + (max m n + max m n + 1 ^ 2)
case inr
m n : ℕ
h : n ≤ m
⊢ (if m < n then n * n + m else m * m + (m + n)) < max m n * max m n + (max m n + max m n + 1 ^ 2)
[PROOFSTEP]
rw [if_pos h, max_eq_right h.le, add_lt_add_iff_left, add_assoc]
[GOAL]
case inl
m n : ℕ
h : m < n
⊢ m < n + (n + 1 ^ 2)
case inr
m n : ℕ
h : n ≤ m
⊢ (if m < n then n * n + m else m * m + (m + n)) < max m n * max m n + (max m n + max m n + 1 ^ 2)
[PROOFSTEP]
exact h.trans_le (self_le_add_right n _)
[GOAL]
case inr
m n : ℕ
h : n ≤ m
⊢ (if m < n then n * n + m else m * m + (m + n)) < max m n * max m n + (max m n + max m n + 1 ^ 2)
[PROOFSTEP]
rw [if_neg h.not_lt, max_eq_left h, add_lt_add_iff_left, add_assoc, add_lt_add_iff_left]
[GOAL]
case inr
m n : ℕ
h : n ≤ m
⊢ n < m + 1 ^ 2
[PROOFSTEP]
exact lt_succ_of_le h
[GOAL]
m n : ℕ
⊢ max m n ^ 2 + min m n ≤ pair m n
[PROOFSTEP]
rw [pair]
[GOAL]
m n : ℕ
⊢ max m n ^ 2 + min m n ≤ if m < n then n * n + m else m * m + m + n
[PROOFSTEP]
cases' lt_or_le m n with h h
[GOAL]
case inl
m n : ℕ
h : m < n
⊢ max m n ^ 2 + min m n ≤ if m < n then n * n + m else m * m + m + n
case inr m n : ℕ h : n ≤ m ⊢ max m n ^ 2 + min m n ≤ if m < n then n * n + m else m * m + m + n
[PROOFSTEP]
rw [if_pos h, max_eq_right h.le, min_eq_left h.le, sq]
[GOAL]
case inr
m n : ℕ
h : n ≤ m
⊢ max m n ^ 2 + min m n ≤ if m < n then n * n + m else m * m + m + n
[PROOFSTEP]
rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, sq, add_assoc, add_le_add_iff_left]
[GOAL]
case inr
m n : ℕ
h : n ≤ m
⊢ n ≤ m + n
[PROOFSTEP]
exact le_add_self
[GOAL]
m n : ℕ
⊢ m + n ≤ max m n ^ 2 + min m n
[PROOFSTEP]
rw [sq, ← min_add_max, add_comm, add_le_add_iff_right]
[GOAL]
m n : ℕ
⊢ max m n ≤ max m n * max m n
[PROOFSTEP]
exact le_mul_self _
[GOAL]
α : Type u_1
inst✝ : CompleteLattice α
f : ℕ → ℕ → α
⊢ ⨆ (n : ℕ), f (unpair n).fst (unpair n).snd = ⨆ (i : ℕ) (j : ℕ), f i j
[PROOFSTEP]
rw [← (iSup_prod : ⨆ i : ℕ × ℕ, f i.1 i.2 = _), ← Nat.surjective_unpair.iSup_comp]
[GOAL]
α : Type u_1
β : Type u_2
s : ℕ → Set α
t : ℕ → Set β
⊢ ⋃ (n : ℕ), s (unpair n).fst ×ˢ t (unpair n).snd = (⋃ (n : ℕ), s n) ×ˢ ⋃ (n : ℕ), t n
[PROOFSTEP]
rw [← Set.iUnion_prod]
[GOAL]
α : Type u_1
β : Type u_2
s : ℕ → Set α
t : ℕ → Set β
⊢ ⋃ (n : ℕ), s (unpair n).fst ×ˢ t (unpair n).snd = ⋃ (x : ℕ × ℕ), s x.fst ×ˢ t x.snd
[PROOFSTEP]
exact surjective_unpair.iUnion_comp (fun x => s x.fst ×ˢ t x.snd)


[GOAL]
F : Sort u_1
α : Sort u_2
β : α → Sort u_3
i : FunLike F α β
f g : F
h : f = g
⊢ ↑f = ↑g
[PROOFSTEP]
cases h
[GOAL]
case refl
F : Sort u_1
α : Sort u_2
β : α → Sort u_3
i : FunLike F α β
f : F
⊢ ↑f = ↑f
[PROOFSTEP]
rfl


[GOAL]
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
f g : SpectralMap α β
h : f.toFun = g.toFun
⊢ f = g
[PROOFSTEP]
cases f
[GOAL]
case mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
g : SpectralMap α β
toFun✝ : α → β
spectral'✝ : IsSpectralMap toFun✝
h : { toFun := toFun✝, spectral' := spectral'✝ }.toFun = g.toFun
⊢ { toFun := toFun✝, spectral' := spectral'✝ } = g
[PROOFSTEP]
cases g
[GOAL]
case mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
toFun✝¹ : α → β
spectral'✝¹ : IsSpectralMap toFun✝¹
toFun✝ : α → β
spectral'✝ : IsSpectralMap toFun✝
h : { toFun := toFun✝¹, spectral' := spectral'✝¹ }.toFun = { toFun := toFun✝, spectral' := spectral'✝ }.toFun
⊢ { toFun := toFun✝¹, spectral' := spectral'✝¹ } = { toFun := toFun✝, spectral' := spectral'✝ }
[PROOFSTEP]
congr
[GOAL]
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
f : SpectralMap β γ
g : SpectralMap α β
⊢ ↑f ∘ ↑g = ↑↑f ∘ ↑↑g
[PROOFSTEP]
rfl
  -- porting note: removed `simp` from this and added lemma above to address `simpNF` lint
[GOAL]
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
f : SpectralMap β γ
g : SpectralMap α β
⊢ ↑(comp f g) = ContinuousMap.comp ↑f ↑g
[PROOFSTEP]
rfl
[GOAL]
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
g : SpectralMap β γ
f₁ f₂ : SpectralMap α β
hg : Injective ↑g
h : comp g f₁ = comp g f₂
a : α
⊢ ↑g (↑f₁ a) = ↑g (↑f₂ a)
[PROOFSTEP]
rw [← comp_apply, h, comp_apply]


[GOAL]
t : ℝ
⊢ ‖exp (↑t * I)‖ = 1
[PROOFSTEP]
simp only [norm_eq_abs, abs_exp_ofReal_mul_I]
[GOAL]
r₁ r₂ : ℝ
h₀ : 0 ≤ r₁
hr : r₁ < r₂
x : ℝ
h : r₁ < x ∧ x < r₂
⊢ r₁ < ‖↑x‖ ∧ ‖↑x‖ < r₂
[PROOFSTEP]
rwa [norm_eq_abs, abs_ofReal, abs_of_pos (h₀.trans_lt h.1)]
[GOAL]
R : Type u_1
inst✝¹ : NormedField R
inst✝ : NormedAlgebra R ℝ
r : R
x : ℂ
⊢ ‖r • x‖ ≤ ‖r‖ * ‖x‖
[PROOFSTEP]
rw [← algebraMap_smul ℝ r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, ← Real.norm_eq_abs, norm_algebraMap']
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
⊢ dist z w = Real.sqrt ((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)
[PROOFSTEP]
rw [sq, sq]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
⊢ dist z w = Real.sqrt ((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))
[PROOFSTEP]
rfl
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
h : z.re = w.re
⊢ dist z w = dist z.im w.im
[PROOFSTEP]
rw [dist_eq_re_im, h, sub_self, zero_pow two_pos, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
h : z.re = w.re
⊢ edist z w = edist z.im w.im
[PROOFSTEP]
rw [edist_nndist, edist_nndist, nndist_of_re_eq h]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
h : z.im = w.im
⊢ dist z w = dist z.re w.re
[PROOFSTEP]
rw [dist_eq_re_im, h, sub_self, zero_pow two_pos, add_zero, Real.sqrt_sq_eq_abs, Real.dist_eq]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
h : z.im = w.im
⊢ edist z w = edist z.re w.re
[PROOFSTEP]
rw [edist_nndist, edist_nndist, nndist_of_im_eq h]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ dist (↑(starRingEnd ℂ) z) z = 2 * |z.im|
[PROOFSTEP]
rw [dist_of_re_eq (conj_re z), conj_im, dist_comm, Real.dist_eq, sub_neg_eq_add, ← two_mul, _root_.abs_mul,
  abs_of_pos (zero_lt_two' ℝ)]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ ↑(nndist (↑(starRingEnd ℂ) z) z) = ↑(2 * ↑Real.nnabs z.im)
[PROOFSTEP]
rw [← dist_nndist, NNReal.coe_mul, NNReal.coe_two, Real.coe_nnabs, dist_conj_self]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ dist z (↑(starRingEnd ℂ) z) = 2 * |z.im|
[PROOFSTEP]
rw [dist_comm, dist_conj_self]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ nndist z (↑(starRingEnd ℂ) z) = 2 * ↑Real.nnabs z.im
[PROOFSTEP]
rw [nndist_comm, nndist_conj_self]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
r : ℚ
⊢ ‖↑r‖ = |↑r|
[PROOFSTEP]
rw [← ofReal_rat_cast]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
r : ℚ
⊢ ‖↑↑r‖ = |↑r|
[PROOFSTEP]
exact norm_real _
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
n : ℤ
hn : 0 ≤ n
⊢ ‖↑n‖ = ↑n
[PROOFSTEP]
rw [norm_int, ← Int.cast_abs, _root_.abs_of_nonneg hn]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
⊢ Continuous ↑normSq
[PROOFSTEP]
simpa [← normSq_eq_abs] using continuous_abs.pow 2
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
n : ℕ
⊢ ↑‖↑n‖₊ = ↑↑n
[PROOFSTEP]
simp
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
ζ : ℂ
n : ℕ
h : ζ ^ n = 1
hn : n ≠ 0
⊢ ‖ζ‖₊ = 1
[PROOFSTEP]
refine' (@pow_left_inj NNReal _ _ _ _ zero_le' zero_le' hn.bot_lt).mp _
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
ζ : ℂ
n : ℕ
h : ζ ^ n = 1
hn : n ≠ 0
⊢ ‖ζ‖₊ ^ n = 1 ^ n
[PROOFSTEP]
rw [← nnnorm_pow, h, nnnorm_one, one_pow]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ ‖↑equivRealProd z‖ ≤ ↑abs z
[PROOFSTEP]
simp [Prod.norm_def, abs_re_le_abs, abs_im_le_abs]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ ‖↑equivRealProd z‖ ≤ 1 * ↑abs z
[PROOFSTEP]
simpa using equivRealProd_apply_le z
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
⊢ LipschitzWith 1 ↑equivRealProd
[PROOFSTEP]
simpa using AddMonoidHomClass.lipschitz_of_bound equivRealProdLm 1 equivRealProd_apply_le'
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
⊢ ‖z‖ ≤ ↑(↑NNReal.sqrt 2) * ‖↑equivRealProdLm z‖
[PROOFSTEP]
simpa only [Real.coe_sqrt, NNReal.coe_ofNat] using abs_le_sqrt_two_mul_max z
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
⊢ Tendsto (↑normSq) (cocompact ℂ) atTop
[PROOFSTEP]
simpa [mul_self_abs] using tendsto_abs_cocompact_atTop.atTop_mul_atTop tendsto_abs_cocompact_atTop
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x : ℂ
⊢ ‖↑reLm x‖ ≤ 1 * ‖x‖
[PROOFSTEP]
simp [abs_re_le_abs]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x : ℂ
⊢ ‖↑imLm x‖ ≤ 1 * ‖x‖
[PROOFSTEP]
simp [abs_im_le_abs]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x : E
⊢ restrictScalars ℝ (smulRight 1 x) = smulRight reClm x + I • smulRight imClm x
[PROOFSTEP]
ext ⟨a, b⟩
[GOAL]
case h.mk
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x : E
a b : ℝ
⊢ ↑(restrictScalars ℝ (smulRight 1 x)) { re := a, im := b } =
    ↑(smulRight reClm x + I • smulRight imClm x) { re := a, im := b }
[PROOFSTEP]
simp [mk_eq_add_mul_I, mul_smul, smul_comm I b x]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x : ℂ
⊢ restrictScalars ℝ (smulRight 1 x) = x • 1
[PROOFSTEP]
ext1 z
[GOAL]
case h
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x z : ℂ
⊢ ↑(restrictScalars ℝ (smulRight 1 x)) z = ↑(x • 1) z
[PROOFSTEP]
dsimp
[GOAL]
case h
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
x z : ℂ
⊢ z * x = x * z
[PROOFSTEP]
apply mul_comm
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z w : ℂ
⊢ dist (↑(starRingEnd ℂ) z) w = dist z (↑(starRingEnd ℂ) w)
[PROOFSTEP]
rw [← dist_conj_conj, conj_conj]
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℂ →+* ℂ
hf : Continuous ↑f
⊢ f = RingHom.id ℂ ∨ f = starRingEnd ℂ
[PROOFSTEP]
simpa only [FunLike.ext_iff] using real_algHom_eq_id_or_conj (AlgHom.mk' f (map_real_smul f hf))
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
f : ℝ →+* ℂ
h : Continuous ↑f
⊢ f = ofReal
[PROOFSTEP]
convert congr_arg AlgHom.toRingHom <| Subsingleton.elim (AlgHom.mk' f <| map_real_smul f h) (Algebra.ofId ℝ ℂ)
[GOAL]
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℂ
hz : 0 ≤ z
⊢ z = ↑‖z‖
[PROOFSTEP]
lift z to ℝ using hz.2.symm
[GOAL]
case intro
E : Type u_1
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℂ E
z : ℝ
hz : 0 ≤ ↑z
⊢ ↑z = ↑‖↑z‖
[PROOFSTEP]
rw [norm_eq_abs, abs_ofReal, _root_.abs_of_nonneg (id hz.1 : 0 ≤ z)]
[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → ℝ
x : ℝ
h : HasSum (fun x => ↑(f x)) ↑x
⊢ HasSum f x
[PROOFSTEP]
simpa only [IsROrC.reClm_apply, IsROrC.ofReal_re] using reClm.hasSum h
[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → ℝ
h : Summable fun x => ↑(f x)
⊢ Summable f
[PROOFSTEP]
simpa only [IsROrC.reClm_apply, IsROrC.ofReal_re] using reClm.summable h
[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → ℝ
⊢ ↑(∑' (a : α), f a) = ∑' (a : α), ↑(f a)
[PROOFSTEP]
by_cases h : Summable f
[GOAL]
case pos
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → ℝ
h : Summable f
⊢ ↑(∑' (a : α), f a) = ∑' (a : α), ↑(f a)
[PROOFSTEP]
exact ContinuousLinearMap.map_tsum ofRealClm h
[GOAL]
case neg
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → ℝ
h : ¬Summable f
⊢ ↑(∑' (a : α), f a) = ∑' (a : α), ↑(f a)
[PROOFSTEP]
rw [tsum_eq_zero_of_not_summable h, tsum_eq_zero_of_not_summable ((summable_ofReal _).not.mpr h), ofReal_zero]
[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → 𝕜
c : 𝕜
⊢ HasSum f c ↔ HasSum (fun x => ↑re (f x)) (↑re c) ∧ HasSum (fun x => ↑im (f x)) (↑im c)
[PROOFSTEP]
refine' ⟨fun h => ⟨hasSum_re _ h, hasSum_im _ h⟩, _⟩
[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → 𝕜
c : 𝕜
⊢ HasSum (fun x => ↑re (f x)) (↑re c) ∧ HasSum (fun x => ↑im (f x)) (↑im c) → HasSum f c
[PROOFSTEP]
rintro ⟨h₁, h₂⟩
[GOAL]
case intro
α : Type u_1
𝕜 : Type u_2
inst✝ : IsROrC 𝕜
f : α → 𝕜
c : 𝕜
h₁ : HasSum (fun x => ↑re (f x)) (↑re c)
h₂ : HasSum (fun x => ↑im (f x)) (↑im c)
⊢ HasSum f c
[PROOFSTEP]
simpa only [re_add_im] using ((hasSum_ofReal 𝕜).mpr h₁).add (((hasSum_ofReal 𝕜).mpr h₂).mul_right I)