Skip to content

Commit

Permalink
Feat: add new Set.univ_pi_piecewise, rename the old lemma to `Set.u…
Browse files Browse the repository at this point in the history
…niv_pi_piecewise_univ` (#1904)
  • Loading branch information
urkud committed Jan 30, 2023
1 parent 2b13f3b commit 2f3db46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions Mathlib/Data/Set/Function.lean
Expand Up @@ -1526,16 +1526,18 @@ theorem piecewise_mem_pi {δ : α → Type _} {t : Set α} {t' : ∀ i, Set (δ

@[simp]
theorem pi_piecewise {ι : Type _} {α : ι → Type _} (s s' : Set ι) (t t' : ∀ i, Set (α i))
[∀ x, Decidable (x ∈ s')] : pi s (s'.piecewise t t') = pi (s ∩ s') t ∩ pi (s \ s') t' := by
ext x
simp only [mem_pi, mem_inter_iff, ← forall_and]
refine' forall_congr' fun i => _
by_cases hi : i ∈ s' <;> simp [*]
[∀ x, Decidable (x ∈ s')] : pi s (s'.piecewise t t') = pi (s ∩ s') t ∩ pi (s \ s') t' :=
pi_if _ _ _
#align set.pi_piecewise Set.pi_piecewise

theorem univ_pi_piecewise {ι : Type _} {α : ι → Type _} (s : Set ι) (t : ∀ i, Set (α i))
-- porting note: new lemma
theorem univ_pi_piecewise {ι : Type _} {α : ι → Type _} (s : Set ι) (t t' : ∀ i, Set (α i))
[∀ x, Decidable (x ∈ s)] : pi univ (s.piecewise t t') = pi s t ∩ pi (sᶜ) t' := by
simp [compl_eq_univ_diff]

theorem univ_pi_piecewise_univ {ι : Type _} {α : ι → Type _} (s : Set ι) (t : ∀ i, Set (α i))
[∀ x, Decidable (x ∈ s)] : pi univ (s.piecewise t fun _ => univ) = pi s t := by simp
#align set.univ_pi_piecewise Set.univ_pi_piecewise
#align set.univ_pi_piecewise Set.univ_pi_piecewise_univ

end Set

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Order/Filter/Pi.lean
Expand Up @@ -132,7 +132,7 @@ theorem pi_inf_principal_univ_pi_eq_bot : pi f ⊓ 𝓟 (Set.pi univ s) = ⊥
@[simp]
theorem pi_inf_principal_pi_eq_bot [∀ i, NeBot (f i)] {I : Set ι} :
pi f ⊓ 𝓟 (Set.pi I s) = ⊥ ↔ ∃ i ∈ I, f i ⊓ 𝓟 (s i) = ⊥ := by
rw [← univ_pi_piecewise I, pi_inf_principal_univ_pi_eq_bot]
rw [← univ_pi_piecewise_univ I, pi_inf_principal_univ_pi_eq_bot]
refine' exists_congr fun i => _
by_cases hi : i ∈ I <;> simp [hi, NeBot.ne']
#align filter.pi_inf_principal_pi_eq_bot Filter.pi_inf_principal_pi_eq_bot
Expand Down

0 comments on commit 2f3db46

Please sign in to comment.