Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lennard Gäher
stdpp
Commits
d83e44a6
Commit
d83e44a6
authored
May 19, 2020
by
Robbert Krebbers
Browse files
Proper instance with `pointwise_relation` for `from_option`.
parent
ea934fb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
theories/option.v
View file @
d83e44a6
...
...
@@ -21,7 +21,7 @@ Proof. congruence. Qed.
(** The [from_option] is the eliminator for option. *)
Definition
from_option
{
A
B
}
(
f
:
A
→
B
)
(
y
:
B
)
(
mx
:
option
A
)
:
B
:
=
match
mx
with
None
=>
y
|
Some
x
=>
f
x
end
.
Instance
:
Params
(@
from_option
)
3
:
=
{}.
Instance
:
Params
(@
from_option
)
2
:
=
{}.
Arguments
from_option
{
_
_
}
_
_
!
_
/
:
assert
.
(** The eliminator with the identity function. *)
...
...
@@ -145,8 +145,12 @@ Section setoids.
Global
Instance
is_Some_proper
:
Proper
((
≡
@{
option
A
})
==>
iff
)
is_Some
.
Proof
.
inversion_clear
1
;
split
;
eauto
.
Qed
.
Global
Instance
from_option_proper
{
B
}
(
R
:
relation
B
)
(
f
:
A
→
B
)
:
Proper
((
≡
)
==>
R
)
f
→
Proper
(
R
==>
(
≡
)
==>
R
)
(
from_option
f
).
Proof
.
destruct
3
;
simpl
;
auto
.
Qed
.
Proper
((
≡
)
==>
R
)
f
→
Proper
(
R
==>
(
≡
)
==>
R
)
(
from_option
f
).
Proof
.
solve_proper
.
Qed
.
Global
Instance
from_option_proper_ext
{
B
}
(
R
:
relation
B
)
:
Proper
(
pointwise_relation
A
R
==>
R
==>
(=)
==>
R
)
from_option
.
Proof
.
solve_proper
.
Qed
.
End
setoids
.
Typeclasses
Opaque
option_equiv
.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment