Session 20 - Friday, October 5th


Using Prolog

Mostly, we spent the period playing with Prolog and the knowledge base we have worked with this week. 

 

If there is time, we will play with the following:

 

An Exercise: Logic as Representation

Represent the following sentences in logic.

  1. One more outburst like that and you’ll be in contempt of court!

  2. A new ER is on TV tonight, if you’re interested.

  3. Either the Yankees win the pennant, or I’m out $10.00.

  4. Maybe I’ll come to your party, and maybe I won’t.

  5. Well, I like Bob and I don’t like Bob.

Solutions?

1. One more outburst like that and you’ll be in contempt of court!

Straightforward translation:

        haveOutburst(You) and inContempt(You)

Consequence:

        inContempt(You) must be true!

Intended meaning:

        haveOutburst(You) implies inContempt(You)

 

2. ER is on TV tonight, if you’re interested.

Straightforward translation:

        interested( You, ER ) implies onTubeTonight( ER )

Consequence:

    What if I am not interested?

Intended meaning:

    onTubeTonight( ER ) and ( interested( You, ER )

                                implies canWatchTonight( You,ER ) )

3. Either the Yankees win the pennant, or I’m out $10.00.

Straightforward translation:

        win( Yankees, pennant-of( AL, 2007 ) ) or  lose(JBS, $10)

Consequence: What if the Yankees win?  Where is the causality?

Intended meaning:

        prevent( win(Yankees, pennant-of( AL, 2007 ) ),

                        lose(JBS, $10) )

 

4. Maybe I’ll come to your party, and maybe I won’t.

Straightforward translation:

        ( maybe( comeTo( JBS, YourParty ) ) ) or

           ( maybe( not comeTo( JBS, YourParty ) ) )

Consequence: The translation is a tautology!

Intended meaning:

        undecided comeTo( JBS, YourParty )

Consequence:  We need an operator that deals with possibility...

 

5. Well, I like Bob and I don’t like Bob.

Straightforward translation:

        like( JBS, Bob ) and not like(JBS, Bob )

Consequence: The translation is a contradiction!

Intended meaning:

    $ way1, way2

        like( JBS, Bob, way1 ) and

        not like(JBS, Bob, way2 ) )

Consequence: We need to represent states explicitly.