feat(library/data/list/comb): add map theorems

This commit is contained in:
Haitao Zhang 2015-07-13 14:38:31 -07:00 committed by Leonardo de Moura
parent 589f9df103
commit fae8176363

View file

@ -19,6 +19,12 @@ theorem map_nil (f : A → B) : map f [] = []
theorem map_cons (f : A → B) (a : A) (l : list A) : map f (a :: l) = f a :: map f l theorem map_cons (f : A → B) (a : A) (l : list A) : map f (a :: l) = f a :: map f l
lemma map_append (f : A → B) : ∀ l₁ l₂, map f (l₁++l₂) = (map f l₁)++(map f l₂)
| nil := take l, rfl
| (a::l) := take l', begin rewrite [append_cons, *map_cons, append_cons, map_append] end
lemma map_singleton (f : A → B) (a : A) : map f [a] = [f a] := rfl
theorem map_id : ∀ l : list A, map id l = l theorem map_id : ∀ l : list A, map id l = l
| [] := rfl | [] := rfl
| (x::xs) := begin rewrite [map_cons, map_id] end | (x::xs) := begin rewrite [map_cons, map_id] end