logic programming combining declarative and procedural representations: emergencies on the london...

20
Logic programming Combining declarative and procedural representations: Emergencies on the London Underground Logic programming for proactive rather than reactive behaviour: The fox and the crow Two classes of semantics: if-and-only-if versus minimal model semantics Logic programs for representing “strong” versus “weak” knowledge

Upload: kelley-goodwin

Post on 17-Dec-2015

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Logic programming

Combining declarative and procedural representations:Emergencies on the London Underground

Logic programming for proactive rather than reactive behaviour: The fox and the crow

Two classes of semantics: if-and-only-if versus minimal model semantics

Logic programs for representing “strong”versus “weak” knowledge

Page 2: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Logic needs to be put in its place:In the thinking component of an agent cycle

observeact

An agent

Perceptual

processing

Motorprocessin

g

The world

think decide

Page 3: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Logic needs to be put in its place:

in the thinking component of the agent cycle:

To cycle,observe the world,think,decide what actions to perform,act,cycle again.

Logic and logic programming are one way of thinking.

Production systems are another way of thinking.Decision theory is one way of deciding what to do.

Page 4: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

What to do in an emergency

Emergencies Press the alarm signal buttonto alert the driver.

The driver will stop if any part of the train is in a station.

If not, the train will continue to the next station,where help can more easily be given.

There is a 50 pound penalty for improper use.

Page 5: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The London Underground Emergency Notice as a program

Press the alarm signal buttonto alert the driver.

This has the form of a goal-reduction procedure:

Reduce the goal of alerting the driver to the sub-goal of pressing the alarm signal button.

Page 6: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The first sentence of the Emergency Notice as a Logic Program

In general, a goal-reduction procedure of the form:

Reduce goal to sub-goalshides a logical implication:

Goal if sub-goals.

The goal-reduction behaviour can be obtained by backward reasoning:

To conclude that the goal can be solved, show that the sub-goals can be solved.

The first sentence of the Emergency Notice has the hidden logical form:

You alert the driver,if you press the alarm signal button.

Page 7: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The second and third sentences of the Emergency Notice in logic programming form

The driver will stop the train in a stationif the driver is alerted to an emergencyand any part of the train is in the station.

The driver will stop the train at the next stationand help can be given there better than between stationsif the driver is alerted to an emergencyand not any part of the train is in a station. 

Page 8: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The fourth sentence of the Emergency Notice

The last sentence of the Notice has the underlying logic programming form:

You get a 50 pound penalty if you press the alarm signal button improperly.

Backwards reasoning turns this into a goal-reduction procedure:

To get a 50 pound penalty,press the alarm signal button improperly.

Forward reasoning in abductive logic programming turns this into an inference to monitor the generation of a candidate action, to evaluate its possible consequences.

Page 9: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Goal The fox has cheese.Beliefs

The crow has cheese.

An animal has an objectif the animal is near the objectand the animal picks up the object.

The fox is near cheese if the crow sings. The crow sings if the fox praises the crow.

?

Page 10: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The fox’s beliefs as goal-reduction procedures

To have an object,be near the objectand pick up the object.

To be near the cheese,make the crow sing.

To make the crow sing,praise the crow.

To show that the crow has the cheese,do nothing.

Page 11: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

I have the cheese.

I am near the cheese. I pick up the

cheese.

The crow sings.

I praise the crow.

In general, the search space for backward reasoning with logic programscan be represented as an and-or tree or graph.

Page 12: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

I have the cheese.

I am near the cheese and I pick up the cheese

The crow has the cheese and the crow sings and I pick up the

cheese

The crow sings and I pick up the cheese

I praise the crow and I pick up the cheese

The fox

The world

The fox reasons proactively

Page 13: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The fox praises me.

I sing

The crow

Perceptualprocessing

Motorprocessing

The world

If an animal praises me, then I sing.

The crow behaves reactively

Page 14: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The moral of the story:Think before you act (pre-actively, lecture 3)

If the crow knew what the fox knowsand the crow could reason pre-actively, then the crow would be able to reason as follows:

I want to sing. But if I sing, then the fox will be near the cheese.

Perhaps the fox will pick up the cheese.Then the fox will have the cheese.Then I will not have the cheese.

Since I want to have the cheese, I will not sing.

Page 15: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Logic Programming – two classes of semantics

At the object level, all the clauses with a given predicate P in the conclusion are interpreted as the definition of P, e.g.

you get help if you press the alarm signal button.you get help if you shout loudly.

are interpreted as:

you get help if and only if you press the alarm signal button or you shout loudly.

At the meta-level, the set of clauses with P in the conclusion are interpreted as the only clauses that conclude P.

A set of Horn clauses “defines” a minimal model. E.g. the natural numbers are the smallest set N such that0 is in NX + 1 is in N if X is in N

Page 16: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Negation as Failure can be understood in two ways

At the object level, not P holds iff the definition of P in if-and-only-if form implies not P

At the meta-level, not P holds iff it is not possible to conclude P, using the uncompleted program. not P means P is not believed (as in auto-epistemic logic)

The two semantics are equivalent in most cases.

Page 17: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Negation in logic programming – two classes of proof procedures

– At the object level, show not P by using the definition of P in if-and-only-if form. (This is the basis for the IFF proof procedure for abductive logic programming, Fung-Kowalski 1997, based on Console-Torasso 1991 and Denecker-De Schreye 1992.)

– At the meta-level, show not P by showing it is not possible to conclude P, using the uncompleted program.

The relationship between object level and meta-level here is like the relationship between the first-order axioms of Peano arithmetic (without induction) and the intended model of arithmetic.

Page 18: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

Logical problem-solving methods are weak and general-purpose. Oaksford, M. & Chater, N. (2002). Commonsense reasoning, logic and human rationality.

Page 19: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

But logic and logic programming can be used to represent strong, domain-specific knowledge.

Examples– Planning from second principles, using plan schemata,

rather than planning from first principles– Quicksort rather than ordered permutation– Theorems rather than axioms

But in some domains only weak knowledge may be available– Database queries– Combinatorial problem-solving– Inductive logic programming

Page 20: Logic programming  Combining declarative and procedural representations: Emergencies on the London Underground  Logic programming for proactive rather

The logic programming view of the relationship between an agent and the world

Goals

Backward reasoning

Intermediate level sub-goals

Backward reasoningActions

?

The world