@@ -3,7 +3,8 @@ Copyright (c) 2021 Yaël Dillies. All rights reserved.
3
3
Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Yaël Dillies
5
5
-/
6
- import data.finset.lattice
6
+ import data.finset.pairwise
7
+ import data.set.finite
7
8
8
9
/-!
9
10
# Finite supremum independence
@@ -13,6 +14,11 @@ sup-independent if, for all `a`, `f a` and the supremum of the rest are disjoint
13
14
14
15
In distributive lattices, this is equivalent to being pairwise disjoint.
15
16
17
+ ## Implementation notes
18
+
19
+ We avoid the "obvious" definition `∀ i ∈ s, disjoint (f i) ((s.erase i).sup f)` because `erase`
20
+ would require decidable equality on `ι`.
21
+
16
22
## TODO
17
23
18
24
`complete_lattice.independent` and `complete_lattice.set_independent` should live in this file.
@@ -21,74 +27,83 @@ In distributive lattices, this is equivalent to being pairwise disjoint.
21
27
variables {α β ι ι' : Type *}
22
28
23
29
namespace finset
24
- variables [lattice α] [order_bot α] [decidable_eq ι] [decidable_eq ι']
30
+ section lattice
31
+ variables [lattice α] [order_bot α]
25
32
26
- /-- Supremum independence of finite sets. -/
27
- def sup_indep (s : finset ι) (f : ι → α) : Prop := ∀ ⦃a⦄, a ∈ s → disjoint (f a) ((s.erase a).sup f)
33
+ /-- Supremum independence of finite sets. We avoid the "obvious" definition using`s.erase i` because
34
+ `erase` would require decidable equality on `ι`. -/
35
+ def sup_indep (s : finset ι) (f : ι → α) : Prop :=
36
+ ∀ ⦃t⦄, t ⊆ s → ∀ ⦃i⦄, i ∈ s → i ∉ t → disjoint (f i) (t.sup f)
28
37
29
- variables {s t : finset ι} {f : ι → α}
38
+ variables {s t : finset ι} {f : ι → α} {i : ι}
30
39
31
40
lemma sup_indep.subset (ht : t.sup_indep f) (h : s ⊆ t) : s.sup_indep f :=
32
- λ a ha, ( ht $ h ha).mono_right $ sup_mono $ erase_subset_erase _ h
41
+ λ u hu i hi, ht (hu.trans h) (h hi)
33
42
34
- lemma sup_indep_empty (f : ι → α) : (∅ : finset ι).sup_indep f := λ a ha, ha.elim
43
+ lemma sup_indep_empty (f : ι → α) : (∅ : finset ι).sup_indep f := λ _ _ a ha, ha.elim
35
44
36
45
lemma sup_indep_singleton (i : ι) (f : ι → α) : ({i} : finset ι).sup_indep f :=
37
- λ j hj, by { rw [mem_singleton.1 hj, erase_singleton, sup_empty], exact disjoint_bot_right }
46
+ λ s hs j hji hj, begin
47
+ rw [eq_empty_of_ssubset_singleton ⟨hs, λ h, hj (h hji)⟩, sup_empty],
48
+ exact disjoint_bot_right,
49
+ end
50
+
51
+ lemma sup_indep.pairwise_disjoint (hs : s.sup_indep f) : (s : set ι).pairwise_disjoint f :=
52
+ λ a ha b hb hab, sup_singleton.subst $ hs (singleton_subset_iff.2 hb) ha $ not_mem_singleton.2 hab
53
+
54
+ /-- The RHS looks like the definition of `complete_lattice.independent`. -/
55
+ lemma sup_indep_iff_disjoint_erase [decidable_eq ι] :
56
+ s.sup_indep f ↔ ∀ i ∈ s, disjoint (f i) ((s.erase i).sup f) :=
57
+ ⟨λ hs i hi, hs (erase_subset _ _) hi (not_mem_erase _ _), λ hs t ht i hi hit,
58
+ (hs i hi).mono_right (sup_mono $ λ j hj, mem_erase.2 ⟨ne_of_mem_of_not_mem hj hit, ht hj⟩)⟩
38
59
39
60
lemma sup_indep.attach (hs : s.sup_indep f) : s.attach.sup_indep (f ∘ subtype.val) :=
40
- λ i _,
41
- by { rw [←finset.sup_image, image_erase subtype.val_injective, attach_image_val], exact hs i.2 }
61
+ begin
62
+ intros t ht i _ hi,
63
+ classical,
64
+ rw ←finset.sup_image,
65
+ refine hs (image_subset_iff.2 $ λ (j : {x // x ∈ s}) _, j.2 ) i.2 (λ hi', hi _),
66
+ rw mem_image at hi',
67
+ obtain ⟨j, hj, hji⟩ := hi',
68
+ rwa subtype.ext hji at hj,
69
+ end
70
+
71
+ end lattice
72
+
73
+ section distrib_lattice
74
+ variables [distrib_lattice α] [order_bot α] {s : finset ι} {f : ι → α}
75
+
76
+ lemma sup_indep_iff_pairwise_disjoint : s.sup_indep f ↔ (s : set ι).pairwise_disjoint f :=
77
+ ⟨sup_indep.pairwise_disjoint, λ hs t ht i hi hit,
78
+ disjoint_sup_right.2 $ λ j hj, hs hi (ht hj) (ne_of_mem_of_not_mem hj hit).symm⟩
79
+
80
+ alias sup_indep_iff_pairwise_disjoint ↔ finset.sup_indep.pairwise_disjoint
81
+ set.pairwise_disjoint.sup_indep
42
82
43
83
/-- Bind operation for `sup_indep`. -/
44
- lemma sup_indep.sup {α} [distrib_lattice α] [order_bot α] {s : finset ι'} {g : ι' → finset ι}
45
- {f : ι → α} (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
84
+ lemma sup_indep.sup [decidable_eq ι] {s : finset ι'} {g : ι' → finset ι} {f : ι → α }
85
+ (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
46
86
(s.sup g).sup_indep f :=
47
87
begin
48
- rintro i hi,
49
- rw disjoint_sup_right,
50
- refine λ j hj, _,
51
- rw mem_sup at hi,
52
- obtain ⟨i', hi', hi⟩ := hi,
53
- rw [mem_erase, mem_sup] at hj,
54
- obtain ⟨hij, j', hj', hj⟩ := hj,
55
- obtain hij' | hij' := eq_or_ne j' i',
56
- { exact disjoint_sup_right.1 (hg i' hi' hi) _ (mem_erase.2 ⟨hij, hij'.subst hj⟩) },
57
- { exact (hs hi').mono (le_sup hi) ((le_sup hj).trans $ le_sup $ mem_erase.2 ⟨hij', hj'⟩) }
88
+ simp_rw sup_indep_iff_pairwise_disjoint at ⊢ hs hg,
89
+ rw [sup_eq_bUnion, coe_bUnion],
90
+ exact hs.bUnion_finset hg,
58
91
end
59
92
60
93
/-- Bind operation for `sup_indep`. -/
61
- lemma sup_indep.bUnion {α} [distrib_lattice α] [order_bot α] {s : finset ι'} {g : ι' → finset ι}
62
- {f : ι → α} (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
94
+ lemma sup_indep.bUnion [decidable_eq ι] {s : finset ι'} {g : ι' → finset ι} {f : ι → α }
95
+ (hs : s.sup_indep (λ i, (g i).sup f)) (hg : ∀ i' ∈ s, (g i').sup_indep f) :
63
96
(s.bUnion g).sup_indep f :=
64
97
by { rw ←sup_eq_bUnion, exact hs.sup hg }
65
98
66
- lemma sup_indep.pairwise_disjoint (hs : s.sup_indep f) : (s : set ι).pairwise_disjoint f :=
67
- λ a ha b hb hab, (hs ha).mono_right $ le_sup $ mem_erase.2 ⟨hab.symm, hb⟩
68
-
69
- -- Once `finset.sup_indep` will have been generalized to non distributive lattices, can we state
70
- -- this lemma for nondistributive atomic lattices? This setting makes the `←` implication much
71
- -- harder.
72
- lemma sup_indep_iff_pairwise_disjoint {α} [distrib_lattice α] [order_bot α] {f : ι → α} :
73
- s.sup_indep f ↔ (s : set ι).pairwise_disjoint f :=
74
- begin
75
- refine ⟨λ hs a ha b hb hab, (hs ha).mono_right $ le_sup $ mem_erase.2 ⟨hab.symm, hb⟩,
76
- λ hs a ha, _⟩,
77
- rw disjoint_sup_right,
78
- exact λ b hb, hs ha (mem_of_mem_erase hb) (ne_of_mem_erase hb).symm,
79
- end
80
-
81
- alias sup_indep_iff_pairwise_disjoint ↔ finset.sup_indep.pairwise_disjoint
82
- set.pairwise_disjoint.sup_indep
83
-
99
+ end distrib_lattice
84
100
end finset
85
101
86
- -- TODO: Relax `complete_distrib_lattice` to `complete_lattice` once `finset.sup_indep` is general
87
- -- enough
88
- lemma complete_lattice.independent_iff_sup_indep [complete_distrib_lattice α] [decidable_eq ι]
89
- {s : finset ι} {f : ι → α} :
102
+ lemma complete_lattice.independent_iff_sup_indep [complete_lattice α] {s : finset ι} {f : ι → α} :
90
103
complete_lattice.independent (f ∘ (coe : s → ι)) ↔ s.sup_indep f :=
91
104
begin
105
+ classical,
106
+ rw finset.sup_indep_iff_disjoint_erase,
92
107
refine subtype.forall.trans (forall_congr $ λ a, forall_congr $ λ b, _),
93
108
rw finset.sup_eq_supr,
94
109
congr' 2 ,
0 commit comments