Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pierre Letouzey
natded
Commits
f9858496
Commit
f9858496
authored
Jul 30, 2020
by
Pierre Letouzey
Browse files
Utils.list_drop : remove the n-th element from a list
To be used later when interpreting lift_above formulas
parent
4cff5b16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Utils.v
View file @
f9858496
...
@@ -123,6 +123,17 @@ Fixpoint list_max l :=
...
@@ -123,6 +123,17 @@ Fixpoint list_max l :=
|
n
::
l
=>
Nat
.
max
n
(
list_max
l
)
|
n
::
l
=>
Nat
.
max
n
(
list_max
l
)
end
.
end
.
(
**
Remove
the
n
-
th
element
of
a
list
(
if
it
exists
)
*
)
Fixpoint
list_drop
{
A
}
n
(
l
:
list
A
)
:=
match
n
,
l
with
|
0
,
a
::
l
=>
l
|
S
n
,
a
::
l
=>
a
::
list_drop
n
l
|
_
,
[]
=>
l
end
.
(
**
Properties
of
these
functions
on
lists
*
)
Ltac
cons
:=
constructor
;
congruence
.
Ltac
cons
:=
constructor
;
congruence
.
Instance
eqb_inst_list
{
A
}
`
{
Eqb
A
}
:
Eqb
(
list
A
)
:=
list_forallb2
eqb
.
Instance
eqb_inst_list
{
A
}
`
{
Eqb
A
}
:
Eqb
(
list
A
)
:=
list_forallb2
eqb
.
...
@@ -315,6 +326,20 @@ Proof.
...
@@ -315,6 +326,20 @@ Proof.
now
rewrite
filter_In
,
<-
eqb_neq
,
negb_true_iff
.
now
rewrite
filter_In
,
<-
eqb_neq
,
negb_true_iff
.
Qed
.
Qed
.
Lemma
list_drop_nth_high
{
A
}
n
k
(
l
:
list
A
)
d
:
n
<=
k
->
nth
k
(
list_drop
n
l
)
d
=
nth
(
S
k
)
l
d
.
Proof
.
revert
k
l
.
induction
n
;
destruct
l
,
k
;
cbn
;
auto
with
arith
;
omega
.
Qed
.
Lemma
list_drop_nth_low
{
A
}
n
k
(
l
:
list
A
)
d
:
k
<
n
->
nth
k
(
list_drop
n
l
)
d
=
nth
k
l
d
.
Proof
.
revert
k
l
.
induction
n
;
destruct
l
,
k
;
cbn
;
auto
with
arith
;
omega
.
Qed
.
(
**
Max
and
lists
*
)
(
**
Max
and
lists
*
)
Lemma
max_le
n
m
p
:
Nat
.
max
n
m
<=
p
<->
n
<=
p
/
\
m
<=
p
.
Lemma
max_le
n
m
p
:
Nat
.
max
n
m
<=
p
<->
n
<=
p
/
\
m
<=
p
.
...
...
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