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
d2e8771d
Commit
d2e8771d
authored
3 months ago
by
Robbert Krebbers
Browse files
Options
Downloads
Plain Diff
Merge branch 'marijnvanwezel/StronglySorted_app' into 'master'
Add lemma `StronglySorted_app_iff` See merge request
!584
parents
6ac98356
7d1f381e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!584
Add lemma `StronglySorted_app_iff`
Pipeline
#117402
passed
3 months ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+8
-0
8 additions, 0 deletions
CHANGELOG.md
stdpp/sorting.v
+27
-15
27 additions, 15 deletions
stdpp/sorting.v
with
35 additions
and
15 deletions
CHANGELOG.md
+
8
−
0
View file @
d2e8771d
...
...
@@ -14,6 +14,11 @@ API-breaking change is listed.
-
Add lemma about
`zip_with`
:
`lookup_zip_with_None`
and add lemmas for
`zip`
:
`length_zip`
,
`zip_nil_inv`
,
`lookup_zip_Some`
,
`lookup_zip_None`
. (by Kimaya Bedarkar)
-
Add
`elem_of_seq`
and
`seq_nil`
. (by Kimaya Bedarkar)
-
Add lemmas
`StronglySorted_app`
,
`StronglySorted_cons`
and
`StronglySorted_app_2`
. Rename lemmas
`elem_of_StronglySorted_app`
→
`StronglySorted_app_1_elem_of`
,
`StronglySorted_app_inv_l`
→
`StronglySorted_app_1_l`
`StronglySorted_app_inv_r`
→
`StronglySorted_app_1_r`
. (by Marijn van Wezel)
The following
`sed`
script should perform most of the renaming
(on macOS, replace
`sed`
by
`gsed`
, installed via e.g.
`brew install gnu-sed`
).
...
...
@@ -22,6 +27,9 @@ Note that the script is not idempotent, do not run it twice.
sed -i -E -f- $(find theories -name "*.v") <<EOF
# length
s/\bmap_filter_empty_iff\b/map_empty_filter/g
# StronglySorted
s/\belem_of_StronglySorted_app\b/StronglySorted_app_1_elem_of/g
s/\bStronglySorted_app_inv_(l|r)\b/StronglySorted_app_1_\1/g
EOF
```
...
...
This diff is collapsed.
Click to expand it.
stdpp/sorting.v
+
27
−
15
View file @
d2e8771d
...
...
@@ -2,6 +2,7 @@
standard library, but without using the module system. *)
From
Coq
Require
Export
Sorted
.
From
stdpp
Require
Export
orders
list
.
From
stdpp
Require
Import
sets
.
From
stdpp
Require
Import
options
.
Section
merge_sort
.
...
...
@@ -48,25 +49,36 @@ Inductive TlRel {A} (R : relation A) (a : A) : list A → Prop :=
Section
sorted
.
Context
{
A
}
(
R
:
relation
A
)
.
Lemma
elem_of_StronglySorted_app
l1
l2
x1
x2
:
StronglySorted
R
(
l1
++
l2
)
→
x1
∈
l1
→
x2
∈
l2
→
R
x1
x2
.
Lemma
StronglySorted_cons
l
x
:
StronglySorted
R
(
x
::
l
)
↔
Forall
(
R
x
)
l
∧
StronglySorted
R
l
.
Proof
.
split
;
[
inv
1
|
constructor
];
naive_solver
.
Qed
.
Lemma
StronglySorted_app
l1
l2
:
StronglySorted
R
(
l1
++
l2
)
↔
(
∀
x1
x2
,
x1
∈
l1
→
x2
∈
l2
→
R
x1
x2
)
∧
StronglySorted
R
l1
∧
StronglySorted
R
l2
.
Proof
.
induction
l1
as
[|
x1'
l1
IH
];
simpl
;
[
by
rewrite
elem_of_nil
|]
.
intros
[?
Hall
]
%
StronglySorted_inv
[
->
|?]
%
elem_of_cons
?;
[|
by
auto
]
.
rewrite
Forall_app
,
!
Forall_forall
in
Hall
.
naive
_solver
.
induction
l1
as
[|
x1'
l1
IH
];
simpl
.
-
set_solver
by
eauto
using
SSorted_nil
.
-
rewrite
!
StronglySorted_cons
,
IH
,
!
Forall_forall
.
set
_solver
.
Qed
.
Lemma
StronglySorted_app_inv_l
l1
l2
:
Lemma
StronglySorted_app_2
l1
l2
:
(
∀
x1
x2
,
x1
∈
l1
→
x2
∈
l2
→
R
x1
x2
)
→
StronglySorted
R
l1
→
StronglySorted
R
l2
→
StronglySorted
R
(
l1
++
l2
)
.
Proof
.
by
rewrite
StronglySorted_app
.
Qed
.
Lemma
StronglySorted_app_1_elem_of
l1
l2
x1
x2
:
StronglySorted
R
(
l1
++
l2
)
→
x1
∈
l1
→
x2
∈
l2
→
R
x1
x2
.
Proof
.
rewrite
StronglySorted_app
.
naive_solver
.
Qed
.
Lemma
StronglySorted_app_1_l
l1
l2
:
StronglySorted
R
(
l1
++
l2
)
→
StronglySorted
R
l1
.
Proof
.
induction
l1
as
[|
x1'
l1
IH
];
simpl
;
[|
inv
1
];
decompose_Forall
;
constructor
;
auto
.
Qed
.
Lemma
StronglySorted_app_inv_r
l1
l2
:
Proof
.
rewrite
StronglySorted_app
.
naive_solver
.
Qed
.
Lemma
StronglySorted_app_1_r
l1
l2
:
StronglySorted
R
(
l1
++
l2
)
→
StronglySorted
R
l2
.
Proof
.
induction
l1
as
[|
x1'
l1
IH
];
simpl
;
[|
inv
1
];
decompose_Forall
;
auto
.
Qed
.
Proof
.
rewrite
StronglySorted_app
.
naive_solver
.
Qed
.
Lemma
Sorted_StronglySorted
`{
!
Transitive
R
}
l
:
Sorted
R
l
→
StronglySorted
R
l
.
...
...
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