
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

HW 11 Prof. Caldwell Due: 9 October 2008 COSC 3015
Recall the list induction principle.
[P ([ ])∧ ∀a : α. ∀m : [α]. P (m) ⇒ P (a : m)] ⇒ ∀m : [α].P (m)
Thus, for a property P of lists, to show that ∀m : [α]. P (m) it is enough to show two things:
i.) P ([ ]) ii.) ∀a : α. ∀m : [α]. P (m) ⇒ P (a : m)
Here are some definitions. head(h : t) = h head[ ] = ⊥
last[x] = x last(h : t) = last t last[ ] = ⊥
reverse[ ] = [ ] reverse(h : t) = (reverse t) + +[h]
map f [ ] = [ ] map f (h : t) = (f h) : map f t
(f. g) x = f (g x)
Prove the following by list induction.
1 .) ∀m : [α]. map (f. g) m = ((map f ). (map g)) m 2 .) ∀m : [α]. head (reverse m) = last m