Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stdpp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
46
Issues
46
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iris
stdpp
Commits
ced43e23
Commit
ced43e23
authored
Jan 16, 2016
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conversion gset positive > coPset.
parent
32b2e751
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
32 additions
and
15 deletions
+32
15
theories/co_pset.v
theories/co_pset.v
+32
15
No files found.
theories/co_pset.v
View file @
ced43e23
...
...
@@ 3,7 +3,7 @@
(** This files implements an efficient implementation of finite/cofinite sets
of positive binary naturals [positive]. *)
Require
Export
prelude
.
collections
.
Require
Import
prelude
.
pmap
prelude
.
mapset
.
Require
Import
prelude
.
pmap
prelude
.
gmap
prelude
.
mapset
.
Local
Open
Scope
positive_scope
.
(** * The tree data structure *)
...
...
@@ 274,18 +274,43 @@ Proof.
*
destruct
l
as
[[]],
r
as
[[]]
;
simpl
in
*
;
rewrite
?andb_true_r
;
rewrite
?andb_True
;
rewrite
?andb_True
in
IHl
,
IHr
;
intuition
.
Qed
.
Lemma
elem_of_of_Pset_raw
i
t
:
e_of
i
(
of_Pset_raw
t
)
↔
t
!!
i
=
Some
().
Proof
.
by
revert
i
;
induction
t
as
[[[]]]
;
intros
[]
;
simpl
;
auto
;
split
.
Qed
.
Lemma
of_Pset_raw_finite
t
:
coPset_finite
(
of_Pset_raw
t
).
Proof
.
induction
t
as
[[[]]]
;
simpl
;
rewrite
?andb_True
;
auto
.
Qed
.
Definition
of_Pset
(
X
:
Pset
)
:
coPset
:
=
let
'
Mapset
(
PMap
t
Ht
)
:
=
X
in
of_Pset_raw
t
↾
of_Pset_wf
_
Ht
.
Lemma
elem_of_of_Pset
X
i
:
i
∈
of_Pset
X
↔
i
∈
X
.
Proof
.
destruct
X
as
[[
t
?]]
;
apply
elem_of_of_Pset_raw
.
Qed
.
Lemma
of_Pset_finite
X
:
set_finite
(
of_Pset
X
).
Proof
.
destruct
X
as
[[
t
Ht
]]
;
change
(
e_of
i
(
of_Pset_raw
t
)
↔
t
!!
i
=
Some
()).
clear
Ht
;
revert
i
.
induction
t
as
[[[]]
l
IHl
r
IHr
]
;
intros
[
i

i
]
;
simpl
;
auto
;
by
split
.
apply
coPset_finite_spec
;
destruct
X
as
[[
t
?]]
;
apply
of_Pset_raw_finite
.
Qed
.
Lemma
of_Pset_finite
X
:
set_finite
(
of_Pset
X
).
(** * Conversion from gsets of positives *)
Definition
of_gset
(
X
:
gset
positive
)
:
coPset
:
=
let
'
Mapset
(
GMap
(
PMap
t
Ht
)
_
)
:
=
X
in
of_Pset_raw
t
↾
of_Pset_wf
_
Ht
.
Lemma
elem_of_of_gset
X
i
:
i
∈
of_gset
X
↔
i
∈
X
.
Proof
.
destruct
X
as
[[[
t
?]]]
;
apply
elem_of_of_Pset_raw
.
Qed
.
Lemma
of_gset_finite
X
:
set_finite
(
of_gset
X
).
Proof
.
apply
coPset_finite_spec
;
destruct
X
as
[[[
t
?]]]
;
apply
of_Pset_raw_finite
.
Qed
.
(** * Domain of finite maps *)
Instance
Pmap_dom_coPset
{
A
}
:
Dom
(
Pmap
A
)
coPset
:
=
λ
m
,
of_Pset
(
dom
_
m
).
Instance
Pmap_dom_coPset_spec
:
FinMapDom
positive
Pmap
coPset
.
Proof
.
rewrite
coPset_finite_spec
;
destruct
X
as
[[
t
Ht
]]
;
simpl
;
clear
Ht
.
induction
t
as
[[[]]
l
IHl
r
IHr
]
;
simpl
;
rewrite
?andb_True
;
auto
.
split
;
try
apply
_;
intros
A
m
i
;
unfold
dom
,
Pmap_dom_coPset
.
by
rewrite
elem_of_of_Pset
,
elem_of_dom
.
Qed
.
Instance
gmap_dom_coPset
{
A
}
:
Dom
(
gmap
positive
A
)
coPset
:
=
λ
m
,
of_gset
(
dom
_
m
).
Instance
gmap_dom_coPset_spec
:
FinMapDom
positive
(
gmap
positive
)
coPset
.
Proof
.
split
;
try
apply
_;
intros
A
m
i
;
unfold
dom
,
gmap_dom_coPset
.
by
rewrite
elem_of_of_gset
,
elem_of_dom
.
Qed
.
(** * Suffix sets *)
...
...
@@ 307,14 +332,6 @@ Proof.
*
by
intros
[
q'
>]
;
induction
q
;
simpl
;
rewrite
?coPset_elem_of_node
.
Qed
.
(** * Domain of finite maps *)
Instance
Pmap_dom_Pset
{
A
}
:
Dom
(
Pmap
A
)
coPset
:
=
λ
m
,
of_Pset
(
dom
_
m
).
Instance
Pmap_dom_coPset
:
FinMapDom
positive
Pmap
coPset
.
Proof
.
split
;
try
apply
_;
intros
A
m
i
;
unfold
dom
,
Pmap_dom_Pset
.
by
rewrite
elem_of_of_Pset
,
elem_of_dom
.
Qed
.
(** * Splitting of infinite sets *)
Fixpoint
coPset_l_raw
(
t
:
coPset_raw
)
:
coPset_raw
:
=
match
t
with
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment