Skip to content

feat(Combinatorics/Graph): connected graphs#37861

Open
Jun2M wants to merge 13 commits intoleanprover-community:masterfrom
Jun2M:GraphIsCompOf
Open

feat(Combinatorics/Graph): connected graphs#37861
Jun2M wants to merge 13 commits intoleanprover-community:masterfrom
Jun2M:GraphIsCompOf

Conversation

@Jun2M
Copy link
Copy Markdown
Collaborator

@Jun2M Jun2M commented Apr 9, 2026

This PR introduces

  • IsConnectedComponentOf, a graph is a connected component of another graph, and
  • IsConnected, a graph is a self component

Under this definition, an empty graph is not connected.

Co-authored-by: Peter Nelson apn.uni@gmail.com


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

PR summary 2a556ee342

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Combinatorics.Graph.Connected.Component (new file) 494

Declarations diff

+ Connected
+ Connected.exists_inc_notMem_of_lt
+ Connected.ext_of_isClosedSubgraph
+ Connected.nonempty
+ IsConnectedComponentOf
+ IsConnectedComponentOf.Connected
+ anti_right
+ connected_iff_forall_closed
+ connected_iff_forall_closed_ge
+ isClosedSubgraph
+ isInducedSubgraph
+ le
+ nonempty
+ not_connected_bot

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-combinatorics Combinatorics label Apr 9, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Apr 9, 2026
Comment thread Mathlib/Combinatorics/Graph/Connected/Component.lean Outdated
@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Apr 13, 2026
@mathlib-dependent-issues
Copy link
Copy Markdown

mathlib-dependent-issues Bot commented Apr 13, 2026

@Jun2M Jun2M requested a review from SnirBroshi April 14, 2026 12:58
@Jun2M Jun2M requested a review from YaelDillies April 15, 2026 04:09
@YaelDillies
Copy link
Copy Markdown
Contributor

What's the plan for IsPreconnected? Will you define it later as "for all u, v, u is reachable from v"?

@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 15, 2026
@Jun2M
Copy link
Copy Markdown
Collaborator Author

Jun2M commented Apr 15, 2026

@YaelDillies, that is exactly the definition of IsPreconnected we have in the Matroid repo. However, Walk is still held up by GraphLike. (although it is almost there! I think we have something everyone is happy with and I just need to put it into Lean) One way is to wait for that.

Alternative, thanks to Menger, is ∀ S ⊆ V(G), δ(G, S) = ∅ ↔ S = ∅ ∨ S = V(G) using δ(G, S) defined in #37865.

@Jun2M Jun2M removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 15, 2026
@YaelDillies YaelDillies changed the title feat(Combinatorics/Graph): Connectedness of Graph feat(Combinatorics/Graph): connected graphs Apr 16, 2026
@YaelDillies
Copy link
Copy Markdown
Contributor

It is difficult to evaluate Connected without Preconnected: is it easy to go from one to the other? Will they live in the same file? What about Reachable? etc...

@Jun2M Jun2M added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 17, 2026
@Jun2M Jun2M added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed awaiting-author A reviewer has asked the author a question or requested changes. labels Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants