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(combinatorics/simple_graph/connectivity): add functions to split walks and to create paths #11095

Closed
wants to merge 4 commits into from

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Dec 28, 2021

This is chunk 3 of #8737. Introduces take_until and drop_until to split walks at a vertex, rotate to rotate cycles, and to_path to remove internal redundancy from a walk to create a path with the same endpoints.

This also defines a bundled path type for is_path since G.path u v is a useful type.


Open in Gitpod

@kmill kmill added the awaiting-review The author would like community review of the PR label Dec 28, 2021
@arthurpaulino
Copy link
Collaborator

I see many repeated blocks of tactics across different proofs (usually after induction p,). Is it possible to extract some logic in a way that reduces code duplication?

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.

Minor things.

src/combinatorics/simple_graph/connectivity.lean Outdated Show resolved Hide resolved
src/combinatorics/simple_graph/connectivity.lean Outdated Show resolved Hide resolved
src/combinatorics/simple_graph/connectivity.lean Outdated Show resolved Hide resolved
end

lemma support_take_until_subset {u v w : V} (p : G.walk v w) (h : u ∈ p.support) :
(p.take_until u h).support ⊆ p.support :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have notions of sub-walk? Should we? (It's entirely possible the answer is no!)

Copy link
Collaborator Author

@kmill kmill Feb 9, 2022

Choose a reason for hiding this comment

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

Not yet, and I don't immediately have any plans for them.

The closest we have at the moment is that we can give an explicit append expression: (p.take_until u h).append (p.drop_until u h) = p

namespace walk
variables {G} [decidable_eq V]

/-- Given a walk, produces a walk with the same endpoints and no repeated vertices. -/
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice here to say that the new walk is a path, and that this is shown below. I can imagine cases where I want to "de-dup" a walk and carry around the property, rather than work in the subtype; perhaps that means this has a better name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it to bypass since it creates a walk that bypasses the subwalks between duplicate vertices. Maybe that's a reasonable name?

src/combinatorics/simple_graph/connectivity.lean Outdated Show resolved Hide resolved
@jcommelin jcommelin added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Jan 5, 2022
@kmill kmill changed the title feat(combinatorics/simple_graph/connectivity): splitting walks, creating paths feat(combinatorics/simple_graph/connectivity): add functions to split walks and to create paths Feb 9, 2022
@kmill kmill added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Feb 9, 2022
Copy link
Member

@robertylewis robertylewis left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, but hopefully someone more familiar with the graph theory library can confirm (@b-mehta ?)!

@b-mehta
Copy link
Collaborator

b-mehta commented Feb 15, 2022

Sorry for not checking this sooner! LGTM

bors merge

bors bot pushed a commit that referenced this pull request Feb 15, 2022
… walks and to create paths (#11095)

This is chunk 3 of #8737. Introduces `take_until` and `drop_until` to split walks at a vertex, `rotate` to rotate cycles, and `to_path` to remove internal redundancy from a walk to create a path with the same endpoints.

This also defines a bundled `path` type for `is_path` since `G.path u v` is a useful type.
@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Feb 15, 2022
@bors
Copy link

bors bot commented Feb 15, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(combinatorics/simple_graph/connectivity): add functions to split walks and to create paths [Merged by Bors] - feat(combinatorics/simple_graph/connectivity): add functions to split walks and to create paths Feb 15, 2022
@bors bors bot closed this Feb 15, 2022
@bors bors bot deleted the kmill_connectivity_3 branch February 15, 2022 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants