{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# HW8 - member(e = False{mem member(e(x xs =(x == e member(e...

This preview shows page 1. Sign up to view the full content.

Sheet1 Page 1 CS 2603 Applied Logic for Hardware and Software Homework 8 FAQ Due Mar 25, nefore class (bring your paper to class, and turn it in there) Late Homework will be not accepted Warning! Some of these problems have long, tedious, involved solutions. Even after you figure them out, it will take a while to d Problem 1: Assume there is a function called max is that delivers the larger of its two arguments: (max x y) = x if x >= y {max>} (max x y) = y if y >= x) {max<) Prove the following theorems (assuming that x and y are values that can be compared using <, >, <=, etc). Theorem{maxL}. (max x y) >= x) Theorem{maxR}. (max x y) >= y) Theorem{maxM}. ((max x y) = x) \/ ((max x y) = y) Problem 2. Define a "big max" function. That is, define a function (call it maximum) that, given a non-empty sequence of value s Problem 3: Assume that the predicate "member" satisfies the following equations:
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: member(e, [ ]) = False {mem.[ ]} member(e, (x: xs)) = ((x == e) \/ member(e, xs)) {mem.:} That is, member(e, xs) is true if the value e occurs as an element of the sequence xs, and false if it doesn't. Prove that your function maximum, from the previous problem, has the following property: member(x, xs) -> ((maximum xs) >= x) Problem 4: Assume that concat satisfies the equations (concat).: and (concat).[ ] from the lectures. Prove that if there are a fi n (concat xss) = ( foldr (++) [ ] xss) Problem 5: Use the "member" predicate to define a predicate that expresses the notion that if xs is a sequence with length n ( t h Problem 6: Prove that the preservation property of "++" is true, regardless of the number of elements in its left-hand operand. Problem 7: Prove the theorem about the concat function (the big ++) that was stated in the lectures....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online