1 / 20

Logic programming

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

reece
Download Presentation

Logic programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. Logic needs to be put in its place: In the thinking component of an agent cycle An agent think decide observe act Motor processing Perceptual processing The world

  3. Logicneeds 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.

  4. What to do in an emergency • Emergencies • Press the alarm signal button • to 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.

  5. The London Underground Emergency Notice as a program • Press the alarm signal button • to 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.

  6. The first sentence of the Emergency Notice as a Logic Program • In general, a goal-reduction procedureof the form: • Reduce goal to sub-goals • hides 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.

  7. The second and third sentences of the Emergency Notice in logic programming form • The driver will stop the train in a station • if the driver is alerted to an emergency • and any part of the train is in the station. • The driver will stop the train at the next station • and help can be given there better than between stations • if the driver is alerted to an emergency • and not any part of the train is in a station.

  8. 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.

  9. ? GoalThe fox has cheese. Beliefs The crow has cheese. An animal has an object ifthe animal is near the object and the animal picks up the object. The fox is near cheeseif the crow sings. The crow singsif the fox praises the crow.

  10. The fox’s beliefs as goal-reduction procedures • To have an object, • be near the object • and 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.

  11. In general, the search space for backward reasoning with logic programs can be represented as an and-or tree or graph. • I have the cheese. • I am near the cheese. • I pick up the cheese. • The crow sings. • I praise the crow.

  12. The fox reasons proactively The fox 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 world

  13. The crow behaves reactively The crow If an animal praises me, then I sing. The fox praises me. I sing Motor processing Perceptual processing The world

  14. The moral of the story:Think before you act (pre-actively, lecture 3) • If the crow knew what the fox knows • and 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. • Perhapsthe 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.

  15. 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 helpif and only ifyou press the alarm signal button • oryou 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 that 0 is in N X + 1 is in N if X is in N

  16. Negation as Failure can be understood in two ways At the object level, not P holds iff the definition of Pin 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 Pmeans P is not believed (as in auto-epistemic logic) The two semantics are equivalent in most cases.

  17. 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.

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

  19. 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

  20. The logic programming view of the relationship between an agent and the world • Goals • Backward reasoning • Intermediate level sub-goals • Backward reasoning • Actions • ? • The world

More Related