-
Notifications
You must be signed in to change notification settings - Fork 234
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: add reverse induction principle for Vector #5400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my main comments here are just style comments about indentation.
Mathlib/Data/Vector/Snoc.lean
Outdated
(nil : C nil) | ||
(snoc : ∀ {n : ℕ} (xs : Vector α n) (x : α), C xs → C (xs.snoc x)) | ||
: C v := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indentation style is not usual. We just indent the theorem statement with four spaces usually, with occasional extra two space indentations for readability.
These should now be addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can merge after the small fixes
bors d+
Mathlib/Data/Vector/Basic.lean
Outdated
|
||
@[simp] | ||
theorem mapAccumr_cons : mapAccumr f (x ::ᵥ xs) s | ||
= let r := mapAccumr f xs s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this indentation is somewhat not in mathlib style as well.
✌️ alexkeizer can now approve this pull request. To approve and merge a pull request, simply reply with |
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
…4 into vector-snoc
bors merge |
Add a snoc pseudo-constructor, lemmas to reason about snoc, and a reverse induction principle for Vectors.
Pull request successfully merged into master. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Add a snoc pseudo-constructor, lemmas to reason about snoc, and a reverse induction principle for Vectors.
Add a snoc pseudo-constructor, lemmas to reason about snoc, and a reverse induction principle for Vectors.
Add a snoc pseudo-constructor, lemmas to reason about snoc, and a reverse induction principle for Vectors.
Add a snoc pseudo-constructor, lemmas to reason about snoc, and a reverse induction principle for Vectors.
Vector.snoc xs x
is just a short-hand forxs ++ [x]
.The reverse induction principle uses
xs.snoc x
for it's recursive step, which makes it easier to reason about algorithms that work on aVector
right-to-left, such asfoldr
ormapAccumr
.The PR also add some simplification rules for
snoc
which help with such backwards proofs.