Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e15e015

Browse files
committed
split(data/finset/sigma): Split off data.finset.basic (#10957)
This moves `finset.sigma` to a new file `data.finset.sigma`. I'm crediting Mario for 16d40d7
1 parent 3f16409 commit e15e015

File tree

4 files changed

+61
-43
lines changed

4 files changed

+61
-43
lines changed

src/data/finset/basic.lean

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ called `top` with `⊤ = univ`.
101101
* `finset.sdiff`: Defines the set difference `s \ t` for finsets `s` and `t`.
102102
* `finset.product`: Given finsets of `α` and `β`, defines finsets of `α × β`.
103103
For arbitrary dependent products, see `data.finset.pi`.
104-
* `finset.sigma`: Given finsets of `α` and `β`, defines finsets of the dependent sum type `Σ α, β`
105104
* `finset.bUnion`: Finite unions of finsets; given an indexing function `f : α → finset β` and a
106105
`s : finset α`, `s.bUnion f` is the union of all finsets of the form `f a` for `a ∈ s`.
107106
* `finset.bInter`: TODO: Implemement finite intersections.
@@ -2435,33 +2434,6 @@ bUnion_nonempty.2 $ hs.imp $ λ x hx, ⟨hx, ht x hx⟩
24352434

24362435
end bUnion
24372436

2438-
/-! ### sigma -/
2439-
section sigma
2440-
variables {σ : α → Type*} {s : finset α} {t : Πa, finset (σ a)}
2441-
2442-
/-- `sigma s t` is the set of dependent pairs `⟨a, b⟩` such that `a ∈ s` and `b ∈ t a`. -/
2443-
protected def sigma (s : finset α) (t : Πa, finset (σ a)) : finset (Σa, σ a) :=
2444-
⟨_, nodup_sigma s.2 (λ a, (t a).2)⟩
2445-
2446-
@[simp] theorem mem_sigma {p : sigma σ} : p ∈ s.sigma t ↔ p.1 ∈ s ∧ p.2 ∈ t (p.1) := mem_sigma
2447-
2448-
@[simp] theorem sigma_nonempty : (s.sigma t).nonempty ↔ ∃ x ∈ s, (t x).nonempty :=
2449-
by simp [finset.nonempty]
2450-
2451-
@[simp] theorem sigma_eq_empty : s.sigma t = ∅ ↔ ∀ x ∈ s, t x = ∅ :=
2452-
by simp only [← not_nonempty_iff_eq_empty, sigma_nonempty, not_exists]
2453-
2454-
@[mono] theorem sigma_mono {s₁ s₂ : finset α} {t₁ t₂ : Πa, finset (σ a)}
2455-
(H1 : s₁ ⊆ s₂) (H2 : ∀a, t₁ a ⊆ t₂ a) : s₁.sigma t₁ ⊆ s₂.sigma t₂ :=
2456-
λ ⟨x, sx⟩ H, let ⟨H3, H4⟩ := mem_sigma.1 H in mem_sigma.2 ⟨H1 H3, H2 x H4⟩
2457-
2458-
theorem sigma_eq_bUnion [decidable_eq (Σ a, σ a)] (s : finset α)
2459-
(t : Πa, finset (σ a)) :
2460-
s.sigma t = s.bUnion (λa, (t a).map $ embedding.sigma_mk a) :=
2461-
by { ext ⟨x, y⟩, simp [and.left_comm] }
2462-
2463-
end sigma
2464-
24652437
/-! ### disjoint -/
24662438
section disjoint
24672439
variable [decidable_eq α]

src/data/finset/lattice.lean

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,6 @@ end
118118
@[simp] lemma sup_attach (s : finset β) (f : β → α) : s.attach.sup (λ x, f x) = s.sup f :=
119119
(s.attach.sup_map (function.embedding.subtype _) f).symm.trans $ congr_arg _ attach_map_val
120120

121-
lemma sup_sigma {γ : β → Type*} (s : finset β) (t : Π i, finset (γ i)) (f : sigma γ → α) :
122-
(s.sigma t).sup f = s.sup (λ i, (t i).sup $ λ b, f ⟨i, b⟩) :=
123-
begin
124-
refine le_antisymm _ (sup_le (λ i hi, sup_le $ λ b hb, le_sup $ mem_sigma.2 ⟨hi, hb⟩)),
125-
refine sup_le _,
126-
rintro ⟨i, b⟩ hb,
127-
rw mem_sigma at hb,
128-
refine le_trans _ (le_sup hb.1),
129-
convert le_sup hb.2,
130-
end
131-
132121
/-- See also `finset.product_bUnion`. -/
133122
lemma sup_product_left (s : finset β) (t : finset γ) (f : β × γ → α) :
134123
(s.product t).sup f = s.sup (λ i, t.sup $ λ i', f ⟨i, i'⟩) :=
@@ -341,10 +330,6 @@ lemma inf_comm (s : finset β) (t : finset γ) (f : β → γ → α) :
341330
s.inf (λ b, t.inf (f b)) = t.inf (λ c, s.inf (λ b, f b c)) :=
342331
@sup_comm (order_dual α) _ _ _ _ _ _ _
343332

344-
lemma inf_sigma {γ : β → Type*} (s : finset β) (t : Π i, finset (γ i)) (f : sigma γ → α) :
345-
(s.sigma t).inf f = s.inf (λ i, (t i).inf $ λ b, f ⟨i, b⟩) :=
346-
@sup_sigma (order_dual α) _ _ _ _ _ _ _
347-
348333
lemma inf_product_left (s : finset β) (t : finset γ) (f : β × γ → α) :
349334
(s.product t).inf f = s.inf (λ i, t.inf $ λ i', f ⟨i, i'⟩) :=
350335
@sup_product_left (order_dual α) _ _ _ _ _ _ _

src/data/finset/sigma.lean

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/-
2+
Copyright (c) 2017 Mario Carneiro. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Mario Carneiro
5+
-/
6+
import data.finset.lattice
7+
8+
/-!
9+
# Finite sets in a sigma type
10+
11+
This file defines a `finset` construction on `Σ i, α i`.
12+
13+
## Main declarations
14+
15+
* `finset.sigma`: Given a finset `s` in `ι` and finsets `t i` in each `α i`, `s.sigma t` is the
16+
finset of the dependent sum `Σ i, α i`
17+
-/
18+
19+
open function multiset
20+
21+
namespace finset
22+
variables {ι β : Type*} {α : ι → Type*} (s s₁ s₂ : finset ι) (t t₁ t₂ : Π i, finset (α i))
23+
24+
/-- `s.sigma t` is the finset of dependent pairs `⟨i, a⟩` such that `i ∈ s` and `a ∈ t i`. -/
25+
protected def sigma : finset (Σ i, α i) := ⟨_, nodup_sigma s.2 (λ i, (t i).2)⟩
26+
27+
variables {s s₁ s₂ t t₁ t₂}
28+
29+
@[simp] lemma mem_sigma {a : Σ i, α i} : a ∈ s.sigma t ↔ a.1 ∈ s ∧ a.2 ∈ t a.1 := mem_sigma
30+
31+
@[simp] lemma sigma_nonempty : (s.sigma t).nonempty ↔ ∃ i ∈ s, (t i).nonempty :=
32+
by simp [finset.nonempty]
33+
34+
@[simp] lemma sigma_eq_empty : s.sigma t = ∅ ↔ ∀ i ∈ s, t i = ∅ :=
35+
by simp only [← not_nonempty_iff_eq_empty, sigma_nonempty, not_exists]
36+
37+
@[mono] lemma sigma_mono (hs : s₁ ⊆ s₂) (ht : ∀ i, t₁ i ⊆ t₂ i) : s₁.sigma t₁ ⊆ s₂.sigma t₂ :=
38+
λ ⟨i, a⟩ h, let ⟨hi, ha⟩ := mem_sigma.1 h in mem_sigma.2 ⟨hs hi, ht i ha⟩
39+
40+
lemma sigma_eq_bUnion [decidable_eq (Σ i, α i)] (s : finset ι) (t : Π i, finset (α i)) :
41+
s.sigma t = s.bUnion (λ i, (t i).map $ embedding.sigma_mk i) :=
42+
by { ext ⟨x, y⟩, simp [and.left_comm] }
43+
44+
variables (s t) (f : (Σ i, α i) → β)
45+
46+
lemma sup_sigma [semilattice_sup β] [order_bot β] :
47+
(s.sigma t).sup f = s.sup (λ i, (t i).sup $ λ b, f ⟨i, b⟩) :=
48+
begin
49+
refine (sup_le _).antisymm (sup_le $ λ i hi, sup_le $ λ b hb, le_sup $ mem_sigma.2 ⟨hi, hb⟩),
50+
rintro ⟨i, b⟩ hb,
51+
rw mem_sigma at hb,
52+
refine le_trans _ (le_sup hb.1),
53+
convert le_sup hb.2,
54+
end
55+
56+
lemma inf_sigma [semilattice_inf β] [order_top β] :
57+
(s.sigma t).inf f = s.inf (λ i, (t i).inf $ λ b, f ⟨i, b⟩) :=
58+
@sup_sigma _ (order_dual β) _ _ _ _ _ _
59+
60+
end finset

src/data/fintype/basic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import data.finset.option
99
import data.finset.pi
1010
import data.finset.powerset
1111
import data.finset.prod
12+
import data.finset.sigma
1213
import data.list.nodup_equiv_fin
1314
import data.sym.basic
1415
import data.ulift

0 commit comments

Comments
 (0)