l3lab/ntp-mathlib huggingface dataset:
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact continuous_of_discreteTopology.measurableEmbedding Nat.cast_injective
  · refine'
      ⟨univ, MeasurableSet.univ,
        ⟨(PolishSpace.measurableEquivOfNotCountable hα _ : α ≃ᵐ (univ : Set ℝ))⟩⟩
    

Proof state:
case neg
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : ¬Countable α
⊢ ¬Countable ↑univ

Next tactic:
rw [countable_coe_iff]
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact continuous_of_discreteTopology.measurableEmbedding Nat.cast_injective
  · refine'
      ⟨univ, MeasurableSet.univ,
        ⟨(PolishSpace.measurableEquivOfNotCountable hα _ : α ≃ᵐ (univ : Set ℝ))⟩⟩
    rw [countable_coe_iff]
    

Proof state:
case neg
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : ¬Countable α
⊢ ¬Set.Countable univ

Next tactic:
exact Cardinal.not_countable_real
/-- Any standard Borel space embeds measurably into the reals. -/
theorem exists_measurableEmbedding_real : ∃ f : α → ℝ, MeasurableEmbedding f := by
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
⊢ ∃ f, MeasurableEmbedding f

Next tactic:
obtain ⟨s, hs, ⟨e⟩⟩ := exists_subset_real_measurableEquiv α
/-- Any standard Borel space embeds measurably into the reals. -/
theorem exists_measurableEmbedding_real : ∃ f : α → ℝ, MeasurableEmbedding f := by
  obtain ⟨s, hs, ⟨e⟩⟩ := exists_subset_real_measurableEquiv α
  

Proof state:
case intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
s : Set ℝ
hs : MeasurableSet s
e : α ≃ᵐ ↑s
⊢ ∃ f, MeasurableEmbedding f

Next tactic:
exact ⟨(↑) ∘ e, (MeasurableEmbedding.subtype_coe hs).comp e.measurableEmbedding⟩
/-- Multiplicative commutative semigroup structure on `Fin n`. -/
instance instCommSemigroup (n : ℕ) : CommSemigroup (Fin n) :=
  { inferInstanceAs (Mul (Fin n)) with
    mul_assoc := fun ⟨a, ha⟩ ⟨b, hb⟩ ⟨c, hc⟩ =>
      Fin.eq_of_veq <|
        calc
          a * b % n * c ≡ a * b * c [MOD n] := (Nat.mod_modEq _ _).mul_right _
          _ ≡ a * (b * c) [MOD n] := by 

Proof state:
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]

Next tactic:
rw [mul_assoc]
private theorem left_distrib_aux (n : ℕ) : ∀ a b c : Fin n, a * (b + c) = a * b + a * c :=
  fun ⟨a, ha⟩ ⟨b, hb⟩ ⟨c, hc⟩ =>
  Fin.eq_of_veq <|
    calc
      a * ((b + c) % n) ≡ a * (b + c) [MOD n] := (Nat.mod_modEq _ _).mul_left _
      _ ≡ a * b + a * c [MOD n] := by 

Proof state:
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]

Next tactic:
rw [mul_add]
/-- Commutative ring structure on `Fin n`. -/
instance instDistrib (n : ℕ) : Distrib (Fin n) :=
  { Fin.addCommSemigroup n, Fin.instCommSemigroup n with
    left_distrib := left_distrib_aux n
    right_distrib := fun a b c => by
      

Proof state:
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

Next tactic:
rw [mul_comm, left_distrib_aux, mul_comm _ b, mul_comm]
instance ZMod.repr : ∀ n : ℕ, Repr (ZMod n)
  | 0 => by 

Proof state:
⊢ Repr (ZMod 0)

Next tactic:
dsimp [ZMod]
instance ZMod.repr : ∀ n : ℕ, Repr (ZMod n)
  | 0 => by dsimp [ZMod]; 

Proof state:
⊢ Repr ℤ

Next tactic:
infer_instance
instance ZMod.repr : ∀ n : ℕ, Repr (ZMod n)
  | 0 => by dsimp [ZMod]; infer_instance
  | n + 1 => by 

Proof state:
n : ℕ
⊢ Repr (ZMod (n + 1))

Next tactic:
dsimp [ZMod]
instance ZMod.repr : ∀ n : ℕ, Repr (ZMod n)
  | 0 => by dsimp [ZMod]; infer_instance
  | n + 1 => by dsimp [ZMod]; 

Proof state:
n : ℕ
⊢ Repr (Fin (n + 1))

Next tactic:
infer_instance
@[simp]
theorem card (n : ℕ) [Fintype (ZMod n)] : Fintype.card (ZMod n) = n := by
  

Proof state:
n : ℕ
inst✝ : Fintype (ZMod n)
⊢ Fintype.card (ZMod n) = n

Next tactic:
cases n with
  | zero => exact (not_finite (ZMod 0)).elim
  | succ n => convert Fintype.card_fin (n + 1) using 2
@[simp]
theorem card (n : ℕ) [Fintype (ZMod n)] : Fintype.card (ZMod n) = n := by
  cases n with
  

Proof state:
case zero
inst✝ : Fintype (ZMod Nat.zero)
⊢ Fintype.card (ZMod Nat.zero) = Nat.zero

Next tactic:
| zero => exact (not_finite (ZMod 0)).elim
@[simp]
theorem card (n : ℕ) [Fintype (ZMod n)] : Fintype.card (ZMod n) = n := by
  cases n with
  | zero => 

Proof state:
case zero
inst✝ : Fintype (ZMod Nat.zero)
⊢ Fintype.card (ZMod Nat.zero) = Nat.zero

Next tactic:
exact (not_finite (ZMod 0)).elim
@[simp]
theorem card (n : ℕ) [Fintype (ZMod n)] : Fintype.card (ZMod n) = n := by
  cases n with
  | zero => exact (not_finite (ZMod 0)).elim
  

Proof state:
case succ
n : ℕ
inst✝ : Fintype (ZMod (Nat.succ n))
⊢ Fintype.card (ZMod (Nat.succ n)) = Nat.succ n

Next tactic:
| succ n => convert Fintype.card_fin (n + 1) using 2
@[simp]
theorem card (n : ℕ) [Fintype (ZMod n)] : Fintype.card (ZMod n) = n := by
  cases n with
  | zero => exact (not_finite (ZMod 0)).elim
  | succ n => 

Proof state:
case succ
n : ℕ
inst✝ : Fintype (ZMod (Nat.succ n))
⊢ Fintype.card (ZMod (Nat.succ n)) = Nat.succ n

Next tactic:
convert Fintype.card_fin (n + 1) using 2
/-- If the product of two commuting elements is a unit, then the left multiplier is a unit. -/
@[to_additive "If the sum of two commuting elements is an additive unit, then the left summand is
an additive unit."]
def _root_.Units.leftOfMul (u : Mˣ) (a b : M) (hu : a * b = u) (hc : Commute a b) : Mˣ where
  val := a
  inv := b * ↑u⁻¹
  val_inv := by 

Proof state:
G : Type u_1
M : Type u_2
inst✝ : Monoid M
a✝ b✝ : M
u✝ u₁ u₂ u : Mˣ
a b : M
hu : a * b = ↑u
hc : Commute a b
⊢ a * (b * ↑u⁻¹) = 1

Next tactic:
rw [← mul_assoc, hu, u.mul_inv]
/-- If the product of two commuting elements is a unit, then the left multiplier is a unit. -/
@[to_additive "If the sum of two commuting elements is an additive unit, then the left summand is
an additive unit."]
def _root_.Units.leftOfMul (u : Mˣ) (a b : M) (hu : a * b = u) (hc : Commute a b) : Mˣ where
  val := a
  inv := b * ↑u⁻¹
  val_inv := by rw [← mul_assoc, hu, u.mul_inv]
  inv_val := by
    

Proof state:
G : Type u_1
M : Type u_2
inst✝ : Monoid M
a✝ b✝ : M
u✝ u₁ u₂ u : Mˣ
a b : M
hu : a * b = ↑u
hc : Commute a b
⊢ b * ↑u⁻¹ * a = 1

Next tactic:
have : Commute a u := hu ▸ (Commute.refl _).mul_right hc
/-- If the product of two commuting elements is a unit, then the left multiplier is a unit. -/
@[to_additive "If the sum of two commuting elements is an additive unit, then the left summand is
an additive unit."]
def _root_.Units.leftOfMul (u : Mˣ) (a b : M) (hu : a * b = u) (hc : Commute a b) : Mˣ where
  val := a
  inv := b * ↑u⁻¹
  val_inv := by rw [← mul_assoc, hu, u.mul_inv]
  inv_val := by
    have : Commute a u := hu ▸ (Commute.refl _).mul_right hc
    

Proof state:
G : Type u_1
M : Type u_2
inst✝ : Monoid M
a✝ b✝ : M
u✝ u₁ u₂ u : Mˣ
a b : M
hu : a * b = ↑u
hc : Commute a b
this : Commute a ↑u
⊢ b * ↑u⁻¹ * a = 1

Next tactic:
rw [← this.units_inv_right.right_comm, ← hc.eq, hu, u.mul_inv]
@[to_additive]
protected theorem inv_mul_cancel (h : Commute a b) : a⁻¹ * b * a = b := by
  

Proof state:
G : Type u_1
inst✝ : Group G
a b : G
h : Commute a b
⊢ a⁻¹ * b * a = b

Next tactic:
rw [h.inv_left.eq, inv_mul_cancel_right]
@[to_additive]
theorem inv_mul_cancel_assoc (h : Commute a b) : a⁻¹ * (b * a) = b := by
  

Proof state:
G : Type u_1
inst✝ : Group G
a b : G
h : Commute a b
⊢ a⁻¹ * (b * a) = b

Next tactic:
rw [← mul_assoc, h.inv_mul_cancel]
@[simp]
theorem seq_eq : ∀ {m} (f : Fin m → α → β) (v : Fin m → α), seq f v = fun i => f i (v i)
  | 0, f, v => Subsingleton.elim _ _
  | n + 1, f, v =>
    funext fun i => by
      

Proof state:
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
f : Fin (n + 1) → α → β
v : Fin (n + 1) → α
i : Fin (n + 1)
⊢ seq f v i = f i (v i)

Next tactic:
simp_rw [seq, seq_eq]
@[simp]
theorem seq_eq : ∀ {m} (f : Fin m → α → β) (v : Fin m → α), seq f v = fun i => f i (v i)
  | 0, f, v => Subsingleton.elim _ _
  | n + 1, f, v =>
    funext fun i => by
      simp_rw [seq, seq_eq]
      

Proof state:
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
f : Fin (n + 1) → α → β
v : Fin (n + 1) → α
i : Fin (n + 1)
⊢ Matrix.vecCons (f 0 (v 0)) (fun i => Matrix.vecTail f i (Matrix.vecTail v i)) i = f i (v i)

Next tactic:
refine' i.cases _ fun i => _
@[simp]
theorem seq_eq : ∀ {m} (f : Fin m → α → β) (v : Fin m → α), seq f v = fun i => f i (v i)
  | 0, f, v => Subsingleton.elim _ _
  | n + 1, f, v =>
    funext fun i => by
      simp_rw [seq, seq_eq]
      refine' i.cases _ fun i => _
      · 

Proof state:
case refine'_1
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
f : Fin (n + 1) → α → β
v : Fin (n + 1) → α
i : Fin (n + 1)
⊢ Matrix.vecCons (f 0 (v 0)) (fun i => Matrix.vecTail f i (Matrix.vecTail v i)) 0 = f 0 (v 0)

Next tactic:
rfl
@[simp]
theorem seq_eq : ∀ {m} (f : Fin m → α → β) (v : Fin m → α), seq f v = fun i => f i (v i)
  | 0, f, v => Subsingleton.elim _ _
  | n + 1, f, v =>
    funext fun i => by
      simp_rw [seq, seq_eq]
      refine' i.cases _ fun i => _
      · rfl
      · 

Proof state:
case refine'_2
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
f : Fin (n + 1) → α → β
v : Fin (n + 1) → α
i✝ : Fin (n + 1)
i : Fin n
⊢ Matrix.vecCons (f 0 (v 0)) (fun i => Matrix.vecTail f i (Matrix.vecTail v i)) (Fin.succ i) =
    f (Fin.succ i) (v (Fin.succ i))

Next tactic:
rw [Matrix.cons_val_succ]
@[simp]
theorem seq_eq : ∀ {m} (f : Fin m → α → β) (v : Fin m → α), seq f v = fun i => f i (v i)
  | 0, f, v => Subsingleton.elim _ _
  | n + 1, f, v =>
    funext fun i => by
      simp_rw [seq, seq_eq]
      refine' i.cases _ fun i => _
      · rfl
      · rw [Matrix.cons_val_succ]
        

Proof state:
case refine'_2
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
f : Fin (n + 1) → α → β
v : Fin (n + 1) → α
i✝ : Fin (n + 1)
i : Fin n
⊢ Matrix.vecTail f i (Matrix.vecTail v i) = f (Fin.succ i) (v (Fin.succ i))

Next tactic:
rfl
/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∀ f, P f) ↔ ∀ a₀ a₁, P ![a₀, a₁] :=
  (forall_iff _).symm
```
-/
@[simp]
theorem forall_iff : ∀ {m} (P : (Fin m → α) → Prop), Forall P ↔ ∀ x, P x
  | 0, P => by
    

Proof state:
m n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
P : (Fin 0 → α) → Prop
⊢ Forall P ↔ ∀ (x : Fin 0 → α), P x

Next tactic:
simp only [Forall, Fin.forall_fin_zero_pi]
/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∀ f, P f) ↔ ∀ a₀ a₁, P ![a₀, a₁] :=
  (forall_iff _).symm
```
-/
@[simp]
theorem forall_iff : ∀ {m} (P : (Fin m → α) → Prop), Forall P ↔ ∀ x, P x
  | 0, P => by
    simp only [Forall, Fin.forall_fin_zero_pi]
    

Proof state:
m n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
P : (Fin 0 → α) → Prop
⊢ P ![] ↔ P finZeroElim

Next tactic:
rfl
/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∀ f, P f) ↔ ∀ a₀ a₁, P ![a₀, a₁] :=
  (forall_iff _).symm
```
-/
@[simp]
theorem forall_iff : ∀ {m} (P : (Fin m → α) → Prop), Forall P ↔ ∀ x, P x
  | 0, P => by
    simp only [Forall, Fin.forall_fin_zero_pi]
    rfl
  | .succ n, P => by 

Proof state:
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
P : (Fin (Nat.succ n) → α) → Prop
⊢ Forall P ↔ ∀ (x : Fin (Nat.succ n) → α), P x

Next tactic:
simp only [Forall, forall_iff, Fin.forall_fin_succ_pi, Matrix.vecCons]
/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∃ f, P f) ↔ ∃ a₀ a₁, P ![a₀, a₁] :=
  (exists_iff _).symm
```
-/
theorem exists_iff : ∀ {m} (P : (Fin m → α) → Prop), Exists P ↔ ∃ x, P x
  | 0, P => by
    

Proof state:
m n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
P : (Fin 0 → α) → Prop
⊢ Exists P ↔ ∃ x, P x

Next tactic:
simp only [Exists, Fin.exists_fin_zero_pi, Matrix.vecEmpty]
/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∃ f, P f) ↔ ∃ a₀ a₁, P ![a₀, a₁] :=
  (exists_iff _).symm
```
-/
theorem exists_iff : ∀ {m} (P : (Fin m → α) → Prop), Exists P ↔ ∃ x, P x
  | 0, P => by
    simp only [Exists, Fin.exists_fin_zero_pi, Matrix.vecEmpty]
    

Proof state:
m n : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
P : (Fin 0 → α) → Prop
⊢ P Fin.elim0' ↔ P finZeroElim

Next tactic:
rfl
/-- This can be use to prove
```lean
example (P : (Fin 2 → α) → Prop) : (∃ f, P f) ↔ ∃ a₀ a₁, P ![a₀, a₁] :=
  (exists_iff _).symm
```
-/
theorem exists_iff : ∀ {m} (P : (Fin m → α) → Prop), Exists P ↔ ∃ x, P x
  | 0, P => by
    simp only [Exists, Fin.exists_fin_zero_pi, Matrix.vecEmpty]
    rfl
  | .succ n, P => by 

Proof state:
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
n : ℕ
P : (Fin (Nat.succ n) → α) → Prop
⊢ Exists P ↔ ∃ x, P x

Next tactic:
simp only [Exists, exists_iff, Fin.exists_fin_succ_pi, Matrix.vecCons]
/-- This can be used to prove
```lean
example [AddCommMonoid α] (a : Fin 3 → α) : ∑ i, a i = a 0 + a 1 + a 2 :=
  (sum_eq _).symm
```
-/
@[simp]
theorem sum_eq [AddCommMonoid α] : ∀ {m} (a : Fin m → α), sum a = ∑ i, a i
  | 0, a => rfl
  | 1, a => (Fintype.sum_unique a).symm
  | n + 2, a => by 

Proof state:
m n✝ : ℕ
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
a : Fin (n + 2) → α
⊢ sum a = ∑ i : Fin (n + 2), a i

Next tactic:
rw [Fin.sum_univ_castSucc, sum, sum_eq]
/-- The kernel of a linear map taking values in a simple module over the base ring is closed or
dense. Applies, e.g., to the case when `R = N` is a division ring. -/
theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) :
    IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by
  

Proof state:
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)

Next tactic:
rcases l.surjective_or_eq_zero with (hl | rfl)
/-- The kernel of a linear map taking values in a simple module over the base ring is closed or
dense. Applies, e.g., to the case when `R = N` is a division ring. -/
theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) :
    IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by
  rcases l.surjective_or_eq_zero with (hl | rfl)
  · 

Proof state:
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)

Next tactic:
exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl)
/-- The kernel of a linear map taking values in a simple module over the base ring is closed or
dense. Applies, e.g., to the case when `R = N` is a division ring. -/
theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) :
    IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by
  rcases l.surjective_or_eq_zero with (hl | rfl)
  · exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl)
  · 

Proof state:
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)

Next tactic:
rw [LinearMap.ker_zero]
/-- The kernel of a linear map taking values in a simple module over the base ring is closed or
dense. Applies, e.g., to the case when `R = N` is a division ring. -/
theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) :
    IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by
  rcases l.surjective_or_eq_zero with (hl | rfl)
  · exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl)
  · rw [LinearMap.ker_zero]
    

Proof state:
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 ↑⊤

Next tactic:
left
/-- The kernel of a linear map taking values in a simple module over the base ring is closed or
dense. Applies, e.g., to the case when `R = N` is a division ring. -/
theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) :
    IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by
  rcases l.surjective_or_eq_zero with (hl | rfl)
  · exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl)
  · rw [LinearMap.ker_zero]
    left
    

Proof state:
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 ↑⊤

Next tactic:
exact isClosed_univ
set_option linter.deprecated false in
theorem zpow_bit1₀ (a : G₀) (n : ℤ) : a ^ bit1 n = a ^ n * a ^ n * a := by
  

Proof state:
G₀ : Type u_1
inst✝ : GroupWithZero G₀
a✝ : G₀
m n✝ : ℕ
a : G₀
n : ℤ
⊢ a ^ bit1 n = a ^ n * a ^ n * a

Next tactic:
rw [← zpow_bit0, bit1, zpow_add', zpow_one]
set_option linter.deprecated false in
theorem zpow_bit1₀ (a : G₀) (n : ℤ) : a ^ bit1 n = a ^ n * a ^ n * a := by
  rw [← zpow_bit0, bit1, zpow_add', zpow_one]
  

Proof state:
G₀ : Type u_1
inst✝ : GroupWithZero G₀
a✝ : G₀
m n✝ : ℕ
a : G₀
n : ℤ
⊢ a ≠ 0 ∨ bit0 n + 1 ≠ 0 ∨ bit0 n = 0 ∧ 1 = 0

Next tactic:
right
set_option linter.deprecated false in
theorem zpow_bit1₀ (a : G₀) (n : ℤ) : a ^ bit1 n = a ^ n * a ^ n * a := by
  rw [← zpow_bit0, bit1, zpow_add', zpow_one]
  right; 

Proof state:
case h
G₀ : Type u_1
inst✝ : GroupWithZero G₀
a✝ : G₀
m n✝ : ℕ
a : G₀
n : ℤ
⊢ bit0 n + 1 ≠ 0 ∨ bit0 n = 0 ∧ 1 = 0

Next tactic:
left
set_option linter.deprecated false in
theorem zpow_bit1₀ (a : G₀) (n : ℤ) : a ^ bit1 n = a ^ n * a ^ n * a := by
  rw [← zpow_bit0, bit1, zpow_add', zpow_one]
  right; left
  

Proof state:
case h.h
G₀ : Type u_1
inst✝ : GroupWithZero G₀
a✝ : G₀
m n✝ : ℕ
a : G₀
n : ℤ
⊢ bit0 n + 1 ≠ 0

Next tactic:
apply bit1_ne_zero
set_option linter.deprecated false in
theorem zpow_bit1' (a : G₀) (n : ℤ) : a ^ bit1 n = (a * a) ^ n * a := by
  

Proof state:
G₀ : Type u_1
inst✝ : GroupWithZero G₀
a✝ : G₀
m n✝ : ℕ
a : G₀
n : ℤ
⊢ a ^ bit1 n = (a * a) ^ n * a

Next tactic:
rw [zpow_bit1₀, (Commute.refl a).mul_zpow]
/-- Definition of `IsBigOWith`. We record it in a lemma as `IsBigOWith` is irreducible. -/
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
G : Type u_5
E' : Type u_6
F' : Type u_7
G' : Type u_8
E'' : Type u_9
F'' : Type u_10
G'' : Type u_11
E''' : Type u_12
R : Type u_13
R' : Type u_14
𝕜 : Type u_15
𝕜' : Type u_16
inst✝¹³ : Norm E
inst✝¹² : Norm F
inst✝¹¹ : Norm G
inst✝¹⁰ : SeminormedAddCommGroup E'
inst✝⁹ : SeminormedAddCommGroup F'
inst✝⁸ : SeminormedAddCommGroup G'
inst✝⁷ : NormedAddCommGroup E''
inst✝⁶ : NormedAddCommGroup F''
inst✝⁵ : NormedAddCommGroup G''
inst✝⁴ : SeminormedRing R
inst✝³ : SeminormedAddGroup E'''
inst✝² : SeminormedRing R'
inst✝¹ : NormedField 𝕜
inst✝ : NormedField 𝕜'
c c' c₁ c₂ : ℝ
f : α → E
g : α → F
k : α → G
f' : α → E'
g' : α → F'
k' : α → G'
f'' : α → E''
g'' : α → F''
k'' : α → G''
l l' : Filter α
⊢ IsBigOWith c l f g ↔ ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖

Next tactic:
rw [IsBigOWith_def]
/-- Definition of `IsBigO` in terms of `IsBigOWith`. We record it in a lemma as `IsBigO` is
irreducible. -/
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g := by 

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
G : Type u_5
E' : Type u_6
F' : Type u_7
G' : Type u_8
E'' : Type u_9
F'' : Type u_10
G'' : Type u_11
E''' : Type u_12
R : Type u_13
R' : Type u_14
𝕜 : Type u_15
𝕜' : Type u_16
inst✝¹³ : Norm E
inst✝¹² : Norm F
inst✝¹¹ : Norm G
inst✝¹⁰ : SeminormedAddCommGroup E'
inst✝⁹ : SeminormedAddCommGroup F'
inst✝⁸ : SeminormedAddCommGroup G'
inst✝⁷ : NormedAddCommGroup E''
inst✝⁶ : NormedAddCommGroup F''
inst✝⁵ : NormedAddCommGroup G''
inst✝⁴ : SeminormedRing R
inst✝³ : SeminormedAddGroup E'''
inst✝² : SeminormedRing R'
inst✝¹ : NormedField 𝕜
inst✝ : NormedField 𝕜'
c c' c₁ c₂ : ℝ
f : α → E
g : α → F
k : α → G
f' : α → E'
g' : α → F'
k' : α → G'
f'' : α → E''
g'' : α → F''
k'' : α → G''
l l' : Filter α
⊢ f =O[l] g ↔ ∃ c, IsBigOWith c l f g

Next tactic:
rw [IsBigO_def]
/-- Definition of `IsBigO` in terms of filters. -/
theorem isBigO_iff : f =O[l] g ↔ ∃ c : ℝ, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
G : Type u_5
E' : Type u_6
F' : Type u_7
G' : Type u_8
E'' : Type u_9
F'' : Type u_10
G'' : Type u_11
E''' : Type u_12
R : Type u_13
R' : Type u_14
𝕜 : Type u_15
𝕜' : Type u_16
inst✝¹³ : Norm E
inst✝¹² : Norm F
inst✝¹¹ : Norm G
inst✝¹⁰ : SeminormedAddCommGroup E'
inst✝⁹ : SeminormedAddCommGroup F'
inst✝⁸ : SeminormedAddCommGroup G'
inst✝⁷ : NormedAddCommGroup E''
inst✝⁶ : NormedAddCommGroup F''
inst✝⁵ : NormedAddCommGroup G''
inst✝⁴ : SeminormedRing R
inst✝³ : SeminormedAddGroup E'''
inst✝² : SeminormedRing R'
inst✝¹ : NormedField 𝕜
inst✝ : NormedField 𝕜'
c c' c₁ c₂ : ℝ
f : α → E
g : α → F
k : α → G
f' : α → E'
g' : α → F'
k' : α → G'
f'' : α → E''
g'' : α → F''
k'' : α → G''
l l' : Filter α
⊢ f =O[l] g ↔ ∃ c, ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖

Next tactic:
simp only [IsBigO_def, IsBigOWith_def]