Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxime Dénès
stdpp
Commits
b084730a
Commit
b084730a
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Simplify proofs relating nth to lookup.
Also make names more consistent.
parent
cdcfeee8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/list.v
+6
-17
6 additions, 17 deletions
theories/list.v
with
6 additions
and
17 deletions
theories/list.v
+
6
−
17
View file @
b084730a
...
...
@@ -477,24 +477,13 @@ Lemma list_lookup_middle l1 l2 x n :
n
=
length
l1
→
(
l1
++
x
::
l2
)
!!
n
=
Some
x
.
Proof
.
intros
->
.
by
induction
l1
.
Qed
.
Lemma
nth_lookup_or_length
l
i
d
:
{
l
!!
i
=
Some
(
nth
i
l
d
)}
+
{(
length
l
≤
i
)
%
nat
}
.
Lemma
nth_lookup
l
i
d
:
nth
i
l
d
=
from_option
id
d
(
l
!!
i
)
.
Proof
.
revert
i
.
induction
l
as
[|
x
l
IH
];
intros
[|
i
];
simpl
;
auto
.
Qed
.
Lemma
nth_lookup_Some
l
i
d
x
:
l
!!
i
=
Some
x
→
nth
i
l
d
=
x
.
Proof
.
rewrite
nth_lookup
.
by
intros
->
.
Qed
.
Lemma
nth_lookup_or_length
l
i
d
:
{
l
!!
i
=
Some
(
nth
i
l
d
)}
+
{
length
l
≤
i
}
.
Proof
.
revert
i
;
induction
l
;
intros
i
.
-
right
.
simpl
.
omega
.
-
destruct
i
;
simpl
.
+
left
.
done
.
+
destruct
(
IHl
i
)
as
[
->
|];
[
by
left
|]
.
right
.
omega
.
Qed
.
Lemma
nth_lookup
l
i
d
x
:
l
!!
i
=
Some
x
→
nth
i
l
d
=
x
.
Proof
.
revert
i
;
induction
l
;
intros
i
;
[
done
|]
.
destruct
i
;
simpl
.
-
congruence
.
-
apply
IHl
.
rewrite
nth_lookup
.
destruct
(
l
!!
i
)
eqn
:?;
eauto
using
lookup_ge_None_1
.
Qed
.
Lemma
list_insert_alter
l
i
x
:
<
[
i
:=
x
]
>
l
=
alter
(
λ
_,
x
)
i
l
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment