KR-IST: Lecture 7b First-order Logic

Chris Thornton


From reasoning to knowledge representation

With any set of implication rules (e.g., the celebrity rulebase), search-like processes can be used to determine implied facts and conclusions.

The combination of rulebase and inference method can be viewed as a representation of knowledge for the domain, i.e., a knowledge base (KB).

A system which packages up knowledge represented this way is a knowledge-based or expert system.

From knowledge representation to logic

Rule-based methods of knowledge representation are also known as logics.

With a history stretching back 2000 years, the study of logic and formal reasoning was a kind of pre-computation AI.

AI methods of knowledge representation (KR) are generally based on adapted systems of formal logic.

What is a logic?

A logic is a formal language for representing facts and properties of a world in a precise, unambiguous way.

Propositional logic

The simplest logic of all.

Allows facts about the world to be represented as sentences formed from:

Propositional logic examples

Truth tables

The meaning of logical relationships is defined using truth tables.

A truth table shows how truth values combine under the relevant relationship.

Basic rules of inference

The two main rules of inference are

P Q
P
Q

P Q
Q
P

Soundness and completeness

In logic, sentences have a value.

This is normally a truth value, i.e., true or false.

The associated inference method is then said to be

Semantics

A semantics maps sentences to facts in the world; e.g., the mapping determines which objects in the world are referenced by which objects in the language. This is called a referential semantics.

The way one fact follows another should be mirrored by the way one sentence is entailed by another.

Problems with propositional logic

In Propositional logic, we have no way to represent properties of objects.

We cannot represent property-based generalisations.

For example, it is impossible to represent this categorical syllogism in Propositional logic:

Every person is mortal
Tony Blair is a person
Therefore Tony Blair is mortal

First-order logic

First-order logic (FOL) (also known as first-order predicate calculus or FOPC) adds

Using predicates to represent relationships

In order to represent a relationship between individual objects, we can use a predicate specifying the objects as its arguments.

Using predicates within a rule

Using variables with predicates to capture generalisations

We can capture generalisations by asserting that any instance of a given class has the relevant property. For example

Using quantifiers and variables

We can use quantification to distinguish general and specific assertion.

More examples

Usually, there are several ways to render a sentence in FOL. There's no `one right answer'.

Consider these

Examples cont.

Problems with FOL

FOL is a powerful language for representing knowledge.

But its expressiveness complicates the derivation of inferences. (It gets easier if we exliminate existential quantification and assume `negation by failure'.)

Also, in FOL you cannot construct sentences which make assertions about other sentences. For example, you cannot say things like `there exists a property such that...'

For this task, you need a higher-order logic.

Special-purpose logics

Other flavours of logic offer different forms of sentence valuation.

For example

The Frame problem

A fundamental difficulty for sentential representation is the frame problem.

This affects all varieties of knowledge representation but is particularly apparent where evaluation is in terms of truth, and rules are used to define the results of actions.

Frame problem example

Suppose we have

paint(X, C) color(X, C)
move(X, P) position(X, P)

and it is known that

paint(tony, blue).
move(tony, garden).

We should then be able to infer that

colour(tony, blue) position(tony, garden)

But the inference is, in fact, logically unsound

There is the possibility that the colour of tony gets changed by the move action.

Nothing in what we know rules this out.

Addressing the frame problem

The most obvious way to protect against the frame problem is to add rules which capture the non-effects of actions.

Such rules are known as frame axioms.

For example

move(X, P) color-before-move(X, C) color(X, C).

asserts the fact that moving an object will not affect its colour.

However, this is not satisfactory.

Since most actions do not affect most properties of a situation, in a domain comprising actions and properties, we are going to need approximately frame axioms.

The Epistemological Frame Problem

The underlying puzzle is how a cognitive creature with many beliefs about the world can update those beliefs when it performs an act so that they remain roughly faithful to the word.

Imagine being the designer of a robot that has to carry out an everyday task, such as making a cup of tea. Now, suppose the robot has to take a tea-cup from the cupboard. The present location of the cup is represented as a sentence in its database of facts alongside those representing innumerable other features of the ongoing situation, such as the ambient temperature, the configuration of its arms, the current date, the colour of the tea-pot, and so on. Having grasped the cup and withdrawn it from the cupboard, the robot needs to update this database. The location of the cup has clearly changed, so that's one fact that demands revision. But which other sentences require modification?

Summary

Questions

Exercises

Exercises cont.

Every knowledge representation is formal
Propositional logic is a knowledge representation
Therefore propositional logic is formal

Exercises cont.

There is a house in New Orleans
They call the Rising Sun
And it's been the ruin of many a poor boy
And God I know I'm one
My mother was a tailor
She sewed my new bluejeans
My father was a gamblin' man
Down in New Orleans
Now the only thing a gambler needs
Is a suitcase and trunk
And the only time he's satisfied
Is when he's on a drunk

Exercises cont.

To be considered for the best mortgage deals during the current
difficult conditions, you must borrow substantially less than the
full purchase price, have a perfect credit record and be able to
act fast.
Only people who have built up savings over
several years and have shown their ability to live on less than
their salary are able to get a mortgage.
It is first-time buyers who are hardest hit by the need to stump up
a bigger deposit in order to get the choice of the best deals.

Exercises cont.

When a man loves a woman
Can't keep his mind on nothing else
He'll trade the world
For the good things he's found
If she's bad, he can't see it
She can do no wrong
Turn his back on his best friend
If he put her down
When a man loves a woman
Spend his very last time
Tryin' to hold on to what he needs
He'd give up all his comfort
Sleep out in the rain
If she says that's the way it ought to be