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
bb981de3
Commit
bb981de3
authored
5 months ago
by
Marijn van Wezel
Browse files
Options
Downloads
Patches
Plain Diff
Move to section and add lemmas
parent
65cf7d06
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!577
Add `gmultiset_map` and associated lemmas
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stdpp/gmultiset.v
+61
-4
61 additions, 4 deletions
stdpp/gmultiset.v
with
61 additions
and
4 deletions
stdpp/gmultiset.v
+
61
−
4
View file @
bb981de3
...
...
@@ -61,10 +61,6 @@ Section definitions.
Global
Instance
gmultiset_dom
:
Dom
(
gmultiset
A
)
(
gset
A
)
:=
λ
X
,
let
(
X
)
:=
X
in
dom
X
.
Definition
gmultiset_map
`{
Elements
A
C
,
SingletonMS
B
D
,
Empty
D
,
DisjUnion
D
}
(
f
:
A
→
B
)
(
X
:
C
)
:
D
:=
list_to_set_disj
(
f
<$>
elements
X
)
.
End
definitions
.
Global
Typeclasses
Opaque
gmultiset_elem_of
gmultiset_subseteq
.
...
...
@@ -780,3 +776,64 @@ Section more_lemmas.
apply
Hinsert
,
IH
;
multiset_solver
.
Qed
.
End
more_lemmas
.
(** * Map *)
Section
map
.
Context
`{
Countable
A
,
Countable
B
}
.
Implicit
Type
f
:
A
->
B
.
Definition
gmultiset_map
(
f
:
A
→
B
)
(
X
:
gmultiset
A
)
:
gmultiset
B
:=
list_to_set_disj
(
f
<$>
elements
X
)
.
Lemma
elem_of_gmultiset_map
f
X
y
:
y
∈
gmultiset_map
f
X
↔
∃
x
,
y
=
f
x
∧
x
∈
X
.
Proof
.
unfold
gmultiset_map
.
rewrite
elem_of_list_to_set_disj
,
elem_of_list_fmap
.
by
setoid_rewrite
gmultiset_elem_of_elements
.
Qed
.
Lemma
gmultiset_map_empty
f
:
gmultiset_map
f
∅
=
∅.
Proof
.
done
.
Qed
.
Lemma
gmultiset_map_disj_union
f
X
Y
:
gmultiset_map
f
(
X
⊎
Y
)
=
gmultiset_map
f
X
⊎
gmultiset_map
f
Y
.
Proof
.
unfold
gmultiset_map
.
rewrite
gmultiset_elements_disj_union
,
fmap_app
.
by
rewrite
list_to_set_disj_app
.
Qed
.
Lemma
gmultiset_map_singleton
f
x
:
gmultiset_map
f
{[
+
x
+
]}
=
{[
+
f
x
+
]}
.
Proof
.
unfold
gmultiset_map
.
rewrite
gmultiset_elements_singleton
.
multiset_solver
.
Qed
.
Lemma
multiplicity_gmultiset_map_inj
f
X
x
:
Inj
(
=
)
(
=
)
f
→
multiplicity
(
f
x
)
(
gmultiset_map
f
X
)
=
multiplicity
x
X
.
Proof
.
induction
X
as
[|
y
]
using
gmultiset_ind
;
intros
Hinj
.
-
multiset_solver
.
-
rewrite
gmultiset_map_disj_union
,
!
multiplicity_disj_union
,
IHX
;
[|
done
]
.
destruct
(
bool_decide
(
x
=
y
));
rewrite
gmultiset_map_singleton
;
multiset_solver
.
Qed
.
Global
Instance
set_unfold_gmultiset_map
(
f
:
A
→
B
)
(
X
:
gmultiset
A
)
(
P
:
A
→
Prop
)
y
:
(
∀
x
,
SetUnfoldElemOf
x
X
(
P
x
))
→
SetUnfoldElemOf
y
(
gmultiset_map
f
X
)
(
∃
x
,
y
=
f
x
∧
P
x
)
.
Proof
.
constructor
.
rewrite
elem_of_gmultiset_map
;
naive_solver
.
Qed
.
Global
Instance
multiset_unfold_map
x
X
n
f
:
Inj
(
=
)
(
=
)
f
→
MultisetUnfold
x
X
n
→
MultisetUnfold
(
f
x
)
(
gmultiset_map
f
X
)
n
.
Proof
.
intros
Hinj
[
HX
];
constructor
.
by
rewrite
multiplicity_gmultiset_map_inj
,
HX
.
Qed
.
End
map
.
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