@@ -3,6 +3,7 @@ Copyright (c) 2021 Aaron Anderson, Yaël Dillies. All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
44Authors: Aaron Anderson, Kevin Buzzard, Yaël Dillies, Eric Wieser
55-/
6+ import data.finset.sigma
67import data.finset.pairwise
78import data.finset.powerset
89import data.fintype.basic
7778lemma sup_indep.pairwise_disjoint (hs : s.sup_indep f) : (s : set ι).pairwise_disjoint f :=
7879λ a ha b hb hab, sup_singleton.subst $ hs (singleton_subset_iff.2 hb) ha $ not_mem_singleton.2 hab
7980
81+ lemma sup_indep.le_sup_iff (hs : s.sup_indep f) (hts : t ⊆ s) (hi : i ∈ s) (hf : ∀ i, f i ≠ ⊥) :
82+ f i ≤ t.sup f ↔ i ∈ t :=
83+ begin
84+ refine ⟨λ h, _, le_sup⟩,
85+ by_contra hit,
86+ exact hf i (disjoint_self.1 $ (hs hts hi hit).mono_right h),
87+ end
88+
8089/-- The RHS looks like the definition of `complete_lattice.independent`. -/
8190lemma sup_indep_iff_disjoint_erase [decidable_eq ι] :
8291 s.sup_indep f ↔ ∀ i ∈ s, disjoint (f i) ((s.erase i).sup f) :=
8392⟨λ hs i hi, hs (erase_subset _ _) hi (not_mem_erase _ _), λ hs t ht i hi hit,
8493 (hs i hi).mono_right (sup_mono $ λ j hj, mem_erase.2 ⟨ne_of_mem_of_not_mem hj hit, ht hj⟩)⟩
8594
95+ lemma sup_indep.image [decidable_eq ι] {s : finset ι'} {g : ι' → ι} (hs : s.sup_indep (f ∘ g)) :
96+ (s.image g).sup_indep f :=
97+ begin
98+ intros t ht i hi hit,
99+ rw mem_image at hi,
100+ obtain ⟨i, hi, rfl⟩ := hi,
101+ haveI : decidable_eq ι' := classical.dec_eq _,
102+ suffices hts : t ⊆ (s.erase i).image g,
103+ { refine (sup_indep_iff_disjoint_erase.1 hs i hi).mono_right ((sup_mono hts).trans _),
104+ rw sup_image },
105+ rintro j hjt,
106+ obtain ⟨j, hj, rfl⟩ := mem_image.1 (ht hjt),
107+ exact mem_image_of_mem _ (mem_erase.2 ⟨ne_of_apply_ne g (ne_of_mem_of_not_mem hjt hit), hj⟩),
108+ end
109+
110+ lemma sup_indep_map {s : finset ι'} {g : ι' ↪ ι} : (s.map g).sup_indep f ↔ s.sup_indep (f ∘ g) :=
111+ begin
112+ refine ⟨λ hs t ht i hi hit, _, λ hs, _⟩,
113+ { rw ←sup_map,
114+ exact hs (map_subset_map.2 ht) ((mem_map' _).2 hi) (by rwa mem_map') },
115+ { classical,
116+ rw map_eq_image,
117+ exact hs.image }
118+ end
119+
86120@[simp] lemma sup_indep_pair [decidable_eq ι] {i j : ι} (hij : i ≠ j) :
87121 ({i, j} : finset ι).sup_indep f ↔ disjoint (f i) (f j) :=
88122⟨λ h, h.pairwise_disjoint (by simp) (by simp) hij, λ h, begin
@@ -117,7 +151,7 @@ begin
117151 exact sup_indep_pair this ,
118152end
119153
120- lemma sup_indep.attach (hs : s.sup_indep f) : s.attach.sup_indep (f ∘ subtype.val ) :=
154+ lemma sup_indep.attach (hs : s.sup_indep f) : s.attach.sup_indep (λ a, f a ) :=
121155begin
122156 intros t ht i _ hi,
123157 classical,
@@ -128,6 +162,18 @@ begin
128162 rwa subtype.ext hji at hj,
129163end
130164
165+ @[simp] lemma sup_indep_attach : s.attach.sup_indep (λ a, f a) ↔ s.sup_indep f :=
166+ begin
167+ refine ⟨λ h t ht i his hit, _, sup_indep.attach⟩,
168+ classical,
169+ convert h (filter_subset (λ i, (i : ι) ∈ t) _) (mem_attach _ ⟨i, ‹_›⟩)
170+ (λ hi, hit $ by simpa using hi) using 1 ,
171+ refine eq_of_forall_ge_iff _,
172+ simp only [finset.sup_le_iff, mem_filter, mem_attach, true_and, function.comp_app, subtype.forall,
173+ subtype.coe_mk],
174+ exact λ a, forall_congr (λ j, ⟨λ h _, h, λ h hj, h (ht hj) hj⟩),
175+ end
176+
131177end lattice
132178
133179section distrib_lattice
@@ -156,6 +202,58 @@ lemma sup_indep.bUnion [decidable_eq ι] {s : finset ι'} {g : ι' → finset ι
156202 (s.bUnion g).sup_indep f :=
157203by { rw ←sup_eq_bUnion, exact hs.sup hg }
158204
205+ /-- Bind operation for `sup_indep`. -/
206+ lemma sup_indep.sigma {β : ι → Type *} {s : finset ι} {g : Π i, finset (β i)} {f : sigma β → α}
207+ (hs : s.sup_indep $ λ i, (g i).sup $ λ b, f ⟨i, b⟩)
208+ (hg : ∀ i ∈ s, (g i).sup_indep $ λ b, f ⟨i, b⟩) :
209+ (s.sigma g).sup_indep f :=
210+ begin
211+ rintro t ht ⟨i, b⟩ hi hit,
212+ rw finset.disjoint_sup_right,
213+ rintro ⟨j, c⟩ hj,
214+ have hbc := (ne_of_mem_of_not_mem hj hit).symm,
215+ replace hj := ht hj,
216+ rw mem_sigma at hi hj,
217+ obtain rfl | hij := eq_or_ne i j,
218+ { exact (hg _ hj.1 ).pairwise_disjoint hi.2 hj.2 (sigma_mk_injective.ne_iff.1 hbc) },
219+ { refine (hs.pairwise_disjoint hi.1 hj.1 hij).mono _ _,
220+ { convert le_sup hi.2 },
221+ { convert le_sup hj.2 } }
222+ end
223+
224+ lemma sup_indep.product {s : finset ι} {t : finset ι'} {f : ι × ι' → α}
225+ (hs : s.sup_indep $ λ i, t.sup $ λ i', f (i, i'))
226+ (ht : t.sup_indep $ λ i', s.sup $ λ i, f (i, i')) :
227+ (s.product t).sup_indep f :=
228+ begin
229+ rintro u hu ⟨i, i'⟩ hi hiu,
230+ rw finset.disjoint_sup_right,
231+ rintro ⟨j, j'⟩ hj,
232+ have hij := (ne_of_mem_of_not_mem hj hiu).symm,
233+ replace hj := hu hj,
234+ rw mem_product at hi hj,
235+ obtain rfl | hij := eq_or_ne i j,
236+ { refine (ht.pairwise_disjoint hi.2 hj.2 $ (prod.mk.inj_left _).ne_iff.1 hij).mono _ _,
237+ { convert le_sup hi.1 },
238+ { convert le_sup hj.1 } },
239+ { refine (hs.pairwise_disjoint hi.1 hj.1 hij).mono _ _,
240+ { convert le_sup hi.2 },
241+ { convert le_sup hj.2 } }
242+ end
243+
244+ lemma sup_indep_product_iff {s : finset ι} {t : finset ι'} {f : ι × ι' → α} :
245+ (s.product t).sup_indep f ↔
246+ s.sup_indep (λ i, t.sup $ λ i', f (i, i')) ∧ t.sup_indep (λ i', s.sup $ λ i, f (i, i')) :=
247+ begin
248+ refine ⟨_, λ h, h.1 .product h.2 ⟩,
249+ simp_rw sup_indep_iff_pairwise_disjoint,
250+ refine (λ h, ⟨λ i hi j hj hij, _, λ i hi j hj hij, _⟩);
251+ simp_rw [function.on_fun, finset.disjoint_sup_left, finset.disjoint_sup_right];
252+ intros i' hi' j' hj',
253+ { exact h (mk_mem_product hi hi') (mk_mem_product hj hj') (ne_of_apply_ne prod.fst hij) },
254+ { exact h (mk_mem_product hi' hi) (mk_mem_product hj' hj) (ne_of_apply_ne prod.snd hij) }
255+ end
256+
159257end distrib_lattice
160258end finset
161259
0 commit comments