Logic

My wife asked me: Buy sausages, if you’ll find eggs, buy 10. What happens next?

Option #1:

if eggs >= 10 then buy(sausages, eggs=10);

Option #2:

if sausages > 0 then buy(sausages);
if eggs >= 10 then buy(eggs, 10);

Option #3

buy(sausages);
if eggs >= 10 then buy(eggs, 10);

The 3rd option is dangerous one because it could end up with never-ending run in the city looking for sausages, never buying eggs and never coming back home.

…and more. Why?

Asking me to make shopping, my wife did not stick to the principles of valid inference and correct reasoning. That’s the reason why not everybody can be a programmer :-)

8 thoughts on “Logic

  1. buy(sausages,2); // sausages is plural, need to buy 2 otherwise its a sausage
    if eggs then buy(sausages,8); // if you find eggs, you better come home with 10 sausages!

  2. if (requester == wife) then
        expect_valid_inferences_and_correct_reasoning = False
    else
        divorce = True
    
    if (divorce == True)
       buy(beer, 12)
    else
       buy(sausages, 10)
       buy(eggs, 12)
       buy(flowers, 1)

    P.S. Sum of five + ten = fifteen, not 15.

  3. Eric,

    Hehe, isn’t it too radical? By the way, my wife does not mind whether I have some beer, so assuming the execution does not fall into divorce case, I’d replace 12 eggs with 10, 1 flower – let’s leave as is, and add 2 beers. Yes. looks good now :-)

  4. Mateusz,
    Me thinks you’ve been staring at a screen too long. Its all about context. That’s what separates humans from computers. Hmm I wonder if that’s what separates real people from geeks too. :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>