hw8Solutions - Homework 8 Solutions Problem 1) Proof of...

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

View Full Document Right Arrow Icon
Homework 8 Solutions Problem 1) Proof of Thm{maxL}: Case 1: x >= y: max x y = x {max>} >= x {2 nd grade arith} Case2: x < y max x y = y {max<} > x {Case 2 assumption} >= x {2 nd grade arith} Proof of Thm{maxR}: similar to proof of maxL Proof of Thm{maxM} Cite the law of the excluded middle to prove the formula ((x >= y) \/ (not(x >= y))). Then use or elimination. In the middle and right-hand proofs in the or-eliminate, use your knowledge of arithmetic and or introduction to conclude the or-formula of {maxM}. Problem 2) maximum(x: xs) = foldr max x xs {maximum} Problem 3) P(n) (member(x, [x 1 , x 2 , … x n+1 ]) (maximum[x 1 , x 2 , … x n+1 ] x)) Base Case: P(0) (member(x, [x 1 ]) (maximum[x 1 ] x)) member(x, [x 1 ]) = member(x, x 1 :[ ]) (:) = (x == x 1 ) (member(x, [ ]) mem.: = (x == x 1 ) F a l s e m e m . [ ] = (x == x 1 ) identity Therefore, maximum[x 1 ] = maximum[x] substitution = maximum(x: [ ]) (:) = foldr max x [ ] maximum = x foldr.[ ] x a r i t h m e t i c Inductive Case: P(n+1) (member(x, [x 1 , x 2 , … x n+2 ]) (maximum[x 1 , x 2 , … x n+2 ] x)) member(x, [x 1 , x 2 , … x n+2 ]) = member(x, x 1 : [x 2 , … x n+2 ]) (:) = (x == x 1 ) member(x, [x 2 , … x n+2 ]) mem.:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/08/2008 for the course CS 2603 taught by Professor Rexpage during the Spring '08 term at The University of Oklahoma.

Page1 / 3

hw8Solutions - Homework 8 Solutions Problem 1) Proof of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online