-
Notifications
You must be signed in to change notification settings - Fork 248
Some lemmata for lists and non-empty lists #2730
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
base: master
Are you sure you want to change the base?
Conversation
These look like good additions! Can you update |
ad38846
to
f4737f0
Compare
Ok, I updated the changelog as well. :) |
I also migrated some additional lemmas from |
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.
A few nits, but otherwise this is looking nice.
[Not a big fan of rewrite
, but it's not a showstopper.]
Thank you for the review. :) I integrated the requested changes. I also got rid of the |
f387ebc
to
658a9b0
Compare
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.
Happy with this; apart from two small naming issues (and related completeness question).
separates the anonymous module for algebraic definitions and structures around _++_ into two modules
moves these theorems below the theorems on the algebraic properties of _++_ so that we can later reuse them for further symmetric theorems
658a9b0
to
15abb26
Compare
Hi everyone, I implemented the requested changes. Implementing the (Maybe there is a simpler proof for |
length-++-sucʳ [] _ _ = refl | ||
length-++-sucʳ (_ ∷ xs) y ys = cong suc (length-++-sucʳ xs y ys) | ||
|
||
length-++-comm : ∀ (xs ys : List A) → |
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 wonder if this would be easier to prove as a corollary of length being preserved by permutations?
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.
If I understand correctly, this means to
- Establish a theorem that says that
length
is preserved under permutation. - Prove that
xs ++ ys
is a permutation ofys ++ xs
. - Prove
length-++-comm
as a corollary.
This should be possible and the theorems 1 and 2 should be useful as well. I am not sure this would be a simpler as a sole means to prove length-++-comm
though.
Given that there are multiple definitions of permutations, which one should be used here? Data.List.Relation.Binary.Permutation.Setoid
or Data.List.Relation.Binary.Permutation.Propositional
?
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 know step 1 already exists, I've used it recently. I'm almost sure step 2 does as well.
I'd use Propositional
as it is more precise in what it asserts.
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'd caution against doing this for dependency tree reasons...
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.
So how should we proceed with this PR?
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.
(Note that I approved the changes, my suggestion above was for a potential future, not this. Now it's up to someone else to also approve the latest changes. Maybe @MatthewDaggitt can re-review?)
These are some lemmata we needed in our project Vatras for reasoning on non-empty lists. It seemed these lemmata could be generally useful to other people as well.
-- PR is part of Zurihac 2025