[Merged by Bors] - refactor(Combinatorics/SimpleGraph): remove sndOfNotNil in favour of getVert 1#15237
[Merged by Bors] - refactor(Combinatorics/SimpleGraph): remove sndOfNotNil in favour of getVert 1#15237
Conversation
PR summary 163e433d41Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
This PR/issue depends on: |
6291e86 to
f1714a7
Compare
|
Just force-pushed after rebasing because of the #14977 merge:) |
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
| have := adj_getVert_succ p (by | ||
| rw [SimpleGraph.Walk.nil_iff_length_eq] at hp | ||
| push_neg at hp | ||
| exact Nat.zero_lt_of_ne_zero hp) | ||
| rwa [getVert_zero] at this |
There was a problem hiding this comment.
This proof really should be
| have := adj_getVert_succ p (by | |
| rw [SimpleGraph.Walk.nil_iff_length_eq] at hp | |
| push_neg at hp | |
| exact Nat.zero_lt_of_ne_zero hp) | |
| rwa [getVert_zero] at this | |
| simpa using adj_getVert_succ p (by simpa) |
Can you add simp lemmas until something of the above works?
There was a problem hiding this comment.
simpa using adj_getVert_succ p (by simpa : 0 < p.length) works except for the second simpa, but simping "not nil" to "0 < p.length" seems pretty impactful, are you sure we want to be doing that?
There was a problem hiding this comment.
I managed to get it to this:
@[simp] lemma adj_getVert_one {p : G.Walk v w} (hp : ¬ p.Nil) :
G.Adj v (p.getVert 1) := by
have := adj_getVert_succ p (by simpa [not_nil_iff_lt_length] using hp)
simp only [getVert_zero, zero_add] at this
exact this
which works
but
@[simp] lemma adj_getVert_one {p : G.Walk v w} (hp : ¬ p.Nil) :
G.Adj v (p.getVert 1) := by
simpa [getVert_zero, zero_add] using adj_getVert_succ p (by simpa [not_nil_iff_lt_length] using hp)
errors with
type mismatch
h✝
has type
G.Adj (p.getVert 0) (p.getVert (0 + 1)) : Prop
but is expected to have type
G.Adj v (p.getVert 1) : Prop
Any clue what's going on here?
There was a problem hiding this comment.
Hmm... no clue, no. If you manage to minimise it, try posting it on #mathlib4 or #lean4 (depending on whether you got rid of the mathlib dependencies or not)
There was a problem hiding this comment.
Type hinting the second simpa works. I don't think there's a bug with simpa, since using rwa in the second part leads to the same problem. Fixed in it that way
There was a problem hiding this comment.
Probably some metavariable instantiating too late
|
Thanks! maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by YaelDillies. |
|
Thanks! bors merge |
…getVert 1 (#15237) This allows to leave out the not-nil hypothesis, in addition to not needing it for the definition of tail.
|
Pull request successfully merged into master. Build succeeded: |
…getVert 1 (#15237) This allows to leave out the not-nil hypothesis, in addition to not needing it for the definition of tail.
…getVert 1 (#15237) This allows to leave out the not-nil hypothesis, in addition to not needing it for the definition of tail.
…getVert 1 (#15237) This allows to leave out the not-nil hypothesis, in addition to not needing it for the definition of tail.
…getVert 1 (#15237) This allows to leave out the not-nil hypothesis, in addition to not needing it for the definition of tail.
This allows to leave out the not-nil hypothesis, in addition to not needing it for
the definition of tail.
Per discussion here