The following exercises demonstrate that different kinds of information can be represented in the same way, and that methods devised for handling one can be transferred to the others. In particular, they emphasise the way in which methods of representing ``spatial'' things like maps and networks can be used for more abstract kinds of data. This is worth knowing, because we are very good at visualising things laid out in space, and it will help greatly if we can learn to visualise other problems in the same way.
The caves world uses facts like
is_a( a, cave ). is_a( b, cave ).to identify caves, and
to describe their connections.
Here are three more sets of facts, each representing a different kind
of knowledge. Compare them with the clauses for is_a
and
meets
.
is_a( budget_needs_more_money , event ). is_a( exports_decrease , event ). is_a( production_decreases , event ). is_a( workers_incentives_decrease, event ). is_a( real_wages_decrease , event ). is_a( tax_increases , event ). is_a( exports_decrease , event ). causes( budget_needs_more_money , tax_increases ). causes( budget_needs_more_money , real_wages_decrease ). causes( tax_increases , workers_incentives_decrease ). causes( real_wages_decrease , workers_incentives_decrease ). causes( workers_incentives_decrease, production_decreases ). causes( production_decreases , exports_decrease ). causes( exports_decreasecauses , budget_needs_more_money ).
is_a( composite , class ). is_a( dicotelydon , class ). is_a( flowering_plant , class ). is_a( plant , class ). is_a( life , class ). is_a( animal , class ). is_a( vertebrates , class ). is_a( fish , class ). is_a( bony_fish , class ). is_a( daisy , class ). is_a( crucifer , class ). is_a( monocotelydon , class ). is_a( mammal , class ). is_a( cartilaginous_fish, class ). is_a( shark , class ). includes( bony_fish , shark ). includes( fish , bony_fish ). includes( fish , cartilaginous_fish ). includes( cartilaginous_fish, herring ). includes( vertebrates , fish ). includes( vertebrates , mammal ). includes( animal , vertebrates ). includes( living_thing , animal ). includes( living_thing , plant ). includes( plant , flowering_plant ). includes( flowering_plant , dicotelydon ). includes( flowering_plant , monocotelydon ). includes( dicotelydon , composite ). includes( dicotelydon , crucifer ). includes( composite , daisy ). includes( composite , dandelion ). includes( crucifer , wallflower ).
is_a( bbbbxbbbb, position ). is_a( obbbxbbbb, position ). is_a( bobbxbbbb, position ). is_a( xobbxbbbb, position ). is_a( oxbbxbbbb, position ). is_a( xobbxbbbx, position ). is_a( xobbxbobb, position ). o_moves_to( bbbbxbbbb, obbbxbbbb ). o_moves_to( bbbbxbbbb, bobbxbbbb ). x_moves_to( bobbxbbbb, xobbxbbbb ). x_moves_to( obbbxbbbb, oxbbxbbbb ). o_moves_to( xobbxbbbb, xobbxbbob ). x_moves_to( xobbxbbob, xobbxbbbx ).
The first example describes a small portion of what economists call macro-economics: the relations between inflation, unemployment, etc. The relations are not at all esoteric, in fact they are taken from There's a Hole in My Budget by Flanders and Swann, in which there is a ``dialogue between the Prime Minister and Chancellor, who wander round the room in a slow inflationary spiral''. The same form could be used to describe other economies, as well as numerous non-economic phenomena (I have such a translation of The Gasman Cometh if anyone wants it.)
The second example classifies living things.
The third example shows a subset of the possible moves and board
states in the game of noughts and crosses - note that if extended to
be complete, it would show all possible moves, not just those in one
particular game. Board states are represented as names made up of the
latters b
for an empty square, x
for an X, and o
for an O. This
representation is not very wieldy - later, you will
learn better ways to
represent such things. In fact, lists, mentioned in Supplement 6
in connection with route-finding, would be ideal for this purpose.