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
Commits
fba969b6
Commit
fba969b6
authored
6 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Infinite instances for prod/sum.
parent
db714636
No related branches found
No related tags found
No related merge requests found
Pipeline
#14442
passed
6 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/infinite.v
+12
-2
12 additions, 2 deletions
theories/infinite.v
with
12 additions
and
2 deletions
theories/infinite.v
+
12
−
2
View file @
fba969b6
...
...
@@ -11,17 +11,27 @@ Class Infinite A := {
inject_injective
:>
Inj
(
=
)
(
=
)
inject
;
}
.
(** Instances *)
Program
Definition
inj_infinite
`{
Infinite
A
}
{
B
}
(
f
:
A
→
B
)
`{
!
Inj
(
=
)
(
=
)
f
}
:
Infinite
B
:=
{|
inject
:=
f
∘
inject
|}
.
Instance
string_infinite
:
Infinite
string
:=
{|
inject
:=
λ
x
,
"~"
+:+
pretty
x
|}
.
Instance
nat_infinite
:
Infinite
nat
:=
{|
inject
:=
id
|}
.
Instance
N_infinite
:
Infinite
N
:=
{|
inject_injective
:=
Nat2N
.
inj
|}
.
Instance
positive_infinite
:
Infinite
positive
:=
{|
inject_injective
:=
SuccNat2Pos
.
inj
|}
.
Instance
Z_infinite
:
Infinite
Z
:=
{|
inject_injective
:=
Nat2Z
.
inj
|}
.
Instance
option_infinite
`{
Infinite
A
}:
Infinite
(
option
A
)
:=
{|
inject
:=
Some
∘
inject
|}
.
Instance
option_infinite
`{
Infinite
A
}
:
Infinite
(
option
A
)
:=
inj_infinite
Some
.
Instance
sum_infinite_l
`{
Infinite
A
}
{
B
}
:
Infinite
(
A
+
B
)
:=
inj_infinite
inl
.
Instance
sum_infinite_r
{
A
}
`{
Infinite
B
}
:
Infinite
(
A
+
B
)
:=
inj_infinite
inr
.
Instance
prod_infinite_l
`{
Infinite
A
,
Inhabited
B
}
:
Infinite
(
A
*
B
)
:=
inj_infinite
(,
inhabitant
)
.
Instance
prod_infinite_r
`{
Inhabited
A
,
Infinite
B
}
:
Infinite
(
A
*
B
)
:=
inj_infinite
(
inhabitant
,)
.
Program
Instance
list_infinite
`{
Inhabited
A
}:
Infinite
(
list
A
)
:=
{|
inject
:=
λ
i
,
replicate
i
inhabitant
|}
.
Next
Obligation
.
Proof
.
intros
A
*
i
j
Heqrep
%
(
f_equal
length
)
.
rewrite
!
replicate_length
in
Heqrep
;
done
.
Qed
.
...
...
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