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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
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
Iris
stdpp
Commits
c52f9b1c
Commit
c52f9b1c
authored
3 weeks ago
by
Rudy Peterson
Committed by
Robbert Krebbers
3 weeks ago
Browse files
Options
Downloads
Patches
Plain Diff
Vector Forall Lemmas, for all!
parent
fd17255c
No related branches found
No related tags found
1 merge request
!599
Vector Forall Lemmas, for all!
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
stdpp/vector.v
+11
-0
11 additions, 0 deletions
stdpp/vector.v
with
12 additions
and
0 deletions
CHANGELOG.md
+
1
−
0
View file @
c52f9b1c
...
...
@@ -3,6 +3,7 @@ API-breaking change is listed.
## std++ master
-
Add lemmas
`Forall_vinsert`
and
`Forall_vreplicate`
. (by Rudy Peterson)
-
Add
`disj_union_list`
and associated lemmas for
`gmultiset`
. (by Marijn van Wezel)
-
Add lemma
`lookup_total_fmap`
.
-
Add lemmas about
`last`
and
`head`
:
`last_app_Some`
,
`last_app_None`
,
...
...
This diff is collapsed.
Click to expand it.
stdpp/vector.v
+
11
−
0
View file @
c52f9b1c
...
...
@@ -297,6 +297,12 @@ Lemma vmap_insert {A B} (f : A → B) (n : nat) i x (v : vec A n) :
vmap
f
(
vinsert
i
x
v
)
=
vinsert
i
(
f
x
)
(
vmap
f
v
)
.
Proof
.
induction
v
;
inv_fin
i
;
intros
;
f_equal
/=
;
auto
.
Qed
.
Lemma
Forall_vinsert
{
A
}
(
P
:
A
→
Prop
)
{
n
}
(
v
:
vec
A
n
)
(
i
:
fin
n
)
(
x
:
A
)
:
Forall
P
(
vec_to_list
v
)
→
P
x
→
Forall
P
(
vec_to_list
(
vinsert
i
x
v
))
.
Proof
.
rewrite
vec_to_list_insert
.
apply
Forall_insert
.
Qed
.
(** The functions [vtake i v] and [vdrop i v] take the first [i] elements of
a vector [v], respectively remove the first [i] elements of a vector [v]. *)
Fixpoint
vtake
{
A
n
}
(
i
:
fin
n
)
:
vec
A
n
→
vec
A
i
:=
...
...
@@ -333,6 +339,11 @@ Lemma vmap_replicate {A B} (f : A → B) n (x : A) :
vmap
f
(
vreplicate
n
x
)
=
vreplicate
n
(
f
x
)
.
Proof
.
induction
n
;
f_equal
/=
;
auto
.
Qed
.
Lemma
Forall_vreplicate
{
A
}
(
P
:
A
→
Prop
)
n
(
x
:
A
)
:
P
x
→
Forall
P
(
vec_to_list
(
vreplicate
n
x
))
.
Proof
.
rewrite
vec_to_list_replicate
.
apply
Forall_replicate
.
Qed
.
(** Vectors are inhabited and countable *)
Global
Instance
vec_0_inhabited
T
:
Inhabited
(
vec
T
0
)
:=
populate
[
#
]
.
Global
Instance
vec_inhabited
`{
Inhabited
T
}
n
:
Inhabited
(
vec
T
n
)
:=
...
...
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