Skip to content

Commit

Permalink
feat(data/finset/basic): A finset that's a subset of a directed uni…
Browse files Browse the repository at this point in the history
…on is contained in one element (#13727)

Proves `directed.exists_mem_subset_of_finset_subset_bUnion`
Renames `finset.exists_mem_subset_of_subset_bUnion_of_directed_on` to `directed_on.exists_mem_subset_of_finset_subset_bUnion`
  • Loading branch information
awainverse committed Apr 29, 2022
1 parent 8624f6d commit a54db9a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
30 changes: 20 additions & 10 deletions src/data/finset/basic.lean
Expand Up @@ -835,27 +835,37 @@ begin
exact union_of singletons (symm hi),
end

lemma exists_mem_subset_of_subset_bUnion_of_directed_on {α ι : Type*}
{f : ι → set α} {c : set ι} {a : ι} (hac : a ∈ c) (hc : directed_on (λ i j, f i ⊆ f j) c)
{s : finset α} (hs : (s : set α) ⊆ ⋃ i ∈ c, f i) : ∃ i ∈ c, (s : set α) ⊆ f i :=
lemma _root_.directed.exists_mem_subset_of_finset_subset_bUnion {α ι : Type*} [hn : nonempty ι]
{f : ι → set α} (h : directed (⊆) f)
{s : finset α} (hs : (s : set α) ⊆ ⋃ i, f i) : ∃ i, (s : set α) ⊆ f i :=
begin
classical,
revert hs,
apply s.induction_on,
{ intros,
use [a, hac],
simp },
{ refine λ _, ⟨hn.some, _⟩,
simp only [coe_empty, set.empty_subset], },
{ intros b t hbt htc hbtc,
obtain ⟨i : ι , hic : i ∈ c, hti : (t : set α) ⊆ f i⟩ :=
obtain ⟨i : ι , hti : (t : set α) ⊆ f i⟩ :=
htc (set.subset.trans (t.subset_insert b) hbtc),
obtain ⟨j, hjc, hbj⟩ : ∃ j ∈ c, b ∈ f j,
obtain ⟨j, hbj⟩ : ∃ j, b ∈ f j,
by simpa [set.mem_Union₂] using hbtc (t.mem_insert_self b),
rcases hc j hjc i hic with ⟨k, hkc, hk, hk'⟩,
use [k, hkc],
rcases h j i with ⟨k, hk, hk'⟩,
use k,
rw [coe_insert, set.insert_subset],
exact ⟨hk hbj, trans hti hk'⟩ }
end

lemma _root_.directed_on.exists_mem_subset_of_finset_subset_bUnion {α ι : Type*}
{f : ι → set α} {c : set ι} (hn : c.nonempty) (hc : directed_on (λ i j, f i ⊆ f j) c)
{s : finset α} (hs : (s : set α) ⊆ ⋃ i ∈ c, f i) : ∃ i ∈ c, (s : set α) ⊆ f i :=
begin
rw set.bUnion_eq_Union at hs,
haveI := c.nonempty_coe_sort.2 hn,
obtain ⟨⟨i, hic⟩, hi⟩ :=
(directed_comp.2 hc.directed_coe).exists_mem_subset_of_finset_subset_bUnion hs,
exact ⟨i, hic, hi⟩
end

/-! #### inter -/

theorem inter_val_nd (s₁ s₂ : finset α) : (s₁ ∩ s₂).1 = ndinter s₁.1 s₂.1 := rfl
Expand Down
4 changes: 2 additions & 2 deletions src/linear_algebra/linear_independent.lean
Expand Up @@ -811,11 +811,11 @@ begin
dsimp [indep],
rw [linear_independent_comp_subtype],
intros f hsupport hsum,
rcases eq_empty_or_nonempty c with rfl | ⟨a, hac⟩,
rcases eq_empty_or_nonempty c with rfl | hn,
{ simpa using hsupport },
haveI : is_refl X r := ⟨λ _, set.subset.refl _⟩,
obtain ⟨I, I_mem, hI⟩ : ∃ I ∈ c, (f.support : set ι) ⊆ I :=
finset.exists_mem_subset_of_subset_bUnion_of_directed_on hac hc.directed_on hsupport,
hc.directed_on.exists_mem_subset_of_finset_subset_bUnion hn hsupport,
exact linear_independent_comp_subtype.mp I.2 f hI hsum },
have trans : transitive r := λ I J K, set.subset.trans,
obtain ⟨⟨I, hli : indep I⟩, hmax : ∀ a, r ⟨I, hli⟩ a → r a ⟨I, hli⟩⟩ :=
Expand Down

0 comments on commit a54db9a

Please sign in to comment.