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
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
Glen Mével
stdpp
Commits
a7c55441
Commit
a7c55441
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Big ops over lists as binder.
parent
030b0fb6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/list.v
+21
-8
21 additions, 8 deletions
theories/list.v
with
21 additions
and
8 deletions
theories/list.v
+
21
−
8
View file @
a7c55441
...
...
@@ -196,6 +196,8 @@ Definition imap_go {A B} (f : nat → A → B) : nat → list A → list B :=
fix
go
(
n
:
nat
)
(
l
:
list
A
)
:=
match
l
with
[]
=>
[]
|
x
::
l
=>
f
n
x
::
go
(
S
n
)
l
end
.
Definition
imap
{
A
B
}
(
f
:
nat
→
A
→
B
)
:
list
A
→
list
B
:=
imap_go
f
0
.
Arguments
imap
:
simpl
never
.
Definition
zipped_map
{
A
B
}
(
f
:
list
A
→
list
A
→
A
→
B
)
:
list
A
→
list
A
→
list
B
:=
fix
go
l
k
:=
match
k
with
[]
=>
[]
|
x
::
k
=>
f
l
k
x
::
go
(
x
::
l
)
k
end
.
...
...
@@ -1266,20 +1268,31 @@ Proof.
Qed
.
(** ** Properties of the [imap] function *)
Lemma
imap_cons
{
B
}
(
f
:
nat
→
A
→
B
)
x
l
:
imap
f
(
x
::
l
)
=
f
0
x
::
imap
(
f
∘
S
)
l
.
Lemma
imap_nil
{
B
}
(
f
:
nat
→
A
→
B
)
:
imap
f
[]
=
[]
.
Proof
.
done
.
Qed
.
Lemma
imap_app
{
B
}
(
f
:
nat
→
A
→
B
)
l1
l2
:
imap
f
(
l1
++
l2
)
=
imap
f
l1
++
imap
(
λ
n
,
f
(
length
l1
+
n
))
l2
.
Proof
.
unfold
imap
.
simpl
.
f_equal
.
generalize
0
.
induction
l
;
intros
n
;
simpl
;
repeat
(
auto
||
f_equal
)
.
unfold
imap
.
generalize
0
.
revert
l2
.
induction
l1
as
[|
x
l1
IH
];
intros
l2
n
;
f_equal
/=
;
auto
.
rewrite
IH
.
f_equal
.
clear
.
revert
n
.
induction
l2
;
simpl
;
auto
with
f_equal
lia
.
Qed
.
Lemma
imap_cons
{
B
}
(
f
:
nat
→
A
→
B
)
x
l
:
imap
f
(
x
::
l
)
=
f
0
x
::
imap
(
f
∘
S
)
l
.
Proof
.
apply
(
imap_app
_
[_])
.
Qed
.
Lemma
imap_ext
{
B
}
(
f
g
:
nat
→
A
→
B
)
l
:
(
∀
i
x
,
f
i
x
=
g
i
x
)
→
imap
f
l
=
imap
g
l
.
(
∀
i
x
,
l
!!
i
=
Some
x
→
f
i
x
=
g
i
x
)
→
imap
f
l
=
imap
g
l
.
Proof
.
unfold
imap
.
intro
EQ
.
generalize
0
.
induction
l
;
simpl
;
intros
n
;
f_equal
;
auto
.
revert
f
g
;
induction
l
as
[|
x
l
IH
];
intros
f
g
Hfg
;
auto
.
rewrite
!
imap_cons
;
f_equal
;
e
auto
.
Qed
.
Lemma
imap_fmap
{
B
C
}
(
f
:
nat
→
B
→
C
)
(
g
:
A
→
B
)
l
:
imap
f
(
g
<$>
l
)
=
imap
(
λ
n
,
f
n
∘
g
)
l
.
Proof
.
unfold
imap
.
generalize
0
.
induction
l
;
csimpl
;
auto
with
f_equal
.
Qed
.
(** ** Properties of the [mask] function *)
Lemma
mask_nil
f
βs
:
mask
f
βs
(
@
nil
A
)
=
[]
.
Proof
.
by
destruct
βs
.
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