Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Tej Chajed
iris
Commits
b7a8a0cc
Commit
b7a8a0cc
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Some more of_list stuff.
parent
90f773c0
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
prelude/collections.v
+47
-21
47 additions, 21 deletions
prelude/collections.v
with
47 additions
and
21 deletions
prelude/collections.v
+
47
−
21
View file @
b7a8a0cc
...
...
@@ -240,6 +240,31 @@ Section set_unfold_monad.
Proof
.
constructor
.
rewrite
elem_of_join
;
naive_solver
.
Qed
.
End
set_unfold_monad
.
Section
set_unfold_list
.
Context
{
A
:
Type
}
.
Implicit
Types
x
:
A
.
Implicit
Types
l
:
list
A
.
Global
Instance
set_unfold_nil
x
:
SetUnfold
(
x
∈
[])
False
.
Proof
.
constructor
;
apply
elem_of_nil
.
Qed
.
Global
Instance
set_unfold_cons
x
y
l
P
:
SetUnfold
(
x
∈
l
)
P
→
SetUnfold
(
x
∈
y
::
l
)
(
x
=
y
∨
P
)
.
Proof
.
constructor
.
by
rewrite
elem_of_cons
,
(
set_unfold
(
x
∈
l
)
P
)
.
Qed
.
Global
Instance
set_unfold_app
x
l
k
P
Q
:
SetUnfold
(
x
∈
l
)
P
→
SetUnfold
(
x
∈
k
)
Q
→
SetUnfold
(
x
∈
l
++
k
)
(
P
∨
Q
)
.
Proof
.
intros
??;
constructor
.
by
rewrite
elem_of_app
,
(
set_unfold
(
x
∈
l
)
P
),
(
set_unfold
(
x
∈
k
)
Q
)
.
Qed
.
Global
Instance
set_unfold_included
l
k
(
P
Q
:
A
→
Prop
)
:
(
∀
x
,
SetUnfold
(
x
∈
l
)
(
P
x
))
→
(
∀
x
,
SetUnfold
(
x
∈
k
)
(
Q
x
))
→
SetUnfold
(
l
⊆
k
)
(
∀
x
,
P
x
→
Q
x
)
.
Proof
.
constructor
;
unfold
subseteq
,
list_subseteq
.
apply
forall_proper
;
naive_solver
.
Qed
.
End
set_unfold_list
.
Ltac
set_unfold
:=
let
rec
unfold_hyps
:=
try
match
goal
with
...
...
@@ -686,8 +711,13 @@ Fixpoint of_list `{Singleton A C, Empty C, Union C} (l : list A) : C :=
Section
of_option_list
.
Context
`{
SimpleCollection
A
C
}
.
Implicit
Types
l
:
list
A
.
Lemma
elem_of_of_option
(
x
:
A
)
mx
:
x
∈
of_option
mx
↔
mx
=
Some
x
.
Proof
.
destruct
mx
;
set_solver
.
Qed
.
Lemma
not_elem_of_of_option
(
x
:
A
)
mx
:
x
∉
of_option
mx
↔
mx
≠
Some
x
.
Proof
.
by
rewrite
elem_of_of_option
.
Qed
.
Lemma
elem_of_of_list
(
x
:
A
)
l
:
x
∈
of_list
l
↔
x
∈
l
.
Proof
.
split
.
...
...
@@ -695,35 +725,31 @@ Section of_option_list.
rewrite
elem_of_union
,
elem_of_singleton
;
intros
[
->
|?];
constructor
;
auto
.
-
induction
1
;
simpl
;
rewrite
elem_of_union
,
elem_of_singleton
;
auto
.
Qed
.
Lemma
not_elem_of_of_list
(
x
:
A
)
l
:
x
∉
of_list
l
↔
x
∉
l
.
Proof
.
by
rewrite
elem_of_of_list
.
Qed
.
Global
Instance
set_unfold_of_option
(
mx
:
option
A
)
x
:
SetUnfold
(
x
∈
of_option
mx
)
(
mx
=
Some
x
)
.
Proof
.
constructor
;
apply
elem_of_of_option
.
Qed
.
Global
Instance
set_unfold_of_list
(
l
:
list
A
)
x
P
:
SetUnfold
(
x
∈
l
)
P
→
SetUnfold
(
x
∈
of_list
l
)
P
.
Proof
.
constructor
.
by
rewrite
elem_of_of_list
,
(
set_unfold
(
x
∈
l
)
P
)
.
Qed
.
End
of_option_list
.
Section
list_unfold
.
Context
{
A
:
Type
}
.
Implicit
Types
x
:
A
.
Implicit
Types
l
:
list
A
.
Lemma
of_list_nil
:
of_list
(
C
:=
C
)
[]
=
∅.
Proof
.
done
.
Qed
.
Lemma
of_list_cons
x
l
:
of_list
(
C
:=
C
)
(
x
::
l
)
=
{[
x
]}
∪
of_list
l
.
Proof
.
done
.
Qed
.
Lemma
of_list_app
l1
l2
:
of_list
(
C
:=
C
)
(
l1
++
l2
)
≡
of_list
l1
∪
of_list
l2
.
Proof
.
set_solver
.
Qed
.
Global
Instance
of_list_perm
:
Proper
((
≡
ₚ
)
==>
(
≡
))
(
of_list
(
C
:=
C
))
.
Proof
.
induction
1
;
set_solver
.
Qed
.
Global
Instance
set_unfold_nil
x
:
SetUnfold
(
x
∈
[])
False
.
Proof
.
constructor
;
apply
elem_of_nil
.
Qed
.
Global
Instance
set_unfold_cons
x
y
l
P
:
SetUnfold
(
x
∈
l
)
P
→
SetUnfold
(
x
∈
y
::
l
)
(
x
=
y
∨
P
)
.
Proof
.
constructor
.
by
rewrite
elem_of_cons
,
(
set_unfold
(
x
∈
l
)
P
)
.
Qed
.
Global
Instance
set_unfold_app
x
l
k
P
Q
:
SetUnfold
(
x
∈
l
)
P
→
SetUnfold
(
x
∈
k
)
Q
→
SetUnfold
(
x
∈
l
++
k
)
(
P
∨
Q
)
.
Proof
.
intros
??;
constructor
.
by
rewrite
elem_of_app
,
(
set_unfold
(
x
∈
l
)
P
),
(
set_unfold
(
x
∈
k
)
Q
)
.
Qed
.
Global
Instance
set_unfold_included
l
k
(
P
Q
:
A
→
Prop
)
:
(
∀
x
,
SetUnfold
(
x
∈
l
)
(
P
x
))
→
(
∀
x
,
SetUnfold
(
x
∈
k
)
(
Q
x
))
→
SetUnfold
(
l
⊆
k
)
(
∀
x
,
P
x
→
Q
x
)
.
Proof
.
by
constructor
;
unfold
subseteq
,
list_subseteq
;
set_unfold
.
Qed
.
End
list_unfold
.
Context
`{
!
LeibnizEquiv
C
}
.
Lemma
of_list_app_L
l1
l2
:
of_list
(
C
:=
C
)
(
l1
++
l2
)
=
of_list
l1
∪
of_list
l2
.
Proof
.
set_solver
.
Qed
.
Global
Instance
of_list_perm_L
:
Proper
((
≡
ₚ
)
==>
(
=
))
(
of_list
(
C
:=
C
))
.
Proof
.
induction
1
;
set_solver
.
Qed
.
End
of_option_list
.
(** * Guard *)
...
...
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