Presentation is loading. Please wait.

Presentation is loading. Please wait.

Conditionals in Computational Logic Bob Kowalski Imperial College London with acknowledgements to Fariba Sadri Keith Stenning Michiel van Lambalgen.

Similar presentations


Presentation on theme: "Conditionals in Computational Logic Bob Kowalski Imperial College London with acknowledgements to Fariba Sadri Keith Stenning Michiel van Lambalgen."— Presentation transcript:

1 Conditionals in Computational Logic Bob Kowalski Imperial College London with acknowledgements to Fariba Sadri Keith Stenning Michiel van Lambalgen

2 Outline Production systems as a cognitive model Logic programming as a computational model Abductive logic programming (ALP) combines descriptive and deontic reasoning ALP agents combine logic programming and production systems Yet another explanation of the Wason Selection Task

3 Production systems Production systems combine declarative memory consisting of atomic sentences, and procedures consisting of condition-action rules: If conditions C, then actions A. look like logical implications, but do not have a logical semantics. Production system cycle: –read a current input, –use forward chaining (from conditions to actions) to match the input against the conditions C of production rules, –perform conflict-resolution to choose a single rule if the conditions C of more than one rule are all satisfied, and –execute the associated actions A.

4 Three kinds of production rules 1.Reactive rules that implement a generalisation of stimulus- response associations. 2.Logical rules that are used to reason forward (modus ponens). 3.Pro-active rules that simulate goal-reduction: If goal G and conditions C then add H as a sub-goal. Production rules have an operational, but not a logical semantics.

5 The relationship between logic and production rules. Thagard (Mind, an Introduction to Cognitive Science) claims (page 45) that the following production rule cannot be represented in logic: If you want to go home for the weekend, and you have the bus fare, then you can catch a bus.

6 Logic programming Logic programs are sets of logical implications: If B1 and … and Bn then H In Horn clause logic programming, B1 and … and Bn and H are restricted to atomic formulae. In normal logic programming, the conditions B1 and … and Bn can be negations of atomic formulae. Negation in conditions makes normal logic programming a simple kind of non-monotonic logic.

7 Inference in logic programming All inference is backward reasoning, using implications: If B1 and … and Bn then H as goal-reduction procedures: to show H by showing B1 and … and Bn. Because implications are used only backwards, they are normally written backwards: H if B1 & … & Bn. or H :- B1,…, Bn (in Prolog notation)

8 Logic Programming – two classes of semantics Logic programs can be understood in two ways:  at the object level, interpreting all the clauses with a given predicate P in the conclusion as the definition of P and rewriting the definition in if-and-only-if form. E.g. the clauses: 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, understanding all the clauses with P in the conclusion as the only clauses that conclude P.

9 Negation as Failure in logic programming – two classes of semantics 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. The two semantics are equivalent in most cases.

10 Inference with logic programs A typical goal has the form: B1 and … and Bn ? where Bi are atomic formulae or their negation. Goals of the form: if B1 and … and Bn then C ? can be rewritten: not D ? D if B1 and … and Bn and not C and solved using negation as failure.

11 The relationship between logic programs and production rules (van Lambalgen and Stenning) Forward chaining with production rules: If you want to go home for the weekend, and you have the bus fare, then you can catch a bus. behaves identically to backward reasoning with logical implications: If you have the bus fare, and you catch a bus, then you can go home for the weekend.

12 Forward chaining with pro-active rules –is ad-hoc and potentially incomplete –makes it hard to distinguish conjoint and disjoint sub-goals. Production rules have an operational, but not a logical semantics. Abductive logic programming (ALP) gives a logical semantics to production systems.

13 ALP can be viewed in Deductive Database terms Database rules define data. E.g. The bus leaves at 9:00. The bus leaves at 10:00. The bus leaves at X:00 if X is an integer & 9 ≤ X ≤ 18. Integrity constraint rules prevent unwanted updates. E.g. There is no bus before 9:00. If the bus leaves at X:00, then it arrives at its destination at X:Y & 20 ≤ Y ≤ 30.

14 Abductive Logic Programming (ALP) Abductive Logic Programs have three components:  P is a normal logic program.  A is a set of abducible predicates.  IC, the set of integrity constraints, is a set of first-order sentences. Often, they are expressed as denials of the form: not (A1 &...& An & not B1 &...& not Bm)

15 Example Integrity constraint: If there is an emergency, then you get help Program: there is an emergency if there is a fire you get help if you alert the driver you alert the driver if you press the alarm signal button Abducible predicates there is a fire and you press the alarm signal button

16 ALP as the thinking component of an intelligent agent observe act Agent Perceptual processing Motor processing The world think decide

17 The world If there is an emergency then get help There is an emergency ALP combines forward and backward reasoning observe act Forward reasoning Backward reasoning get help press the alarm signal button There is a fire alert the driver The World

18 Hypothesis: ALP solves the Wason Selection Task The task has the abstract form: Given some data/observations and an implication If A then B determine whether the data/observations satisfy the implication. To solve the task: Determine whether the implication is a program implication or an integrity constraint implication. –The form of the task suggests it is an integrity constraint. –But the content of the implication may suggest it is a program implication. If the implication is interpreted as an integrity constraint, then check that not(A and not B) holds. If the implication is interpreted as a program implication, then interpret the implication as A iff B.

19 Conclusions ALP  combines backward and forward reasoning  combines descriptive and deontic reasoning  gives a logical semantics to production rules ALP agents  embed ALP as the thinking component of an intelligent agent interacting with an external environment  provide a rational reconstruction of production systems

20

21

22

23

24

25

26

27 ALP – One class of Proof Procedures Use backwards reasoning to find Δ such that P  Δ  G. Use forward reasoning to show that P  Δ  IC. ALP gives a logical semantics to production rules:  Backward reasoning using clauses in P behaves like forward chaining with pro-active rules in production systems.  Forward reasoning using clauses in P behaves like forward reasoning with logical rules in production systems.  Forward reasoning using implications in IC behaves like forward reasoning with reactive rules in production systems.

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

29 ALP – completion semantics Let P be a conjunction of definitions in iff-form Let IC be a conjunction of integrity constraints in if-then form. Let G be a conjunction of positive and negative observations or goals.  is an answer iff  is a conjunction of ground literals (atoms or the negations* of atoms) in the abducible predicates such that P &  |= IC P &  |= G  is consistent. Note: Both IC and G can be regarded as goals: IC is the set of persistent goals. G is the set of transient goals. * Negative literals not p are written as denials if p then false.

30 Event Condition Action (ECA) Rules wikipedia 1 Aug 2007 “ECA is a short-cut for referring to the structure of active rules in event driven architecture and database systems. Such a rule consists of three parts:active rulesevent driven architecturedatabase The event part specifies the signal that triggers the invocation of the rule The condition part is a logical test that, if satisfied or evaluates to true, causes the action to be carried out The action part consists of updates or invocations on the local data.” ECA rules have an operational, but not a logical, semantics. Integrity constraints in ALP agents give a logical semantics to ECA rules.

31 ALP –iff proof procedure Backward reasoning uses iff-definitions to reduce atomic goals (and observations) to disjunctions of conjunctions of sub-goals. The search space is represented by a logical formula, e. g. [do(drop-out, T) & do(take-drugs, T)] or [do(study-hard, T) & do(get-good-job, T’) & do(get-rich, T’’) & T<T’<T’’] Each disjunct represents a branch of a prolog-like search space.

32 ALP –iff proof procedure Forward reasoning matches an observation or atomic goal p with a condition of an implication (IC)if p & q then r to derive the new implication if q then r. q can be reduced to subgoals by backward reasoning or can also be verified by forward reasoning. r is added as a new goal (after p & q have been verified). r can then trigger forward reasoning or can be reduced to sub-goals. r is (in general) a disjunction of conjunctions of sub-goals.

33 ALP –iff proof procedure Splitting uses distributivity to replace a formula of the form (D or D') & G by (D & G) or (D'& G) Logical equivalences replace a sub-formula by another formula which is both logically equivalent and simpler. These include the following equivalences used as rewrite rules: G & true iff GG & false iff false D or true iff trueD or false iff D. [if true then D] iff D[if false then D] iff true Factoring “unifies two atomic subgoals P(t) & P(s) replacing them by the equivalent formula [P(t) & s=t] or [P(t) & P(s) & s  t]

34 Committed choice In production systems, if several actions are candidates for selection, then the system needs to make a committed choice, from which there is no backtracking. For example, if both of the following rules apply: If it’s raining, then carry an umbrella. If a car is rushing towards you, then jump out of its way. then the second rule should take priority over the first. Although there is no backtracking, if a candidate action is not selected in one cycle, it may be possible to select it in a later cycle. So, if it is raining, and there is a car rushing towards you, and you succeed in jumping out of the way, then you can put up your umbrella afterwards, if it’s still raining.

35 Example Program: X citizen if X born in USA. X citizen if X born outside USA & X resident of USA & X naturalised. X citizen if X born outside USA & Y is mother of X & is Y citizen & X registered. Mary is mother of John. Mary is citizen. Abducible predicates: X born in USA, X born outside USA, X resident of USA, X naturalised, X registered Integrity constraint: if John resident of USA then false. Goal: John citizen Two abductive solutions: John born in USA, John born outside USA & John registered

36 Committed choice In a production system, if several actions are candidates for selection, then the system needs to make a committed choice, from which there is no backtracking. For example, if both of the following rules apply: If it’s raining, then carry an umbrella. If a car is rushing towards you, then jump out of its way. then the second rule should take priority over the first.

37 Logic programming Backwards reasoning (from conclusion to conditions) treats logical implications: If B1 and … and Bn then H as goal-reduction procedures: to show/solve H, show/solve B1 and … and Bn. Because implications are used only backwards, they are normally written backwards: H if B1 & … & Bn. or H :- B1,…, Bn.

38 ALP –semantics The program P defines the non-abducible predicates. The abducible predicates A specify possible extensions Δ of P, where Δ is a set of positive (and sometimes also negative) ground instances of the predicates A. The integrity constraints IC specify general properties that must hold of P  Δ. Given a problem, G, which expresses either an observation that needs to be explained or a goal that is desired, an abductive explanation (or solution) of G is an extension Δ of P, such that  P  Δ |= G  P  Δ |= IC  Δ is consistent (in the case Δ contains positive and negative literals) Here |= can be interpreted in different ways, according to different semantics for logic programming.

39 ALP Example Program: Grass is wet if it rained. Grass is wet if the sprinkler was on. The sun was shining. Abducible predicates:it rained, the sprinkler was on Integrity constraint: not (it rained and the sun was shining) Observation:Grass is wet Two potential explanations: it rained, the sprinkler was on The only explanation that satisfies the integrity constraint i the sprinkler was on.

40 Computational Logic explains performance on the Wason selection task If there is a vowel on one side, then there is an even number on the other side. Interpretation as a logic program inhibits the contrapositive: If it is not the case that there is an even number on one side, then it is not the case that there is a vowel on the other side. Interpretation of if as if-and-only-if justifies the converse: If there is an even number on one side, then there is a vowel on the other side.


Download ppt "Conditionals in Computational Logic Bob Kowalski Imperial College London with acknowledgements to Fariba Sadri Keith Stenning Michiel van Lambalgen."

Similar presentations


Ads by Google