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
b778f3eb
Commit
b778f3eb
authored
7 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Plain Diff
Merge branch 'dfrumin/coq-stdpp-map_properties'
parents
9b01e3d8
cd0b7f48
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/fin_maps.v
+73
-8
73 additions, 8 deletions
theories/fin_maps.v
with
73 additions
and
8 deletions
theories/fin_maps.v
+
73
−
8
View file @
b778f3eb
...
...
@@ -843,14 +843,6 @@ Proof.
rewrite
elem_of_map_to_list
in
Hj
;
simplify_option_eq
.
Qed
.
(** Properties of the zip_with function *)
Lemma
map_lookup_zip_with
{
A
B
C
}
(
f
:
A
→
B
→
C
)
m1
m2
i
:
map_zip_with
f
m1
m2
!!
i
=
x
←
m1
!!
i
;
y
←
m2
!!
i
;
Some
(
f
x
y
)
.
Proof
.
unfold
map_zip_with
.
rewrite
lookup_merge
by
done
.
by
destruct
(
m1
!!
i
),
(
m2
!!
i
)
.
Qed
.
(** ** Properties of conversion from collections *)
Section
map_of_to_collection
.
Context
{
A
:
Type
}
`{
FinCollection
B
C
}
.
...
...
@@ -1136,6 +1128,79 @@ Lemma insert_merge_r m1 m2 i x z :
Proof
.
by
intros
;
apply
partial_alter_merge_r
.
Qed
.
End
more_merge
.
(** Properties of the zip_with function *)
Lemma
map_lookup_zip_with
{
A
B
C
}
(
f
:
A
→
B
→
C
)
m1
m2
i
:
map_zip_with
f
m1
m2
!!
i
=
x
←
m1
!!
i
;
y
←
m2
!!
i
;
Some
(
f
x
y
)
.
Proof
.
unfold
map_zip_with
.
rewrite
lookup_merge
by
done
.
by
destruct
(
m1
!!
i
),
(
m2
!!
i
)
.
Qed
.
Lemma
map_zip_with_empty
{
A
B
C
}
(
f
:
A
→
B
→
C
)
:
map_zip_with
f
∅
∅
=
∅.
Proof
.
unfold
map_zip_with
.
by
rewrite
merge_empty
by
done
.
Qed
.
Lemma
map_insert_zip_with
{
A
B
C
}
(
f
:
A
→
B
→
C
)
m1
m2
i
x
y
z
:
f
y
z
=
x
→
<
[
i
:=
x
]
>
(
map_zip_with
f
m1
m2
)
=
map_zip_with
f
(
<
[
i
:=
y
]
>
m1
)
(
<
[
i
:=
z
]
>
m2
)
.
Proof
.
intros
Hf
.
unfold
map_zip_with
.
erewrite
insert_merge
;
[
auto
|
by
compute
|
by
rewrite
Hf
]
.
Qed
.
Lemma
map_zip_with_fmap
{
A'
A
B'
B
C
}
(
f
:
A
→
B
→
C
)
(
g1
:
A'
→
A
)
(
g2
:
B'
→
B
)
m1
m2
:
map_zip_with
f
(
g1
<$>
m1
)
(
g2
<$>
m2
)
=
map_zip_with
(
λ
x
y
,
f
(
g1
x
)
(
g2
y
))
m1
m2
.
Proof
.
apply
map_eq
;
intro
i
.
rewrite
?map_lookup_zip_with
.
rewrite
?lookup_fmap
.
by
destruct
(
m1
!!
i
),
(
m2
!!
i
)
.
Qed
.
Lemma
map_zip_with_fmap_1
{
A'
A
B
C
}
(
f
:
A
→
B
→
C
)
(
g
:
A'
→
A
)
m1
m2
:
map_zip_with
f
(
g
<$>
m1
)
m2
=
map_zip_with
(
λ
x
y
,
f
(
g
x
)
y
)
m1
m2
.
Proof
.
rewrite
<-
(
map_fmap_id
m2
)
at
1
.
by
rewrite
map_zip_with_fmap
;
simpl
.
Qed
.
Lemma
map_zip_with_fmap_2
{
A
B'
B
C
}
(
f
:
A
→
B
→
C
)
(
g
:
B'
→
B
)
m1
m2
:
map_zip_with
f
m1
(
g
<$>
m2
)
=
map_zip_with
(
λ
x
y
,
f
x
(
g
y
))
m1
m2
.
Proof
.
rewrite
<-
(
map_fmap_id
m1
)
at
1
.
by
rewrite
map_zip_with_fmap
;
simpl
.
Qed
.
Lemma
map_fmap_zip_with
{
A
B
C
D
}
(
f
:
A
→
B
→
C
)
(
g
:
C
→
D
)
m1
m2
:
g
<$>
map_zip_with
f
m1
m2
=
map_zip_with
(
λ
x
y
,
g
(
f
x
y
))
m1
m2
.
Proof
.
apply
map_eq
;
intro
i
.
rewrite
lookup_fmap
.
rewrite
?map_lookup_zip_with
.
by
destruct
(
m1
!!
i
),
(
m2
!!
i
)
.
Qed
.
Lemma
map_zip_with_map_zip
{
A
B
C
}
(
f
:
A
→
B
→
C
)
m1
m2
:
map_zip_with
f
m1
m2
=
curry
f
<$>
map_zip
m1
m2
.
Proof
.
apply
map_eq
;
intro
i
.
rewrite
lookup_fmap
;
rewrite
?map_lookup_zip_with
;
rewrite
?lookup_fmap
.
by
destruct
(
m1
!!
i
),
(
m2
!!
i
)
.
Qed
.
Lemma
map_fmap_zip
{
A'
A
B'
B
}
(
g1
:
A'
→
A
)
(
g2
:
B'
→
B
)
m1
m2
:
map_zip
(
fmap
g1
m1
)
(
fmap
g2
m2
)
=
prod_map
g1
g2
<$>
map_zip
m1
m2
.
Proof
.
rewrite
map_zip_with_fmap
.
rewrite
map_zip_with_map_zip
.
generalize
(
map_zip
m1
m2
);
intro
m
.
apply
map_eq
;
intro
i
.
by
rewrite
?lookup_fmap
;
destruct
(
m
!!
i
)
as
[[
x1
x2
]|]
.
Qed
.
(** ** Properties on the [map_relation] relation *)
Section
Forall2
.
Context
{
A
B
}
(
R
:
A
→
B
→
Prop
)
(
P
:
A
→
Prop
)
(
Q
:
B
→
Prop
)
.
...
...
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