From: Andrea Asperti Date: Fri, 21 Dec 2012 11:13:51 +0000 (+0000) Subject: mem/append lemmas X-Git-Tag: make_still_working~1377 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=f5359a93d72e95e0d4335f8acaba291848fa77c8;p=helm.git mem/append lemmas --- 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.