Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stdpp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
47
Issues
47
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iris
stdpp
Commits
0d7a7f06
Commit
0d7a7f06
authored
Sep 18, 2017
by
Robbert Krebbers
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of type class instance finite_countable.
This instance leads to exponential failing searches.
parent
e7b13437
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
theories/countable.v
theories/countable.v
+12
-0
theories/finite.v
theories/finite.v
+4
-1
No files found.
theories/countable.v
View file @
0d7a7f06
...
...
@@ -93,6 +93,18 @@ Section inj_countable.
Next
Obligation
.
intros
y
;
simpl
;
rewrite
decode_encode
;
eauto
.
Qed
.
End
inj_countable
.
(** ** Unit *)
Program
Instance
unit_countable
:
Countable
unit
:
=
{|
encode
u
:
=
1
;
decode
p
:
=
Some
()
|}.
Next
Obligation
.
by
intros
[].
Qed
.
(** ** Bool *)
Program
Instance
bool_countable
:
Countable
bool
:
=
{|
encode
b
:
=
if
b
then
1
else
2
;
decode
p
:
=
Some
match
p
return
bool
with
1
=>
true
|
_
=>
false
end
|}.
Next
Obligation
.
by
intros
[].
Qed
.
(** ** Option *)
Program
Instance
option_countable
`
{
Countable
A
}
:
Countable
(
option
A
)
:
=
{|
encode
o
:
=
match
o
with
None
=>
1
|
Some
x
=>
Pos
.
succ
(
encode
x
)
end
;
...
...
theories/finite.v
View file @
0d7a7f06
...
...
@@ -13,7 +13,8 @@ Arguments enum _ {_ _} : assert.
Arguments
NoDup_enum
:
clear
implicits
.
Arguments
NoDup_enum
_
{
_
_
}
:
assert
.
Definition
card
A
`
{
Finite
A
}
:
=
length
(
enum
A
).
Program
Instance
finite_countable
`
{
Finite
A
}
:
Countable
A
:
=
{|
Program
Definition
finite_countable
`
{
Finite
A
}
:
Countable
A
:
=
{|
encode
:
=
λ
x
,
Pos
.
of_nat
$
S
$
from_option
id
0
$
fst
<$>
list_find
(
x
=)
(
enum
A
)
;
decode
:
=
λ
p
,
enum
A
!!
pred
(
Pos
.
to_nat
p
)
...
...
@@ -25,6 +26,8 @@ Next Obligation.
rewrite
Nat2Pos
.
id
by
done
;
simpl
;
rewrite
Hi
;
simpl
.
destruct
(
list_find_Some
(
x
=)
xs
i
y
)
;
naive_solver
.
Qed
.
Hint
Immediate
finite_countable
:
typeclass_instances
.
Definition
find
`
{
Finite
A
}
P
`
{
∀
x
,
Decision
(
P
x
)}
:
option
A
:
=
list_find
P
(
enum
A
)
≫
=
decode_nat
∘
fst
.
...
...
Robbert
@robbertkrebbers
mentioned in commit
f806b9b0
·
Oct 01, 2020
mentioned in commit
f806b9b0
mentioned in commit f806b9b058ea9097313cce7408f359e856c92f02
Toggle commit list
Write
Preview
Markdown
is supported
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