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
7f43d3f2
Commit
7f43d3f2
authored
4 months ago
by
Marijn van Wezel
Committed by
Marijn van Wezel
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add lemma `StronglySorted_app`
parent
6ac98356
No related branches found
No related tags found
1 merge request
!584
Add lemma `StronglySorted_app_iff`
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
stdpp/sorting.v
+36
-13
36 additions, 13 deletions
stdpp/sorting.v
with
40 additions
and
13 deletions
CHANGELOG.md
+
4
−
0
View file @
7f43d3f2
...
...
@@ -14,6 +14,10 @@ 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)
`length_zip`
,
`zip_nil_inv`
,
`lookup_zip_Some`
,
`lookup_zip_None`
. (by Kimaya Bedarkar)
-
Add lemma
`StronglySorted_app`
. (by Marijn van Wezel)
-
Add lemmas
`StronglySorted_app_iff`
and
`StronglySorted_app`
. (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`
).
...
...
This diff is collapsed.
Click to expand it.
stdpp/sorting.v
+
36
−
13
View file @
7f43d3f2
...
...
@@ -48,25 +48,48 @@ 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_app_iff
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
;
split
.
-
intros
Hs
.
repeat
split
;
[|
constructor
|
naive_solver
]
.
by
setoid_rewrite
elem_of_nil
.
-
naive_solver
.
-
intros
[
Hs
Hall
]
%
StronglySorted_inv
.
split
.
*
intros
?
?
Hinl1
Hinl2
.
apply
elem_of_cons
in
Hinl1
as
[
Hinl1
|
Hinl1
]
.
+
subst
.
apply
Forall_app
in
Hall
as
[_
Hall
]
.
rewrite
Forall_forall
in
Hall
.
by
apply
Hall
.
+
apply
IH
in
Hs
as
(
HR
&
?
&
?)
.
by
apply
HR
.
*
repeat
split
;
[
apply
SSorted_cons
|];
apply
IH
in
Hs
.
+
naive_solver
.
+
apply
Forall_app
in
Hall
;
naive_solver
.
+
naive_solver
.
-
intros
(
HR
&
[?
?]
%
StronglySorted_inv
&
?)
.
apply
SSorted_cons
.
*
apply
IH
;
[|
done
..]
.
repeat
split
;
[|
done
..]
.
intros
;
apply
HR
;
[|
done
]
.
apply
elem_of_cons
.
naive_solver
.
*
rewrite
Forall_app
;
split
;
[
done
|]
.
rewrite
Forall_forall
.
intros
;
apply
HR
;
[|
done
]
.
apply
elem_of_cons
.
naive_solver
.
Qed
.
Lemma
StronglySorted_app
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_iff
.
Qed
.
Lemma
elem_of_StronglySorted_app
l1
l2
x1
x2
:
StronglySorted
R
(
l1
++
l2
)
→
x1
∈
l1
→
x2
∈
l2
→
R
x1
x2
.
Proof
.
rewrite
StronglySorted_app_iff
.
naive_solver
.
Qed
.
Lemma
StronglySorted_app_inv_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
.
Proof
.
rewrite
StronglySorted_app_iff
.
naive_solver
.
Qed
.
Lemma
StronglySorted_app_inv_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_iff
.
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