Skip to content

[Merged by Bors] - feat(Combinatorics/SimpleGraph): define edge-connectivity#32870

Closed
0xTerencePrime wants to merge 29 commits intoleanprover-community:masterfrom
0xTerencePrime:edge-connectivity
Closed

[Merged by Bors] - feat(Combinatorics/SimpleGraph): define edge-connectivity#32870
0xTerencePrime wants to merge 29 commits intoleanprover-community:masterfrom
0xTerencePrime:edge-connectivity

Conversation

@0xTerencePrime
Copy link
Copy Markdown
Contributor

@0xTerencePrime 0xTerencePrime commented Dec 14, 2025

This PR introduces k-edge-connectivity definitions for SimpleGraph, addressing #31691.


Summary

This PR introduces k-edge-connectivity definitions for SimpleGraph, addressing #31691.

Main Changes

  • New file: Mathlib/Combinatorics/SimpleGraph/Connectivity/EdgeConnectivity.lean

Definitions

  • IsEdgeReachable k u v: vertices remain reachable after removing < k edges
  • IsEdgeConnected k: graph is k-edge-connected

Lemmas

  • Basic properties: rfl, symm, trans, mono, zero
  • isEdgeReachable_one: equivalence with standard Reachable
  • isEdgeConnected_one: equivalence with Preconnected
  • isEdgeReachable_succ: inductive characterization
  • isEdgeConnected_succ: inductive characterization for graphs
  • isEdgeConnected_two: equivalence with Preconnected ∧ ¬∃ e, IsBridge e

Verification

  • lake build passes
  • lake exe runLinter passes

Closes #31691

@github-actions github-actions bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-combinatorics Combinatorics labels Dec 14, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 14, 2025

PR summary 0a5fe12b77

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Combinatorics.SimpleGraph.Connectivity.EdgeConnectivity (new file) 589

Declarations diff

+ IsEdgeConnected
+ IsEdgeConnected.connected
+ IsEdgeConnected.preconnected
+ IsEdgeConnected.zero
+ IsEdgeReachable
+ IsEdgeReachable.anti
+ IsEdgeReachable.mono
+ IsEdgeReachable.reachable
+ IsEdgeReachable.rfl
+ IsEdgeReachable.symm
+ IsEdgeReachable.trans
+ IsEdgeReachable.zero
+ isBridge_iff_adj_and_not_isEdgeConnected_two
+ isEdgeConnected_add_one
+ isEdgeConnected_one
+ isEdgeConnected_two
+ isEdgeReachable_add_one
+ isEdgeReachable_one

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

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

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


No changes to technical debt.

You can run this locally as

./scripts/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).

0xTerencePrime and others added 5 commits December 14, 2025 07:46
- Define IsEdgeReachable and IsEdgeConnected
- Prove basic properties: reflexivity, symmetry, transitivity, monotonicity
- Prove equivalence with standard reachability for k=1
- Prove inductive characterization for k+1
- Prove IsEdgeConnected 2 ↔ Preconnected ∧ no bridges

Closes leanprover-community#31691
@YaelDillies YaelDillies added the awaiting-author A reviewer has asked the author a question or requested changes. label Dec 20, 2025
Copy link
Copy Markdown
Collaborator

@SnirBroshi SnirBroshi left a comment

Choose a reason for hiding this comment

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

Looks good!

@SnirBroshi
Copy link
Copy Markdown
Collaborator

@YaelDillies in the issue you said "possibly more lemmas relating G.IsEdgeConnected 2 and G.IsAcyclic", and I'm wondering what the relation is specifically.
It's not difficult to prove ¬G.IsAcyclic ↔ ∃ u v, G.Adj u v ∧ G.IsEdgeReachable 2 u v,
but do you know if ¬G.IsAcyclic ↔ ∃ u v, G.IsEdgeReachable 2 u v is true?
Perhaps even G.IsTree ↔ ¬G.IsEdgeConnected 2 assuming Nonempty V?

@YaelDillies
Copy link
Copy Markdown
Contributor

YaelDillies commented Dec 20, 2025

do you know if ¬G.IsAcyclic ↔ ∃ u v, G.IsEdgeReachable 2 u v is true?

Yes, by (the local version of) edge Menger

G.IsTree ↔ ¬G.IsEdgeConnected 2 assuming Nonempty V?

That is very false. Not being two-edge connected is the same thing as having a bridge, while being a tree is the same as all edges being bridges.

@0xTerencePrime
Copy link
Copy Markdown
Contributor Author

I've applied all the suggested improvements from @YaelDillies and @SnirBroshi, including the 'strictly fewer' terminology, theorem protection, dot notation golfs, and the characterization of bridges. The full lake build Mathlib now passes without any errors or warnings. Thank you both for the great feedback!

Copy link
Copy Markdown
Contributor

@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.

Thanks!

maintainer delegate

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Dec 22, 2025
Copy link
Copy Markdown
Collaborator

@SnirBroshi SnirBroshi left a comment

Choose a reason for hiding this comment

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

Thanks!

btw the current build will probably time out in 3.5 hours, there's some unknown bug there (see #mathlib4 > slow linting step CI? @ 💬), but retriggerring the build should fix it (click "Update branch" below)

@0xTerencePrime
Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up regarding the CI timeout bug, @SnirBroshi! I have updated the branch as suggested to re-trigger the build.

@0xTerencePrime
Copy link
Copy Markdown
Contributor Author

I've noted the CI error. I'll re-trigger the build later today when I'm back at my computer. Thanks!

@0xTerencePrime
Copy link
Copy Markdown
Contributor Author

Hi @YaelDillies and @SnirBroshi,

I have updated the code to incorporate the final golfs and address the remaining comments.

  1. Resolved the nonempty assignment thread.
  2. Cleaned up redundant {k : ℕ} variable declarations in the lemma headers.
  3. I have kept the conversation regarding isEdgeConnected_add_one open. As discussed, I retained G.Preconnected to ensure the equivalence holds for discrete graphs where the RHS is vacuously true.

The build is now fully green. Ready for a final review!

@0xTerencePrime
Copy link
Copy Markdown
Contributor Author

All remaining comments addressed and local build passes. Ready for review!

Copy link
Copy Markdown
Collaborator

@SnirBroshi SnirBroshi left a comment

Choose a reason for hiding this comment

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

Nice! Here's a golf for the new result

@jcommelin
Copy link
Copy Markdown
Member

I think I've already requested this on another PR: please reduce the AI generated commit messages. We don't need the "Verification" stuff at all. We have CI for that.
And the rest of the message is mostly directly readable from the diff.

The 1-line "Summary" is good.

Copy link
Copy Markdown
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@ghost ghost added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Dec 26, 2025
mathlib-bors bot pushed a commit that referenced this pull request Dec 26, 2025
This PR introduces k-edge-connectivity definitions for SimpleGraph, addressing #31691.

Co-authored-by: 0xTerencePrime <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Yaël Dillies <[email protected]>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Dec 26, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Combinatorics/SimpleGraph): define edge-connectivity [Merged by Bors] - feat(Combinatorics/SimpleGraph): define edge-connectivity Dec 26, 2025
@mathlib-bors mathlib-bors bot closed this Dec 26, 2025
kim-em pushed a commit to kim-em/mathlib4 that referenced this pull request Jan 6, 2026
…-community#32870)

This PR introduces k-edge-connectivity definitions for SimpleGraph, addressing leanprover-community#31691.

Co-authored-by: 0xTerencePrime <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Yaël Dillies <[email protected]>
goliath-klein pushed a commit to PrParadoxy/mathlib4 that referenced this pull request Jan 24, 2026
…-community#32870)

This PR introduces k-edge-connectivity definitions for SimpleGraph, addressing leanprover-community#31691.

Co-authored-by: 0xTerencePrime <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Yaël Dillies <[email protected]>
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-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge-connectivity

4 participants