The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V03. Sets, finite structures and big operators

Mathlib.Data.Finset.Piecewise

32 declarations. Mathlib docs · Source

theorem Finset.piecewise.congr_simp E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s s_1 : Finset ι),
  s = s_1 →
    ∀ (f f_1 : (i : ι) → π i),
      f = f_1 →
        ∀ (g g_1 : (i : ι) → π i),
          g = g_1 →
            ∀ {inst : (j : ι) → Decidable (j ∈ s)} [inst_1 : (j : ι) → Decidable (j ∈ s_1)] (i : ι),
              s.piecewise f g i = s_1.piecewise f_1 g_1 i

def Finset.piecewise E1 #

{ι : Type u_1} →
  {π : ι → Sort u_2} →
    (s : Finset ι) → ((i : ι) → π i) → ((i : ι) → π i) → [(j : ι) → Decidable (j ∈ s)] → (i : ι) → π i

s.piecewise f g is the function equal to f on the finset s, and to g on its complement.

theorem Finset.piecewise_insert_self E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : DecidableEq ι] {j : ι}
  [inst_1 : (i : ι) → Decidable (i ∈ insert j s)], (insert j s).piecewise f g j = f j

theorem Finset.piecewise_empty E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (f g : (i : ι) → π i) [inst : (i : ι) → Decidable (i ∈ ∅)], ∅.piecewise f g = g

theorem Finset.piecewise_coe E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)],
  (↑s).piecewise f g = s.piecewise f g

theorem Finset.piecewise_eq_of_mem E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)] {i : ι},
  i ∈ s → s.piecewise f g i = f i

theorem Finset.piecewise_eq_of_notMem E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)] {i : ι},
  i ∉ s → s.piecewise f g i = g i

theorem Finset.piecewise_congr E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {f f' g g' : (i : ι) → π i},
  (∀ i ∈ s, f i = f' i) → (∀ i ∉ s, g i = g' i) → s.piecewise f g = s.piecewise f' g'

theorem Finset.piecewise_insert_of_ne E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)]
  [inst_1 : DecidableEq ι] {i j : ι} [inst_2 : (i : ι) → Decidable (i ∈ insert j s)],
  i ≠ j → (insert j s).piecewise f g i = s.piecewise f g i

theorem Finset.piecewise_insert E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)]
  [inst_1 : DecidableEq ι] (j : ι) [inst_2 : (i : ι) → Decidable (i ∈ insert j s)],
  (insert j s).piecewise f g = Function.update (s.piecewise f g) j (f j)

theorem Finset.piecewise_cases E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)] {i : ι}
  (p : π i → Prop), p (f i) → p (g i) → p (s.piecewise f g i)

theorem Finset.piecewise_singleton E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (f g : (i : ι) → π i) [inst : DecidableEq ι] (i : ι),
  {i}.piecewise f g = Function.update g i (f i)

theorem Finset.piecewise_piecewise_of_subset_left E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} {s t : Finset ι} [inst : (i : ι) → Decidable (i ∈ s)]
  [inst_1 : (i : ι) → Decidable (i ∈ t)],
  s ⊆ t → ∀ (f₁ f₂ g : (a : ι) → π a), s.piecewise (t.piecewise f₁ f₂) g = s.piecewise f₁ g

theorem Finset.piecewise_idem_left E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] (f₁ f₂ g : (a : ι) → π a),
  s.piecewise (s.piecewise f₁ f₂) g = s.piecewise f₁ g

theorem Finset.piecewise_piecewise_of_subset_right E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} {s t : Finset ι} [inst : (i : ι) → Decidable (i ∈ s)]
  [inst_1 : (i : ι) → Decidable (i ∈ t)],
  t ⊆ s → ∀ (f g₁ g₂ : (a : ι) → π a), s.piecewise f (t.piecewise g₁ g₂) = s.piecewise f g₂

theorem Finset.piecewise_idem_right E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] (f g₁ g₂ : (a : ι) → π a),
  s.piecewise f (s.piecewise g₁ g₂) = s.piecewise f g₂

theorem Finset.update_eq_piecewise E1 #

∀ {ι : Type u_1} {β : Type u_3} [inst : DecidableEq ι] (f : ι → β) (i : ι) (v : β),
  Function.update f i v = {i}.piecewise (fun x ↦ v) f

theorem Finset.update_piecewise E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)]
  [inst_1 : DecidableEq ι] (i : ι) (v : π i),
  Function.update (s.piecewise f g) i v = s.piecewise (Function.update f i v) (Function.update g i v)

theorem Finset.update_piecewise_of_mem E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)]
  [inst_1 : DecidableEq ι] {i : ι},
  i ∈ s → ∀ (v : π i), Function.update (s.piecewise f g) i v = s.piecewise (Function.update f i v) g

theorem Finset.update_piecewise_of_notMem E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f g : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)]
  [inst_1 : DecidableEq ι] {i : ι},
  i ∉ s → ∀ (v : π i), Function.update (s.piecewise f g) i v = s.piecewise f (Function.update g i v)

theorem Finset.piecewise_same E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} (s : Finset ι) (f : (i : ι) → π i) [inst : (j : ι) → Decidable (j ∈ s)],
  s.piecewise f f = f

theorem Finset.piecewise_univ E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} [inst : Fintype ι] [inst_1 : (i : ι) → Decidable (i ∈ Finset.univ)]
  (f g : (i : ι) → π i), Finset.univ.piecewise f g = f

theorem Finset.piecewise_compl E1 #

∀ {ι : Type u_1} {π : ι → Sort u_2} [inst : Fintype ι] [inst_1 : DecidableEq ι] (s : Finset ι)
  [inst_2 : (i : ι) → Decidable (i ∈ s)] [inst_3 : (i : ι) → Decidable (i ∈ sᶜ)] (f g : (i : ι) → π i),
  sᶜ.piecewise f g = s.piecewise g f

theorem Finset.piecewise_erase_univ E0 #

∀ {ι : Type u_1} {π : ι → Sort u_2} [inst : Fintype ι] [inst_1 : DecidableEq ι] (i : ι) (f g : (i : ι) → π i),
  (Finset.univ.erase i).piecewise f g = Function.update f i (g i)

theorem Finset.piecewise_mem_set_pi E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {t : Set ι}
  {t' : (i : ι) → Set (π i)} {f g : (i : ι) → π i}, f ∈ t.pi t' → g ∈ t.pi t' → s.piecewise f g ∈ t.pi t'

theorem Finset.piecewise_le_of_le_of_le E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g h : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)], f ≤ h → g ≤ h → s.piecewise f g ≤ h

theorem Finset.le_piecewise_of_le_of_le E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g h : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)], h ≤ f → h ≤ g → h ≤ s.piecewise f g

theorem Finset.piecewise_le_piecewise' E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g f' g' : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)],
  (∀ x ∈ s, f x ≤ f' x) → (∀ x ∉ s, g x ≤ g' x) → s.piecewise f g ≤ s.piecewise f' g'

theorem Finset.piecewise_le_piecewise E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g f' g' : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)], f ≤ f' → g ≤ g' → s.piecewise f g ≤ s.piecewise f' g'

theorem Finset.piecewise_mem_Icc_of_mem_of_mem E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g f' g' : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)], f ∈ Set.Icc f' g' → g ∈ Set.Icc f' g' → s.piecewise f g ∈ Set.Icc f' g'

theorem Finset.piecewise_mem_Icc E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)], f ≤ g → s.piecewise f g ∈ Set.Icc f g

theorem Finset.piecewise_mem_Icc' E1 #

∀ {ι : Type u_1} (s : Finset ι) [inst : (j : ι) → Decidable (j ∈ s)] {π : ι → Type u_3} {f g : (i : ι) → π i}
  [inst_1 : (i : ι) → Preorder (π i)], g ≤ f → s.piecewise f g ∈ Set.Icc g f