From 2381ee32dd7bea497e92ac815ccc541a908eb98b Mon Sep 17 00:00:00 2001
From: Jonas Kastberg <jihgfee@gmail.com>
Date: Wed, 12 Jan 2022 15:13:33 +0000
Subject: [PATCH] Add lemmas `elem_of_prefix` and `elem_of_suffix`

---
 theories/list.v | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/theories/list.v b/theories/list.v
index b73ac068..a6ba10c8 100644
--- a/theories/list.v
+++ b/theories/list.v
@@ -2053,6 +2053,12 @@ Lemma prefix_length l1 l2 : l1 `prefix_of` l2 → length l1 ≤ length l2.
 Proof. intros [? ->]. rewrite app_length. lia. Qed.
 Lemma prefix_snoc_not l x : ¬l ++ [x] `prefix_of` l.
 Proof. intros [??]. discriminate_list. Qed.
+Lemma elem_of_prefix l1 l2 x :
+  x ∈ l1 → l1 `prefix_of` l2 → x ∈ l2.
+Proof. intros Hin [l' ->]. apply elem_of_app. by left. Qed.
+Lemma elem_of_suffix l1 l2 x :
+  x ∈ l1 → l1 `suffix_of` l2 → x ∈ l2.
+Proof. intros Hin [l' ->]. apply elem_of_app. by right. Qed.
 (* [prefix] is not a total order, but [l1] and [l2] are always comparable if
   they are both prefixes of some [l3]. *)
 Lemma prefix_weak_total l1 l2 l3 :
-- 
GitLab