Skip to content

feat(SimpleGraph/Trails): define Eulerian graphs - #41524

Open
SnirBroshi wants to merge 21 commits into
leanprover-community:masterfrom
SnirBroshi:feature/simple-graph/eulerian-iff-at-vertex
Open

SnirBroshi wants to merge 21 commits into
leanprover-community:masterfrom
SnirBroshi:feature/simple-graph/eulerian-iff-at-vertex

Conversation

@SnirBroshi

@SnirBroshi SnirBroshi commented Jul 9, 2026 •

Copy link
Copy Markdown
Collaborator

Define SimpleGraph.IsEulerian to be ∃ (v : V) (p : G.Walk v v), p.IsEulerian, and prove basic results.

Also show that in a connected Eulerian graph there exists an Eulerian circuit from any vertex.
This lets us take a circuit at a specific vertex, much like IsHamiltonian.exists_isHamiltonianCycle in Hamiltonian graphs.


Open in Gitpod

…ian iff there exists an Eulerian circuit from a specific vertex
@SnirBroshi SnirBroshi changed the title feat(Combinatorics/SimpleGraph/Trails): a preconnected graph is Eulerian iff there exists an Eulerian circuit from a specific vertex feat(SimpleGraph/Trails): a preconnected graph is Eulerian iff there exists an Eulerian circuit from a specific vertex Jul 9, 2026
@github-actions github-actions Bot added the t-combinatorics Combinatorics label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

PR summary 42ccd789c9

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ IsEulerian
+ IsEulerian.bot
+ IsEulerian.connected_of_forall_not_isIsolated
+ IsEulerian.even_degree
+ IsEulerian.exists_isEulerian_of_not_isIsolated
+ IsEulerian.exists_isEulerian_of_preconnected
+ IsEulerian.isCircuit_iff
+ IsEulerian.mem_support_of_preconnected
+ IsEulerian.nonempty
+ IsEulerian.of_bot
+ IsEulerian.rotate
+ isEulerian_and_ne_bot_iff
+ isEulerian_rotate

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 42ccd78).

  • +20 new declarations
  • −0 removed declarations
+SimpleGraph.IsEulerian
+SimpleGraph.IsEulerian.bot
+SimpleGraph.IsEulerian.casesOn
+SimpleGraph.IsEulerian.congr_simp
+SimpleGraph.IsEulerian.connected_of_forall_not_isIsolated
+SimpleGraph.IsEulerian.even_degree
+SimpleGraph.IsEulerian.exists_isEulerian
+SimpleGraph.IsEulerian.exists_isEulerian_of_not_isIsolated
+SimpleGraph.IsEulerian.exists_isEulerian_of_preconnected
+SimpleGraph.IsEulerian.mk
+SimpleGraph.IsEulerian.nonempty
+SimpleGraph.IsEulerian.rec
+SimpleGraph.IsEulerian.recOn
+SimpleGraph.Walk.IsEulerian.isCircuit_iff
+SimpleGraph.Walk.IsEulerian.mem_support_of_preconnected
+SimpleGraph.Walk.IsEulerian.of_bot
+SimpleGraph.Walk.IsEulerian.rotate
+SimpleGraph.Walk.isEulerian_rotate
+SimpleGraph.isEulerian_and_ne_bot_iff
+SimpleGraph.isEulerian_iff

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 42ccd789c9
Reference commit f32f0e99f9

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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).

Comment thread Mathlib/Combinatorics/SimpleGraph/Trails.lean Outdated
@SnirBroshi SnirBroshi changed the title feat(SimpleGraph/Trails): a preconnected graph is Eulerian iff there exists an Eulerian circuit from a specific vertex feat(SimpleGraph/Trails): in a preconnected Eulerian graph there exists an Eulerian circuit from any vertex Jul 9, 2026
Comment thread Mathlib/Combinatorics/SimpleGraph/Trails.lean Outdated
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 9, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 13, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 15, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 15, 2026
Comment thread Mathlib/Combinatorics/SimpleGraph/Trails.lean
Comment thread Mathlib/Combinatorics/SimpleGraph/Trails.lean Outdated
Comment thread Mathlib/Combinatorics/SimpleGraph/Trails.lean Outdated
Comment thread Mathlib/Combinatorics/SimpleGraph/Trails.lean Outdated
@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 25, 2026
SnirBroshi and others added 2 commits October 25, 2026 15:22
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@SnirBroshi SnirBroshi changed the title feat(SimpleGraph/Trails): in a preconnected Eulerian graph there exists an Eulerian circuit from any vertex feat(SimpleGraph/Trails): define Eulerian graphs Oct 25, 2026
@SnirBroshi SnirBroshi removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 25, 2026
Comment on lines 162 to 163

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you show that it is equivalent to \forall v, \exists p, ... under appropriate conditions?

@SnirBroshi SnirBroshi Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean #41524 (comment)? As in iff versions of exists_isEulerian_of_not_isIsolated and exists_isEulerian_of_preconnected?
Even though it was kinda the first version of this PR (ab128a4, although the forall is in a different place) I kinda agree with Vlad that the reverse implication is trivial, so the iff is redundant.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, the reverse implication is trivial, but iffs let you rewrite, while implications don't (not exactly true now that we have grw, but you get the point)

@YaelDillies YaelDillies added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants