l3lab/ntp-mathlib huggingface dataset:
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
⊢ r ∈ annihilator (span R s) ↔ ∀ (n : ↑s), r • ↑n = 0

Next tactic:
rw [Submodule.mem_annihilator]
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
⊢ (∀ n ∈ span R s, r • n = 0) ↔ ∀ (n : ↑s), r • ↑n = 0

Next tactic:
constructor
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · 

Proof state:
case mp
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
⊢ (∀ n ∈ span R s, r • n = 0) → ∀ (n : ↑s), r • ↑n = 0

Next tactic:
intro h n
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    

Proof state:
case mp
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ n ∈ span R s, r • n = 0
n : ↑s
⊢ r • ↑n = 0

Next tactic:
exact h _ (Submodule.subset_span n.prop)
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · 

Proof state:
case mpr
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
⊢ (∀ (n : ↑s), r • ↑n = 0) → ∀ n ∈ span R s, r • n = 0

Next tactic:
intro h n hn
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    

Proof state:
case mpr
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
⊢ r • n = 0

Next tactic:
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · 

Proof state:
case mpr.refine_1
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
⊢ ∀ x ∈ s, r • x = 0

Next tactic:
intro x hx
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · intro x hx
      

Proof state:
case mpr.refine_1
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
x : M
hx : x ∈ s
⊢ r • x = 0

Next tactic:
exact h ⟨x, hx⟩
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · intro x hx
      exact h ⟨x, hx⟩
    · 

Proof state:
case mpr.refine_2
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
⊢ r • 0 = 0

Next tactic:
exact smul_zero _
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · intro x hx
      exact h ⟨x, hx⟩
    · exact smul_zero _
    · 

Proof state:
case mpr.refine_3
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
⊢ ∀ (x y : M), r • x = 0 → r • y = 0 → r • (x + y) = 0

Next tactic:
intro x y hx hy
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · intro x hx
      exact h ⟨x, hx⟩
    · exact smul_zero _
    · intro x y hx hy
      

Proof state:
case mpr.refine_3
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
x y : M
hx : r • x = 0
hy : r • y = 0
⊢ r • (x + y) = 0

Next tactic:
rw [smul_add, hx, hy, zero_add]
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · intro x hx
      exact h ⟨x, hx⟩
    · exact smul_zero _
    · intro x y hx hy
      rw [smul_add, hx, hy, zero_add]
    · 

Proof state:
case mpr.refine_4
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
⊢ ∀ (a : R) (x : M), r • x = 0 → r • a • x = 0

Next tactic:
intro a x hx
theorem mem_annihilator_span (s : Set M) (r : R) :
    r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by
  rw [Submodule.mem_annihilator]
  constructor
  · intro h n
    exact h _ (Submodule.subset_span n.prop)
  · intro h n hn
    refine Submodule.span_induction hn ?_ ?_ ?_ ?_
    · intro x hx
      exact h ⟨x, hx⟩
    · exact smul_zero _
    · intro x y hx hy
      rw [smul_add, hx, hy, zero_add]
    · intro a x hx
      

Proof state:
case mpr.refine_4
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
s : Set M
r : R
h : ∀ (n : ↑s), r • ↑n = 0
n : M
hn : n ∈ span R s
a : R
x : M
hx : r • x = 0
⊢ r • a • x = 0

Next tactic:
rw [smul_comm, hx, smul_zero]
theorem mem_annihilator_span_singleton (g : M) (r : R) :
    r ∈ (Submodule.span R ({g} : Set M)).annihilator ↔ r • g = 0 := by 

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
g : M
r : R
⊢ r ∈ annihilator (span R {g}) ↔ r • g = 0

Next tactic:
simp [mem_annihilator_span]
@[elab_as_elim]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
    (H1 : ∀ x y, p x → p y → p (x + y)) : p x := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
p : M → Prop
x : M
H : x ∈ I • N
Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n)
H1 : ∀ (x y : M), p x → p y → p (x + y)
⊢ p x

Next tactic:
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
@[elab_as_elim]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
    (H1 : ∀ x y, p x → p y → p (x + y)) : p x := by
  have H0 : p 0 := by 

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
p : M → Prop
x : M
H : x ∈ I • N
Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n)
H1 : ∀ (x y : M), p x → p y → p (x + y)
⊢ p 0

Next tactic:
simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
@[elab_as_elim]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
    (H1 : ∀ x y, p x → p y → p (x + y)) : p x := by
  have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
p : M → Prop
x : M
H : x ∈ I • N
Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n)
H1 : ∀ (x y : M), p x → p y → p (x + y)
H0 : p 0
⊢ p x

Next tactic:
refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
@[elab_as_elim]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
    (H1 : ∀ x y, p x → p y → p (x + y)) : p x := by
  have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
  refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
p : M → Prop
x : M
H : x ∈ I • N
Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n)
H1 : ∀ (x y : M), p x → p y → p (x + y)
H0 : p 0
⊢ ∀ (i : ↥I), ∀ x ∈ map ((LinearMap.lsmul R M) ↑i) N, p x

Next tactic:
rintro ⟨i, hi⟩ m ⟨j, hj, hj'⟩
@[elab_as_elim]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
    (H1 : ∀ x y, p x → p y → p (x + y)) : p x := by
  have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
  refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
  rintro ⟨i, hi⟩ m ⟨j, hj, hj'⟩
  

Proof state:
case mk.intro.intro
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
p : M → Prop
x : M
H : x ∈ I • N
Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n)
H1 : ∀ (x y : M), p x → p y → p (x + y)
H0 : p 0
i : R
hi : i ∈ I
m j : M
hj : j ∈ ↑N
hj' : ((LinearMap.lsmul R M) ↑{ val := i, property := hi }) j = m
⊢ p m

Next tactic:
rw [← hj']
@[elab_as_elim]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
    (H1 : ∀ x y, p x → p y → p (x + y)) : p x := by
  have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem
  refine Submodule.iSup_induction (x := x) _ H ?_ H0 H1
  rintro ⟨i, hi⟩ m ⟨j, hj, hj'⟩
  rw [← hj']
  

Proof state:
case mk.intro.intro
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
p : M → Prop
x : M
H : x ∈ I • N
Hb : ∀ r ∈ I, ∀ n ∈ N, p (r • n)
H1 : ∀ (x y : M), p x → p y → p (x + y)
H0 : p 0
i : R
hi : i ∈ I
m j : M
hj : j ∈ ↑N
hj' : ((LinearMap.lsmul R M) ↑{ val := i, property := hi }) j = m
⊢ p (((LinearMap.lsmul R M) ↑{ val := i, property := hi }) j)

Next tactic:
exact Hb _ hi _ hj
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x ∈ I • N) {p : ∀ x, x ∈ I • N → Prop}
    (Hb : ∀ (r : R) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (smul_mem_smul hr hn))
    (H1 : ∀ x hx y hy, p x hx → p y hy → p (x + y) (Submodule.add_mem _ ‹_› ‹_›)) : p x hx := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
x : M
hx : x ∈ I • N
p : (x : M) → x ∈ I • N → Prop
Hb : ∀ (r : R) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (_ : r • n ∈ I • N)
H1 : ∀ (x : M) (hx : x ∈ I • N) (y : M) (hy : y ∈ I • N), p x hx → p y hy → p (x + y) (_ : x + y ∈ I • N)
⊢ p x hx

Next tactic:
refine' Exists.elim _ fun (h : x ∈ I • N) (H : p x h) => H
/-- Dependent version of `Submodule.smul_induction_on`. -/
@[elab_as_elim]
theorem smul_induction_on' {x : M} (hx : x ∈ I • N) {p : ∀ x, x ∈ I • N → Prop}
    (Hb : ∀ (r : R) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (smul_mem_smul hr hn))
    (H1 : ∀ x hx y hy, p x hx → p y hy → p (x + y) (Submodule.add_mem _ ‹_› ‹_›)) : p x hx := by
  refine' Exists.elim _ fun (h : x ∈ I • N) (H : p x h) => H
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
x : M
hx : x ∈ I • N
p : (x : M) → x ∈ I • N → Prop
Hb : ∀ (r : R) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (_ : r • n ∈ I • N)
H1 : ∀ (x : M) (hx : x ∈ I • N) (y : M) (hy : y ∈ I • N), p x hx → p y hy → p (x + y) (_ : x + y ∈ I • N)
⊢ ∃ (x_1 : x ∈ I • N), p x x_1

Next tactic:
exact
    smul_induction_on hx (fun a ha x hx => ⟨_, Hb _ ha _ hx⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>
      ⟨_, H1 _ _ _ _ hx hy⟩
theorem mem_smul_span_singleton {I : Ideal R} {m : M} {x : M} :
    x ∈ I • span R ({m} : Set M) ↔ ∃ y ∈ I, y • m = x :=
  ⟨fun hx =>
    smul_induction_on hx
      (fun r hri n hnm =>
        let ⟨s, hs⟩ := mem_span_singleton.1 hnm
        ⟨r * s, I.mul_mem_right _ hri, hs ▸ mul_smul r s m⟩)
      fun m1 m2 ⟨y1, hyi1, hy1⟩ ⟨y2, hyi2, hy2⟩ =>
      ⟨y1 + y2, I.add_mem hyi1 hyi2, by 

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I✝ J : Ideal R
N P : Submodule R M
I : Ideal R
m x : M
hx : x ∈ I • span R {m}
m1 m2 : M
x✝¹ : ∃ y ∈ I, y • m = m1
x✝ : ∃ y ∈ I, y • m = m2
y1 : R
hyi1 : y1 ∈ I
hy1 : y1 • m = m1
y2 : R
hyi2 : y2 ∈ I
hy2 : y2 • m = m2
⊢ (y1 + y2) • m = m1 + m2

Next tactic:
rw [add_smul, hy1, hy2]
theorem map_le_smul_top (I : Ideal R) (f : R →ₗ[R] M) :
    Submodule.map f I ≤ I • (⊤ : Submodule R M) := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I✝ J : Ideal R
N P : Submodule R M
I : Ideal R
f : R →ₗ[R] M
⊢ map f I ≤ I • ⊤

Next tactic:
rintro _ ⟨y, hy, rfl⟩
theorem map_le_smul_top (I : Ideal R) (f : R →ₗ[R] M) :
    Submodule.map f I ≤ I • (⊤ : Submodule R M) := by
  rintro _ ⟨y, hy, rfl⟩
  

Proof state:
case intro.intro
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I✝ J : Ideal R
N P : Submodule R M
I : Ideal R
f : R →ₗ[R] M
y : R
hy : y ∈ ↑I
⊢ f y ∈ I • ⊤

Next tactic:
rw [← mul_one y, ← smul_eq_mul, f.map_smul]
theorem map_le_smul_top (I : Ideal R) (f : R →ₗ[R] M) :
    Submodule.map f I ≤ I • (⊤ : Submodule R M) := by
  rintro _ ⟨y, hy, rfl⟩
  rw [← mul_one y, ← smul_eq_mul, f.map_smul]
  

Proof state:
case intro.intro
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I✝ J : Ideal R
N P : Submodule R M
I : Ideal R
f : R →ₗ[R] M
y : R
hy : y ∈ ↑I
⊢ y • f 1 ∈ I • ⊤

Next tactic:
exact smul_mem_smul hy mem_top
@[simp]
theorem mul_annihilator (I : Ideal R) : I * annihilator I = ⊥ := by 

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I✝ J : Ideal R
N P : Submodule R M
I : Ideal R
⊢ I * annihilator I = ⊥

Next tactic:
rw [mul_comm, annihilator_mul]
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N✝ P : Submodule R M
S : Set R
T : Set M
r : R
N : Submodule R M
⊢ Ideal.span {r} • N = r • N

Next tactic:
have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    convert span_eq (r • N)
    exact (Set.image_eq_iUnion _ (N : Set M)).symm
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N✝ P : Submodule R M
S : Set R
T : Set M
r : R
N : Submodule R M
⊢ span R (⋃ t ∈ N, {r • t}) = r • N

Next tactic:
convert span_eq (r • N)
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    convert span_eq (r • N)
    

Proof state:
case h.e'_2.h.e'_6
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N✝ P : Submodule R M
S : Set R
T : Set M
r : R
N : Submodule R M
⊢ ⋃ t ∈ N, {r • t} = ↑(r • N)

Next tactic:
exact (Set.image_eq_iUnion _ (N : Set M)).symm
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    convert span_eq (r • N)
    exact (Set.image_eq_iUnion _ (N : Set M)).symm
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N✝ P : Submodule R M
S : Set R
T : Set M
r : R
N : Submodule R M
this : span R (⋃ t ∈ N, {r • t}) = r • N
⊢ Ideal.span {r} • N = r • N

Next tactic:
conv_lhs => rw [← span_eq N, span_smul_span]
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    convert span_eq (r • N)
    exact (Set.image_eq_iUnion _ (N : Set M)).symm
  conv_lhs => 

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N✝ P : Submodule R M
S : Set R
T : Set M
r : R
N : Submodule R M
this : span R (⋃ t ∈ N, {r • t}) = r • N
| Ideal.span {r} • N

Next tactic:
rw [← span_eq N, span_smul_span]
theorem ideal_span_singleton_smul (r : R) (N : Submodule R M) :
    (Ideal.span {r} : Ideal R) • N = r • N := by
  have : span R (⋃ (t : M) (_ : t ∈ N), {r • t}) = r • N := by
    convert span_eq (r • N)
    exact (Set.image_eq_iUnion _ (N : Set M)).symm
  conv_lhs => rw [← span_eq N, span_smul_span]
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N✝ P : Submodule R M
S : Set R
T : Set M
r : R
N : Submodule R M
this : span R (⋃ t ∈ N, {r • t}) = r • N
⊢ span R (⋃ s ∈ {r}, ⋃ t ∈ ↑N, {s • t}) = r • N

Next tactic:
simpa
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M)
    (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ↑r • x ∈ M'
⊢ x ∈ M'

Next tactic:
suffices (⊤ : Ideal R) • span R ({x} : Set M) ≤ M' by
    rw [top_smul] at this
    exact this (subset_span (Set.mem_singleton x))
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M)
    (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
  suffices (⊤ : Ideal R) • span R ({x} : Set M) ≤ M' by
    

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ↑r • x ∈ M'
this : ⊤ • span R {x} ≤ M'
⊢ x ∈ M'

Next tactic:
rw [top_smul] at this
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M)
    (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
  suffices (⊤ : Ideal R) • span R ({x} : Set M) ≤ M' by
    rw [top_smul] at this
    

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ↑r • x ∈ M'
this : span R {x} ≤ M'
⊢ x ∈ M'

Next tactic:
exact this (subset_span (Set.mem_singleton x))
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M)
    (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
  suffices (⊤ : Ideal R) • span R ({x} : Set M) ≤ M' by
    rw [top_smul] at this
    exact this (subset_span (Set.mem_singleton x))
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ↑r • x ∈ M'
⊢ ⊤ • span R {x} ≤ M'

Next tactic:
rw [← hs, span_smul_span, span_le]
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M)
    (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
  suffices (⊤ : Ideal R) • span R ({x} : Set M) ≤ M' by
    rw [top_smul] at this
    exact this (subset_span (Set.mem_singleton x))
  rw [← hs, span_smul_span, span_le]
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ↑r • x ∈ M'
⊢ ⋃ s_1 ∈ s, ⋃ t ∈ {x}, {s_1 • t} ⊆ ↑M'

Next tactic:
simpa using H
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n • x ∈ M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤)
    (x : M) (H : ∀ r : s, ∃ n : ℕ, ((r : R) ^ n : R) • x ∈ M') : x ∈ M' := by
  

Proof state:
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ∃ n, ↑r ^ n • x ∈ M'
⊢ x ∈ M'

Next tactic:
obtain ⟨s', hs₁, hs₂⟩ := (Ideal.span_eq_top_iff_finite _).mp hs
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n • x ∈ M'` for some `n` for each `r : s`. -/
theorem mem_of_span_eq_top_of_smul_pow_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤)
    (x : M) (H : ∀ r : s, ∃ n : ℕ, ((r : R) ^ n : R) • x ∈ M') : x ∈ M' := by
  obtain ⟨s', hs₁, hs₂⟩ := (Ideal.span_eq_top_iff_finite _).mp hs
  

Proof state:
case intro.intro
R : Type u
M : Type v
F : Type u_1
G : Type u_2
inst✝² : CommSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
I J : Ideal R
N P : Submodule R M
S : Set R
T : Set M
M' : Submodule R M
s : Set R
hs : Ideal.span s = ⊤
x : M
H : ∀ (r : ↑s), ∃ n, ↑r ^ n • x ∈ M'
s' : Finset R
hs₁ : ↑s' ⊆ s
hs₂ : Ideal.span ↑s' = ⊤
⊢ x ∈ M'

Next tactic:
replace H : ∀ r : s', ∃ n : ℕ, ((r : R) ^ n : R) • x ∈ M' := fun r => H ⟨_, hs₁ r.2⟩