21.1 Syllogisms in Prolog: Question

Exercise: Syllogisms in Prolog

Introduction to syllogisms

For those who need to refresh their memories on what a syllogism is, here is a little reminder.

Syllogisms make use of four kinds of two-place predicates:

Kind Syntax Example
Universal affirmative all(S,P) All whales are mammals
Universal negative no(S,P) No bird is a mammal
Particular affirmative some(S,P) Some rhino is a wall-paper eater
Particular negative some_not(S,P) Some rhino is not grey

A syllogism consists of two premises and a conclusion. Both of the premises, as well as the conclusion, are predicates of the kind described above.

There are four figures to choose from:

1st figure:              
Therefore: z(S,P)
3rd figure:
Therefore: z(S,P)
2nd figure:
Therefore: z(S,P)
4th figure:
Therefore: z(S,P)

Here, x, y, and z are predicates of the kind described. S, P, and M are arguments such as "mammals", "birds", "wallpaper-eaters".

Syllogisms are named by Latin words, each of which has three of the vowels a, e, i, and o. Each of the vovels corresponds to one of the four kinds of predicates:

  • a: Univeral affirmative
  • e: Universal negative
  • i: Particular affirmative
  • o: Particular negative

The vowels 'a' and 'i' come from the Latin word 'affirmo', which means 'I affirm', while the vowels 'e' and 'o' come from the Latin word 'nego', which means 'I deny'.

For example, the syllogism "Darii" is a syllogism from the 1st figure, and contains a universal affirmative ('a') as the first premise, and a particular affirmative ('i') for its psecond premise as well as its conclusion:

Premise 1: all(M,P) All mammals are breast-feeders
Premise 2: some(S,M) Some whales are mammals
Conclusion: some(S,P) Some whales are breast-feeders

Note that it does not matter in which order Premise 1 and Premise 2 come. Both of them are assertions that must be true simultaneously, so the order does not matter.

Here is a complete list of the twenty four Aristotelian syllogisms:

  • 1st figure: barbara, celarent, darii, ferio, barbarix, feraxo.
  • 2nd figure: cesare, camestres, festino, baroco, camestrop, cesarox.
  • 3rd figure: darapti, disamis, datisi, felapton, bocardo, ferison.
  • 4th figure: bramantip, camenes, dimaris, fesapo, fresison, camenop.

The beginning of a Prolog program to solve syllogisms

Here is the beginning of a Prolog program to deduct using syllogisms:

syll(   all(M,P), 
// This is barbara in the 1st figure.

syll(   no(M,P),
// This is celarent in the 1st figure.

syll(   all(M,P),
// This is darii in the 1st figure.

syll(   no(M,P),
// This is ferio in the 1st figure.

deduction(P1,P2,C):- syll(P1,P2,C).
deduction(P1,P2,C):- syll(P2,P1,C).

Copy-paste this into a new Prolog document (first fire up the Prolog system, then remember to press the 'New' button on the toolbar, or choose 'New' from the 'File' menu).

This can be used as follows:

?- deduction(all(mammals, breast_feeders), some(whales, mammals), C).
{C = some(whales, breast_feeders)}
{C = some(breast_feeders, whales)}

Or, with another example:

?- deduction(no(rhino, wall_paper_eater), some(Otto, rhino), C).
{C = some_not(Otto, wall_paper_eater)}

Your task

Your task is to add the rest of the syllogisms. Start with barbarix in the 1st figure and work your way down the list above.

Then use the program to solve the following syllogisms:

  • Some dogs are not cat-haters
  • All dogs are mammals
  • Therefore: ?
  • All dogs are canines
  • All canines are mammals
  • Therefore: ?
  • All dogs are dependent on people
  • No cats are dependent on people
  • Therefore: ?
  • Some bears are animals of very little brain
  • All animals of very little brain are humble
  • Therefore: ?


Click to see an answer.

Prev: 21 Syllogisms
Up: 21 Syllogisms
Next: 22 A Murder Mystery