-
Notifications
You must be signed in to change notification settings - Fork 194
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
more theory about lists #1957
more theory about lists #1957
Conversation
Signed-off-by: Ali Caglayan <[email protected]>
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 skimmed some parts, but this looks good. Lots of results in this PR!
theories/Spaces/List/Theory.v
Outdated
apply nth'_cons. | ||
Defined. | ||
|
||
(** The [nth'] element of a map is the function applied to the [nth'] element of the original list. *) |
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 some of the results about nth'
would be cleaner if first proved about nth
and then converted to statements about nth'
using nth_nth'
? (Like how nth'_cons
was done.)
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 tried nth'_map
and I end up having to reason about nth
returning Some
when in range so it ended up not being shorter. I did not try nth'_map2
but presumably it has the same issue. That leaves only nth'_repeat
and I would guess the nth_repeat
proof would be the same length if we had it.
Signed-off-by: Ali Caglayan <[email protected]>
Signed-off-by: Ali Caglayan <[email protected]>
Signed-off-by: Ali Caglayan <[email protected]>
Signed-off-by: Ali Caglayan <[email protected]>
Co-authored-by: Dan Christensen <[email protected]>
This PR develops the theory of lists some more. Here is a summary of the changes:
[ a0; ...; an ]
notation to[ a0, ..., an ]
in a way that doesn't disrupt the pointed type notation.theories/Spaces/Option.v
file for some basics about option types.Option.v
I needed to use theinjection
tactic which lets Coq prove that constructors of inductive types are injective. In order to do that, I had to register some constants inOverture.v
. It appears to be working fine. See the proof ofoption_path
.head
,nth
andlast
functions now return anoption A
rather than requiring a default value.drop
which drops the first n elements of a list.take
which takes the first n elements of a list and returns it.remove
which removes the element at a given index.nth'
a variant ofnth
which takes a proof that the index is in bounds and guarantees an element.repeat
which repeats an element n times.seq'
a variant ofseq
which keeps around a proof that the elements are less than the length.Theory.v
file.These new functions and lemmas will be used in an upcoming PR.