Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
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
Package Registry
Model registry
Operate
Terraform modules
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
Simcha van Collem
Iris
Commits
ab23831f
Commit
ab23831f
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Shorten OFE construction for vectors.
parent
a9fb187b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/algebra/vector.v
+12
-26
12 additions, 26 deletions
theories/algebra/vector.v
with
12 additions
and
26 deletions
theories/algebra/vector.v
+
12
−
26
View file @
ab23831f
...
...
@@ -10,14 +10,18 @@ Section ofe.
Instance
vec_dist
m
:
Dist
(
vec
A
m
)
:=
dist
(
A
:=
list
A
)
.
Definition
vec_ofe_mixin
m
:
OfeMixin
(
vec
A
m
)
.
Proof
.
by
apply
(
iso_ofe_mixin
vec_to_list
)
.
Qed
.
Canonical
Structure
vecC
m
:
ofeT
:=
OfeT
(
vec
A
m
)
(
vec_ofe_mixin
m
)
.
Global
Instance
list_cofe
`{
Cofe
A
}
m
:
Cofe
(
vecC
m
)
.
Proof
.
split
.
-
intros
v
w
.
apply
(
equiv_dist
(
A
:=
listC
A
))
.
-
unfold
dist
,
vec_dist
.
split
.
by
intros
?
.
by
intros
??
.
by
intros
?????;
etrans
.
-
intros
n
v
w
.
by
apply
(
dist_S
(
A
:=
listC
A
))
.
assert
(
LimitPreserving
(
λ
l
,
length
l
=
m
))
.
{
apply
limit_preserving_timeless
=>
l
k
->
//.
}
apply
(
iso_cofe_subtype
(
λ
l
:
list
A
,
length
l
=
m
)
(
λ
l
,
eq_rect
_
(
vec
A
)
(
list_to_vec
l
)
m
)
vec_to_list
)=>
//.
-
intros
v
.
by
rewrite
vec_to_list_length
.
-
intros
v
[]
.
by
rewrite
/=
vec_to_list_of_list
.
Qed
.
Canonical
Structure
vecC
m
:
ofeT
:=
OfeT
(
vec
A
m
)
(
vec_ofe_mixin
m
)
.
Global
Instance
vnil_timeless
:
Timeless
(
@
vnil
A
)
.
Proof
.
intros
v
_
.
by
inv_vec
v
.
Qed
.
...
...
@@ -57,30 +61,12 @@ Section proper.
intros
v
v'
?
x
x'
->
.
apply
equiv_dist
=>
n
.
f_equiv
.
by
apply
equiv_dist
.
Qed
.
Global
Instance
vec_to_list_ne
m
:
NonExpansive
(
@
vec_to_list
A
m
)
.
Global
Instance
vec_to_list_ne
m
:
NonExpansive
(
@
vec_to_list
A
m
)
.
Proof
.
by
intros
v
v'
.
Qed
.
Global
Instance
vec_to_list_proper
m
:
Proper
(
equiv
==>
equiv
)
(
@
vec_to_list
A
m
)
.
Global
Instance
vec_to_list_proper
m
:
Proper
((
≡
)
==>
(
≡
))
(
@
vec_to_list
A
m
)
.
Proof
.
by
intros
v
v'
.
Qed
.
End
proper
.
Section
cofe
.
Context
`{
Cofe
A
}
.
Global
Program
Instance
list_cofe
m
:
Cofe
(
vecC
A
m
)
:=
{|
compl
c
:=
eq_rect
_
(
vec
A
)
(
list_to_vec
(
compl
(
chain_map
vec_to_list
c
)))
_
_
|}
.
Next
Obligation
.
intros
.
by
rewrite
(
conv_compl
0
)
vec_to_list_length
.
Qed
.
Next
Obligation
.
simpl
.
intros
m
n
c
.
unfold
dist
,
ofe_dist
,
vecC
,
vec_dist
.
destruct
(
list_cofe_obligation_1
m
c
)
.
by
rewrite
/=
vec_to_list_of_list
conv_compl
.
Qed
.
End
cofe
.
(** Functor *)
Definition
vec_map
{
A
B
:
ofeT
}
m
(
f
:
A
→
B
)
:
vecC
A
m
→
vecC
B
m
:=
@
vmap
A
B
f
m
.
...
...
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