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
41c7048e
Commit
41c7048e
authored
10 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
More properties about conversions between natsets and Boolean lists.
parent
bf21d0d2
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
theories/natmap.v
+28
-0
28 additions, 0 deletions
theories/natmap.v
with
28 additions
and
0 deletions
theories/natmap.v
+
28
−
0
View file @
41c7048e
...
@@ -287,6 +287,8 @@ Proof.
...
@@ -287,6 +287,8 @@ Proof.
Qed
.
Qed
.
Lemma
to_bools_length
(
X
:
natset
)
sz
:
length
(
to_bools
sz
X
)
=
sz
.
Lemma
to_bools_length
(
X
:
natset
)
sz
:
length
(
to_bools
sz
X
)
=
sz
.
Proof
.
apply
resize_length
.
Qed
.
Proof
.
apply
resize_length
.
Qed
.
Lemma
lookup_to_bools_ge
sz
X
i
:
sz
≤
i
→
to_bools
sz
X
!!
i
=
None
.
Proof
.
by
apply
lookup_resize_old
.
Qed
.
Lemma
lookup_to_bools
sz
X
i
β
:
Lemma
lookup_to_bools
sz
X
i
β
:
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
β
↔
(
i
∈
X
↔
β
=
true
)
.
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
β
↔
(
i
∈
X
↔
β
=
true
)
.
Proof
.
Proof
.
...
@@ -302,6 +304,32 @@ Qed.
...
@@ -302,6 +304,32 @@ Qed.
Lemma
lookup_to_bools_true
sz
X
i
:
Lemma
lookup_to_bools_true
sz
X
i
:
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
true
↔
i
∈
X
.
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
true
↔
i
∈
X
.
Proof
.
intros
.
rewrite
lookup_to_bools
by
done
.
intuition
.
Qed
.
Proof
.
intros
.
rewrite
lookup_to_bools
by
done
.
intuition
.
Qed
.
Lemma
lookup_to_bools_false
sz
X
i
:
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
false
↔
i
∉
X
.
Proof
.
intros
.
rewrite
lookup_to_bools
by
done
.
naive_solver
.
Qed
.
Lemma
to_bools_union
sz
X1
X2
:
to_bools
sz
(
X1
∪
X2
)
=
to_bools
sz
X1
||
*
to_bools
sz
X2
.
Proof
.
apply
list_eq
;
intros
i
;
rewrite
lookup_zip_with
.
destruct
(
decide
(
i
<
sz
));
[|
by
rewrite
!
lookup_to_bools_ge
by
lia
]
.
apply
option_eq
;
intros
β
.
rewrite
lookup_to_bools
,
elem_of_union
by
done
;
intros
.
destruct
(
decide
(
i
∈
X1
)),
(
decide
(
i
∈
X2
));
repeat
first
[
rewrite
(
λ
X
H
,
proj2
(
lookup_to_bools_true
sz
X
i
H
))
by
done
|
rewrite
(
λ
X
H
,
proj2
(
lookup_to_bools_false
sz
X
i
H
))
by
done
];
destruct
β
;
naive_solver
.
Qed
.
Lemma
to_of_bools
βs
sz
:
to_bools
sz
(
of_bools
βs
)
=
resize
sz
false
βs
.
Proof
.
apply
list_eq
;
intros
i
.
destruct
(
decide
(
i
<
sz
));
[|
by
rewrite
lookup_to_bools_ge
,
lookup_resize_old
by
lia
]
.
apply
option_eq
;
intros
β
.
rewrite
lookup_to_bools
,
elem_of_of_bools
by
done
.
destruct
(
decide
(
i
<
length
βs
))
.
{
rewrite
lookup_resize
by
done
.
destruct
(
lookup_lt_is_Some_2
βs
i
)
as
[[]];
destruct
β
;
naive_solver
.
}
rewrite
lookup_resize_new
,
lookup_ge_None_2
by
lia
.
destruct
β
;
naive_solver
.
Qed
.
(** A [natmap A] forms a stack with elements of type [A] and possible holes *)
(** A [natmap A] forms a stack with elements of type [A] and possible holes *)
Definition
natmap_push
{
A
}
(
o
:
option
A
)
(
m
:
natmap
A
)
:
natmap
A
:=
Definition
natmap_push
{
A
}
(
o
:
option
A
)
(
m
:
natmap
A
)
:
natmap
A
:=
...
...
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