Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris
Manage
Activity
Members
Labels
Plan
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
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
Paolo G. Giarrusso
iris
Commits
d47d99dd
Commit
d47d99dd
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Alternative definition of is_Some.
parent
233aa0fa
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
prelude/option.v
+11
-5
11 additions, 5 deletions
prelude/option.v
with
11 additions
and
5 deletions
prelude/option.v
+
11
−
5
View file @
d47d99dd
...
...
@@ -42,6 +42,10 @@ Proof. congruence. Qed.
Definition
is_Some
{
A
}
(
mx
:
option
A
)
:=
∃
x
,
mx
=
Some
x
.
Instance
:
Params
(
@
is_Some
)
1
.
Lemma
is_Some_alt
{
A
}
(
mx
:
option
A
)
:
is_Some
mx
↔
match
mx
with
Some
_
=>
True
|
None
=>
False
end
.
Proof
.
unfold
is_Some
.
destruct
mx
;
naive_solver
.
Qed
.
Lemma
mk_is_Some
{
A
}
(
mx
:
option
A
)
x
:
mx
=
Some
x
→
is_Some
mx
.
Proof
.
intros
;
red
;
subst
;
eauto
.
Qed
.
Hint
Resolve
mk_is_Some
.
...
...
@@ -49,6 +53,11 @@ Lemma is_Some_None {A} : ¬is_Some (@None A).
Proof
.
by
destruct
1
.
Qed
.
Hint
Resolve
is_Some_None
.
Lemma
eq_None_not_Some
{
A
}
(
mx
:
option
A
)
:
mx
=
None
↔
¬
is_Some
mx
.
Proof
.
rewrite
is_Some_alt
;
destruct
mx
;
naive_solver
.
Qed
.
Lemma
not_eq_None_Some
{
A
}
(
mx
:
option
A
)
:
mx
≠
None
↔
is_Some
mx
.
Proof
.
rewrite
is_Some_alt
;
destruct
mx
;
naive_solver
.
Qed
.
Instance
is_Some_pi
{
A
}
(
mx
:
option
A
)
:
ProofIrrel
(
is_Some
mx
)
.
Proof
.
set
(
P
(
mx
:
option
A
)
:=
match
mx
with
Some
_
=>
True
|
_
=>
False
end
)
.
...
...
@@ -59,6 +68,7 @@ Proof.
assert
(
∀
mx
H
,
f
mx
(
g
mx
H
)
=
H
)
as
f_g
by
(
by
intros
?
[??];
subst
)
.
intros
p1
p2
.
rewrite
<-
(
f_g
_
p1
),
<-
(
f_g
_
p2
)
.
by
destruct
mx
,
p1
.
Qed
.
Instance
is_Some_dec
{
A
}
(
mx
:
option
A
)
:
Decision
(
is_Some
mx
)
:=
match
mx
with
|
Some
x
=>
left
(
ex_intro
_
x
eq_refl
)
...
...
@@ -67,17 +77,13 @@ Instance is_Some_dec {A} (mx : option A) : Decision (is_Some mx) :=
Definition
is_Some_proj
{
A
}
{
mx
:
option
A
}
:
is_Some
mx
→
A
:=
match
mx
with
Some
x
=>
λ
_,
x
|
None
=>
False_rect
_
∘
is_Some_None
end
.
Definition
Some_dec
{
A
}
(
mx
:
option
A
)
:
{
x
|
mx
=
Some
x
}
+
{
mx
=
None
}
:=
match
mx
return
{
x
|
mx
=
Some
x
}
+
{
mx
=
None
}
with
|
Some
x
=>
inleft
(
x
↾
eq_refl
_)
|
None
=>
inright
eq_refl
end
.
Lemma
eq_None_not_Some
{
A
}
(
mx
:
option
A
)
:
mx
=
None
↔
¬
is_Some
mx
.
Proof
.
destruct
mx
;
unfold
is_Some
;
naive_solver
.
Qed
.
Lemma
not_eq_None_Some
{
A
}
(
mx
:
option
A
)
:
mx
≠
None
↔
is_Some
mx
.
Proof
.
rewrite
eq_None_not_Some
;
apply
dec_stable
;
tauto
.
Qed
.
(** Lifting a relation point-wise to option *)
Inductive
option_Forall2
{
A
B
}
(
R
:
A
→
B
→
Prop
)
:
option
A
→
option
B
→
Prop
:=
|
Some_Forall2
x
y
:
R
x
y
→
option_Forall2
R
(
Some
x
)
(
Some
y
)
...
...
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