Computer Science 662: Artificial Intelligence

Potential Questions

  1. First-Order Logic
    1. Write the following sentences in First-Order Logic:
      1. All men are mortal
      2. Forall x, Man(x) -> Mortal(x)

      3. Socrartes is a man
      4. Man(Socrates)

      5. Any mortal who drinks Hemlock will die
      6. Forall x, Mortal(x) and Drinks(x,Hemlock) -> Die(x)

      7. Every man loves a woman
      8. Forall x, Exists y Man(x) -> Woman(y) and Loves(x,y)

      9. There is a man who loves all women
      10. Exists x, Forrall y Man(x) and (Woman(y) -> Loves(x,y))

      11. There is a woman whom every man loves
      12. Exists x, Forall y Woman(x) and (Man(y) -> Loves(y,x))

      13. Every woman loves every man who loves her
      14. Forall x, Forall Y, Woman(x) and Man(y) and Loves(y,x) -> Loves(x,y)

      15. If a man is loved, he will drink Hemlock
      16. Forall x, Forall Y, Man(x) and Loves(y,x) -> Drinks(x, Hemlock)

      using the predicates: Man(x), Mortal(x), Drinks(x,y), Die(X), Loves(x,y), Woman(x,y)
    2. Rewrite all of the above statements in CNF (without quantifiers)
      1. All men are mortal
      2. Forall x, Man(x) -> Mortal(x)

        not Man(x) or Mortal(x)

      3. Socrartes is a man
      4. Man(Socrates)

      5. Any mortal who drinks Hemlock will die
      6. Forall x Mortal(x) and Drinks(x, Hemlock) -> Die(x)

        not Mortal(x) or not Drinks(x, Hemlock) or Die(x)

      7. Every man loves a woman
      8. Forall x, Exists y Man(x) -> Woman(y) and Loves(x,y)

        (Man(x) or Woman(f(X)) and (Man(x) or Loves(x,f(x))

      9. There is a man who loves all women
      10. Exists x, Forrall y Man(x) and (Woman(y) -> Loves(x,y))

        Man(M) and (not Woman(y) or Loves(M,y))

      11. There is a woman whom every man loves
      12. Exists x, Forall y Woman(x) and (Man(y) -> Loves(y,x))

        Woman(W) and (not Man(y) or Loves(y,W))

      13. Every woman loves every man who loves her
      14. Forall x, Forall Y, Woman(x) and Man(y) and Loves(y,x) -> Loves(x,y)

        not Woman(x) or not Man(y) or not Loves(y,x) or Loves(x,y)

      15. If a man is loved, he will drink Hemlock
      16. Forall x, Forall Y, Man(x) and Loves(y,x) -> Drinks(x, Hemlock)

        Forall x, Forall Y, Man(x) and Loves(y,x) -> Drinks(x, Hemlock)

        not Man(x) or not Loves(y,x) or Drinks(x, Hemlock)

    3. Use resolution by refutation (and unification!) to prove Die(Socrates)
      1. not Man(x) or Mortal(x)
      2. Man(Socrates)
      3. not Mortal(a) or not Drinks(a, Hemlock) or Die(a)
      4. (Man(b) or Woman(f(b))
      5. (Man(c) or Loves(c,f(c))
      6. Man(M)
      7. Woman(d) or Loves(M,d)
      8. Woman(W)
      9. not Man(e) or Loves(e,W))
      10. not Woman(f) or not Man(g) or not Loves(g,f) or Loves(f,g)
      11. not Man(h) or not Loves(i,h) or Drinks(h, Hemlock)
      12. not Die(Socrates) (assuming negation
      13. Resolve 12,3 {a / Socrates}: not Mortal(Socrates) or not Drinks(Socrates,Hemlock)
      14. Resolve 1,2 {x / Socrates}: Mortal(Socrates)
      15. Resolve 13,14 {x / Socrates}: not Drinks(Socrates,Hemlock)
      16. Resolve 15,11 {h / Socrates}: not Man(Socrates) or not Loves(i,Socrates)
      17. Resolve 2,16 {h / Socrates}: not Loves(i,Socrates)
      18. Resolve 17, 10 {g / Socrtes i/f}: not Woman(f) or not Man(Socrates) or not Loves(Socrates,f)
      19. Resolve 18, 2 {g / Socrtes i/f}: not Woman(f) or not Loves(Socrates,f)
      20. Resolve 19, 9 {e / Socrates f/W}: not Woman(W) or not Man(Socrates)
      21. Resolve 20, 2: not Woman(W)
      22. Resolve 19, 8: <empty>
  2. Joe Student comes to his professor and tells him that he forgot to bring his project to hand in, and wants to turn it in tomorrow without penalty. The professor knows that 1 time in 100, a student completes her assignment and forgets to bring it. The professor also knows that 50% of the time, a student who hasn't completed the assignment will say that they forgot it. Finally, the professor believes that 90% of the students in the class completed the assignment. What is the probability that the student completed the homework?
  3. We know: (s = student says assignment completed, c = assignment completed, b = assignment brought)

    P(not b, c) = 1/100
    P(s | not b, not c) = 1/2
    P(c) = 9/10

    P(c | s, not b) = P(s, not b | c) p(c) / P(s, not b)
    P(s, not b | c) = P(not b | c) P(s | not b, c)
    Assumption: P(s | not b, c) = 1 (If a student did the assignment and forget, they would say so)
    P(not b | c) = P(not b, c) / P(c) P(s, not b) = P(s, not b | c) P(c) + P(s, not b | not c)P(not c)
    P(s, not b | not c) = P(not b | not c) P(s | not b, not c)

    We now have everything ... P(s , not b | c) = P(not b | c) P(s | not b, c)
        = (P(not b, c) / P(c)) P(s | not b, c)
        = (1/100 / (9/10)) * 1 = 1/90
    P(s, not b | not c) = P(not b | not c) P(s | not b, not c)
        =1 * (1/2)
    P(s, not b) = P(s, not b | c) P(c) + P(s, not b | not c)P(not c)
        1/90 (90/100) + (1/2) (1/10)
        6/100
    P(c | s, not b) = P(s, not b | c) p(c) / P(s, not b)
        (1/90) (90/100) / (6/100)
        1/6
  4. You are playng a simplified blackjack-style game. Your opponent is assigned a random number between 1 and 10 (each number being equally likely). You are not allowed to see your opponents number. You are then given a random number between 1 and 10 (each number being equally likely). After seeing your number, you are allowed to receive a second random number between 1 and 10. If the sum of your two numbers is less than your opponent's number, you lose $10. If the sum of your two numbers is the same as your opponent's number, you lose nothing. If the sum of your two numbers is greater than your opponent's number, and less than or equal to 10, then you win $10. Finally, if the sum of your two numbers is greater than 10, you lose $10.
    1. If you draw a 3, what is the expected utility if you do not get another number? If you do get another number?
      If you do not get another number, you win with probabily 2/10, lose with probabilty 7/10, and tie with probability 1/10. So, the expected utility of not drawing another card is : 2/10 * 10 + 7/10 * (-10) + 1/10 * 0 = -5
      If you do get another number, it gets a little more complicated. We need to look at all of the cases -- you could draw a 1-10, each with probabilty 1/10. If you draw a 1, you win with probability 3/10, if you draw a 2, you win with probability 4/10, if you draw a 3 you win with probability 5/10, all the way up to if you draw a 7, you win with probability 9/10. If you draw a 8, 9, or 10, you win with probability 0. So, your probability of winning is:
      (1/10)(3/10 + 4/10 + 5/10 + 6/10 + 7/10 + 8/10 + 9/10 + 0 + 0 + 0) = 42/ 100
      By the same logic, if you draw another card you will lose with probability:
      (1/10)(6/10 + 5/10 + 4/10 + 3/10 + 2/10 + 1/10 + 0/10 + 1 + 1 + 1) = 51/ 100
      Finally, you will tie with probability 100 - 42/100 - 51/100 = 7/100

      So, your expected utility for drawing again is: 42/100 * 10 + 51/100*-10 = 42/10 - 51/10 = -9/10, which is slightly better than not drawing.
    2. If you draw a 5, what is the expected utility if you do not get another number? If you do get another number?
      If you don't get another number, you win with probability 4/10, lose with probabilty 5/10, and tie with probability 1/10, for a utility of 4/10 * 10 + 5/10 * (-10) + 1/10 * 0 = -1
      If you do get another number, we need to do the same calculation as before. You win will probability:
      (1/10)(5/10 + 6/10 + 7/10 + 8/10 + 9/10 +0 + 0 + 0 + 0 + 0) = 30/ 100
      and lose with probability
      (1/10)(4/10 + 3/10 + 2/10 + 1/10 + 0/10 +1 + 1 + 1 + 1 + 1) = 60/ 100
      Finally, you will tie with probability 100 - 30/100 - 70/100 = 10/100
      So, the expected utility of picking again on a 5 is 30/100 * 10 + 60/100 * -10 = -3
    3. If you draw a 10, what is the expected utility if you do not get another number? If you do get another number?
      If you do not get another number, you win with probability 9/10, tie with probability 1/10, and lose with probability 0/10, for an expected utility of 9/10 * 10 + 0/10 * (-10) + 1/10 * 0 = 9.
      If you do not get another number, you lose with probability 1, for an expeced utility of -10.
    4. What is the maximum expected utility for this game?
      Going through each possible number you could draw, 1-10, we have:
      1: Don't pick another : Expected Utility = -9
      Pick another: P(win) = (1/10)(1/10 + 2/10 + 3/10 + 4/10 + 5/10 + 6/10 + 7/10 + 8/10 + 9/10 + 0) = 45/100
      Pick another: P(lose) = (1/10)(8/10 + 7/10 + 6/10 + 5/10 + 4/10 + 3/10 + 2/10 + 1/10 + 0/10 +1) = 46/100
      Expected Utility = 45/10 - 46/10 = -1/10
      2: Don't pick another : Expected Utility = -7
      Pick another: P(win) = (1/10)(2/10 + 3/10 + 4/10 + 5/10 + 6/10 + 7/10 + 8/10 + 9/10 + 0 + 0) = 44/100
      Pick another: P(lose) = (1/10)(7/10 + 6/10 + 5/10 + 4/10 + 3/10 + 2/10 + 1/10 + 0/10 + 1 +1) =48/100
      Expected Utility = 44/10 - 48/10 = -4/10
      3: Don't pick another : Expected Utility = -5
      Pick another: P(win) = (1/10)(3/10 + 4/10 + 5/10 + 6/10 + 7/10 + 8/10 + 9/10 + 0 + 0 + 0) = 42/100
      Pick another: P(lose) = (1/10)(6/10 + 5/10 + 4/10 + 3/10 + 2/10 + 1/10 + 0/10 + 1 +1 + 1) =51/100
      Expected Utility = 42/10 - 51/10 = -9/10
      4: Don't pick another : Expected Utility = -3
      Pick another: P(win) = (1/10)(4/10 + 5/10 + 6/10 + 7/10 + 8/10 + 9/10 + 0 + 0 + 0 + 0) = 39/100
      Pick another: P(lose) = (1/10)(5/10 + 4/10 + 3/10 + 2/10 + 1/10 + 0/10 + 1 +1 + 1 + 1) =54/100
      Expected Utility = 39/10 - 55/10 = -16/10
      5: Don't pick another : Expected Utility = -1
      Pick another: P(win) = (1/10)(5/10 + 6/10 + 7/10 + 8/10 + 9/10 + 0 + 0 + 0 + 0 + 0) = 35/100
      Pick another: P(lose) = (1/10)(4/10 + 3/10 + 2/10 + 1/10 + 0/10 + 1 +1 + 1 + 1 + 1) =60/100
      Expected Utility = 35/10 - 60/10 = -25/10
      6: Don't pick another : Expected Utility = 1
      Pick another: P(win) = (1/10)(6/10 + 7/10 + 8/10 + 9/10 + 0 + 0 + 0 + 0 + 0 + 0) = 30/100
      Pick another: P(lose) = (1/10)(3/10 + 2/10 + 1/10 + 0/10 + 1 + 1 +1 + 1 + 1 + 1) =66/100
      Expected Utility = 30/10 - 66/10 = -36/10
      7: Don't pick another : Expected Utility = 3
      Pick another: P(win) = (1/10)(7/10 + 8/10 + 9/10 + 0 + 0 + 0 + 0 + 0 + 0) = 24/100
      Pick another: P(lose) = (1/10)( 2/10 + 1/10 + 0/10 + 1 + 1 +1 + 1 + 1 + 1 + 1) =73/100
      Expected Utility = 24/10 - 73/10 = -49/10
      8: Don't pick another : Expected Utility = 5
      Pick another: P(win) = (1/10)(8/10 + 9/10 + 0 + 0 + 0 + 0 + 0 + 0 + 0) = 17/100
      Pick another: P(lose) = (1/10)( 1/10 + 0/10 + 1 + 1 +1 + 1+1 + 1 + 1 + 1) =81/100
      Expected Utility = 17/10 - 81/10 = -64/10
      9: Don't pick another : Expected Utility = 7
      Pick another: P(win) = (1/10)( 9/10 + 0 + 0 + 0 + 0 + 0 + 0 + 0+0) = 9/100
      Pick another: P(lose) = (1/10)( 0/10 + 1 + 1+1 +1 + 1+1 + 1 + 1 + 1) =90/100
      Expected Utility = 9/10 - 90/10 = -81/10
      9: Don't pick another : Expected Utility = 9
      Pick another: Expected Utility = -9

      So, maximum expected utility is:
      (1/10)(-1/10 -4/10 -9/10 -16/10 -1 + 1 + 3 + 5 + 7 + 9) = 2.2
    5. You draw a 5. What would you be willing to pay to see your opponent's number before deciding to draw another number?

      If we draw a 5, then our maximum expected utility is -1 (which we get by not drawing again). If we know what the opponet's number before we deciide to draw, then our strategy will be:
      • if the opponent's number is 1-4, then we will not draw (and win with a probability 1, guaranteed return of 10)
      • if the opponent's number is 5, then we will not draw (and tie with a probability 1, with a guaranteed return of 0)
      • If the opponent's number is greater than 5, then we pick another number. If their number is 6, we win with probabilty 4/10 and lose with probability 5/10, for an expected return of -1. If their number is 7, we win with probabililty 3/10 and lose with probability 6/10, for an expected return of -3. Likewise, if their number is 8, our expected return is -5, and if their number is 9 our expected return is -7, and if their number is 10, our expected return is -9.
      That gives us an expected utility of: (4/10)*10 + 1/10 * 0 + 1/10 * (-1 -3 -5 -7 -9) = 4 -2.5 = 1.5. So, our maxiumum expected utility has gone up from -1 to 1.5, so we should be willing to pay up to 2.5 for this information.