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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
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
Iris
stdpp
Merge requests
!4
Add countability for Q, Qc, and Qp
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add countability for Q, Qc, and Qp
haidang/stdpp:hai/QpCountable
into
master
Overview
3
Commits
1
Pipelines
0
Changes
2
Merged
Hai Dang
requested to merge
haidang/stdpp:hai/QpCountable
into
master
7 years ago
Overview
3
Commits
1
Pipelines
0
Changes
2
Expand
Addded countability proofs for Q, Qc and Qp.
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
8cf5a7ad
1 commit,
7 years ago
2 files
+
53
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
theories/countable.v
+
44
−
1
Options
(* Copyright (c) 2012-2017, Coq-std++ developers. *)
(* This file is distributed under the terms of the BSD license. *)
From
stdpp
Require
Export
list
.
From
Coq
.
QArith
Require
Import
QArith_base
Qcanon
.
From
stdpp
Require
Export
list
numbers
.
Set
Default
Proof
Using
"Type"
.
Local
Open
Scope
positive
.
@@ -268,3 +269,45 @@ Program Instance nat_countable : Countable nat :=
Next
Obligation
.
by
intros
x
;
lazy
beta
;
rewrite
decode_encode
;
csimpl
;
rewrite
Nat2N
.
id
.
Qed
.
Definition
_
Q2pair
(
p
:
Q
):
_
:=
(
Qnum
p
,
Qden
p
)
.
Definition
_
pair2Q
(
p
:
Z
*
positive
)
:
Q
:=
match
p
with
|
(
num
,
den
)
=>
Qmake
num
den
end
.
Instance
Q_dec_eq
:
EqDecision
Q
:=
injective_dec_eq
_
Q2pair
(
Some
∘
_
pair2Q
)
_
.
Proof
.
by
destruct
0
.
Qed
.
Instance
Q_countable
:
Countable
Q
:=
injective_countable
_
Q2pair
(
Some
∘
_
pair2Q
)
_
.
Proof
.
by
destruct
0
.
Qed
.
Definition
_
Qc_to_Q
(
p
:
Qc
):
_
:=
match
p
with
|
Qcmake
pb
_
=>
pb
end
.
Global
Instance
Qc_countable
:
Countable
Qc
:=
injective_countable
_
Qc_to_Q
(
Some
∘
Q2Qc
)
_
.
Proof
.
intros
[
p
Can
]
.
simpl
.
f_equal
.
apply
Qc_is_canon
.
simpl
.
rewrite
Can
.
reflexivity
.
Qed
.
Definition
_
Qc2Qp
(
p
:
Qc
)
:
option
Qp
:=
match
(
decide
(
0
<
p
)
%
Qc
)
with
|
left
G0
=>
Some
(
mk_Qp
p
G0
)
|
_
=>
None
end
.
Global
Instance
Qp_countable
:
Countable
Qp
:=
injective_countable
Qp_car
(_
Qc2Qp
)
_
.
Proof
.
intros
[
p
G0
]
.
unfold
_
Qc2Qp
.
simpl
.
destruct
(
decide
(
0
<
p
)
%
Qc
);
[|
tauto
]
.
f_equal
.
apply
Qp_eq
.
auto
.
Qed
.
Loading