[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ dist (secondInter s p v) s.center = dist p s.center
[PROOFSTEP]
rw [Sphere.secondInter]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ dist ((-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p) s.center = dist p s.center
[PROOFSTEP]
by_cases hv : v = 0
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : v = 0
⊢ dist ((-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p) s.center = dist p s.center
[PROOFSTEP]
simp [hv]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
⊢ dist ((-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p) s.center = dist p s.center
[PROOFSTEP]
rw [dist_smul_vadd_eq_dist _ _ hv]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
⊢ -2 * inner v (p -ᵥ s.center) / inner v v = 0 ∨
    -2 * inner v (p -ᵥ s.center) / inner v v = -2 * inner v (p -ᵥ s.center) / inner v v
[PROOFSTEP]
exact Or.inr rfl
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ secondInter s p v ∈ s ↔ p ∈ s
[PROOFSTEP]
simp_rw [mem_sphere, Sphere.secondInter_dist]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
⊢ secondInter s p 0 = p
[PROOFSTEP]
simp [Sphere.secondInter]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ secondInter s p v = p ↔ inner v (p -ᵥ s.center) = 0
[PROOFSTEP]
refine' ⟨fun hp => _, fun hp => _⟩
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hp : secondInter s p v = p
⊢ inner v (p -ᵥ s.center) = 0
[PROOFSTEP]
by_cases hv : v = 0
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hp : secondInter s p v = p
hv : v = 0
⊢ inner v (p -ᵥ s.center) = 0
[PROOFSTEP]
simp [hv]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hp : secondInter s p v = p
hv : ¬v = 0
⊢ inner v (p -ᵥ s.center) = 0
[PROOFSTEP]
rwa [Sphere.secondInter, eq_comm, eq_vadd_iff_vsub_eq, vsub_self, eq_comm, smul_eq_zero, or_iff_left hv,
  div_eq_zero_iff, inner_self_eq_zero, or_iff_left hv, mul_eq_zero, or_iff_right (by norm_num : (-2 : ℝ) ≠ 0)] at hp
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hp : -2 = 0 ∨ inner v (p -ᵥ s.center) = 0
hv : ¬v = 0
⊢ -2 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hp : inner v (p -ᵥ s.center) = 0
⊢ secondInter s p v = p
[PROOFSTEP]
rw [Sphere.secondInter, hp, mul_zero, zero_div, zero_smul, zero_vadd]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
hp' : p' ∈ AffineSubspace.mk' p (Submodule.span ℝ {v})
⊢ p' = p ∨ p' = secondInter s p v ↔ p' ∈ s
[PROOFSTEP]
refine' ⟨fun h => _, fun h => _⟩
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
hp' : p' ∈ AffineSubspace.mk' p (Submodule.span ℝ {v})
h : p' = p ∨ p' = secondInter s p v
⊢ p' ∈ s
[PROOFSTEP]
rcases h with (h | h)
[GOAL]
case refine'_1.inl
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
hp' : p' ∈ AffineSubspace.mk' p (Submodule.span ℝ {v})
h : p' = p
⊢ p' ∈ s
[PROOFSTEP]
rwa [h]
[GOAL]
case refine'_1.inr
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
hp' : p' ∈ AffineSubspace.mk' p (Submodule.span ℝ {v})
h : p' = secondInter s p v
⊢ p' ∈ s
[PROOFSTEP]
rwa [h, Sphere.secondInter_mem]
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
hp' : p' ∈ AffineSubspace.mk' p (Submodule.span ℝ {v})
h : p' ∈ s
⊢ p' = p ∨ p' = secondInter s p v
[PROOFSTEP]
rw [AffineSubspace.mem_mk'_iff_vsub_mem, Submodule.mem_span_singleton] at hp'
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
hp' : ∃ a, a • v = p' -ᵥ p
h : p' ∈ s
⊢ p' = p ∨ p' = secondInter s p v
[PROOFSTEP]
rcases hp' with ⟨r, hr⟩
[GOAL]
case refine'_2.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
h : p' ∈ s
r : ℝ
hr : r • v = p' -ᵥ p
⊢ p' = p ∨ p' = secondInter s p v
[PROOFSTEP]
rw [eq_comm, ← eq_vadd_iff_vsub_eq] at hr
[GOAL]
case refine'_2.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
p' : P
h : p' ∈ s
r : ℝ
hr : p' = r • v +ᵥ p
⊢ p' = p ∨ p' = secondInter s p v
[PROOFSTEP]
subst hr
[GOAL]
case refine'_2.intro
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
r : ℝ
h : r • v +ᵥ p ∈ s
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = secondInter s p v
[PROOFSTEP]
by_cases hv : v = 0
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
r : ℝ
h : r • v +ᵥ p ∈ s
hv : v = 0
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = secondInter s p v
[PROOFSTEP]
simp [hv]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
r : ℝ
h : r • v +ᵥ p ∈ s
hv : ¬v = 0
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = secondInter s p v
[PROOFSTEP]
rw [Sphere.secondInter]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : p ∈ s
v : V
r : ℝ
h : r • v +ᵥ p ∈ s
hv : ¬v = 0
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p
[PROOFSTEP]
rw [mem_sphere] at h hp
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : dist p s.center = s.radius
v : V
r : ℝ
h : dist (r • v +ᵥ p) s.center = s.radius
hv : ¬v = 0
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p
[PROOFSTEP]
rw [← hp, dist_smul_vadd_eq_dist _ _ hv] at h
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : dist p s.center = s.radius
v : V
r : ℝ
h : r = 0 ∨ r = -2 * inner v (p -ᵥ s.center) / inner v v
hv : ¬v = 0
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p
[PROOFSTEP]
rcases h with (h | h)
[GOAL]
case neg.inl
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : dist p s.center = s.radius
v : V
r : ℝ
hv : ¬v = 0
h : r = 0
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p
[PROOFSTEP]
simp [h]
[GOAL]
case neg.inr
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
hp : dist p s.center = s.radius
v : V
r : ℝ
hv : ¬v = 0
h : r = -2 * inner v (p -ᵥ s.center) / inner v v
⊢ r • v +ᵥ p = p ∨ r • v +ᵥ p = (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p
[PROOFSTEP]
simp [h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
r : ℝ
hr : r ≠ 0
⊢ secondInter s p (r • v) = secondInter s p v
[PROOFSTEP]
simp_rw [Sphere.secondInter, real_inner_smul_left, inner_smul_right, smul_smul, div_mul_eq_div_div]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
r : ℝ
hr : r ≠ 0
⊢ (-2 * (r * inner v (p -ᵥ s.center)) / r / r / inner v v * r) • v +ᵥ p =
    (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ p
[PROOFSTEP]
rw [mul_comm, ← mul_div_assoc, ← mul_div_assoc, mul_div_cancel_left _ hr, mul_comm, mul_assoc, mul_div_cancel_left _ hr,
  mul_comm]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ secondInter s p (-v) = secondInter s p v
[PROOFSTEP]
rw [← neg_one_smul ℝ v, s.secondInter_smul p v (by norm_num : (-1 : ℝ) ≠ 0)]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ -1 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
⊢ secondInter s (secondInter s p v) v = p
[PROOFSTEP]
by_cases hv : v = 0
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : v = 0
⊢ secondInter s (secondInter s p v) v = p
[PROOFSTEP]
simp [hv]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
⊢ secondInter s (secondInter s p v) v = p
[PROOFSTEP]
have hv' : ⟪v, v⟫ ≠ 0 := inner_self_ne_zero.2 hv
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
hv' : inner v v ≠ 0
⊢ secondInter s (secondInter s p v) v = p
[PROOFSTEP]
simp only [Sphere.secondInter, vadd_vsub_assoc, vadd_vadd, inner_add_right, inner_smul_right, div_mul_cancel _ hv']
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
hv' : inner v v ≠ 0
⊢ (-2 * (-2 * inner v (p -ᵥ s.center) + inner v (p -ᵥ s.center)) / inner v v) • v +
        (-2 * inner v (p -ᵥ s.center) / inner v v) • v +ᵥ
      p =
    p
[PROOFSTEP]
rw [← @vsub_eq_zero_iff_eq V, vadd_vsub, ← add_smul, ← add_div]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
hv' : inner v v ≠ 0
⊢ ((-2 * (-2 * inner v (p -ᵥ s.center) + inner v (p -ᵥ s.center)) + -2 * inner v (p -ᵥ s.center)) / inner v v) • v = 0
[PROOFSTEP]
convert zero_smul ℝ (M := V) _
[GOAL]
case h.e'_2.h.e'_5
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
hv' : inner v v ≠ 0
⊢ (-2 * (-2 * inner v (p -ᵥ s.center) + inner v (p -ᵥ s.center)) + -2 * inner v (p -ᵥ s.center)) / inner v v = 0
[PROOFSTEP]
convert zero_div (G₀ := ℝ) _
[GOAL]
case h.e'_2.h.e'_5
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p : P
v : V
hv : ¬v = 0
hv' : inner v v ≠ 0
⊢ -2 * (-2 * inner v (p -ᵥ s.center) + inner v (p -ᵥ s.center)) + -2 * inner v (p -ᵥ s.center) = 0
[PROOFSTEP]
ring
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
⊢ Collinear ℝ {p, p', secondInter s p (p' -ᵥ p)}
[PROOFSTEP]
rw [Set.pair_comm, Set.insert_comm]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
⊢ Collinear ℝ {secondInter s p (p' -ᵥ p), p, p'}
[PROOFSTEP]
exact (collinear_insert_iff_of_mem_affineSpan (s.secondInter_vsub_mem_affineSpan _ _)).2 (collinear_pair ℝ _ _)
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center ≤ s.radius
⊢ Wbtw ℝ p p' (secondInter s p (p' -ᵥ p))
[PROOFSTEP]
by_cases h : p' = p
[GOAL]
case pos
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center ≤ s.radius
h : p' = p
⊢ Wbtw ℝ p p' (secondInter s p (p' -ᵥ p))
[PROOFSTEP]
simp [h]
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center ≤ s.radius
h : ¬p' = p
⊢ Wbtw ℝ p p' (secondInter s p (p' -ᵥ p))
[PROOFSTEP]
refine'
  wbtw_of_collinear_of_dist_center_le_radius (s.secondInter_collinear p p') hp hp' ((Sphere.secondInter_mem _).2 hp) _
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center ≤ s.radius
h : ¬p' = p
⊢ p ≠ secondInter s p (p' -ᵥ p)
[PROOFSTEP]
intro he
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center ≤ s.radius
h : ¬p' = p
he : p = secondInter s p (p' -ᵥ p)
⊢ False
[PROOFSTEP]
rw [eq_comm, Sphere.secondInter_eq_self_iff, ← neg_neg (p' -ᵥ p), inner_neg_left, neg_vsub_eq_vsub_rev, neg_eq_zero,
  eq_comm] at he
[GOAL]
case neg
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center ≤ s.radius
h : ¬p' = p
he : 0 = inner (p -ᵥ p') (p -ᵥ s.center)
⊢ False
[PROOFSTEP]
exact ((inner_pos_or_eq_of_dist_le_radius hp hp').resolve_right (Ne.symm h)).ne he
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center < s.radius
⊢ Sbtw ℝ p p' (secondInter s p (p' -ᵥ p))
[PROOFSTEP]
refine' ⟨Sphere.wbtw_secondInter hp hp'.le, _, _⟩
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center < s.radius
⊢ p' ≠ p
[PROOFSTEP]
rintro rfl
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p' : P
hp' : dist p' s.center < s.radius
hp : p' ∈ s
⊢ False
[PROOFSTEP]
rw [mem_sphere] at hp
[GOAL]
case refine'_1
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p' : P
hp' : dist p' s.center < s.radius
hp : dist p' s.center = s.radius
⊢ False
[PROOFSTEP]
simp [hp] at hp'
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center < s.radius
⊢ p' ≠ secondInter s p (p' -ᵥ p)
[PROOFSTEP]
rintro h
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : dist p' s.center < s.radius
h : p' = secondInter s p (p' -ᵥ p)
⊢ False
[PROOFSTEP]
rw [h, mem_sphere.1 ((Sphere.secondInter_mem _).2 hp)] at hp'
[GOAL]
case refine'_2
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
s : Sphere P
p p' : P
hp : p ∈ s
hp' : s.radius < s.radius
h : p' = secondInter s p (p' -ᵥ p)
⊢ False
[PROOFSTEP]
exact lt_irrefl _ hp'


[GOAL]
a : ℤ
h₁ : a ≠ 0
h₂ : -a = 0
⊢ False
[PROOFSTEP]
have : -a = -0 := by rwa [Int.neg_zero]
[GOAL]
a : ℤ
h₁ : a ≠ 0
h₂ : -a = 0
⊢ -a = -0
[PROOFSTEP]
rwa [Int.neg_zero]
[GOAL]
a : ℤ
h₁ : a ≠ 0
h₂ : -a = 0
this : -a = -0
⊢ False
[PROOFSTEP]
have : a = 0 := Int.neg_eq_neg this
[GOAL]
a : ℤ
h₁ : a ≠ 0
h₂ : -a = 0
this✝ : -a = -0
this : a = 0
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
a b : ℤ
h₁ : 0 < a
h₂ : 0 < b
h : -a = b
⊢ False
[PROOFSTEP]
rw [← h] at h₂
[GOAL]
a b : ℤ
h₁ : 0 < a
h₂ : 0 < -a
h : -a = b
⊢ False
[PROOFSTEP]
exact absurd (le_of_lt h₁) (not_le_of_gt (Int.neg_of_neg_pos h₂))
[GOAL]
n : ℕ
⊢ 0 + ↑n = ofNat n
[PROOFSTEP]
rw [Int.zero_add, Int.coe_nat_eq]
[GOAL]
a b : ℤ
ha : 0 ≤ a
hb : 0 ≤ b
h✝ : natAbs a ≠ natAbs b
h : a = b
⊢ False
[PROOFSTEP]
have : (natAbs a : ℤ) = natAbs b := by rwa [ofNat_natAbs_eq_of_nonneg _ ha, ofNat_natAbs_eq_of_nonneg _ hb]
[GOAL]
a b : ℤ
ha : 0 ≤ a
hb : 0 ≤ b
h✝ : natAbs a ≠ natAbs b
h : a = b
⊢ ↑(natAbs a) = ↑(natAbs b)
[PROOFSTEP]
rwa [ofNat_natAbs_eq_of_nonneg _ ha, ofNat_natAbs_eq_of_nonneg _ hb]
[GOAL]
a b : ℤ
ha : 0 ≤ a
hb : 0 ≤ b
h✝ : natAbs a ≠ natAbs b
h : a = b
this : ↑(natAbs a) = ↑(natAbs b)
⊢ False
[PROOFSTEP]
injection this
[GOAL]
a b : ℤ
ha : 0 ≤ a
hb : 0 ≤ b
h✝ : natAbs a ≠ natAbs b
h : a = b
a_eq✝ : natAbs a = natAbs b
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
a b : ℤ
n m : ℕ
ha : 0 ≤ a
hb : 0 ≤ b
e1 : natAbs a = n
e2 : natAbs b = m
h : n ≠ m
⊢ natAbs a ≠ natAbs b
[PROOFSTEP]
rwa [e1, e2]
[GOAL]
n m : ℕ
x✝¹ : 0 ≤ ofNat n
x✝ : 0 ≤ ofNat m
⊢ natAbs (ofNat n + ofNat m) = natAbs (ofNat n) + natAbs (ofNat m)
[PROOFSTEP]
simp [natAbs_ofNat_core]
[GOAL]
n m : ℕ
x✝¹ : -[n+1] < 0
x✝ : -[m+1] < 0
⊢ natAbs (-[n+1] + -[m+1]) = natAbs -[n+1] + natAbs -[m+1]
[PROOFSTEP]
simp [natAbs_of_negSucc, Nat.succ_add, Nat.add_succ]
[GOAL]
a : ℤ
n : ℕ
h : natAbs a = n
⊢ natAbs (bit0 a) = bit0 n
[PROOFSTEP]
rw [← h]
[GOAL]
a : ℤ
n : ℕ
h : natAbs a = n
⊢ natAbs (bit0 a) = bit0 (natAbs a)
[PROOFSTEP]
apply Int.natAbs_bit0
[GOAL]
a : ℤ
h : 0 ≤ a
⊢ natAbs (bit0 a + 1) = bit0 (natAbs a) + natAbs 1
[PROOFSTEP]
rw [Int.natAbs_add_nonneg (Int.bit0_nonneg h) (le_of_lt Int.zero_lt_one), Int.natAbs_bit0]
[GOAL]
a : ℤ
n : ℕ
h₁ : 0 ≤ a
h₂ : natAbs a = n
⊢ natAbs (bit1 a) = bit1 n
[PROOFSTEP]
rw [← h₂]
[GOAL]
a : ℤ
n : ℕ
h₁ : 0 ≤ a
h₂ : natAbs a = n
⊢ natAbs (bit1 a) = bit1 (natAbs a)
[PROOFSTEP]
apply Int.natAbs_bit1_nonneg h₁


[GOAL]
m n : ℕ
x✝ : ↑m ∣ ↑n
a : ℤ
ae : ↑n = ↑m * a
m0 : m = 0
⊢ m ∣ n
[PROOFSTEP]
simp [m0] at ae
[GOAL]
m n : ℕ
x✝ : ↑m ∣ ↑n
a : ℤ
m0 : m = 0
ae : n = 0
⊢ m ∣ n
[PROOFSTEP]
simp [ae, m0]
[GOAL]
m n : ℕ
x✝ : ↑m ∣ ↑n
a : ℤ
ae : ↑n = ↑m * a
m0l : m > 0
⊢ m ∣ n
[PROOFSTEP]
cases' eq_ofNat_of_zero_le (@nonneg_of_mul_nonneg_right ℤ _ m a (by simp [ae.symm]) (by simpa using m0l)) with k e
[GOAL]
m n : ℕ
x✝ : ↑m ∣ ↑n
a : ℤ
ae : ↑n = ↑m * a
m0l : m > 0
⊢ 0 ≤ ↑m * a
[PROOFSTEP]
simp [ae.symm]
[GOAL]
m n : ℕ
x✝ : ↑m ∣ ↑n
a : ℤ
ae : ↑n = ↑m * a
m0l : m > 0
⊢ 0 < ↑m
[PROOFSTEP]
simpa using m0l
[GOAL]
case intro
m n : ℕ
x✝ : ↑m ∣ ↑n
a : ℤ
ae : ↑n = ↑m * a
m0l : m > 0
k : ℕ
e : a = ↑k
⊢ m ∣ n
[PROOFSTEP]
subst a
[GOAL]
case intro
m n : ℕ
x✝ : ↑m ∣ ↑n
m0l : m > 0
k : ℕ
ae : ↑n = ↑m * ↑k
⊢ m ∣ n
[PROOFSTEP]
exact ⟨k, Int.ofNat.inj ae⟩
[GOAL]
m n : ℕ
x✝ : m ∣ n
k : ℕ
e : n = m * k
⊢ ↑m * ↑k = ↑n
[PROOFSTEP]
rw [e, Int.ofNat_mul]
[GOAL]
n : ℕ
z : ℤ
⊢ ↑n ∣ z ↔ n ∣ natAbs z
[PROOFSTEP]
rcases natAbs_eq z with (eq | eq)
[GOAL]
case inl
n : ℕ
z : ℤ
eq : z = ↑(natAbs z)
⊢ ↑n ∣ z ↔ n ∣ natAbs z
[PROOFSTEP]
rw [eq]
[GOAL]
case inr
n : ℕ
z : ℤ
eq : z = -↑(natAbs z)
⊢ ↑n ∣ z ↔ n ∣ natAbs z
[PROOFSTEP]
rw [eq]
[GOAL]
case inl
n : ℕ
z : ℤ
eq : z = ↑(natAbs z)
⊢ ↑n ∣ ↑(natAbs z) ↔ n ∣ natAbs ↑(natAbs z)
[PROOFSTEP]
simp [← coe_nat_dvd]
[GOAL]
case inr
n : ℕ
z : ℤ
eq : z = -↑(natAbs z)
⊢ ↑n ∣ -↑(natAbs z) ↔ n ∣ natAbs (-↑(natAbs z))
[PROOFSTEP]
simp [← coe_nat_dvd]
[GOAL]
n : ℕ
z : ℤ
⊢ z ∣ ↑n ↔ natAbs z ∣ n
[PROOFSTEP]
rcases natAbs_eq z with (eq | eq)
[GOAL]
case inl
n : ℕ
z : ℤ
eq : z = ↑(natAbs z)
⊢ z ∣ ↑n ↔ natAbs z ∣ n
[PROOFSTEP]
rw [eq]
[GOAL]
case inr
n : ℕ
z : ℤ
eq : z = -↑(natAbs z)
⊢ z ∣ ↑n ↔ natAbs z ∣ n
[PROOFSTEP]
rw [eq]
[GOAL]
case inl
n : ℕ
z : ℤ
eq : z = ↑(natAbs z)
⊢ ↑(natAbs z) ∣ ↑n ↔ natAbs ↑(natAbs z) ∣ n
[PROOFSTEP]
simp [← coe_nat_dvd]
[GOAL]
case inr
n : ℕ
z : ℤ
eq : z = -↑(natAbs z)
⊢ -↑(natAbs z) ∣ ↑n ↔ natAbs (-↑(natAbs z)) ∣ n
[PROOFSTEP]
simp [← coe_nat_dvd]


[GOAL]
X Y : FintypeCat
f g : X ⟶ Y
h : ∀ (x : ↑X), f x = g x
⊢ f = g
[PROOFSTEP]
funext
[GOAL]
case h
X Y : FintypeCat
f g : X ⟶ Y
h : ∀ (x : ↑X), f x = g x
x✝ : ↑X
⊢ f x✝ = g x✝
[PROOFSTEP]
apply h
[GOAL]
A B : FintypeCat
⊢ Function.LeftInverse
    (fun i =>
      { toFun := i.hom, invFun := i.inv, left_inv := (_ : ∀ (a : ↑A), i.inv (i.hom a) = a),
        right_inv := (_ : ∀ (a : ↑B), i.hom (i.inv a) = a) })
    fun e => Iso.mk ↑e ↑e.symm
[PROOFSTEP]
aesop_cat
[GOAL]
A B : FintypeCat
⊢ Function.RightInverse
    (fun i =>
      { toFun := i.hom, invFun := i.inv, left_inv := (_ : ∀ (a : ↑A), i.inv (i.hom a) = a),
        right_inv := (_ : ∀ (a : ↑B), i.hom (i.inv a) = a) })
    fun e => Iso.mk ↑e ↑e.symm
[PROOFSTEP]
aesop_cat
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
⊢ Function.LeftInverse (fun x => (h.inv { down := x }).down) fun x => (h.hom { down := x }).down
[PROOFSTEP]
intro a
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len X)
⊢ (fun x => (h.inv { down := x }).down) ((fun x => (h.hom { down := x }).down) a) = a
[PROOFSTEP]
change ULift.down _ = _
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len X)
⊢ (h.inv { down := (fun x => (h.hom { down := x }).down) a }).down = a
[PROOFSTEP]
rw [ULift.up_down]
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len X)
⊢ (h.inv (h.hom { down := a })).down = a
[PROOFSTEP]
change ((h.hom ≫ h.inv) _).down = _
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len X)
⊢ ((h.hom ≫ h.inv) { down := a }).down = a
[PROOFSTEP]
simp
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len X)
⊢ (𝟙 X { down := a }).down = a
[PROOFSTEP]
rfl
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
⊢ Function.RightInverse (fun x => (h.inv { down := x }).down) fun x => (h.hom { down := x }).down
[PROOFSTEP]
intro a
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len Y)
⊢ (fun x => (h.hom { down := x }).down) ((fun x => (h.inv { down := x }).down) a) = a
[PROOFSTEP]
change ULift.down _ = _
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len Y)
⊢ (h.hom { down := (fun x => (h.inv { down := x }).down) a }).down = a
[PROOFSTEP]
rw [ULift.up_down]
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len Y)
⊢ (h.hom (h.inv { down := a })).down = a
[PROOFSTEP]
change ((h.inv ≫ h.hom) _).down = _
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len Y)
⊢ ((h.inv ≫ h.hom) { down := a }).down = a
[PROOFSTEP]
simp
[GOAL]
X Y : Skeleton
x✝ : IsIsomorphic X Y
h : X ≅ Y
a : Fin (len Y)
⊢ (𝟙 Y { down := a }).down = a
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
⊢ Fintype.card ↑(incl.obj (mk n)) = n
[PROOFSTEP]
convert Finset.card_fin n
[GOAL]
case h.e'_2
n : ℕ
⊢ Fintype.card ↑(incl.obj (mk n)) = Finset.card Finset.univ
[PROOFSTEP]
apply Fintype.ofEquiv_card
[GOAL]
⊢ IsEquivalence Skeleton.incl
[PROOFSTEP]
infer_instance


[GOAL]
x✝¹ x✝ : ℕ
⊢ (fun m n => m * n) (x✝¹ + 1) x✝ = x✝ + (fun m n => m * n) x✝¹ x✝
[PROOFSTEP]
dsimp only
[GOAL]
x✝¹ x✝ : ℕ
⊢ (x✝¹ + 1) * x✝ = x✝ + x✝¹ * x✝
[PROOFSTEP]
rw [Nat.add_comm, Nat.right_distrib, Nat.one_mul]
[GOAL]
m n k : ℕ
p : ℕ → Prop
⊢ (∃ n, p n) → p 0 ∨ ∃ n, p (n + 1)
[PROOFSTEP]
rintro ⟨_ | n, hn⟩
[GOAL]
case intro.zero
m n k : ℕ
p : ℕ → Prop
hn : p zero
⊢ p 0 ∨ ∃ n, p (n + 1)
case intro.succ m n✝ k : ℕ p : ℕ → Prop n : ℕ hn : p (succ n) ⊢ p 0 ∨ ∃ n, p (n + 1)
[PROOFSTEP]
exacts [Or.inl hn, Or.inr ⟨n, hn⟩]
[GOAL]
m✝ n✝ k m n : ℕ
⊢ max (succ m) (succ n) = succ (max m n)
[PROOFSTEP]
by_cases h1 : m ≤ n
[GOAL]
case pos
m✝ n✝ k m n : ℕ
h1 : m ≤ n
⊢ max (succ m) (succ n) = succ (max m n)
case neg m✝ n✝ k m n : ℕ h1 : ¬m ≤ n ⊢ max (succ m) (succ n) = succ (max m n)
[PROOFSTEP]
rw [max_eq_right h1, max_eq_right (succ_le_succ h1)]
[GOAL]
case neg
m✝ n✝ k m n : ℕ
h1 : ¬m ≤ n
⊢ max (succ m) (succ n) = succ (max m n)
[PROOFSTEP]
rw [not_le] at h1
[GOAL]
case neg
m✝ n✝ k m n : ℕ
h1 : n < m
⊢ max (succ m) (succ n) = succ (max m n)
[PROOFSTEP]
have h2 := le_of_lt h1
[GOAL]
case neg
m✝ n✝ k m n : ℕ
h1 : n < m
h2 : n ≤ m
⊢ max (succ m) (succ n) = succ (max m n)
[PROOFSTEP]
rw [max_eq_left h2, max_eq_left (succ_le_succ h2)]
[GOAL]
m✝ n✝ k m n : ℕ
⊢ m < n ↔ m + 1 ≤ n
[PROOFSTEP]
rw [succ_le_iff]
[GOAL]
m n k a b : ℕ
⊢ a < 1 + b ↔ a ≤ b
[PROOFSTEP]
simp only [add_comm, lt_succ_iff]
[GOAL]
m n k a b : ℕ
⊢ 1 + a ≤ b ↔ a < b
[PROOFSTEP]
simp only [add_comm, add_one_le_iff]
[GOAL]
m✝ n✝ k✝ m n k : ℕ
n0 : 0 < n
⊢ m / n ≤ k ↔ m ≤ n * k + (n - 1)
[PROOFSTEP]
rw [← lt_succ_iff, div_lt_iff_lt_mul n0, succ_mul, mul_comm]
[GOAL]
m✝ n✝ k✝ m n k : ℕ
n0 : 0 < n
⊢ m < n * k + n ↔ m ≤ n * k + (n - 1)
[PROOFSTEP]
cases n
[GOAL]
case zero
m✝ n k✝ m k : ℕ
n0 : 0 < zero
⊢ m < zero * k + zero ↔ m ≤ zero * k + (zero - 1)
[PROOFSTEP]
cases n0
[GOAL]
case succ
m✝ n k✝ m k n✝ : ℕ
n0 : 0 < succ n✝
⊢ m < succ n✝ * k + succ n✝ ↔ m ≤ succ n✝ * k + (succ n✝ - 1)
[PROOFSTEP]
exact lt_succ_iff
[GOAL]
m n✝ k n : ℕ
x✝² : n + 3 ≠ 0
x✝¹ : n + 3 ≠ 1
x✝ : n + 3 ≠ 2
⊢ 2 < n + 3
[PROOFSTEP]
rw [Nat.lt_iff_add_one_le]
[GOAL]
m n✝ k n : ℕ
x✝² : n + 3 ≠ 0
x✝¹ : n + 3 ≠ 1
x✝ : n + 3 ≠ 2
⊢ 2 + 1 ≤ n + 3
[PROOFSTEP]
convert Nat.le_add_left 3 n
[GOAL]
m n✝ k : ℕ
P : ℕ → Prop
n : ℕ
⊢ (∀ (m : ℕ), m < n + 1 → P m) ↔ (∀ (m : ℕ), m < n → P m) ∧ P n
[PROOFSTEP]
simp only [lt_succ_iff, Decidable.le_iff_eq_or_lt, forall_eq_or_imp, and_comm]
[GOAL]
m n✝ k : ℕ
P : ℕ → Prop
n : ℕ
⊢ (∃ m, m < n + 1 ∧ P m) ↔ (∃ m, m < n ∧ P m) ∨ P n
[PROOFSTEP]
rw [← not_iff_not]
[GOAL]
m n✝ k : ℕ
P : ℕ → Prop
n : ℕ
⊢ (¬∃ m, m < n + 1 ∧ P m) ↔ ¬((∃ m, m < n ∧ P m) ∨ P n)
[PROOFSTEP]
push_neg
[GOAL]
m n✝ k : ℕ
P : ℕ → Prop
n : ℕ
⊢ (∀ (m : ℕ), m < n + 1 → ¬P m) ↔ (∀ (m : ℕ), m < n → ¬P m) ∧ ¬P n
[PROOFSTEP]
exact forall_lt_succ
[GOAL]
m n k : ℕ
h : m < n
⊢ n = m + (n - (m + 1)) + 1
[PROOFSTEP]
rw [add_right_comm, add_sub_of_le h]
[GOAL]
m✝ n✝ k n m : ℕ
⊢ n + succ m - 1 = n + m
[PROOFSTEP]
rw [add_succ, succ_sub_one]
[GOAL]
m✝ n✝ k n m : ℕ
⊢ succ n + m - 1 = n + m
[PROOFSTEP]
rw [succ_add, succ_sub_one]
[GOAL]
m✝ n✝ k m n : ℕ
H : m = succ n
⊢ pred m = n
[PROOFSTEP]
simp [H]
[GOAL]
m✝ n✝ k n m : ℕ
⊢ pred n = succ m ↔ n = m + 2
[PROOFSTEP]
cases n
[GOAL]
case zero
m✝ n k m : ℕ
⊢ pred zero = succ m ↔ zero = m + 2
[PROOFSTEP]
constructor
[GOAL]
case succ
m✝ n k m n✝ : ℕ
⊢ pred (succ n✝) = succ m ↔ succ n✝ = m + 2
[PROOFSTEP]
constructor
[GOAL]
case zero.mp
m✝ n k m : ℕ
⊢ pred zero = succ m → zero = m + 2
[PROOFSTEP]
rintro ⟨⟩
[GOAL]
case zero.mpr
m✝ n k m : ℕ
⊢ zero = m + 2 → pred zero = succ m
[PROOFSTEP]
rintro ⟨⟩
[GOAL]
case succ.mp
m✝ n k m n✝ : ℕ
⊢ pred (succ n✝) = succ m → succ n✝ = m + 2
[PROOFSTEP]
rintro ⟨⟩
[GOAL]
case succ.mpr
m✝ n k m n✝ : ℕ
⊢ succ n✝ = m + 2 → pred (succ n✝) = succ m
[PROOFSTEP]
rintro ⟨⟩
[GOAL]
case succ.mp.refl
m✝ n k m : ℕ
⊢ succ (succ m) = m + 2
[PROOFSTEP]
rfl
[GOAL]
case succ.mpr.refl
m✝ n k m : ℕ
⊢ pred (succ (Nat.add m 1)) = succ m
[PROOFSTEP]
rfl
[GOAL]
m✝ n✝ k n m : ℕ
⊢ pred n - m = pred (n - m)
[PROOFSTEP]
rw [← Nat.sub_one, Nat.sub_sub, one_add, sub_succ]
[GOAL]
m n✝ k n : ℕ
⊢ pred (1 + n) = n
[PROOFSTEP]
rw [add_comm, add_one, Nat.pred_succ]
[GOAL]
m✝ n✝ k n m : ℕ
⊢ ¬2 * n % 2 = (2 * m + 1) % 2
[PROOFSTEP]
rw [add_comm, add_mul_mod_self_left, mul_mod_right, mod_eq_of_lt]
[GOAL]
m✝ n✝ k n m : ℕ
⊢ ¬0 = 1
[PROOFSTEP]
simp
[GOAL]
m✝ n✝ k n m : ℕ
⊢ 1 < 2
[PROOFSTEP]
simp
[GOAL]
m n k a b : ℕ
ha : 0 < a
this : a * b = a * 1 ↔ b = 1
⊢ a * b = a ↔ b = 1
[PROOFSTEP]
rwa [mul_one] at this
[GOAL]
m n k a b : ℕ
hb : 0 < b
⊢ a * b = b ↔ a = 1
[PROOFSTEP]
rw [mul_comm, Nat.mul_right_eq_self_iff hb]
[GOAL]
m n✝ k : ℕ
C : ℕ → Sort u
n : ℕ
h : n ≤ n
next : {k : ℕ} → C k → C (k + 1)
x : C n
⊢ leRecOn h (fun {k} => next) x = x
[PROOFSTEP]
cases n
[GOAL]
case zero
m n k : ℕ
C : ℕ → Sort u
next : {k : ℕ} → C k → C (k + 1)
h : zero ≤ zero
x : C zero
⊢ leRecOn h (fun {k} => next) x = x
[PROOFSTEP]
unfold leRecOn Eq.recOn
[GOAL]
case succ
m n k : ℕ
C : ℕ → Sort u
next : {k : ℕ} → C k → C (k + 1)
n✝ : ℕ
h : succ n✝ ≤ succ n✝
x : C (succ n✝)
⊢ leRecOn h (fun {k} => next) x = x
[PROOFSTEP]
unfold leRecOn Eq.recOn
[GOAL]
case zero
m n k : ℕ
C : ℕ → Sort u
next : {k : ℕ} → C k → C (k + 1)
h : zero ≤ zero
x : C zero
⊢ (_ : zero = 0) ▸ x = x
[PROOFSTEP]
simp
[GOAL]
case succ
m n k : ℕ
C : ℕ → Sort u
next : {k : ℕ} → C k → C (k + 1)
n✝ : ℕ
h : succ n✝ ≤ succ n✝
x : C (succ n✝)
⊢ (Or.by_cases (_ : succ n✝ ≤ n✝ ∨ succ n✝ = succ n✝) (fun h => (fun {k} => next) (leRecOn h (fun {k} => next) x))
      fun h => h ▸ x) =
    x
[PROOFSTEP]
unfold Or.by_cases
[GOAL]
case succ
m n k : ℕ
C : ℕ → Sort u
next : {k : ℕ} → C k → C (k + 1)
n✝ : ℕ
h : succ n✝ ≤ succ n✝
x : C (succ n✝)
⊢ (if hp : succ n✝ ≤ n✝ then (fun h => (fun {k} => next) (leRecOn h (fun {k} => next) x)) hp
    else (fun h => h ▸ x) (_ : succ n✝ = succ n✝)) =
    x
[PROOFSTEP]
rw [dif_neg (Nat.not_succ_le_self _)]
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
h1 : n ≤ m
h2 : n ≤ m + 1
next : {k : ℕ} → C k → C (k + 1)
x : C n
⊢ leRecOn h2 next x = next (leRecOn h1 next x)
[PROOFSTEP]
conv =>
  lhs
  rw [leRecOn, Or.by_cases, dif_pos h1]
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
h1 : n ≤ m
h2 : n ≤ m + 1
next : {k : ℕ} → C k → C (k + 1)
x : C n
| leRecOn h2 next x = next (leRecOn h1 next x)
[PROOFSTEP]
  lhs
  rw [leRecOn, Or.by_cases, dif_pos h1]
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
h1 : n ≤ m
h2 : n ≤ m + 1
next : {k : ℕ} → C k → C (k + 1)
x : C n
| leRecOn h2 next x = next (leRecOn h1 next x)
[PROOFSTEP]
  lhs
  rw [leRecOn, Or.by_cases, dif_pos h1]
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
h1 : n ≤ m
h2 : n ≤ m + 1
next : {k : ℕ} → C k → C (k + 1)
x : C n
| leRecOn h2 next x = next (leRecOn h1 next x)
[PROOFSTEP]
lhs
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
h1 : n ≤ m
h2 : n ≤ m + 1
next : {k : ℕ} → C k → C (k + 1)
x : C n
| leRecOn h2 next x
[PROOFSTEP]
rw [leRecOn, Or.by_cases, dif_pos h1]
[GOAL]
m n✝ k : ℕ
C : ℕ → Sort u
n : ℕ
h : n ≤ n + 1
next : {k : ℕ} → C k → C (k + 1)
x : C n
⊢ leRecOn h (fun {k} => next) x = next x
[PROOFSTEP]
rw [leRecOn_succ (le_refl n), leRecOn_self]
[GOAL]
m✝ n✝ k✝ : ℕ
C : ℕ → Sort u
n m k : ℕ
hnm : n ≤ m
hmk : m ≤ k
next : {k : ℕ} → C k → C (k + 1)
x : C n
⊢ leRecOn (_ : n ≤ k) next x = leRecOn hmk next (leRecOn hnm next x)
[PROOFSTEP]
induction' hmk with k hmk ih
[GOAL]
case refl
m✝ n✝ k✝ : ℕ
C : ℕ → Sort u
n m k : ℕ
hnm : n ≤ m
next : {k : ℕ} → C k → C (k + 1)
x : C n
⊢ leRecOn (_ : n ≤ m) next x = leRecOn (_ : Nat.le m m) next (leRecOn hnm next x)
[PROOFSTEP]
rw [leRecOn_self]
[GOAL]
case step
m✝ n✝ k✝¹ : ℕ
C : ℕ → Sort u
n m k✝ : ℕ
hnm : n ≤ m
next : {k : ℕ} → C k → C (k + 1)
x : C n
k : ℕ
hmk : Nat.le m k
ih : leRecOn (_ : n ≤ k) next x = leRecOn hmk next (leRecOn hnm next x)
⊢ leRecOn (_ : n ≤ succ k) next x = leRecOn (_ : Nat.le m (succ k)) next (leRecOn hnm next x)
[PROOFSTEP]
rw [leRecOn_succ (le_trans hnm hmk), ih, leRecOn_succ]
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
h1 : n ≤ m
h2 : n + 1 ≤ m
next : {k : ℕ} → C k → C (k + 1)
x : C n
⊢ leRecOn h2 (fun {k} => next) (next x) = leRecOn h1 (fun {k} => next) x
[PROOFSTEP]
rw [Subsingleton.elim h1 (le_trans (le_succ n) h2), leRecOn_trans (le_succ n) h2, leRecOn_succ']
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
hnm : n ≤ m
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Injective next
⊢ Function.Injective (leRecOn hnm fun {k} => next)
[PROOFSTEP]
induction' hnm with m hnm ih
[GOAL]
case refl
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Injective next
⊢ Function.Injective (leRecOn (_ : Nat.le n n) fun {k} => next)
[PROOFSTEP]
intro x y H
[GOAL]
case refl
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Injective next
x y : C n
H : leRecOn (_ : Nat.le n n) (fun {k} => next) x = leRecOn (_ : Nat.le n n) (fun {k} => next) y
⊢ x = y
[PROOFSTEP]
rwa [leRecOn_self, leRecOn_self] at H
[GOAL]
case step
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Injective next
m : ℕ
hnm : Nat.le n m
ih : Function.Injective (leRecOn hnm fun {k} => next)
⊢ Function.Injective (leRecOn (_ : Nat.le n (succ m)) fun {k} => next)
[PROOFSTEP]
intro x y H
[GOAL]
case step
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Injective next
m : ℕ
hnm : Nat.le n m
ih : Function.Injective (leRecOn hnm fun {k} => next)
x y : C n
H : leRecOn (_ : Nat.le n (succ m)) (fun {k} => next) x = leRecOn (_ : Nat.le n (succ m)) (fun {k} => next) y
⊢ x = y
[PROOFSTEP]
rw [leRecOn_succ hnm, leRecOn_succ hnm] at H
[GOAL]
case step
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Injective next
m : ℕ
hnm : Nat.le n m
ih : Function.Injective (leRecOn hnm fun {k} => next)
x y : C n
H : next (leRecOn hnm (fun {k} => next) x) = next (leRecOn hnm (fun {k} => next) y)
⊢ x = y
[PROOFSTEP]
exact ih (Hnext _ H)
[GOAL]
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
hnm : n ≤ m
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
⊢ Function.Surjective (leRecOn hnm fun {k} => next)
[PROOFSTEP]
induction' hnm with m hnm ih
[GOAL]
case refl
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
⊢ Function.Surjective (leRecOn (_ : Nat.le n n) fun {k} => next)
[PROOFSTEP]
intro x
[GOAL]
case refl
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
x : C n
⊢ ∃ a, leRecOn (_ : Nat.le n n) (fun {k} => next) a = x
[PROOFSTEP]
use x
[GOAL]
case h
m✝ n✝ k : ℕ
C : ℕ → Sort u
n m : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
x : C n
⊢ leRecOn (_ : Nat.le n n) (fun {k} => next) x = x
[PROOFSTEP]
rw [leRecOn_self]
[GOAL]
case step
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
m : ℕ
hnm : Nat.le n m
ih : Function.Surjective (leRecOn hnm fun {k} => next)
⊢ Function.Surjective (leRecOn (_ : Nat.le n (succ m)) fun {k} => next)
[PROOFSTEP]
intro x
[GOAL]
case step
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
m : ℕ
hnm : Nat.le n m
ih : Function.Surjective (leRecOn hnm fun {k} => next)
x : C (succ m)
⊢ ∃ a, leRecOn (_ : Nat.le n (succ m)) (fun {k} => next) a = x
[PROOFSTEP]
rcases Hnext _ x with ⟨w, rfl⟩
[GOAL]
case step.intro
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
m : ℕ
hnm : Nat.le n m
ih : Function.Surjective (leRecOn hnm fun {k} => next)
w : C m
⊢ ∃ a, leRecOn (_ : Nat.le n (succ m)) (fun {k} => next) a = next w
[PROOFSTEP]
rcases ih w with ⟨x, rfl⟩
[GOAL]
case step.intro.intro
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
m : ℕ
hnm : Nat.le n m
ih : Function.Surjective (leRecOn hnm fun {k} => next)
x : C n
⊢ ∃ a, leRecOn (_ : Nat.le n (succ m)) (fun {k} => next) a = next (leRecOn hnm (fun {k} => next) x)
[PROOFSTEP]
use x
[GOAL]
case h
m✝¹ n✝ k : ℕ
C : ℕ → Sort u
n m✝ : ℕ
next : {k : ℕ} → C k → C (k + 1)
Hnext : ∀ (n : ℕ), Function.Surjective next
m : ℕ
hnm : Nat.le n m
ih : Function.Surjective (leRecOn hnm fun {k} => next)
x : C n
⊢ leRecOn (_ : Nat.le n (succ m)) (fun {k} => next) x = next (leRecOn hnm (fun {k} => next) x)
[PROOFSTEP]
rw [leRecOn_succ]
[GOAL]
m n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → ((m : ℕ) → m < n → P m) → P n
n : ℕ
⊢ strongRecOn' n h = h n fun m x => strongRecOn' m h
[PROOFSTEP]
simp only [strongRecOn']
[GOAL]
m n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → ((m : ℕ) → m < n → P m) → P n
n : ℕ
⊢ Nat.strongRec' h n = h n fun m x => Nat.strongRec' h m
[PROOFSTEP]
rw [Nat.strongRec']
[GOAL]
m✝ n k m : ℕ
P : (n : ℕ) → m ≤ n → Prop
base : P m (_ : m ≤ m)
succ : ∀ (n : ℕ) (hn : m ≤ n), P n hn → P (n + 1) (_ : m ≤ n + 1)
⊢ ∀ (n : ℕ) (hn : m ≤ n), P n hn
[PROOFSTEP]
apply Nat.le.rec
[GOAL]
case refl
m✝ n k m : ℕ
P : (n : ℕ) → m ≤ n → Prop
base : P m (_ : m ≤ m)
succ : ∀ (n : ℕ) (hn : m ≤ n), P n hn → P (n + 1) (_ : m ≤ n + 1)
⊢ P m (_ : Nat.le m m)
[PROOFSTEP]
exact base
[GOAL]
case step
m✝ n k m : ℕ
P : (n : ℕ) → m ≤ n → Prop
base : P m (_ : m ≤ m)
succ : ∀ (n : ℕ) (hn : m ≤ n), P n hn → P (n + 1) (_ : m ≤ n + 1)
⊢ ∀ {m_1 : ℕ} (a : Nat.le m m_1), P m_1 a → P (Nat.succ m_1) (_ : Nat.le m (Nat.succ m_1))
[PROOFSTEP]
intros n hn
[GOAL]
case step
m✝ n✝ k m : ℕ
P : (n : ℕ) → m ≤ n → Prop
base : P m (_ : m ≤ m)
succ : ∀ (n : ℕ) (hn : m ≤ n), P n hn → P (n + 1) (_ : m ≤ n + 1)
n : ℕ
hn : Nat.le m n
⊢ P n hn → P (Nat.succ n) (_ : Nat.le m (Nat.succ n))
[PROOFSTEP]
apply succ n hn
[GOAL]
m n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
n : ℕ
nn : n ≤ n
hP : P n
⊢ decreasingInduction h nn hP = hP
[PROOFSTEP]
dsimp only [decreasingInduction]
[GOAL]
m n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
n : ℕ
nn : n ≤ n
hP : P n
⊢ leRecOn nn (fun {k} ih hsk => ih (h k hsk)) (fun h => h) hP = hP
[PROOFSTEP]
rw [leRecOn_self]
[GOAL]
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n : ℕ
mn : m ≤ n
msn : m ≤ n + 1
hP : P (n + 1)
⊢ decreasingInduction h msn hP = decreasingInduction h mn (h n hP)
[PROOFSTEP]
dsimp only [decreasingInduction]
[GOAL]
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n : ℕ
mn : m ≤ n
msn : m ≤ n + 1
hP : P (n + 1)
⊢ leRecOn msn (fun {k} ih hsk => ih (h k hsk)) (fun h => h) hP =
    leRecOn mn (fun {k} ih hsk => ih (h k hsk)) (fun h => h) (h n hP)
[PROOFSTEP]
rw [leRecOn_succ]
[GOAL]
m✝ n k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m : ℕ
msm : m ≤ m + 1
hP : P (m + 1)
⊢ decreasingInduction h msm hP = h m hP
[PROOFSTEP]
dsimp only [decreasingInduction]
[GOAL]
m✝ n k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m : ℕ
msm : m ≤ m + 1
hP : P (m + 1)
⊢ leRecOn msm (fun {k} ih hsk => ih (h k hsk)) (fun h => h) hP = h m hP
[PROOFSTEP]
rw [leRecOn_succ']
[GOAL]
m✝ n✝ k✝ : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n k : ℕ
mn : m ≤ n
nk : n ≤ k
hP : P k
⊢ decreasingInduction h (_ : m ≤ k) hP = decreasingInduction h mn (decreasingInduction h nk hP)
[PROOFSTEP]
induction' nk with k nk ih
[GOAL]
case refl
m✝ n✝ k✝ : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n k : ℕ
mn : m ≤ n
hP✝ : P k
hP : P n
⊢ decreasingInduction h (_ : m ≤ n) hP = decreasingInduction h mn (decreasingInduction h (_ : Nat.le n n) hP)
[PROOFSTEP]
rw [decreasingInduction_self]
[GOAL]
case step
m✝ n✝ k✝¹ : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n k✝ : ℕ
mn : m ≤ n
hP✝ : P k✝
k : ℕ
nk : Nat.le n k
ih : ∀ (hP : P k), decreasingInduction h (_ : m ≤ k) hP = decreasingInduction h mn (decreasingInduction h nk hP)
hP : P (succ k)
⊢ decreasingInduction h (_ : m ≤ succ k) hP =
    decreasingInduction h mn (decreasingInduction h (_ : Nat.le n (succ k)) hP)
[PROOFSTEP]
rw [decreasingInduction_succ h (le_trans mn nk), ih, decreasingInduction_succ]
[GOAL]
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n : ℕ
smn : m + 1 ≤ n
mn : m ≤ n
hP : P n
⊢ decreasingInduction h mn hP = h m (decreasingInduction h smn hP)
[PROOFSTEP]
rw [Subsingleton.elim mn (le_trans (le_succ m) smn), decreasingInduction_trans, decreasingInduction_succ']
[GOAL]
case msm
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
h : (n : ℕ) → P (n + 1) → P n
m n : ℕ
smn : m + 1 ≤ n
mn : m ≤ n
hP : P n
⊢ m ≤ m + 1
[PROOFSTEP]
apply Nat.le_succ
[GOAL]
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
m n : ℕ
h : (k : ℕ) → k < n → m ≤ k → P (k + 1) → P k
mn : m ≤ n
hP : P n
⊢ P m
[PROOFSTEP]
revert h hP
[GOAL]
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
m n : ℕ
mn : m ≤ n
⊢ ((k : ℕ) → k < n → m ≤ k → P (k + 1) → P k) → P n → P m
[PROOFSTEP]
refine' leRecOn' mn _ _
[GOAL]
case refine'_1
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
m n : ℕ
mn : m ≤ n
⊢ ⦃k : ℕ⦄ →
    m ≤ k →
      (((k_1 : ℕ) → k_1 < k → m ≤ k_1 → P (k_1 + 1) → P k_1) → P k → P m) →
        ((k_1 : ℕ) → k_1 < k + 1 → m ≤ k_1 → P (k_1 + 1) → P k_1) → P (k + 1) → P m
[PROOFSTEP]
intro n mn ih h hP
[GOAL]
case refine'_1
m✝ n✝¹ k : ℕ
P : ℕ → Sort u_1
m n✝ : ℕ
mn✝ : m ≤ n✝
n : ℕ
mn : m ≤ n
ih : ((k : ℕ) → k < n → m ≤ k → P (k + 1) → P k) → P n → P m
h : (k : ℕ) → k < n + 1 → m ≤ k → P (k + 1) → P k
hP : P (n + 1)
⊢ P m
[PROOFSTEP]
apply ih
[GOAL]
case refine'_1.h
m✝ n✝¹ k : ℕ
P : ℕ → Sort u_1
m n✝ : ℕ
mn✝ : m ≤ n✝
n : ℕ
mn : m ≤ n
ih : ((k : ℕ) → k < n → m ≤ k → P (k + 1) → P k) → P n → P m
h : (k : ℕ) → k < n + 1 → m ≤ k → P (k + 1) → P k
hP : P (n + 1)
⊢ (k : ℕ) → k < n → m ≤ k → P (k + 1) → P k
[PROOFSTEP]
exact fun k hk => h k (Nat.lt.step hk)
[GOAL]
case refine'_1.hP
m✝ n✝¹ k : ℕ
P : ℕ → Sort u_1
m n✝ : ℕ
mn✝ : m ≤ n✝
n : ℕ
mn : m ≤ n
ih : ((k : ℕ) → k < n → m ≤ k → P (k + 1) → P k) → P n → P m
h : (k : ℕ) → k < n + 1 → m ≤ k → P (k + 1) → P k
hP : P (n + 1)
⊢ P n
[PROOFSTEP]
exact h n (lt_succ_self n) mn hP
[GOAL]
case refine'_2
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
m n : ℕ
mn : m ≤ n
⊢ ((k : ℕ) → k < m → m ≤ k → P (k + 1) → P k) → P m → P m
[PROOFSTEP]
intro _ hP
[GOAL]
case refine'_2
m✝ n✝ k : ℕ
P : ℕ → Sort u_1
m n : ℕ
mn : m ≤ n
h✝ : (k : ℕ) → k < m → m ≤ k → P (k + 1) → P k
hP : P m
⊢ P m
[PROOFSTEP]
exact hP
[GOAL]
m n k a b : ℕ
hb : 0 < b
⊢ 1 ≤ a / b ↔ b ≤ a
[PROOFSTEP]
rw [le_div_iff_mul_le hb, one_mul]
[GOAL]
m✝ n✝ k✝ n m : ℕ
h : n ≤ m
k : ℕ
k0 : k = 0
⊢ n / k ≤ m / k
[PROOFSTEP]
simp [k0]
[GOAL]
m n k a b : ℕ
hba : b ≤ a
hb : 0 < b
h : a / b = 0
⊢ a = a % b
[PROOFSTEP]
simpa [h] using (mod_add_div a b).symm
[GOAL]
m n k a b c : ℕ
hc0 : c = 0
⊢ a * (b / c) ≤ a * b / c
[PROOFSTEP]
simp [hc0]
[GOAL]
m n k a b c : ℕ
hc0 : ¬c = 0
⊢ a * (b / c) * c ≤ a * b
[PROOFSTEP]
rw [mul_assoc]
[GOAL]
m n k a b c : ℕ
hc0 : ¬c = 0
⊢ a * (b / c * c) ≤ a * b
[PROOFSTEP]
exact Nat.mul_le_mul_left _ (Nat.div_mul_le_self _ _)
[GOAL]
m n k a b c : ℕ
H1 : b ∣ a
H2 : a / b = c
⊢ a = b * c
[PROOFSTEP]
rw [← H2, Nat.mul_div_cancel' H1]
[GOAL]
m n k a b c : ℕ
H : 0 < b
H' : b ∣ a
⊢ a / b = c ↔ a = c * b
[PROOFSTEP]
rw [mul_comm]
[GOAL]
m n k a b c : ℕ
H : 0 < b
H' : b ∣ a
⊢ a / b = c ↔ a = b * c
[PROOFSTEP]
exact Nat.div_eq_iff_eq_mul_right H H'
[GOAL]
m n k a b c : ℕ
H1 : b ∣ a
H2 : a / b = c
⊢ a = c * b
[PROOFSTEP]
rw [mul_comm, Nat.eq_mul_of_div_eq_right H1 H2]
[GOAL]
m n k a b : ℕ
Hd : a ∣ b
⊢ a * (b / a) = b
[PROOFSTEP]
rw [mul_comm, Nat.div_mul_cancel Hd]
[GOAL]
m n k a b : ℕ
hb : 0 < b
⊢ a < a / b * b + b
[PROOFSTEP]
rw [← Nat.succ_mul, ← Nat.div_lt_iff_lt_mul hb]
[GOAL]
m n k a b : ℕ
hb : 0 < b
⊢ a / b < succ (a / b)
[PROOFSTEP]
exact Nat.lt_succ_self _
[GOAL]
m n k a b d : ℕ
hda : d ∣ a
hdb : d ∣ b
⊢ a / d = b / d ↔ a = b
[PROOFSTEP]
refine ⟨fun h => ?_, congr_arg fun n => n / d⟩
[GOAL]
m n k a b d : ℕ
hda : d ∣ a
hdb : d ∣ b
h : a / d = b / d
⊢ a = b
[PROOFSTEP]
rw [← Nat.mul_div_cancel' hda, ← Nat.mul_div_cancel' hdb, h]
[GOAL]
m n k a b : ℕ
h : b ≠ 0
⊢ a % b = a ↔ a < b
[PROOFSTEP]
cases b
[GOAL]
case zero
m n k a : ℕ
h : zero ≠ 0
⊢ a % zero = a ↔ a < zero
case succ m n k a n✝ : ℕ h : succ n✝ ≠ 0 ⊢ a % succ n✝ = a ↔ a < succ n✝
[PROOFSTEP]
contradiction
[GOAL]
case succ
m n k a n✝ : ℕ
h : succ n✝ ≠ 0
⊢ a % succ n✝ = a ↔ a < succ n✝
[PROOFSTEP]
exact ⟨fun h => h.ge.trans_lt (mod_lt _ (succ_pos _)), mod_eq_of_lt⟩
[GOAL]
m✝ n k✝ m k : ℕ
⊢ m % k + m / k * k = m
[PROOFSTEP]
rw [mul_comm]
[GOAL]
m✝ n k✝ m k : ℕ
⊢ m % k + k * (m / k) = m
[PROOFSTEP]
exact mod_add_div _ _
[GOAL]
m✝ n k✝ m k : ℕ
⊢ m / k * k + m % k = m
[PROOFSTEP]
rw [mul_comm]
[GOAL]
m✝ n k✝ m k : ℕ
⊢ k * (m / k) + m % k = m
[PROOFSTEP]
exact div_add_mod _ _
[GOAL]
m✝ n✝ k✝ n k m d : ℕ
h : 0 < k
x✝ : m + k * d = n ∧ m < k
h₁ : m + k * d = n
h₂ : m < k
⊢ (m + k * d) / k = d ∧ (m + k * d) % k = m
[PROOFSTEP]
rw [add_mul_div_left _ _ h, add_mul_mod_self_left]
[GOAL]
m✝ n✝ k✝ n k m d : ℕ
h : 0 < k
x✝ : m + k * d = n ∧ m < k
h₁ : m + k * d = n
h₂ : m < k
⊢ m / k + d = d ∧ m % k = m
[PROOFSTEP]
simp [div_eq_of_lt, mod_eq_of_lt, h₂]
[GOAL]
m n k a b c : ℕ
ha : 0 < a
d : ℕ
⊢ a * c = a * b * d ↔ c = b * d
[PROOFSTEP]
rw [mul_assoc, mul_right_inj' ha.ne']
[GOAL]
m n k a b c : ℕ
hc : 0 < c
d : ℕ
⊢ b * c = a * c * d ↔ b = a * d
[PROOFSTEP]
rw [mul_right_comm, mul_left_inj' hc.ne']
[GOAL]
m✝ n✝ k✝ n m k : ℕ
h : m ∣ k
⊢ n % k % m = n % m
[PROOFSTEP]
conv =>
  rhs
  rw [← mod_add_div n k]
[GOAL]
m✝ n✝ k✝ n m k : ℕ
h : m ∣ k
| n % k % m = n % m
[PROOFSTEP]
  rhs
  rw [← mod_add_div n k]
[GOAL]
m✝ n✝ k✝ n m k : ℕ
h : m ∣ k
| n % k % m = n % m
[PROOFSTEP]
  rhs
  rw [← mod_add_div n k]
[GOAL]
m✝ n✝ k✝ n m k : ℕ
h : m ∣ k
| n % k % m = n % m
[PROOFSTEP]
rhs
[GOAL]
m✝ n✝ k✝ n m k : ℕ
h : m ∣ k
| n % m
[PROOFSTEP]
rw [← mod_add_div n k]
[GOAL]
m✝ n✝ k✝ n m k : ℕ
h : m ∣ k
⊢ n % k % m = (n % k + k * (n / k)) % m
[PROOFSTEP]
rcases h with ⟨t, rfl⟩
[GOAL]
case intro
m✝ n✝ k n m t : ℕ
⊢ n % (m * t) % m = (n % (m * t) + m * t * (n / (m * t))) % m
[PROOFSTEP]
rw [mul_assoc, add_mul_mod_self_left]
[GOAL]
m✝ n✝ k✝ m n k i : ℕ
H : m % n = k % n
⊢ (m + i) % n = (k + i) % n
[PROOFSTEP]
rw [← mod_add_mod, ← mod_add_mod k, H]
[GOAL]
m✝ n✝ k✝ m n k i : ℕ
H : m % n = k % n
⊢ (i + m) % n = (i + k) % n
[PROOFSTEP]
rw [add_comm, add_mod_eq_add_mod_right _ H, add_comm]
[GOAL]
m n k a b c : ℕ
hab : c ∣ b
h : a ∣ b / c
h1 : ∃ d, b / c = a * d
d : ℕ
hd : b / c = a * d
h3 : b = a * d * c
⊢ b = c * a * d
[PROOFSTEP]
rwa [mul_comm, ← mul_assoc] at h3
[GOAL]
m n k a b : ℕ
w : a ∣ b
h : b / a = 1
⊢ a = b
[PROOFSTEP]
rw [← Nat.div_mul_cancel w, h, one_mul]
[GOAL]
m n k a b : ℕ
w : a ∣ b
h : b / a = 0
⊢ b = 0
[PROOFSTEP]
rw [← Nat.div_mul_cancel w, h, zero_mul]
[GOAL]
m✝ n✝ k m n : ℕ
n0 : 0 < n
⊢ m < n * (m / n + 1)
[PROOFSTEP]
rw [mul_comm, ← Nat.div_lt_iff_lt_mul' n0]
[GOAL]
m✝ n✝ k m n : ℕ
n0 : 0 < n
⊢ m / n < m / n + 1
[PROOFSTEP]
exact lt_succ_self _
[GOAL]
m n k a b c : ℕ
⊢ (a * b + c) % b = c % b
[PROOFSTEP]
simp [Nat.add_mod]
[GOAL]
m n k a b c : ℕ
h : c < b
⊢ (a * b + c) % b = c
[PROOFSTEP]
rw [Nat.mul_add_mod, Nat.mod_eq_of_lt h]
[GOAL]
m n✝ k n : ℕ
⊢ pred n = n ↔ n = 0
[PROOFSTEP]
cases n
[GOAL]
case zero
m n k : ℕ
⊢ pred zero = zero ↔ zero = 0
[PROOFSTEP]
simp [(Nat.succ_ne_self _).symm]
[GOAL]
case succ
m n k n✝ : ℕ
⊢ pred (succ n✝) = succ n✝ ↔ succ n✝ = 0
[PROOFSTEP]
simp [(Nat.succ_ne_self _).symm]
[GOAL]
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
⊢ Nat.find h = m ↔ p m ∧ ∀ (n : ℕ), n < m → ¬p n
[PROOFSTEP]
constructor
[GOAL]
case mp
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
⊢ Nat.find h = m → p m ∧ ∀ (n : ℕ), n < m → ¬p n
[PROOFSTEP]
rintro rfl
[GOAL]
case mp
n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
⊢ p (Nat.find h) ∧ ∀ (n : ℕ), n < Nat.find h → ¬p n
[PROOFSTEP]
exact ⟨Nat.find_spec h, fun _ => Nat.find_min h⟩
[GOAL]
case mpr
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
⊢ (p m ∧ ∀ (n : ℕ), n < m → ¬p n) → Nat.find h = m
[PROOFSTEP]
rintro ⟨hm, hlt⟩
[GOAL]
case mpr.intro
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
hm : p m
hlt : ∀ (n : ℕ), n < m → ¬p n
⊢ Nat.find h = m
[PROOFSTEP]
exact le_antisymm (Nat.find_min' h hm) (not_lt.1 <| imp_not_comm.1 (hlt _) <| Nat.find_spec h)
[GOAL]
m n✝ k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
n : ℕ
⊢ Nat.find h ≤ n ↔ ∃ m, m ≤ n ∧ p m
[PROOFSTEP]
simp only [exists_prop, ← lt_succ_iff, find_lt_iff]
[GOAL]
m n✝ k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
n : ℕ
⊢ n ≤ Nat.find h ↔ ∀ (m : ℕ), m < n → ¬p m
[PROOFSTEP]
simp_rw [← not_lt, find_lt_iff, not_exists, not_and]
[GOAL]
m n✝ k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
n : ℕ
⊢ n < Nat.find h ↔ ∀ (m : ℕ), m ≤ n → ¬p m
[PROOFSTEP]
simp only [← succ_le_iff, le_find_iff, succ_le_succ_iff]
[GOAL]
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h : ∃ n, p n
⊢ Nat.find h = 0 ↔ p 0
[PROOFSTEP]
simp [find_eq_iff]
[GOAL]
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h₁ : ∃ n, p n
h₂ : ∃ n, p (n + 1)
h0 : ¬p 0
⊢ Nat.find h₁ = Nat.find h₂ + 1
[PROOFSTEP]
refine' (find_eq_iff _).2 ⟨Nat.find_spec h₂, fun n hn => _⟩
[GOAL]
m n✝ k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h₁ : ∃ n, p n
h₂ : ∃ n, p (n + 1)
h0 : ¬p 0
n : ℕ
hn : n < Nat.find h₂ + 1
⊢ ¬p n
[PROOFSTEP]
cases' n with n
[GOAL]
case zero
m n k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h₁ : ∃ n, p n
h₂ : ∃ n, p (n + 1)
h0 : ¬p 0
hn : zero < Nat.find h₂ + 1
⊢ ¬p zero
case succ
m n✝ k : ℕ
p q : ℕ → Prop
inst✝¹ : DecidablePred p
inst✝ : DecidablePred q
h₁ : ∃ n, p n
h₂ : ∃ n, p (n + 1)
h0 : ¬p 0
n : ℕ
hn : succ n < Nat.find h₂ + 1
⊢ ¬p (succ n)
[PROOFSTEP]
exacts [h0, @Nat.find_min (fun n => p (n + 1)) _ h₂ _ (succ_lt_succ_iff.1 hn)]
[GOAL]
m n✝ k : ℕ
P Q : ℕ → Prop
inst✝ : DecidablePred P
b n : ℕ
h : P (n + 1)
⊢ Nat.findGreatest P (n + 1) = n + 1
[PROOFSTEP]
simp [Nat.findGreatest, h]
[GOAL]
m n k : ℕ
P Q : ℕ → Prop
inst✝ : DecidablePred P
b : ℕ
h : ¬P (b + 1)
⊢ Nat.findGreatest P (b + 1) = Nat.findGreatest P b
[PROOFSTEP]
simp [Nat.findGreatest, h]
[GOAL]
m n✝ k : ℕ
P : (k : ℕ) → k < 0 → Prop
x✝ : (n : ℕ) → (h : n < 0) → Decidable (P n h)
n : ℕ
h : n < 0
⊢ P n h
[PROOFSTEP]
cases h
[GOAL]
m n✝ k n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
⊢ Decidable (∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h)
[PROOFSTEP]
cases' decidableBallLT n fun k h => P k (lt_succ_of_lt h) with h h
[GOAL]
case isFalse
m n✝ k n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
h : ¬∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
⊢ Decidable (∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h)
[PROOFSTEP]
refine' isFalse (mt _ h)
[GOAL]
case isFalse
m n✝ k n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
h : ¬∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
⊢ (∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h) → ∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
[PROOFSTEP]
intro hn k h
[GOAL]
case isFalse
m n✝ k✝ n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
h✝ : ¬∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
hn : ∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h
k : ℕ
h : k < n
⊢ P k (_ : k < succ n)
[PROOFSTEP]
apply hn
[GOAL]
case isTrue
m n✝ k n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
h : ∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
⊢ Decidable (∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h)
[PROOFSTEP]
by_cases p : P n (lt_succ_self n)
[GOAL]
case pos
m n✝ k n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
h : ∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
p : P n (_ : n < succ n)
⊢ Decidable (∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h)
[PROOFSTEP]
exact
  isTrue fun k h' =>
    (le_of_lt_succ h').lt_or_eq_dec.elim (h _) fun e =>
      match k, e, h' with
      | _, rfl, _ => p
[GOAL]
case neg
m n✝ k n : ℕ
P : (k : ℕ) → k < n + 1 → Prop
H : (n_1 : ℕ) → (h : n_1 < n + 1) → Decidable (P n_1 h)
h : ∀ (n_1 : ℕ) (h : n_1 < n), P n_1 (_ : n_1 < succ n)
p : ¬P n (_ : n < succ n)
⊢ Decidable (∀ (n_1 : ℕ) (h : n_1 < n + 1), P n_1 h)
[PROOFSTEP]
exact isFalse (mt (fun hn => hn _ _) p)
[GOAL]
m n k : ℕ
P : ℕ → Prop
h : DecidablePred P
⊢ ¬(fun n => ∃ m, m < n ∧ P m) 0
[PROOFSTEP]
simp
[GOAL]
m n✝ k : ℕ
P : ℕ → Prop
h : DecidablePred P
n : ℕ
⊢ (fun n_1 => ∃ m, m < n_1 ∧ ?m.69545 n m) n ∨ P n ↔ (fun n => ∃ m, m < n ∧ P m) (n + 1)
[PROOFSTEP]
simp only [lt_succ_iff_lt_or_eq, or_and_right, exists_or, exists_eq_left]
[GOAL]
m n✝ k : ℕ
P : ℕ → Prop
h : DecidablePred P
n : ℕ
⊢ (∃ m, m < n ∧ ?m.69545 n m) ∨ P n ↔ (∃ x, x < n ∧ P x) ∨ P n
[PROOFSTEP]
apply Iff.refl


[GOAL]
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
inst✝ : CompleteSpace E
f : ℝ → E
a b : ℝ
⊢ ⨍ (x : ℝ) in a..b, f x = ⨍ (x : ℝ) in b..a, f x
[PROOFSTEP]
rw [setAverage_eq, setAverage_eq, uIoc_comm]
[GOAL]
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
inst✝ : CompleteSpace E
f : ℝ → E
a b : ℝ
⊢ ⨍ (x : ℝ) in a..b, f x = (b - a)⁻¹ • ∫ (x : ℝ) in a..b, f x
[PROOFSTEP]
cases' le_or_lt a b with h h
[GOAL]
case inl
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
inst✝ : CompleteSpace E
f : ℝ → E
a b : ℝ
h : a ≤ b
⊢ ⨍ (x : ℝ) in a..b, f x = (b - a)⁻¹ • ∫ (x : ℝ) in a..b, f x
[PROOFSTEP]
rw [setAverage_eq, uIoc_of_le h, Real.volume_Ioc, intervalIntegral.integral_of_le h,
  ENNReal.toReal_ofReal (sub_nonneg.2 h)]
[GOAL]
case inr
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
inst✝ : CompleteSpace E
f : ℝ → E
a b : ℝ
h : b < a
⊢ ⨍ (x : ℝ) in a..b, f x = (b - a)⁻¹ • ∫ (x : ℝ) in a..b, f x
[PROOFSTEP]
rw [setAverage_eq, uIoc_of_lt h, Real.volume_Ioc, intervalIntegral.integral_of_ge h.le,
  ENNReal.toReal_ofReal (sub_nonneg.2 h.le), smul_neg, ← neg_smul, ← inv_neg, neg_sub]
[GOAL]
E : Type u_1
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
inst✝ : CompleteSpace E
f : ℝ → ℝ
a b : ℝ
⊢ ⨍ (x : ℝ) in a..b, f x = (∫ (x : ℝ) in a..b, f x) / (b - a)
[PROOFSTEP]
rw [interval_average_eq, smul_eq_mul, div_eq_inv_mul]


[GOAL]
E : Type u_1
F : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : InnerProductSpace ℝ E
inst✝ : InnerProductSpace ℝ F
f' : E →L[ℝ] F
h : IsConformalMap f'
u v : E
⊢ angle (↑f' u) (↑f' v) = angle u v
[PROOFSTEP]
obtain ⟨c, hc, li, rfl⟩ := h
[GOAL]
case intro.intro.intro
E : Type u_1
F : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : InnerProductSpace ℝ E
inst✝ : InnerProductSpace ℝ F
u v : E
c : ℝ
hc : c ≠ 0
li : E →ₗᵢ[ℝ] F
⊢ angle (↑(c • LinearIsometry.toContinuousLinearMap li) u) (↑(c • LinearIsometry.toContinuousLinearMap li) v) =
    angle u v
[PROOFSTEP]
exact (angle_smul_smul hc _ _).trans (li.angle_map _ _)


[GOAL]
ι : Type u_1
X : Type u_2
E : Type u_3
inst✝⁷ : TopologicalSpace X
inst✝⁶ : AddCommGroup E
inst✝⁵ : Module ℝ E
inst✝⁴ : NormalSpace X
inst✝³ : ParacompactSpace X
inst✝² : TopologicalSpace E
inst✝¹ : ContinuousAdd E
inst✝ : ContinuousSMul ℝ E
t : X → Set E
ht : ∀ (x : X), Convex ℝ (t x)
H : ∀ (x : X), ∃ U, U ∈ 𝓝 x ∧ ∃ g, ContinuousOn g U ∧ ∀ (y : X), y ∈ U → g y ∈ t y
⊢ ∃ g, ∀ (x : X), ↑g x ∈ t x
[PROOFSTEP]
choose U hU g hgc hgt using H
[GOAL]
ι : Type u_1
X : Type u_2
E : Type u_3
inst✝⁷ : TopologicalSpace X
inst✝⁶ : AddCommGroup E
inst✝⁵ : Module ℝ E
inst✝⁴ : NormalSpace X
inst✝³ : ParacompactSpace X
inst✝² : TopologicalSpace E
inst✝¹ : ContinuousAdd E
inst✝ : ContinuousSMul ℝ E
t : X → Set E
ht : ∀ (x : X), Convex ℝ (t x)
U : X → Set X
hU : ∀ (x : X), U x ∈ 𝓝 x
g : X → X → E
hgc : ∀ (x : X), ContinuousOn (g x) (U x)
hgt : ∀ (x y : X), y ∈ U x → g x y ∈ t y
⊢ ∃ g, ∀ (x : X), ↑g x ∈ t x
[PROOFSTEP]
obtain ⟨f, hf⟩ :=
  PartitionOfUnity.exists_isSubordinate isClosed_univ (fun x => interior (U x)) (fun x => isOpen_interior) fun x _ =>
    mem_iUnion.2 ⟨x, mem_interior_iff_mem_nhds.2 (hU x)⟩
[GOAL]
case intro
ι : Type u_1
X : Type u_2
E : Type u_3
inst✝⁷ : TopologicalSpace X
inst✝⁶ : AddCommGroup E
inst✝⁵ : Module ℝ E
inst✝⁴ : NormalSpace X
inst✝³ : ParacompactSpace X
inst✝² : TopologicalSpace E
inst✝¹ : ContinuousAdd E
inst✝ : ContinuousSMul ℝ E
t : X → Set E
ht : ∀ (x : X), Convex ℝ (t x)
U : X → Set X
hU : ∀ (x : X), U x ∈ 𝓝 x
g : X → X → E
hgc : ∀ (x : X), ContinuousOn (g x) (U x)
hgt : ∀ (x y : X), y ∈ U x → g x y ∈ t y
f : PartitionOfUnity X X univ
hf : PartitionOfUnity.IsSubordinate f fun x => interior (U x)
⊢ ∃ g, ∀ (x : X), ↑g x ∈ t x
[PROOFSTEP]
refine'
  ⟨⟨fun x => ∑ᶠ i, f i x • g i x,
      hf.continuous_finsum_smul (fun i => isOpen_interior) fun i => (hgc i).mono interior_subset⟩,
    fun x => f.finsum_smul_mem_convex (mem_univ x) (fun i hi => hgt _ _ _) (ht _)⟩
[GOAL]
case intro
ι : Type u_1
X : Type u_2
E : Type u_3
inst✝⁷ : TopologicalSpace X
inst✝⁶ : AddCommGroup E
inst✝⁵ : Module ℝ E
inst✝⁴ : NormalSpace X
inst✝³ : ParacompactSpace X
inst✝² : TopologicalSpace E
inst✝¹ : ContinuousAdd E
inst✝ : ContinuousSMul ℝ E
t : X → Set E
ht : ∀ (x : X), Convex ℝ (t x)
U : X → Set X
hU : ∀ (x : X), U x ∈ 𝓝 x
g : X → X → E
hgc : ∀ (x : X), ContinuousOn (g x) (U x)
hgt : ∀ (x y : X), y ∈ U x → g x y ∈ t y
f : PartitionOfUnity X X univ
hf : PartitionOfUnity.IsSubordinate f fun x => interior (U x)
x i : X
hi : ↑(↑f i) x ≠ 0
⊢ x ∈ U i
[PROOFSTEP]
exact interior_subset (hf _ <| subset_closure hi)


[GOAL]
n : ℕ
⊢ fib (n + 2) = fib n + fib (n + 1)
[PROOFSTEP]
simp [fib, Function.iterate_succ_apply']
[GOAL]
n : ℕ
⊢ fib n ≤ fib (n + 1)
[PROOFSTEP]
cases n
[GOAL]
case zero
⊢ fib zero ≤ fib (zero + 1)
[PROOFSTEP]
simp [fib_add_two]
[GOAL]
case succ
n✝ : ℕ
⊢ fib (succ n✝) ≤ fib (succ n✝ + 1)
[PROOFSTEP]
simp [fib_add_two]
[GOAL]
n : ℕ
n_pos : 0 < n
⊢ 0 < fib 1
[PROOFSTEP]
decide
[GOAL]
n : ℕ
⊢ fib (n + 2) - fib (n + 1) = fib n
[PROOFSTEP]
rw [fib_add_two, add_tsub_cancel_right]
[GOAL]
n : ℕ
hn : 2 ≤ n
⊢ fib n < fib (n + 1)
[PROOFSTEP]
rcases exists_add_of_le hn with ⟨n, rfl⟩
[GOAL]
case intro
n : ℕ
hn : 2 ≤ 2 + n
⊢ fib (2 + n) < fib (2 + n + 1)
[PROOFSTEP]
rw [← tsub_pos_iff_lt, add_comm 2, fib_add_two_sub_fib_add_one]
[GOAL]
case intro
n : ℕ
hn : 2 ≤ 2 + n
⊢ 0 < fib (n + 1)
[PROOFSTEP]
apply fib_pos (succ_pos n)
[GOAL]
⊢ StrictMono fun n => fib (n + 2)
[PROOFSTEP]
refine' strictMono_nat_of_lt_succ fun n => _
[GOAL]
n : ℕ
⊢ fib (n + 2) < fib (n + 1 + 2)
[PROOFSTEP]
rw [add_right_comm]
[GOAL]
n : ℕ
⊢ fib (n + 2) < fib (n + 2 + 1)
[PROOFSTEP]
exact fib_lt_fib_succ (self_le_add_left _ _)
[GOAL]
n : ℕ
five_le_n : 5 ≤ n
⊢ n ≤ fib n
[PROOFSTEP]
induction' five_le_n with n five_le_n IH
[GOAL]
case refl
n : ℕ
⊢ 5 ≤ fib 5
[PROOFSTEP]
rfl
[GOAL]
case step
n✝ n : ℕ
five_le_n : Nat.le 5 n
IH : n ≤ fib n
⊢ succ n ≤ fib (succ n)
[PROOFSTEP]
rw [succ_le_iff]
[GOAL]
case step
n✝ n : ℕ
five_le_n : Nat.le 5 n
IH : n ≤ fib n
⊢ n < fib (succ n)
[PROOFSTEP]
calc
  n ≤ fib n := IH
  _ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n)
[GOAL]
n✝ n : ℕ
five_le_n : Nat.le 5 n
IH : n ≤ fib n
⊢ 2 ≤ 5
[PROOFSTEP]
decide
[GOAL]
n : ℕ
⊢ coprime (fib n) (fib (n + 1))
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
⊢ coprime (fib zero) (fib (zero + 1))
[PROOFSTEP]
simp
[GOAL]
case succ
n : ℕ
ih : coprime (fib n) (fib (n + 1))
⊢ coprime (fib (succ n)) (fib (succ n + 1))
[PROOFSTEP]
rw [fib_add_two]
[GOAL]
case succ
n : ℕ
ih : coprime (fib n) (fib (n + 1))
⊢ coprime (fib (succ n)) (fib n + fib (n + 1))
[PROOFSTEP]
simp only [coprime_add_self_right]
[GOAL]
case succ
n : ℕ
ih : coprime (fib n) (fib (n + 1))
⊢ coprime (fib (succ n)) (fib n)
[PROOFSTEP]
simp [coprime, ih.symm]
[GOAL]
m n : ℕ
⊢ fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1)
[PROOFSTEP]
induction' n with n ih generalizing m
[GOAL]
case zero
m✝ m : ℕ
⊢ fib (m + zero + 1) = fib m * fib zero + fib (m + 1) * fib (zero + 1)
[PROOFSTEP]
simp
[GOAL]
case succ
m✝ n : ℕ
ih : ∀ (m : ℕ), fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1)
m : ℕ
⊢ fib (m + succ n + 1) = fib m * fib (succ n) + fib (m + 1) * fib (succ n + 1)
[PROOFSTEP]
intros
[GOAL]
case succ
m✝ n : ℕ
ih : ∀ (m : ℕ), fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1)
m : ℕ
⊢ fib (m + succ n + 1) = fib m * fib (succ n) + fib (m + 1) * fib (succ n + 1)
[PROOFSTEP]
specialize ih (m + 1)
[GOAL]
case succ
m✝ n m : ℕ
ih : fib (m + 1 + n + 1) = fib (m + 1) * fib n + fib (m + 1 + 1) * fib (n + 1)
⊢ fib (m + succ n + 1) = fib m * fib (succ n) + fib (m + 1) * fib (succ n + 1)
[PROOFSTEP]
rw [add_assoc m 1 n, add_comm 1 n] at ih
[GOAL]
case succ
m✝ n m : ℕ
ih : fib (m + (n + 1) + 1) = fib (m + 1) * fib n + fib (m + 1 + 1) * fib (n + 1)
⊢ fib (m + succ n + 1) = fib m * fib (succ n) + fib (m + 1) * fib (succ n + 1)
[PROOFSTEP]
simp only [fib_add_two, ih]
[GOAL]
case succ
m✝ n m : ℕ
ih : fib (m + (n + 1) + 1) = fib (m + 1) * fib n + fib (m + 1 + 1) * fib (n + 1)
⊢ fib (m + 1) * fib n + (fib m + fib (m + 1)) * fib (n + 1) = fib m * fib (succ n) + fib (m + 1) * (fib n + fib (n + 1))
[PROOFSTEP]
ring
[GOAL]
n : ℕ
⊢ fib (2 * n) = fib n * (2 * fib (n + 1) - fib n)
[PROOFSTEP]
cases n
[GOAL]
case zero
⊢ fib (2 * zero) = fib zero * (2 * fib (zero + 1) - fib zero)
[PROOFSTEP]
simp
[GOAL]
case succ
n✝ : ℕ
⊢ fib (2 * succ n✝) = fib (succ n✝) * (2 * fib (succ n✝ + 1) - fib (succ n✝))
[PROOFSTEP]
rw [Nat.succ_eq_add_one, two_mul, ← add_assoc, fib_add, fib_add_two, two_mul]
[GOAL]
case succ
n✝ : ℕ
⊢ fib (n✝ + 1) * fib n✝ + (fib n✝ + fib (n✝ + 1)) * fib (n✝ + 1) =
    fib (n✝ + 1) * (fib n✝ + fib (n✝ + 1) + (fib n✝ + fib (n✝ + 1)) - fib (n✝ + 1))
[PROOFSTEP]
simp only [← add_assoc, add_tsub_cancel_right]
[GOAL]
case succ
n✝ : ℕ
⊢ fib (n✝ + 1) * fib n✝ + (fib n✝ + fib (n✝ + 1)) * fib (n✝ + 1) = fib (n✝ + 1) * (fib n✝ + fib (n✝ + 1) + fib n✝)
[PROOFSTEP]
ring
[GOAL]
n : ℕ
⊢ fib (2 * n + 1) = fib (n + 1) ^ 2 + fib n ^ 2
[PROOFSTEP]
rw [two_mul, fib_add]
[GOAL]
n : ℕ
⊢ fib n * fib n + fib (n + 1) * fib (n + 1) = fib (n + 1) ^ 2 + fib n ^ 2
[PROOFSTEP]
ring
[GOAL]
n : ℕ
⊢ fib (2 * n + 2) = fib (n + 1) * (2 * fib n + fib (n + 1))
[PROOFSTEP]
rw [fib_add_two, fib_two_mul, fib_two_mul_add_one]
  -- porting note: A bunch of issues similar to [this zulip thread](https://github.com/leanprover-community/mathlib4/pull/1576) with `zify`
[GOAL]
n : ℕ
⊢ fib n * (2 * fib (n + 1) - fib n) + (fib (n + 1) ^ 2 + fib n ^ 2) = fib (n + 1) * (2 * fib n + fib (n + 1))
[PROOFSTEP]
have : fib n ≤ 2 * fib (n + 1) := le_trans (fib_le_fib_succ) (mul_comm 2 _ ▸ le_mul_of_pos_right two_pos)
[GOAL]
n : ℕ
this : fib n ≤ 2 * fib (n + 1)
⊢ fib n * (2 * fib (n + 1) - fib n) + (fib (n + 1) ^ 2 + fib n ^ 2) = fib (n + 1) * (2 * fib n + fib (n + 1))
[PROOFSTEP]
zify [this]
[GOAL]
n : ℕ
this : fib n ≤ 2 * fib (n + 1)
⊢ ↑(fib n) * (2 * ↑(fib (n + 1)) - ↑(fib n)) + (↑(fib (n + 1)) ^ 2 + ↑(fib n) ^ 2) =
    ↑(fib (n + 1)) * (2 * ↑(fib n) + ↑(fib (n + 1)))
[PROOFSTEP]
ring
[GOAL]
n : ℕ
⊢ fib (bit0 n) = fib n * (2 * fib (n + 1) - fib n)
[PROOFSTEP]
rw [bit0_eq_two_mul, fib_two_mul]
[GOAL]
n : ℕ
⊢ fib (bit1 n) = fib (n + 1) ^ 2 + fib n ^ 2
[PROOFSTEP]
rw [Nat.bit1_eq_succ_bit0, bit0_eq_two_mul, fib_two_mul_add_one]
[GOAL]
n : ℕ
⊢ fib (bit1 n + 1) = fib (n + 1) * (2 * fib n + fib (n + 1))
[PROOFSTEP]
rw [Nat.bit1_eq_succ_bit0, bit0_eq_two_mul, fib_two_mul_add_two]
[GOAL]
n : ℕ
⊢ fastFibAux (bit false n) =
    let p := fastFibAux n;
    (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2)
[PROOFSTEP]
rw [fastFibAux, binaryRec_eq]
[GOAL]
n : ℕ
⊢ (if false = true then
      ((binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).snd ^
            2 +
          (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).fst ^
            2,
        (binaryRec (fib 0, fib 1)
              (fun b x p =>
                if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
              n).snd *
          (2 *
              (binaryRec (fib 0, fib 1)
                  (fun b x p =>
                    if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                    else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                  n).fst +
            (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).snd))
    else
      ((binaryRec (fib 0, fib 1)
              (fun b x p =>
                if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
              n).fst *
          (2 *
              (binaryRec (fib 0, fib 1)
                  (fun b x p =>
                    if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                    else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                  n).snd -
            (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).fst),
        (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).snd ^
            2 +
          (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).fst ^
            2)) =
    let p :=
      binaryRec (fib 0, fib 1)
        (fun b x p =>
          if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
          else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
        n;
    (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2)
[PROOFSTEP]
rfl
[GOAL]
case h
n : ℕ
⊢ (if false = true then
      ((fib 0, fib 1).snd ^ 2 + (fib 0, fib 1).fst ^ 2,
        (fib 0, fib 1).snd * (2 * (fib 0, fib 1).fst + (fib 0, fib 1).snd))
    else
      ((fib 0, fib 1).fst * (2 * (fib 0, fib 1).snd - (fib 0, fib 1).fst),
        (fib 0, fib 1).snd ^ 2 + (fib 0, fib 1).fst ^ 2)) =
    (fib 0, fib 1)
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ fastFibAux (bit true n) =
    let p := fastFibAux n;
    (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
[PROOFSTEP]
rw [fastFibAux, binaryRec_eq]
[GOAL]
n : ℕ
⊢ (if true = true then
      ((binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).snd ^
            2 +
          (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).fst ^
            2,
        (binaryRec (fib 0, fib 1)
              (fun b x p =>
                if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
              n).snd *
          (2 *
              (binaryRec (fib 0, fib 1)
                  (fun b x p =>
                    if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                    else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                  n).fst +
            (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).snd))
    else
      ((binaryRec (fib 0, fib 1)
              (fun b x p =>
                if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
              n).fst *
          (2 *
              (binaryRec (fib 0, fib 1)
                  (fun b x p =>
                    if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                    else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                  n).snd -
            (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).fst),
        (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).snd ^
            2 +
          (binaryRec (fib 0, fib 1)
                (fun b x p =>
                  if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
                  else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
                n).fst ^
            2)) =
    let p :=
      binaryRec (fib 0, fib 1)
        (fun b x p =>
          if b = true then (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
          else (p.fst * (2 * p.snd - p.fst), p.snd ^ 2 + p.fst ^ 2))
        n;
    (p.snd ^ 2 + p.fst ^ 2, p.snd * (2 * p.fst + p.snd))
[PROOFSTEP]
rfl
[GOAL]
case h
n : ℕ
⊢ (if false = true then
      ((fib 0, fib 1).snd ^ 2 + (fib 0, fib 1).fst ^ 2,
        (fib 0, fib 1).snd * (2 * (fib 0, fib 1).fst + (fib 0, fib 1).snd))
    else
      ((fib 0, fib 1).fst * (2 * (fib 0, fib 1).snd - (fib 0, fib 1).fst),
        (fib 0, fib 1).snd ^ 2 + (fib 0, fib 1).fst ^ 2)) =
    (fib 0, fib 1)
[PROOFSTEP]
simp
[GOAL]
n : ℕ
⊢ fastFibAux n = (fib n, fib (n + 1))
[PROOFSTEP]
apply Nat.binaryRec _ (fun b n' ih => _) n
[GOAL]
n : ℕ
⊢ fastFibAux 0 = (fib 0, fib (0 + 1))
[PROOFSTEP]
simp [fastFibAux]
[GOAL]
n : ℕ
⊢ ∀ (b : Bool) (n' : ℕ),
    fastFibAux n' = (fib n', fib (n' + 1)) → fastFibAux (bit b n') = (fib (bit b n'), fib (bit b n' + 1))
[PROOFSTEP]
intro b
[GOAL]
n : ℕ
b : Bool
⊢ ∀ (n' : ℕ), fastFibAux n' = (fib n', fib (n' + 1)) → fastFibAux (bit b n') = (fib (bit b n'), fib (bit b n' + 1))
[PROOFSTEP]
intro n'
[GOAL]
n : ℕ
b : Bool
n' : ℕ
⊢ fastFibAux n' = (fib n', fib (n' + 1)) → fastFibAux (bit b n') = (fib (bit b n'), fib (bit b n' + 1))
[PROOFSTEP]
intro ih
[GOAL]
n : ℕ
b : Bool
n' : ℕ
ih : fastFibAux n' = (fib n', fib (n' + 1))
⊢ fastFibAux (bit b n') = (fib (bit b n'), fib (bit b n' + 1))
[PROOFSTEP]
cases b
[GOAL]
case false
n n' : ℕ
ih : fastFibAux n' = (fib n', fib (n' + 1))
⊢ fastFibAux (bit false n') = (fib (bit false n'), fib (bit false n' + 1))
[PROOFSTEP]
simp only [fast_fib_aux_bit_ff, fast_fib_aux_bit_tt, congr_arg Prod.fst ih, congr_arg Prod.snd ih, Prod.mk.inj_iff]
[GOAL]
case true
n n' : ℕ
ih : fastFibAux n' = (fib n', fib (n' + 1))
⊢ fastFibAux (bit true n') = (fib (bit true n'), fib (bit true n' + 1))
[PROOFSTEP]
simp only [fast_fib_aux_bit_ff, fast_fib_aux_bit_tt, congr_arg Prod.fst ih, congr_arg Prod.snd ih, Prod.mk.inj_iff]
[GOAL]
case false
n n' : ℕ
ih : fastFibAux n' = (fib n', fib (n' + 1))
⊢ fib n' * (2 * fib (n' + 1) - fib n') = fib (bit false n') ∧ fib (n' + 1) ^ 2 + fib n' ^ 2 = fib (bit false n' + 1)
[PROOFSTEP]
simp [bit, fib_bit0, fib_bit1, fib_bit0_succ, fib_bit1_succ]
[GOAL]
case true
n n' : ℕ
ih : fastFibAux n' = (fib n', fib (n' + 1))
⊢ fib (n' + 1) ^ 2 + fib n' ^ 2 = fib (bit true n') ∧ fib (n' + 1) * (2 * fib n' + fib (n' + 1)) = fib (bit true n' + 1)
[PROOFSTEP]
simp [bit, fib_bit0, fib_bit1, fib_bit0_succ, fib_bit1_succ]
[GOAL]
n : ℕ
⊢ fastFib n = fib n
[PROOFSTEP]
rw [fastFib, fast_fib_aux_eq]
[GOAL]
m n : ℕ
⊢ gcd (fib m) (fib (n + m)) = gcd (fib m) (fib n)
[PROOFSTEP]
cases' Nat.eq_zero_or_pos n with h h
[GOAL]
case inl
m n : ℕ
h : n = 0
⊢ gcd (fib m) (fib (n + m)) = gcd (fib m) (fib n)
[PROOFSTEP]
rw [h]
[GOAL]
case inl
m n : ℕ
h : n = 0
⊢ gcd (fib m) (fib (0 + m)) = gcd (fib m) (fib 0)
[PROOFSTEP]
simp
[GOAL]
case inr
m n : ℕ
h : n > 0
⊢ gcd (fib m) (fib (n + m)) = gcd (fib m) (fib n)
[PROOFSTEP]
replace h := Nat.succ_pred_eq_of_pos h
[GOAL]
case inr
m n : ℕ
h : succ (pred n) = n
⊢ gcd (fib m) (fib (n + m)) = gcd (fib m) (fib n)
[PROOFSTEP]
rw [← h, succ_eq_add_one]
[GOAL]
case inr
m n : ℕ
h : succ (pred n) = n
⊢ gcd (fib m) (fib (pred n + 1 + m)) = gcd (fib m) (fib (pred n + 1))
[PROOFSTEP]
calc
  gcd (fib m) (fib (n.pred + 1 + m)) = gcd (fib m) (fib n.pred * fib m + fib (n.pred + 1) * fib (m + 1)) :=
    by
    rw [← fib_add n.pred _]
    ring_nf
  _ = gcd (fib m) (fib (n.pred + 1) * fib (m + 1)) := by rw [add_comm, gcd_add_mul_right_right (fib m) _ (fib n.pred)]
  _ = gcd (fib m) (fib (n.pred + 1)) :=
    coprime.gcd_mul_right_cancel_right (fib (n.pred + 1)) (coprime.symm (fib_coprime_fib_succ m))
[GOAL]
m n : ℕ
h : succ (pred n) = n
⊢ gcd (fib m) (fib (pred n + 1 + m)) = gcd (fib m) (fib (pred n) * fib m + fib (pred n + 1) * fib (m + 1))
[PROOFSTEP]
rw [← fib_add n.pred _]
[GOAL]
m n : ℕ
h : succ (pred n) = n
⊢ gcd (fib m) (fib (pred n + 1 + m)) = gcd (fib m) (fib (pred n + m + 1))
[PROOFSTEP]
ring_nf
[GOAL]
m n : ℕ
h : succ (pred n) = n
⊢ gcd (fib m) (fib (pred n) * fib m + fib (pred n + 1) * fib (m + 1)) = gcd (fib m) (fib (pred n + 1) * fib (m + 1))
[PROOFSTEP]
rw [add_comm, gcd_add_mul_right_right (fib m) _ (fib n.pred)]
[GOAL]
m n : ℕ
⊢ gcd (fib m) (fib (n + 0 * m)) = gcd (fib m) (fib n)
[PROOFSTEP]
simp
[GOAL]
m n k : ℕ
⊢ gcd (fib m) (fib (n + (k + 1) * m)) = gcd (fib m) (fib n)
[PROOFSTEP]
rw [← gcd_fib_add_mul_self m n k, add_mul, ← add_assoc, one_mul, gcd_fib_add_self _ _]
[GOAL]
m n : ℕ
⊢ fib (gcd m n) = gcd (fib m) (fib n)
[PROOFSTEP]
induction m, n using Nat.gcd.induction with
| H0 => simp
| H1 m n _ h' =>
  rw [← gcd_rec m n] at h'
  conv_rhs => rw [← mod_add_div' n m]
  rwa [gcd_fib_add_mul_self m (n % m) (n / m), gcd_comm (fib m) _]
[GOAL]
m n : ℕ
⊢ fib (gcd m n) = gcd (fib m) (fib n)
[PROOFSTEP]
induction m, n using Nat.gcd.induction with
| H0 => simp
| H1 m n _ h' =>
  rw [← gcd_rec m n] at h'
  conv_rhs => rw [← mod_add_div' n m]
  rwa [gcd_fib_add_mul_self m (n % m) (n / m), gcd_comm (fib m) _]
[GOAL]
case H0
n✝ : ℕ
⊢ fib (gcd 0 n✝) = gcd (fib 0) (fib n✝)
[PROOFSTEP]

| H0 => simp
[GOAL]
case H0
n✝ : ℕ
⊢ fib (gcd 0 n✝) = gcd (fib 0) (fib n✝)
[PROOFSTEP]
simp
[GOAL]
case H1
m n : ℕ
a✝ : 0 < m
h' : fib (gcd (n % m) m) = gcd (fib (n % m)) (fib m)
⊢ fib (gcd m n) = gcd (fib m) (fib n)
[PROOFSTEP]

| H1 m n _ h' =>
  rw [← gcd_rec m n] at h'
  conv_rhs => rw [← mod_add_div' n m]
  rwa [gcd_fib_add_mul_self m (n % m) (n / m), gcd_comm (fib m) _]
[GOAL]
case H1
m n : ℕ
a✝ : 0 < m
h' : fib (gcd (n % m) m) = gcd (fib (n % m)) (fib m)
⊢ fib (gcd m n) = gcd (fib m) (fib n)
[PROOFSTEP]
rw [← gcd_rec m n] at h'
[GOAL]
case H1
m n : ℕ
a✝ : 0 < m
h' : fib (gcd m n) = gcd (fib (n % m)) (fib m)
⊢ fib (gcd m n) = gcd (fib m) (fib n)
[PROOFSTEP]
conv_rhs => rw [← mod_add_div' n m]
[GOAL]
m n : ℕ
a✝ : 0 < m
h' : fib (gcd m n) = gcd (fib (n % m)) (fib m)
| gcd (fib m) (fib n)
[PROOFSTEP]
rw [← mod_add_div' n m]
[GOAL]
m n : ℕ
a✝ : 0 < m
h' : fib (gcd m n) = gcd (fib (n % m)) (fib m)
| gcd (fib m) (fib n)
[PROOFSTEP]
rw [← mod_add_div' n m]
[GOAL]
m n : ℕ
a✝ : 0 < m
h' : fib (gcd m n) = gcd (fib (n % m)) (fib m)
| gcd (fib m) (fib n)
[PROOFSTEP]
rw [← mod_add_div' n m]
[GOAL]
case H1
m n : ℕ
a✝ : 0 < m
h' : fib (gcd m n) = gcd (fib (n % m)) (fib m)
⊢ fib (gcd m n) = gcd (fib m) (fib (n % m + n / m * m))
[PROOFSTEP]
rwa [gcd_fib_add_mul_self m (n % m) (n / m), gcd_comm (fib m) _]
[GOAL]
m n : ℕ
h : m ∣ n
⊢ fib m ∣ fib n
[PROOFSTEP]
rwa [gcd_eq_left_iff_dvd, ← fib_gcd, gcd_eq_left_iff_dvd.mp]
[GOAL]
n : ℕ
h1 : fib (n + 1) = ∑ p in Finset.Nat.antidiagonal n, choose p.fst p.snd
h2 : fib (succ n + 1) = ∑ p in Finset.Nat.antidiagonal (succ n), choose p.fst p.snd
⊢ fib (succ (succ n) + 1) = ∑ p in Finset.Nat.antidiagonal (succ (succ n)), choose p.fst p.snd
[PROOFSTEP]
rw [fib_add_two, h1, h2, Finset.Nat.antidiagonal_succ_succ', Finset.Nat.antidiagonal_succ']
[GOAL]
n : ℕ
h1 : fib (n + 1) = ∑ p in Finset.Nat.antidiagonal n, choose p.fst p.snd
h2 : fib (succ n + 1) = ∑ p in Finset.Nat.antidiagonal (succ n), choose p.fst p.snd
⊢ ∑ p in Finset.Nat.antidiagonal n, choose p.fst p.snd +
      ∑ p in
        Finset.cons (n + 1, 0)
          (Finset.map (Function.Embedding.prodMap (Function.Embedding.refl ℕ) { toFun := succ, inj' := succ_injective })
            (Finset.Nat.antidiagonal n))
          (_ :
            ¬(n + 1, 0) ∈
                Finset.map
                  (Function.Embedding.prodMap (Function.Embedding.refl ℕ) { toFun := succ, inj' := succ_injective })
                  (Finset.Nat.antidiagonal n)),
        choose p.fst p.snd =
    ∑ p in
      Finset.cons (0, n + 2)
        (Finset.cons (n + 2, 0)
          (Finset.map
            (Function.Embedding.prodMap { toFun := succ, inj' := succ_injective }
              { toFun := succ, inj' := succ_injective })
            (Finset.Nat.antidiagonal n))
          (_ :
            ¬(n + 2, 0) ∈
                Finset.map
                  (Function.Embedding.prodMap { toFun := succ, inj' := succ_injective }
                    { toFun := succ, inj' := succ_injective })
                  (Finset.Nat.antidiagonal n)))
        (_ :
          ¬(0, n + 2) ∈
              Finset.cons (n + 2, 0)
                (Finset.map
                  (Function.Embedding.prodMap { toFun := succ, inj' := succ_injective }
                    { toFun := succ, inj' := succ_injective })
                  (Finset.Nat.antidiagonal n))
                (_ :
                  ¬(n + 2, 0) ∈
                      Finset.map
                        (Function.Embedding.prodMap { toFun := succ, inj' := succ_injective }
                          { toFun := succ, inj' := succ_injective })
                        (Finset.Nat.antidiagonal n))),
      choose p.fst p.snd
[PROOFSTEP]
simp [choose_succ_succ, Finset.sum_add_distrib, add_left_comm]
[GOAL]
n : ℕ
⊢ fib (n + 1) = ∑ k in Finset.range n, fib k + 1
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
⊢ fib (zero + 1) = ∑ k in Finset.range zero, fib k + 1
[PROOFSTEP]
simp
[GOAL]
case succ
n : ℕ
ih : fib (n + 1) = ∑ k in Finset.range n, fib k + 1
⊢ fib (succ n + 1) = ∑ k in Finset.range (succ n), fib k + 1
[PROOFSTEP]
calc
  fib (n + 2) = fib n + fib (n + 1) := fib_add_two
  _ = (fib n + ∑ k in Finset.range n, fib k) + 1 := by rw [ih, add_assoc]
  _ = (∑ k in Finset.range (n + 1), fib k) + 1 := by simp [Finset.range_add_one]
[GOAL]
n : ℕ
ih : fib (n + 1) = ∑ k in Finset.range n, fib k + 1
⊢ fib n + fib (n + 1) = fib n + ∑ k in Finset.range n, fib k + 1
[PROOFSTEP]
rw [ih, add_assoc]
[GOAL]
n : ℕ
ih : fib (n + 1) = ∑ k in Finset.range n, fib k + 1
⊢ fib n + ∑ k in Finset.range n, fib k + 1 = ∑ k in Finset.range (n + 1), fib k + 1
[PROOFSTEP]
simp [Finset.range_add_one]


[GOAL]
α : Type u
β : Type v
f fa g : α → α
x✝ y : α
fb : β → β
m n k : ℕ
e : Perm α
x : α
hx : IsFixedPt f x
⊢ IsFixedPt f (f x)
[PROOFSTEP]
convert hx
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n✝ k : ℕ
e : Perm α
s : Set α
h : IsFixedPt (Set.preimage f) s
n : ℕ
⊢ IsFixedPt (Set.preimage f^[n]) s
[PROOFSTEP]
rw [Set.preimage_iterate_eq]
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n✝ k : ℕ
e : Perm α
s : Set α
h : IsFixedPt (Set.preimage f) s
n : ℕ
⊢ IsFixedPt (Set.preimage f)^[n] s
[PROOFSTEP]
exact h.iterate n
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n✝ k : ℕ
e : Perm α
h : IsFixedPt (↑e) x
n : ℕ
⊢ IsFixedPt (↑(e ^ n)) x
[PROOFSTEP]
rw [Equiv.Perm.coe_pow]
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n✝ k : ℕ
e : Perm α
h : IsFixedPt (↑e) x
n : ℕ
⊢ IsFixedPt (↑e)^[n] x
[PROOFSTEP]
exact h.iterate _
[GOAL]
α✝ : Type u
β : Type v
f✝ fa g : α✝ → α✝
x✝ y : α✝
fb : β → β
m n k : ℕ
e : Perm α✝
α : Type u_1
f : α → α
x : α
⊢ x ∈ fixedPoints f ↔ f x = x
[PROOFSTEP]
rfl
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n k : ℕ
e : Perm α
x✝ : α
⊢ x✝ ∈ fixedPoints id ↔ x✝ ∈ Set.univ
[PROOFSTEP]
simpa using isFixedPt_id _
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n k : ℕ
e : Perm α
h : Function.Commute f g
⊢ Set.InvOn f g (fixedPoints (f ∘ g)) (fixedPoints (f ∘ g))
[PROOFSTEP]
simpa only [h.comp_eq] using Function.invOn_fixedPoints_comp f g
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n k : ℕ
e : Perm α
h : Function.Commute f g
⊢ Set.BijOn f (fixedPoints (f ∘ g)) (fixedPoints (f ∘ g))
[PROOFSTEP]
simpa only [h.comp_eq] using bijOn_fixedPoints_comp g f
[GOAL]
α : Type u
β : Type v
f fa g : α → α
x y : α
fb : β → β
m n k : ℕ
e : Perm α
h : Function.Commute f g
⊢ Set.BijOn g (fixedPoints (f ∘ g)) (fixedPoints (f ∘ g))
[PROOFSTEP]
simpa only [h.comp_eq] using bijOn_fixedPoints_comp f g


[GOAL]
A : Type u_1
B : Type u_2
i : SetLike A B
p q : A
⊢ p < q ↔ p ≤ q ∧ ∃ x, x ∈ q ∧ ¬x ∈ p
[PROOFSTEP]
rw [lt_iff_le_not_le, not_le_iff_exists]


[GOAL]
G₁ : Type u_1
G₂ : Type u_2
inst✝¹ : Semigroup G₁
inst✝ : Semigroup G₂
x y : G₁ × G₂
⊢ x ∣ y ↔ x.fst ∣ y.fst ∧ x.snd ∣ y.snd
[PROOFSTEP]
cases x
[GOAL]
case mk
G₁ : Type u_1
G₂ : Type u_2
inst✝¹ : Semigroup G₁
inst✝ : Semigroup G₂
y : G₁ × G₂
fst✝ : G₁
snd✝ : G₂
⊢ (fst✝, snd✝) ∣ y ↔ (fst✝, snd✝).fst ∣ y.fst ∧ (fst✝, snd✝).snd ∣ y.snd
[PROOFSTEP]
cases y
[GOAL]
case mk.mk
G₁ : Type u_1
G₂ : Type u_2
inst✝¹ : Semigroup G₁
inst✝ : Semigroup G₂
fst✝¹ : G₁
snd✝¹ : G₂
fst✝ : G₁
snd✝ : G₂
⊢ (fst✝¹, snd✝¹) ∣ (fst✝, snd✝) ↔ (fst✝¹, snd✝¹).fst ∣ (fst✝, snd✝).fst ∧ (fst✝¹, snd✝¹).snd ∣ (fst✝, snd✝).snd
[PROOFSTEP]
simp only [dvd_def, Prod.exists, Prod.mk_mul_mk, Prod.mk.injEq, exists_and_left, exists_and_right, and_self, true_and]