Documentation

Projects.Util.Finset

@[simp]
theorem le_trans_simp {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
a bb ca c True
@[simp]
theorem le_trans_simp' {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
b ca ba c True
@[simp]
theorem le_total_simp {α : Type u_1} [ha : LinearOrder α] {a b : α} :
a b b a True
@[simp]
theorem le_antisymm_simp {α : Type u_1} [ha : LinearOrder α] {a b : α} :
a bb aa = b True
@[simp]
theorem lt_trans_simp {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
a < bb < ca < c True
@[simp]
theorem lt_trans_simp' {α : Type u_1} [ha : LinearOrder α] {a b c : α} :
b < ca < ba < c True
theorem Fintype.exi_iter_cycle {α : Type u_1} [ha : Fintype α] {f : αα} {x : α} :
∃ (n : ) (m : ), n < m f^[n] x = f^[m] x
@[simp]
theorem Fintype.complete' {α : Type u_1} [ha : Fintype α] {x : α} :
@[instance_reducible]
instance Fintype.instOfIsEmpty_projects {α : Type u_2} [h : IsEmpty α] :
Equations
@[instance_reducible]
noncomputable instance Fintype.instElemRange_projects {α : Type u_1} [ha : Fintype α] {β : Type u_2} {f : αβ} :
Equations
@[simp]
theorem Fintype.elems_eq_empty_iff {α : Type u_1} [ha : Fintype α] :
elems = ∀ (x : α), False
@[instance_reducible]
noncomputable instance Fintype.instElem_projects {α : Type u_1} [ha : Fintype α] {s : Set α} :
Fintype s
Equations
def Finset.fold' {α : Type u_1} {β : Type u_2} (s : Finset α) (f : βαβ) (z : β) (h : ∀ {acc : β} {x y : α}, f (f acc x) y = f (f acc y) x) :
β
Equations
Instances For
    theorem Finset.sum_eq_sum_of_fn_congr {α : Type u_4} {S : Finset α} {f g : α} (h : iS, f i = g i) :
    xS, f x = xS, g x
    @[simp]
    theorem Finset.sum_fn_set_eq {S : Finset } {f : } {a b : } (ha : a S) :
    xS, fn_set a b f x = xS, f x + b - f a
    @[simp]
    theorem Finset.sum_fn_swap_eq {S : Finset } {f : } {a b : } (ha : a S) (hb : b S) :
    xS, fn_swap a b f x = xS, f x
    def Finset.toSortedList {α : Type u_4} [h : LinearOrder α] (s : Finset α) :
    List α
    Equations
    Instances For
      noncomputable def Finset.mkRaw {α : Type u_4} {β : Type u_5} (f : αβ) :
      Equations
      Instances For
        @[simp]
        theorem Finset.toSortedList_toFinset {α : Type u_4} [h : LinearOrder α] {s : Finset α} :
        def Finset.mkRaw_comp {α : Type u_4} {β : Type u_5} [Fintype α] [LinearOrder α] [DecidableEq β] (f : αβ) :
        Equations
        Instances For
          @[simp]
          theorem Finset.mem_toList_iff {α : Type u_4} {s : Finset α} {x : α} :
          x s.toList x s
          @[simp]
          theorem Finset.mem_toSortedList_iff {α : Type u_4} [LinearOrder α] {s : Finset α} {x : α} :
          theorem Finset.mkRaw_eq {α : Type u_4} {β : Type u_5} [ha : Fintype α] [DecidableEq α] [DecidableEq β] {f : αβ} :
          @[simp]
          theorem Finset.mem_mkRaw_iff {α : Type u_4} {β : Type u_5} [Fintype α] {f : αβ} {b : β} :
          b mkRaw f ∃ (a : α), f a = b
          @[simp]
          theorem Finset.mem_mkRaw_comp_iff {α : Type u_4} {β : Type u_5} [Fintype α] [LinearOrder α] [DecidableEq β] {f : αβ} {b : β} :
          b mkRaw_comp f ∃ (a : α), f a = b
          @[simp]
          theorem Finset.mkRaw_comp_eq_mkRaw {α : Type u_4} {β : Type u_5} [Fintype α] [LinearOrder α] [DecidableEq β] {f : αβ} :
          @[simp]
          theorem Finset.mkRaw_const_of_nonempty {α : Type u_4} {β : Type u_5} [Fintype α] [Nonempty α] [DecidableEq α] [DecidableEq β] {b : β} :
          (mkRaw fun (x : α) => b) = {b}
          @[simp]
          theorem Finset.mkRaw_const_of_empty {α : Type u_4} {β : Type u_5} [IsEmpty α] [DecidableEq β] {b : β} :
          (mkRaw fun (x : α) => b) =
          theorem Finset.mkRaw_fin_succ_eq_insert {α : Type u_4} [ha : DecidableEq α] {n : } {f : Fin (n + 1)α} :
          mkRaw f = insert (f n, ) (mkRaw fun (x : Fin n) => match x with | k, hk => f k, )
          theorem Finset.mkRaw_card_le {α : Type u_4} {β : Type u_5} [ha₁ : Fintype α] {f : αβ} :
          theorem Finset.mkRaw_toSet_eq {α : Type u_4} {β : Type u_5} [ha : Fintype α] {f : αβ} :
          (mkRaw f) = Set.range f
          theorem Finset.card_eq_toSet_ncard {α : Type u_4} {s : Finset α} :
          s.card = (↑s).ncard
          theorem Finset.image_toSet_eq {α : Type u_4} {β : Type u_5} [DecidableEq β] {s : Finset α} {f : αβ} :
          f '' s = (image f s)
          theorem Finset.ncard_toSet {α : Type u_4} {s : Finset α} :
          (↑s).ncard = s.card
          theorem Finset.sum_eq_add_sum_erase_of_mem {α : Type u_4} [ha : DecidableEq α] {s : Finset α} {x : α} {f : α} (h : x s) :
          is, f i = f x + is.erase x, f i
          theorem Finset.eq_of_sum_eq_sum_and_forall_le {α : Type u_4} {s : Finset α} {f g : α} (h₁ : is, f i = is, g i) (h₂ : is, f i g i) {i : α} (h₃ : i s) :
          f i = g i
          theorem Multiset.card_eq_sum_count_of_subset {α : Type u_1} [ha : DecidableEq α] {m₁ m₂ : Multiset α} (h₁ : m₁ m₂) :
          m₁.card = im₁.toFinset m₂.toFinset, count i m₁
          @[simp]
          theorem Multiset.subset_add_left' {α : Type u_1} {m₁ m₂ : Multiset α} :
          m₁ m₁ + m₂
          @[simp]
          theorem Multiset.subset_add_right' {α : Type u_1} {m₁ m₂ : Multiset α} :
          m₁ m₂ + m₁
          theorem Multiset.eq_of_le_and_card_eq {α : Type u_1} {m₁ m₂ : Multiset α} (h₁ : m₁ m₂) (h₂ : m₁.card = m₂.card) :
          m₁ = m₂
          theorem Multiset.eq_of_le_and_le {α : Type u_1} {m₁ m₂ : Multiset α} (h₁ : m₁ m₂) (h₂ : m₂ m₁) :
          m₁ = m₂
          theorem Multiset.eq_of_nodup_and_subset_and_subset {α : Type u_1} {m₁ m₂ : Multiset α} (h₁ : m₁.Nodup) (h₂ : m₂.Nodup) (h₃ : m₁ m₂) (h₄ : m₂ m₁) :
          m₁ = m₂
          @[simp]
          theorem Multiset.card_filter_eq_eq_count {α : Type u_1} [ha : DecidableEq α] {m : Multiset α} {x : α} :
          (filter (fun (x_1 : α) => x = x_1) m).card = count x m
          theorem Multiset.map_eq_map_iff_loc {α : Type u_1} {β : Type u_2} {m₁ m₂ : Multiset α} {f : αβ} (hf : ∀ (x y : α), x m₁ x m₂y m₁ y m₂f x = f yx = y) :
          map f m₁ = map f m₂ m₁ = m₂
          @[simp]
          theorem Multiset.toList_ofList_perm {α : Type u_1} {xs : List α} :
          (↑xs).toList.Perm xs
          @[simp]
          theorem Multiset.nodup_out_iff {α : Type u_1} {m : Multiset α} :
          theorem List.subperm_of_subperm_and_length_eq {α : Type u_1} {xs ys : List α} (h₁ : xs.Subperm ys) (h₂ : xs.length = ys.length) :
          ys.Subperm xs
          theorem List.perm_of_nodup_and_subset_and_length_eq {α : Type u_1} {xs ys : List α} (hx : xs.Nodup) (h₁ : xs ys) (h₂ : xs.length = ys.length) :
          ys.Perm xs
          theorem List.subset_of_nodup_and_subset_and_length_eq {α : Type u_1} {xs ys : List α} (h₁ : xs.Nodup) (h₂ : xs ys) (h₃ : xs.length = ys.length) :
          ys xs
          theorem List.mem_iff_count_ne_zero {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} :
          x xs count x xs 0
          theorem List.perm_of_subset_and_nodup {α : Type u_1} {xs ys : List α} (h₁ : xs.Nodup) (h₂ : ys.Nodup) (h₃ : xs ys) (h₄ : ys xs) :
          xs.Perm ys
          theorem List.length_eq_of_subset_and_nodup {α : Type u_1} {xs ys : List α} (h₁ : xs.Nodup) (h₂ : ys.Nodup) (h₃ : xs ys) (h₄ : ys xs) :
          theorem List.map_perm_map_iff_loc {α : Type u_1} {β : Type u_2} {xs ys : List α} {f : αβ} (hf : ∀ (x y : α), x xs x ysy xs y ysf x = f yx = y) :
          (map f xs).Perm (map f ys) xs.Perm ys
          theorem List.nodup_of_nodup_and_subperm {α : Type u_1} {xs ys : List α} (h₁ : ys.Nodup) (h₂ : xs.Subperm ys) :
          theorem List.nodup_filterMap_iff {α : Type u_1} {β : Type u_2} {xs : List α} [ha : DecidableEq α] {f : αOption β} :
          (filterMap f xs).Nodup xxs, ∀ (y : β), f x = some ycount x xs 1 x'xs, f x' = some yx = x'
          theorem List.filterMap_perm_filterMap_iff_filter_map_perm {α : Type u_1} {β : Type u_2} {xs ys : List α} {f : αOption β} :
          theorem List.count_filter_pos {α : Type u_1} {xs : List α} [ha : DecidableEq α] {f : αBool} {x : α} (h : f x = true) :
          count x (filter f xs) = count x xs
          theorem List.count_filter_neg {α : Type u_1} {xs : List α} [ha : DecidableEq α] {f : αBool} {x : α} (h : f x = false) :
          count x (filter f xs) = 0
          theorem List.count_filter_neg' {α : Type u_1} {xs : List α} [ha : DecidableEq α] {f : αBool} {x : α} (h : ¬f x = true) :
          count x (filter f xs) = 0
          theorem List.count_filter_eq_ite {α : Type u_1} {xs : List α} [ha : DecidableEq α] {f : αBool} {x : α} :
          count x (filter f xs) = if f x = true then count x xs else 0
          theorem List.filter_perm_of_perm {α : Type u_1} {xs ys : List α} {f : αBool} (h : xs.Perm ys) :
          (filter f xs).Perm (filter f ys)
          theorem List.count_map_of_loc {α : Type u_1} {β : Type u_2} {xs : List α} [ha : DecidableEq α] [hb : DecidableEq β] {f : αβ} {x : α} (h : yxs, f x = f yx = y) :
          count (f x) (map f xs) = count x xs
          theorem List.count_map_eq_sum {α : Type u_1} {β : Type u_2} {xs : List α} [ha : DecidableEq α] [hb : DecidableEq β] {f : αβ} {y : β} :
          count y (map f xs) = xxs.toFinset, if f x = y then count x xs else 0
          @[simp]
          theorem List.cons_erase_perm_iff_mem {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} :
          (x :: xs.erase x).Perm xs x xs
          @[simp]
          theorem List.perm_cons_erase_iff_mem {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} :
          xs.Perm (x :: xs.erase x) x xs
          theorem List.le_max? {α : Type u_1} {xs : List α} [ha : LinearOrder α] {x m : α} (h₁ : x xs) (h₂ : xs.max? = some m) :
          x m
          theorem List.nodup_erase {α : Type u_1} {xs : List α} [ha : DecidableEq α] {x : α} (h : xs.Nodup) :
          (xs.erase x).Nodup
          theorem List.pairwise_erase {α : Type u_1} {xs : List α} [ha : DecidableEq α] {r : ααProp} {x : α} (h : Pairwise r xs) :
          Pairwise r (xs.erase x)
          theorem List.Perm.mapWith {α : Type u_1} {β : Type u_2} {xs ys : List α} {f : (x : α) → x xsβ} (h : xs.Perm ys) :
          (xs.mapWith f).Perm (ys.mapWith fun (x : α) (h₁ : x ys) => f x )
          @[simp]
          theorem Finset.nodup_out_val {α : Type u_1} {s : Finset α} :
          @[simp]
          theorem Finset.nodup_val {α : Type u_1} {s : Finset α} :
          @[simp]
          theorem Finset.mem_out_val {α : Type u_1} {s : Finset α} {x : α} :
          theorem Finset.card_insert_erase_eq {α : Type u_1} {s : Finset α} {x y : α} [ha : DecidableEq α] (h₁ : x s) (h₂ : ys) :
          (insert y (s.erase x)).card = s.card
          def Finset.map' {α : Type u_1} {β : Type u_2} [DecidableEq β] (s : Finset α) (f : αβ) :
          Equations
          Instances For
            @[simp]
            theorem Finset.mem_map'' {α : Type u_1} {β : Type u_2} {s : Finset α} [hb : DecidableEq β] {f : αβ} {y : β} :
            y s.map' f xs, f x = y
            theorem Finset.sum_range_list_get! {xs : List } {f : } :
            irange xs.length, f xs[i]! = (List.map f xs).sum
            theorem Finset.prod_range_list_get! {xs : List } {f : } :
            irange xs.length, f xs[i]! = (List.map f xs).prod
            theorem Finset.le_sum_range {a : } {N n : } (h : n < N) :
            |a n| irange N, |a i|
            theorem Finset.one_le_prod_of_forall_one_le {ι : Type u_4} {s : Finset ι} {f : ι} (h : is, 1 f i) :
            1 is, f i
            theorem Finset.sum_geom_eq {b : } {n : } (hb : b 1) :
            krange n, b ^ k = (1 - b ^ n) / (1 - b)
            theorem Finset.sum_add_geom_eq' {b : } {n : } (hb : b 1) :
            krange n, k * b ^ k = (b * krange n, b ^ k - n * b ^ n) / (1 - b)
            theorem Finset.sum_add_geom_eq {b : } {n : } (hb : b 1) :
            krange n, k * b ^ k = (b ^ n * (n * b - n - b) + b) / (1 - b) ^ 2
            theorem Finset.card_filter_range_le_of_le {p : Prop} {i j : } [hp : DecidablePred p] (h : i j) :
            (filter p (range i)).card (filter p (range j)).card
            theorem Finset.Ico_add_right {n m k : } (h : n m) :
            Ico n (m + k) = Ico n m Ico m (m + k)
            theorem Finset.card_filter_range_add {p : Prop} {n k : } [hp : DecidablePred p] :
            {irange (n + k) | p i}.card = {irange n | p i}.card + {iIco n (n + k) | p i}.card
            theorem Finset.card_eq_one_iff_exiu {α : Type u_1} {s : Finset α} :
            s.card = 1 ∃! x : α, x s
            theorem Finset.forall_iff_of_fintype {α : Type u_1} [ha : Fintype α] {p : αProp} :
            (∀ (x : α), p x) xFintype.elems, p x
            @[instance_reducible]
            instance Finset.instDecidableForallOfFintypeOfDecidablePred_projects {α : Type u_1} [ha : Fintype α] {p : αProp} [hp : DecidablePred p] :
            Decidable (∀ (x : α), p x)
            Equations