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
32b2e751
Commit
32b2e751
authored
9 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Pick element from infinite coPset.
parent
36bfee17
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/co_pset.v
+31
-0
31 additions, 0 deletions
theories/co_pset.v
with
31 additions
and
0 deletions
theories/co_pset.v
+
31
−
0
View file @
32b2e751
...
...
@@ -210,6 +210,37 @@ Proof.
refine
(
cast_if
(
decide
(
coPset_finite
(
`
X
))));
by
rewrite
coPset_finite_spec
.
Defined
.
(** * Pick element from infitinite sets *)
(* just depth-first search: using this to pick elements results in very
unbalanced trees. *)
Fixpoint
coPpick_raw
(
t
:
coPset_raw
)
:
option
positive
:=
match
t
with
|
coPLeaf
true
|
coPNode
true
_
_
=>
Some
1
|
coPLeaf
false
=>
None
|
coPNode
false
l
r
=>
match
coPpick_raw
l
with
|
Some
i
=>
Some
(
i
~
0
)
|
None
=>
(
~
1
)
<$>
coPpick_raw
r
end
end
.
Definition
coPpick
(
X
:
coPset
)
:
positive
:=
from_option
1
(
coPpick_raw
(
`
X
))
.
Lemma
coPpick_raw_elem_of
t
i
:
coPpick_raw
t
=
Some
i
→
e_of
i
t
.
Proof
.
revert
i
;
induction
t
as
[[]|[]
l
?
r
];
intros
i
?;
simplify_equality'
;
auto
.
destruct
(
coPpick_raw
l
);
simplify_option_equality
;
auto
.
Qed
.
Lemma
coPpick_raw_None
t
:
coPpick_raw
t
=
None
→
coPset_finite
t
.
Proof
.
induction
t
as
[[]|[]
l
?
r
];
intros
i
;
simplify_equality'
;
auto
.
destruct
(
coPpick_raw
l
);
simplify_option_equality
;
auto
.
Qed
.
Lemma
coPpick_elem_of
X
:
¬
set_finite
X
→
coPpick
X
∈
X
.
Proof
.
destruct
X
as
[
t
?];
unfold
coPpick
;
destruct
(
coPpick_raw
_)
as
[
j
|]
eqn
:?
.
*
by
intros
;
apply
coPpick_raw_elem_of
.
*
by
intros
[];
apply
coPset_finite_spec
,
coPpick_raw_None
.
Qed
.
(** * Conversion to psets *)
Fixpoint
to_Pset_raw
(
t
:
coPset_raw
)
:
Pmap_raw
()
:=
match
t
with
...
...
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