l3lab/ntp-mathlib huggingface dataset:
/-- Submonoids are closed under natural powers. -/
@[to_additive
      "An `AddSubmonoid` is closed under multiplication by naturals."]
theorem IsSubmonoid.pow_mem {a : M} (hs : IsSubmonoid s) (h : a ∈ s) : ∀ {n : ℕ}, a ^ n ∈ s
  | 0 => by
    rw [pow_zero]
    exact hs.one_mem
  | n + 1 => by
    rw [pow_succ]
    

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
a : M
hs : IsSubmonoid s
h : a ∈ s
n : ℕ
⊢ a * a ^ n ∈ s

Next tactic:
exact hs.mul_mem h (IsSubmonoid.pow_mem hs h)
/-- The product of a list of elements of a submonoid is an element of the submonoid. -/
@[to_additive
      "The sum of a list of elements of an `AddSubmonoid` is an element of the `AddSubmonoid`."]
theorem list_prod_mem (hs : IsSubmonoid s) : ∀ {l : List M}, (∀ x ∈ l, x ∈ s) → l.prod ∈ s
  | [], _ => hs.one_mem
  | a :: l, h =>
    suffices a * l.prod ∈ s by simpa
    have : a ∈ s ∧ ∀ x ∈ l, x ∈ s := by 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
hs : IsSubmonoid s
a : M
l : List M
h : ∀ x ∈ a :: l, x ∈ s
⊢ a ∈ s ∧ ∀ x ∈ l, x ∈ s

Next tactic:
simpa using h
/-- The product of a list of elements of a submonoid is an element of the submonoid. -/
@[to_additive
      "The sum of a list of elements of an `AddSubmonoid` is an element of the `AddSubmonoid`."]
theorem list_prod_mem (hs : IsSubmonoid s) : ∀ {l : List M}, (∀ x ∈ l, x ∈ s) → l.prod ∈ s
  | [], _ => hs.one_mem
  | a :: l, h =>
    suffices a * l.prod ∈ s by 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
hs : IsSubmonoid s
a : M
l : List M
h : ∀ x ∈ a :: l, x ∈ s
this : a * List.prod l ∈ s
⊢ List.prod (a :: l) ∈ s

Next tactic:
simpa
/-- The product of a multiset of elements of a submonoid of a `CommMonoid` is an element of
the submonoid. -/
@[to_additive
      "The sum of a multiset of elements of an `AddSubmonoid` of an `AddCommMonoid`
      is an element of the `AddSubmonoid`. "]
theorem multiset_prod_mem {M} [CommMonoid M] {s : Set M} (hs : IsSubmonoid s) (m : Multiset M) :
    (∀ a ∈ m, a ∈ s) → m.prod ∈ s := by
  

Proof state:
M✝ : Type u_1
inst✝² : Monoid M✝
s✝ : Set M✝
A : Type u_2
inst✝¹ : AddMonoid A
t : Set A
M : Type u_3
inst✝ : CommMonoid M
s : Set M
hs : IsSubmonoid s
m : Multiset M
⊢ (∀ a ∈ m, a ∈ s) → Multiset.prod m ∈ s

Next tactic:
refine' Quotient.inductionOn m fun l hl => _
/-- The product of a multiset of elements of a submonoid of a `CommMonoid` is an element of
the submonoid. -/
@[to_additive
      "The sum of a multiset of elements of an `AddSubmonoid` of an `AddCommMonoid`
      is an element of the `AddSubmonoid`. "]
theorem multiset_prod_mem {M} [CommMonoid M] {s : Set M} (hs : IsSubmonoid s) (m : Multiset M) :
    (∀ a ∈ m, a ∈ s) → m.prod ∈ s := by
  refine' Quotient.inductionOn m fun l hl => _
  

Proof state:
M✝ : Type u_1
inst✝² : Monoid M✝
s✝ : Set M✝
A : Type u_2
inst✝¹ : AddMonoid A
t : Set A
M : Type u_3
inst✝ : CommMonoid M
s : Set M
hs : IsSubmonoid s
m : Multiset M
l : List M
hl : ∀ a ∈ ⟦l⟧, a ∈ s
⊢ Multiset.prod ⟦l⟧ ∈ s

Next tactic:
rw [Multiset.quot_mk_to_coe, Multiset.coe_prod]
/-- The product of a multiset of elements of a submonoid of a `CommMonoid` is an element of
the submonoid. -/
@[to_additive
      "The sum of a multiset of elements of an `AddSubmonoid` of an `AddCommMonoid`
      is an element of the `AddSubmonoid`. "]
theorem multiset_prod_mem {M} [CommMonoid M] {s : Set M} (hs : IsSubmonoid s) (m : Multiset M) :
    (∀ a ∈ m, a ∈ s) → m.prod ∈ s := by
  refine' Quotient.inductionOn m fun l hl => _
  rw [Multiset.quot_mk_to_coe, Multiset.coe_prod]
  

Proof state:
M✝ : Type u_1
inst✝² : Monoid M✝
s✝ : Set M✝
A : Type u_2
inst✝¹ : AddMonoid A
t : Set A
M : Type u_3
inst✝ : CommMonoid M
s : Set M
hs : IsSubmonoid s
m : Multiset M
l : List M
hl : ∀ a ∈ ⟦l⟧, a ∈ s
⊢ List.prod l ∈ s

Next tactic:
exact list_prod_mem hs hl
/-- The product of elements of a submonoid of a `CommMonoid` indexed by a `Finset` is an element
of the submonoid. -/
@[to_additive
      "The sum of elements of an `AddSubmonoid` of an `AddCommMonoid` indexed by
      a `Finset` is an element of the `AddSubmonoid`."]
theorem finset_prod_mem {M A} [CommMonoid M] {s : Set M} (hs : IsSubmonoid s) (f : A → M) :
    ∀ t : Finset A, (∀ b ∈ t, f b ∈ s) → (∏ b in t, f b) ∈ s
  | ⟨m, hm⟩, _ => multiset_prod_mem hs _ (by 

Proof state:
M✝ : Type u_1
inst✝² : Monoid M✝
s✝ : Set M✝
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
M : Type u_3
A : Type u_4
inst✝ : CommMonoid M
s : Set M
hs : IsSubmonoid s
f : A → M
m : Multiset A
hm : Multiset.Nodup m
x✝ : ∀ b ∈ { val := m, nodup := hm }, f b ∈ s
⊢ ∀ a ∈ Multiset.map (fun b => f b) { val := m, nodup := hm }.val, a ∈ s

Next tactic:
simpa
/-- The submonoid generated by a set is contained in any submonoid that contains the set. -/
@[to_additive
      "The `AddSubmonoid` generated by a set is contained in any `AddSubmonoid` that
      contains the set."]
theorem closure_subset {s t : Set M} (ht : IsSubmonoid t) (h : s ⊆ t) : Closure s ⊆ t := fun a ha =>
  by 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t✝ : Set A
s t : Set M
ht : IsSubmonoid t
h : s ⊆ t
a : M
ha : a ∈ Closure s
⊢ a ∈ t

Next tactic:
induction ha
/-- The submonoid generated by a set is contained in any submonoid that contains the set. -/
@[to_additive
      "The `AddSubmonoid` generated by a set is contained in any `AddSubmonoid` that
      contains the set."]
theorem closure_subset {s t : Set M} (ht : IsSubmonoid t) (h : s ⊆ t) : Closure s ⊆ t := fun a ha =>
  by induction ha <;> 

Proof state:
case basic
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t✝ : Set A
s t : Set M
ht : IsSubmonoid t
h : s ⊆ t
a a✝¹ : M
a✝ : a✝¹ ∈ s
⊢ a✝¹ ∈ t

Next tactic:
simp [h _, *, IsSubmonoid.one_mem, IsSubmonoid.mul_mem]
/-- The submonoid generated by a set is contained in any submonoid that contains the set. -/
@[to_additive
      "The `AddSubmonoid` generated by a set is contained in any `AddSubmonoid` that
      contains the set."]
theorem closure_subset {s t : Set M} (ht : IsSubmonoid t) (h : s ⊆ t) : Closure s ⊆ t := fun a ha =>
  by induction ha <;> 

Proof state:
case one
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t✝ : Set A
s t : Set M
ht : IsSubmonoid t
h : s ⊆ t
a : M
⊢ 1 ∈ t

Next tactic:
simp [h _, *, IsSubmonoid.one_mem, IsSubmonoid.mul_mem]
/-- The submonoid generated by a set is contained in any submonoid that contains the set. -/
@[to_additive
      "The `AddSubmonoid` generated by a set is contained in any `AddSubmonoid` that
      contains the set."]
theorem closure_subset {s t : Set M} (ht : IsSubmonoid t) (h : s ⊆ t) : Closure s ⊆ t := fun a ha =>
  by induction ha <;> 

Proof state:
case mul
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t✝ : Set A
s t : Set M
ht : IsSubmonoid t
h : s ⊆ t
a a✝² b✝ : M
a✝¹ : InClosure s a✝²
a✝ : InClosure s b✝
a_ih✝¹ : a✝² ∈ t
a_ih✝ : b✝ ∈ t
⊢ a✝² * b✝ ∈ t

Next tactic:
simp [h _, *, IsSubmonoid.one_mem, IsSubmonoid.mul_mem]
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      

Proof state:
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
⊢ f '' Closure s ≤ Closure (f '' s)

Next tactic:
rintro _ ⟨x, hx, rfl⟩
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      rintro _ ⟨x, hx, rfl⟩
      

Proof state:
case intro.intro
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
x : M
hx : x ∈ Closure s
⊢ f x ∈ Closure (f '' s)

Next tactic:
induction' hx with z hz
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      rintro _ ⟨x, hx, rfl⟩
      induction' hx with z hz
      · 

Proof state:
case intro.intro.basic
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
x z : M
hz : z ∈ s
⊢ f z ∈ Closure (f '' s)

Next tactic:
solve_by_elim [subset_closure, Set.mem_image_of_mem]
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      rintro _ ⟨x, hx, rfl⟩
      induction' hx with z hz
      · solve_by_elim [subset_closure, Set.mem_image_of_mem]
      · 

Proof state:
case intro.intro.one
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
x : M
⊢ f 1 ∈ Closure (f '' s)

Next tactic:
rw [hf.map_one]
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      rintro _ ⟨x, hx, rfl⟩
      induction' hx with z hz
      · solve_by_elim [subset_closure, Set.mem_image_of_mem]
      · rw [hf.map_one]
        

Proof state:
case intro.intro.one
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
x : M
⊢ 1 ∈ Closure (f '' s)

Next tactic:
apply IsSubmonoid.one_mem (closure.isSubmonoid (f '' s))
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      rintro _ ⟨x, hx, rfl⟩
      induction' hx with z hz
      · solve_by_elim [subset_closure, Set.mem_image_of_mem]
      · rw [hf.map_one]
        apply IsSubmonoid.one_mem (closure.isSubmonoid (f '' s))
      · 

Proof state:
case intro.intro.mul
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
x a✝² b✝ : M
a✝¹ : InClosure s a✝²
a✝ : InClosure s b✝
a_ih✝¹ : f a✝² ∈ Closure (f '' s)
a_ih✝ : f b✝ ∈ Closure (f '' s)
⊢ f (a✝² * b✝) ∈ Closure (f '' s)

Next tactic:
rw [hf.map_mul]
/-- The image under a monoid hom of the submonoid generated by a set equals the submonoid generated
    by the image of the set under the monoid hom. -/
@[to_additive
      "The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
      the `AddSubmonoid` generated by the image of the set under the `AddMonoid` hom."]
theorem image_closure {A : Type*} [Monoid A] {f : M → A} (hf : IsMonoidHom f) (s : Set M) :
    f '' Closure s = Closure (f '' s) :=
  le_antisymm
    (by
      rintro _ ⟨x, hx, rfl⟩
      induction' hx with z hz
      · solve_by_elim [subset_closure, Set.mem_image_of_mem]
      · rw [hf.map_one]
        apply IsSubmonoid.one_mem (closure.isSubmonoid (f '' s))
      · rw [hf.map_mul]
        

Proof state:
case intro.intro.mul
M : Type u_1
inst✝² : Monoid M
s✝ : Set M
A✝ : Type u_2
inst✝¹ : AddMonoid A✝
t : Set A✝
A : Type u_3
inst✝ : Monoid A
f : M → A
hf : IsMonoidHom f
s : Set M
x a✝² b✝ : M
a✝¹ : InClosure s a✝²
a✝ : InClosure s b✝
a_ih✝¹ : f a✝² ∈ Closure (f '' s)
a_ih✝ : f b✝ ∈ Closure (f '' s)
⊢ f a✝² * f b✝ ∈ Closure (f '' s)

Next tactic:
solve_by_elim [(closure.isSubmonoid _).mul_mem]
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a : M
h : a ∈ Closure s
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a

Next tactic:
induction h
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  

Proof state:
case basic
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a a✝¹ : M
a✝ : a✝¹ ∈ s
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝¹
case one
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a : M
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = 1
case mul
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a a✝² b✝ : M
a✝¹ : InClosure s a✝²
a✝ : InClosure s b✝
a_ih✝¹ : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝²
a_ih✝ : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = b✝
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝² * b✝

Next tactic:
case basic a ha => exists [a]; simp [ha]
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a✝ a : M
ha : a ∈ s
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a

Next tactic:
case basic a ha => exists [a]; simp [ha]
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a✝ a : M
ha : a ∈ s
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a

Next tactic:
exists [a]
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a✝ a : M
ha : a ∈ s
⊢ (∀ x ∈ [a], x ∈ s) ∧ List.prod [a] = a

Next tactic:
simp [ha]
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  

Proof state:
case one
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a : M
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = 1
case mul
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a a✝² b✝ : M
a✝¹ : InClosure s a✝²
a✝ : InClosure s b✝
a_ih✝¹ : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝²
a_ih✝ : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = b✝
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝² * b✝

Next tactic:
case one => exists []; simp
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a : M
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = 1

Next tactic:
case one => exists []; simp
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  case one => 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a : M
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = 1

Next tactic:
exists []
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  case one => exists []; 

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a : M
⊢ (∀ x ∈ [], x ∈ s) ∧ List.prod [] = 1

Next tactic:
simp
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  case one => exists []; simp
  

Proof state:
case mul
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a a✝² b✝ : M
a✝¹ : InClosure s a✝²
a✝ : InClosure s b✝
a_ih✝¹ : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝²
a_ih✝ : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = b✝
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a✝² * b✝

Next tactic:
case mul a b _ _ ha hb =>
    rcases ha with ⟨la, ha, eqa⟩
    rcases hb with ⟨lb, hb, eqb⟩
    exists la ++ lb
    simp only [List.mem_append, or_imp, List.prod_append, eqa.symm, eqb.symm, and_true]
    exact fun a => ⟨ha a, hb a⟩
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  case one => exists []; simp
  

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a✝² a b : M
a✝¹ : InClosure s a
a✝ : InClosure s b
ha : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a
hb : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = b
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a * b

Next tactic:
case mul a b _ _ ha hb =>
    rcases ha with ⟨la, ha, eqa⟩
    rcases hb with ⟨lb, hb, eqb⟩
    exists la ++ lb
    simp only [List.mem_append, or_imp, List.prod_append, eqa.symm, eqb.symm, and_true]
    exact fun a => ⟨ha a, hb a⟩
/-- Given an element `a` of the submonoid of a monoid `M` generated by a set `s`, there exists
a list of elements of `s` whose product is `a`. -/
@[to_additive
      "Given an element `a` of the `AddSubmonoid` of an `AddMonoid M` generated by
      a set `s`, there exists a list of elements of `s` whose sum is `a`."]
theorem exists_list_of_mem_closure {s : Set M} {a : M} (h : a ∈ Closure s) :
    ∃ l : List M, (∀ x ∈ l, x ∈ s) ∧ l.prod = a := by
  induction h
  case basic a ha => exists [a]; simp [ha]
  case one => exists []; simp
  case mul a b _ _ ha hb =>
    

Proof state:
M : Type u_1
inst✝¹ : Monoid M
s✝ : Set M
A : Type u_2
inst✝ : AddMonoid A
t : Set A
s : Set M
a✝² a b : M
a✝¹ : InClosure s a
a✝ : InClosure s b
ha : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a
hb : ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = b
⊢ ∃ l, (∀ x ∈ l, x ∈ s) ∧ List.prod l = a * b

Next tactic:
rcases ha with ⟨la, ha, eqa⟩