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
!416
Add lemma `foldr_cons`.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add lemma `foldr_cons`.
robbert/foldr_cons
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Robbert Krebbers
requested to merge
robbert/foldr_cons
into
master
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
78a390c9
1 commit,
2 years ago
1 file
+
6
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
stdpp/list.v
+
6
−
0
Options
@@ -4487,15 +4487,21 @@ End permutations.
(** Note that [foldr] has much better support, so when in doubt, it should be
preferred over [foldl]. *)
Definition
foldr_app
:=
@
fold_right_app
.
Lemma
foldr_cons
{
A
B
}
(
f
:
B
→
A
→
A
)
(
a
:
A
)
l
x
:
foldr
f
a
(
x
::
l
)
=
f
x
(
foldr
f
a
l
)
.
Proof
.
done
.
Qed
.
Lemma
foldr_snoc
{
A
B
}
(
f
:
B
→
A
→
A
)
(
a
:
A
)
l
x
:
foldr
f
a
(
l
++
[
x
])
=
foldr
f
(
f
x
a
)
l
.
Proof
.
rewrite
foldr_app
.
done
.
Qed
.
Lemma
foldr_fmap
{
A
B
C
}
(
f
:
B
→
A
→
A
)
x
(
l
:
list
C
)
g
:
foldr
f
x
(
g
<$>
l
)
=
foldr
(
λ
b
a
,
f
(
g
b
)
a
)
x
l
.
Proof
.
induction
l
;
f_equal
/=
;
auto
.
Qed
.
Lemma
foldr_ext
{
A
B
}
(
f1
f2
:
B
→
A
→
A
)
x1
x2
l1
l2
:
(
∀
b
a
,
f1
b
a
=
f2
b
a
)
→
l1
=
l2
→
x1
=
x2
→
foldr
f1
x1
l1
=
foldr
f2
x2
l2
.
Proof
.
intros
Hf
->
->
.
induction
l2
as
[|
x
l2
IH
];
f_equal
/=
;
by
rewrite
Hf
,
IH
.
Qed
.
Lemma
foldr_permutation
{
A
B
}
(
R
:
relation
B
)
`{
!
PreOrder
R
}
(
f
:
A
→
B
→
B
)
(
b
:
B
)
`{
Hf
:
!∀
x
,
Proper
(
R
==>
R
)
(
f
x
)}
(
l1
l2
:
list
A
)
:
(
∀
j1
a1
j2
a2
b
,
Loading