@@ -32,29 +32,6 @@ section Monoid
3232
3333variable [Monoid M] [Monoid N] [Monoid P] {l l₁ l₂ : List M} {a : M}
3434
35- @[to_additive]
36- theorem prod_eq_foldl : ∀ {l : List M}, l.prod = foldl (· * ·) 1 l
37- | [] => rfl
38- | cons a l => by
39- rw [prod_cons, prod_eq_foldl, ← foldl_assoc (α := M) (op := (· * ·))]
40- simp
41-
42- @[to_additive (attr := simp)]
43- theorem prod_append : (l₁ ++ l₂).prod = l₁.prod * l₂.prod :=
44- calc
45- (l₁ ++ l₂).prod = foldr (· * ·) (1 * foldr (· * ·) 1 l₂) l₁ := by simp [List.prod]
46- _ = l₁.prod * l₂.prod := foldr_assoc
47-
48- @[to_additive]
49- theorem prod_concat : (l.concat a).prod = l.prod * a := by
50- rw [concat_eq_append, prod_append, prod_singleton]
51-
52- @[to_additive (attr := simp)]
53- theorem prod_flatten {l : List (List M)} : l.flatten.prod = (l.map List.prod).prod := by
54- induction l with
55- | nil => simp
56- | cons head tail ih => simp only [*, List.flatten_cons, map, prod_append, prod_cons]
57-
5835open scoped Relator in
5936@[to_additive]
6037theorem rel_prod {R : M → N → Prop } (h : R 1 1 ) (hf : (R ⇒ R ⇒ R) (· * ·) (· * ·)) :
@@ -82,8 +59,8 @@ theorem prod_hom₂_nonempty {l : List ι} (f : M → N → P)
8259theorem prod_hom₂ (l : List ι) (f : M → N → P) (hf : ∀ a b c d, f (a * b) (c * d) = f a c * f b d)
8360 (hf' : f 1 1 = 1 ) (f₁ : ι → M) (f₂ : ι → N) :
8461 (l.map fun i => f (f₁ i) (f₂ i)).prod = f (l.map f₁).prod (l.map f₂).prod := by
85- rw [prod, prod, prod, foldr_map, foldr_map, foldr_map,
86- ← l. foldr_hom₂ f _ _ (fun x y => f (f₁ x) (f₂ x) * y) _ _ (by simp [hf]), hf']
62+ simp only [prod_eq_foldr, foldr_map]
63+ rw [← foldr_hom₂ l f _ _ (( fun x y => f (f₁ x) (f₂ x) * y) ) _ _ (by simp [hf]), hf']
8764
8865@[to_additive (attr := simp)]
8966theorem prod_map_mul {M : Type *} [CommMonoid M] {l : List ι} {f g : ι → M} :
@@ -302,7 +279,7 @@ variable [Group G]
302279@[to_additive /-- This is the `List.sum` version of `add_neg_rev` -/]
303280theorem prod_inv_reverse : ∀ L : List G, L.prod⁻¹ = (L.map fun x => x⁻¹).reverse.prod
304281 | [] => by simp
305- | x :: xs => by simp [prod_inv_reverse xs]
282+ | x :: xs => by simp [prod_append, prod_inv_reverse xs]
306283
307284/-- A non-commutative variant of `List.prod_reverse` -/
308285@[to_additive /-- A non-commutative variant of `List.sum_reverse` -/]
@@ -324,8 +301,7 @@ theorem prod_range_div' (n : ℕ) (f : ℕ → G) :
324301 ((range n).map fun k ↦ f k / f (k + 1 )).prod = f 0 / f n := by
325302 induction n with
326303 | zero => exact (div_self' (f 0 )).symm
327- | succ n h =>
328- rw [range_succ, map_append, map_singleton, prod_append, prod_singleton, h, div_mul_div_cancel]
304+ | succ n h => simp [range_succ, prod_append, map_append, h]
329305
330306end Group
331307
0 commit comments