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
fe8930b6
There was a problem fetching the pipeline summary.
Commit
fe8930b6
authored
7 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Plain Diff
Merge branch 'gmap_filter'
parents
2175e39f
20f1b822
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/fin_map_dom.v
+7
-0
7 additions, 0 deletions
theories/fin_map_dom.v
theories/fin_maps.v
+50
-0
50 additions, 0 deletions
theories/fin_maps.v
with
57 additions
and
0 deletions
theories/fin_map_dom.v
+
7
−
0
View file @
fe8930b6
...
...
@@ -19,6 +19,13 @@ Class FinMapDom K M D `{∀ A, Dom (M A) D, FMap M,
Section
fin_map_dom
.
Context
`{
FinMapDom
K
M
D
}
.
Lemma
dom_map_filter
{
A
}
(
P
:
K
*
A
→
Prop
)
`{
!∀
x
,
Decision
(
P
x
)}
(
m
:
M
A
):
dom
D
(
filter
P
m
)
⊆
dom
D
m
.
Proof
.
intros
?
.
rewrite
2
!
elem_of_dom
.
destruct
1
as
[?[
Eq
_]
%
map_filter_lookup_Some
]
.
by
eexists
.
Qed
.
Lemma
elem_of_dom_2
{
A
}
(
m
:
M
A
)
i
x
:
m
!!
i
=
Some
x
→
i
∈
dom
D
m
.
Proof
.
rewrite
elem_of_dom
;
eauto
.
Qed
.
Lemma
not_elem_of_dom
{
A
}
(
m
:
M
A
)
i
:
i
∉
dom
D
m
↔
m
!!
i
=
None
.
...
...
This diff is collapsed.
Click to expand it.
theories/fin_maps.v
+
50
−
0
View file @
fe8930b6
...
...
@@ -130,6 +130,9 @@ is unspecified. *)
Definition
map_fold
`{
FinMapToList
K
A
M
}
{
B
}
(
f
:
K
→
A
→
B
→
B
)
(
b
:
B
)
:
M
→
B
:=
foldr
(
curry
f
)
b
∘
map_to_list
.
Instance
map_filter
`{
FinMapToList
K
A
M
,
Insert
K
A
M
,
Empty
M
}
:
Filter
(
K
*
A
)
M
:=
λ
P
_,
map_fold
(
λ
k
v
m
,
if
decide
(
P
(
k
,
v
))
then
<
[
k
:=
v
]
>
m
else
m
)
∅.
(** * Theorems *)
Section
theorems
.
Context
`{
FinMap
K
M
}
.
...
...
@@ -1002,6 +1005,53 @@ Proof.
assert
(
m
!!
j
=
Some
y
)
by
(
apply
Hm
;
by
right
)
.
naive_solver
.
Qed
.
(** ** The filter operation *)
Section
map_Filter
.
Context
{
A
}
(
P
:
K
*
A
→
Prop
)
`{
!∀
x
,
Decision
(
P
x
)}
.
Implicit
Types
m
:
M
A
.
Lemma
map_filter_lookup_Some
m
i
x
:
filter
P
m
!!
i
=
Some
x
↔
m
!!
i
=
Some
x
∧
P
(
i
,
x
)
.
Proof
.
revert
m
i
x
.
apply
(
map_fold_ind
(
λ
m1
m2
,
∀
i
x
,
m1
!!
i
=
Some
x
↔
m2
!!
i
=
Some
x
∧
P
_));
intros
i
x
.
-
rewrite
lookup_empty
.
naive_solver
.
-
intros
m
m'
Hm
Eq
j
y
.
case_decide
;
case
(
decide
(
j
=
i
))
as
[
->
|?]
.
+
rewrite
2
!
lookup_insert
.
naive_solver
.
+
rewrite
!
lookup_insert_ne
by
done
.
by
apply
Eq
.
+
rewrite
Eq
,
Hm
,
lookup_insert
.
naive_solver
.
+
by
rewrite
lookup_insert_ne
.
Qed
.
Lemma
map_filter_lookup_None
m
i
:
filter
P
m
!!
i
=
None
↔
m
!!
i
=
None
∨
∀
x
,
m
!!
i
=
Some
x
→
¬
P
(
i
,
x
)
.
Proof
.
rewrite
eq_None_not_Some
.
unfold
is_Some
.
setoid_rewrite
map_filter_lookup_Some
.
naive_solver
.
Qed
.
Lemma
map_filter_lookup_eq
m1
m2
:
(
∀
k
x
,
P
(
k
,
x
)
→
m1
!!
k
=
Some
x
↔
m2
!!
k
=
Some
x
)
→
filter
P
m1
=
filter
P
m2
.
Proof
.
intros
HP
.
apply
map_eq
.
intros
i
.
apply
option_eq
;
intros
x
.
rewrite
!
map_filter_lookup_Some
.
naive_solver
.
Qed
.
Lemma
map_filter_lookup_insert
m
i
x
:
P
(
i
,
x
)
→
<
[
i
:=
x
]
>
(
filter
P
m
)
=
filter
P
(
<
[
i
:=
x
]
>
m
)
.
Proof
.
intros
HP
.
apply
map_eq
.
intros
j
.
apply
option_eq
;
intros
y
.
destruct
(
decide
(
j
=
i
))
as
[
->
|?]
.
-
rewrite
map_filter_lookup_Some
,
!
lookup_insert
.
naive_solver
.
-
rewrite
lookup_insert_ne
,
!
map_filter_lookup_Some
,
lookup_insert_ne
by
done
.
naive_solver
.
Qed
.
Lemma
map_filter_empty
:
filter
P
(
∅
:
M
A
)
=
∅.
Proof
.
apply
map_fold_empty
.
Qed
.
End
map_Filter
.
(** ** Properties of the [map_Forall] predicate *)
Section
map_Forall
.
Context
{
A
}
(
P
:
K
→
A
→
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