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
f807ece7
Commit
f807ece7
authored
6 years ago
by
Hai Dang
Committed by
Robbert Krebbers
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Additionally lemmas for insert, nth, take, and list_find
parent
425c0d18
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
+29
-0
29 additions, 0 deletions
theories/list.v
with
29 additions
and
0 deletions
theories/list.v
+
29
−
0
View file @
f807ece7
...
...
@@ -523,6 +523,8 @@ Lemma list_insert_commute l i j x y :
Proof
.
revert
i
j
.
by
induction
l
;
intros
[|?]
[|?]
?;
f_equal
/=
;
auto
.
Qed
.
Lemma
list_insert_id
l
i
x
:
l
!!
i
=
Some
x
→
<
[
i
:=
x
]
>
l
=
l
.
Proof
.
revert
i
.
induction
l
;
intros
[|
i
]
[
=
];
f_equal
/=
;
auto
.
Qed
.
Lemma
list_insert_ge
l
i
x
:
length
l
≤
i
→
<
[
i
:=
x
]
>
l
=
l
.
Proof
.
revert
i
.
induction
l
;
intros
[|
i
]
?;
f_equal
/=
;
auto
with
lia
.
Qed
.
Lemma
list_lookup_other
l
i
x
:
length
l
≠
1
→
l
!!
i
=
Some
x
→
∃
j
y
,
j
≠
i
∧
l
!!
j
=
Some
y
.
...
...
@@ -689,6 +691,13 @@ Proof.
-
intros
(
x
&
Hx
&
?)
.
by
induction
Hx
;
csimpl
;
repeat
case_match
;
simplify_eq
;
try
constructor
;
auto
.
Qed
.
Lemma
list_elem_of_insert
l
i
x
:
i
<
length
l
→
x
∈
<
[
i
:=
x
]
>
l
.
Proof
.
intros
.
by
eapply
elem_of_list_lookup_2
,
list_lookup_insert
.
Qed
.
Lemma
nth_elem_of
l
i
d
:
i
<
length
l
→
nth
i
l
d
∈
l
.
Proof
.
intros
;
eapply
elem_of_list_lookup_2
.
destruct
(
nth_lookup_or_length
l
i
d
);
[
done
|
by
lia
]
.
Qed
.
(** ** Properties of the [NoDup] predicate *)
Lemma
NoDup_nil
:
NoDup
(
@
nil
A
)
↔
True
.
...
...
@@ -851,6 +860,13 @@ Section find.
[
match
goal
with
x
:
prod
_
_
|
-
_
=>
destruct
x
end
|
simplify_option_eq
];
eauto
.
Qed
.
Lemma
list_find_None
l
:
list_find
P
l
=
None
→
Forall
(
λ
x
,
¬
P
x
)
l
.
Proof
.
induction
l
as
[|?
l
IHl
];
[
eauto
|]
.
simpl
.
case_decide
;
[
done
|]
.
intros
.
constructor
;
[
done
|]
.
apply
IHl
.
by
destruct
(
list_find
P
l
)
.
Qed
.
Lemma
list_find_elem_of
l
x
:
x
∈
l
→
P
x
→
is_Some
(
list_find
P
l
)
.
Proof
.
induction
1
as
[|
x
y
l
?
IH
];
intros
;
simplify_option_eq
;
eauto
.
...
...
@@ -960,6 +976,11 @@ Proof.
-
by
rewrite
!
lookup_take_ge
.
-
by
rewrite
!
lookup_take
,
!
list_lookup_insert_ne
by
lia
.
Qed
.
Lemma
take_insert_lt
l
n
i
x
:
i
<
n
→
take
n
(
<
[
i
:=
x
]
>
l
)
=
<
[
i
:=
x
]
>
(
take
n
l
)
.
Proof
.
revert
l
i
.
induction
n
as
[|?
IHn
];
auto
;
simpl
.
intros
[|]
[|]
?;
auto
;
simpl
.
by
rewrite
IHn
by
lia
.
Qed
.
(** ** Properties of the [drop] function *)
Lemma
drop_0
l
:
drop
0
l
=
l
.
...
...
@@ -2237,6 +2258,14 @@ Section Forall_Exists.
Proof
.
by
rewrite
Forall_lookup
.
Qed
.
Lemma
Forall_tail
l
:
Forall
P
l
→
Forall
P
(
tail
l
)
.
Proof
.
destruct
1
;
simpl
;
auto
.
Qed
.
Lemma
Forall_nth
d
l
:
Forall
P
l
↔
∀
i
,
i
<
length
l
→
P
(
nth
i
l
d
)
.
Proof
.
rewrite
Forall_lookup
.
split
.
-
intros
Hl
?
[
x
Hl'
]
%
lookup_lt_is_Some_2
.
rewrite
(
nth_lookup_Some
_
_
_
_
Hl'
)
.
by
eapply
Hl
.
-
intros
Hl
i
x
Hl'
.
specialize
(
Hl
_
(
lookup_lt_Some
_
_
_
Hl'
))
.
by
rewrite
(
nth_lookup_Some
_
_
_
_
Hl'
)
in
Hl
.
Qed
.
Lemma
Forall_alter
f
l
i
:
Forall
P
l
→
(
∀
x
,
l
!!
i
=
Some
x
→
P
x
→
P
(
f
x
))
→
Forall
P
(
alter
f
i
l
)
.
Proof
.
...
...
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