CSE 4308/5360 - Exams - Preparation for Second Midterm - Answers

Material

The material covered in this midterm consists of the following chapters and sections in the textbook:

Practice Questions

  1. What is the negation of each of the following sentences:
    1. for-every x, exists y: son(x) = y
    2. for-every x, for-every y: son(x) = y <=> father(y) = x
    
    In your answers, any "not" may only appear after the last appearance of a universal or existential quantifier.

    Answer:

    1. exists x, for every y: son(x) != y
    2. exists x, exists y: not (son(x) = y <=> father(y) = x)
    
    

  2. Textbook exercise 8.8.

    Answer:

    Male(x) and Spouse(x, y) => Female(y)
    

  3. Consider the technique of propositionalization. For each of the following two knowledge bases, decide if propositionalization can be applied successfully. If not, why not?
    KB 1:
    
    for-every x: king(x) and greedy(x) => evil(x)
    king(John)
    greedy(John)
    brother(Richard, John)
    
    
    KB 2:
    for-every x: king(x) and greedy(x) => evil(x)
    king(John)
    greedy(John)
    brother(Richard, John)
    king(father(John))
    

    Answer:

    For KB1, propositionalization can be applied successfully because there are no functions. For KB2, propositionalization cannot be applied successfully because there are functions.

  4. What is the most general unifier for each of the following pairs of expressions:
    1. major(John, x), major(y, mathematics)
    2. major(John, x), major(y, z)
    3. major(John, x), major(y, x)
    4. major(John, x), major(x, y)
    

    Answer:

    1. {y/John, x/mathematics}
    2. {y/John, x/z}
    3. {y/John}
    4. {x/John, y/John}
    

  5. Textbook exercise 9.3, parts (a), (b)

    Answer:

    Only (b) is valid, because in (b) we replace the existential quantifier with a variable that does not appear elsewhere in the database, whereas in (a) we have replaced the existential quantifier with a variable that already appeared in the database.

  6. Textbook exercise 9.4.

    Answer:

    1. {x/A, y/B, z/B}
    2. none
    3. {y/John, x/John}
    4. none
    

  7. Textbook exercise 9.19, parts (a), (b), (c).

    Answer:
    (a). (A) becomes: for every natural number x there exists a natural number y such that x is greater than or equal to y.
    (B) becomes: there exists a natural number y such that every natural number x is greater than or equal to y.
    (b). (A) is true: any natural number is >= 0.
    (c). (B) is true: If y = 0, then any natural number x is greater than or equal to 0.

  8. Textbook exercise 11.2.

    Answer:

    Fly(P1, JFK, SFO)
    Fly(P2, SFO, JFK)
    

  9. Textbook exercise 11.8.

    Answer:

    In class on Tuesday, November 13.

  10. Textbook figure 11.4 provides a description for a deterministic version of the blocks world. We want to make a modification to that description, so as to model a nondeterministic version, in which the effect of action move(b, x, y) is sometimes on(b, y) and sometimes on(b, table). How would you modify the description of the move action to make it reflect the above two possible outcomes of move(b, x, y)?

    Answer:

    We would replace the effect of the action shown on figure 11.4 with the following effect:

    (On(b, y) and Clear(x) and (not On(b, x)) and (not Clear(y))) or
    (On(b, table) and Clear(x) and (not (On(b, x))))
    
  11. In the nondeterministic blocks world described in the previous exercise, suppose that the initial state and the goal are as described in figure 11.4. Is there a conditional plan that achieves this goal with guaranteed success? If yes, list the sequence of actions in that plan. If no, explain why not.

    Answer:

    No, there is no conditional plan that guarantees success, because it is theoretically possible that an infinite number of moves be required to successfully move a block on top of another block.

    1. Is the following function P a valid probability function? If you answer "no", explain why not.
      P(day == Monday) = 0.4
      P(day == Tuesday) = 0.4
      P(day == Wednesday) = 0.2
      
    2. Is the following function P a valid probability function? If you answer "no", explain why not.
      P(day == Monday) = 0.4
      P(day == Tuesday) = 0.4
      P(day == Wednesday) = 0.2
      P(day == Thursday) = 0.1
      
    3. Is the following function P a valid probability density function? If you answer "no", explain why not.
      P(x) = 0.1, if 10 <= x <= 20.
      P(x) = 0 otherwise.
      
    4. Is the following function P a valid probability density function? If you answer "no", explain why not.
      P(x) = 0.01, if 10 <= x <= 20.
      P(x) = 0 otherwise.
      

    Answer:

    In (1) and (3), P is valid. In (2), P is not a valid probability function, because the sum of probabilities is not 1. In (4), P is not a valid probability density function, because the integral is not 1.

  12. Compute P(fire | alarm), given the following information:
    P(alarm | fire) = A
    P(alarm | not fire) = B
    P(fire) = C
    

    Answer:

    P(alarm) = P(alarm | fire) * P(fire) + P(alarm | not fire) * P(not fire)
             = A*C + B*(1-C).
    P(fire | alarm) = P(alarm | fire) * P(fire) / P(alarm)
                    = A*C / A*C + B*(1-C)
    

  13. We are given the following information:
    P(fire) = 0.1
    P(earthquake) = 0.2
    P(flood) = 0.4
    
    1. Suppose that we do not know whether fire, earthquake, and flood, are independent events. Can we compute the probability P(fire and earthquake and flood)? If yes, what is P(fire and earthquake and flood)?
    2. Suppose that we know that fire, earthquake, and flood, are independent events. Can we compute the probability P(fire and earthquake and flood)? If yes, what is P(fire and earthquake and flood)?
    3. Suppose that we know that fire, earthquake, and flood, are not independent events. Can we compute the probability P(fire and earthquake and flood)? If yes, what is P(fire and earthquake and flood)?

    Answer:

    We can only compute the probability P(fire and earthquake and flood) in case (2), where we know that the events are independent. In that case, P(fire and earthquake and flood) = P(fire) * P(earthquake) * P(flood) = 0.1 * 0.2 * 0.4 = 0.008.

  14. Compute P(commute time < 20 min | temperature > 80), given the following joint probability distribution:
    Commute time  40-60 Fahrenheit 60-80 Fahrenheit   above 80 Fahrenheit
    < 20 min      0.1              0.05               0.1 
    20-40 min     0.2              0.1                0.1
    > 40 min      0.05             0.1                0.2
    

    Answer:

    P(temperature > 80) = 0.1 + 0.1 + 0.2 = 0.4
    P(commute time < 20 min AND temperature > 80) = 0.1
    P(commute time < 20 min | temperature > 80) = P(commute time < 20 min AND temperature > 80) / P(temperature > 80) 
                                                = 0.1 / 0.4 = 0.25 
    
  15. For the Bayesian network shown in textbook figure 14.2: is P(Earthquake | Alarm) larger, equal to, or smaller than P(Earthquake | Alarm and Burglary)? You can either (not recommended) compute both probabilities, or (recommended) provide an intuitive (but correct) justification for your answer.

    Answer:

    P(Earthquake | Alarm) is larger than P(Earthquake | Alarm and Burglary) because burglary and earthquake are competing causes of the alarm event. If we know that one of those causes is true, it makes the other cause less likely.

  16. For the Bayesian network shown in textbook figure 14.2: is P(Earthquake | Alarm) larger, equal to, or smaller than P(Earthquake | Alarm and MaryCalls)? You can either (not recommended) compute both probabilities, or (recommended) provide an intuitive (but correct) justification for your answer.

    Answer:

    P(Earthquake | Alarm) is equal to P(Earthquake | Alarm and MaryCalls) because the probability distribution of Earthquake is conditionally independent of MaryCalls given knowledge of whether Alarm occurred.