Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(Analysis/Convex): Helly's convexity theorem #7236

Closed
wants to merge 30 commits into from

Conversation

vasnesterov
Copy link
Collaborator

@vasnesterov vasnesterov commented Sep 18, 2023

  • Prove Helly's convexity theorem (including compact and set versions) and fix typos in Analysis.Convex.Radon
  • Add alias Set.sInter_mono in the style of Set.sUnion_mono
  • Mark encard_coe_eq_coe_finsetCard with simp and norm_cast

This PR is a natural continuation of my recent PR #6598, introducing Radon's theorem.

Open in Gitpod

@vasnesterov vasnesterov added awaiting-review t-analysis Analysis (normed *, calculus) labels Sep 18, 2023
Copy link
Collaborator

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just move this to the Analysis.Convex.Radon file, as that file only has the convex_partition declaration anyway, and the imports for the current file are not egregious.

This looks pretty good, but I haven't had an in-depth think about possible ways to improve the proof yet. I'll come back to that later. For now, here are a few comments.

@j-loreaux j-loreaux added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Sep 26, 2023
Copy link
Collaborator

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some comments below, but mainly I added them for your own benefit so you can see how I transformed the proof into what I am copying below. If you want, you can just copy this proof and resolve the conversations below after you have read and understand them. If you want me to explain any part of this proof I'm happy to. Note: it was not the case that your proof was bad. I'm only trying to show you alternative techniques that can make things a bit easier for you.

/-- **Helly's theorem on convex sets**: If `F` is a finite family of convex sets in a vector space
of finite dimension `d`, and any `d + 1` sets of `F` intersect, then all sets of `F` intersect. -/
theorem helly_theorem (F : Set (Set E)) {hF_fin : Set.Finite F}
    (h_card : (finrank 𝕜 E) + 1 ≤ ncard F) (h_convex : ∀ X ∈ F, Convex 𝕜 X)
    (h_inter : ∀ G : Set (Set E), (G ⊆ F) → (ncard G = (finrank 𝕜 E) + 1) →
    (⋂₀ G).Nonempty) : (⋂₀ F).Nonempty := by
  obtain ⟨n, hn⟩ : ∃ n : ℕ, ncard F = n := ⟨ncard F, rfl⟩ -- for induction on ncard F
  rw [hn] at h_card
  induction' n, h_card using Nat.le_induction with k h_card hk generalizing F
  exact h_inter F (Eq.subset rfl) hn
  /- construct a family of vectors indexed by `F` such that the vector corresponding to `X : F` is
  an arbitrary element of the intersection `⋂₀ F` which *does not lie in `X`*. -/
  let a : F → E := fun X : F ↦ Set.Nonempty.some (s := ⋂₀ (F \ {(X : Set E)})) <| by
    apply @hk _ (Finite.diff hF_fin {(X : Set E)})
    · exact fun Y hY ↦ h_convex Y (mem_of_mem_diff hY)
    · exact fun G hG_1 hG_2 ↦ h_inter G (Subset.trans hG_1 (diff_subset F {(X : Set E)})) hG_2
    · rw [ncard_diff_singleton_of_mem X.property hF_fin, Nat.sub_eq_of_eq_add hn]
  /- This family of vectors is not affine independent because the number of them exceeds the
  dimension of the space. -/
  have h2 : ¬AffineIndependent 𝕜 a := by
    have : Fintype ↑F := Finite.fintype hF_fin -- for instance inferring
    rw [←finrank_vectorSpan_le_iff_not_affineIndependent 𝕜 a (n := (k - 1))]
    · exact (Submodule.finrank_le (vectorSpan 𝕜 (Set.range a))).trans (Nat.le_pred_of_lt h_card)
    · rw [←Finite.card_toFinset hF_fin, ←ncard_eq_toFinset_card F hF_fin, hn,
        ←Nat.sub_add_comm (Nat.one_le_of_lt h_card)]
      rfl
  /- Use `Convex.radon_partition` to conclude there is a subset `I` of `F` and a point `p : E`
  which lies in the convex hull of either `a '' I` or `a '' Iᶜ`. We claim that `p ∈ ⋂₀ F`.
  (here `Iᶜ` is the complement within `F`, i.e., it is effectively `F \ I`.) -/
  obtain ⟨I, p, h4_I, h4_Ic⟩ := Convex.radon_partition h2
  refine ⟨p, fun X hX ↦ ?_⟩
  lift X to F using hX
  /- It suffices to show that for any set `X` in a subcollection `I` of `F`, that the convex hull
  of `a '' Iᶜ` is contained in `X`. -/
  suffices ∀ I : Set F, X ∈ I → (convexHull 𝕜) (a '' Iᶜ) ⊆ X by
    by_cases (X ∈ I)
    · exact this I h h4_Ic
    · apply this Iᶜ h; rwa [compl_compl]
  /- Given any subcollection `I` of `F` containing `X`, because `X` is convex, we need only show
  that `a Y ∈ X` for each `Y ∈ Iᶜ` -/
  intro I h
  rw [Convex.convexHull_subset_iff (h_convex _ X.prop)]
  rintro - ⟨Y, hY, rfl⟩
  /- Since `Y ∈ Iᶜ` and `X ∈ I`, we conclude that `X ≠ Y`, and hence by the definition of `a`:
  `a Y ∈ ⋂₀ F \ {Y} ⊆ X`  -/
  have : X ≠ Y := fun h' ↦ hY (h' ▸ h)
  exact (sInter_subset_of_mem <| mem_diff_singleton.mpr ⟨X.prop, Subtype.coe_injective.ne this⟩)
    (Set.Nonempty.some_mem _)

@vasnesterov
Copy link
Collaborator Author

vasnesterov commented Nov 3, 2023

Thank you very much! And sorry for such a delay. I learned a lot from your comments. In the end, I decided to keep your proof. I don't think I can improve it :)

I added you to the authors list in the heading. Hope you don't mind.

@vasnesterov vasnesterov added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Nov 5, 2023
@j-loreaux
Copy link
Collaborator

@vasnesterov can you address the earlier unresolved comments?

@j-loreaux j-loreaux added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Nov 29, 2023
@vasnesterov
Copy link
Collaborator Author

I added a comment about the theorem at the beginning, switched to indexed families instead sets and proved the infinite version.

@vasnesterov vasnesterov added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Mar 7, 2024
Copy link
Collaborator

@j-loreaux j-loreaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to get this merged sooner rather than later. So if you have any questions let me know. Otherwise ping me (i.e., request my review) when you add the set version back in and I'll do a last review.

@j-loreaux j-loreaux added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Apr 7, 2024
@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Apr 7, 2024
@vasnesterov vasnesterov added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Apr 7, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the blocked-by-other-PR This PR depends on another PR to Mathlib (this label is automatically managed by a bot) label Jun 25, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

This PR/issue depends on:

@YaelDillies YaelDillies added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Jun 25, 2024
@vasnesterov vasnesterov added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jun 29, 2024
Copy link
Collaborator

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good thing to remember is that s : Finset ι is more general than Fintype ι

Comment on lines 89 to 91
generalize hn : Fintype.card ι = n
rw [hn] at h_card
induction' n, h_card using Nat.le_induction with k h_card hk generalizing ι
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... namely

Suggested change
generalize hn : Fintype.card ι = n
rw [hn] at h_card
induction' n, h_card using Nat.le_induction with k h_card hk generalizing ι
induction' s using Finset.induction

and more simplifications below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is more convenient to use induction on the size of the set rather than its elements.

@YaelDillies YaelDillies added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Jul 1, 2024
@vasnesterov vasnesterov added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jul 3, 2024
@YaelDillies
Copy link
Collaborator

I merged master because you are now on an old toolchain

@jcommelin
Copy link
Member

Thanks 🎉

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Jul 5, 2024
mathlib-bors bot pushed a commit that referenced this pull request Jul 5, 2024
* Prove Helly's convexity theorem (including compact and set versions) and fix typos in `Analysis.Convex.Radon`
* Add alias `Set.sInter_mono` in the style of `Set.sUnion_mono`
* Mark  `encard_coe_eq_coe_finsetCard` with `simp` and `norm_cast`



Co-authored-by: Vasily Nesterov <[email protected]>
Co-authored-by: Yaël Dillies <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 5, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Analysis/Convex): Helly's convexity theorem [Merged by Bors] - feat(Analysis/Convex): Helly's convexity theorem Jul 5, 2024
@mathlib-bors mathlib-bors bot closed this Jul 5, 2024
@mathlib-bors mathlib-bors bot deleted the vasnesterov_helly_convex branch July 5, 2024 19:33
@adomani adomani mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! ready-to-merge This PR has been sent to bors. t-analysis Analysis (normed *, calculus)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants