Skip to content

Commit

Permalink
chore: adaptations for nightly-2024-10-17 (#17872)
Browse files Browse the repository at this point in the history
Co-authored-by: Anne C.A. Baanen <[email protected]>
Co-authored-by: leanprover-community-mathlib4-bot <[email protected]>
Co-authored-by: Kim Morrison <[email protected]>
  • Loading branch information
4 people committed Oct 20, 2024
1 parent 3ed6b80 commit 11bb174
Show file tree
Hide file tree
Showing 43 changed files with 276 additions and 253 deletions.
22 changes: 14 additions & 8 deletions Mathlib/Algebra/BigOperators/Group/List.lean
Original file line number Diff line number Diff line change
Expand Up @@ -652,16 +652,22 @@ lemma mem_mem_ranges_iff_lt_sum (l : List ℕ) {n : ℕ} :
(∃ s ∈ l.ranges, n ∈ s) ↔ n < l.sum := by simp [mem_mem_ranges_iff_lt_natSum]

@[simp]
theorem length_bind (l : List α) (f : α → List β) :
length (List.bind l f) = sum (map (length ∘ f) l) := by
rw [List.bind, length_flatten, map_map]
theorem length_flatMap (l : List α) (f : α → List β) :
length (List.flatMap l f) = sum (map (length ∘ f) l) := by
rw [List.flatMap, length_flatten, map_map]

lemma countP_bind (p : β → Bool) (l : List α) (f : α → List β) :
countP p (l.bind f) = sum (map (countP p ∘ f) l) := by
rw [List.bind, countP_flatten, map_map]
@[deprecated (since := "2024-10-16")] alias length_bind := length_flatMap

lemma count_bind [BEq β] (l : List α) (f : α → List β) (x : β) :
count x (l.bind f) = sum (map (count x ∘ f) l) := countP_bind _ _ _
lemma countP_flatMap (p : β → Bool) (l : List α) (f : α → List β) :
countP p (l.flatMap f) = sum (map (countP p ∘ f) l) := by
rw [List.flatMap, countP_flatten, map_map]

@[deprecated (since := "2024-10-16")] alias countP_bind := countP_flatMap

lemma count_flatMap [BEq β] (l : List α) (f : α → List β) (x : β) :
count x (l.flatMap f) = sum (map (count x ∘ f) l) := countP_flatMap _ _ _

@[deprecated (since := "2024-10-16")] alias count_bind := count_flatMap

/-- In a flatten, taking the first elements up to an index which is the sum of the lengths of the
first `i` sublists, is the same as taking the flatten of the first `i` sublists. -/
Expand Down
1 change: 0 additions & 1 deletion Mathlib/Algebra/Group/Pi/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon, Patrick Massot, Eric Wieser
-/
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Prod.Basic
import Mathlib.Data.Sum.Basic
import Mathlib.Logic.Unique
import Mathlib.Tactic.Spread
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/AlgebraicTopology/SimplicialSet/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ def edge (n : ℕ) (i a b : Fin (n+1)) (hab : a ≤ b) (H : Finset.card {i, a, b
refine ⟨standardSimplex.edge n a b hab, ?range⟩
case range =>
suffices ∃ x, ¬i = x ∧ ¬a = x ∧ ¬b = x by
simpa only [unop_op, SimplexCategory.len_mk, asOrderHom, SimplexCategory.Hom.toOrderHom_mk,
Set.union_singleton, ne_eq, ← Set.univ_subset_iff, Set.subset_def, Set.mem_univ,
Set.mem_insert_iff, @eq_comm _ _ i, Set.mem_range, forall_true_left, not_forall, not_or,
not_exists, Fin.forall_fin_two]
simpa only [unop_op, len_mk, Nat.reduceAdd, asOrderHom, yoneda_obj_obj, Set.union_singleton,
ne_eq, ← Set.univ_subset_iff, Set.subset_def, Set.mem_univ, Set.mem_insert_iff,
@eq_comm _ _ i, Set.mem_range, forall_const, not_forall, not_or, not_exists,
Fin.forall_fin_two, Fin.isValue]
contrapose! H
replace H : univ ⊆ {i, a, b} :=
fun x _ ↦ by simpa [or_iff_not_imp_left, eq_comm] using H x
Expand Down
1 change: 0 additions & 1 deletion Mathlib/CategoryTheory/Pi/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Authors: Simon Hudon, Kim Morrison
import Mathlib.CategoryTheory.EqToHom
import Mathlib.CategoryTheory.NatIso
import Mathlib.CategoryTheory.Products.Basic
import Batteries.Data.Sum.Basic

/-!
# Categories of indexed families of objects.
Expand Down
1 change: 0 additions & 1 deletion Mathlib/Combinatorics/Quiver/Symmetric.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Authors: David Wärn, Antoine Labelle, Rémi Bottinelli
-/
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
import Batteries.Data.Sum.Lemmas

/-!
## Symmetric quivers and arrow reversal
Expand Down
22 changes: 12 additions & 10 deletions Mathlib/Computability/Primrec.lean
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,10 @@ theorem list_flatten : Primrec (@List.flatten α) :=

@[deprecated (since := "2024-10-15")] alias list_join := list_flatten

theorem list_bind {f : α → List β} {g : α → β → List σ} (hf : Primrec f) (hg : Primrec₂ g) :
Primrec (fun a => (f a).bind (g a)) := list_flatten.comp (list_map hf hg)
theorem list_flatMap {f : α → List β} {g : α → β → List σ} (hf : Primrec f) (hg : Primrec₂ g) :
Primrec (fun a => (f a).flatMap (g a)) := list_flatten.comp (list_map hf hg)

@[deprecated (since := "2024-10-16")] alias list_bind := list_flatMap

theorem optionToList : Primrec (Option.toList : Option α → List α) :=
(option_casesOn Primrec.id (const [])
Expand All @@ -961,8 +963,8 @@ theorem optionToList : Primrec (Option.toList : Option α → List α) :=

theorem listFilterMap {f : α → List β} {g : α → β → Option σ}
(hf : Primrec f) (hg : Primrec₂ g) : Primrec fun a => (f a).filterMap (g a) :=
(list_bind hf (comp₂ optionToList hg)).of_eq
fun _ ↦ Eq.symm <| List.filterMap_eq_bind_toList _ _
(list_flatMap hf (comp₂ optionToList hg)).of_eq
fun _ ↦ Eq.symm <| List.filterMap_eq_flatMap_toList _ _

theorem list_length : Primrec (@List.length α) :=
(list_foldr (@Primrec.id (List α) _) (const 0) <| to₂ <| (succ.comp <| snd.comp snd).to₂).of_eq
Expand Down Expand Up @@ -1010,16 +1012,16 @@ theorem nat_omega_rec' (f : β → σ) {m : β → ℕ} {l : β → List β} {g
(Ord : ∀ b, ∀ b' ∈ l b, m b' < m b)
(H : ∀ b, g b ((l b).map f) = some (f b)) : Primrec f := by
haveI : DecidableEq β := Encodable.decidableEqOfEncodable β
let mapGraph (M : List (β × σ)) (bs : List β) : List σ := bs.bind (Option.toList <| M.lookup ·)
let bindList (b : β) : ℕ → List β := fun n ↦ n.rec [b] fun _ bs ↦ bs.bind l
let mapGraph (M : List (β × σ)) (bs : List β) : List σ := bs.flatMap (Option.toList <| M.lookup ·)
let bindList (b : β) : ℕ → List β := fun n ↦ n.rec [b] fun _ bs ↦ bs.flatMap l
let graph (b : β) : ℕ → List (β × σ) := fun i ↦ i.rec [] fun i ih ↦
(bindList b (m b - i)).filterMap fun b' ↦ (g b' <| mapGraph ih (l b')).map (b', ·)
have mapGraph_primrec : Primrec₂ mapGraph :=
to₂ <| list_bind snd <| optionToList.comp₂ <| listLookup.comp₂ .right (fst.comp₂ .left)
to₂ <| list_flatMap snd <| optionToList.comp₂ <| listLookup.comp₂ .right (fst.comp₂ .left)
have bindList_primrec : Primrec₂ (bindList) :=
nat_rec' snd
(list_cons.comp fst (const []))
(to₂ <| list_bind (snd.comp snd) (hl.comp₂ .right))
(to₂ <| list_flatMap (snd.comp snd) (hl.comp₂ .right))
have graph_primrec : Primrec₂ (graph) :=
to₂ <| nat_rec' snd (const []) <|
to₂ <| listFilterMap
Expand Down Expand Up @@ -1055,15 +1057,15 @@ theorem nat_omega_rec' (f : β → σ) {m : β → ℕ} {l : β → List β} {g
have graph_succ : ∀ i, graph b (i + 1) =
(bindList b (m b - i)).filterMap fun b' =>
(g b' <| mapGraph (graph b i) (l b')).map (b', ·) := fun _ => rfl
have bindList_succ : ∀ i, bindList b (i + 1) = (bindList b i).bind l := fun _ => rfl
have bindList_succ : ∀ i, bindList b (i + 1) = (bindList b i).flatMap l := fun _ => rfl
induction' i with i ih
· symm; simpa [graph] using bindList_eq_nil
· simp only [graph_succ, ih (Nat.le_of_lt hi), Nat.succ_sub (Nat.lt_succ.mp hi),
Nat.succ_eq_add_one, bindList_succ, Nat.reduceSubDiff]
apply List.filterMap_eq_map_iff_forall_eq_some.mpr
intro b' ha'; simp; rw [mapGraph_graph]
· exact H b'
· exact (List.infix_bind_of_mem ha' l).subset
· exact (List.infix_flatMap_of_mem ha' l).subset
simp [graph_eq_map_bindList (m b + 1) (Nat.le_refl _), bindList]

theorem nat_omega_rec (f : α → β → σ) {m : α → β → ℕ}
Expand Down
35 changes: 21 additions & 14 deletions Mathlib/Computability/TuringMachine.lean
Original file line number Diff line number Diff line change
Expand Up @@ -419,29 +419,36 @@ theorem ListBlank.append_assoc {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) (l₃ :
suffices append (l₁ ++ l₂) (mk l) = append l₁ (append l₂ (mk l)) by exact this
simp only [ListBlank.append_mk, List.append_assoc]

/-- The `bind` function on lists is well defined on `ListBlank`s provided that the default element
is sent to a sequence of default elements. -/
def ListBlank.bind {Γ Γ'} [Inhabited Γ] [Inhabited Γ'] (l : ListBlank Γ) (f : Γ → List Γ')
/-- The `flatMap` function on lists is well defined on `ListBlank`s provided that the default
element is sent to a sequence of default elements. -/
def ListBlank.flatMap {Γ Γ'} [Inhabited Γ] [Inhabited Γ'] (l : ListBlank Γ) (f : Γ → List Γ')
(hf : ∃ n, f default = List.replicate n default) : ListBlank Γ' := by
apply l.liftOn (fun l ↦ ListBlank.mk (List.bind l f))
apply l.liftOn (fun l ↦ ListBlank.mk (List.flatMap l f))
rintro l _ ⟨i, rfl⟩; cases' hf with n e; refine Quotient.sound' (Or.inl ⟨i * n, ?_⟩)
rw [List.append_bind, mul_comm]; congr
rw [List.flatMap_append, mul_comm]; congr
induction' i with i IH
· rfl
simp only [IH, e, List.replicate_add, Nat.mul_succ, add_comm, List.replicate_succ, List.cons_bind]

@[deprecated (since := "2024-10-16")] alias ListBlank.bind := ListBlank.flatMap

@[simp]
theorem ListBlank.bind_mk {Γ Γ'} [Inhabited Γ] [Inhabited Γ'] (l : List Γ) (f : Γ → List Γ') (hf) :
(ListBlank.mk l).bind f hf = ListBlank.mk (l.bind f) :=
theorem ListBlank.flatMap_mk
{Γ Γ'} [Inhabited Γ] [Inhabited Γ'] (l : List Γ) (f : Γ → List Γ') (hf) :
(ListBlank.mk l).flatMap f hf = ListBlank.mk (l.flatMap f) :=
rfl

@[deprecated (since := "2024-10-16")] alias ListBlank.bind_mk := ListBlank.flatMap_mk

@[simp]
theorem ListBlank.cons_bind {Γ Γ'} [Inhabited Γ] [Inhabited Γ'] (a : Γ) (l : ListBlank Γ)
(f : Γ → List Γ') (hf) : (l.cons a).bind f hf = (l.bind f hf).append (f a) := by
theorem ListBlank.cons_flatMap {Γ Γ'} [Inhabited Γ] [Inhabited Γ'] (a : Γ) (l : ListBlank Γ)
(f : Γ → List Γ') (hf) : (l.cons a).flatMap f hf = (l.flatMap f hf).append (f a) := by
refine l.inductionOn fun l ↦ ?_
-- Porting note: Added `suffices` to get `simp` to work.
suffices ((mk l).cons a).bind f hf = ((mk l).bind f hf).append (f a) by exact this
simp only [ListBlank.append_mk, ListBlank.bind_mk, ListBlank.cons_mk, List.cons_bind]
suffices ((mk l).cons a).flatMap f hf = ((mk l).flatMap f hf).append (f a) by exact this
simp only [ListBlank.append_mk, ListBlank.flatMap_mk, ListBlank.cons_mk, List.cons_flatMap]

@[deprecated (since := "2024-10-16")] alias ListBlank.cons_bind := ListBlank.cons_flatMap

/-- The tape of a Turing machine is composed of a head element (which we imagine to be the
current position of the head), together with two `ListBlank`s denoting the portions of the tape
Expand Down Expand Up @@ -1548,8 +1555,8 @@ variable {enc}
/-- The low level tape corresponding to the given tape over alphabet `Γ`. -/
def trTape' (L R : ListBlank Γ) : Tape Bool := by
refine
Tape.mk' (L.bind (fun x ↦ (enc x).toList.reverse) ⟨n, ?_⟩)
(R.bind (fun x ↦ (enc x).toList) ⟨n, ?_⟩) <;>
Tape.mk' (L.flatMap (fun x ↦ (enc x).toList.reverse) ⟨n, ?_⟩)
(R.flatMap (fun x ↦ (enc x).toList) ⟨n, ?_⟩) <;>
simp only [enc0, Vector.replicate, List.reverse_replicate, Bool.default_bool, Vector.toList_mk]

/-- The low level tape corresponding to the given tape over alphabet `Γ`. -/
Expand All @@ -1575,7 +1582,7 @@ variable {enc}
theorem trTape'_move_left (L R : ListBlank Γ) :
(Tape.move Dir.left)^[n] (trTape' enc0 L R) = trTape' enc0 L.tail (R.cons L.head) := by
obtain ⟨a, L, rfl⟩ := L.exists_cons
simp only [trTape', ListBlank.cons_bind, ListBlank.head_cons, ListBlank.tail_cons]
simp only [trTape', ListBlank.cons_flatMap, ListBlank.head_cons, ListBlank.tail_cons]
suffices ∀ {L' R' l₁ l₂} (_ : Vector.toList (enc a) = List.reverseAux l₁ l₂),
(Tape.move Dir.left)^[l₁.length]
(Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
Expand Down
1 change: 0 additions & 1 deletion Mathlib/Control/Bifunctor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Authors: Simon Hudon
-/
import Mathlib.Control.Functor
import Mathlib.Tactic.Common
import Batteries.Data.Sum.Basic

/-!
# Functors with two arguments
Expand Down
31 changes: 31 additions & 0 deletions Mathlib/Data/BitVec.lean
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,35 @@ instance : CommSemiring (BitVec w) :=
(fun _ => rfl) /- toFin_natCast -/
-- The statement in the new API would be: `n#(k.succ) = ((n / 2)#k).concat (n % 2 != 0)`

@[simp] lemma ofFin_neg {x : Fin (2 ^ w)} : ofFin (-x) = -(ofFin x) := by
rfl

@[simp] lemma ofFin_natCast (n : ℕ) : ofFin (n : Fin (2^w)) = n := by
rfl

lemma toFin_natCast (n : ℕ) : toFin (n : BitVec w) = n := by
rfl

theorem ofFin_intCast (z : ℤ) : ofFin (z : Fin (2^w)) = ↑z := by
cases w
case zero =>
simp only [eq_nil]
case succ w =>
simp only [Int.cast, IntCast.intCast]
unfold Int.castDef
cases' z with z z
· rfl
· rw [ofInt_negSucc_eq_not_ofNat]
simp only [Nat.cast_add, Nat.cast_one, neg_add_rev]
rw [← add_ofFin, ofFin_neg, ofFin_ofNat, ofNat_eq_ofNat, ofFin_neg, ofFin_natCast,
natCast_eq_ofNat, negOne_eq_allOnes, ← sub_toAdd, allOnes_sub_eq_not]

theorem toFin_intCast (z : ℤ) : toFin (z : BitVec w) = z := by
apply toFin_inj.mpr <| (ofFin_intCast z).symm

instance : CommRing (BitVec w) :=
toFin_injective.commRing _
toFin_zero toFin_one toFin_add toFin_mul toFin_neg toFin_sub
toFin_nsmul toFin_zsmul toFin_pow toFin_natCast toFin_intCast

end BitVec
4 changes: 2 additions & 2 deletions Mathlib/Data/Char.lean
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Provides a `LinearOrder` instance on `Char`. `Char` is the type of Unicode scala
instance : LinearOrder Char where
le_refl := fun _ => @le_refl ℕ _ _
le_trans := fun _ _ _ => @le_trans ℕ _ _ _ _
le_antisymm := fun _ _ h₁ h₂ => Char.eq_of_val_eq <| UInt32.eq_of_val_eq <| Fin.ext <|
@le_antisymm ℕ _ _ _ h₁ h₂
le_antisymm := fun _ _ h₁ h₂ => Char.eq_of_val_eq <| UInt32.eq_of_toBitVec_eq <|
BitVec.le_antisymm h₁ h₂
lt_iff_le_not_le := fun _ _ => @lt_iff_le_not_le ℕ _ _ _
le_total := fun _ _ => @le_total ℕ _ _ _
min := fun a b => if a ≤ b then a else b
Expand Down
18 changes: 9 additions & 9 deletions Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def antidiagonalTuple : ∀ k, ℕ → List (Fin k → ℕ)
| 0, 0 => [![]]
| 0, _ + 1 => []
| k + 1, n =>
(List.Nat.antidiagonal n).bind fun ni =>
(List.Nat.antidiagonal n).flatMap fun ni =>
(antidiagonalTuple k ni.2).map fun x => Fin.cons ni.1 x

@[simp]
Expand All @@ -79,7 +79,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
· decide
· simp [eq_comm]
| h x₀ x ih =>
simp_rw [Fin.sum_cons, antidiagonalTuple, List.mem_bind, List.mem_map,
simp_rw [Fin.sum_cons, antidiagonalTuple, List.mem_flatMap, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
@eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _),
← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right]
Expand All @@ -90,7 +90,7 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
· cases n
· simp
· simp [eq_comm]
simp_rw [antidiagonalTuple, List.nodup_bind]
simp_rw [antidiagonalTuple, List.nodup_flatMap]
constructor
· intro i _
exact (ih i.snd).map (Fin.cons_right_injective (α := fun _ => ℕ) i.fst)
Expand All @@ -113,17 +113,17 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0]
| 0 => (congr_arg fun x => [x]) <| Subsingleton.elim _ _
| k + 1 => by
rw [antidiagonalTuple, antidiagonal_zero, List.bind_singleton, antidiagonalTuple_zero_right k,
List.map_singleton]
rw [antidiagonalTuple, antidiagonal_zero, List.flatMap_singleton,
antidiagonalTuple_zero_right k, List.map_singleton]
exact congr_arg (fun x => [x]) Matrix.cons_zero_zero

@[simp]
theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = [![n]] := by
simp_rw [antidiagonalTuple, antidiagonal, List.range_succ, List.map_append, List.map_singleton,
Nat.sub_self, List.bind_append, List.bind_singleton, List.bind_map]
Nat.sub_self, List.flatMap_append, List.flatMap_singleton, List.flatMap_map]
conv_rhs => rw [← List.nil_append [![n]]]
congr 1
simp_rw [List.bind_eq_nil_iff, List.mem_range, List.map_eq_nil_iff]
simp_rw [List.flatMap_eq_nil_iff, List.mem_range, List.map_eq_nil_iff]
intro x hx
obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_lt hx
rw [add_assoc, add_tsub_cancel_left, antidiagonalTuple_zero_succ]
Expand All @@ -132,15 +132,15 @@ theorem antidiagonalTuple_two (n : ℕ) :
antidiagonalTuple 2 n = (antidiagonal n).map fun i => ![i.1, i.2] := by
rw [antidiagonalTuple]
simp_rw [antidiagonalTuple_one, List.map_singleton]
rw [List.map_eq_bind]
rw [List.map_eq_flatMap]
rfl

theorem antidiagonalTuple_pairwise_pi_lex :
∀ k n, (antidiagonalTuple k n).Pairwise (Pi.Lex (· < ·) @fun _ => (· < ·))
| 0, 0 => List.pairwise_singleton _ _
| 0, _ + 1 => List.Pairwise.nil
| k + 1, n => by
simp_rw [antidiagonalTuple, List.pairwise_bind, List.pairwise_map, List.mem_map,
simp_rw [antidiagonalTuple, List.pairwise_flatMap, List.pairwise_map, List.mem_map,
forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
simp only [mem_antidiagonal, Prod.forall, and_imp, forall_apply_eq_imp_iff₂]
simp only [Fin.pi_lex_lt_cons_cons, eq_self_iff_true, true_and, lt_self_iff_false,
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Data/FinEnum.lean
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
induction xs generalizing s with
| nil => simp [enum, eq_empty_iff_forall_not_mem]
| cons x xs ih =>
simp only [enum, List.bind_eq_bind, List.mem_bind, List.mem_cons, List.mem_singleton,
simp only [enum, List.bind_eq_flatMap, List.mem_flatMap, List.mem_cons, List.mem_singleton,
List.not_mem_nil, or_false, ih]
refine ⟨by aesop, fun hs => ⟨s.erase x, ?_⟩⟩
simp only [or_iff_not_imp_left] at hs
Expand All @@ -129,7 +129,7 @@ instance Subtype.finEnum [FinEnum α] (p : α → Prop) [DecidablePred p] : FinE
(by rintro ⟨x, h⟩; simpa)

instance (β : α → Type v) [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Sigma β) :=
ofList ((toList α).bind fun a => (toList (β a)).map <| Sigma.mk a)
ofList ((toList α).flatMap fun a => (toList (β a)).map <| Sigma.mk a)
(by intro x; cases x; simp)

instance PSigma.finEnum [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Σ'a, β a) :=
Expand Down
Loading

0 comments on commit 11bb174

Please sign in to comment.