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
0d7a7f06
Commit
0d7a7f06
authored
7 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Get rid of type class instance finite_countable.
This instance leads to exponential failing searches.
parent
e7b13437
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/countable.v
+12
-0
12 additions, 0 deletions
theories/countable.v
theories/finite.v
+4
-1
4 additions, 1 deletion
theories/finite.v
with
16 additions
and
1 deletion
theories/countable.v
+
12
−
0
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
;
...
...
This diff is collapsed.
Click to expand it.
theories/finite.v
+
4
−
1
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
.
...
...
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