Repository navigation
[Merged by Bors] - feat(SimpleGraph): sub-walks - #26655
Rida-Hamadani wants to merge 10 commits into
Conversation
PR summary df7b8fa466Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type |
|---|---|---|
| 4 | 1 | large files |
Current commit 141cf1ba15
Reference commit df7b8fa466
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
kmill
left a comment
There was a problem hiding this comment.
I spent some time trying to prove this by induction, and got to here.
theorem isSubwalk_iff_support_isInfix {u₁ v₁ u₂ v₂ : V} (p : G.Walk u₁ v₁) (q : G.Walk u₂ v₂) :
p.IsSubwalk q ↔ p.support <:+: q.support := by
induction q with
| nil =>
cases p with
| nil => simp [isSubwalk_nil_iff, eq_comm]
| cons h p =>
suffices ∀ (w) (hu : w = u₁) (hv : w = v₁), ¬cons h p = nil.copy hu hv by
simp [isSubwalk_nil_iff, List.infix_singleton_iff, this]
rintro _ rfl rfl
simp
| cons h q ih =>
cases p with
| nil =>
simp only [support_nil, List.singleton_infix_iff] at ih
simp [List.singleton_infix_iff, ← ih, nil_isSubwalk_cons_iff]
| cons h p =>
rw [support_cons] at ih
rw [support_cons, support_cons, List.infix_cons_iff, ← ih]
simp
sorry
Maybe it's worth contributing these:
lemma List.singleton_infix_iff {α : Type*} (x : α) (xs : List α) :
[x] <:+: xs ↔ x ∈ xs := by
rw [List.mem_iff_append, List.IsInfix]
congr! 4
simp [eq_comm]
@[simp]
lemma List.singleton_infix_singleton_iff {α : Type*} {x y : α} :
[x] <:+: [y] ↔ x = y := by
constructor
· rintro ⟨_ | _, bs, h⟩ <;> simp_all
· rintro rfl; rfl
lemma List.infix_singleton_iff {α : Type*} (xs : List α) (x : α) :
xs <:+: [x] ↔ xs = [] ∨ xs = [x] := by
match xs with
| [] => simp
| [_] => simp [List.singleton_infix_singleton_iff]
| _ :: _ :: _ =>
constructor
· rintro ⟨_ | _, _, h⟩ <;> simp at h
· simp|
This is what I had worked up locally: vlad902@4767466 Note that the proof of equivalence |
Co-authored-by: Vlad Tsyrklevich <[email protected]>
jt496
left a comment
There was a problem hiding this comment.
This PR looks great to me! My only real question is would it be better to call this IsInfixwalk (or maybe just Infixwalk) so it aligns with the naming in List
and makes it easer to introduce not-necessarily-contiguous subwalks at a later date if we want them.
(I've been playing around with something like this based on List.Sublist https://github.com/jt496/mathlib4/blob/walks/Mathlib/Combinatorics/SimpleGraph/Subwalk.lean)
|
bors merge |
defines (contiguous) subwalks and provides lemmas about them. Co-authored-by: Kyle Miller <[email protected]> Co-authored-by: Vlad Tsyrklevich <[email protected]>
|
Build failed (retrying...): |
|
Please merge bors r- |
|
✌️ Rida-Hamadani can now approve this pull request. To approve and merge a pull request, simply reply with |
|
Canceled. |
|
bors r+ |
defines (contiguous) subwalks and provides lemmas about them. Co-authored-by: Kyle Miller <[email protected]> Co-authored-by: Vlad Tsyrklevich <[email protected]>
|
Pull request successfully merged into master. Build succeeded: |
defines (contiguous) subwalks and provides lemmas about them. Co-authored-by: Kyle Miller <[email protected]> Co-authored-by: Vlad Tsyrklevich <[email protected]>
defines (contiguous) subwalks and provides lemmas about them. Co-authored-by: Kyle Miller <[email protected]> Co-authored-by: Vlad Tsyrklevich <[email protected]>
defines (contiguous) subwalks and provides lemmas about them. Co-authored-by: Kyle Miller <[email protected]> Co-authored-by: Vlad Tsyrklevich <[email protected]>
defines (contiguous) subwalks and provides lemmas about them.
Co-authored-by: Kyle Miller [email protected]
Co-authored-by: Vlad Tsyrklevich [email protected]