Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Iris
stdpp
Commits
41c7048e
Commit
41c7048e
authored
Jan 25, 2015
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More properties about conversions between natsets and Boolean lists.
parent
bf21d0d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
theories/natmap.v
theories/natmap.v
+28
-0
No files found.
theories/natmap.v
View file @
41c7048e
...
...
@@ -287,6 +287,8 @@ Proof.
Qed
.
Lemma
to_bools_length
(
X
:
natset
)
sz
:
length
(
to_bools
sz
X
)
=
sz
.
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
β
:
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
β
↔
(
i
∈
X
↔
β
=
true
).
Proof
.
...
...
@@ -302,6 +304,32 @@ Qed.
Lemma
lookup_to_bools_true
sz
X
i
:
i
<
sz
→
to_bools
sz
X
!!
i
=
Some
true
↔
i
∈
X
.
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 *)
Definition
natmap_push
{
A
}
(
o
:
option
A
)
(
m
:
natmap
A
)
:
natmap
A
:
=
...
...
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