[GOAL]
a b : ℕ
h : 0 < b
⊢ a + 0 < a + b
[PROOFSTEP]
apply Nat.add_lt_add_left
[GOAL]
case h
a b : ℕ
h : 0 < b
⊢ 0 < b
[PROOFSTEP]
assumption
[GOAL]
a : ℕ
this : 0 < a + 1
⊢ 0 < 1 + a
[PROOFSTEP]
simp [Nat.add_comm]
[GOAL]
a : ℕ
this : 0 < a + 1
⊢ 0 < a + 1
[PROOFSTEP]
assumption


[GOAL]
a : ℕ
ha : a ≤ pred a
⊢ IsMin a
[PROOFSTEP]
cases a
[GOAL]
case zero
ha : zero ≤ pred zero
⊢ IsMin zero
[PROOFSTEP]
exact isMin_bot
[GOAL]
case succ
n✝ : ℕ
ha : succ n✝ ≤ pred (succ n✝)
⊢ IsMin (succ n✝)
[PROOFSTEP]
exact (not_succ_le_self _ ha).elim
[GOAL]
a b : ℕ
h : a < b
⊢ a ≤ pred b
[PROOFSTEP]
cases b
[GOAL]
case zero
a : ℕ
h : a < zero
⊢ a ≤ pred zero
[PROOFSTEP]
exact (a.not_lt_zero h).elim
[GOAL]
case succ
a n✝ : ℕ
h : a < succ n✝
⊢ a ≤ pred (succ n✝)
[PROOFSTEP]
exact le_of_succ_le_succ h
[GOAL]
a b : ℕ
h : pred a < b
⊢ a ≤ b
[PROOFSTEP]
cases a
[GOAL]
case zero
b : ℕ
h : pred zero < b
⊢ zero ≤ b
[PROOFSTEP]
exact b.zero_le
[GOAL]
case succ
b n✝ : ℕ
h : pred (succ n✝) < b
⊢ succ n✝ ≤ b
[PROOFSTEP]
exact h
[GOAL]
a n : ℕ
⊢ succ^[n + 1] a = a + (n + 1)
[PROOFSTEP]
rw [Function.iterate_succ', add_succ]
[GOAL]
a n : ℕ
⊢ (succ ∘ succ^[n]) a = succ (a + n)
[PROOFSTEP]
exact congr_arg _ (succ_iterate a n)
[GOAL]
a n : ℕ
⊢ pred^[n + 1] a = a - (n + 1)
[PROOFSTEP]
rw [Function.iterate_succ', sub_succ]
[GOAL]
a n : ℕ
⊢ (pred ∘ pred^[n]) a = pred (a - n)
[PROOFSTEP]
exact congr_arg _ (pred_iterate a n)
[GOAL]
a b : ℕ
h : a ≤ b
⊢ Order.succ^[b - a] a = b
[PROOFSTEP]
rw [succ_eq_succ, succ_iterate, add_tsub_cancel_of_le h]
[GOAL]
a b : ℕ
h : a ≤ b
⊢ Order.pred^[b - a] b = a
[PROOFSTEP]
rw [pred_eq_pred, pred_iterate, tsub_tsub_cancel_of_le h]


[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝ : NonUnitalNonAssocRing R
a b : R
h : Commute a b
⊢ a * a - b * b = (a + b) * (a - b)
[PROOFSTEP]
rw [add_mul, mul_sub, mul_sub, h.eq, sub_add_sub_cancel]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝ : NonUnitalNonAssocRing R
a b : R
h : Commute a b
⊢ a * a - b * b = (a - b) * (a + b)
[PROOFSTEP]
rw [mul_add, sub_mul, sub_mul, h.eq, sub_add_sub_cancel]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝¹ : NonUnitalNonAssocRing R
inst✝ : NoZeroDivisors R
a b : R
h : Commute a b
⊢ a * a = b * b ↔ a = b ∨ a = -b
[PROOFSTEP]
rw [← sub_eq_zero, h.mul_self_sub_mul_self_eq, mul_eq_zero, or_comm, sub_eq_zero, add_eq_zero_iff_eq_neg]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝ : NonAssocRing R
a : R
⊢ a * a - 1 = (a + 1) * (a - 1)
[PROOFSTEP]
rw [← (Commute.one_right a).mul_self_sub_mul_self_eq, mul_one]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝¹ : NonAssocRing R
inst✝ : NoZeroDivisors R
a : R
⊢ a * a = 1 ↔ a = 1 ∨ a = -1
[PROOFSTEP]
rw [← (Commute.one_right a).mul_self_eq_mul_self_iff, mul_one]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
u : Rˣ
⊢ u⁻¹ = u ↔ u = 1 ∨ u = -1
[PROOFSTEP]
rw [inv_eq_iff_mul_eq_one]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
u : Rˣ
⊢ u * u = 1 ↔ u = 1 ∨ u = -1
[PROOFSTEP]
simp only [ext_iff]
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
u : Rˣ
⊢ ↑(u * u) = ↑1 ↔ ↑u = ↑1 ∨ ↑u = ↑(-1)
[PROOFSTEP]
push_cast
[GOAL]
α : Type u
β : Type v
γ : Type w
R : Type x
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
u : Rˣ
⊢ ↑u * ↑u = 1 ↔ ↑u = 1 ∨ ↑u = -1
[PROOFSTEP]
exact mul_self_eq_one_iff


[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : Fintype p
inst✝¹ : DecidableEq n
inst✝ : AddCommMonoidWithOne R
⊢ trace 1 = ↑(Fintype.card n)
[PROOFSTEP]
simp_rw [trace, diag_one, Pi.one_def, Finset.sum_const, nsmul_one, Finset.card_univ]
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : Fintype p
inst✝¹ : AddCommMonoid R
inst✝ : CommSemigroup R
A : Matrix m n R
B : Matrix n m R
⊢ trace (A * B) = trace (B * A)
[PROOFSTEP]
rw [← trace_transpose, ← trace_transpose_mul, transpose_mul]
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Fintype p
inst✝ : NonUnitalCommSemiring R
A : Matrix m n R
B : Matrix n p R
C : Matrix p m R
⊢ trace (A * B * C) = trace (C * A * B)
[PROOFSTEP]
rw [trace_mul_comm, Matrix.mul_assoc]
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Fintype p
inst✝ : NonUnitalCommSemiring R
A : Matrix m n R
B : Matrix n p R
C : Matrix p m R
⊢ trace (A * (B * C)) = trace (C * (A * B))
[PROOFSTEP]
rw [← Matrix.mul_assoc, trace_mul_comm]
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Fintype p
inst✝ : NonUnitalNonAssocSemiring R
a b : n → R
⊢ trace (col a * row b) = a ⬝ᵥ b
[PROOFSTEP]
apply Finset.sum_congr rfl
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Fintype p
inst✝ : NonUnitalNonAssocSemiring R
a b : n → R
⊢ ∀ (x : n), x ∈ Finset.univ → diag (col a * row b) x = a x * b x
[PROOFSTEP]
simp [mul_apply]
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Fintype p
inst✝ : AddCommMonoid R
A : Matrix (Fin 3) (Fin 3) R
⊢ trace A = A 0 0 + A 1 1 + A 2 2
[PROOFSTEP]
rw [← add_zero (A 2 2), add_assoc]
[GOAL]
ι : Type u_1
m : Type u_2
n : Type u_3
p : Type u_4
α : Type u_5
R : Type u_6
S : Type u_7
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Fintype p
inst✝ : AddCommMonoid R
A : Matrix (Fin 3) (Fin 3) R
⊢ trace A = A 0 0 + (A 1 1 + (A 2 2 + 0))
[PROOFSTEP]
rfl


[GOAL]
n : ℕ
src✝ : Mul (Fin n) := inferInstanceAs (Mul (Fin n))
x✝² x✝¹ x✝ : Fin n
a : ℕ
ha : a < n
b : ℕ
hb : b < n
c : ℕ
hc : c < n
⊢ a * b * c ≡ a * (b * c) [MOD n]
[PROOFSTEP]
rw [mul_assoc]
[GOAL]
n : ℕ
x✝² x✝¹ x✝ : Fin n
a : ℕ
ha : a < n
b : ℕ
hb : b < n
c : ℕ
hc : c < n
⊢ a * (b + c) ≡ a * b + a * c [MOD n]
[PROOFSTEP]
rw [mul_add]
[GOAL]
n : ℕ
src✝¹ : AddCommSemigroup (Fin n) := addCommSemigroup n
src✝ : CommSemigroup (Fin n) := instCommSemigroup n
a b c : Fin n
⊢ (a + b) * c = a * c + b * c
[PROOFSTEP]
rw [mul_comm, left_distrib_aux, mul_comm _ b, mul_comm]
[GOAL]
⊢ Repr (ZMod 0)
[PROOFSTEP]
dsimp [ZMod]
[GOAL]
⊢ Repr ℤ
[PROOFSTEP]
infer_instance
[GOAL]
n : ℕ
⊢ Repr (ZMod (n + 1))
[PROOFSTEP]
dsimp [ZMod]
[GOAL]
n : ℕ
⊢ Repr (Fin (n + 1))
[PROOFSTEP]
infer_instance
[GOAL]
n : ℕ
inst✝ : Fintype (ZMod n)
⊢ Fintype.card (ZMod n) = n
[PROOFSTEP]
cases n with
| zero => exact (not_finite (ZMod 0)).elim
| succ n => convert Fintype.card_fin (n + 1) using 2
[GOAL]
n : ℕ
inst✝ : Fintype (ZMod n)
⊢ Fintype.card (ZMod n) = n
[PROOFSTEP]
cases n with
| zero => exact (not_finite (ZMod 0)).elim
| succ n => convert Fintype.card_fin (n + 1) using 2
[GOAL]
case zero
inst✝ : Fintype (ZMod Nat.zero)
⊢ Fintype.card (ZMod Nat.zero) = Nat.zero
[PROOFSTEP]

| zero => exact (not_finite (ZMod 0)).elim
[GOAL]
case zero
inst✝ : Fintype (ZMod Nat.zero)
⊢ Fintype.card (ZMod Nat.zero) = Nat.zero
[PROOFSTEP]
exact (not_finite (ZMod 0)).elim
[GOAL]
case succ
n : ℕ
inst✝ : Fintype (ZMod (Nat.succ n))
⊢ Fintype.card (ZMod (Nat.succ n)) = Nat.succ n
[PROOFSTEP]

| succ n => convert Fintype.card_fin (n + 1) using 2
[GOAL]
case succ
n : ℕ
inst✝ : Fintype (ZMod (Nat.succ n))
⊢ Fintype.card (ZMod (Nat.succ n)) = Nat.succ n
[PROOFSTEP]
convert Fintype.card_fin (n + 1) using 2


[GOAL]
n : ℕ
⊢ range (succ n) = n ::ₘ range n
[PROOFSTEP]
rw [range, List.range_succ, ← coe_add, add_comm]
[GOAL]
n : ℕ
⊢ ↑[n] + ↑(List.range n) = n ::ₘ range n
[PROOFSTEP]
rfl
[GOAL]
a : ℕ
m : Multiset ℕ
⊢ Disjoint (range a) (map (fun x => a + x) m)
[PROOFSTEP]
intro x hxa hxb
[GOAL]
a : ℕ
m : Multiset ℕ
x : ℕ
hxa : x ∈ range a
hxb : x ∈ map (fun x => a + x) m
⊢ False
[PROOFSTEP]
rw [range, mem_coe, List.mem_range] at hxa
[GOAL]
a : ℕ
m : Multiset ℕ
x : ℕ
hxa : x < a
hxb : x ∈ map (fun x => a + x) m
⊢ False
[PROOFSTEP]
obtain ⟨c, _, rfl⟩ := mem_map.1 hxb
[GOAL]
case intro.intro
a : ℕ
m : Multiset ℕ
c : ℕ
left✝ : c ∈ m
hxa : a + c < a
hxb : a + c ∈ map (fun x => a + x) m
⊢ False
[PROOFSTEP]
exact (self_le_add_right _ _).not_lt hxa
[GOAL]
a b : ℕ
⊢ range (a + b) = range a ∪ map (fun x => a + x) (range b)
[PROOFSTEP]
rw [range_add, add_eq_union_iff_disjoint]
[GOAL]
a b : ℕ
⊢ Disjoint (range a) (map (fun x => a + x) (range b))
[PROOFSTEP]
apply range_disjoint_map_add


[GOAL]
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
f g : α →CO β
h : (fun f => f.toFun) f = (fun f => f.toFun) g
⊢ f = g
[PROOFSTEP]
obtain ⟨⟨_, _⟩, _⟩ := f
[GOAL]
case mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
g : α →CO β
toFun✝ : α → β
continuous_toFun✝ : Continuous toFun✝
map_open'✝ : IsOpenMap (ContinuousMap.mk toFun✝).toFun
h : (fun f => f.toFun) { toContinuousMap := ContinuousMap.mk toFun✝, map_open' := map_open'✝ } = (fun f => f.toFun) g
⊢ { toContinuousMap := ContinuousMap.mk toFun✝, map_open' := map_open'✝ } = g
[PROOFSTEP]
obtain ⟨⟨_, _⟩, _⟩ := g
[GOAL]
case mk.mk.mk.mk
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
toFun✝¹ : α → β
continuous_toFun✝¹ : Continuous toFun✝¹
map_open'✝¹ : IsOpenMap (ContinuousMap.mk toFun✝¹).toFun
toFun✝ : α → β
continuous_toFun✝ : Continuous toFun✝
map_open'✝ : IsOpenMap (ContinuousMap.mk toFun✝).toFun
h :
  (fun f => f.toFun) { toContinuousMap := ContinuousMap.mk toFun✝¹, map_open' := map_open'✝¹ } =
    (fun f => f.toFun) { toContinuousMap := ContinuousMap.mk toFun✝, map_open' := map_open'✝ }
⊢ { toContinuousMap := ContinuousMap.mk toFun✝¹, map_open' := map_open'✝¹ } =
    { toContinuousMap := ContinuousMap.mk toFun✝, map_open' := map_open'✝ }
[PROOFSTEP]
congr
[GOAL]
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
δ : Type u_5
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : TopologicalSpace δ
g : β →CO γ
f₁ f₂ : α →CO β
hg : Injective ↑g
h : comp g f₁ = comp g f₂
a : α
⊢ ↑g (↑f₁ a) = ↑g (↑f₂ a)
[PROOFSTEP]
rw [← comp_apply, h, comp_apply]


[GOAL]
m : ℕ
⊢ ↑(toPNat' (m + 1)) = if 0 < m + 1 then m + 1 else 1
[PROOFSTEP]
rw [if_pos (succ_pos m)]
[GOAL]
m : ℕ
⊢ ↑(toPNat' (m + 1)) = m + 1
[PROOFSTEP]
rfl
[GOAL]
m k : ℕ+
⊢ ↑(mod m k) = if ↑m % ↑k = 0 then ↑k else ↑m % ↑k
[PROOFSTEP]
dsimp [mod, modDiv]
[GOAL]
m k : ℕ+
⊢ ↑(modDivAux k (↑m % ↑k) (↑m / ↑k)).fst = if ↑m % ↑k = 0 then ↑k else ↑m % ↑k
[PROOFSTEP]
cases (m : ℕ) % (k : ℕ) with
| zero =>
  rw [if_pos rfl]
  rfl
| succ n =>
  rw [if_neg n.succ_ne_zero]
  rfl
[GOAL]
m k : ℕ+
x✝ : ℕ
⊢ ↑(modDivAux k x✝ (↑m / ↑k)).fst = if x✝ = 0 then ↑k else x✝
[PROOFSTEP]
cases (m : ℕ) % (k : ℕ) with
| zero =>
  rw [if_pos rfl]
  rfl
| succ n =>
  rw [if_neg n.succ_ne_zero]
  rfl
[GOAL]
case zero
m k : ℕ+
⊢ ↑(modDivAux k zero (↑m / ↑k)).fst = if zero = 0 then ↑k else zero
[PROOFSTEP]

| zero =>
  rw [if_pos rfl]
  rfl
[GOAL]
case zero
m k : ℕ+
⊢ ↑(modDivAux k zero (↑m / ↑k)).fst = if zero = 0 then ↑k else zero
[PROOFSTEP]
rw [if_pos rfl]
[GOAL]
case zero
m k : ℕ+
⊢ ↑(modDivAux k zero (↑m / ↑k)).fst = ↑k
[PROOFSTEP]
rfl
[GOAL]
case succ
m k : ℕ+
n : ℕ
⊢ ↑(modDivAux k (succ n) (↑m / ↑k)).fst = if succ n = 0 then ↑k else succ n
[PROOFSTEP]

| succ n =>
  rw [if_neg n.succ_ne_zero]
  rfl
[GOAL]
case succ
m k : ℕ+
n : ℕ
⊢ ↑(modDivAux k (succ n) (↑m / ↑k)).fst = if succ n = 0 then ↑k else succ n
[PROOFSTEP]
rw [if_neg n.succ_ne_zero]
[GOAL]
case succ
m k : ℕ+
n : ℕ
⊢ ↑(modDivAux k (succ n) (↑m / ↑k)).fst = succ n
[PROOFSTEP]
rfl
[GOAL]
m k : ℕ+
⊢ div m k = if ↑m % ↑k = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]
dsimp [div, modDiv]
[GOAL]
m k : ℕ+
⊢ (modDivAux k (↑m % ↑k) (↑m / ↑k)).snd = if ↑m % ↑k = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]
cases (m : ℕ) % (k : ℕ) with
| zero =>
  rw [if_pos rfl]
  rfl
| succ n =>
  rw [if_neg n.succ_ne_zero]
  rfl
[GOAL]
m k : ℕ+
x✝ : ℕ
⊢ (modDivAux k x✝ (↑m / ↑k)).snd = if x✝ = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]
cases (m : ℕ) % (k : ℕ) with
| zero =>
  rw [if_pos rfl]
  rfl
| succ n =>
  rw [if_neg n.succ_ne_zero]
  rfl
[GOAL]
case zero
m k : ℕ+
⊢ (modDivAux k zero (↑m / ↑k)).snd = if zero = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]

| zero =>
  rw [if_pos rfl]
  rfl
[GOAL]
case zero
m k : ℕ+
⊢ (modDivAux k zero (↑m / ↑k)).snd = if zero = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]
rw [if_pos rfl]
[GOAL]
case zero
m k : ℕ+
⊢ (modDivAux k zero (↑m / ↑k)).snd = pred (↑m / ↑k)
[PROOFSTEP]
rfl
[GOAL]
case succ
m k : ℕ+
n : ℕ
⊢ (modDivAux k (succ n) (↑m / ↑k)).snd = if succ n = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]

| succ n =>
  rw [if_neg n.succ_ne_zero]
  rfl
[GOAL]
case succ
m k : ℕ+
n : ℕ
⊢ (modDivAux k (succ n) (↑m / ↑k)).snd = if succ n = 0 then pred (↑m / ↑k) else ↑m / ↑k
[PROOFSTEP]
rw [if_neg n.succ_ne_zero]
[GOAL]
case succ
m k : ℕ+
n : ℕ
⊢ (modDivAux k (succ n) (↑m / ↑k)).snd = ↑m / ↑k
[PROOFSTEP]
rfl
[GOAL]
n : ℤ
hn : 0 < n
⊢ ↑↑(Nat.toPNat' (natAbs n)) = n
[PROOFSTEP]
rw [Nat.toPNat'_coe, if_pos (Int.natAbs_pos.2 hn.ne'), Int.natAbs_of_nonneg hn.le]


[GOAL]
𝕜✝ : Type u_1
𝕜 : Type u_2
inst✝ : NonUnitalSeminormedRing 𝕜
a✝ b✝ : 𝕜
hx : a✝ ∈ ball 0 1
hy : b✝ ∈ ball 0 1
⊢ a✝ * b✝ ∈ ball 0 1
[PROOFSTEP]
rw [mem_ball_zero_iff] at *
[GOAL]
𝕜✝ : Type u_1
𝕜 : Type u_2
inst✝ : NonUnitalSeminormedRing 𝕜
a✝ b✝ : 𝕜
hx : ‖a✝‖ < 1
hy : ‖b✝‖ < 1
⊢ ‖a✝ * b✝‖ < 1
[PROOFSTEP]
exact (norm_mul_le _ _).trans_lt (mul_lt_one_of_nonneg_of_lt_one_left (norm_nonneg _) hx hy.le)
[GOAL]
𝕜✝ : Type u_1
𝕜 : Type u_2
inst✝ : NonUnitalSeminormedRing 𝕜
a✝ b✝ : 𝕜
hx : a✝ ∈ closedBall 0 1
hy : b✝ ∈ closedBall 0 1
⊢ a✝ * b✝ ∈ closedBall 0 1
[PROOFSTEP]
rw [mem_closedBall_zero_iff] at *
[GOAL]
𝕜✝ : Type u_1
𝕜 : Type u_2
inst✝ : NonUnitalSeminormedRing 𝕜
a✝ b✝ : 𝕜
hx : ‖a✝‖ ≤ 1
hy : ‖b✝‖ ≤ 1
⊢ ‖a✝ * b✝‖ ≤ 1
[PROOFSTEP]
exact (norm_mul_le _ _).trans (mul_le_one hx (norm_nonneg _) hy)
[GOAL]
𝕜✝ : Type u_1
𝕜 : Type u_2
inst✝ : NormedDivisionRing 𝕜
a✝ b✝ : 𝕜
hx : a✝ ∈ sphere 0 1
hy : b✝ ∈ sphere 0 1
⊢ a✝ * b✝ ∈ sphere 0 1
[PROOFSTEP]
rw [mem_sphere_zero_iff_norm] at *
[GOAL]
𝕜✝ : Type u_1
𝕜 : Type u_2
inst✝ : NormedDivisionRing 𝕜
a✝ b✝ : 𝕜
hx : ‖a✝‖ = 1
hy : ‖b✝‖ = 1
⊢ ‖a✝ * b✝‖ = 1
[PROOFSTEP]
simp [*]
[GOAL]
𝕜 : Type u_1
inst✝ : NormedDivisionRing 𝕜
x : ↑(sphere 0 1)
⊢ ‖(↑x)⁻¹‖ = 1
[PROOFSTEP]
rw [norm_inv, mem_sphere_zero_iff_norm.1 x.coe_prop, inv_one]
[GOAL]
𝕜 : Type u_1
inst✝ : NormedDivisionRing 𝕜
x y : ↑(sphere 0 1)
⊢ ‖↑x / ↑y‖ = 1
[PROOFSTEP]
rw [norm_div, mem_sphere_zero_iff_norm.1 x.coe_prop, mem_sphere_zero_iff_norm.1 y.coe_prop, div_one]
[GOAL]
𝕜 : Type u_1
inst✝ : NormedDivisionRing 𝕜
x : ↑(sphere 0 1)
n : ℤ
⊢ ↑x ^ n ∈ sphere 0 1
[PROOFSTEP]
rw [mem_sphere_zero_iff_norm, norm_zpow, mem_sphere_zero_iff_norm.1 x.coe_prop, one_zpow]
[GOAL]
𝕜 : Type u_1
inst✝ : NormedDivisionRing 𝕜
x y : ↑(sphere 0 1)
h : ↑(unitSphereToUnits 𝕜) x = ↑(unitSphereToUnits 𝕜) y
⊢ ↑x = ↑y
[PROOFSTEP]
convert congr_arg Units.val h


[GOAL]
R : Type u_1
A : Type u_2
a✝ b✝ : A
r : R
inst✝³ : OrderedCommRing R
inst✝² : OrderedRing A
inst✝¹ : Algebra R A
inst✝ : OrderedSMul R A
a b : R
h : a ≤ b
⊢ ↑(algebraMap R A) a ≤ ↑(algebraMap R A) b
[PROOFSTEP]
rw [Algebra.algebraMap_eq_smul_one, Algebra.algebraMap_eq_smul_one, ← sub_nonneg, ← sub_smul]
[GOAL]
R : Type u_1
A : Type u_2
a✝ b✝ : A
r : R
inst✝³ : OrderedCommRing R
inst✝² : OrderedRing A
inst✝¹ : Algebra R A
inst✝ : OrderedSMul R A
a b : R
h : a ≤ b
⊢ 0 ≤ (b - a) • 1
[PROOFSTEP]
trans (b - a) • (0 : A)
[GOAL]
R : Type u_1
A : Type u_2
a✝ b✝ : A
r : R
inst✝³ : OrderedCommRing R
inst✝² : OrderedRing A
inst✝¹ : Algebra R A
inst✝ : OrderedSMul R A
a b : R
h : a ≤ b
⊢ 0 ≤ (b - a) • 0
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
A : Type u_2
a✝ b✝ : A
r : R
inst✝³ : OrderedCommRing R
inst✝² : OrderedRing A
inst✝¹ : Algebra R A
inst✝ : OrderedSMul R A
a b : R
h : a ≤ b
⊢ (b - a) • 0 ≤ (b - a) • 1
[PROOFSTEP]
exact smul_le_smul_of_nonneg zero_le_one (sub_nonneg.mpr h)


[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then q else True) = (¬p ∨ q)
[PROOFSTEP]
by_cases p
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then q else True) = (¬p ∨ q)
[PROOFSTEP]
by_cases p
[GOAL]
case pos
p : Prop
h✝ : Decidable p
q : Prop
h : p
⊢ (if p then q else True) = (¬p ∨ q)
[PROOFSTEP]
simp [h]
[GOAL]
case neg
p : Prop
h✝ : Decidable p
q : Prop
h : ¬p
⊢ (if p then q else True) = (¬p ∨ q)
[PROOFSTEP]
simp [h]
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then True else q) = (p ∨ q)
[PROOFSTEP]
by_cases p
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then True else q) = (p ∨ q)
[PROOFSTEP]
by_cases p
[GOAL]
case pos
p : Prop
h✝ : Decidable p
q : Prop
h : p
⊢ (if p then True else q) = (p ∨ q)
[PROOFSTEP]
simp [h]
[GOAL]
case neg
p : Prop
h✝ : Decidable p
q : Prop
h : ¬p
⊢ (if p then True else q) = (p ∨ q)
[PROOFSTEP]
simp [h]
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then q else False) = (p ∧ q)
[PROOFSTEP]
by_cases p
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then q else False) = (p ∧ q)
[PROOFSTEP]
by_cases p
[GOAL]
case pos
p : Prop
h✝ : Decidable p
q : Prop
h : p
⊢ (if p then q else False) = (p ∧ q)
[PROOFSTEP]
simp [h]
[GOAL]
case neg
p : Prop
h✝ : Decidable p
q : Prop
h : ¬p
⊢ (if p then q else False) = (p ∧ q)
[PROOFSTEP]
simp [h]
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then False else q) = (¬p ∧ q)
[PROOFSTEP]
by_cases p
[GOAL]
p : Prop
h : Decidable p
q : Prop
⊢ (if p then False else q) = (¬p ∧ q)
[PROOFSTEP]
by_cases p
[GOAL]
case pos
p : Prop
h✝ : Decidable p
q : Prop
h : p
⊢ (if p then False else q) = (¬p ∧ q)
[PROOFSTEP]
simp [h]
[GOAL]
case neg
p : Prop
h✝ : Decidable p
q : Prop
h : ¬p
⊢ (if p then False else q) = (¬p ∧ q)
[PROOFSTEP]
simp [h]


[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ π' (k + n) ≤ card (filter Prime (range k)) + card (filter Prime (Ico k (k + n)))
[PROOFSTEP]
rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ← Ico_union_Ico_eq_Ico (zero_le k) le_self_add,
  filter_union]
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ card (filter Prime (Ico 0 k) ∪ filter Prime (Ico k (k + n))) ≤
    card (filter Prime (Ico 0 k)) + card (filter Prime (Ico k (k + n)))
[PROOFSTEP]
apply card_union_le
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ card (filter Prime (range k)) + card (filter Prime (Ico k (k + n))) ≤ π' k + card (filter Prime (Ico k (k + n)))
[PROOFSTEP]
rw [primeCounting', count_eq_card_filter_range]
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ π' k + card (filter Prime (Ico k (k + n))) ≤ π' k + card (filter (coprime a) (Ico k (k + n)))
[PROOFSTEP]
refine' add_le_add_left (card_le_of_subset _) k.primeCounting'
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ filter Prime (Ico k (k + n)) ⊆ filter (coprime a) (Ico k (k + n))
[PROOFSTEP]
simp only [subset_iff, and_imp, mem_filter, mem_Ico]
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ ∀ ⦃x : ℕ⦄, k ≤ x → x < k + n → Prime x → (k ≤ x ∧ x < k + n) ∧ coprime a x
[PROOFSTEP]
intro p succ_k_le_p p_lt_n p_prime
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n p : ℕ
succ_k_le_p : k ≤ p
p_lt_n : p < k + n
p_prime : Prime p
⊢ (k ≤ p ∧ p < k + n) ∧ coprime a p
[PROOFSTEP]
constructor
[GOAL]
case left
a k : ℕ
h0 : 0 < a
h1 : a < k
n p : ℕ
succ_k_le_p : k ≤ p
p_lt_n : p < k + n
p_prime : Prime p
⊢ k ≤ p ∧ p < k + n
[PROOFSTEP]
exact ⟨succ_k_le_p, p_lt_n⟩
[GOAL]
case right
a k : ℕ
h0 : 0 < a
h1 : a < k
n p : ℕ
succ_k_le_p : k ≤ p
p_lt_n : p < k + n
p_prime : Prime p
⊢ coprime a p
[PROOFSTEP]
rw [coprime_comm]
[GOAL]
case right
a k : ℕ
h0 : 0 < a
h1 : a < k
n p : ℕ
succ_k_le_p : k ≤ p
p_lt_n : p < k + n
p_prime : Prime p
⊢ coprime p a
[PROOFSTEP]
exact coprime_of_lt_prime h0 (gt_of_ge_of_gt succ_k_le_p h1) p_prime
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ π' k + card (filter (coprime a) (Ico k (k + n))) ≤ π' k + φ a * (n / a + 1)
[PROOFSTEP]
rw [add_le_add_iff_left]
[GOAL]
a k : ℕ
h0 : 0 < a
h1 : a < k
n : ℕ
⊢ card (filter (coprime a) (Ico k (k + n))) ≤ φ a * (n / a + 1)
[PROOFSTEP]
exact Ico_filter_coprime_le k n h0


[GOAL]
k x y : ℕ
h : x ≤ y / k
⊢ x * k ≤ y
[PROOFSTEP]
by_cases hk : k = 0
[GOAL]
case pos
k x y : ℕ
h : x ≤ y / k
hk : k = 0
⊢ x * k ≤ y
case neg k x y : ℕ h : x ≤ y / k hk : ¬k = 0 ⊢ x * k ≤ y
[PROOFSTEP]
case pos => rw [hk, mul_zero]; exact zero_le _
[GOAL]
k x y : ℕ
h : x ≤ y / k
hk : k = 0
⊢ x * k ≤ y
[PROOFSTEP]
case pos => rw [hk, mul_zero]; exact zero_le _
[GOAL]
k x y : ℕ
h : x ≤ y / k
hk : k = 0
⊢ x * k ≤ y
[PROOFSTEP]
rw [hk, mul_zero]
[GOAL]
k x y : ℕ
h : x ≤ y / k
hk : k = 0
⊢ 0 ≤ y
[PROOFSTEP]
exact zero_le _
[GOAL]
case neg
k x y : ℕ
h : x ≤ y / k
hk : ¬k = 0
⊢ x * k ≤ y
[PROOFSTEP]
case neg => rwa [← le_div_iff_mul_le (pos_iff_ne_zero.2 hk)]
[GOAL]
k x y : ℕ
h : x ≤ y / k
hk : ¬k = 0
⊢ x * k ≤ y
[PROOFSTEP]
case neg => rwa [← le_div_iff_mul_le (pos_iff_ne_zero.2 hk)]
[GOAL]
k x y : ℕ
h : x ≤ y / k
hk : ¬k = 0
⊢ x * k ≤ y
[PROOFSTEP]
rwa [← le_div_iff_mul_le (pos_iff_ne_zero.2 hk)]
[GOAL]
a b c d : ℕ
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
by_cases hb : b = 0
[GOAL]
case pos
a b c d : ℕ
hb : b = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
case neg a b c d : ℕ hb : ¬b = 0 ⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
case pos => simp [hb]
[GOAL]
a b c d : ℕ
hb : b = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
case pos => simp [hb]
[GOAL]
a b c d : ℕ
hb : b = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
simp [hb]
[GOAL]
case neg
a b c d : ℕ
hb : ¬b = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
by_cases hd : d = 0
[GOAL]
case pos
a b c d : ℕ
hb : ¬b = 0
hd : d = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
case neg a b c d : ℕ hb : ¬b = 0 hd : ¬d = 0 ⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
case pos => simp [hd]
[GOAL]
a b c d : ℕ
hb : ¬b = 0
hd : d = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
case pos => simp [hd]
[GOAL]
a b c d : ℕ
hb : ¬b = 0
hd : d = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
simp [hd]
[GOAL]
case neg
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
have hbd : b * d ≠ 0 := mul_ne_zero hb hd
[GOAL]
case neg
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ a / b * (c / d) ≤ a * c / (b * d)
[PROOFSTEP]
rw [le_div_iff_mul_le (Nat.pos_of_ne_zero hbd)]
[GOAL]
case neg
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ a / b * (c / d) * (b * d) ≤ a * c
[PROOFSTEP]
transitivity ((a / b) * b) * ((c / d) * d)
[GOAL]
case neg.a
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ a / b * (c / d) * (b * d) ≤ a / b * b * (c / d * d)
[PROOFSTEP]
apply le_of_eq
[GOAL]
case neg.a.a
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ a / b * (c / d) * (b * d) = a / b * b * (c / d * d)
[PROOFSTEP]
simp only [mul_assoc, mul_left_comm]
[GOAL]
case neg.a
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ a / b * b * (c / d * d) ≤ a * c
[PROOFSTEP]
apply Nat.mul_le_mul
[GOAL]
case neg.a.h₁
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ a / b * b ≤ a
[PROOFSTEP]
apply div_mul_le_self
[GOAL]
case neg.a.h₂
a b c d : ℕ
hb : ¬b = 0
hd : ¬d = 0
hbd : b * d ≠ 0
⊢ c / d * d ≤ c
[PROOFSTEP]
apply div_mul_le_self
[GOAL]
n k : ℕ
⊢ let iter_next := fun n guess => (guess + n / guess) / 2;
  sqrt.iter n k ≤ iter_next n (sqrt.iter n k)
[PROOFSTEP]
intro iter_next
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
⊢ sqrt.iter n k ≤ iter_next n (sqrt.iter n k)
[PROOFSTEP]
unfold sqrt.iter
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
by_cases h : (k + n / k) / 2 < k
[GOAL]
case pos
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : (k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
case neg
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : ¬(k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
case pos => simp [if_pos h]; exact iter_fp_bound _ _
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : (k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
case pos => simp [if_pos h]; exact iter_fp_bound _ _
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : (k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
simp [if_pos h]
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : (k + n / k) / 2 < k
⊢ sqrt.iter n ((k + n / k) / 2) ≤ (sqrt.iter n ((k + n / k) / 2) + n / sqrt.iter n ((k + n / k) / 2)) / 2
[PROOFSTEP]
exact iter_fp_bound _ _
[GOAL]
case neg
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : ¬(k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
case neg => simp [if_neg h]; exact Nat.le_of_not_lt h
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : ¬(k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
case neg => simp [if_neg h]; exact Nat.le_of_not_lt h
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : ¬(k + n / k) / 2 < k
⊢ (let next := (k + n / k) / 2;
    if _h : next < k then sqrt.iter n next else k) ≤
    iter_next n
      (let next := (k + n / k) / 2;
      if _h : next < k then sqrt.iter n next else k)
[PROOFSTEP]
simp [if_neg h]
[GOAL]
n k : ℕ
iter_next : ℕ → ℕ → ℕ := fun n guess => (guess + n / guess) / 2
h : ¬(k + n / k) / 2 < k
⊢ k ≤ (k + n / k) / 2
[PROOFSTEP]
exact Nat.le_of_not_lt h
[GOAL]
x✝ : ℕ
⊢ 4 * 0 * x✝ ≤ (0 + x✝) * (0 + x✝)
[PROOFSTEP]
rw [mul_zero, zero_mul]
[GOAL]
x✝ : ℕ
⊢ 0 ≤ (0 + x✝) * (0 + x✝)
[PROOFSTEP]
exact zero_le _
[GOAL]
x✝ : ℕ
⊢ 4 * x✝ * 0 ≤ (x✝ + 0) * (x✝ + 0)
[PROOFSTEP]
rw [mul_zero]
[GOAL]
x✝ : ℕ
⊢ 0 ≤ (x✝ + 0) * (x✝ + 0)
[PROOFSTEP]
exact zero_le _
[GOAL]
a b : ℕ
⊢ 4 * (a + 1) * (b + 1) ≤ (a + 1 + (b + 1)) * (a + 1 + (b + 1))
[PROOFSTEP]
have ih := add_le_add_right (@AM_GM a b) 4
[GOAL]
a b : ℕ
ih : 4 * a * b + 4 ≤ (a + b) * (a + b) + 4
⊢ 4 * (a + 1) * (b + 1) ≤ (a + 1 + (b + 1)) * (a + 1 + (b + 1))
[PROOFSTEP]
simp only [mul_add, add_mul, show (4 : ℕ) = 1 + 1 + 1 + 1 from rfl, one_mul, mul_one] at ih ⊢
[GOAL]
a b : ℕ
ih : a * b + a * b + a * b + a * b + (1 + 1 + 1 + 1) ≤ a * a + b * a + (a * b + b * b) + (1 + 1 + 1 + 1)
⊢ a * b + a * b + a * b + a * b + (b + b + b + b) + (a + a + a + a + (1 + 1 + 1 + 1)) ≤
    a * a + a + (b * a + a) + (a + 1 + (b + 1)) + (a * b + b + (b * b + b) + (a + 1 + (b + 1)))
[PROOFSTEP]
simp only [add_assoc, add_left_comm, add_le_add_iff_left] at ih ⊢
[GOAL]
a b : ℕ
ih :
  a * b + (a * b + (a * b + (a * b + (1 + (1 + (1 + 1)))))) ≤ a * a + (a * b + (b * a + (b * b + (1 + (1 + (1 + 1))))))
⊢ a * b + (a * b + (a * b + (a * b + (1 + (1 + (1 + 1)))))) ≤ a * a + (a * b + (b * a + (b * b + (1 + (1 + (1 + 1))))))
[PROOFSTEP]
exact ih
[GOAL]
n guess : ℕ
⊢ iter n guess * iter n guess ≤ n
[PROOFSTEP]
unfold sqrt.iter
[GOAL]
n guess : ℕ
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
let next := (guess + n / guess) / 2
[GOAL]
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
by_cases h : next < guess
[GOAL]
case pos
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
case neg
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
case pos => simpa only [dif_pos h] using sqrt.iter_sq_le n next
[GOAL]
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
case pos => simpa only [dif_pos h] using sqrt.iter_sq_le n next
[GOAL]
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
simpa only [dif_pos h] using sqrt.iter_sq_le n next
[GOAL]
case neg
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
case neg =>
  simp only [dif_neg h]
  apply Nat.mul_le_of_le_div
  apply le_of_add_le_add_left (a := guess)
  rw [← mul_two, ← le_div_iff_mul_le]
  · exact le_of_not_lt h
  · exact zero_lt_two
[GOAL]
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
case neg =>
  simp only [dif_neg h]
  apply Nat.mul_le_of_le_div
  apply le_of_add_le_add_left (a := guess)
  rw [← mul_two, ← le_div_iff_mul_le]
  · exact le_of_not_lt h
  · exact zero_lt_two
[GOAL]
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ ((let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) *
      let next := (guess + n / guess) / 2;
      if _h : next < guess then iter n next else guess) ≤
    n
[PROOFSTEP]
simp only [dif_neg h]
[GOAL]
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ guess * guess ≤ n
[PROOFSTEP]
apply Nat.mul_le_of_le_div
[GOAL]
case h
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ guess ≤ n / guess
[PROOFSTEP]
apply le_of_add_le_add_left (a := guess)
[GOAL]
case h
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ guess + guess ≤ guess + n / guess
[PROOFSTEP]
rw [← mul_two, ← le_div_iff_mul_le]
[GOAL]
case h
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ guess ≤ (guess + n / guess) / 2
[PROOFSTEP]
exact le_of_not_lt h
[GOAL]
case h
n guess : ℕ
next : ℕ := (guess + n / guess) / 2
h : ¬next < guess
⊢ 0 < 2
[PROOFSTEP]
exact zero_lt_two
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
⊢ n < (iter n guess + 1) * (iter n guess + 1)
[PROOFSTEP]
unfold sqrt.iter
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
let m := (guess + n / guess) / 2
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
by_cases h : m < guess
[GOAL]
case pos
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
case neg
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : ¬m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
case pos =>
  suffices : n < (m + 1) * (m + 1)
  · simpa only [dif_pos h] using sqrt.lt_iter_succ_sq n m this
  refine lt_of_mul_lt_mul_left ?_ (4 * (guess * guess)).zero_le
  apply lt_of_le_of_lt AM_GM
  rw [show (4 : ℕ) = 2 * 2 from rfl]
  rw [mul_mul_mul_comm 2, mul_mul_mul_comm (2 * guess)]
  refine mul_self_lt_mul_self (?_ : _ < _ * succ (_ / 2))
  rw [← add_div_right _ (by decide), mul_comm 2, mul_assoc,
    show guess + n / guess + 2 = (guess + n / guess + 1) + 1 from rfl]
  have aux_lemma {a : ℕ} : a ≤ 2 * ((a + 1) / 2) := by
    rw [mul_comm]
    exact (add_le_add_iff_right 2).1 $ succ_le_of_lt $ @lt_div_mul_add (a + 1) 2 zero_lt_two
  refine lt_of_lt_of_le ?_ (act_rel_act_of_rel _ aux_lemma)
  rw [add_assoc, mul_add]
  exact add_lt_add_left (lt_mul_div_succ _ (lt_of_le_of_lt (Nat.zero_le m) h)) _
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
case pos =>
  suffices : n < (m + 1) * (m + 1)
  · simpa only [dif_pos h] using sqrt.lt_iter_succ_sq n m this
  refine lt_of_mul_lt_mul_left ?_ (4 * (guess * guess)).zero_le
  apply lt_of_le_of_lt AM_GM
  rw [show (4 : ℕ) = 2 * 2 from rfl]
  rw [mul_mul_mul_comm 2, mul_mul_mul_comm (2 * guess)]
  refine mul_self_lt_mul_self (?_ : _ < _ * succ (_ / 2))
  rw [← add_div_right _ (by decide), mul_comm 2, mul_assoc,
    show guess + n / guess + 2 = (guess + n / guess + 1) + 1 from rfl]
  have aux_lemma {a : ℕ} : a ≤ 2 * ((a + 1) / 2) := by
    rw [mul_comm]
    exact (add_le_add_iff_right 2).1 $ succ_le_of_lt $ @lt_div_mul_add (a + 1) 2 zero_lt_two
  refine lt_of_lt_of_le ?_ (act_rel_act_of_rel _ aux_lemma)
  rw [add_assoc, mul_add]
  exact add_lt_add_left (lt_mul_div_succ _ (lt_of_le_of_lt (Nat.zero_le m) h)) _
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
suffices : n < (m + 1) * (m + 1)
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
this : n < (m + 1) * (m + 1)
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
simpa only [dif_pos h] using sqrt.lt_iter_succ_sq n m this
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ n < (m + 1) * (m + 1)
[PROOFSTEP]
refine lt_of_mul_lt_mul_left ?_ (4 * (guess * guess)).zero_le
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ 4 * (guess * guess) * n < 4 * (guess * guess) * ((m + 1) * (m + 1))
[PROOFSTEP]
apply lt_of_le_of_lt AM_GM
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ (guess * guess + n) * (guess * guess + n) < 4 * (guess * guess) * ((m + 1) * (m + 1))
[PROOFSTEP]
rw [show (4 : ℕ) = 2 * 2 from rfl]
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ (guess * guess + n) * (guess * guess + n) < 2 * 2 * (guess * guess) * ((m + 1) * (m + 1))
[PROOFSTEP]
rw [mul_mul_mul_comm 2, mul_mul_mul_comm (2 * guess)]
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ (guess * guess + n) * (guess * guess + n) < 2 * guess * (m + 1) * (2 * guess * (m + 1))
[PROOFSTEP]
refine mul_self_lt_mul_self (?_ : _ < _ * succ (_ / 2))
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ guess * guess + n < 2 * guess * succ ((guess + n / guess) / 2)
[PROOFSTEP]
rw [← add_div_right _ (by decide), mul_comm 2, mul_assoc,
  show guess + n / guess + 2 = (guess + n / guess + 1) + 1 from rfl]
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ 0 < 2
[PROOFSTEP]
decide
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
⊢ guess * guess + n < guess * (2 * ((guess + n / guess + 1 + 1) / 2))
[PROOFSTEP]
have aux_lemma {a : ℕ} : a ≤ 2 * ((a + 1) / 2) := by
  rw [mul_comm]
  exact (add_le_add_iff_right 2).1 $ succ_le_of_lt $ @lt_div_mul_add (a + 1) 2 zero_lt_two
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
a : ℕ
⊢ a ≤ 2 * ((a + 1) / 2)
[PROOFSTEP]
rw [mul_comm]
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
a : ℕ
⊢ a ≤ (a + 1) / 2 * 2
[PROOFSTEP]
exact (add_le_add_iff_right 2).1 $ succ_le_of_lt $ @lt_div_mul_add (a + 1) 2 zero_lt_two
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
aux_lemma : ∀ {a : ℕ}, a ≤ 2 * ((a + 1) / 2)
⊢ guess * guess + n < guess * (2 * ((guess + n / guess + 1 + 1) / 2))
[PROOFSTEP]
refine lt_of_lt_of_le ?_ (act_rel_act_of_rel _ aux_lemma)
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
aux_lemma : ∀ {a : ℕ}, a ≤ 2 * ((a + 1) / 2)
⊢ guess * guess + n < guess * (guess + n / guess + 1)
[PROOFSTEP]
rw [add_assoc, mul_add]
[GOAL]
case this
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : m < guess
aux_lemma : ∀ {a : ℕ}, a ≤ 2 * ((a + 1) / 2)
⊢ guess * guess + n < guess * guess + guess * (n / guess + 1)
[PROOFSTEP]
exact add_lt_add_left (lt_mul_div_succ _ (lt_of_le_of_lt (Nat.zero_le m) h)) _
[GOAL]
case neg
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : ¬m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
case neg => simpa only [dif_neg h] using hn
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : ¬m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
case neg => simpa only [dif_neg h] using hn
[GOAL]
n guess : ℕ
hn : n < (guess + 1) * (guess + 1)
m : ℕ := (guess + n / guess) / 2
h : ¬m < guess
⊢ n <
    ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1) *
      ((let next := (guess + n / guess) / 2;
        if _h : next < guess then iter n next else guess) +
        1)
[PROOFSTEP]
simpa only [dif_neg h] using hn


[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedRing A
inst✝² : NormedAlgebra 𝕜 A
inst✝¹ : CompleteSpace A
inst✝ : ProperSpace 𝕜
⊢ CompactSpace ↑(characterSpace 𝕜 A)
[PROOFSTEP]
rw [← isCompact_iff_compactSpace]
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedRing A
inst✝² : NormedAlgebra 𝕜 A
inst✝¹ : CompleteSpace A
inst✝ : ProperSpace 𝕜
⊢ IsCompact (characterSpace 𝕜 A)
[PROOFSTEP]
have h : characterSpace 𝕜 A ⊆ toNormedDual ⁻¹' Metric.closedBall 0 ‖(1 : A)‖ :=
  by
  intro φ hφ
  rw [Set.mem_preimage, mem_closedBall_zero_iff]
  exact (norm_le_norm_one ⟨φ, ⟨hφ.1, hφ.2⟩⟩ : _)
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedRing A
inst✝² : NormedAlgebra 𝕜 A
inst✝¹ : CompleteSpace A
inst✝ : ProperSpace 𝕜
⊢ characterSpace 𝕜 A ⊆ ↑toNormedDual ⁻¹' Metric.closedBall 0 ‖1‖
[PROOFSTEP]
intro φ hφ
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedRing A
inst✝² : NormedAlgebra 𝕜 A
inst✝¹ : CompleteSpace A
inst✝ : ProperSpace 𝕜
φ : WeakDual 𝕜 A
hφ : φ ∈ characterSpace 𝕜 A
⊢ φ ∈ ↑toNormedDual ⁻¹' Metric.closedBall 0 ‖1‖
[PROOFSTEP]
rw [Set.mem_preimage, mem_closedBall_zero_iff]
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedRing A
inst✝² : NormedAlgebra 𝕜 A
inst✝¹ : CompleteSpace A
inst✝ : ProperSpace 𝕜
φ : WeakDual 𝕜 A
hφ : φ ∈ characterSpace 𝕜 A
⊢ ‖↑toNormedDual φ‖ ≤ ‖1‖
[PROOFSTEP]
exact (norm_le_norm_one ⟨φ, ⟨hφ.1, hφ.2⟩⟩ : _)
[GOAL]
𝕜 : Type u_1
A : Type u_2
inst✝⁴ : NontriviallyNormedField 𝕜
inst✝³ : NormedRing A
inst✝² : NormedAlgebra 𝕜 A
inst✝¹ : CompleteSpace A
inst✝ : ProperSpace 𝕜
h : characterSpace 𝕜 A ⊆ ↑toNormedDual ⁻¹' Metric.closedBall 0 ‖1‖
⊢ IsCompact (characterSpace 𝕜 A)
[PROOFSTEP]
exact isCompact_of_isClosed_subset (isCompact_closedBall 𝕜 0 _) CharacterSpace.isClosed h


[GOAL]
n m : ℕ
⊢ dist n m = dist m n
[PROOFSTEP]
simp [dist.def, add_comm]
[GOAL]
n : ℕ
⊢ dist n n = 0
[PROOFSTEP]
simp [dist.def, tsub_self]
[GOAL]
n m : ℕ
h : n = m
⊢ dist n m = 0
[PROOFSTEP]
rw [h, dist_self]
[GOAL]
n m : ℕ
h : n ≤ m
⊢ dist n m = m - n
[PROOFSTEP]
rw [dist.def, tsub_eq_zero_iff_le.mpr h, zero_add]
[GOAL]
n m : ℕ
h : m ≤ n
⊢ dist n m = n - m
[PROOFSTEP]
rw [dist_comm]
[GOAL]
n m : ℕ
h : m ≤ n
⊢ dist m n = n - m
[PROOFSTEP]
apply dist_eq_sub_of_le h
[GOAL]
n m : ℕ
⊢ m ≤ n + dist n m
[PROOFSTEP]
rw [add_comm]
[GOAL]
n m : ℕ
⊢ m ≤ dist n m + n
[PROOFSTEP]
apply dist_tri_left
[GOAL]
n m : ℕ
⊢ n ≤ dist n m + m
[PROOFSTEP]
rw [dist_comm]
[GOAL]
n m : ℕ
⊢ n ≤ dist m n + m
[PROOFSTEP]
apply dist_tri_left
[GOAL]
n m : ℕ
⊢ n ≤ m + dist n m
[PROOFSTEP]
rw [dist_comm]
[GOAL]
n m : ℕ
⊢ n ≤ m + dist m n
[PROOFSTEP]
apply dist_tri_right
[GOAL]
n k m : ℕ
⊢ n + k - (m + k) + (m + k - (n + k)) = n - m + (m + k - (n + k))
[PROOFSTEP]
rw [@add_tsub_add_eq_tsub_right]
[GOAL]
n k m : ℕ
⊢ n - m + (m + k - (n + k)) = n - m + (m - n)
[PROOFSTEP]
rw [@add_tsub_add_eq_tsub_right]
[GOAL]
k n m : ℕ
⊢ dist (k + n) (k + m) = dist n m
[PROOFSTEP]
rw [add_comm k n, add_comm k m]
[GOAL]
k n m : ℕ
⊢ dist (n + k) (m + k) = dist n m
[PROOFSTEP]
apply dist_add_add_right
[GOAL]
n m k l : ℕ
h : n + m = k + l
⊢ dist n k = dist (n + m) (k + m)
[PROOFSTEP]
rw [dist_add_add_right]
[GOAL]
n m k l : ℕ
h : n + m = k + l
⊢ dist (n + m) (k + m) = dist (k + l) (k + m)
[PROOFSTEP]
rw [h]
[GOAL]
n m k l : ℕ
h : n + m = k + l
⊢ dist (k + l) (k + m) = dist l m
[PROOFSTEP]
rw [dist_add_add_left]
[GOAL]
n m k : ℕ
⊢ dist n k ≤ dist n m + dist m k
[PROOFSTEP]
have : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n)) := by
  simp [dist.def, add_comm, add_left_comm, add_assoc]
[GOAL]
n m k : ℕ
⊢ dist n m + dist m k = n - m + (m - k) + (k - m + (m - n))
[PROOFSTEP]
simp [dist.def, add_comm, add_left_comm, add_assoc]
[GOAL]
n m k : ℕ
this : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n))
⊢ dist n k ≤ dist n m + dist m k
[PROOFSTEP]
rw [this, dist.def]
[GOAL]
n m k : ℕ
this : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n))
⊢ n - k + (k - n) ≤ n - m + (m - k) + (k - m + (m - n))
[PROOFSTEP]
exact add_le_add tsub_le_tsub_add_tsub tsub_le_tsub_add_tsub
[GOAL]
n k m : ℕ
⊢ dist (n * k) (m * k) = dist n m * k
[PROOFSTEP]
rw [dist.def, dist.def, right_distrib, tsub_mul n, tsub_mul m]
[GOAL]
k n m : ℕ
⊢ dist (k * n) (k * m) = k * dist n m
[PROOFSTEP]
rw [mul_comm k n, mul_comm k m, dist_mul_right, mul_comm]
[GOAL]
i j : ℕ
⊢ i < j → dist i j = max i j - min i j
[PROOFSTEP]
intro h
[GOAL]
i j : ℕ
h : i < j
⊢ dist i j = max i j - min i j
[PROOFSTEP]
rw [max_eq_right_of_lt h, min_eq_left_of_lt h, dist_eq_sub_of_le (Nat.le_of_lt h)]
[GOAL]
i j : ℕ
⊢ i ≥ j → dist i j = max i j - min i j
[PROOFSTEP]
intro h
[GOAL]
i j : ℕ
h : i ≥ j
⊢ dist i j = max i j - min i j
[PROOFSTEP]
rw [max_eq_left h, min_eq_right h, dist_eq_sub_of_le_right h]
[GOAL]
i j : ℕ
⊢ dist (succ i) (succ j) = dist i j
[PROOFSTEP]
simp [dist.def, succ_sub_succ]
[GOAL]
i j : ℕ
hne : i ≠ j
h : i < j
⊢ 0 < dist i j
[PROOFSTEP]
rw [dist_eq_sub_of_le (le_of_lt h)]
[GOAL]
i j : ℕ
hne : i ≠ j
h : i < j
⊢ 0 < j - i
[PROOFSTEP]
apply tsub_pos_of_lt h
[GOAL]
i j : ℕ
hne : i ≠ j
h : i = j
⊢ 0 < dist i j
[PROOFSTEP]
contradiction
[GOAL]
i j : ℕ
hne : i ≠ j
h : i > j
⊢ 0 < dist i j
[PROOFSTEP]
rw [dist_eq_sub_of_le_right (le_of_lt h)]
[GOAL]
i j : ℕ
hne : i ≠ j
h : i > j
⊢ 0 < i - j
[PROOFSTEP]
apply tsub_pos_of_lt h


[GOAL]
G : Type u_1
H : Type u_2
inst✝¹ : LinearOrderedAddCommGroup G
inst✝ : OrderedAddCommGroup H
f : G → H
h₁ : ∀ (x : G), f (-x) = -f x
h₂ : StrictMonoOn f (Ici 0)
⊢ StrictMono f
[PROOFSTEP]
refine' StrictMonoOn.Iic_union_Ici (fun x hx y hy hxy => neg_lt_neg_iff.1 _) h₂
[GOAL]
G : Type u_1
H : Type u_2
inst✝¹ : LinearOrderedAddCommGroup G
inst✝ : OrderedAddCommGroup H
f : G → H
h₁ : ∀ (x : G), f (-x) = -f x
h₂ : StrictMonoOn f (Ici 0)
x : G
hx : x ∈ Iic 0
y : G
hy : y ∈ Iic 0
hxy : x < y
⊢ -f y < -f x
[PROOFSTEP]
rw [← h₁, ← h₁]
[GOAL]
G : Type u_1
H : Type u_2
inst✝¹ : LinearOrderedAddCommGroup G
inst✝ : OrderedAddCommGroup H
f : G → H
h₁ : ∀ (x : G), f (-x) = -f x
h₂ : StrictMonoOn f (Ici 0)
x : G
hx : x ∈ Iic 0
y : G
hy : y ∈ Iic 0
hxy : x < y
⊢ f (-y) < f (-x)
[PROOFSTEP]
exact h₂ (neg_nonneg.2 hy) (neg_nonneg.2 hx) (neg_lt_neg hxy)
[GOAL]
G : Type u_1
H : Type u_2
inst✝¹ : LinearOrderedAddCommGroup G
inst✝ : OrderedAddCommGroup H
f : G → H
h₁ : ∀ (x : G), f (-x) = -f x
h₂ : MonotoneOn f (Ici 0)
⊢ Monotone f
[PROOFSTEP]
refine' MonotoneOn.Iic_union_Ici (fun x hx y hy hxy => neg_le_neg_iff.1 _) h₂
[GOAL]
G : Type u_1
H : Type u_2
inst✝¹ : LinearOrderedAddCommGroup G
inst✝ : OrderedAddCommGroup H
f : G → H
h₁ : ∀ (x : G), f (-x) = -f x
h₂ : MonotoneOn f (Ici 0)
x : G
hx : x ∈ Iic 0
y : G
hy : y ∈ Iic 0
hxy : x ≤ y
⊢ -f y ≤ -f x
[PROOFSTEP]
rw [← h₁, ← h₁]
[GOAL]
G : Type u_1
H : Type u_2
inst✝¹ : LinearOrderedAddCommGroup G
inst✝ : OrderedAddCommGroup H
f : G → H
h₁ : ∀ (x : G), f (-x) = -f x
h₂ : MonotoneOn f (Ici 0)
x : G
hx : x ∈ Iic 0
y : G
hy : y ∈ Iic 0
hxy : x ≤ y
⊢ f (-y) ≤ f (-x)
[PROOFSTEP]
exact h₂ (neg_nonneg.2 hy) (neg_nonneg.2 hx) (neg_le_neg hxy)


[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
h : IsUpperSet s
x y : α
hxy : x ≤ y
hx : x ∈ closure s
⊢ y ∈ closure ((y / x) • s)
[PROOFSTEP]
rw [closure_smul]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
h : IsUpperSet s
x y : α
hxy : x ≤ y
hx : x ∈ closure s
⊢ y ∈ (y / x) • closure s
[PROOFSTEP]
exact ⟨x, hx, div_mul_cancel' _ _⟩
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
h : IsLowerSet s
x y : α
hxy : y ≤ x
hx : x ∈ closure s
⊢ y ∈ closure ((y / x) • s)
[PROOFSTEP]
rw [closure_smul]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
h : IsLowerSet s
x y : α
hxy : y ≤ x
hx : x ∈ closure s
⊢ y ∈ (y / x) • closure s
[PROOFSTEP]
exact ⟨x, hx, div_mul_cancel' _ _⟩
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
hs : IsOpen s
⊢ IsOpen ↑(upperClosure s)
[PROOFSTEP]
rw [← mul_one s, ← mul_upperClosure]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
hs : IsOpen s
⊢ IsOpen (s * ↑(upperClosure 1))
[PROOFSTEP]
exact hs.mul_right
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
hs : IsOpen s
⊢ IsOpen ↑(lowerClosure s)
[PROOFSTEP]
rw [← mul_one s, ← mul_lowerClosure]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : OrderedCommGroup α
inst✝ : ContinuousConstSMul α α
s : Set α
hs : IsOpen s
⊢ IsOpen (s * ↑(lowerClosure 1))
[PROOFSTEP]
exact hs.mul_right
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : Preorder α
inst✝ : HasUpperLowerClosure α
s : Set α
h : IsUpperSet s
⊢ IsUpperSet (interior s)
[PROOFSTEP]
rw [← isLowerSet_compl, ← closure_compl]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : Preorder α
inst✝ : HasUpperLowerClosure α
s : Set α
h : IsUpperSet s
⊢ IsLowerSet (closure sᶜ)
[PROOFSTEP]
exact h.compl.closure
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : Preorder α
inst✝ : HasUpperLowerClosure α
s : Set α
h : OrdConnected s
⊢ OrdConnected (interior s)
[PROOFSTEP]
rw [← h.upperClosure_inter_lowerClosure, interior_inter]
[GOAL]
α : Type u_1
inst✝² : TopologicalSpace α
inst✝¹ : Preorder α
inst✝ : HasUpperLowerClosure α
s : Set α
h : OrdConnected s
⊢ OrdConnected (interior ↑(upperClosure s) ∩ interior ↑(lowerClosure s))
[PROOFSTEP]
exact (upperClosure s).upper.interior.ordConnected.inter (lowerClosure s).lower.interior.ordConnected


[GOAL]
α : Type u_1
inst✝³ : AddMonoidWithOne α
inst✝² : Preorder α
inst✝¹ : ZeroLEOneClass α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 ≤ 2
[PROOFSTEP]
rw [← one_add_one_eq_two]
[GOAL]
α : Type u_1
inst✝³ : AddMonoidWithOne α
inst✝² : Preorder α
inst✝¹ : ZeroLEOneClass α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 ≤ 1 + 1
[PROOFSTEP]
exact add_nonneg zero_le_one zero_le_one
[GOAL]
α : Type u_1
inst✝³ : AddMonoidWithOne α
inst✝² : Preorder α
inst✝¹ : ZeroLEOneClass α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 ≤ 3
[PROOFSTEP]
rw [← two_add_one_eq_three]
[GOAL]
α : Type u_1
inst✝³ : AddMonoidWithOne α
inst✝² : Preorder α
inst✝¹ : ZeroLEOneClass α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 ≤ 2 + 1
[PROOFSTEP]
exact add_nonneg zero_le_two zero_le_one
[GOAL]
α : Type u_1
inst✝³ : AddMonoidWithOne α
inst✝² : Preorder α
inst✝¹ : ZeroLEOneClass α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 ≤ 4
[PROOFSTEP]
rw [← three_add_one_eq_four]
[GOAL]
α : Type u_1
inst✝³ : AddMonoidWithOne α
inst✝² : Preorder α
inst✝¹ : ZeroLEOneClass α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 ≤ 3 + 1
[PROOFSTEP]
exact add_nonneg zero_le_three zero_le_one
[GOAL]
α : Type u_1
inst✝⁴ : AddMonoidWithOne α
inst✝³ : PartialOrder α
inst✝² : ZeroLEOneClass α
inst✝¹ : NeZero 1
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 < 3
[PROOFSTEP]
rw [← two_add_one_eq_three]
[GOAL]
α : Type u_1
inst✝⁴ : AddMonoidWithOne α
inst✝³ : PartialOrder α
inst✝² : ZeroLEOneClass α
inst✝¹ : NeZero 1
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 < 2 + 1
[PROOFSTEP]
exact lt_add_of_lt_of_nonneg zero_lt_two zero_le_one
[GOAL]
α : Type u_1
inst✝⁴ : AddMonoidWithOne α
inst✝³ : PartialOrder α
inst✝² : ZeroLEOneClass α
inst✝¹ : NeZero 1
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 < 4
[PROOFSTEP]
rw [← three_add_one_eq_four]
[GOAL]
α : Type u_1
inst✝⁴ : AddMonoidWithOne α
inst✝³ : PartialOrder α
inst✝² : ZeroLEOneClass α
inst✝¹ : NeZero 1
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ 0 < 3 + 1
[PROOFSTEP]
exact lt_add_of_lt_of_nonneg zero_lt_three zero_le_one
[GOAL]
α : Type u_1
inst✝⁴ : AddMonoidWithOne α
inst✝³ : PartialOrder α
inst✝² : ZeroLEOneClass α
inst✝¹ : NeZero 1
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x < x_1
⊢ 1 < 2
[PROOFSTEP]
rw [← one_add_one_eq_two]
[GOAL]
α : Type u_1
inst✝⁴ : AddMonoidWithOne α
inst✝³ : PartialOrder α
inst✝² : ZeroLEOneClass α
inst✝¹ : NeZero 1
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x < x_1
⊢ 1 < 1 + 1
[PROOFSTEP]
exact lt_add_one _


[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
one_mul : ∀ (a : G), 1 * a = a
mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
a : G
⊢ a * 1 = a
[PROOFSTEP]
have mul_right_inv : ∀ a, a * a⁻¹ = 1 := fun a =>
  calc
    a * a⁻¹ = 1 * (a * a⁻¹) := (one_mul _).symm
    _ = ((a * a⁻¹)⁻¹ * (a * a⁻¹)) * (a * a⁻¹) := by rw [mul_left_inv]
    _ = (a * a⁻¹)⁻¹ * (a * ((a⁻¹ * a) * a⁻¹)) := by simp only [assoc]
    _ = 1 := by rw [mul_left_inv, one_mul, mul_left_inv]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
one_mul : ∀ (a : G), 1 * a = a
mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
a✝ a : G
⊢ 1 * (a * a⁻¹) = (a * a⁻¹)⁻¹ * (a * a⁻¹) * (a * a⁻¹)
[PROOFSTEP]
rw [mul_left_inv]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
one_mul : ∀ (a : G), 1 * a = a
mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
a✝ a : G
⊢ (a * a⁻¹)⁻¹ * (a * a⁻¹) * (a * a⁻¹) = (a * a⁻¹)⁻¹ * (a * (a⁻¹ * a * a⁻¹))
[PROOFSTEP]
simp only [assoc]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
one_mul : ∀ (a : G), 1 * a = a
mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
a✝ a : G
⊢ (a * a⁻¹)⁻¹ * (a * (a⁻¹ * a * a⁻¹)) = 1
[PROOFSTEP]
rw [mul_left_inv, one_mul, mul_left_inv]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
one_mul : ∀ (a : G), 1 * a = a
mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
a : G
mul_right_inv : ∀ (a : G), a * a⁻¹ = 1
⊢ a * 1 = a
[PROOFSTEP]
rw [← mul_left_inv a, ← assoc, mul_right_inv a, one_mul]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
mul_one : ∀ (a : G), a * 1 = a
mul_right_inv : ∀ (a : G), a * a⁻¹ = 1
a : G
⊢ a⁻¹ * a * 1 = a⁻¹ * a * (a⁻¹ * a * (a⁻¹ * a)⁻¹)
[PROOFSTEP]
rw [mul_right_inv]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
mul_one : ∀ (a : G), a * 1 = a
mul_right_inv : ∀ (a : G), a * a⁻¹ = 1
a : G
⊢ a⁻¹ * a * (a⁻¹ * a * (a⁻¹ * a)⁻¹) = a⁻¹ * (a * a⁻¹) * a * (a⁻¹ * a)⁻¹
[PROOFSTEP]
simp only [assoc]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
mul_one : ∀ (a : G), a * 1 = a
mul_right_inv : ∀ (a : G), a * a⁻¹ = 1
a : G
⊢ a⁻¹ * (a * a⁻¹) * a * (a⁻¹ * a)⁻¹ = 1
[PROOFSTEP]
rw [mul_right_inv, mul_one, mul_right_inv]
[GOAL]
G : Type u
inst✝² : Mul G
inst✝¹ : Inv G
inst✝ : One G
assoc : ∀ (a b c : G), a * b * c = a * (b * c)
mul_one : ∀ (a : G), a * 1 = a
mul_right_inv : ∀ (a : G), a * a⁻¹ = 1
mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
a : G
⊢ 1 * a = a
[PROOFSTEP]
rw [← mul_right_inv a, assoc, mul_left_inv, mul_one]


[GOAL]
⊢ {0} ∪ range succ = univ
[PROOFSTEP]
ext n
[GOAL]
case h
n : ℕ
⊢ n ∈ {0} ∪ range succ ↔ n ∈ univ
[PROOFSTEP]
cases n
[GOAL]
case h.zero
⊢ zero ∈ {0} ∪ range succ ↔ zero ∈ univ
[PROOFSTEP]
simp
[GOAL]
case h.succ
n✝ : ℕ
⊢ succ n✝ ∈ {0} ∪ range succ ↔ succ n✝ ∈ univ
[PROOFSTEP]
simp
[GOAL]
⊢ range succ = {i | 0 < i}
[PROOFSTEP]
ext (_ | i)
[GOAL]
case h.zero
⊢ zero ∈ range succ ↔ zero ∈ {i | 0 < i}
[PROOFSTEP]
simp [succ_pos, succ_ne_zero, Set.mem_setOf]
[GOAL]
case h.succ
i : ℕ
⊢ succ i ∈ range succ ↔ succ i ∈ {i | 0 < i}
[PROOFSTEP]
simp [succ_pos, succ_ne_zero, Set.mem_setOf]
[GOAL]
α : Type u_1
f : ℕ → α
⊢ {f 0} ∪ range (f ∘ succ) = range f
[PROOFSTEP]
rw [← image_singleton, range_comp, ← image_union, zero_union_range_succ, image_univ]
[GOAL]
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
⊢ (range fun n => rec x f n) = {x} ∪ range fun n => rec (f 0 x) (f ∘ succ) n
[PROOFSTEP]
convert (range_of_succ (fun n => Nat.rec x f n : ℕ → α)).symm using 4
[GOAL]
case h.e'_3.h.e'_4.h.e'_3.h
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
x✝ : ℕ
⊢ rec (f 0 x) (f ∘ succ) x✝ = ((fun n => rec x f n) ∘ succ) x✝
[PROOFSTEP]
dsimp
[GOAL]
case h.e'_3.h.e'_4.h.e'_3.h
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
x✝ : ℕ
⊢ rec (f 0 x) (f ∘ succ) x✝ = f x✝ (rec x f x✝)
[PROOFSTEP]
rename_i n
[GOAL]
case h.e'_3.h.e'_4.h.e'_3.h
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
n : ℕ
⊢ rec (f 0 x) (f ∘ succ) n = f n (rec x f n)
[PROOFSTEP]
induction' n with n ihn
[GOAL]
case h.e'_3.h.e'_4.h.e'_3.h.zero
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
⊢ rec (f 0 x) (f ∘ succ) zero = f zero (rec x f zero)
[PROOFSTEP]
rfl
[GOAL]
case h.e'_3.h.e'_4.h.e'_3.h.succ
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
n : ℕ
ihn : rec (f 0 x) (f ∘ succ) n = f n (rec x f n)
⊢ rec (f 0 x) (f ∘ succ) (succ n) = f (succ n) (rec x f (succ n))
[PROOFSTEP]
dsimp at ihn ⊢
[GOAL]
case h.e'_3.h.e'_4.h.e'_3.h.succ
α✝ : Type u_1
α : Type u_2
x : α
f : ℕ → α → α
n : ℕ
ihn : rec (f 0 x) (f ∘ succ) n = f n (rec x f n)
⊢ f (succ n) (rec (f 0 x) (f ∘ succ) n) = f (succ n) (f n (rec x f n))
[PROOFSTEP]
rw [ihn]


[GOAL]
α : Type u_1
inst✝⁴ : Zero α
inst✝³ : TopologicalSpace α
inst✝² : PartialOrder α
inst✝¹ : DecidableRel fun x x_1 => x < x_1
inst✝ : OrderTopology α
a : α
h : 0 < a
⊢ ContinuousAt (↑SignType.sign) a
[PROOFSTEP]
refine' (continuousAt_const : ContinuousAt (fun _ => (1 : SignType)) a).congr _
[GOAL]
α : Type u_1
inst✝⁴ : Zero α
inst✝³ : TopologicalSpace α
inst✝² : PartialOrder α
inst✝¹ : DecidableRel fun x x_1 => x < x_1
inst✝ : OrderTopology α
a : α
h : 0 < a
⊢ (fun x => 1) =ᶠ[nhds a] ↑SignType.sign
[PROOFSTEP]
rw [Filter.EventuallyEq, eventually_nhds_iff]
[GOAL]
α : Type u_1
inst✝⁴ : Zero α
inst✝³ : TopologicalSpace α
inst✝² : PartialOrder α
inst✝¹ : DecidableRel fun x x_1 => x < x_1
inst✝ : OrderTopology α
a : α
h : 0 < a
⊢ ∃ t, (∀ (x : α), x ∈ t → 1 = ↑SignType.sign x) ∧ IsOpen t ∧ a ∈ t
[PROOFSTEP]
exact ⟨{x | 0 < x}, fun x hx => (sign_pos hx).symm, isOpen_lt' 0, h⟩
[GOAL]
α : Type u_1
inst✝⁴ : Zero α
inst✝³ : TopologicalSpace α
inst✝² : PartialOrder α
inst✝¹ : DecidableRel fun x x_1 => x < x_1
inst✝ : OrderTopology α
a : α
h : a < 0
⊢ ContinuousAt (↑SignType.sign) a
[PROOFSTEP]
refine' (continuousAt_const : ContinuousAt (fun x => (-1 : SignType)) a).congr _
[GOAL]
α : Type u_1
inst✝⁴ : Zero α
inst✝³ : TopologicalSpace α
inst✝² : PartialOrder α
inst✝¹ : DecidableRel fun x x_1 => x < x_1
inst✝ : OrderTopology α
a : α
h : a < 0
⊢ (fun x => -1) =ᶠ[nhds a] ↑SignType.sign
[PROOFSTEP]
rw [Filter.EventuallyEq, eventually_nhds_iff]
[GOAL]
α : Type u_1
inst✝⁴ : Zero α
inst✝³ : TopologicalSpace α
inst✝² : PartialOrder α
inst✝¹ : DecidableRel fun x x_1 => x < x_1
inst✝ : OrderTopology α
a : α
h : a < 0
⊢ ∃ t, (∀ (x : α), x ∈ t → -1 = ↑SignType.sign x) ∧ IsOpen t ∧ a ∈ t
[PROOFSTEP]
exact ⟨{x | x < 0}, fun x hx => (sign_neg hx).symm, isOpen_gt' 0, h⟩
[GOAL]
α : Type u_1
inst✝³ : Zero α
inst✝² : TopologicalSpace α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
a : α
h : a ≠ 0
⊢ ContinuousAt (↑SignType.sign) a
[PROOFSTEP]
rcases h.lt_or_lt with (h_neg | h_pos)
[GOAL]
case inl
α : Type u_1
inst✝³ : Zero α
inst✝² : TopologicalSpace α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
a : α
h : a ≠ 0
h_neg : a < 0
⊢ ContinuousAt (↑SignType.sign) a
[PROOFSTEP]
exact continuousAt_sign_of_neg h_neg
[GOAL]
case inr
α : Type u_1
inst✝³ : Zero α
inst✝² : TopologicalSpace α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
a : α
h : a ≠ 0
h_pos : 0 < a
⊢ ContinuousAt (↑SignType.sign) a
[PROOFSTEP]
exact continuousAt_sign_of_pos h_pos


[GOAL]
α : Type u_1
M : Type u_2
inst✝ : AddCommMonoid M
f : α → α
g : α → M
m n : ℕ
x : α
⊢ birkhoffSum f g (m + n) x = birkhoffSum f g m x + birkhoffSum f g n (f^[m] x)
[PROOFSTEP]
simp_rw [birkhoffSum, sum_range_add, add_comm m, iterate_add_apply]
[GOAL]
α : Type u_1
M : Type u_2
inst✝ : AddCommMonoid M
f : α → α
x : α
h : IsFixedPt f x
g : α → M
n : ℕ
⊢ birkhoffSum f g n x = n • g x
[PROOFSTEP]
simp [birkhoffSum, (h.iterate _).eq]
[GOAL]
α : Type u_1
G : Type u_2
inst✝ : AddCommGroup G
f : α → α
g : α → G
n : ℕ
x : α
⊢ birkhoffSum f g n (f x) - birkhoffSum f g n x = g (f^[n] x) - g x
[PROOFSTEP]
rw [← sub_eq_iff_eq_add.2 (birkhoffSum_succ f g n x), ← sub_eq_iff_eq_add.2 (birkhoffSum_succ' f g n x), ← sub_add, ←
  sub_add, sub_add_comm]


[GOAL]
R : Type u
M : Type v
N : Type w
inst✝⁹ : Ring R
inst✝⁸ : TopologicalSpace R
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup N
inst✝⁴ : Module R M
inst✝³ : ContinuousSMul R M
inst✝² : Module R N
inst✝¹ : ContinuousAdd M
inst✝ : IsSimpleModule R N
l : M →ₗ[R] N
⊢ IsClosed ↑(ker l) ∨ Dense ↑(ker l)
[PROOFSTEP]
rcases l.surjective_or_eq_zero with (hl | rfl)
[GOAL]
case inl
R : Type u
M : Type v
N : Type w
inst✝⁹ : Ring R
inst✝⁸ : TopologicalSpace R
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup N
inst✝⁴ : Module R M
inst✝³ : ContinuousSMul R M
inst✝² : Module R N
inst✝¹ : ContinuousAdd M
inst✝ : IsSimpleModule R N
l : M →ₗ[R] N
hl : Function.Surjective ↑l
⊢ IsClosed ↑(ker l) ∨ Dense ↑(ker l)
[PROOFSTEP]
exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl)
[GOAL]
case inr
R : Type u
M : Type v
N : Type w
inst✝⁹ : Ring R
inst✝⁸ : TopologicalSpace R
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup N
inst✝⁴ : Module R M
inst✝³ : ContinuousSMul R M
inst✝² : Module R N
inst✝¹ : ContinuousAdd M
inst✝ : IsSimpleModule R N
⊢ IsClosed ↑(ker 0) ∨ Dense ↑(ker 0)
[PROOFSTEP]
rw [LinearMap.ker_zero]
[GOAL]
case inr
R : Type u
M : Type v
N : Type w
inst✝⁹ : Ring R
inst✝⁸ : TopologicalSpace R
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup N
inst✝⁴ : Module R M
inst✝³ : ContinuousSMul R M
inst✝² : Module R N
inst✝¹ : ContinuousAdd M
inst✝ : IsSimpleModule R N
⊢ IsClosed ↑⊤ ∨ Dense ↑⊤
[PROOFSTEP]
left
[GOAL]
case inr.h
R : Type u
M : Type v
N : Type w
inst✝⁹ : Ring R
inst✝⁸ : TopologicalSpace R
inst✝⁷ : TopologicalSpace M
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup N
inst✝⁴ : Module R M
inst✝³ : ContinuousSMul R M
inst✝² : Module R N
inst✝¹ : ContinuousAdd M
inst✝ : IsSimpleModule R N
⊢ IsClosed ↑⊤
[PROOFSTEP]
exact isClosed_univ


[GOAL]
C : Type u₁
D : Type u₂
E : Type u₃
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Category.{v₂, u₂} D
inst✝ : Category.{v₃, u₃} E
F : C × D ⥤ E
W : C
X Y Z : D
f : X ⟶ Y
g : Y ⟶ Z
⊢ F.map (𝟙 W, f ≫ g) = F.map (𝟙 W, f) ≫ F.map (𝟙 W, g)
[PROOFSTEP]
rw [← Functor.map_comp, prod_comp, Category.comp_id]
[GOAL]
C : Type u₁
D : Type u₂
E : Type u₃
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Category.{v₂, u₂} D
inst✝ : Category.{v₃, u₃} E
F : C × D ⥤ E
X Y Z : C
W : D
f : X ⟶ Y
g : Y ⟶ Z
⊢ F.map (f ≫ g, 𝟙 W) = F.map (f, 𝟙 W) ≫ F.map (g, 𝟙 W)
[PROOFSTEP]
rw [← Functor.map_comp, prod_comp, Category.comp_id]
[GOAL]
C : Type u₁
D : Type u₂
E : Type u₃
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Category.{v₂, u₂} D
inst✝ : Category.{v₃, u₃} E
F : C × D ⥤ E
X X' : C
f : X ⟶ X'
Y Y' : D
g : Y ⟶ Y'
⊢ F.map (𝟙 X, g) ≫ F.map (f, 𝟙 Y') = F.map (f, g)
[PROOFSTEP]
rw [← Functor.map_comp, prod_comp, Category.id_comp, Category.comp_id]
[GOAL]
C : Type u₁
D : Type u₂
E : Type u₃
inst✝² : Category.{v₁, u₁} C
inst✝¹ : Category.{v₂, u₂} D
inst✝ : Category.{v₃, u₃} E
F : C × D ⥤ E
X X' : C
f : X ⟶ X'
Y Y' : D
g : Y ⟶ Y'
⊢ F.map (f, 𝟙 Y) ≫ F.map (𝟙 X', g) = F.map (f, g)
[PROOFSTEP]
rw [← Functor.map_comp, prod_comp, Category.id_comp, Category.comp_id]


[GOAL]
n : Type u
inst✝² : DecidableEq n
inst✝¹ : Fintype n
R : Type v
inst✝ : CommRing R
A : GL n R
⊢ Matrix.det ↑A * Matrix.det ↑A⁻¹ = 1
[PROOFSTEP]
rw [← det_mul, A.mul_inv, det_one]
[GOAL]
n : Type u
inst✝² : DecidableEq n
inst✝¹ : Fintype n
R : Type v
inst✝ : CommRing R
A : GL n R
⊢ Matrix.det ↑A⁻¹ * Matrix.det ↑A = 1
[PROOFSTEP]
rw [← det_mul, A.inv_mul, det_one]
[GOAL]
n : Type u
R : Type v
inst✝³ : DecidableEq n
inst✝² : Fintype n
inst✝¹ : LinearOrderedCommRing R
inst✝ : Fact (Even (Fintype.card n))
g : { x // x ∈ GLPos n R }
⊢ -↑g ∈ GLPos n R
[PROOFSTEP]
rw [mem_glpos, GeneralLinearGroup.det_apply_val, Units.val_neg, det_neg,
  (Fact.out (p := Even <| Fintype.card n)).neg_one_pow, one_mul]
[GOAL]
n : Type u
R : Type v
inst✝³ : DecidableEq n
inst✝² : Fintype n
inst✝¹ : LinearOrderedCommRing R
inst✝ : Fact (Even (Fintype.card n))
g : { x // x ∈ GLPos n R }
⊢ 0 < det ↑↑g
[PROOFSTEP]
exact g.prop
[GOAL]
R : Type ?u.1604470
inst✝ : Field R
a b : R
hab : a ^ 2 + b ^ 2 ≠ 0
⊢ det (↑of ![![a, -b], ![b, a]]) ≠ 0
[PROOFSTEP]
simpa [det_fin_two, sq] using hab


[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
⊢ ∀ (a b : R), a + b = b + a
[PROOFSTEP]
intro a b
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
⊢ a + b = b + a
[PROOFSTEP]
have h₁ : (1 + 1 : R) * (a + b) = a + (a + b) + b :=
  by
  rw [left_distrib]
  simp only [right_distrib, one_mul, add_assoc]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
⊢ (1 + 1) * (a + b) = a + (a + b) + b
[PROOFSTEP]
rw [left_distrib]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
⊢ (1 + 1) * a + (1 + 1) * b = a + (a + b) + b
[PROOFSTEP]
simp only [right_distrib, one_mul, add_assoc]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
h₁ : (1 + 1) * (a + b) = a + (a + b) + b
⊢ a + b = b + a
[PROOFSTEP]
have h₂ : (1 + 1 : R) * (a + b) = a + (b + a) + b :=
  by
  rw [right_distrib]
  simp only [left_distrib, one_mul, add_assoc]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
h₁ : (1 + 1) * (a + b) = a + (a + b) + b
⊢ (1 + 1) * (a + b) = a + (b + a) + b
[PROOFSTEP]
rw [right_distrib]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
h₁ : (1 + 1) * (a + b) = a + (a + b) + b
⊢ 1 * (a + b) + 1 * (a + b) = a + (b + a) + b
[PROOFSTEP]
simp only [left_distrib, one_mul, add_assoc]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
h₁ : (1 + 1) * (a + b) = a + (a + b) + b
h₂ : (1 + 1) * (a + b) = a + (b + a) + b
⊢ a + b = b + a
[PROOFSTEP]
have := h₁.symm.trans h₂
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this✝ : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
a b : R
h₁ : (1 + 1) * (a + b) = a + (a + b) + b
h₂ : (1 + 1) * (a + b) = a + (b + a) + b
this : a + (a + b) + b = a + (b + a) + b
⊢ a + b = b + a
[PROOFSTEP]
rwa [add_left_inj, add_right_inj] at this
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
a : R
⊢ 0 * a = 0
[PROOFSTEP]
have : 0 * a = 0 * a + 0 * a :=
  calc
    0 * a = (0 + 0) * a := by rw [zero_add]
    _ = 0 * a + 0 * a := by rw [right_distrib]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
a : R
⊢ 0 * a = (0 + 0) * a
[PROOFSTEP]
rw [zero_add]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
a : R
⊢ (0 + 0) * a = 0 * a + 0 * a
[PROOFSTEP]
rw [right_distrib]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this✝ : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
a : R
this : 0 * a = 0 * a + 0 * a
⊢ 0 * a = 0
[PROOFSTEP]
rwa [self_eq_add_right] at this
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
zero_mul : ∀ (a : R), 0 * a = 0
a : R
⊢ a * 0 = 0
[PROOFSTEP]
have : a * 0 = a * 0 + a * 0 :=
  calc
    a * 0 = a * (0 + 0) := by rw [zero_add]
    _ = a * 0 + a * 0 := by rw [left_distrib]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
zero_mul : ∀ (a : R), 0 * a = 0
a : R
⊢ a * 0 = a * (0 + 0)
[PROOFSTEP]
rw [zero_add]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
zero_mul : ∀ (a : R), 0 * a = 0
a : R
⊢ a * (0 + 0) = a * 0 + a * 0
[PROOFSTEP]
rw [left_distrib]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
one_mul : ∀ (a : R), 1 * a = a
mul_one : ∀ (a : R), a * 1 = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
right_distrib : ∀ (a b c : R), (a + b) * c = a * c + b * c
this✝ : AddGroup R := AddGroup.ofLeftAxioms add_assoc zero_add add_left_neg
add_comm : ∀ (a b : R), a + b = b + a
zero_mul : ∀ (a : R), 0 * a = 0
a : R
this : a * 0 = a * 0 + a * 0
⊢ a * 0 = 0
[PROOFSTEP]
rwa [self_eq_add_right] at this
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
mul_comm : ∀ (a b : R), a * b = b * a
one_mul : ∀ (a : R), 1 * a = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
a : R
⊢ a * 1 = a
[PROOFSTEP]
rw [mul_comm, one_mul]
[GOAL]
R : Type u
inst✝⁴ : Add R
inst✝³ : Mul R
inst✝² : Neg R
inst✝¹ : Zero R
inst✝ : One R
add_assoc : ∀ (a b c : R), a + b + c = a + (b + c)
zero_add : ∀ (a : R), 0 + a = a
add_left_neg : ∀ (a : R), -a + a = 0
mul_assoc : ∀ (a b c : R), a * b * c = a * (b * c)
mul_comm : ∀ (a b : R), a * b = b * a
one_mul : ∀ (a : R), 1 * a = a
left_distrib : ∀ (a b c : R), a * (b + c) = a * b + a * c
mul_one : ∀ (a : R), a * 1 = a
a b c : R
⊢ (a + b) * c = a * c + b * c
[PROOFSTEP]
rw [mul_comm, left_distrib, mul_comm, mul_comm b c]


[GOAL]
G : Type u_1
H : Type u_2
M : Type u_3
N : Type u_4
α : Type u_5
inst✝⁴ : Group G
inst✝³ : Monoid M
inst✝² : MulAction G M
inst✝¹ : SMulCommClass G M M
inst✝ : IsScalarTower G M M
g : G
m : Mˣ
⊢ g • ↑m * g⁻¹ • ↑m⁻¹ = 1
[PROOFSTEP]
rw [smul_mul_smul, Units.mul_inv, mul_right_inv, one_smul]
[GOAL]
G : Type u_1
H : Type u_2
M : Type u_3
N : Type u_4
α : Type u_5
inst✝⁴ : Group G
inst✝³ : Monoid M
inst✝² : MulAction G M
inst✝¹ : SMulCommClass G M M
inst✝ : IsScalarTower G M M
g : G
m : Mˣ
⊢ g⁻¹ • ↑m⁻¹ * g • ↑m = 1
[PROOFSTEP]
rw [smul_mul_smul, Units.inv_mul, mul_left_inv, one_smul]


[GOAL]
m n : ℤ
⊢ dist m n = ↑|m - n|
[PROOFSTEP]
rw [dist_eq]
[GOAL]
m n : ℤ
⊢ |↑m - ↑n| = ↑|m - n|
[PROOFSTEP]
norm_cast
[GOAL]
⊢ Pairwise fun m n => 1 ≤ dist m n
[PROOFSTEP]
intro m n hne
[GOAL]
m n : ℤ
hne : m ≠ n
⊢ 1 ≤ dist m n
[PROOFSTEP]
rw [dist_eq]
[GOAL]
m n : ℤ
hne : m ≠ n
⊢ 1 ≤ |↑m - ↑n|
[PROOFSTEP]
norm_cast
[GOAL]
m n : ℤ
hne : m ≠ n
⊢ 1 ≤ |m - n|
[PROOFSTEP]
rwa [← zero_add (1 : ℤ), Int.add_one_le_iff, abs_pos, sub_ne_zero]
[GOAL]
x : ℤ
r : ℝ
⊢ ball x r = Ioo ⌊↑x - r⌋ ⌈↑x + r⌉
[PROOFSTEP]
rw [← preimage_ball, Real.ball_eq_Ioo, preimage_Ioo]
[GOAL]
x : ℤ
r : ℝ
⊢ closedBall x r = Icc ⌈↑x - r⌉ ⌊↑x + r⌋
[PROOFSTEP]
rw [← preimage_closedBall, Real.closedBall_eq_Icc, preimage_Icc]
[GOAL]
x : ℤ
r : ℝ
⊢ IsCompact (closedBall x r)
[PROOFSTEP]
rw [closedBall_eq_Icc]
[GOAL]
x : ℤ
r : ℝ
⊢ IsCompact (Icc ⌈↑x - r⌉ ⌊↑x + r⌋)
[PROOFSTEP]
exact (Set.finite_Icc _ _).isCompact
[GOAL]
⊢ cocompact ℤ = atBot ⊔ atTop
[PROOFSTEP]
simp_rw [← comap_dist_right_atTop_eq_cocompact (0 : ℤ), dist_eq', sub_zero, ← comap_abs_atTop, ←
  @Int.comap_cast_atTop ℝ, comap_comap]
[GOAL]
⊢ comap (fun y => ↑|y|) atTop = comap (Int.cast ∘ abs) atTop
[PROOFSTEP]
rfl
[GOAL]
⊢ cofinite = atBot ⊔ atTop
[PROOFSTEP]
rw [← cocompact_eq_cofinite, cocompact_eq]


[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ ↑(choose n r) ≤ ↑(n ^ r) / ↑r !
[PROOFSTEP]
rw [le_div_iff']
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ ↑r ! * ↑(choose n r) ≤ ↑(n ^ r)
[PROOFSTEP]
norm_cast
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ r ! * choose n r ≤ n ^ r
[PROOFSTEP]
rw [← Nat.descFactorial_eq_factorial_mul_choose]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ descFactorial n r ≤ n ^ r
[PROOFSTEP]
exact n.descFactorial_le_pow r
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ 0 < ↑r !
[PROOFSTEP]
exact_mod_cast r.factorial_pos
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ ↑((n + 1 - r) ^ r) / ↑r ! ≤ ↑(choose n r)
[PROOFSTEP]
rw [div_le_iff']
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ ↑((n + 1 - r) ^ r) ≤ ↑r ! * ↑(choose n r)
[PROOFSTEP]
norm_cast
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ (n + 1 - r) ^ r ≤ r ! * choose n r
[PROOFSTEP]
rw [← Nat.descFactorial_eq_factorial_mul_choose]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ (n + 1 - r) ^ r ≤ descFactorial n r
[PROOFSTEP]
exact n.pow_sub_le_descFactorial r
[GOAL]
α : Type u_1
inst✝ : LinearOrderedSemifield α
r n : ℕ
⊢ 0 < ↑r !
[PROOFSTEP]
exact_mod_cast r.factorial_pos


[GOAL]
x y : ℕ
⊢ dist ↑x ↑y = dist x y
[PROOFSTEP]
rw [← Nat.dist_cast_real, ← Rat.dist_cast]
[GOAL]
x y : ℕ
⊢ dist ↑↑x ↑↑y = dist ↑x ↑y
[PROOFSTEP]
congr
[GOAL]
⊢ Pairwise fun x y => 1 ≤ dist ↑x ↑y
[PROOFSTEP]
simpa using Nat.pairwise_one_le_dist
[GOAL]
⊢ Pairwise fun x y => 1 ≤ dist ↑x ↑y
[PROOFSTEP]
simpa using Nat.pairwise_one_le_dist
[GOAL]
x y : ℤ
⊢ dist ↑x ↑y = dist x y
[PROOFSTEP]
rw [← Int.dist_cast_real, ← Rat.dist_cast]
[GOAL]
x y : ℤ
⊢ dist ↑↑x ↑↑y = dist ↑x ↑y
[PROOFSTEP]
congr
[GOAL]
⊢ Pairwise fun x y => 1 ≤ dist ↑x ↑y
[PROOFSTEP]
simpa using Int.pairwise_one_le_dist
[GOAL]
⊢ Pairwise fun x y => 1 ≤ dist ↑x ↑y
[PROOFSTEP]
simpa using Int.pairwise_one_le_dist
[GOAL]
⊢ UniformContinuous (Rat.cast ∘ fun p => p.fst + p.snd)
[PROOFSTEP]
simp only [(· ∘ ·), Rat.cast_add]
[GOAL]
⊢ UniformContinuous fun x => ↑x.fst + ↑x.snd
[PROOFSTEP]
exact Real.uniformContinuous_add.comp (Rat.uniformContinuous_coe_real.prod_map Rat.uniformContinuous_coe_real)
[GOAL]
ε : ℝ
ε0 : ε > 0
a✝ b✝ : ℚ
h : dist a✝ b✝ < ε
⊢ dist (-a✝) (-b✝) < ε
[PROOFSTEP]
rw [dist_comm] at h
[GOAL]
ε : ℝ
ε0 : ε > 0
a✝ b✝ : ℚ
h : dist b✝ a✝ < ε
⊢ dist (-a✝) (-b✝) < ε
[PROOFSTEP]
simpa only [dist_eq, cast_neg, neg_sub_neg] using h
[GOAL]
ε : ℝ
ε0 : ε > 0
a✝ b✝ : ℚ
h : dist a✝ b✝ < ε
⊢ dist |a✝| |b✝| ≤ dist a✝ b✝
[PROOFSTEP]
simpa [Rat.dist_eq] using abs_abs_sub_abs_le_abs_sub _ _
[GOAL]
a b : ℚ
⊢ TotallyBounded (Icc a b)
[PROOFSTEP]
simpa only [preimage_cast_Icc] using
  totallyBounded_preimage Rat.uniformEmbedding_coe_real (totallyBounded_Icc (a : ℝ) b)