Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
coqstdpp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Swasey
coqstdpp
Commits
4ea9c34a
Commit
4ea9c34a
authored
Sep 24, 2017
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Misc lemmas for lists.
parent
9d1092a0
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
25 additions
and
1 deletion
+25
1
theories/list.v
theories/list.v
+25
1
No files found.
theories/list.v
View file @
4ea9c34a
...
...
@@ 986,6 +986,19 @@ Proof.
f_equal
/=
;
auto
using
take_drop
with
lia
.
Qed
.
Lemma
app_eq_inv
l1
l2
k1
k2
:
l1
++
l2
=
k1
++
k2
→
(
∃
k
,
l1
=
k1
++
k
∧
k2
=
k
++
l2
)
∨
(
∃
k
,
k1
=
l1
++
k
∧
l2
=
k
++
k2
).
Proof
.
intros
Hlk
.
destruct
(
decide
(
length
l1
<
length
k1
)).

right
.
rewrite
<(
take_drop
(
length
l1
)
k1
),
<(
assoc_L
_
)
in
Hlk
.
apply
app_inj_1
in
Hlk
as
[
Hl1
Hl2
]
;
[
rewrite
take_length
;
lia
].
exists
(
drop
(
length
l1
)
k1
).
by
rewrite
Hl1
at
1
;
rewrite
take_drop
.

left
.
rewrite
<(
take_drop
(
length
k1
)
l1
),
<(
assoc_L
_
)
in
Hlk
.
apply
app_inj_1
in
Hlk
as
[
Hk1
Hk2
]
;
[
rewrite
take_length
;
lia
].
exists
(
drop
(
length
k1
)
l1
).
by
rewrite
<
Hk1
at
1
;
rewrite
take_drop
.
Qed
.
(** ** Properties of the [replicate] function *)
Lemma
replicate_length
n
x
:
length
(
replicate
n
x
)
=
n
.
Proof
.
induction
n
;
simpl
;
auto
.
Qed
.
...
...
@@ 1421,6 +1434,17 @@ Qed.
Lemma
elem_of_Permutation
l
x
:
x
∈
l
→
∃
k
,
l
≡
ₚ
x
::
k
.
Proof
.
intros
[
i
?]%
elem_of_list_lookup
.
eauto
using
delete_Permutation
.
Qed
.
Lemma
Permutation_cons_inv
l
k
x
:
k
≡
ₚ
x
::
l
→
∃
k1
k2
,
k
=
k1
++
x
::
k2
∧
l
≡
ₚ
k1
++
k2
.
Proof
.
intros
Hk
.
assert
(
∃
i
,
k
!!
i
=
Some
x
)
as
[
i
Hi
].
{
apply
elem_of_list_lookup
.
rewrite
Hk
,
elem_of_cons
;
auto
.
}
exists
(
take
i
k
),
(
drop
(
S
i
)
k
).
split
.

by
rewrite
take_drop_middle
.

rewrite
<
delete_take_drop
.
apply
(
inj
(
x
::
)).
by
rewrite
<
Hk
,
<(
delete_Permutation
k
)
by
done
.
Qed
.
Lemma
length_delete
l
i
:
is_Some
(
l
!!
i
)
→
length
(
delete
i
l
)
=
length
l

1
.
Proof
.
...
...
@@ 1993,7 +2017,7 @@ Qed.
Lemma
submseteq_app_inv_l
l1
l2
k
:
k
++
l1
⊆
+
k
++
l2
→
l1
⊆
+
l2
.
Proof
.
induction
k
as
[
y
k
IH
]
;
simpl
;
[
done
].
rewrite
submseteq_cons_l
.
intros
(?&
E
&?).
apply
Permutation_cons_inv
in
E
.
apply
IH
.
by
rewrite
E
.
intros
(?&
E
%(
inj
_
)&?)
.
apply
IH
.
by
rewrite
E
.
Qed
.
Lemma
submseteq_app_inv_r
l1
l2
k
:
l1
++
k
⊆
+
l2
++
k
→
l1
⊆
+
l2
.
Proof
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment