{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw7Solutions

# hw7Solutions - Homework 7 Solutions Problem 1 and = foldr...

This preview shows pages 1–2. Sign up to view the full content.

Homework 7 Solutions Problem 1) and = foldr ( ) True {and} Problem 2) Theorem {and 1 }. and([x] ++ ([False] ++ ys)) = False proof: and([x] ++ ([False] ++ ys)) = and((x: [ ]) ++ ([False] ++ ys)) (:) = and(x: ([ ] ++ ([False] ++ ys))) ++.: = foldr ( ) True (x: ([ ] ++ ([False] ++ ys))) and = x (foldr ( ) True ([ ] ++ ([False] ++ ys))) foldr.: = x (foldr ( ) True ([False] ++ ys)) ++.[ ] = x (foldr ( ) True ((False: [ ]) ++ ys)) (:) = x (False (foldr ( ) True ([ ] ++ ys))) foldr.: = x ((foldr ( ) True ([ ] ++ ys)) False) commutes = (x (foldr ( ) True ([ ] ++ ys)) False associative = False null Problem 3) Theorem {and T }. and[True, True, … True] = True P(0) (and[ ] = True) P(1) (and[True] = True) P(2) (and[True, True] = True) P(n) (and[True, True, … True] = True) where [True, True, … True] has n elements Base Case: P(0) and [ ] = foldr (∧) True [ ] and = True foldr.[ ] Inductive Case: P(n+1) and[True, True, … True] where [True, True, … True] has n+1 elements = foldr (∧) True [True, True, … True] and where [True, True, … True] has n+1 elements = foldr (∧)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}