-- Mathlib/LinearAlgebra/Span/Defs.lean
theorem submodule_eq_sSup_le_nonzero_spans (p : Submodule R M) :
    p = sSup { T : Submodule R M | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m} }

Proof state:
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ p = sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
apply le_antisymm

Result:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ p ≤ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}} ≤ p

Proof state:
case pos
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
h : m = 0
⊢ m ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
rw [h]

Result:
case pos
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
h : m = 0
⊢ 0 ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Proof state:
case neg
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
h : ¬m = 0
⊢ m ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
exact @le_sSup _ _ S _ ⟨m, ⟨hm, ⟨h, rfl⟩⟩⟩ m (mem_span_singleton_self m)

Result:
no goals

Proof state:
case pos
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
h : m = 0
⊢ 0 ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
simp

Result:
no goals

Proof state:
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
⊢ p = sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
let S := { T : Submodule R M | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m} }

Result:
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ p = sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Proof state:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ p ≤ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
intro m hm

Result:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
⊢ m ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Proof state:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ ∀ b ∈ {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}, b ≤ p

Tactic:
rintro S ⟨_, ⟨_, ⟨_, rfl⟩⟩⟩

Result:
case a.intro.intro.intro
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
w✝ : M
left✝¹ : w✝ ∈ p
left✝ : w✝ ≠ 0
⊢ span R {w✝} ≤ p

Proof state:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
⊢ m ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Tactic:
by_cases h : m = 0

Result:
case pos
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
h : m = 0
⊢ m ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

case neg
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
m : M
hm : m ∈ p
h : ¬m = 0
⊢ m ∈ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}

Proof state:
case a.intro.intro.intro
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
w✝ : M
left✝¹ : w✝ ∈ p
left✝ : w✝ ≠ 0
⊢ span R {w✝} ≤ p

Tactic:
rwa [span_singleton_le_iff_mem]

Result:
no goals

Proof state:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ sSup {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}} ≤ p

Tactic:
rw [sSup_le_iff]

Result:
case a
R : Type u_1
M : Type u_4
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p : Submodule R M
S : Set (Submodule R M) := {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}
⊢ ∀ b ∈ {T | ∃ m ∈ p, m ≠ 0 ∧ T = span R {m}}, b ≤ p