data.list.prod_sigma
⟷
Mathlib.Data.List.ProdSigma
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
-import Data.List.BigOperators.Basic
+import Algebra.BigOperators.List.Basic
#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"be24ec5de6701447e5df5ca75400ffee19d65659"
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
-import Mathbin.Data.List.BigOperators.Basic
+import Data.List.BigOperators.Basic
#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"be24ec5de6701447e5df5ca75400ffee19d65659"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.list.prod_sigma
-! leanprover-community/mathlib commit be24ec5de6701447e5df5ca75400ffee19d65659
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.List.BigOperators.Basic
+#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"be24ec5de6701447e5df5ca75400ffee19d65659"
+
/-!
# Lists in product and sigma types
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -36,31 +36,39 @@ theorem nil_product (l : List β) : product (@nil α) l = [] :=
#align list.nil_product List.nil_product
-/
+#print List.product_cons /-
@[simp]
theorem product_cons (a : α) (l₁ : List α) (l₂ : List β) :
product (a :: l₁) l₂ = map (fun b => (a, b)) l₂ ++ product l₁ l₂ :=
rfl
#align list.product_cons List.product_cons
+-/
+#print List.product_nil /-
@[simp]
theorem product_nil : ∀ l : List α, product l (@nil β) = []
| [] => rfl
| a :: l => by rw [product_cons, product_nil] <;> rfl
#align list.product_nil List.product_nil
+-/
+#print List.mem_product /-
@[simp]
theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
(a, b) ∈ product l₁ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ := by
simp only [product, mem_bind, mem_map, Prod.ext_iff, exists_prop, and_left_comm, exists_and_left,
exists_eq_left, exists_eq_right]
#align list.mem_product List.mem_product
+-/
+#print List.length_product /-
theorem length_product (l₁ : List α) (l₂ : List β) :
length (product l₁ l₂) = length l₁ * length l₂ := by
induction' l₁ with x l₁ IH <;> [exact (MulZeroClass.zero_mul _).symm;
simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
add_comm]]
#align list.length_product List.length_product
+-/
/-! ### sigma -/
@@ -74,30 +82,38 @@ theorem nil_sigma (l : ∀ a, List (σ a)) : (@nil α).Sigma l = [] :=
#align list.nil_sigma List.nil_sigma
-/
+#print List.sigma_cons /-
@[simp]
theorem sigma_cons (a : α) (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
(a :: l₁).Sigma l₂ = map (Sigma.mk a) (l₂ a) ++ l₁.Sigma l₂ :=
rfl
#align list.sigma_cons List.sigma_cons
+-/
+#print List.sigma_nil /-
@[simp]
theorem sigma_nil : ∀ l : List α, (l.Sigma fun a => @nil (σ a)) = []
| [] => rfl
| a :: l => by rw [sigma_cons, sigma_nil] <;> rfl
#align list.sigma_nil List.sigma_nil
+-/
+#print List.mem_sigma /-
@[simp]
theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ a} :
Sigma.mk a b ∈ l₁.Sigma l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ a := by
simp only [List.sigma, mem_bind, mem_map, exists_prop, exists_and_left, and_left_comm,
exists_eq_left, heq_iff_eq, exists_eq_right]
#align list.mem_sigma List.mem_sigma
+-/
+#print List.length_sigma /-
theorem length_sigma (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
length (l₁.Sigma l₂) = (l₁.map fun a => length (l₂ a)).Sum := by
induction' l₁ with x l₁ IH <;> [rfl;
simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]]
#align list.length_sigma List.length_sigma
+-/
end List
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -57,11 +57,9 @@ theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
theorem length_product (l₁ : List α) (l₂ : List β) :
length (product l₁ l₂) = length l₁ * length l₂ := by
- induction' l₁ with x l₁ IH <;>
- [exact
- (MulZeroClass.zero_mul
- _).symm;simp only [length, product_cons, length_append, IH, right_distrib, one_mul,
- length_map, add_comm]]
+ induction' l₁ with x l₁ IH <;> [exact (MulZeroClass.zero_mul _).symm;
+ simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
+ add_comm]]
#align list.length_product List.length_product
/-! ### sigma -/
@@ -97,8 +95,8 @@ theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ
theorem length_sigma (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
length (l₁.Sigma l₂) = (l₁.map fun a => length (l₂ a)).Sum := by
- induction' l₁ with x l₁ IH <;>
- [rfl;simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]]
+ induction' l₁ with x l₁ IH <;> [rfl;
+ simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]]
#align list.length_sigma List.length_sigma
end List
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -36,36 +36,18 @@ theorem nil_product (l : List β) : product (@nil α) l = [] :=
#align list.nil_product List.nil_product
-/
-/- warning: list.product_cons -> List.product_cons is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (a : α) (l₁ : List.{u1} α) (l₂ : List.{u2} β), Eq.{succ (max u1 u2)} (List.{max u1 u2} (Prod.{u1, u2} α β)) (List.product.{u1, u2} α β (List.cons.{u1} α a l₁) l₂) (Append.append.{max u1 u2} (List.{max u1 u2} (Prod.{u1, u2} α β)) (List.hasAppend.{max u1 u2} (Prod.{u1, u2} α β)) (List.map.{u2, max u1 u2} β (Prod.{u1, u2} α β) (fun (b : β) => Prod.mk.{u1, u2} α β a b) l₂) (List.product.{u1, u2} α β l₁ l₂))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (a : α) (l₁ : List.{u2} α) (l₂ : List.{u1} β), Eq.{max (succ u2) (succ u1)} (List.{max u1 u2} (Prod.{u2, u1} α β)) (List.product.{u2, u1} α β (List.cons.{u2} α a l₁) l₂) (HAppend.hAppend.{max u2 u1, max u2 u1, max u2 u1} (List.{max u1 u2} (Prod.{u2, u1} α β)) (List.{max u1 u2} (Prod.{u2, u1} α β)) (List.{max u1 u2} (Prod.{u2, u1} α β)) (instHAppend.{max u2 u1} (List.{max u1 u2} (Prod.{u2, u1} α β)) (List.instAppendList.{max u2 u1} (Prod.{u2, u1} α β))) (List.map.{u1, max u1 u2} β (Prod.{u2, u1} α β) (fun (b : β) => Prod.mk.{u2, u1} α β a b) l₂) (List.product.{u2, u1} α β l₁ l₂))
-Case conversion may be inaccurate. Consider using '#align list.product_cons List.product_consₓ'. -/
@[simp]
theorem product_cons (a : α) (l₁ : List α) (l₂ : List β) :
product (a :: l₁) l₂ = map (fun b => (a, b)) l₂ ++ product l₁ l₂ :=
rfl
#align list.product_cons List.product_cons
-/- warning: list.product_nil -> List.product_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l : List.{u1} α), Eq.{succ (max u1 u2)} (List.{max u1 u2} (Prod.{u1, u2} α β)) (List.product.{u1, u2} α β l (List.nil.{u2} β)) (List.nil.{max u1 u2} (Prod.{u1, u2} α β))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (l : List.{u2} α), Eq.{max (succ u2) (succ u1)} (List.{max u1 u2} (Prod.{u2, u1} α β)) (List.product.{u2, u1} α β l (List.nil.{u1} β)) (List.nil.{max u2 u1} (Prod.{u2, u1} α β))
-Case conversion may be inaccurate. Consider using '#align list.product_nil List.product_nilₓ'. -/
@[simp]
theorem product_nil : ∀ l : List α, product l (@nil β) = []
| [] => rfl
| a :: l => by rw [product_cons, product_nil] <;> rfl
#align list.product_nil List.product_nil
-/- warning: list.mem_product -> List.mem_product is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {l₁ : List.{u1} α} {l₂ : List.{u2} β} {a : α} {b : β}, Iff (Membership.Mem.{max u1 u2, max u1 u2} (Prod.{u1, u2} α β) (List.{max u1 u2} (Prod.{u1, u2} α β)) (List.hasMem.{max u1 u2} (Prod.{u1, u2} α β)) (Prod.mk.{u1, u2} α β a b) (List.product.{u1, u2} α β l₁ l₂)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₁) (Membership.Mem.{u2, u2} β (List.{u2} β) (List.hasMem.{u2} β) b l₂))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {l₁ : List.{u2} α} {l₂ : List.{u1} β} {a : α} {b : β}, Iff (Membership.mem.{max u1 u2, max u1 u2} (Prod.{u2, u1} α β) (List.{max u1 u2} (Prod.{u2, u1} α β)) (List.instMembershipList.{max u2 u1} (Prod.{u2, u1} α β)) (Prod.mk.{u2, u1} α β a b) (List.product.{u2, u1} α β l₁ l₂)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l₁) (Membership.mem.{u1, u1} β (List.{u1} β) (List.instMembershipList.{u1} β) b l₂))
-Case conversion may be inaccurate. Consider using '#align list.mem_product List.mem_productₓ'. -/
@[simp]
theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
(a, b) ∈ product l₁ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ := by
@@ -73,12 +55,6 @@ theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
exists_eq_left, exists_eq_right]
#align list.mem_product List.mem_product
-/- warning: list.length_product -> List.length_product is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (l₁ : List.{u1} α) (l₂ : List.{u2} β), Eq.{1} Nat (List.length.{max u1 u2} (Prod.{u1, u2} α β) (List.product.{u1, u2} α β l₁ l₂)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (List.length.{u1} α l₁) (List.length.{u2} β l₂))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (l₁ : List.{u2} α) (l₂ : List.{u1} β), Eq.{1} Nat (List.length.{max u1 u2} (Prod.{u2, u1} α β) (List.product.{u2, u1} α β l₁ l₂)) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (List.length.{u2} α l₁) (List.length.{u1} β l₂))
-Case conversion may be inaccurate. Consider using '#align list.length_product List.length_productₓ'. -/
theorem length_product (l₁ : List α) (l₂ : List β) :
length (product l₁ l₂) = length l₁ * length l₂ := by
induction' l₁ with x l₁ IH <;>
@@ -100,36 +76,18 @@ theorem nil_sigma (l : ∀ a, List (σ a)) : (@nil α).Sigma l = [] :=
#align list.nil_sigma List.nil_sigma
-/
-/- warning: list.sigma_cons -> List.sigma_cons is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {σ : α -> Type.{u2}} (a : α) (l₁ : List.{u1} α) (l₂ : forall (a : α), List.{u2} (σ a)), Eq.{succ (max u1 u2)} (List.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a))) (List.sigma.{u1, u2} α (fun (a : α) => σ a) (List.cons.{u1} α a l₁) l₂) (Append.append.{max u1 u2} (List.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a))) (List.hasAppend.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a))) (List.map.{u2, max u1 u2} (σ a) (Sigma.{u1, u2} α (fun (a : α) => σ a)) (Sigma.mk.{u1, u2} α (fun (a : α) => σ a) a) (l₂ a)) (List.sigma.{u1, u2} α (fun (a : α) => σ a) l₁ l₂))
-but is expected to have type
- forall {α : Type.{u2}} {σ : α -> Type.{u1}} (a : α) (l₁ : List.{u2} α) (l₂ : forall (a : α), List.{u1} (σ a)), Eq.{max (succ u2) (succ u1)} (List.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => σ a))) (List.sigma.{u2, u1} α (fun (a : α) => σ a) (List.cons.{u2} α a l₁) l₂) (HAppend.hAppend.{max u2 u1, max u2 u1, max u2 u1} (List.{max u2 u1} (Sigma.{u2, u1} α σ)) (List.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => σ a))) (List.{max u2 u1} (Sigma.{u2, u1} α σ)) (instHAppend.{max u2 u1} (List.{max u2 u1} (Sigma.{u2, u1} α σ)) (List.instAppendList.{max u2 u1} (Sigma.{u2, u1} α σ))) (List.map.{u1, max u2 u1} (σ a) (Sigma.{u2, u1} α σ) (Sigma.mk.{u2, u1} α σ a) (l₂ a)) (List.sigma.{u2, u1} α (fun (a : α) => σ a) l₁ l₂))
-Case conversion may be inaccurate. Consider using '#align list.sigma_cons List.sigma_consₓ'. -/
@[simp]
theorem sigma_cons (a : α) (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
(a :: l₁).Sigma l₂ = map (Sigma.mk a) (l₂ a) ++ l₁.Sigma l₂ :=
rfl
#align list.sigma_cons List.sigma_cons
-/- warning: list.sigma_nil -> List.sigma_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {σ : α -> Type.{u2}} (l : List.{u1} α), Eq.{succ (max u1 u2)} (List.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a))) (List.sigma.{u1, u2} α (fun (a : α) => σ a) l (fun (a : α) => List.nil.{u2} (σ a))) (List.nil.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a)))
-but is expected to have type
- forall {α : Type.{u2}} {σ : α -> Type.{u1}} (l : List.{u2} α), Eq.{max (succ u2) (succ u1)} (List.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => σ a))) (List.sigma.{u2, u1} α (fun (a : α) => σ a) l (fun (a : α) => List.nil.{u1} (σ a))) (List.nil.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => σ a)))
-Case conversion may be inaccurate. Consider using '#align list.sigma_nil List.sigma_nilₓ'. -/
@[simp]
theorem sigma_nil : ∀ l : List α, (l.Sigma fun a => @nil (σ a)) = []
| [] => rfl
| a :: l => by rw [sigma_cons, sigma_nil] <;> rfl
#align list.sigma_nil List.sigma_nil
-/- warning: list.mem_sigma -> List.mem_sigma is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {σ : α -> Type.{u2}} {l₁ : List.{u1} α} {l₂ : forall (a : α), List.{u2} (σ a)} {a : α} {b : σ a}, Iff (Membership.Mem.{max u1 u2, max u1 u2} (Sigma.{u1, u2} α (fun {a : α} => σ a)) (List.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a))) (List.hasMem.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a))) (Sigma.mk.{u1, u2} α (fun {a : α} => σ a) a b) (List.sigma.{u1, u2} α (fun (a : α) => σ a) l₁ l₂)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l₁) (Membership.Mem.{u2, u2} (σ a) (List.{u2} (σ a)) (List.hasMem.{u2} (σ a)) b (l₂ a)))
-but is expected to have type
- forall {α : Type.{u2}} {σ : α -> Type.{u1}} {l₁ : List.{u2} α} {l₂ : forall (a : α), List.{u1} (σ a)} {a : α} {b : σ a}, Iff (Membership.mem.{max u1 u2, max u2 u1} (Sigma.{u2, u1} α σ) (List.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => σ a))) (List.instMembershipList.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => σ a))) (Sigma.mk.{u2, u1} α σ a b) (List.sigma.{u2, u1} α (fun (a : α) => σ a) l₁ l₂)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l₁) (Membership.mem.{u1, u1} (σ a) (List.{u1} (σ a)) (List.instMembershipList.{u1} (σ a)) b (l₂ a)))
-Case conversion may be inaccurate. Consider using '#align list.mem_sigma List.mem_sigmaₓ'. -/
@[simp]
theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ a} :
Sigma.mk a b ∈ l₁.Sigma l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ a := by
@@ -137,12 +95,6 @@ theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ
exists_eq_left, heq_iff_eq, exists_eq_right]
#align list.mem_sigma List.mem_sigma
-/- warning: list.length_sigma -> List.length_sigma is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {σ : α -> Type.{u2}} (l₁ : List.{u1} α) (l₂ : forall (a : α), List.{u2} (σ a)), Eq.{1} Nat (List.length.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => σ a)) (List.sigma.{u1, u2} α (fun (a : α) => σ a) l₁ l₂)) (List.sum.{0} Nat Nat.hasAdd Nat.hasZero (List.map.{u1, 0} α Nat (fun (a : α) => List.length.{u2} (σ a) (l₂ a)) l₁))
-but is expected to have type
- forall {α : Type.{u2}} {σ : α -> Type.{u1}} (l₁ : List.{u2} α) (l₂ : forall (a : α), List.{u1} (σ a)), Eq.{1} Nat (List.length.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => σ a)) (List.sigma.{u2, u1} α (fun (a : α) => σ a) l₁ l₂)) (List.sum.{0} Nat instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) (List.map.{u2, 0} α Nat (fun (a : α) => List.length.{u1} (σ a) (l₂ a)) l₁))
-Case conversion may be inaccurate. Consider using '#align list.length_sigma List.length_sigmaₓ'. -/
theorem length_sigma (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
length (l₁.Sigma l₂) = (l₁.map fun a => length (l₂ a)).Sum := by
induction' l₁ with x l₁ IH <;>
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -81,9 +81,11 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align list.length_product List.length_productₓ'. -/
theorem length_product (l₁ : List α) (l₂ : List β) :
length (product l₁ l₂) = length l₁ * length l₂ := by
- induction' l₁ with x l₁ IH <;> [exact (MulZeroClass.zero_mul _).symm,
- simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
- add_comm]]
+ induction' l₁ with x l₁ IH <;>
+ [exact
+ (MulZeroClass.zero_mul
+ _).symm;simp only [length, product_cons, length_append, IH, right_distrib, one_mul,
+ length_map, add_comm]]
#align list.length_product List.length_product
/-! ### sigma -/
@@ -143,8 +145,8 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align list.length_sigma List.length_sigmaₓ'. -/
theorem length_sigma (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
length (l₁.Sigma l₂) = (l₁.map fun a => length (l₂ a)).Sum := by
- induction' l₁ with x l₁ IH <;> [rfl,
- simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]]
+ induction' l₁ with x l₁ IH <;>
+ [rfl;simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]]
#align list.length_sigma List.length_sigma
end List
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -81,7 +81,7 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align list.length_product List.length_productₓ'. -/
theorem length_product (l₁ : List α) (l₂ : List β) :
length (product l₁ l₂) = length l₁ * length l₂ := by
- induction' l₁ with x l₁ IH <;> [exact (zero_mul _).symm,
+ induction' l₁ with x l₁ IH <;> [exact (MulZeroClass.zero_mul _).symm,
simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
add_comm]]
#align list.length_product List.length_product
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Data.List.Count
, Data.List.Dedup
, Data.List.ProdSigma
, Data.List.Range
, Data.List.Rotate
, Data.List.Zip
not depend on Data.List.BigOperators.Basic
.Data.List.BigOperators.Basic
. For the lemmas that were Nat
-specific, keep a version of them in the original file but stated using Nat.sum
.Nat.sum_eq_listSum (l : List Nat) : Nat.sum l = l.sum
.@@ -3,7 +3,7 @@ Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
-import Mathlib.Algebra.BigOperators.List.Basic
+import Mathlib.Data.List.Basic
import Mathlib.Data.Sigma.Basic
#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
@@ -51,9 +51,9 @@ theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
theorem length_product (l₁ : List α) (l₂ : List β) :
length (l₁ ×ˢ l₂) = length l₁ * length l₂ := by
induction' l₁ with x l₁ IH
- · exact (zero_mul _).symm
- · simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
- add_comm]
+ · exact (Nat.zero_mul _).symm
+ · simp only [length, product_cons, length_append, IH, Nat.add_mul, Nat.one_mul, length_map,
+ Nat.add_comm]
#align list.length_product List.length_product
/-! ### sigma -/
@@ -85,11 +85,11 @@ theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ
exists_eq_left, heq_iff_eq, exists_eq_right]
#align list.mem_sigma List.mem_sigma
-theorem length_sigma (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
- length (l₁.sigma l₂) = (l₁.map fun a => length (l₂ a)).sum := by
+/-- See `List.length_sigma` for the corresponding statement using `List.sum`. -/
+theorem length_sigma' (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
+ length (l₁.sigma l₂) = Nat.sum (l₁.map fun a ↦ length (l₂ a)) := by
induction' l₁ with x l₁ IH
· rfl
- · simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]
-#align list.length_sigma List.length_sigma
+ · simp only [map, sigma_cons, length_append, length_map, IH, Nat.sum_cons]
end List
Algebra.BigOperators.List
(#11729)
This is algebra and should be foldered as such.
@@ -3,8 +3,8 @@ Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
+import Mathlib.Algebra.BigOperators.List.Basic
import Mathlib.Data.Sigma.Basic
-import Mathlib.Data.List.BigOperators.Basic
#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -38,7 +38,7 @@ theorem product_cons (a : α) (l₁ : List α) (l₂ : List β) :
@[simp]
theorem product_nil : ∀ l : List α, l ×ˢ (@nil β) = []
| [] => rfl
- | _ :: l => by simp [product_cons, product_nil]
+ | _ :: l => by simp [product_cons, product_nil l]
#align list.product_nil List.product_nil
@[simp]
@@ -75,7 +75,7 @@ theorem sigma_cons (a : α) (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
@[simp]
theorem sigma_nil : ∀ l : List α, (l.sigma fun a => @nil (σ a)) = []
| [] => rfl
- | _ :: l => by simp [sigma_cons, sigma_nil]
+ | _ :: l => by simp [sigma_cons, sigma_nil l]
#align list.sigma_nil List.sigma_nil
@[simp]
@@ -3,6 +3,7 @@ Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
+import Mathlib.Data.Sigma.Basic
import Mathlib.Data.List.BigOperators.Basic
#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -16,7 +16,7 @@ living in `Prod` and `Sigma` types respectively. Their definitions can be found
-/
-variable {α β : Type _}
+variable {α β : Type*}
namespace List
@@ -58,7 +58,7 @@ theorem length_product (l₁ : List α) (l₂ : List β) :
/-! ### sigma -/
-variable {σ : α → Type _}
+variable {σ : α → Type*}
@[simp]
theorem nil_sigma (l : ∀ a, List (σ a)) : (@nil α).sigma l = [] :=
@@ -2,14 +2,11 @@
Copyright (c) 2015 Leonardo de Moura. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.list.prod_sigma
-! leanprover-community/mathlib commit dd71334db81d0bd444af1ee339a29298bef40734
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.List.BigOperators.Basic
+#align_import data.list.prod_sigma from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
+
/-!
# Lists in product and sigma types
SProd
to implement overloaded notation · ×ˢ ·
(#4200)
Currently, the following notations are changed from · ×ˢ ·
because Lean 4 can't deal with ambiguous notations.
| Definition | Notation |
| :
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Chris Hughes <chrishughes24@gmail.com>
@@ -27,31 +27,31 @@ namespace List
@[simp]
-theorem nil_product (l : List β) : product (@nil α) l = [] :=
+theorem nil_product (l : List β) : (@nil α) ×ˢ l = [] :=
rfl
#align list.nil_product List.nil_product
@[simp]
theorem product_cons (a : α) (l₁ : List α) (l₂ : List β) :
- product (a :: l₁) l₂ = map (fun b => (a, b)) l₂ ++ product l₁ l₂ :=
+ (a :: l₁) ×ˢ l₂ = map (fun b => (a, b)) l₂ ++ (l₁ ×ˢ l₂) :=
rfl
#align list.product_cons List.product_cons
@[simp]
-theorem product_nil : ∀ l : List α, product l (@nil β) = []
+theorem product_nil : ∀ l : List α, l ×ˢ (@nil β) = []
| [] => rfl
| _ :: l => by simp [product_cons, product_nil]
#align list.product_nil List.product_nil
@[simp]
theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
- (a, b) ∈ product l₁ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ := by
- simp_all [product, mem_bind, mem_map, Prod.ext_iff, exists_prop, and_left_comm, exists_and_left,
- exists_eq_left, exists_eq_right]
+ (a, b) ∈ l₁ ×ˢ l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ := by
+ simp_all [SProd.sprod, product, mem_bind, mem_map, Prod.ext_iff, exists_prop, and_left_comm,
+ exists_and_left, exists_eq_left, exists_eq_right]
#align list.mem_product List.mem_product
theorem length_product (l₁ : List α) (l₂ : List β) :
- length (product l₁ l₂) = length l₁ * length l₂ := by
+ length (l₁ ×ˢ l₂) = length l₁ * length l₂ := by
induction' l₁ with x l₁ IH
· exact (zero_mul _).symm
· simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
fix-comments.py
on all files.@@ -14,7 +14,7 @@ import Mathlib.Data.List.BigOperators.Basic
# Lists in product and sigma types
This file proves basic properties of `List.product` and `List.sigma`, which are list constructions
-living in `prod` and `sigma` types respectively. Their definitions can be found in
+living in `Prod` and `Sigma` types respectively. Their definitions can be found in
[`Data.List.Defs`](./defs). Beware, this is not about `List.prod`, the multiplicative product.
-/
@@ -52,9 +52,10 @@ theorem mem_product {l₁ : List α} {l₂ : List β} {a : α} {b : β} :
theorem length_product (l₁ : List α) (l₂ : List β) :
length (product l₁ l₂) = length l₁ * length l₂ := by
- induction' l₁ with x l₁ IH <;> [exact (zero_mul _).symm,
- simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
- add_comm]]
+ induction' l₁ with x l₁ IH
+ · exact (zero_mul _).symm
+ · simp only [length, product_cons, length_append, IH, right_distrib, one_mul, length_map,
+ add_comm]
#align list.length_product List.length_product
/-! ### sigma -/
@@ -82,14 +83,15 @@ theorem sigma_nil : ∀ l : List α, (l.sigma fun a => @nil (σ a)) = []
@[simp]
theorem mem_sigma {l₁ : List α} {l₂ : ∀ a, List (σ a)} {a : α} {b : σ a} :
Sigma.mk a b ∈ l₁.sigma l₂ ↔ a ∈ l₁ ∧ b ∈ l₂ a := by
- simp_all [List.sigma, mem_bind, mem_map, exists_prop, exists_and_left, and_left_comm,
+ simp [List.sigma, mem_bind, mem_map, exists_prop, exists_and_left, and_left_comm,
exists_eq_left, heq_iff_eq, exists_eq_right]
#align list.mem_sigma List.mem_sigma
theorem length_sigma (l₁ : List α) (l₂ : ∀ a, List (σ a)) :
length (l₁.sigma l₂) = (l₁.map fun a => length (l₂ a)).sum := by
- induction' l₁ with x l₁ IH <;> [rfl,
- simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]]
+ induction' l₁ with x l₁ IH
+ · rfl
+ · simp only [map, sigma_cons, length_append, length_map, IH, sum_cons]
#align list.length_sigma List.length_sigma
end List
The unported dependencies are