From f5359a93d72e95e0d4335f8acaba291848fa77c8 Mon Sep 17 00:00:00 2001 From: Andrea Asperti Date: Fri, 21 Dec 2012 11:13:51 +0000 Subject: [PATCH] mem/append lemmas --- matita/matita/lib/basics/lists/list.ma | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/matita/matita/lib/basics/lists/list.ma b/matita/matita/lib/basics/lists/list.ma index c1f6ab738..a34ac3c9c 100644 --- a/matita/matita/lib/basics/lists/list.ma +++ b/matita/matita/lib/basics/lists/list.ma @@ -268,6 +268,32 @@ let rec mem A (a:A) (l:list A) on l ≝ [ nil ⇒ False | cons hd tl ⇒ a=hd ∨ mem A a tl ]. + +lemma mem_append: ∀A,a,l1,l2.mem A a (l1@l2) → + mem ? a l1 ∨ mem ? a l2. +#A #a #l1 elim l1 + [#l2 #mema %2 @mema + |#b #tl #Hind #l2 * + [#eqab %1 %1 @eqab + |#Hmema cases (Hind ? Hmema) -Hmema #Hmema [%1 %2 //|%2 //] + ] + ] +qed. + +lemma mem_append_l1: ∀A,a,l1,l2.mem A a l1 → mem A a (l1@l2). +#A #a #l1 #l2 elim l1 + [whd in ⊢ (%→?); @False_ind + |#b #tl #Hind * [#eqab %1 @eqab |#Hmema %2 @Hind //] + ] +qed. + +lemma mem_append_l2: ∀A,a,l1,l2.mem A a l2 → mem A a (l1@l2). +#A #a #l1 #l2 elim l1 [//|#b #tl #Hind #Hmema %2 @Hind //] +qed. + +lemma mem_single: ∀A,a,b. mem A a [b] → a=b. +#A #a #b * // @False_ind +qed. lemma mem_map: ∀A,B.∀f:A→B.∀l,b. mem ? b (map … f l) → ∃a. mem ? a l ∧ f a = b. -- 2.39.2