Skip to content

Add proof of the existence of eulerian path#39700

Closed
samuelchassot wants to merge 2 commits into
leanprover-community:masterfrom
samuelchassot:sam/eulerianPathContrib
Closed

Add proof of the existence of eulerian path#39700
samuelchassot wants to merge 2 commits into
leanprover-community:masterfrom
samuelchassot:sam/eulerianPathContrib

Conversation

@samuelchassot

Copy link
Copy Markdown

Open in Gitpod

Copilot AI review requested due to automatic review settings May 22, 2026 13:46
@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 May 22, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions

Copy link
Copy Markdown

🚨 PR Title Needs Formatting

Please update the title to match our commit style conventions.

Errors from script:

error: the PR title does not contain a colon
Details on the required title format

The title should fit the following format:

<kind>(<optional-scope>): <subject>

<kind> is:

  • feat (feature)
  • fix (bug fix)
  • doc (documentation)
  • style (formatting, missing semicolons, ...)
  • refactor
  • test (when adding missing tests)
  • chore (maintain)
  • perf (performance improvement, optimization, ...)
  • ci (changes to continuous integration, repo automation, ...)

<optional-scope> is a name of module or a directory which contains changed modules.
This is not necessary to include, but may be useful if the <subject> is insufficient.
The Mathlib directory prefix is always omitted.
For instance, it could be

  • Data/Nat/Basic
  • Algebra/Group/Defs
  • Topology/Constructions

<subject> has the following constraints:

  • do not capitalize the first letter
  • no dot(.) at the end
  • use imperative, present tense: "change" not "changed" nor "changes"

@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown

PR summary 8985862c6d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Combinatorics.SimpleGraph.Eulerian (new file) 633

Declarations diff

+ IsMaximalAvoidingFrom
+ IsMaximalAvoidingFrom.even_countP_edges_right_of_endpoints
+ IsMaximalAvoidingFrom.filter_edgesFinset_eq_incidenceFinset_inter_unused
+ IsMaximalAvoidingFrom.isClosed_of_endpoints
+ IsMaximalAvoidingFrom.length_pos_of_unused_adj_start
+ IsMaximalTrail
+ IsMaximalTrail.countP_edges_right_eq_degree
+ IsMaximalTrail.filter_edgesFinset_eq_incidenceFinset
+ IsMaximalTrail.isClosed_of_forall_even_degree
+ IsMaximalTrail.isEulerian_of_connected_of_closed
+ IsMaximalTrail.mem_edges_of_connected_card_two
+ IsMaximalTrail.not_closed_of_card_odd_degree_eq_two
+ IsMaximalTrail.odd_degree_left_of_ne
+ IsMaximalTrail.odd_degree_right_of_ne
+ IsTrail.even_countP_iff_even_degree_of_endpoints
+ IsTrail.exists_longer_of_unused_closed_detour
+ IsTrail.exists_longer_of_unused_edge_at_start
+ IsTrail.filter_edgesFinset_eq_incidenceFinset_inter_used
+ IsTrail.length_edges_le_card_edgeFinset
+ IsTrail.odd_countP_edges_right_of_ne
+ all_non_endpoint_even_of_card_odd_degree_eq_two
+ card_odd_degree_eq_zero_of_forall_even
+ disjoint
+ exists_adj_of_mem_edgeSet_and_mem
+ exists_isEulerian_of_connected_card_oddDegree_eq_two
+ exists_isEulerian_of_connected_card_oddDegree_eq_zero_or_two
+ exists_isEulerian_of_connected_forall_even_degree
+ exists_isMaximalAvoidingFrom
+ exists_isMaximalTrail
+ exists_maximal_walk
+ exists_maximal_walk,
+ exists_unused_closed_detour
+ exists_unused_incident_edge_of_unused_edge
+ exists_unused_incident_edge_of_walk_to_not_support
+ forall_even_degree_of_card_oddDegree_eq_zero
+ reverse
++ isTrail
++ length_le
++ not_unused_edge_at_end

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.


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

@github-actions github-actions Bot added the t-combinatorics Combinatorics label May 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new SimpleGraph module proving the existence direction of the Eulerian trail theorem (connected finite graph with 0 or 2 odd-degree vertices ⇒ Eulerian trail), and updates documentation/imports accordingly.

Changes:

  • Add Mathlib.Combinatorics.SimpleGraph.Eulerian with maximal-trail-based existence proofs (0-odd and 2-odd cases).
  • Update Trails.lean module docs to reference the new existence proof location.
  • Re-export the new module from Mathlib.lean.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Mathlib/Combinatorics/SimpleGraph/Trails.lean Replaces TODO with “Related” note pointing to the new existence-direction file.
Mathlib/Combinatorics/SimpleGraph/Eulerian.lean New file implementing the existence direction using maximal trail constructions and parity arguments.
Mathlib.lean Adds public import for the new Eulerian module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Released under Apache 2.0 license as described in the file LICENSE.
Authors: Samuel Chassot
-/
module
lemma `exists_maximal_walk`, parameterised by an arbitrary walk predicate.
-/

@[expose] public section
hrev.exists_longer_of_unused_edge_at_start hvw.symm hunusedRev
have hle := hpmax.length_le hqT.reverse
simp only [edges_reverse, List.length_reverse] at hle hqL
omega
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! t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants