Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marianna Rapoport
iriscoq
Commits
97e8a9de
Commit
97e8a9de
authored
Jul 25, 2016
by
Robbert Krebbers
Browse files
More documentation of [coPset].
parent
b198ab3a
Changes
1
Hide whitespace changes
Inline
Sidebyside
prelude/coPset.v
View file @
97e8a9de
(* Copyright (c) 20122015, Robbert Krebbers. *)
(* Copyright (c) 20122015, Robbert Krebbers. *)
(* This file is distributed under the terms of the BSD license. *)
(* This file is distributed under the terms of the BSD license. *)
(** This files implements an efficient implementation of finite/cofinite sets
(** This files implements the type [coPset] of efficient finite/cofinite sets
of positive binary naturals [positive]. *)
of positive binary naturals [positive]. These sets are:
 Closed under union, intersection and set complement.
 Closed under splitting of cofinite sets.
Also, they enjoy various nice properties, such as decidable equality and set
membership, as well as extensional equality (i.e. [X = Y ↔ ∀ x, x ∈ X ↔ x ∈ Y]).
Since [positive]s are bitstrings, we encode [coPset]s as trees that correspond
to the decision function that map bitstrings to bools. *)
From
iris
.
prelude
Require
Export
collections
.
From
iris
.
prelude
Require
Export
collections
.
From
iris
.
prelude
Require
Import
pmap
gmap
mapset
.
From
iris
.
prelude
Require
Import
pmap
gmap
mapset
.
Local
Open
Scope
positive_scope
.
Local
Open
Scope
positive_scope
.
...
@@ 228,9 +237,9 @@ Proof.
...
@@ 228,9 +237,9 @@ Proof.
refine
(
cast_if
(
decide
(
coPset_finite
(
`
X
))))
;
by
rewrite
coPset_finite_spec
.
refine
(
cast_if
(
decide
(
coPset_finite
(
`
X
))))
;
by
rewrite
coPset_finite_spec
.
Defined
.
Defined
.
(** * Pick element from infi
ti
nite sets *)
(** * Pick element from infinite sets *)
(*
just
depthfirst search
: using this to pick elements
results in very
(*
Implemented using
depthfirst search
, which
results in very
unbalanced
unbalanced
trees. *)
trees. *)
Fixpoint
coPpick_raw
(
t
:
coPset_raw
)
:
option
positive
:
=
Fixpoint
coPpick_raw
(
t
:
coPset_raw
)
:
option
positive
:
=
match
t
with
match
t
with

coPLeaf
true

coPNode
true
_
_
=>
Some
1

coPLeaf
true

coPNode
true
_
_
=>
Some
1
...
...
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