[GOAL]
R : Type u_1
L : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : LieRing L
inst✝⁶ : LieAlgebra R L
M : Type u_3
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : LieRingModule L M
inst✝² : LieModule R L M
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
x y z : L
⊢ ↑(↑(traceForm R L M) ⁅x, y⁆) z = ↑(↑(traceForm R L M) x) ⁅y, z⁆
[PROOFSTEP]
calc
  traceForm R L M ⁅x, y⁆ z = trace R _ (φ ⁅x, y⁆ ∘ₗ φ z) := by simp only [traceForm_apply_apply]
  _ = trace R _ ((φ x * φ y - φ y * φ x) * φ z) := ?_
  _ = trace R _ (φ x * (φ y * φ z)) - trace R _ (φ y * (φ x * φ z)) := ?_
  _ = trace R _ (φ x * (φ y * φ z)) - trace R _ (φ x * (φ z * φ y)) := ?_
  _ = traceForm R L M x ⁅y, z⁆ := ?_
[GOAL]
R : Type u_1
L : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : LieRing L
inst✝⁶ : LieAlgebra R L
M : Type u_3
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : LieRingModule L M
inst✝² : LieModule R L M
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
x y z : L
⊢ ↑(↑(traceForm R L M) ⁅x, y⁆) z = ↑(trace R M) (LinearMap.comp (↑φ ⁅x, y⁆) (↑φ z))
[PROOFSTEP]
simp only [traceForm_apply_apply]
[GOAL]
case calc_1
R : Type u_1
L : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : LieRing L
inst✝⁶ : LieAlgebra R L
M : Type u_3
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : LieRingModule L M
inst✝² : LieModule R L M
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
x y z : L
⊢ ↑(trace R M) (LinearMap.comp (↑φ ⁅x, y⁆) (↑φ z)) = ↑(trace R M) ((↑φ x * ↑φ y - ↑φ y * ↑φ x) * ↑φ z)
[PROOFSTEP]
simp only [LieHom.map_lie, Ring.lie_def, ← LinearMap.mul_eq_comp]
[GOAL]
case calc_2
R : Type u_1
L : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : LieRing L
inst✝⁶ : LieAlgebra R L
M : Type u_3
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : LieRingModule L M
inst✝² : LieModule R L M
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
x y z : L
⊢ ↑(trace R M) ((↑φ x * ↑φ y - ↑φ y * ↑φ x) * ↑φ z) =
    ↑(trace R M) (↑φ x * (↑φ y * ↑φ z)) - ↑(trace R M) (↑φ y * (↑φ x * ↑φ z))
[PROOFSTEP]
simp only [sub_mul, mul_sub, map_sub, mul_assoc]
[GOAL]
case calc_3
R : Type u_1
L : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : LieRing L
inst✝⁶ : LieAlgebra R L
M : Type u_3
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : LieRingModule L M
inst✝² : LieModule R L M
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
x y z : L
⊢ ↑(trace R M) (↑φ x * (↑φ y * ↑φ z)) - ↑(trace R M) (↑φ y * (↑φ x * ↑φ z)) =
    ↑(trace R M) (↑φ x * (↑φ y * ↑φ z)) - ↑(trace R M) (↑φ x * (↑φ z * ↑φ y))
[PROOFSTEP]
simp only [LinearMap.trace_mul_cycle' R (φ x) (φ z) (φ y)]
[GOAL]
case calc_4
R : Type u_1
L : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : LieRing L
inst✝⁶ : LieAlgebra R L
M : Type u_3
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : LieRingModule L M
inst✝² : LieModule R L M
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
x y z : L
⊢ ↑(trace R M) (↑φ x * (↑φ y * ↑φ z)) - ↑(trace R M) (↑φ x * (↑φ z * ↑φ y)) = ↑(↑(traceForm R L M) x) ⁅y, z⁆
[PROOFSTEP]
simp only [traceForm_apply_apply, LieHom.map_lie, Ring.lie_def, mul_sub, map_sub, ← LinearMap.mul_eq_comp]


[GOAL]
f f' : ℝ → ℝ
a b l : ℝ
hab : a < b
hfa : Tendsto f (𝓝[Ioi a] a) (𝓝 l)
hfb : Tendsto f (𝓝[Iio b] b) (𝓝 l)
⊢ ∃ c, c ∈ Ioo a b ∧ deriv f c = 0
[PROOFSTEP]
by_cases h : ∀ x ∈ Ioo a b, DifferentiableAt ℝ f x
[GOAL]
case pos
f f' : ℝ → ℝ
a b l : ℝ
hab : a < b
hfa : Tendsto f (𝓝[Ioi a] a) (𝓝 l)
hfb : Tendsto f (𝓝[Iio b] b) (𝓝 l)
h : ∀ (x : ℝ), x ∈ Ioo a b → DifferentiableAt ℝ f x
⊢ ∃ c, c ∈ Ioo a b ∧ deriv f c = 0
[PROOFSTEP]
exact exists_hasDerivAt_eq_zero' hab hfa hfb fun x hx => (h x hx).hasDerivAt
[GOAL]
case neg
f f' : ℝ → ℝ
a b l : ℝ
hab : a < b
hfa : Tendsto f (𝓝[Ioi a] a) (𝓝 l)
hfb : Tendsto f (𝓝[Iio b] b) (𝓝 l)
h : ¬∀ (x : ℝ), x ∈ Ioo a b → DifferentiableAt ℝ f x
⊢ ∃ c, c ∈ Ioo a b ∧ deriv f c = 0
[PROOFSTEP]
obtain ⟨c, hc, hcdiff⟩ : ∃ x ∈ Ioo a b, ¬DifferentiableAt ℝ f x
[GOAL]
f f' : ℝ → ℝ
a b l : ℝ
hab : a < b
hfa : Tendsto f (𝓝[Ioi a] a) (𝓝 l)
hfb : Tendsto f (𝓝[Iio b] b) (𝓝 l)
h : ¬∀ (x : ℝ), x ∈ Ioo a b → DifferentiableAt ℝ f x
⊢ ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x
[PROOFSTEP]
push_neg at h
[GOAL]
f f' : ℝ → ℝ
a b l : ℝ
hab : a < b
hfa : Tendsto f (𝓝[Ioi a] a) (𝓝 l)
hfb : Tendsto f (𝓝[Iio b] b) (𝓝 l)
h : ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x
⊢ ∃ x, x ∈ Ioo a b ∧ ¬DifferentiableAt ℝ f x
[PROOFSTEP]
exact h
[GOAL]
case neg.intro.intro
f f' : ℝ → ℝ
a b l : ℝ
hab : a < b
hfa : Tendsto f (𝓝[Ioi a] a) (𝓝 l)
hfb : Tendsto f (𝓝[Iio b] b) (𝓝 l)
h : ¬∀ (x : ℝ), x ∈ Ioo a b → DifferentiableAt ℝ f x
c : ℝ
hc : c ∈ Ioo a b
hcdiff : ¬DifferentiableAt ℝ f c
⊢ ∃ c, c ∈ Ioo a b ∧ deriv f c = 0
[PROOFSTEP]
exact ⟨c, hc, deriv_zero_of_not_differentiableAt hcdiff⟩


[GOAL]
R : Type u_1
inst✝¹ : Ring R
n m : ℕ
inst✝ : CharP R m
h : m ∣ n
src✝ : ZMod n →+* R := castHom h R
a : ZMod n
r : (fun x => R) a
⊢ ↑a * r = r * ↑a
[PROOFSTEP]
rcases ZMod.int_cast_surjective a with ⟨k, rfl⟩
[GOAL]
case intro
R : Type u_1
inst✝¹ : Ring R
n m : ℕ
inst✝ : CharP R m
h : m ∣ n
src✝ : ZMod n →+* R := castHom h R
k : ℤ
r : R
⊢ ↑↑k * r = r * ↑↑k
[PROOFSTEP]
show ZMod.castHom h R k * r = r * ZMod.castHom h R k
[GOAL]
case intro
R : Type u_1
inst✝¹ : Ring R
n m : ℕ
inst✝ : CharP R m
h : m ∣ n
src✝ : ZMod n →+* R := castHom h R
k : ℤ
r : R
⊢ ↑(castHom h R) ↑k * r = r * ↑(castHom h R) ↑k
[PROOFSTEP]
rw [map_intCast]
[GOAL]
case intro
R : Type u_1
inst✝¹ : Ring R
n m : ℕ
inst✝ : CharP R m
h : m ∣ n
src✝ : ZMod n →+* R := castHom h R
k : ℤ
r : R
⊢ ↑k * r = r * ↑k
[PROOFSTEP]
exact Commute.cast_int_left r k


[GOAL]
α : Type u_1
β : Type u_2
head✝ : α
l : List α
⊢ (head✝ :: l) ×ˢ [] = []
[PROOFSTEP]
simp [product_cons, product_nil]
[GOAL]
α : Type u_1
β : Type u_2
l₁ : List α
l₂ : List β
a : α
b : β
⊢ (a, b) ∈ l₁ ×ˢ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂
[PROOFSTEP]
simp_all [SProd.sprod, product, mem_bind, mem_map, Prod.ext_iff, exists_prop, and_left_comm, exists_and_left,
  exists_eq_left, exists_eq_right]
[GOAL]
α : Type u_1
β : Type u_2
l₁ : List α
l₂ : List β
⊢ length (l₁ ×ˢ l₂) = length l₁ * length l₂
[PROOFSTEP]
induction' l₁ with x l₁ IH
[GOAL]
case nil
α : Type u_1
β : Type u_2
l₂ : List β
⊢ length ([] ×ˢ l₂) = length [] * length l₂
[PROOFSTEP]
exact (zero_mul _).symm
[GOAL]
case cons
α : Type u_1
β : Type u_2
l₂ : List β
x : α
l₁ : List α
IH : length (l₁ ×ˢ l₂) = length l₁ * length l₂
⊢ length ((x :: l₁) ×ˢ l₂) = length (x :: l₁) * length l₂
[PROOFSTEP]
simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map, add_comm]
[GOAL]
α : Type u_1
β : Type u_2
σ : α → Type u_3
head✝ : α
l : List α
⊢ (List.sigma (head✝ :: l) fun a => []) = []
[PROOFSTEP]
simp [sigma_cons, sigma_nil]
[GOAL]
α : Type u_1
β : Type u_2
σ : α → Type u_3
l₁ : List α
l₂ : (a : α) → List (σ a)
a : α
b : σ a
⊢ { fst := a, snd := b } ∈ List.sigma l₁ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ a
[PROOFSTEP]
simp [List.sigma, mem_bind, mem_map, exists_prop, exists_and_left, and_left_comm, exists_eq_left, heq_iff_eq,
  exists_eq_right]
[GOAL]
α : Type u_1
β : Type u_2
σ : α → Type u_3
l₁ : List α
l₂ : (a : α) → List (σ a)
⊢ length (List.sigma l₁ l₂) = sum (map (fun a => length (l₂ a)) l₁)
[PROOFSTEP]
induction' l₁ with x l₁ IH
[GOAL]
case nil
α : Type u_1
β : Type u_2
σ : α → Type u_3
l₂ : (a : α) → List (σ a)
⊢ length (List.sigma [] l₂) = sum (map (fun a => length (l₂ a)) [])
[PROOFSTEP]
rfl
[GOAL]
case cons
α : Type u_1
β : Type u_2
σ : α → Type u_3
l₂ : (a : α) → List (σ a)
x : α
l₁ : List α
IH : length (List.sigma l₁ l₂) = sum (map (fun a => length (l₂ a)) l₁)
⊢ length (List.sigma (x :: l₁) l₂) = sum (map (fun a => length (l₂ a)) (x :: l₁))
[PROOFSTEP]
simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]


[GOAL]
α : Type u_1
inst✝¹ : UniformSpace α
inst✝ : SeparatedSpace α
s : Set α
h : IsComplete s
a : α
ha : ClusterPt a (𝓟 s)
⊢ a ∈ s
[PROOFSTEP]
let f := 𝓝[s] a
[GOAL]
α : Type u_1
inst✝¹ : UniformSpace α
inst✝ : SeparatedSpace α
s : Set α
h : IsComplete s
a : α
ha : ClusterPt a (𝓟 s)
f : Filter α := 𝓝[s] a
⊢ a ∈ s
[PROOFSTEP]
have : Cauchy f := cauchy_nhds.mono' ha inf_le_left
[GOAL]
α : Type u_1
inst✝¹ : UniformSpace α
inst✝ : SeparatedSpace α
s : Set α
h : IsComplete s
a : α
ha : ClusterPt a (𝓟 s)
f : Filter α := 𝓝[s] a
this : Cauchy f
⊢ a ∈ s
[PROOFSTEP]
rcases h f this inf_le_right with ⟨y, ys, fy⟩
[GOAL]
case intro.intro
α : Type u_1
inst✝¹ : UniformSpace α
inst✝ : SeparatedSpace α
s : Set α
h : IsComplete s
a : α
ha : ClusterPt a (𝓟 s)
f : Filter α := 𝓝[s] a
this : Cauchy f
y : α
ys : y ∈ s
fy : f ≤ 𝓝 y
⊢ a ∈ s
[PROOFSTEP]
rwa [(tendsto_nhds_unique' ha inf_le_left fy : a = y)]


[GOAL]
k : ℕ
⊢ 0 < W k
[PROOFSTEP]
induction' k with k hk
[GOAL]
case zero
⊢ 0 < W Nat.zero
[PROOFSTEP]
unfold W
[GOAL]
case zero
⊢ 0 < ∏ i in range Nat.zero, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3))
[PROOFSTEP]
simp
[GOAL]
case succ
k : ℕ
hk : 0 < W k
⊢ 0 < W (Nat.succ k)
[PROOFSTEP]
rw [W_succ]
[GOAL]
case succ
k : ℕ
hk : 0 < W k
⊢ 0 < W k * ((2 * ↑k + 2) / (2 * ↑k + 1) * ((2 * ↑k + 2) / (2 * ↑k + 3)))
[PROOFSTEP]
refine' mul_pos hk (mul_pos (div_pos _ _) (div_pos _ _))
[GOAL]
case succ.refine'_1
k : ℕ
hk : 0 < W k
⊢ 0 < 2 * ↑k + 2
[PROOFSTEP]
positivity
[GOAL]
case succ.refine'_2
k : ℕ
hk : 0 < W k
⊢ 0 < 2 * ↑k + 1
[PROOFSTEP]
positivity
[GOAL]
case succ.refine'_3
k : ℕ
hk : 0 < W k
⊢ 0 < 2 * ↑k + 2
[PROOFSTEP]
positivity
[GOAL]
case succ.refine'_4
k : ℕ
hk : 0 < W k
⊢ 0 < 2 * ↑k + 3
[PROOFSTEP]
positivity
[GOAL]
n : ℕ
⊢ W n = ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
[PROOFSTEP]
induction' n with n IH
[GOAL]
case zero
⊢ W Nat.zero = ↑(2 ^ (4 * Nat.zero)) * ↑(Nat.zero ! ^ 4) / (↑((2 * Nat.zero)! ^ 2) * (2 * ↑Nat.zero + 1))
[PROOFSTEP]
simp only [W, prod_range_zero, Nat.factorial_zero, mul_zero, pow_zero, algebraMap.coe_one, one_pow, mul_one,
  algebraMap.coe_zero, zero_add, div_self, Ne.def, one_ne_zero, not_false_iff]
[GOAL]
case zero
⊢ 1 = ↑(2 ^ (4 * Nat.zero)) * ↑1 / (↑((2 * Nat.zero)! ^ 2) * (2 * ↑Nat.zero + 1))
[PROOFSTEP]
norm_num
[GOAL]
case succ
n : ℕ
IH : W n = ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ W (Nat.succ n) = ↑(2 ^ (4 * Nat.succ n)) * ↑((Nat.succ n)! ^ 4) / (↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1))
[PROOFSTEP]
unfold W at IH ⊢
[GOAL]
case succ
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ∏ i in range (Nat.succ n), (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * Nat.succ n)) * ↑((Nat.succ n)! ^ 4) / (↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1))
[PROOFSTEP]
rw [prod_range_succ, IH, _root_.div_mul_div_comm, _root_.div_mul_div_comm]
[GOAL]
case succ
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) * ((2 * ↑n + 2) * (2 * ↑n + 2)) /
      (↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3))) =
    ↑(2 ^ (4 * Nat.succ n)) * ↑((Nat.succ n)! ^ 4) / (↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1))
[PROOFSTEP]
refine' (div_eq_div_iff _ _).mpr _
[GOAL]
case succ.refine'_1
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)) ≠ 0
case succ.refine'_2
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1) ≠ 0
case succ.refine'_3
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) * ((2 * ↑n + 2) * (2 * ↑n + 2)) * (↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1)) =
    ↑(2 ^ (4 * Nat.succ n)) * ↑((Nat.succ n)! ^ 4) * (↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)))
[PROOFSTEP]
any_goals exact ne_of_gt (by positivity)
[GOAL]
case succ.refine'_1
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)) ≠ 0
[PROOFSTEP]
exact ne_of_gt (by positivity)
[GOAL]
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ 0 < ↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3))
[PROOFSTEP]
positivity
[GOAL]
case succ.refine'_2
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1) ≠ 0
[PROOFSTEP]
exact ne_of_gt (by positivity)
[GOAL]
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ 0 < ↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1)
[PROOFSTEP]
positivity
[GOAL]
case succ.refine'_3
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) * ((2 * ↑n + 2) * (2 * ↑n + 2)) * (↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1)) =
    ↑(2 ^ (4 * Nat.succ n)) * ↑((Nat.succ n)! ^ 4) * (↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)))
[PROOFSTEP]
exact ne_of_gt (by positivity)
[GOAL]
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ?m.19110 < ?m.19109
[PROOFSTEP]
positivity
[GOAL]
case succ.refine'_3
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) * ((2 * ↑n + 2) * (2 * ↑n + 2)) * (↑((2 * Nat.succ n)! ^ 2) * (2 * ↑(Nat.succ n) + 1)) =
    ↑(2 ^ (4 * Nat.succ n)) * ↑((Nat.succ n)! ^ 4) * (↑((2 * n)! ^ 2) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)))
[PROOFSTEP]
simp_rw [Nat.mul_succ, Nat.factorial_succ, pow_succ]
[GOAL]
case succ.refine'_3
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ ↑(2 ^ (4 * n)) * ↑(n ! * (n ! * (n ! * (n ! * n ! ^ 0)))) * ((2 * ↑n + 2) * (2 * ↑n + 2)) *
      (↑((2 * n + 1 + 1) * ((2 * n + 1) * (2 * n)!) *
            ((2 * n + 1 + 1) * ((2 * n + 1) * (2 * n)!) * ((2 * n + 1 + 1) * ((2 * n + 1) * (2 * n)!)) ^ 0)) *
        (2 * ↑(Nat.succ n) + 1)) =
    ↑(2 * (2 * (2 * (2 * 2 ^ (4 * n))))) *
        ↑((n + 1) * n ! * ((n + 1) * n ! * ((n + 1) * n ! * ((n + 1) * n ! * ((n + 1) * n !) ^ 0)))) *
      (↑((2 * n)! * ((2 * n)! * (2 * n)! ^ 0)) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)))
[PROOFSTEP]
push_cast
[GOAL]
case succ.refine'_3
n : ℕ
IH :
  ∏ i in range n, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3)) =
    ↑(2 ^ (4 * n)) * ↑(n ! ^ 4) / (↑((2 * n)! ^ 2) * (2 * ↑n + 1))
⊢ 2 ^ (4 * n) * (↑n ! * (↑n ! * (↑n ! * (↑n ! * ↑n ! ^ 0)))) * ((2 * ↑n + 2) * (2 * ↑n + 2)) *
      ((2 * ↑n + 1 + 1) * ((2 * ↑n + 1) * ↑(2 * n)!) *
          ((2 * ↑n + 1 + 1) * ((2 * ↑n + 1) * ↑(2 * n)!) * ((2 * ↑n + 1 + 1) * ((2 * ↑n + 1) * ↑(2 * n)!)) ^ 0) *
        (2 * (↑n + 1) + 1)) =
    2 * (2 * (2 * (2 * 2 ^ (4 * n)))) *
        ((↑n + 1) * ↑n ! * ((↑n + 1) * ↑n ! * ((↑n + 1) * ↑n ! * ((↑n + 1) * ↑n ! * ((↑n + 1) * ↑n !) ^ 0)))) *
      (↑(2 * n)! * (↑(2 * n)! * ↑(2 * n)! ^ 0) * (2 * ↑n + 1) * ((2 * ↑n + 1) * (2 * ↑n + 3)))
[PROOFSTEP]
ring_nf
[GOAL]
k : ℕ
⊢ (π / 2)⁻¹ * W k = (∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k + 1)) / ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k)
[PROOFSTEP]
rw [integral_sin_pow_even, integral_sin_pow_odd, mul_div_mul_comm, ← prod_div_distrib, inv_div]
[GOAL]
k : ℕ
⊢ 2 / π * W k = 2 / π * ∏ x in range k, (2 * ↑x + 2) / (2 * ↑x + 3) / ((2 * ↑x + 1) / (2 * ↑x + 2))
[PROOFSTEP]
simp_rw [div_div_div_comm, div_div_eq_mul_div, mul_div_assoc]
[GOAL]
k : ℕ
⊢ 2 / π * W k = 2 / π * ∏ x in range k, (2 * ↑x + 2) / (2 * ↑x + 1) * ((2 * ↑x + 2) / (2 * ↑x + 3))
[PROOFSTEP]
rfl
[GOAL]
k : ℕ
⊢ W k ≤ π / 2
[PROOFSTEP]
rw [← div_le_one pi_div_two_pos, div_eq_inv_mul]
[GOAL]
k : ℕ
⊢ (π / 2)⁻¹ * W k ≤ 1
[PROOFSTEP]
rw [W_eq_integral_sin_pow_div_integral_sin_pow, div_le_one (integral_sin_pow_pos _)]
[GOAL]
k : ℕ
⊢ ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k + 1) ≤ ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k)
[PROOFSTEP]
apply integral_sin_pow_succ_le
[GOAL]
k : ℕ
⊢ (2 * ↑k + 1) / (2 * ↑k + 2) * (π / 2) ≤ W k
[PROOFSTEP]
rw [← le_div_iff pi_div_two_pos, div_eq_inv_mul (W k) _]
[GOAL]
k : ℕ
⊢ (2 * ↑k + 1) / (2 * ↑k + 2) ≤ (π / 2)⁻¹ * W k
[PROOFSTEP]
rw [W_eq_integral_sin_pow_div_integral_sin_pow, le_div_iff (integral_sin_pow_pos _)]
[GOAL]
k : ℕ
⊢ (2 * ↑k + 1) / (2 * ↑k + 2) * ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k) ≤ ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k + 1)
[PROOFSTEP]
convert integral_sin_pow_succ_le (2 * k + 1)
[GOAL]
case h.e'_3
k : ℕ
⊢ (2 * ↑k + 1) / (2 * ↑k + 2) * ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k) = ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k + 1 + 1)
[PROOFSTEP]
rw [integral_sin_pow (2 * k)]
[GOAL]
case h.e'_3
k : ℕ
⊢ (2 * ↑k + 1) / (2 * ↑k + 2) * ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k) =
    (sin 0 ^ (2 * k + 1) * cos 0 - sin π ^ (2 * k + 1) * cos π) / (↑(2 * k) + 2) +
      (↑(2 * k) + 1) / (↑(2 * k) + 2) * ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k)
[PROOFSTEP]
simp only [sin_zero, zero_pow', Ne.def, Nat.succ_ne_zero, zero_mul, sin_pi, tsub_zero, zero_div, zero_add]
[GOAL]
case h.e'_3
k : ℕ
⊢ (2 * ↑k + 1) / (2 * ↑k + 2) * ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k) =
    (↑(2 * k) + 1) / (↑(2 * k) + 2) * ∫ (x : ℝ) in 0 ..π, sin x ^ (2 * k)
[PROOFSTEP]
norm_cast
[GOAL]
⊢ Tendsto W atTop (𝓝 (π / 2))
[PROOFSTEP]
refine' tendsto_of_tendsto_of_tendsto_of_le_of_le _ tendsto_const_nhds le_W W_le
[GOAL]
⊢ Tendsto (fun i => (2 * ↑i + 1) / (2 * ↑i + 2) * (π / 2)) atTop (𝓝 (π / 2))
[PROOFSTEP]
have : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2)) := by rw [sub_zero, one_mul]
[GOAL]
⊢ 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
[PROOFSTEP]
rw [sub_zero, one_mul]
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
⊢ Tendsto (fun i => (2 * ↑i + 1) / (2 * ↑i + 2) * (π / 2)) atTop (𝓝 (π / 2))
[PROOFSTEP]
rw [this]
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
⊢ Tendsto (fun i => (2 * ↑i + 1) / (2 * ↑i + 2) * (π / 2)) atTop (𝓝 ((1 - 0) * (π / 2)))
[PROOFSTEP]
refine' Tendsto.mul _ tendsto_const_nhds
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
⊢ Tendsto (fun i => (2 * ↑i + 1) / (2 * ↑i + 2)) atTop (𝓝 (1 - 0))
[PROOFSTEP]
have h : ∀ n : ℕ, ((2 : ℝ) * n + 1) / (2 * n + 2) = 1 - 1 / (2 * n + 2) :=
  by
  intro n
  rw [sub_div' _ _ _
      (ne_of_gt (add_pos_of_nonneg_of_pos (mul_nonneg (two_pos : 0 < (2 : ℝ)).le (Nat.cast_nonneg _)) two_pos)),
    one_mul]
  congr 1; ring
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
⊢ ∀ (n : ℕ), (2 * ↑n + 1) / (2 * ↑n + 2) = 1 - 1 / (2 * ↑n + 2)
[PROOFSTEP]
intro n
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
n : ℕ
⊢ (2 * ↑n + 1) / (2 * ↑n + 2) = 1 - 1 / (2 * ↑n + 2)
[PROOFSTEP]
rw [sub_div' _ _ _
    (ne_of_gt (add_pos_of_nonneg_of_pos (mul_nonneg (two_pos : 0 < (2 : ℝ)).le (Nat.cast_nonneg _)) two_pos)),
  one_mul]
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
n : ℕ
⊢ (2 * ↑n + 1) / (2 * ↑n + 2) = (2 * ↑n + 2 - 1) / (2 * ↑n + 2)
[PROOFSTEP]
congr 1
[GOAL]
case e_a
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
n : ℕ
⊢ 2 * ↑n + 1 = 2 * ↑n + 2 - 1
[PROOFSTEP]
ring
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
h : ∀ (n : ℕ), (2 * ↑n + 1) / (2 * ↑n + 2) = 1 - 1 / (2 * ↑n + 2)
⊢ Tendsto (fun i => (2 * ↑i + 1) / (2 * ↑i + 2)) atTop (𝓝 (1 - 0))
[PROOFSTEP]
simp_rw [h]
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
h : ∀ (n : ℕ), (2 * ↑n + 1) / (2 * ↑n + 2) = 1 - 1 / (2 * ↑n + 2)
⊢ Tendsto (fun i => 1 - 1 / (2 * ↑i + 2)) atTop (𝓝 (1 - 0))
[PROOFSTEP]
refine' (tendsto_const_nhds.div_atTop _).const_sub _
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
h : ∀ (n : ℕ), (2 * ↑n + 1) / (2 * ↑n + 2) = 1 - 1 / (2 * ↑n + 2)
⊢ Tendsto (fun i => 2 * ↑i + 2) atTop atTop
[PROOFSTEP]
refine' Tendsto.atTop_add _ tendsto_const_nhds
[GOAL]
this : 𝓝 (π / 2) = 𝓝 ((1 - 0) * (π / 2))
h : ∀ (n : ℕ), (2 * ↑n + 1) / (2 * ↑n + 2) = 1 - 1 / (2 * ↑n + 2)
⊢ Tendsto (fun i => 2 * ↑i) atTop atTop
[PROOFSTEP]
exact tendsto_nat_cast_atTop_atTop.const_mul_atTop two_pos


[GOAL]
α : Type u
β : Type v
inst✝² : Mul α
inst✝¹ : Mul β
γ : Type u_1
inst✝ : Mul γ
f : α → β
g : β → γ
hf : IsMulHom f
hg : IsMulHom g
x y : α
⊢ (g ∘ f) (x * y) = (g ∘ f) x * (g ∘ f) y
[PROOFSTEP]
simp only [Function.comp, hf.map_mul, hg.map_mul]
[GOAL]
α✝ : Type u
β✝ : Type v
inst✝⁴ : Mul α✝
inst✝³ : Mul β✝
γ : Type u_1
inst✝² : Mul γ
α : Type u_2
β : Type u_3
inst✝¹ : Semigroup α
inst✝ : CommSemigroup β
f g : α → β
hf : IsMulHom f
hg : IsMulHom g
a b : α
⊢ f (a * b) * g (a * b) = f a * g a * (f b * g b)
[PROOFSTEP]
simp only [hf.map_mul, hg.map_mul, mul_comm, mul_assoc, mul_left_comm]
[GOAL]
α : Type u
β : Type v
inst✝¹ : MulOneClass α
inst✝ : Group β
f : α → β
hf : IsMulHom f
⊢ ?m.13736 hf * f 1 = ?m.13736 hf
[PROOFSTEP]
rw [← hf.map_mul, one_mul]
[GOAL]
α : Type u
β : Type v
inst✝² : MulOneClass α
inst✝¹ : MulOneClass β
f : α → β
hf : IsMonoidHom f
γ : Type u_1
inst✝ : MulOneClass γ
g : β → γ
hg : IsMonoidHom g
src✝ : IsMulHom (g ∘ f) := IsMulHom.comp hf.toIsMulHom hg.toIsMulHom
⊢ g (f 1) = 1
[PROOFSTEP]
rw [hf.map_one, hg.map_one]
[GOAL]
α : Type u
β : Type v
inst✝¹ : Group α
inst✝ : Group β
f : α → β
hf✝ hf : IsGroupHom f
a : α
⊢ f a⁻¹ * f a = 1
[PROOFSTEP]
rw [← hf.map_mul, inv_mul_self, hf.map_one]
[GOAL]
α : Type u
β : Type v
inst✝¹ : Group α
inst✝ : Group β
f : α → β
hf✝ hf : IsGroupHom f
a b : α
⊢ f (a / b) = f a / f b
[PROOFSTEP]
simp_rw [div_eq_mul_inv, hf.map_mul, hf.map_inv]
[GOAL]
α : Type u
β : Type v
inst✝¹ : Group α
inst✝ : Group β
f✝ : α → β
hf✝ : IsGroupHom f✝
f : α → β
hf : IsGroupHom f
h : Function.Injective f
x✝ : α
⊢ f x✝ = 1 → x✝ = 1
[PROOFSTEP]
rw [← hf.map_one]
[GOAL]
α : Type u
β : Type v
inst✝¹ : Group α
inst✝ : Group β
f✝ : α → β
hf✝ : IsGroupHom f✝
f : α → β
hf : IsGroupHom f
h : Function.Injective f
x✝ : α
⊢ f x✝ = f 1 → x✝ = 1
[PROOFSTEP]
exact @h _ _
[GOAL]
α : Type u
β : Type v
inst✝¹ : Group α
inst✝ : Group β
f✝ : α → β
hf✝ : IsGroupHom f✝
f : α → β
hf : IsGroupHom f
h : ∀ (a : α), f a = 1 → a = 1
x y : α
hxy : f x = f y
⊢ f (x / y) = 1
[PROOFSTEP]
rwa [hf.map_div, div_eq_one]
[GOAL]
α✝ : Type u
β✝ : Type v
α : Type u_1
β : Type u_2
inst✝¹ : AddGroup α
inst✝ : AddCommGroup β
f g : α → β
hf : IsAddGroupHom f
hg : IsAddGroupHom g
⊢ IsAddGroupHom fun a => f a - g a
[PROOFSTEP]
simpa only [sub_eq_add_neg] using hf.add hg.neg


[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f : ι → ℝ
g : ι' → ℝ
hf : Summable f
hg : Summable g
hf' : 0 ≤ f
hg' : 0 ≤ g
⊢ Summable fun x => ∑' (y : ι'), f (x, y).fst * g (x, y).snd
[PROOFSTEP]
simpa only [hg.tsum_mul_left _] using hf.mul_right (∑' x, g x)
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
⊢ Summable fun n => ‖∑ kl in antidiagonal n, f kl.fst * g kl.snd‖
[PROOFSTEP]
have :=
  summable_sum_mul_antidiagonal_of_summable_mul
    (Summable.mul_of_nonneg hf hg (fun _ => norm_nonneg _) fun _ => norm_nonneg _)
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
this : Summable fun n => ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
⊢ Summable fun n => ‖∑ kl in antidiagonal n, f kl.fst * g kl.snd‖
[PROOFSTEP]
refine' summable_of_nonneg_of_le (fun _ => norm_nonneg _) _ this
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
this : Summable fun n => ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
⊢ ∀ (b : ℕ), ‖∑ kl in antidiagonal b, f kl.fst * g kl.snd‖ ≤ ∑ kl in antidiagonal b, ‖f kl.fst‖ * ‖g kl.snd‖
[PROOFSTEP]
intro n
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
this : Summable fun n => ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
n : ℕ
⊢ ‖∑ kl in antidiagonal n, f kl.fst * g kl.snd‖ ≤ ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
[PROOFSTEP]
calc
  ‖∑ kl in antidiagonal n, f kl.1 * g kl.2‖ ≤ ∑ kl in antidiagonal n, ‖f kl.1 * g kl.2‖ := norm_sum_le _ _
  _ ≤ ∑ kl in antidiagonal n, ‖f kl.1‖ * ‖g kl.2‖ := by gcongr; apply norm_mul_le
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
this : Summable fun n => ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
n : ℕ
⊢ ∑ kl in antidiagonal n, ‖f kl.fst * g kl.snd‖ ≤ ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
[PROOFSTEP]
gcongr
[GOAL]
case h
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
this : Summable fun n => ∑ kl in antidiagonal n, ‖f kl.fst‖ * ‖g kl.snd‖
n : ℕ
i✝ : ℕ × ℕ
a✝ : i✝ ∈ antidiagonal n
⊢ ‖f i✝.fst * g i✝.snd‖ ≤ ‖f i✝.fst‖ * ‖g i✝.snd‖
[PROOFSTEP]
apply norm_mul_le
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
⊢ Summable fun n => ‖∑ k in range (n + 1), f k * g (n - k)‖
[PROOFSTEP]
simp_rw [← sum_antidiagonal_eq_sum_range_succ fun k l => f k * g l]
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝ : NormedRing R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
⊢ Summable fun n => ‖∑ ij in antidiagonal n, f ij.fst * g ij.snd‖
[PROOFSTEP]
exact summable_norm_sum_mul_antidiagonal_of_summable_norm hf hg
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝¹ : NormedRing R
inst✝ : CompleteSpace R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
⊢ (∑' (n : ℕ), f n) * ∑' (n : ℕ), g n = ∑' (n : ℕ), ∑ k in range (n + 1), f k * g (n - k)
[PROOFSTEP]
simp_rw [← sum_antidiagonal_eq_sum_range_succ fun k l => f k * g l]
[GOAL]
R : Type u_1
ι : Type u_2
ι' : Type u_3
inst✝¹ : NormedRing R
inst✝ : CompleteSpace R
f g : ℕ → R
hf : Summable fun x => ‖f x‖
hg : Summable fun x => ‖g x‖
⊢ (∑' (n : ℕ), f n) * ∑' (n : ℕ), g n = ∑' (n : ℕ), ∑ ij in antidiagonal n, f ij.fst * g ij.snd
[PROOFSTEP]
exact tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm hf hg


[GOAL]
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
⊢ IsLocalMaxOn f (closure s) a
[PROOFSTEP]
rcases mem_nhdsWithin.1 h with ⟨U, Uo, aU, hU⟩
[GOAL]
case intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
U : Set X
Uo : IsOpen U
aU : a ∈ U
hU : U ∩ s ⊆ {x | (fun x => f x ≤ f a) x}
⊢ IsLocalMaxOn f (closure s) a
[PROOFSTEP]
refine' mem_nhdsWithin.2 ⟨U, Uo, aU, _⟩
[GOAL]
case intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
U : Set X
Uo : IsOpen U
aU : a ∈ U
hU : U ∩ s ⊆ {x | (fun x => f x ≤ f a) x}
⊢ U ∩ closure s ⊆ {x | (fun x => f x ≤ f a) x}
[PROOFSTEP]
rintro x ⟨hxU, hxs⟩
[GOAL]
case intro.intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
U : Set X
Uo : IsOpen U
aU : a ∈ U
hU : U ∩ s ⊆ {x | (fun x => f x ≤ f a) x}
x : X
hxU : x ∈ U
hxs : x ∈ closure s
⊢ x ∈ {x | (fun x => f x ≤ f a) x}
[PROOFSTEP]
refine' ContinuousWithinAt.closure_le _ _ continuousWithinAt_const hU
[GOAL]
case intro.intro.intro.intro.refine'_1
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
U : Set X
Uo : IsOpen U
aU : a ∈ U
hU : U ∩ s ⊆ {x | (fun x => f x ≤ f a) x}
x : X
hxU : x ∈ U
hxs : x ∈ closure s
⊢ x ∈ closure (U ∩ s)
[PROOFSTEP]
rwa [mem_closure_iff_nhdsWithin_neBot, nhdsWithin_inter_of_mem, ← mem_closure_iff_nhdsWithin_neBot]
[GOAL]
case intro.intro.intro.intro.refine'_1
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
U : Set X
Uo : IsOpen U
aU : a ∈ U
hU : U ∩ s ⊆ {x | (fun x => f x ≤ f a) x}
x : X
hxU : x ∈ U
hxs : x ∈ closure s
⊢ U ∈ 𝓝[s] x
[PROOFSTEP]
exact nhdsWithin_le_nhds (Uo.mem_nhds hxU)
[GOAL]
case intro.intro.intro.intro.refine'_2
X : Type u_1
Y : Type u_2
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : Preorder Y
inst✝ : OrderClosedTopology Y
f g : X → Y
s : Set X
a : X
h : IsLocalMaxOn f s a
hc : ContinuousOn f (closure s)
U : Set X
Uo : IsOpen U
aU : a ∈ U
hU : U ∩ s ⊆ {x | (fun x => f x ≤ f a) x}
x : X
hxU : x ∈ U
hxs : x ∈ closure s
⊢ ContinuousWithinAt f (U ∩ s) x
[PROOFSTEP]
exact (hc _ hxs).mono ((inter_subset_right _ _).trans subset_closure)


[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
h₀ : x 0 ≤ y 0
hx : ∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)
hy : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
⊢ x n ≤ y n
[PROOFSTEP]
induction' n with n ihn
[GOAL]
case zero
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)
hy✝ : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
hx : ∀ (k : ℕ), k < Nat.zero → x (k + 1) ≤ f (x k)
hy : ∀ (k : ℕ), k < Nat.zero → f (y k) ≤ y (k + 1)
⊢ x Nat.zero ≤ y Nat.zero
[PROOFSTEP]
exact h₀
[GOAL]
case succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) ≤ f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : (∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n ≤ y n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) ≤ f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ x (Nat.succ n) ≤ y (Nat.succ n)
[PROOFSTEP]
refine' (hx _ n.lt_succ_self).trans ((hf $ ihn _ _).trans (hy _ n.lt_succ_self))
[GOAL]
case succ.refine'_1
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) ≤ f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : (∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n ≤ y n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) ≤ f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ ∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)
case succ.refine'_2
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) ≤ f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : (∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n ≤ y n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) ≤ f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
[PROOFSTEP]
exact fun k hk => hx _ (hk.trans n.lt_succ_self)
[GOAL]
case succ.refine'_2
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) ≤ f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : (∀ (k : ℕ), k < n → x (k + 1) ≤ f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n ≤ y n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) ≤ f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
[PROOFSTEP]
exact fun k hk => hy _ (hk.trans n.lt_succ_self)
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
hn : 0 < n
h₀ : x 0 ≤ y 0
hx : ∀ (k : ℕ), k < n → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
⊢ x n < y n
[PROOFSTEP]
induction' n with n ihn
[GOAL]
case zero
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
hn✝ : 0 < n
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
hn : 0 < Nat.zero
hx : ∀ (k : ℕ), k < Nat.zero → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.zero → f (y k) ≤ y (k + 1)
⊢ x Nat.zero < y Nat.zero
[PROOFSTEP]
exact hn.false.elim
[GOAL]
case succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : 0 < n → (∀ (k : ℕ), k < n → x (k + 1) < f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n < y n
hn : 0 < Nat.succ n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ x (Nat.succ n) < y (Nat.succ n)
[PROOFSTEP]
suffices x n ≤ y n from (hx n n.lt_succ_self).trans_le ((hf this).trans $ hy n n.lt_succ_self)
[GOAL]
case succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : 0 < n → (∀ (k : ℕ), k < n → x (k + 1) < f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n < y n
hn : 0 < Nat.succ n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ x n ≤ y n
[PROOFSTEP]
cases n with
| zero => exact h₀
| succ n =>
  refine' (ihn n.zero_lt_succ (fun k hk => hx _ _) fun k hk => hy _ _).le <;> exact hk.trans n.succ.lt_succ_self
[GOAL]
case succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn : 0 < n → (∀ (k : ℕ), k < n → x (k + 1) < f (x k)) → (∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)) → x n < y n
hn : 0 < Nat.succ n
hx : ∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)
⊢ x n ≤ y n
[PROOFSTEP]
cases n with
| zero => exact h₀
| succ n =>
  refine' (ihn n.zero_lt_succ (fun k hk => hx _ _) fun k hk => hy _ _).le <;> exact hk.trans n.succ.lt_succ_self
[GOAL]
case succ.zero
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
hn✝ : 0 < n
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
ihn :
  0 < Nat.zero →
    (∀ (k : ℕ), k < Nat.zero → x (k + 1) < f (x k)) →
      (∀ (k : ℕ), k < Nat.zero → f (y k) ≤ y (k + 1)) → x Nat.zero < y Nat.zero
hn : 0 < Nat.succ Nat.zero
hx : ∀ (k : ℕ), k < Nat.succ Nat.zero → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ Nat.zero → f (y k) ≤ y (k + 1)
⊢ x Nat.zero ≤ y Nat.zero
[PROOFSTEP]

| zero => exact h₀
[GOAL]
case succ.zero
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
hn✝ : 0 < n
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
ihn :
  0 < Nat.zero →
    (∀ (k : ℕ), k < Nat.zero → x (k + 1) < f (x k)) →
      (∀ (k : ℕ), k < Nat.zero → f (y k) ≤ y (k + 1)) → x Nat.zero < y Nat.zero
hn : 0 < Nat.succ Nat.zero
hx : ∀ (k : ℕ), k < Nat.succ Nat.zero → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ Nat.zero → f (y k) ≤ y (k + 1)
⊢ x Nat.zero ≤ y Nat.zero
[PROOFSTEP]
exact h₀
[GOAL]
case succ.succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn :
  0 < Nat.succ n →
    (∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)) →
      (∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)) → x (Nat.succ n) < y (Nat.succ n)
hn : 0 < Nat.succ (Nat.succ n)
hx : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → f (y k) ≤ y (k + 1)
⊢ x (Nat.succ n) ≤ y (Nat.succ n)
[PROOFSTEP]

| succ n =>
  refine' (ihn n.zero_lt_succ (fun k hk => hx _ _) fun k hk => hy _ _).le <;> exact hk.trans n.succ.lt_succ_self
[GOAL]
case succ.succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn :
  0 < Nat.succ n →
    (∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)) →
      (∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)) → x (Nat.succ n) < y (Nat.succ n)
hn : 0 < Nat.succ (Nat.succ n)
hx : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → f (y k) ≤ y (k + 1)
⊢ x (Nat.succ n) ≤ y (Nat.succ n)
[PROOFSTEP]
refine' (ihn n.zero_lt_succ (fun k hk => hx _ _) fun k hk => hy _ _).le
[GOAL]
case succ.succ.refine'_1
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn :
  0 < Nat.succ n →
    (∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)) →
      (∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)) → x (Nat.succ n) < y (Nat.succ n)
hn : 0 < Nat.succ (Nat.succ n)
hx : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → f (y k) ≤ y (k + 1)
k : ℕ
hk : k < Nat.succ n
⊢ k < Nat.succ (Nat.succ n)
[PROOFSTEP]
exact hk.trans n.succ.lt_succ_self
[GOAL]
case succ.succ.refine'_2
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n✝ : ℕ
hn✝ : 0 < n✝
h₀ : x 0 ≤ y 0
hx✝ : ∀ (k : ℕ), k < n✝ → x (k + 1) < f (x k)
hy✝ : ∀ (k : ℕ), k < n✝ → f (y k) ≤ y (k + 1)
n : ℕ
ihn :
  0 < Nat.succ n →
    (∀ (k : ℕ), k < Nat.succ n → x (k + 1) < f (x k)) →
      (∀ (k : ℕ), k < Nat.succ n → f (y k) ≤ y (k + 1)) → x (Nat.succ n) < y (Nat.succ n)
hn : 0 < Nat.succ (Nat.succ n)
hx : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ (Nat.succ n) → f (y k) ≤ y (k + 1)
k : ℕ
hk : k < Nat.succ n
⊢ k < Nat.succ (Nat.succ n)
[PROOFSTEP]
exact hk.trans n.succ.lt_succ_self
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
n : ℕ
h₀ : x 0 < y 0
hx : ∀ (k : ℕ), k < n → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < n → f (y k) ≤ y (k + 1)
⊢ x n < y n
[PROOFSTEP]
cases n
[GOAL]
case zero
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
h₀ : x 0 < y 0
hx : ∀ (k : ℕ), k < Nat.zero → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.zero → f (y k) ≤ y (k + 1)
⊢ x Nat.zero < y Nat.zero
case succ
α : Type u_1
inst✝ : Preorder α
f : α → α
x y : ℕ → α
hf : Monotone f
h₀ : x 0 < y 0
n✝ : ℕ
hx : ∀ (k : ℕ), k < Nat.succ n✝ → x (k + 1) < f (x k)
hy : ∀ (k : ℕ), k < Nat.succ n✝ → f (y k) ≤ y (k + 1)
⊢ x (Nat.succ n✝) < y (Nat.succ n✝)
[PROOFSTEP]
exacts [h₀, hf.seq_pos_lt_seq_of_lt_of_le (Nat.zero_lt_succ _) h₀.le hx hy]
[GOAL]
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
⊢ (h ∘ g^[n]) x ≤ (f^[n] ∘ h) x
[PROOFSTEP]
apply hf.seq_le_seq n
[GOAL]
case h₀
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
⊢ (h ∘ g^[0]) x ≤ (f^[0] ∘ h) x
[PROOFSTEP]
intros
[GOAL]
case hx
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
⊢ ∀ (k : ℕ), k < n → (h ∘ g^[k + 1]) x ≤ f ((h ∘ g^[k]) x)
[PROOFSTEP]
intros
[GOAL]
case hy
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
⊢ ∀ (k : ℕ), k < n → f ((f^[k] ∘ h) x) ≤ (f^[k + 1] ∘ h) x
[PROOFSTEP]
intros
[GOAL]
case h₀
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
⊢ (h ∘ g^[0]) x ≤ (f^[0] ∘ h) x
[PROOFSTEP]
simp [iterate_succ', -iterate_succ, comp_apply, id_eq, le_refl]
[GOAL]
case hx
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
k✝ : ℕ
a✝ : k✝ < n
⊢ (h ∘ g^[k✝ + 1]) x ≤ f ((h ∘ g^[k✝]) x)
[PROOFSTEP]
simp [iterate_succ', -iterate_succ, comp_apply, id_eq, le_refl]
[GOAL]
case hy
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
k✝ : ℕ
a✝ : k✝ < n
⊢ f ((f^[k✝] ∘ h) x) ≤ (f^[k✝ + 1] ∘ h) x
[PROOFSTEP]
simp [iterate_succ', -iterate_succ, comp_apply, id_eq, le_refl]
[GOAL]
case hx
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
k✝ : ℕ
a✝ : k✝ < n
⊢ h (g (g^[k✝] x)) ≤ f (h (g^[k✝] x))
[PROOFSTEP]
case hx => exact H _
[GOAL]
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
k✝ : ℕ
a✝ : k✝ < n
⊢ h (g (g^[k✝] x)) ≤ f (h (g^[k✝] x))
[PROOFSTEP]
case hx => exact H _
[GOAL]
α : Type u_1
β : Type u_2
inst✝ : Preorder α
f : α → α
x✝ y : ℕ → α
g : β → β
h : β → α
hf : Monotone f
H : h ∘ g ≤ f ∘ h
n : ℕ
x : β
k✝ : ℕ
a✝ : k✝ < n
⊢ h (g (g^[k✝] x)) ≤ f (h (g^[k✝] x))
[PROOFSTEP]
exact H _
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
h : id ≤ f
n : ℕ
⊢ id ≤ f^[n]
[PROOFSTEP]
simpa only [iterate_id] using monotone_id.iterate_le_of_le h n
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
h : id ≤ f
n : ℕ
x : α
⊢ f^[n] x ≤ f^[n + 1] x
[PROOFSTEP]
rw [iterate_succ_apply']
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
h : id ≤ f
n : ℕ
x : α
⊢ f^[n] x ≤ f (f^[n] x)
[PROOFSTEP]
exact h _
[GOAL]
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : Monotone g
x : α
hx : f x ≤ g x
n : ℕ
⊢ f^[n] x ≤ g^[n] x
[PROOFSTEP]
apply hf.seq_le_seq n
[GOAL]
case h₀
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : Monotone g
x : α
hx : f x ≤ g x
n : ℕ
⊢ f^[0] x ≤ g^[0] x
[PROOFSTEP]
rfl
[GOAL]
case hx
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : Monotone g
x : α
hx : f x ≤ g x
n : ℕ
⊢ ∀ (k : ℕ), k < n → f^[k + 1] x ≤ f (f^[k] x)
[PROOFSTEP]
intros
[GOAL]
case hx
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : Monotone g
x : α
hx : f x ≤ g x
n k✝ : ℕ
a✝ : k✝ < n
⊢ f^[k✝ + 1] x ≤ f (f^[k✝] x)
[PROOFSTEP]
rw [iterate_succ_apply']
[GOAL]
case hy
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : Monotone g
x : α
hx : f x ≤ g x
n : ℕ
⊢ ∀ (k : ℕ), k < n → f (g^[k] x) ≤ g^[k + 1] x
[PROOFSTEP]
intros
[GOAL]
case hy
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : Monotone g
x : α
hx : f x ≤ g x
n k✝ : ℕ
a✝ : k✝ < n
⊢ f (g^[k✝] x) ≤ g^[k✝ + 1] x
[PROOFSTEP]
simp [h.iterate_right _ _, hg.iterate _ hx]
[GOAL]
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
hx : f x < g x
n : ℕ
hn : 0 < n
⊢ f^[n] x < g^[n] x
[PROOFSTEP]
apply hf.seq_pos_lt_seq_of_le_of_lt hn
[GOAL]
case h₀
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
hx : f x < g x
n : ℕ
hn : 0 < n
⊢ f^[0] x ≤ g^[0] x
[PROOFSTEP]
rfl
[GOAL]
case hx
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
hx : f x < g x
n : ℕ
hn : 0 < n
⊢ ∀ (k : ℕ), k < n → f^[k + 1] x ≤ f (f^[k] x)
[PROOFSTEP]
intros
[GOAL]
case hx
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
hx : f x < g x
n : ℕ
hn : 0 < n
k✝ : ℕ
a✝ : k✝ < n
⊢ f^[k✝ + 1] x ≤ f (f^[k✝] x)
[PROOFSTEP]
rw [iterate_succ_apply']
[GOAL]
case hy
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
hx : f x < g x
n : ℕ
hn : 0 < n
⊢ ∀ (k : ℕ), k < n → f (g^[k] x) < g^[k + 1] x
[PROOFSTEP]
intros
[GOAL]
case hy
α : Type u_1
inst✝ : Preorder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
hx : f x < g x
n : ℕ
hn : 0 < n
k✝ : ℕ
a✝ : k✝ < n
⊢ f (g^[k✝] x) < g^[k✝ + 1] x
[PROOFSTEP]
simp [h.iterate_right _ _, hg.iterate _ hx]
[GOAL]
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
n : ℕ
hn : 0 < n
⊢ f^[n] x < g^[n] x ↔ f x < g x
[PROOFSTEP]
rcases lt_trichotomy (f x) (g x) with (H | H | H)
[GOAL]
case inl
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
n : ℕ
hn : 0 < n
H : f x < g x
⊢ f^[n] x < g^[n] x ↔ f x < g x
[PROOFSTEP]
simp only [*, iterate_pos_lt_of_map_lt]
[GOAL]
case inr.inl
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
n : ℕ
hn : 0 < n
H : f x = g x
⊢ f^[n] x < g^[n] x ↔ f x < g x
[PROOFSTEP]
simp only [*, h.iterate_eq_of_map_eq, lt_irrefl]
[GOAL]
case inr.inr
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
n : ℕ
hn : 0 < n
H : g x < f x
⊢ f^[n] x < g^[n] x ↔ f x < g x
[PROOFSTEP]
simp only [lt_asymm H, lt_asymm (h.symm.iterate_pos_lt_of_map_lt' hg hf H hn)]
[GOAL]
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
n : ℕ
hn : 0 < n
⊢ f^[n] x ≤ g^[n] x ↔ f x ≤ g x
[PROOFSTEP]
simpa only [not_lt] using not_congr (h.symm.iterate_pos_lt_iff_map_lt' hg hf hn)
[GOAL]
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : StrictMono f
hg : Monotone g
x : α
n : ℕ
hn : 0 < n
⊢ f^[n] x ≤ g^[n] x ↔ f x ≤ g x
[PROOFSTEP]
simpa only [not_lt] using not_congr (h.symm.iterate_pos_lt_iff_map_lt hg hf hn)
[GOAL]
α : Type u_1
inst✝ : LinearOrder α
f g : α → α
h : Commute f g
hf : Monotone f
hg : StrictMono g
x : α
n : ℕ
hn : 0 < n
⊢ f^[n] x = g^[n] x ↔ f x = g x
[PROOFSTEP]
simp only [le_antisymm_iff, h.iterate_pos_le_iff_map_le hf hg hn, h.symm.iterate_pos_le_iff_map_le' hg hf hn]
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x : α
hf : Monotone f
hx : x ≤ f x
n : ℕ
⊢ f^[n] x ≤ f^[n + 1] x
[PROOFSTEP]
rw [iterate_succ_apply]
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x : α
hf : Monotone f
hx : x ≤ f x
n : ℕ
⊢ f^[n] x ≤ f^[n] (f x)
[PROOFSTEP]
exact hf.iterate n hx
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x : α
hf : StrictMono f
hx : x < f x
n : ℕ
⊢ f^[n] x < f^[n + 1] x
[PROOFSTEP]
rw [iterate_succ_apply]
[GOAL]
α : Type u_1
inst✝ : Preorder α
f : α → α
x : α
hf : StrictMono f
hx : x < f x
n : ℕ
⊢ f^[n] x < f^[n] (f x)
[PROOFSTEP]
exact hf.iterate n hx


[GOAL]
n : ℕ
⊢ 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) < π
[PROOFSTEP]
have : sqrt (2 - sqrtTwoAddSeries 0 n) / (2 : ℝ) * (2 : ℝ) ^ (n + 2) < π :=
  by
  rw [← lt_div_iff, ← sin_pi_over_two_pow_succ]; apply sin_lt; apply div_pos pi_pos
  all_goals apply pow_pos; norm_num
[GOAL]
n : ℕ
⊢ sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) < π
[PROOFSTEP]
rw [← lt_div_iff, ← sin_pi_over_two_pow_succ]
[GOAL]
n : ℕ
⊢ sin (π / 2 ^ (n + 2)) < π / 2 ^ (n + 2)
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply sin_lt
[GOAL]
case h
n : ℕ
⊢ 0 < π / 2 ^ (n + 2)
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply div_pos pi_pos
[GOAL]
case h
n : ℕ
⊢ 0 < 2 ^ (n + 2)
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
all_goals apply pow_pos; norm_num
[GOAL]
case h
n : ℕ
⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_pos
[GOAL]
case h.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_pos
[GOAL]
case H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
this : sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) < π
⊢ 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) < π
[PROOFSTEP]
apply lt_of_le_of_lt (le_of_eq _) this
[GOAL]
n : ℕ
this : sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) < π
⊢ 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) = sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2)
[PROOFSTEP]
rw [pow_succ _ (n + 1), ← mul_assoc, div_mul_cancel, mul_comm]
[GOAL]
case h
n : ℕ
this : sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) < π
⊢ 2 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
⊢ π < 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) + 1 / 4 ^ n
[PROOFSTEP]
have : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / (2 : ℝ) + (1 : ℝ) / ((2 : ℝ) ^ n) ^ 3 / 4) * (2 : ℝ) ^ (n + 2) :=
  by
  rw [← div_lt_iff, ← sin_pi_over_two_pow_succ]
  refine' lt_of_lt_of_le (lt_add_of_sub_right_lt (sin_gt_sub_cube _ _)) _
  · apply div_pos pi_pos; apply pow_pos; norm_num
  · rw [div_le_iff']
    · refine' le_trans pi_le_four _
      simp only [show (4 : ℝ) = (2 : ℝ) ^ 2 by norm_num, mul_one]
      apply pow_le_pow; norm_num; apply le_add_of_nonneg_left; apply Nat.zero_le
    · apply pow_pos; norm_num
  apply add_le_add_left; rw [div_le_div_right]
  rw [le_div_iff, ← mul_pow]
  refine' le_trans _ (le_of_eq (one_pow 3)); apply pow_le_pow_of_le_left
  · apply le_of_lt; apply mul_pos; apply div_pos pi_pos; apply pow_pos; norm_num; apply pow_pos
    norm_num
  rw [← le_div_iff]
  refine' le_trans ((div_le_div_right _).mpr pi_le_four) _; apply pow_pos; norm_num
  rw [pow_succ, pow_succ, ← mul_assoc, ← div_div]
    -- Porting note: removed `convert le_rfl`
  all_goals (repeat' apply pow_pos); norm_num
[GOAL]
n : ℕ
⊢ π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
[PROOFSTEP]
rw [← div_lt_iff, ← sin_pi_over_two_pow_succ]
[GOAL]
n : ℕ
⊢ π / 2 ^ (n + 2) < sin (π / 2 ^ (n + 2)) + 1 / (2 ^ n) ^ 3 / 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
refine' lt_of_lt_of_le (lt_add_of_sub_right_lt (sin_gt_sub_cube _ _)) _
[GOAL]
case refine'_1
n : ℕ
⊢ 0 < π / 2 ^ (n + 2)
[PROOFSTEP]
apply div_pos pi_pos
[GOAL]
case refine'_1
n : ℕ
⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_1.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_2
n : ℕ
⊢ π / 2 ^ (n + 2) ≤ 1
[PROOFSTEP]
rw [div_le_iff']
[GOAL]
case refine'_2
n : ℕ
⊢ π ≤ 2 ^ (n + 2) * 1
[PROOFSTEP]
refine' le_trans pi_le_four _
[GOAL]
case refine'_2
n : ℕ
⊢ 4 ≤ 2 ^ (n + 2) * 1
[PROOFSTEP]
simp only [show (4 : ℝ) = (2 : ℝ) ^ 2 by norm_num, mul_one]
[GOAL]
n : ℕ
⊢ 4 = 2 ^ 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_2
n : ℕ
⊢ 2 ^ 2 ≤ 2 ^ (n + 2)
[PROOFSTEP]
apply pow_le_pow
[GOAL]
case refine'_2.ha
n : ℕ
⊢ 1 ≤ 2
case refine'_2.h n : ℕ ⊢ 2 ≤ n + 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_2.h
n : ℕ
⊢ 2 ≤ n + 2
[PROOFSTEP]
apply le_add_of_nonneg_left
[GOAL]
case refine'_2.h.h
n : ℕ
⊢ 0 ≤ n
[PROOFSTEP]
apply Nat.zero_le
[GOAL]
case refine'_2
n : ℕ
⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_2.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3
n : ℕ
⊢ sin (π / 2 ^ (n + 2)) + (π / 2 ^ (n + 2)) ^ 3 / 4 ≤ sin (π / 2 ^ (n + 2)) + 1 / (2 ^ n) ^ 3 / 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply add_le_add_left
[GOAL]
case refine'_3.bc
n : ℕ
⊢ (π / 2 ^ (n + 2)) ^ 3 / 4 ≤ 1 / (2 ^ n) ^ 3 / 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
rw [div_le_div_right]
[GOAL]
case refine'_3.bc
n : ℕ
⊢ (π / 2 ^ (n + 2)) ^ 3 ≤ 1 / (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
rw [le_div_iff, ← mul_pow]
[GOAL]
case refine'_3.bc
n : ℕ
⊢ (π / 2 ^ (n + 2) * 2 ^ n) ^ 3 ≤ 1
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
refine' le_trans _ (le_of_eq (one_pow 3))
[GOAL]
case refine'_3.bc
n : ℕ
⊢ (π / 2 ^ (n + 2) * 2 ^ n) ^ 3 ≤ 1 ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_le_pow_of_le_left
[GOAL]
case refine'_3.bc.ha
n : ℕ
⊢ 0 ≤ π / 2 ^ (n + 2) * 2 ^ n
[PROOFSTEP]
apply le_of_lt
[GOAL]
case refine'_3.bc.ha.a
n : ℕ
⊢ 0 < π / 2 ^ (n + 2) * 2 ^ n
[PROOFSTEP]
apply mul_pos
[GOAL]
case refine'_3.bc.ha.a.ha
n : ℕ
⊢ 0 < π / 2 ^ (n + 2)
case refine'_3.bc.ha.a.hb n : ℕ ⊢ 0 < 2 ^ n
[PROOFSTEP]
apply div_pos pi_pos
[GOAL]
case refine'_3.bc.ha.a.ha
n : ℕ
⊢ 0 < 2 ^ (n + 2)
case refine'_3.bc.ha.a.hb n : ℕ ⊢ 0 < 2 ^ n
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.ha.a.ha.H
n : ℕ
⊢ 0 < 2
case refine'_3.bc.ha.a.hb n : ℕ ⊢ 0 < 2 ^ n
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3.bc.ha.a.hb
n : ℕ
⊢ 0 < 2 ^ n
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.ha.a.hb.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3.bc.hab
n : ℕ
⊢ π / 2 ^ (n + 2) * 2 ^ n ≤ 1
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
rw [← le_div_iff]
[GOAL]
case refine'_3.bc.hab
n : ℕ
⊢ π / 2 ^ (n + 2) ≤ 1 / 2 ^ n
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
refine' le_trans ((div_le_div_right _).mpr pi_le_four) _
[GOAL]
case refine'_3.bc.hab.refine'_1
n : ℕ
⊢ 0 < 2 ^ (n + 2)
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / 2 ^ (n + 2) ≤ 1 / 2 ^ n
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.hab.refine'_1.H
n : ℕ
⊢ 0 < 2
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / 2 ^ (n + 2) ≤ 1 / 2 ^ n
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / 2 ^ (n + 2) ≤ 1 / 2 ^ n
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
rw [pow_succ, pow_succ, ← mul_assoc, ← div_div]
  -- Porting note: removed `convert le_rfl`
[GOAL]
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / (2 * 2) / 2 ^ n ≤ 1 / 2 ^ n
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
case refine'_3.bc
n : ℕ
⊢ 0 < 4
n : ℕ ⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
all_goals (repeat' apply pow_pos); norm_num
[GOAL]
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / (2 * 2) / 2 ^ n ≤ 1 / 2 ^ n
[PROOFSTEP]
repeat' apply pow_pos
[GOAL]
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / (2 * 2) / 2 ^ n ≤ 1 / 2 ^ n
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.hab.refine'_2
n : ℕ
⊢ 4 / (2 * 2) / 2 ^ n ≤ 1 / 2 ^ n
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
[PROOFSTEP]
repeat' apply pow_pos
[GOAL]
case refine'_3.bc.hab
n : ℕ
⊢ 0 < 2 ^ n
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.hab.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.hab.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
[PROOFSTEP]
repeat' apply pow_pos
[GOAL]
case refine'_3.bc
n : ℕ
⊢ 0 < (2 ^ n) ^ 3
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.H
n : ℕ
⊢ 0 < 2 ^ n
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.H.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc.H.H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
case refine'_3.bc
n : ℕ
⊢ 0 < 4
[PROOFSTEP]
repeat' apply pow_pos
[GOAL]
case refine'_3.bc
n : ℕ
⊢ 0 < 4
[PROOFSTEP]
apply pow_pos
[GOAL]
case refine'_3.bc
n : ℕ
⊢ 0 < 4
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
repeat' apply pow_pos
[GOAL]
n : ℕ
⊢ 0 < 2 ^ (n + 2)
[PROOFSTEP]
apply pow_pos
[GOAL]
case H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
apply pow_pos
[GOAL]
case H
n : ℕ
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ π < 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) + 1 / 4 ^ n
[PROOFSTEP]
apply lt_of_lt_of_le this (le_of_eq _)
[GOAL]
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2) =
    2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) + 1 / 4 ^ n
[PROOFSTEP]
rw [add_mul]
[GOAL]
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) + 1 / (2 ^ n) ^ 3 / 4 * 2 ^ (n + 2) =
    2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) + 1 / 4 ^ n
[PROOFSTEP]
congr 1
[GOAL]
case e_a
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ sqrt (2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) = 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n)
[PROOFSTEP]
rw [pow_succ _ (n + 1), ← mul_assoc, div_mul_cancel, mul_comm]
[GOAL]
case e_a.h
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 2 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
case e_a
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 1 / (2 ^ n) ^ 3 / 4 * 2 ^ (n + 2) = 1 / 4 ^ n
[PROOFSTEP]
rw [pow_succ, ← pow_mul, mul_comm n 2, pow_mul, show (2 : ℝ) ^ 2 = 4 by norm_num, pow_succ, pow_succ, ←
  mul_assoc (2 : ℝ), show (2 : ℝ) * 2 = 4 by norm_num, ← mul_assoc, div_mul_cancel, mul_comm ((2 : ℝ) ^ n), ← div_div,
  div_mul_cancel]
[GOAL]
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 2 ^ 2 = 4
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 2 * 2 = 4
[PROOFSTEP]
norm_num
[GOAL]
case e_a.h
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 2 ^ n ≠ 0
case e_a.h n : ℕ this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2) ⊢ 4 ≠ 0
[PROOFSTEP]
apply pow_ne_zero
[GOAL]
case e_a.h.h
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 2 ≠ 0
case e_a.h n : ℕ this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2) ⊢ 4 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
case e_a.h
n : ℕ
this : π < (sqrt (2 - sqrtTwoAddSeries 0 n) / 2 + 1 / (2 ^ n) ^ 3 / 4) * 2 ^ (n + 2)
⊢ 4 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
a : ℝ
h : sqrtTwoAddSeries (↑0 / ↑1) n ≤ 2 - (a / 2 ^ (n + 1)) ^ 2
⊢ a < π
[PROOFSTEP]
refine' lt_of_le_of_lt _ (pi_gt_sqrtTwoAddSeries n)
[GOAL]
n : ℕ
a : ℝ
h : sqrtTwoAddSeries (↑0 / ↑1) n ≤ 2 - (a / 2 ^ (n + 1)) ^ 2
⊢ a ≤ 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n)
[PROOFSTEP]
rw [mul_comm]
[GOAL]
n : ℕ
a : ℝ
h : sqrtTwoAddSeries (↑0 / ↑1) n ≤ 2 - (a / 2 ^ (n + 1)) ^ 2
⊢ a ≤ sqrt (2 - sqrtTwoAddSeries 0 n) * 2 ^ (n + 1)
[PROOFSTEP]
refine' (div_le_iff (pow_pos (by norm_num) _ : (0 : ℝ) < _)).mp (le_sqrt_of_sq_le _)
[GOAL]
n : ℕ
a : ℝ
h : sqrtTwoAddSeries (↑0 / ↑1) n ≤ 2 - (a / 2 ^ (n + 1)) ^ 2
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
n : ℕ
a : ℝ
h : sqrtTwoAddSeries (↑0 / ↑1) n ≤ 2 - (a / 2 ^ (n + 1)) ^ 2
⊢ (a / 2 ^ (n + 1)) ^ 2 ≤ 2 - sqrtTwoAddSeries 0 n
[PROOFSTEP]
rwa [le_sub_comm, show (0 : ℝ) = (0 : ℕ) / (1 : ℕ) by rw [Nat.cast_zero, zero_div]]
[GOAL]
n : ℕ
a : ℝ
h : sqrtTwoAddSeries (↑0 / ↑1) n ≤ 2 - (a / 2 ^ (n + 1)) ^ 2
⊢ 0 = ↑0 / ↑1
[PROOFSTEP]
rw [Nat.cast_zero, zero_div]
[GOAL]
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
⊢ sqrtTwoAddSeries (↑a / ↑b) (n + 1) ≤ z
[PROOFSTEP]
refine' le_trans _ hz
[GOAL]
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
⊢ sqrtTwoAddSeries (↑a / ↑b) (n + 1) ≤ sqrtTwoAddSeries (↑c / ↑d) n
[PROOFSTEP]
rw [sqrtTwoAddSeries_succ]
[GOAL]
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
⊢ sqrtTwoAddSeries (sqrt (2 + ↑a / ↑b)) n ≤ sqrtTwoAddSeries (↑c / ↑d) n
[PROOFSTEP]
apply sqrtTwoAddSeries_monotone_left
[GOAL]
case h
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
⊢ sqrt (2 + ↑a / ↑b) ≤ ↑c / ↑d
[PROOFSTEP]
have hb' : 0 < (b : ℝ) := Nat.cast_pos.2 hb
[GOAL]
case h
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
hb' : 0 < ↑b
⊢ sqrt (2 + ↑a / ↑b) ≤ ↑c / ↑d
[PROOFSTEP]
have hd' : 0 < (d : ℝ) := Nat.cast_pos.2 hd
[GOAL]
case h
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
hb' : 0 < ↑b
hd' : 0 < ↑d
⊢ sqrt (2 + ↑a / ↑b) ≤ ↑c / ↑d
[PROOFSTEP]
rw [sqrt_le_left (div_nonneg c.cast_nonneg d.cast_nonneg), div_pow, add_div_eq_mul_add_div _ _ (ne_of_gt hb'),
  div_le_div_iff hb' (pow_pos hd' _)]
[GOAL]
case h
c d a b n : ℕ
z : ℝ
hz : sqrtTwoAddSeries (↑c / ↑d) n ≤ z
hb : 0 < b
hd : 0 < d
h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b
hb' : 0 < ↑b
hd' : 0 < ↑d
⊢ (2 * ↑b + ↑a) * ↑d ^ 2 ≤ ↑c ^ 2 * ↑b
[PROOFSTEP]
exact_mod_cast h
[GOAL]
n : ℕ
a : ℝ
h : 2 - ((a - 1 / 4 ^ n) / 2 ^ (n + 1)) ^ 2 ≤ sqrtTwoAddSeries (↑0 / ↑1) n
h₂ : 1 / 4 ^ n ≤ a
⊢ π < a
[PROOFSTEP]
refine' lt_of_lt_of_le (pi_lt_sqrtTwoAddSeries n) _
[GOAL]
n : ℕ
a : ℝ
h : 2 - ((a - 1 / 4 ^ n) / 2 ^ (n + 1)) ^ 2 ≤ sqrtTwoAddSeries (↑0 / ↑1) n
h₂ : 1 / 4 ^ n ≤ a
⊢ 2 ^ (n + 1) * sqrt (2 - sqrtTwoAddSeries 0 n) + 1 / 4 ^ n ≤ a
[PROOFSTEP]
rw [← le_sub_iff_add_le, ← le_div_iff', sqrt_le_left, sub_le_comm]
[GOAL]
n : ℕ
a : ℝ
h : 2 - ((a - 1 / 4 ^ n) / 2 ^ (n + 1)) ^ 2 ≤ sqrtTwoAddSeries (↑0 / ↑1) n
h₂ : 1 / 4 ^ n ≤ a
⊢ 2 - ((a - 1 / 4 ^ n) / 2 ^ (n + 1)) ^ 2 ≤ sqrtTwoAddSeries 0 n
[PROOFSTEP]
rwa [Nat.cast_zero, zero_div] at h
[GOAL]
n : ℕ
a : ℝ
h : 2 - ((a - 1 / 4 ^ n) / 2 ^ (n + 1)) ^ 2 ≤ sqrtTwoAddSeries (↑0 / ↑1) n
h₂ : 1 / 4 ^ n ≤ a
⊢ 0 ≤ (a - 1 / 4 ^ n) / 2 ^ (n + 1)
[PROOFSTEP]
exact div_nonneg (sub_nonneg.2 h₂) (pow_nonneg (le_of_lt zero_lt_two) _)
[GOAL]
n : ℕ
a : ℝ
h : 2 - ((a - 1 / 4 ^ n) / 2 ^ (n + 1)) ^ 2 ≤ sqrtTwoAddSeries (↑0 / ↑1) n
h₂ : 1 / 4 ^ n ≤ a
⊢ 0 < 2 ^ (n + 1)
[PROOFSTEP]
exact pow_pos zero_lt_two _
[GOAL]
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
⊢ z ≤ sqrtTwoAddSeries (↑c / ↑d) (n + 1)
[PROOFSTEP]
apply le_trans hz
[GOAL]
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
⊢ sqrtTwoAddSeries (↑a / ↑b) n ≤ sqrtTwoAddSeries (↑c / ↑d) (n + 1)
[PROOFSTEP]
rw [sqrtTwoAddSeries_succ]
[GOAL]
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
⊢ sqrtTwoAddSeries (↑a / ↑b) n ≤ sqrtTwoAddSeries (sqrt (2 + ↑c / ↑d)) n
[PROOFSTEP]
apply sqrtTwoAddSeries_monotone_left
[GOAL]
case h
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
⊢ ↑a / ↑b ≤ sqrt (2 + ↑c / ↑d)
[PROOFSTEP]
apply le_sqrt_of_sq_le
[GOAL]
case h.h
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
⊢ (↑a / ↑b) ^ 2 ≤ 2 + ↑c / ↑d
[PROOFSTEP]
have hb' : 0 < (b : ℝ) := Nat.cast_pos.2 hb
[GOAL]
case h.h
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
hb' : 0 < ↑b
⊢ (↑a / ↑b) ^ 2 ≤ 2 + ↑c / ↑d
[PROOFSTEP]
have hd' : 0 < (d : ℝ) := Nat.cast_pos.2 hd
[GOAL]
case h.h
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
hb' : 0 < ↑b
hd' : 0 < ↑d
⊢ (↑a / ↑b) ^ 2 ≤ 2 + ↑c / ↑d
[PROOFSTEP]
rw [div_pow, add_div_eq_mul_add_div _ _ (ne_of_gt hd'), div_le_div_iff (pow_pos hb' _) hd']
[GOAL]
case h.h
a b c d n : ℕ
z : ℝ
hz : z ≤ sqrtTwoAddSeries (↑a / ↑b) n
hb : 0 < b
hd : 0 < d
h : a ^ 2 * d ≤ (2 * d + c) * b ^ 2
hb' : 0 < ↑b
hd' : 0 < ↑d
⊢ ↑a ^ 2 * ↑d ≤ (2 * ↑d + ↑c) * ↑b ^ 2
[PROOFSTEP]
exact_mod_cast h
[GOAL]
⊢ 3 < π
[PROOFSTEP]
pi_lower_bound [23 / 16]
[GOAL]
⊢ 3.14 < π
[PROOFSTEP]
pi_lower_bound [99 / 70, 874 / 473, 1940 / 989, 1447 / 727]
[GOAL]
⊢ π < 3.15
[PROOFSTEP]
pi_upper_bound [140 / 99, 279 / 151, 51 / 26, 412 / 207]
[GOAL]
⊢ 3.1415 < π
[PROOFSTEP]
pi_lower_bound [11482 / 8119, 5401 / 2923, 2348 / 1197, 11367 / 5711, 25705 / 12868, 23235 / 11621]
[GOAL]
⊢ π < 3.1416
[PROOFSTEP]
pi_upper_bound [4756 / 3363, 101211 / 54775, 505534 / 257719, 83289 / 41846, 411278 / 205887, 438142 / 219137,
  451504 / 225769, 265603 / 132804, 849938 / 424971]
[GOAL]
⊢ 3.141592 < π
[PROOFSTEP]
pi_lower_bound [11482 / 8119, 7792 / 4217, 54055 / 27557, 949247 / 476920, 3310126 / 1657059, 2635492 / 1318143,
  1580265 / 790192, 1221775 / 610899, 3612247 / 1806132, 849943 / 424972]
[GOAL]
⊢ π < 3.141593
[PROOFSTEP]
pi_upper_bound [27720 / 19601, 56935 / 30813, 49359 / 25163, 258754 / 130003, 113599 / 56868, 1101994 / 551163,
  8671537 / 4336095, 3877807 / 1938940, 52483813 / 26242030, 56946167 / 28473117, 23798415 / 11899211]


[GOAL]
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
⊢ ↑(trans e (dualMap (symm (flip e)))) = Dual.eval R N
[PROOFSTEP]
ext
[GOAL]
case h.h
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
x✝¹ : N
x✝ : Dual R N
⊢ ↑(↑↑(trans e (dualMap (symm (flip e)))) x✝¹) x✝ = ↑(↑(Dual.eval R N) x✝¹) x✝
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
⊢ IsReflexive R N
[PROOFSTEP]
constructor
[GOAL]
case bijective_dual_eval'
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
⊢ Function.Bijective ↑(Dual.eval R N)
[PROOFSTEP]
rw [← trans_dualMap_symm_flip e]
[GOAL]
case bijective_dual_eval'
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
⊢ Function.Bijective ↑↑(trans e (dualMap (symm (flip e))))
[PROOFSTEP]
exact LinearEquiv.bijective _
[GOAL]
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
h : optParam (IsReflexive R N) (_ : IsReflexive R N)
⊢ flip (flip e) = e
[PROOFSTEP]
ext
[GOAL]
case h.h
R : Type u_1
M : Type u_2
N : Type u_3
inst✝⁵ : CommRing R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : IsReflexive R M
e : N ≃ₗ[R] Dual R M
h : optParam (IsReflexive R N) (_ : IsReflexive R N)
x✝¹ : N
x✝ : M
⊢ ↑(↑(flip (flip e)) x✝¹) x✝ = ↑(↑e x✝¹) x✝
[PROOFSTEP]
rfl


[GOAL]
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ HEq (evenOddRec h0 h_even h_odd (bit false n)) (h_even n (evenOddRec h0 h_even h_odd n))
[PROOFSTEP]
rw [evenOddRec, binaryRec_eq]
[GOAL]
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ HEq
    (match false, n,
      binaryRec h0
        (fun x x_1 x_2 =>
          match x, x_1, x_2 with
          | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
          | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi)
        n with
    | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
    | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi)
    (h_even n (evenOddRec h0 h_even h_odd n))
case h
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ (match false, 0, h0 with
    | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
    | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi) =
    h0
[PROOFSTEP]
apply eq_rec_heq
[GOAL]
case h
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ (match false, 0, h0 with
    | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
    | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi) =
    h0
[PROOFSTEP]
exact H
[GOAL]
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ HEq (evenOddRec h0 h_even h_odd (bit true n)) (h_odd n (evenOddRec h0 h_even h_odd n))
[PROOFSTEP]
rw [evenOddRec, binaryRec_eq]
[GOAL]
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ HEq
    (match true, n,
      binaryRec h0
        (fun x x_1 x_2 =>
          match x, x_1, x_2 with
          | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
          | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi)
        n with
    | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
    | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi)
    (h_odd n (evenOddRec h0 h_even h_odd n))
case h
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ (match false, 0, h0 with
    | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
    | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi) =
    h0
[PROOFSTEP]
apply eq_rec_heq
[GOAL]
case h
n : ℕ
P : ℕ → Sort u_1
h0 : P 0
h_even : (i : ℕ) → P i → P (2 * i)
h_odd : (i : ℕ) → P i → P (2 * i + 1)
H : h_even 0 h0 = h0
⊢ (match false, 0, h0 with
    | false, i, hi => (_ : 2 * i = bit0 i) ▸ h_even i hi
    | true, i, hi => (_ : 2 * i + 1 = bit1 i) ▸ h_odd i hi) =
    h0
[PROOFSTEP]
exact H


[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
⊢ (x + y) ^ n = ∑ m in range (n + 1), x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
[PROOFSTEP]
let t : ℕ → ℕ → R := fun n m ↦ x ^ m * y ^ (n - m) * choose n m
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
⊢ (x + y) ^ n = ∑ m in range (n + 1), x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
[PROOFSTEP]
change (x + y) ^ n = ∑ m in range (n + 1), t n m
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
⊢ (x + y) ^ n = ∑ m in range (n + 1), t n m
[PROOFSTEP]
have h_first : ∀ n, t n 0 = y ^ n := fun n ↦ by
  simp only [choose_zero_right, _root_.pow_zero, Nat.cast_one, mul_one, one_mul, tsub_zero]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
n : ℕ
⊢ t n 0 = y ^ n
[PROOFSTEP]
simp only [choose_zero_right, _root_.pow_zero, Nat.cast_one, mul_one, one_mul, tsub_zero]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
⊢ (x + y) ^ n = ∑ m in range (n + 1), t n m
[PROOFSTEP]
have h_last : ∀ n, t n n.succ = 0 := fun n ↦ by simp only [ge_iff_le, choose_succ_self, cast_zero, mul_zero]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
n : ℕ
⊢ t n (succ n) = 0
[PROOFSTEP]
simp only [ge_iff_le, choose_succ_self, cast_zero, mul_zero]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
⊢ (x + y) ^ n = ∑ m in range (n + 1), t n m
[PROOFSTEP]
have h_middle : ∀ n i : ℕ, i ∈ range n.succ → (t n.succ ∘ Nat.succ) i = x * t n i + y * t n i.succ :=
  by
  intro n i h_mem
  have h_le : i ≤ n := Nat.le_of_lt_succ (mem_range.mp h_mem)
  dsimp only
  rw [Function.comp_apply, choose_succ_succ, Nat.cast_add, mul_add]
  congr 1
  · rw [pow_succ x, succ_sub_succ, mul_assoc, mul_assoc, mul_assoc]
  · rw [← mul_assoc y, ← mul_assoc y, (h.symm.pow_right i.succ).eq]
    by_cases h_eq : i = n
    · rw [h_eq, choose_succ_self, Nat.cast_zero, mul_zero, mul_zero]
    · rw [succ_sub (lt_of_le_of_ne h_le h_eq)]
      rw [pow_succ y, mul_assoc, mul_assoc, mul_assoc, mul_assoc]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
⊢ ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
[PROOFSTEP]
intro n i h_mem
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
⊢ (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
[PROOFSTEP]
have h_le : i ≤ n := Nat.le_of_lt_succ (mem_range.mp h_mem)
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
⊢ (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
[PROOFSTEP]
dsimp only
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
⊢ ((fun m => x ^ m * y ^ (succ n - m) * ↑(Nat.choose (succ n) m)) ∘ succ) i =
    x * (x ^ i * y ^ (n - i) * ↑(Nat.choose n i)) + y * (x ^ succ i * y ^ (n - succ i) * ↑(Nat.choose n (succ i)))
[PROOFSTEP]
rw [Function.comp_apply, choose_succ_succ, Nat.cast_add, mul_add]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
⊢ x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n i) +
      x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n (succ i)) =
    x * (x ^ i * y ^ (n - i) * ↑(Nat.choose n i)) + y * (x ^ succ i * y ^ (n - succ i) * ↑(Nat.choose n (succ i)))
[PROOFSTEP]
congr 1
[GOAL]
case e_a
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
⊢ x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n i) = x * (x ^ i * y ^ (n - i) * ↑(Nat.choose n i))
[PROOFSTEP]
rw [pow_succ x, succ_sub_succ, mul_assoc, mul_assoc, mul_assoc]
[GOAL]
case e_a
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
⊢ x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n (succ i)) =
    y * (x ^ succ i * y ^ (n - succ i) * ↑(Nat.choose n (succ i)))
[PROOFSTEP]
rw [← mul_assoc y, ← mul_assoc y, (h.symm.pow_right i.succ).eq]
[GOAL]
case e_a
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
⊢ x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n (succ i)) =
    x ^ succ i * y * y ^ (n - succ i) * ↑(Nat.choose n (succ i))
[PROOFSTEP]
by_cases h_eq : i = n
[GOAL]
case pos
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
h_eq : i = n
⊢ x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n (succ i)) =
    x ^ succ i * y * y ^ (n - succ i) * ↑(Nat.choose n (succ i))
[PROOFSTEP]
rw [h_eq, choose_succ_self, Nat.cast_zero, mul_zero, mul_zero]
[GOAL]
case neg
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
h_eq : ¬i = n
⊢ x ^ succ i * y ^ (succ n - succ i) * ↑(Nat.choose n (succ i)) =
    x ^ succ i * y * y ^ (n - succ i) * ↑(Nat.choose n (succ i))
[PROOFSTEP]
rw [succ_sub (lt_of_le_of_ne h_le h_eq)]
[GOAL]
case neg
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n✝ : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
n i : ℕ
h_mem : i ∈ range (succ n)
h_le : i ≤ n
h_eq : ¬i = n
⊢ x ^ succ i * y ^ succ (n - succ i) * ↑(Nat.choose n (succ i)) =
    x ^ succ i * y * y ^ (n - succ i) * ↑(Nat.choose n (succ i))
[PROOFSTEP]
rw [pow_succ y, mul_assoc, mul_assoc, mul_assoc, mul_assoc]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
⊢ (x + y) ^ n = ∑ m in range (n + 1), t n m
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
⊢ (x + y) ^ zero = ∑ m in range (zero + 1), t zero m
[PROOFSTEP]
rw [_root_.pow_zero, sum_range_succ, range_zero, sum_empty, zero_add]
[GOAL]
case zero
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
⊢ 1 = t zero zero
[PROOFSTEP]
dsimp only
[GOAL]
case zero
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
⊢ 1 = x ^ zero * y ^ (zero - zero) * ↑(Nat.choose zero zero)
[PROOFSTEP]
rw [_root_.pow_zero, _root_.pow_zero, choose_self, Nat.cast_one, mul_one, mul_one]
[GOAL]
case succ
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
n : ℕ
ih : (x + y) ^ n = ∑ m in range (n + 1), t n m
⊢ (x + y) ^ succ n = ∑ m in range (succ n + 1), t (succ n) m
[PROOFSTEP]
rw [sum_range_succ', h_first]
[GOAL]
case succ
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
n : ℕ
ih : (x + y) ^ n = ∑ m in range (n + 1), t n m
⊢ (x + y) ^ succ n = ∑ k in range (n + 1), t (succ n) (k + 1) + y ^ succ n
[PROOFSTEP]
erw [sum_congr rfl (h_middle n), sum_add_distrib, add_assoc]
[GOAL]
case succ
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
n : ℕ
ih : (x + y) ^ n = ∑ m in range (n + 1), t n m
⊢ (x + y) ^ succ n = ∑ x_1 in range (succ n), x * t n x_1 + (∑ x in range (succ n), y * t n (succ x) + y ^ succ n)
[PROOFSTEP]
rw [pow_succ (x + y), ih, add_mul, mul_sum, mul_sum]
[GOAL]
case succ
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
n : ℕ
ih : (x + y) ^ n = ∑ m in range (n + 1), t n m
⊢ ∑ x_1 in range (n + 1), x * t n x_1 + ∑ x in range (n + 1), y * t n x =
    ∑ x_1 in range (succ n), x * t n x_1 + (∑ x in range (succ n), y * t n (succ x) + y ^ succ n)
[PROOFSTEP]
congr 1
[GOAL]
case succ.e_a
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
t : ℕ → ℕ → R := fun n m => x ^ m * y ^ (n - m) * ↑(Nat.choose n m)
h_first : ∀ (n : ℕ), t n 0 = y ^ n
h_last : ∀ (n : ℕ), t n (succ n) = 0
h_middle : ∀ (n i : ℕ), i ∈ range (succ n) → (t (succ n) ∘ succ) i = x * t n i + y * t n (succ i)
n : ℕ
ih : (x + y) ^ n = ∑ m in range (n + 1), t n m
⊢ ∑ x in range (n + 1), y * t n x = ∑ x in range (succ n), y * t n (succ x) + y ^ succ n
[PROOFSTEP]
rw [sum_range_succ', sum_range_succ, h_first, h_last, mul_zero, add_zero, _root_.pow_succ]
[GOAL]
R : Type u_1
inst✝ : Semiring R
x y : R
h : Commute x y
n : ℕ
⊢ (x + y) ^ n = ∑ m in Nat.antidiagonal n, Nat.choose n m.fst • (x ^ m.fst * y ^ m.snd)
[PROOFSTEP]
simp_rw [Finset.Nat.sum_antidiagonal_eq_sum_range_succ fun m p ↦ choose n m • (x ^ m * y ^ p), _root_.nsmul_eq_mul,
  cast_comm, h.add_pow]
[GOAL]
R : Type u_1
n : ℕ
⊢ ∑ m in range (n + 1), choose n m = 2 ^ n
[PROOFSTEP]
have := (add_pow 1 1 n).symm
[GOAL]
R : Type u_1
n : ℕ
this : ∑ m in range (n + 1), 1 ^ m * 1 ^ (n - m) * ↑(choose n m) = (1 + 1) ^ n
⊢ ∑ m in range (n + 1), choose n m = 2 ^ n
[PROOFSTEP]
simpa [one_add_one_eq_two] using this
[GOAL]
R : Type u_1
m i : ℕ
hi : i ∈ range (m + 1)
⊢ i ≤ 2 * m + 1
[PROOFSTEP]
linarith [mem_range.1 hi]
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ 2 * ∑ i in range (m + 1), choose (2 * m + 1) i =
    ∑ i in range (m + 1), choose (2 * m + 1) i + ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i)
[PROOFSTEP]
rw [two_mul, this]
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ ∑ i in range (m + 1), choose (2 * m + 1) i + ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) =
    ∑ i in range (m + 1), choose (2 * m + 1) i + ∑ i in Ico (m + 1) (2 * m + 2), choose (2 * m + 1) i
[PROOFSTEP]
{ rw [range_eq_Ico, sum_Ico_reflect]
  · congr
    have A : m + 1 ≤ 2 * m + 1 := by linarith
    rw [add_comm, add_tsub_assoc_of_le A, ← add_comm]
    congr
    rw [tsub_eq_iff_eq_add_of_le A]
    ring
  · linarith
}
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ ∑ i in range (m + 1), choose (2 * m + 1) i + ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) =
    ∑ i in range (m + 1), choose (2 * m + 1) i + ∑ i in Ico (m + 1) (2 * m + 2), choose (2 * m + 1) i
[PROOFSTEP]
rw [range_eq_Ico, sum_Ico_reflect]
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ ∑ i in Ico 0 (m + 1), choose (2 * m + 1) i +
      ∑ j in Ico (2 * m + 1 + 1 - (m + 1)) (2 * m + 1 + 1 - 0), choose (2 * m + 1) j =
    ∑ i in Ico 0 (m + 1), choose (2 * m + 1) i + ∑ i in Ico (m + 1) (2 * m + 2), choose (2 * m + 1) i
[PROOFSTEP]
congr
[GOAL]
case e_a.e_s.e_a
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ 2 * m + 1 + 1 - (m + 1) = m + 1
[PROOFSTEP]
have A : m + 1 ≤ 2 * m + 1 := by linarith
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ m + 1 ≤ 2 * m + 1
[PROOFSTEP]
linarith
[GOAL]
case e_a.e_s.e_a
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
A : m + 1 ≤ 2 * m + 1
⊢ 2 * m + 1 + 1 - (m + 1) = m + 1
[PROOFSTEP]
rw [add_comm, add_tsub_assoc_of_le A, ← add_comm]
[GOAL]
case e_a.e_s.e_a
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
A : m + 1 ≤ 2 * m + 1
⊢ 2 * m + 1 - (m + 1) + 1 = m + 1
[PROOFSTEP]
congr
[GOAL]
case e_a.e_s.e_a.e_a
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
A : m + 1 ≤ 2 * m + 1
⊢ 2 * m + 1 - (m + 1) = m
[PROOFSTEP]
rw [tsub_eq_iff_eq_add_of_le A]
[GOAL]
case e_a.e_s.e_a.e_a
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
A : m + 1 ≤ 2 * m + 1
⊢ 2 * m + 1 = m + (m + 1)
[PROOFSTEP]
ring
[GOAL]
case h
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ m + 1 ≤ 2 * m + 1 + 1
[PROOFSTEP]
linarith
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ m + 1 ≤ 2 * m + 2
[PROOFSTEP]
linarith
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ 2 ^ (2 * m + 1) = 2 * 4 ^ m
[PROOFSTEP]
rw [pow_succ, pow_mul, mul_comm]
[GOAL]
R : Type u_1
m : ℕ
this : ∑ i in range (m + 1), choose (2 * m + 1) (2 * m + 1 - i) = ∑ i in range (m + 1), choose (2 * m + 1) i
⊢ 2 * (2 ^ 2) ^ m = 2 * 4 ^ m
[PROOFSTEP]
rfl
[GOAL]
R : Type u_1
n : ℕ
⊢ choose (2 * n + 1) n ≤ 4 ^ n
[PROOFSTEP]
have t : choose (2 * n + 1) n ≤ ∑ i in range (n + 1), choose (2 * n + 1) i :=
  single_le_sum (fun x _ ↦ by linarith) (self_mem_range_succ n)
[GOAL]
R : Type u_1
n x : ℕ
x✝ : x ∈ range (n + 1)
⊢ 0 ≤ choose (2 * n + 1) x
[PROOFSTEP]
linarith
[GOAL]
R : Type u_1
n : ℕ
t : choose (2 * n + 1) n ≤ ∑ i in range (n + 1), choose (2 * n + 1) i
⊢ choose (2 * n + 1) n ≤ 4 ^ n
[PROOFSTEP]
simpa [sum_range_choose_halfway n] using t
[GOAL]
R : Type u_1
n : ℕ
⊢ 4 ^ n = (1 + 1) ^ (2 * n)
[PROOFSTEP]
simp only [pow_mul, one_add_one_eq_two]
[GOAL]
R : Type u_1
n : ℕ
⊢ 4 ^ n = (2 ^ 2) ^ n
[PROOFSTEP]
rfl
[GOAL]
R : Type u_1
n : ℕ
⊢ (1 + 1) ^ (2 * n) = ∑ m in range (2 * n + 1), choose (2 * n) m
[PROOFSTEP]
simp [add_pow]
[GOAL]
R : Type u_1
n : ℕ
⊢ ∑ m in range (2 * n + 1), choose (2 * n) m ≤ ∑ m in range (2 * n + 1), choose (2 * n) (2 * n / 2)
[PROOFSTEP]
gcongr
[GOAL]
case h
R : Type u_1
n i✝ : ℕ
a✝ : i✝ ∈ range (2 * n + 1)
⊢ choose (2 * n) i✝ ≤ choose (2 * n) (2 * n / 2)
[PROOFSTEP]
apply choose_le_middle
[GOAL]
R : Type u_1
n : ℕ
⊢ ∑ m in range (2 * n + 1), choose (2 * n) (2 * n / 2) = (2 * n + 1) * choose (2 * n) n
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
n : ℕ
⊢ ∑ m in range (n + 1), (-1) ^ m * ↑(Nat.choose n m) = if n = 0 then 1 else 0
[PROOFSTEP]
cases n
[GOAL]
case zero
R : Type u_1
⊢ ∑ m in range (zero + 1), (-1) ^ m * ↑(Nat.choose zero m) = if zero = 0 then 1 else 0
[PROOFSTEP]
simp
[GOAL]
case succ
R : Type u_1
n✝ : ℕ
⊢ ∑ m in range (Nat.succ n✝ + 1), (-1) ^ m * ↑(Nat.choose (Nat.succ n✝) m) = if Nat.succ n✝ = 0 then 1 else 0
[PROOFSTEP]
case succ n =>
  have h := add_pow (-1 : ℤ) 1 n.succ
  simp only [one_pow, mul_one, add_left_neg] at h
  rw [← h, zero_pow (Nat.succ_pos n), if_neg (Nat.succ_ne_zero n)]
[GOAL]
R : Type u_1
n : ℕ
⊢ ∑ m in range (Nat.succ n + 1), (-1) ^ m * ↑(Nat.choose (Nat.succ n) m) = if Nat.succ n = 0 then 1 else 0
[PROOFSTEP]
case succ n =>
  have h := add_pow (-1 : ℤ) 1 n.succ
  simp only [one_pow, mul_one, add_left_neg] at h
  rw [← h, zero_pow (Nat.succ_pos n), if_neg (Nat.succ_ne_zero n)]
[GOAL]
R : Type u_1
n : ℕ
⊢ ∑ m in range (Nat.succ n + 1), (-1) ^ m * ↑(Nat.choose (Nat.succ n) m) = if Nat.succ n = 0 then 1 else 0
[PROOFSTEP]
have h := add_pow (-1 : ℤ) 1 n.succ
[GOAL]
R : Type u_1
n : ℕ
h :
  (-1 + 1) ^ Nat.succ n = ∑ m in range (Nat.succ n + 1), (-1) ^ m * 1 ^ (Nat.succ n - m) * ↑(Nat.choose (Nat.succ n) m)
⊢ ∑ m in range (Nat.succ n + 1), (-1) ^ m * ↑(Nat.choose (Nat.succ n) m) = if Nat.succ n = 0 then 1 else 0
[PROOFSTEP]
simp only [one_pow, mul_one, add_left_neg] at h
[GOAL]
R : Type u_1
n : ℕ
h : 0 ^ Nat.succ n = ∑ x in range (Nat.succ n + 1), (-1) ^ x * ↑(Nat.choose (Nat.succ n) x)
⊢ ∑ m in range (Nat.succ n + 1), (-1) ^ m * ↑(Nat.choose (Nat.succ n) m) = if Nat.succ n = 0 then 1 else 0
[PROOFSTEP]
rw [← h, zero_pow (Nat.succ_pos n), if_neg (Nat.succ_ne_zero n)]
[GOAL]
R : Type u_1
n : ℕ
h0 : n ≠ 0
⊢ ∑ m in range (n + 1), (-1) ^ m * ↑(Nat.choose n m) = 0
[PROOFSTEP]
rw [Int.alternating_sum_range_choose, if_neg h0]
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
⊢ ∑ m in powerset x, f (card m) = ∑ m in range (card x + 1), Nat.choose (card x) m • f m
[PROOFSTEP]
trans ∑ m in range (x.card + 1), ∑ j in x.powerset.filter fun z ↦ z.card = m, f j.card
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
⊢ ∑ m in powerset x, f (card m) =
    ∑ m in range (card x + 1), ∑ j in filter (fun z => card z = m) (powerset x), f (card j)
[PROOFSTEP]
refine' (sum_fiberwise_of_maps_to _ _).symm
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
⊢ ∀ (x_1 : Finset β), x_1 ∈ powerset x → card x_1 ∈ range (card x + 1)
[PROOFSTEP]
intro y hy
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x y : Finset β
hy : y ∈ powerset x
⊢ card y ∈ range (card x + 1)
[PROOFSTEP]
rw [mem_range, Nat.lt_succ_iff]
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x y : Finset β
hy : y ∈ powerset x
⊢ card y ≤ card x
[PROOFSTEP]
rw [mem_powerset] at hy
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x y : Finset β
hy : y ⊆ x
⊢ card y ≤ card x
[PROOFSTEP]
exact card_le_of_subset hy
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
⊢ ∑ m in range (card x + 1), ∑ j in filter (fun z => card z = m) (powerset x), f (card j) =
    ∑ m in range (card x + 1), Nat.choose (card x) m • f m
[PROOFSTEP]
refine' sum_congr rfl fun y _ ↦ _
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
y : ℕ
x✝ : y ∈ range (card x + 1)
⊢ ∑ j in filter (fun z => card z = y) (powerset x), f (card j) = Nat.choose (card x) y • f y
[PROOFSTEP]
rw [← card_powersetLen, ← sum_const]
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
y : ℕ
x✝ : y ∈ range (card x + 1)
⊢ ∑ j in filter (fun z => card z = y) (powerset x), f (card j) = ∑ _x in powersetLen y x, f y
[PROOFSTEP]
refine' sum_congr powersetLen_eq_filter.symm fun z hz ↦ _
[GOAL]
R : Type u_1
α : Type u_2
β : Type u_3
inst✝ : AddCommMonoid α
f : ℕ → α
x : Finset β
y : ℕ
x✝ : y ∈ range (card x + 1)
z : Finset β
hz : z ∈ powersetLen y x
⊢ f (card z) = f y
[PROOFSTEP]
rw [(mem_powersetLen.1 hz).2]
[GOAL]
R : Type u_1
α : Type u_2
inst✝ : DecidableEq α
x : Finset α
⊢ ∑ m in powerset x, (-1) ^ card m = if x = ∅ then 1 else 0
[PROOFSTEP]
rw [sum_powerset_apply_card]
[GOAL]
R : Type u_1
α : Type u_2
inst✝ : DecidableEq α
x : Finset α
⊢ ∑ m in range (card x + 1), Nat.choose (card x) m • (-1) ^ m = if x = ∅ then 1 else 0
[PROOFSTEP]
simp only [nsmul_eq_mul', ← card_eq_zero, Int.alternating_sum_range_choose]
[GOAL]
R : Type u_1
α : Type u_2
x : Finset α
h0 : Finset.Nonempty x
⊢ ∑ m in powerset x, (-1) ^ card m = 0
[PROOFSTEP]
classical
rw [sum_powerset_neg_one_pow_card, if_neg]
rw [← Ne.def, ← nonempty_iff_ne_empty]
apply h0
[GOAL]
R : Type u_1
α : Type u_2
x : Finset α
h0 : Finset.Nonempty x
⊢ ∑ m in powerset x, (-1) ^ card m = 0
[PROOFSTEP]
rw [sum_powerset_neg_one_pow_card, if_neg]
[GOAL]
case hnc
R : Type u_1
α : Type u_2
x : Finset α
h0 : Finset.Nonempty x
⊢ ¬x = ∅
[PROOFSTEP]
rw [← Ne.def, ← nonempty_iff_ne_empty]
[GOAL]
case hnc
R : Type u_1
α : Type u_2
x : Finset α
h0 : Finset.Nonempty x
⊢ Finset.Nonempty x
[PROOFSTEP]
apply h0
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ ∏ i in range (n + 2), f i (n + 1 - i) ^ Nat.choose (n + 1) i =
    (∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i) * ∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n i
[PROOFSTEP]
have A :
  (∏ i in range (n + 1), f (i + 1) (n - i) ^ (n.choose (i + 1))) * f 0 (n + 1) =
    ∏ i in range (n + 1), f i (n + 1 - i) ^ (n.choose i)
[GOAL]
case A
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ (∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n (i + 1)) * f 0 (n + 1) =
    ∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i
[PROOFSTEP]
rw [prod_range_succ, prod_range_succ']
[GOAL]
case A
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ (∏ x in range n, f (x + 1) (n - x) ^ Nat.choose n (x + 1)) * f (n + 1) (n - n) ^ Nat.choose n (n + 1) * f 0 (n + 1) =
    (∏ k in range n, f (k + 1) (n + 1 - (k + 1)) ^ Nat.choose n (k + 1)) * f 0 (n + 1 - 0) ^ Nat.choose n 0
[PROOFSTEP]
simp
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
A :
  (∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n (i + 1)) * f 0 (n + 1) =
    ∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i
⊢ ∏ i in range (n + 2), f i (n + 1 - i) ^ Nat.choose (n + 1) i =
    (∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i) * ∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n i
[PROOFSTEP]
rw [prod_range_succ']
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
A :
  (∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n (i + 1)) * f 0 (n + 1) =
    ∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i
⊢ (∏ k in range (n + 1), f (k + 1) (n + 1 - (k + 1)) ^ Nat.choose (n + 1) (k + 1)) *
      f 0 (n + 1 - 0) ^ Nat.choose (n + 1) 0 =
    (∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i) * ∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n i
[PROOFSTEP]
simpa [Nat.choose_succ_succ, pow_add, prod_mul_distrib, A, mul_assoc] using
  mul_comm _
    _
      -- porting note: new lemma
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ ∏ ij in Nat.antidiagonal (n + 1), f ij.fst ij.snd ^ Nat.choose (n + 1) ij.fst =
    (∏ ij in Nat.antidiagonal n, f ij.fst (ij.snd + 1) ^ Nat.choose n ij.fst) *
      ∏ ij in Nat.antidiagonal n, f (ij.fst + 1) ij.snd ^ Nat.choose n ij.snd
[PROOFSTEP]
simp only [Nat.prod_antidiagonal_eq_prod_range_succ_mk, prod_pow_choose_succ]
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
⊢ (∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i) * ∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n i =
    (∏ x in range (succ n), f x (n - x + 1) ^ Nat.choose n x) *
      ∏ x in range (succ n), f (x + 1) (n - x) ^ Nat.choose n (n - x)
[PROOFSTEP]
have : ∀ i ∈ range (n + 1), i ≤ n := fun i hi ↦ by simpa [Nat.lt_succ_iff] using hi
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n i : ℕ
hi : i ∈ range (n + 1)
⊢ i ≤ n
[PROOFSTEP]
simpa [Nat.lt_succ_iff] using hi
[GOAL]
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
this : ∀ (i : ℕ), i ∈ range (n + 1) → i ≤ n
⊢ (∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i) * ∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n i =
    (∏ x in range (succ n), f x (n - x + 1) ^ Nat.choose n x) *
      ∏ x in range (succ n), f (x + 1) (n - x) ^ Nat.choose n (n - x)
[PROOFSTEP]
congr 1
[GOAL]
case e_a
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
this : ∀ (i : ℕ), i ∈ range (n + 1) → i ≤ n
⊢ ∏ i in range (n + 1), f i (n + 1 - i) ^ Nat.choose n i = ∏ x in range (succ n), f x (n - x + 1) ^ Nat.choose n x
[PROOFSTEP]
refine prod_congr rfl fun i hi ↦ ?_
[GOAL]
case e_a
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
this : ∀ (i : ℕ), i ∈ range (n + 1) → i ≤ n
i : ℕ
hi : i ∈ range (succ n)
⊢ f i (n + 1 - i) ^ Nat.choose n i = f i (n - i + 1) ^ Nat.choose n i
[PROOFSTEP]
rw [tsub_add_eq_add_tsub (this _ hi)]
[GOAL]
case e_a
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
this : ∀ (i : ℕ), i ∈ range (n + 1) → i ≤ n
⊢ ∏ i in range (n + 1), f (i + 1) (n - i) ^ Nat.choose n i =
    ∏ x in range (succ n), f (x + 1) (n - x) ^ Nat.choose n (n - x)
[PROOFSTEP]
refine prod_congr rfl fun i hi ↦ ?_
[GOAL]
case e_a
R✝ : Type u_1
M✝ : Type u_2
R : Type u_3
inst✝² : CommMonoid M✝
inst✝¹ : NonAssocSemiring R
M : Type u_4
inst✝ : CommMonoid M
f : ℕ → ℕ → M
n : ℕ
this : ∀ (i : ℕ), i ∈ range (n + 1) → i ≤ n
i : ℕ
hi : i ∈ range (succ n)
⊢ f (i + 1) (n - i) ^ Nat.choose n i = f (i + 1) (n - i) ^ Nat.choose n (n - i)
[PROOFSTEP]
rw [Nat.choose_symm (this _ hi)]
  -- porting note: moved from `Mathlib.Analysis.Calculus.ContDiff`
[GOAL]
R✝ : Type u_1
M : Type u_2
R : Type u_3
inst✝¹ : CommMonoid M
inst✝ : NonAssocSemiring R
f : ℕ → ℕ → R
n : ℕ
⊢ ∑ i in range (n + 2), ↑(Nat.choose (n + 1) i) * f i (n + 1 - i) =
    ∑ i in range (n + 1), ↑(Nat.choose n i) * f i (n + 1 - i) +
      ∑ i in range (n + 1), ↑(Nat.choose n i) * f (i + 1) (n - i)
[PROOFSTEP]
simpa only [nsmul_eq_mul] using sum_choose_succ_nsmul f n
[GOAL]
R✝ : Type u_1
M : Type u_2
R : Type u_3
inst✝¹ : CommMonoid M
inst✝ : NonAssocSemiring R
f : ℕ → ℕ → R
n : ℕ
⊢ ∑ ij in Nat.antidiagonal (n + 1), ↑(Nat.choose (n + 1) ij.fst) * f ij.fst ij.snd =
    ∑ ij in Nat.antidiagonal n, ↑(Nat.choose n ij.fst) * f ij.fst (ij.snd + 1) +
      ∑ ij in Nat.antidiagonal n, ↑(Nat.choose n ij.snd) * f (ij.fst + 1) ij.snd
[PROOFSTEP]
simpa only [nsmul_eq_mul] using sum_antidiagonal_choose_succ_nsmul f n


[GOAL]
x y r : ℕ
hr : y * y + r = x
hle : Nat.ble r (2 * y) = true
⊢ Nat.sqrt x = y
[PROOFSTEP]
rw [← hr, ← pow_two]
[GOAL]
x y r : ℕ
hr : y * y + r = x
hle : Nat.ble r (2 * y) = true
⊢ Nat.sqrt (y ^ 2 + r) = y
[PROOFSTEP]
rw [two_mul] at hle
[GOAL]
x y r : ℕ
hr : y * y + r = x
hle : Nat.ble r (y + y) = true
⊢ Nat.sqrt (y ^ 2 + r) = y
[PROOFSTEP]
exact Nat.sqrt_add_eq' _ (Nat.le_of_ble_eq_true hle)


[GOAL]
n : ℕ
⊢ IsReduced (ZMod n) ↔ Squarefree n ∨ n = 0
[PROOFSTEP]
rw [← RingHom.ker_isRadical_iff_reduced_of_surjective (ZMod.ringHom_surjective <| Int.castRingHom <| ZMod n),
  ZMod.ker_int_castRingHom, ← isRadical_iff_span_singleton, isRadical_iff_squarefree_or_zero, Int.squarefree_coe_nat,
  Nat.cast_eq_zero]


[GOAL]
x y : ℤ
⊢ |x| < |y| ↔ natAbs x < natAbs y
[PROOFSTEP]
rw [abs_eq_natAbs, abs_eq_natAbs, ofNat_lt]