Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
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
Simcha van Collem
Iris
Commits
4d5474e2
Commit
4d5474e2
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Conversion gset -> gmap.
parent
f372c5c1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
prelude/gmap.v
+27
-0
27 additions, 0 deletions
prelude/gmap.v
with
27 additions
and
0 deletions
prelude/gmap.v
+
27
−
0
View file @
4d5474e2
...
...
@@ -122,6 +122,33 @@ Definition of_gset `{Countable A} (X : gset A) : set A := mkSet (λ x, x ∈ X).
Lemma
elem_of_of_gset
`{
Countable
A
}
(
X
:
gset
A
)
x
:
x
∈
of_gset
X
↔
x
∈
X
.
Proof
.
done
.
Qed
.
Definition
to_gmap
`{
Countable
K
}
{
A
}
(
x
:
A
)
(
X
:
gset
K
)
:
gmap
K
A
:=
(
λ
_,
x
)
<$>
mapset_car
X
.
Lemma
lookup_to_gmap
`{
Countable
K
}
{
A
}
(
x
:
A
)
(
X
:
gset
K
)
i
:
to_gmap
x
X
!!
i
=
guard
(
i
∈
X
);
Some
x
.
Proof
.
destruct
X
as
[
X
];
unfold
to_gmap
,
elem_of
,
mapset_elem_of
;
simpl
.
rewrite
lookup_fmap
.
case_option_guard
;
destruct
(
X
!!
i
)
as
[[]|];
naive_solver
.
Qed
.
Lemma
lookup_to_gmap_Some
`{
Countable
K
}
{
A
}
(
x
:
A
)
(
X
:
gset
K
)
i
y
:
to_gmap
x
X
!!
i
=
Some
y
↔
i
∈
X
∧
x
=
y
.
Proof
.
rewrite
lookup_to_gmap
.
simplify_option_eq
;
naive_solver
.
Qed
.
Lemma
lookup_to_gmap_None
`{
Countable
K
}
{
A
}
(
x
:
A
)
(
X
:
gset
K
)
i
:
to_gmap
x
X
!!
i
=
None
↔
i
∉
X
.
Proof
.
rewrite
lookup_to_gmap
.
simplify_option_eq
;
naive_solver
.
Qed
.
Lemma
to_gmap_empty
`{
Countable
K
}
{
A
}
(
x
:
A
)
:
to_gmap
x
∅
=
∅.
Proof
.
apply
fmap_empty
.
Qed
.
Lemma
to_gmap_union_singleton
`{
Countable
K
}
{
A
}
(
x
:
A
)
i
Y
:
to_gmap
x
({[
i
]}
∪
Y
)
=
<
[
i
:=
x
]
>
(
to_gmap
x
Y
)
.
Proof
.
apply
map_eq
;
intros
j
;
apply
option_eq
;
intros
y
.
rewrite
lookup_insert_Some
,
!
lookup_to_gmap_Some
,
elem_of_union
,
elem_of_singleton
;
destruct
(
decide
(
i
=
j
));
intuition
.
Qed
.
(** * Fresh elements *)
(* This is pretty ad-hoc and just for the case of [gset positive]. We need a
notion of countable non-finite types to generalize this. *)
...
...
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