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
Package registry
Model registry
Operate
Terraform modules
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
Adam
stdpp
Commits
fc5f32d7
Commit
fc5f32d7
authored
2 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Simplify definition of `mapset_dom_with`.
parent
5ea9d5a4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
stdpp/mapset.v
+3
-5
3 additions, 5 deletions
stdpp/mapset.v
tests/fin_maps.v
+7
-0
7 additions, 0 deletions
tests/fin_maps.v
with
10 additions
and
5 deletions
stdpp/mapset.v
+
3
−
5
View file @
fc5f32d7
...
...
@@ -109,11 +109,9 @@ Definition mapset_map_with {A B} (f : bool → A → option B)
match
x
,
y
with
|
Some
_,
Some
a
=>
f
true
a
|
None
,
Some
a
=>
f
false
a
|
_,
None
=>
None
end
)
mX
.
Definition
mapset_dom_with
{
A
}
(
f
:
A
→
bool
)
(
m
:
M
A
)
:
mapset
M
:=
Mapset
$
merge
(
λ
x
_,
match
x
with
|
Some
a
=>
if
f
a
then
Some
()
else
None
|
None
=>
None
end
)
m
(
@
empty
(
M
A
)
_)
.
Mapset
$
omap
(
λ
a
,
if
f
a
then
Some
()
else
None
)
m
.
Lemma
lookup_mapset_map_with
{
A
B
}
(
f
:
bool
→
A
→
option
B
)
X
m
i
:
mapset_map_with
f
X
m
!!
i
=
m
!!
i
≫=
f
(
bool_decide
(
i
∈
X
))
.
...
...
@@ -126,7 +124,7 @@ Lemma elem_of_mapset_dom_with {A} (f : A → bool) m i :
i
∈
mapset_dom_with
f
m
↔
∃
x
,
m
!!
i
=
Some
x
∧
f
x
.
Proof
.
unfold
mapset_dom_with
,
elem_of
,
mapset_elem_of
.
simpl
.
rewrite
lookup_
merge
,
lookup_empty
.
destruct
(
m
!!
i
)
as
[
a
|];
simpl
.
simpl
.
rewrite
lookup_
omap
.
destruct
(
m
!!
i
)
as
[
a
|];
simpl
.
-
destruct
(
Is_true_reflect
(
f
a
));
naive_solver
.
-
naive_solver
.
Qed
.
...
...
This diff is collapsed.
Click to expand it.
tests/fin_maps.v
+
7
−
0
View file @
fc5f32d7
...
...
@@ -289,6 +289,13 @@ Theorem gmap_insert_positives_union_reflexivity_1000 :
=
gmap_insert_positives
1
1
1000
.
Proof
.
(* this should less than a second *)
reflexivity
.
Qed
.
(** This should be immediate, see std++ issue #183 *)
Goal
dom
((
<
[
10
%
positive
:=
1
]
>
∅
)
:
Pmap
_)
=
dom
((
<
[
10
%
positive
:=
2
]
>
∅
)
:
Pmap
_)
.
Proof
.
reflexivity
.
Qed
.
Goal
dom
((
<
[
"f"
:=
1
]
>
∅
)
:
gmap
_
_)
=
dom
((
<
[
"f"
:=
2
]
>
∅
)
:
gmap
_
_)
.
Proof
.
reflexivity
.
Qed
.
(** Make sure that [pmap] and [gmap] can be used in nested inductive
definitions *)
...
...
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