Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simon Gregersen
stdpp
Commits
057543ba
Commit
057543ba
authored
Apr 24, 2021
by
Simon Gregersen
Browse files
add Countable instance for decidable Sigma types
parent
f7c9c556
Changes
1
Hide whitespace changes
Inline
Side-by-side
theories/countable.v
View file @
057543ba
...
...
@@ -340,3 +340,21 @@ Next Obligation.
intros
T
??
t
.
by
rewrite
<-(
right_id_L
[]
_
(
gen_tree_to_list
_
)),
gen_tree_of_to_list
.
Qed
.
(** ** Decidable Sigma *)
Section
sigma
.
Context
`
{
Countable
A
}
(
P
:
A
→
Prop
).
Context
`
{
∀
x
,
Decision
(
P
x
)}
`
{
∀
x
,
ProofIrrel
(
P
x
)}.
Program
Instance
countable_sig
:
Countable
{
x
:
A
|
P
x
}
:
=
{|
encode
:
=
λ
x
,
encode
(
`
x
)
;
decode
:
=
λ
p
,
x
←
decode
p
;
match
decide
(
P
x
)
return
option
{
x
|
P
x
}
with
|
left
H
=>
Some
(
x
↾
H
)
|
right
_
=>
None
end
|}.
Next
Obligation
.
intros
[].
rewrite
decode_encode
;
simpl
.
by
erewrite
decide_left
.
Qed
.
End
sigma
.
Write
Preview
Supports
Markdown
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