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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Arthur Azevedo de Amorim
stdpp
Commits
46799584
Commit
46799584
authored
11 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Improve [decompose_elem_of] tactic.
Conflicts: collections.v
parent
fe66a96f
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/collections.v
+21
-6
21 additions, 6 deletions
theories/collections.v
with
21 additions
and
6 deletions
theories/collections.v
+
21
−
6
View file @
46799584
...
...
@@ -82,6 +82,23 @@ Section simple_collection.
End
dec
.
End
simple_collection
.
Definition
of_option
`{
Singleton
A
C
}
`{
Empty
C
}
(
x
:
option
A
)
:
C
:=
match
x
with
None
=>
∅
|
Some
a
=>
{[
a
]}
end
.
Lemma
elem_of_of_option
`{
SimpleCollection
A
C
}
(
x
:
A
)
o
:
x
∈
of_option
o
↔
o
=
Some
x
.
Proof
.
destruct
o
;
simpl
;
rewrite
?elem_of_empty
,
?elem_of_singleton
;
naive_solver
.
Qed
.
Global
Instance
collection_guard
`{
CollectionMonad
M
}
:
MGuard
M
:=
λ
P
dec
A
x
,
match
dec
with
left
H
=>
x
H
|
_
=>
∅
end
.
Lemma
elem_of_guard
`{
CollectionMonad
M
}
`{
Decision
P
}
{
A
}
(
x
:
A
)
(
X
:
M
A
)
:
x
∈
guard
P
;
X
↔
P
∧
x
∈
X
.
Proof
.
unfold
mguard
,
collection_guard
;
simpl
;
case_match
;
rewrite
?elem_of_empty
;
naive_solver
.
Qed
.
(** * Tactics *)
(** Given a hypothesis [H : _ ∈ _], the tactic [destruct_elem_of H] will
recursively split [H] for [(∪)], [(∩)], [(∖)], [map], [∅], [{[_]}]. *)
...
...
@@ -111,6 +128,10 @@ Tactic Notation "decompose_elem_of" hyp(H) :=
|
_
∈
mjoin
_
≫=
_
=>
let
H1
:=
fresh
in
let
H2
:=
fresh
in
apply
elem_of_join
in
H
;
destruct
H
as
[?
[
H1
H2
]];
go
H1
;
go
H2
|
_
∈
guard
_;
_
=>
let
H1
:=
fresh
in
let
H2
:=
fresh
in
apply
elem_of_guard
in
H
;
destruct
H
as
[
H1
H2
];
go
H2
|
_
∈
of_option
_
=>
apply
elem_of_of_option
in
H
|
_
=>
idtac
end
in
go
H
.
Tactic
Notation
"decompose_elem_of"
:=
...
...
@@ -412,16 +433,10 @@ Section fresh.
Qed
.
End
fresh
.
Definition
option_collection
`{
Singleton
A
C
}
`{
Empty
C
}
(
x
:
option
A
)
:
C
:=
match
x
with
None
=>
∅
|
Some
a
=>
{[
a
]}
end
.
(** * Properties of implementations of collections that form a monad *)
Section
collection_monad
.
Context
`{
CollectionMonad
M
}
.
Global
Instance
collection_guard
:
MGuard
M
:=
λ
P
dec
A
x
,
match
dec
with
left
H
=>
x
H
|
_
=>
∅
end
.
Global
Instance
collection_fmap_proper
{
A
B
}
(
f
:
A
→
B
)
:
Proper
((
≡
)
==>
(
≡
))
(
fmap
f
)
.
Proof
.
intros
X
Y
E
.
esolve_elem_of
.
Qed
.
...
...
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