Skip to content

Commit 8103bb5

Browse files
add lemma length_app_comm
1 parent 155be26 commit 8103bb5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

theories/Lists/List.v

+9
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ Section Facts.
239239
intro l; induction l; simpl; auto.
240240
Qed.
241241

242+
Lemma length_app_comm : forall l l' : list A, length (l++l') = length (l'++l).
243+
Proof.
244+
intros.
245+
repeat rewrite length_app.
246+
rewrite Nat.add_comm.
247+
reflexivity.
248+
Qed.
249+
242250
Lemma last_length : forall (l : list A) a, length (l ++ [a]) = S (length l).
243251
Proof.
244252
intros ; rewrite length_app ; simpl.
@@ -3972,6 +3980,7 @@ Global Hint Rewrite
39723980
length_map (* length (map f l) = length l *)
39733981
length_seq (* length (seq start len) = len *)
39743982
length_app (* length (l ++ l') = length l + length l' *)
3983+
length_app_comm (* length (l ++ l') = length (l' ++ l) *)
39753984
length_rev (* length (rev l) = length l *)
39763985
app_nil_r (* l ++ nil = l *)
39773986
: list.

0 commit comments

Comments
 (0)