hw2 - add a bean of the third color (eg., blue) to the can....

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

View Full Document Right Arrow Icon
CSE586 (Spring 2010): Homework 2 Due by Feb 3, in class. 1. (30 points) True or False? Explain your answer. 1. stable.P stable.Q stable. ( P Q ) 2. P unless Q stable. ( P Q ) stable.P 3. P squiggleright Q P R squiggleright Q 4. ( P squiggleright Q ) ( P squiggleright R ) stable.R P squiggleright ( Q R ) 5. ( P squiggleright Q ) ( RnextS ) ( P R ) squiggleright (( R Q ) ( ¬ R S )) 2. (70 points) Consider a cofee can containing an arbitrary (but ±nite) number o² beans. The beans come in 3 diferent colors: red, green, and blue. You are asked to per²orm the ²ollowing action repeatedly (ie., over and over as long as possible): Reach into the can and pick two random beans. I² the beans are the same color, throw them both out and add two beans for the other two colors . I² they are diferent colors (eg., red and green), throw them both out and
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: add a bean of the third color (eg., blue) to the can. I. Program Write the simplest program you can that represents this computation. (3 variables should suce). II. Fixed Point Calculate the xed-point o your program. III. Progress Give a careully reasoned argument that your program terminates. IV. Safety Is the nal state determined deterministically by the initial conguration? (Give a yes/no answer) I no, give an example o a single initial conguration and two diferent runs rom that initial state that lead to diferent nal states. I yes, give the simplest rule you can or predicting the nal state given an initial conguration. Prove that your rule is correct. 1...
View Full Document

This document was uploaded on 05/02/2010.

Ask a homework question - tutors are online