modeling the dynamics of knowledge · 2012-05-09 · illustrate this with the wumpus world and...

335
Modeling the Dynamics of Knowledge Jürgen Dix and Wojtek Jamroga Department of Computer Science Clausthal University of Technology, Germany ESSLLI (Dublin 2007) Jürgen Dix and Wojtek Jamroga ESSLLI (Dublin 2007) 1/335

Upload: others

Post on 18-Feb-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

Modeling the Dynamics ofKnowledge

Jürgen Dix and Wojtek Jamroga

Department of Computer ScienceClausthal University of Technology, Germany

ESSLLI(Dublin 2007)

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 1/335

Page 2: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

Lecture Overview

Lecture 1: Chapter 1: Basics about Knowledge.Lecture 2: Chapter 2: Answer Set Programming.Lecture 3: Chapter 3: Modal Logic.

Chapter 4: Logics of Action and Time.Lecture 4: Chapter 5: Combining Knowledge

and Time.Chapter 6: Knowledge in Flux.

Lecture 5: Chapter 7: Modalities in Action.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 2/335

Page 3: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic

Chapter 1. Basics about Logic

Basics about Logic1.1 Why Logic?1.2 Sentential Logic1.3 Examples1.4 Calculi1.5 First-Order Logic (FOL)1.6 Logic Programming1.7 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 3/335

Page 4: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic

We make the case for using logics as a representationformalism for reasoning about the world.While almost everything can be done with logic, theformalization is often awkward and cumbersome. Weillustrate this with theWumpus world andSudoku-puzzles.We introduce two sorts of calculi for propositionallogics: a Hilbert type and a resolution calculus.We introduce first-order logic (FOL) and reconsider theWumpus world. The dynamics of the changing worldcan be modeled with the terms: they enable us toexplicitly denote the situation we are in and to reasonabout it: McCarthy's situation calculus.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 4/335

Page 5: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic

One of the main features is to ask queries of the formDφpxq to a theory T . We expect not just a “yes/no”answer, but an instantiation of the variable x. Thiscan be achieved with the resolution calculus for FOL.While resolution is much more efficientlyimplementable (compared to Hilbert-type calculi), thesearch space is still huge. Thus it was suggested torestrict resolution and apply it to a smaller class offormulae: Horn clauses.This leads to PROLOG as an efficient inference enginefor definite logic programs. However, fulldeclarativeness is lost and PROLOG is not (yet) theanswer: emphasis is put on computing answersubstitutions.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 5/335

Page 6: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 1. Why Logic?

1.1 Why Logic?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 6/335

Page 7: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 1. Why Logic?

Why logic at all?

framework for thinking about systems,makes one realisemany assumptions,. . . and then we can:investigate them, accept or reject them,relax some of them and still use a part of theformal and conceptual machinery,

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 7/335

Page 8: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 1. Why Logic?

Why logic at all?

verification: check specification againstimplementation,executable specification,

planning as model checking

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 8/335

Page 9: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 1. Why Logic?

Symbolic AI: Symbolic representation,e.g. sentential or first order logic.Agent as a theorem prover.

Traditional: Theory about agents.Implementation as stepwise process(Software Engineering) over manyabstractions.

Symbolic AI: View the theory itself asexecutable specification.Internal state: Knowledge Base (KB),often simply called D (database).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 9/335

Page 10: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

1.2 Sentential Logic

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 10/335

Page 11: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.1 (Sentential Logic LSL, Language L � LSL)

The language LSL of propositional (or sentential) logicconsists of

l and J: the constants falsum and verum,p,q,r,x1,x2, . . .xn, . . .: a countable set AT ofSL-constants, , ^, _,Ñ: the sentential connectives ( is unary, allothers are binary operators),p, q: the parentheses to help readability.

In most cases we consider only a finite set of SL-constants.They define a language L � LSL. The set of L-formulaeFmlL is defined inductively.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 11/335

Page 12: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.2 (Semantics, Valuation, Model)

A valuation v for a language L � LSL is a mapping fromthe set of SL-constants defined by L into the setttrue, falseu with vplq � false, vpJq � true.Each valuation v can be uniquely extended to a functionv̄ : FmlL Ñ ttrue, falseu so that:

v̄p pq �"

true, if v̄ppq � false,false, if v̄ppq � true.

v̄pϕ^ γq �

"true, if v̄pϕq � true and v̄pγq � true,false, else

v̄pϕ_ γq �

"true, if v̄pϕq � true or v̄pγq � true,false, else

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 12/335

Page 13: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition (continued)v̄pϕÑ γq �"

true, if v̄pϕq � false or (v̄pϕq � true and v̄pγq � trueq,false, else

Thus each valuation v uniquely defines a v̄. We call v̄L-structure.A structure determines for each formula if it is true or false.If a formula φ is true in structure v̄ we also say Av is amodel of φ. From now on we will speak of models,structures and valuations synonymously.

SemanticsThe process of mapping a set of L-formulae intottrue, falseu is called semantics.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 13/335

Page 14: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.3 (Validity of a Formula, Tautology)

1 A formula ϕ P FmlL holds under thevaluation v if v̄pϕq � true. We also write v̄ |ù ϕ

or simply v |ù ϕ. v̄ is a model of ϕ.2 A theory is a set of formulae: T � FmlL . vsatisfies T if v̄pϕq � true for all ϕ� T . We writev |ù T .

3 A L-formula ϕ is called L-tautology if for allpossible valuations v in L v |ù ϕ holds.

From now on we suppress the language L, because it isobvious from context. Nevertheless it needs to be carefullydefined.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 14/335

Page 15: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.4 (Consequence Set CnpT q)

A formula ϕ follows from T if for all models v ofT (i.e. v |ù T ) also v |ù ϕ holds. We write: T |ù ϕ.We call

CnLpT q �def tϕ P FmlL : T |ù ϕu,

or simply CnpT q, the semantic consequenceoperator.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 15/335

Page 16: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Lemma 1.5 (Properties of CnpT q)The semantic consequence operator has the followingproperties:1 T -expansion: T �CnpT q,2 Monotony: T � T 1 ñ CnpT q �CnpT 1q,3 Closure: CnpCnpT qq �CnpT q.

Lemma 1.6 (ϕ R Cn(T))ϕ RCnpT q if and only if there is a model v with

v |ù T and v̄pϕq � false.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 16/335

Page 17: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.7 (MOD(T), CnpUq)

If T � FmlL then we denote withMODpT q the set of allL-structures A which are models of T :

MODpT q �def tA : A |ù Tu.

If U is a set of models, we consider all those sentences,which are valid in all models of U. We call this set CnpUq:

CnpUq �def tϕ P FmlL : @v PU : v̄pϕq � trueu.

MOD is obviously dual to Cn:

CnpMODpT qq �CnpT q, MODpCnpT qq �MODpT q.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 17/335

Page 18: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.8 (Completeness of a Theory T )

T is called complete if for each formula ϕ P Fml: T |ù ϕ orT |ù ϕ holds.

Attention:Do not mix up this last condition with the property of avaluation (model) v: each model is complete in theabove sense.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 18/335

Page 19: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 2. Sentential Logic

Definition 1.9 (Consistency of a Theory)

T is called consistent if there is a valuation (model) v withv̄pϕq � true for all ϕ P T .

Lemma 1.10 (Ex Falso Quodlibet)T is consistent if and only if CnpT q � FmlL .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 19/335

Page 20: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

1.3 Examples

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 20/335

Page 21: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Wumpus World

Breeze Breeze

Breeze

BreezeBreeze

Stench

Stench

BreezePIT

PIT

PIT

1 2 3 4

1

2

3

4

START

Gold�

Stench

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 21/335

Page 22: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

A�

B�

G

P�

S

W�

= Agent = Breeze = Glitter, Gold

= Pit = Stench

= Wumpus

OK = Safe square

V�

= Visited

A�

OK

1,1 2,1 3,1 4,1

1,2 2,2 3,2 4,2

1,3 2,3 3,3 4,3

1,4 2,4 3,4 4,4

OKOKB

P?�

P?�

A�

OK OK

OK

1,1 2,1 3,1 4,1

1,2 2,2 3,2 4,2

1,3 2,3 3,3 4,3

1,4 2,4 3,4 4,4

V�

(a)�

(b)�

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 22/335

Page 23: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

B�

B�

P!�

A�

OK OK

OK

1,1 2,1 3,1 4,1

1,2 2,2 3,2 4,2

1,3 2,3 3,3 4,3

1,4 2,4 3,4 4,4

V�

OK

W!�

V�

P!�

A�

OK OK

OK

1,1 2,1 3,1 4,1

1,2 2,2 3,2 4,2

1,3 2,3 3,3 4,3

1,4 2,4 3,4 4,4

V�

S

OK

W!�

V�

V�

V�

B�

S G

P?�

P?�

(b)(a)�

S

A�

B�

G

P�

S

W�

= Agent = Breeze = Glitter, Gold

= Pit = Stench

= Wumpus

OK = Safe square

V�

= Visited

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 23/335

Page 24: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Language definition:Si, j stenchBi, j breezePiti, j is a pitGli, j glittersWi, j contains Wumpus

General knowledge: S1,1 ÝÑ p W1,1^ W1,2^ W2,1q S2,1 ÝÑ p W1,1^ W2,1^ W2,2^ W3,1q S1,2 ÝÑ p W1,1^ W1,2^ W2,2^ W1,3q

S1,2 ÝÑ pW1,3_W1,2_W2,2_W1,1q

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 24/335

Page 25: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Knowledge after the 3rd move:

S1,1^ S2,1^S1,2^ B1,1^ B2,1^ B1,2

Question:Can we deduce that the wumpus is located at (1,3)?

Answer:Yes. Either via resolution or using our Hilbert-calculus.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 25/335

Page 26: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Problem:We want more: given a certain situation we would like todetermine the best action, i.e. to ask a query which givesus back such an action. This is impossible in SL: we canonly check for each action whether it is good or not andthen, by comparison, try to find the best action.

But we can check for each action if it should be done ornot. Therefore we need additional axioms:A1,1^East^W2,1 ÝÑ ForwardA1,1^East^Grube2,1 ÝÑ ForwardAi, j^Gli, j ÝÑ TakeGold

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 26/335

Page 27: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Breeze Breeze

Breeze

BreezeBreeze

Stench

Stench

BreezePIT

PIT

PIT

1 2 3 4

1

2

3

4

START

Gold�

Stench

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 27/335

Page 28: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Disadvantages

actions can only be guesseddatabase must be changed continuouslythe set of rules becomes very big becausethere are no variables

Using an appropriate formalisation (additionalaxioms) we can check if

KB $ action or KB $ action

But it can happen that neither one nor theother is deducible.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 28/335

Page 29: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Sudoku

Since some time, Sudoku puzzles are becomingquite famous.

Table 1: A simple Sudoku (S1)

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 29/335

Page 30: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Can they be solved with sentential logic?

Idea: Given a Sudoku-Puzzle S, construct alanguage LSudoku and a theory TS � FmlLSudokusuch that

MODpTSq � Solutions of the puzzle S

Solution

In fact, we construct a theory TSudoku and foreach (partial) instance of a 9�9 puzzle S aparticular theory TS such that

MODpTSudoku Y TSq � tS : S is a solution of Su

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 30/335

Page 31: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

We introduce the following language LSudoku:1 einsi, j, 1¤ i, j ¤ 9,2 zweii, j, 1¤ i, j ¤ 9,3 dreii, j, 1¤ i, j ¤ 9,4 vieri, j, 1¤ i, j ¤ 9,5 fuenfi, j, 1¤ i, j ¤ 9,6 sechsi, j, 1¤ i, j ¤ 9,7 siebeni, j, 1¤ i, j ¤ 9,8 achti, j, 1¤ i, j ¤ 9,9 neuni, j, 1¤ i, j ¤ 9.

This completes the language, the syntax.

How many symbols are these?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 31/335

Page 32: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

We distinguished between the puzzle S and asolution S of it.What is a model (or valuation) in the sense ofDefinition 1.2?

Table 2: How to construct a model S?Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 32/335

Page 33: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

We have to give our symbols a meaning: thesemantics!

einsi, j means i, j contains a 1zweii, j means i, j contains a 2

...neuni, j means i, j contains a 9

To be precise: given a 9�9 square that iscompletely filled out, we define our valuation vas follows (for all 1¤ i, j ¤ 9).

vpeinsi, jq �

"true, if 1 is at position pi, jq,false, else .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 33/335

Page 34: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

vpzweii, jq �

"true, if 2 is at position pi, jq,false, else .

vpdreii, jq �

"true, if 3 is at position pi, jq,false, else .

vpvieri, jq �

"true, if 4 is at position pi, jq,false, else .

etc.

vpneuni, jq �

"true, if 9 is at position pi, jq,false, else .

Therefore any 9�9 square can be seen as amodel or valuation with respect to the languageLSudoku.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 34/335

Page 35: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

How does TS look like?

TS � t eins1,4,eins5,8,eins6,6,

zwei2,2,zwei4,8,

drei6,8,drei8,3,drei9,4,

vier1,7,vier2,5,vier3,1,vier4,3,vier8,2,vier9,8,...neun3,4,neun5,2,neun6,9,

u

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 35/335

Page 36: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

How should the theory TSudoku look like (s.t.models of TSudokuYTS correspond to solutions of thepuzzle)?First square: T11 eins1,1 _ . . . _ eins3,32 zwei1,1 _ . . . _ zwei3,33 drei1,1 _ . . . _ drei3,34 vier1,1 _ . . . _ vier3,35 fuenf1,1 _ . . . _ fuenf3,36 sechs1,1 _ . . . _ sechs3,37 sieben1,1 _ . . . _ sieben3,38 acht1,1 _ . . . _ acht3,39 neun1,1 _ . . . _ neun3,3

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 36/335

Page 37: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

The formulae on the last slide are saying, that1 The number 1must appear somewhere in thefirst square.

2 The number 2must appear somewhere in thefirst square.

3 The number 3must appear somewhere in thefirst square.

4 etcDoes that mean, that each number 1, . . . , 9occurs exactly once in the first square?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 37/335

Page 38: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

No! We have to say, that each number occursonly once:

T 11:1 peinsi, j ^ zweii, jq, 1¤ i, j ¤ 3,2 peinsi, j ^ dreii, jq, 1¤ i, j ¤ 3,3 peinsi, j ^ vieri, jq, 1¤ i, j ¤ 3,4 etc5 pzweii, j ^ dreii, jq, 1¤ i, j ¤ 3,6 pzweii, j ^ vieri, jq, 1¤ i, j ¤ 3,7 pzweii, j ^ fuenfi, jq, 1¤ i, j ¤ 3,8 etcHow many formulae are these?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 38/335

Page 39: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Second square: T21 eins1,4 _ . . . _ eins3,62 zwei1,4 _ . . . _ zwei3,63 drei1,4 _ . . . _ drei3,64 vier1,4 _ . . . _ vier3,65 fuenf1,4 _ . . . _ fuenf3,66 sechs1,4 _ . . . _ sechs3,67 sieben1,4 _ . . . _ sieben3,68 acht1,4 _ . . . _ acht3,69 neun1,4 _ . . . _ neun3,6

And all the other formulae from the previousslides (adapted to this case): T 12

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 39/335

Page 40: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

The same has to be done for all 9 squares.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 40/335

Page 41: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

What is still missing:

Rows: Each row should contain exactly thenumbers from 1 to 9 (no numbertwice).

Columns: Each column should contain exactlythe numbers from 1 to 9 (no numbertwice).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 41/335

Page 42: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

First Row: TRow 11 eins1,1 _ eins1,2 _ . . . _ eins1,9

2 zwei1,1 _ zwei1,2 _ . . . _ zwei1,9

3 drei1,1 _ drei1,2 _ . . . _ drei1,9

4 vier1,1 _ vier1,2 _ . . . _ vier1,9

5 fuenf1,1 _ fuenf1,2 _ . . . _ fuenf1,9

6 sechs1,1 _ sechs1,2 _ . . . _ sechs1,9

7 sieben1,1 _ sieben1,2 _ . . . _ sieben1,9

8 acht1,1 _ acht1,2 _ . . . _ acht1,9

9 neun1,1 _ neun1,2 _ . . . _ neun1,9

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 42/335

Page 43: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Analogously for all other rows, eg.Ninth Row: TRow 91 eins9,1 _ eins9,2 _ . . . _ eins9,92 zwei9,1 _ zwei9,2 _ . . . _ zwei9,93 drei9,1 _ drei9,2 _ . . . _ drei9,94 vier9,1 _ vier9,2 _ . . . _ vier9,95 fuenf9,1 _ fuenf9,2 _ . . . _ fuenf9,96 sechs9,1 _ sechs9,2 _ . . . _ sechs9,97 sieben9,1 _ sieben9,2 _ . . . _ sieben9,98 acht9,1 _ acht9,2 _ . . . _ acht9,99 neun9,1 _ neun9,2 _ . . . _ neun9,9

Is that sufficient? What if a row containsseveral 1's?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 43/335

Page 44: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

First Column: TColumn 11 eins1,1 _ eins2,1 _ . . . _ eins9,12 zwei1,1 _ zwei2,1 _ . . . _ zwei9,13 drei1,1 _ drei2,1 _ . . . _ drei9,14 vier1,1 _ vier2,1 _ . . . _ vier9,15 fuenf1,1 _ fuenf2,1 _ . . . _ fuenf9,16 sechs1,1 _ sechs2,1 _ . . . _ sechs9,17 sieben1,1 _ sieben2,1 _ . . . _ sieben9,18 acht1,1 _ acht2,1 _ . . . _ acht9,19 neun1,1 _ neun2,1 _ . . . _ neun9,1

Analogously for all other columns.

Is that sufficient? What if a column containsseveral 1's?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 44/335

Page 45: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

All put together:

TSudoku � T1YT 11 Y . . . Y T9YT 19TRow 1Y . . .YTRow 9TColumn 1Y . . .YTColumn 9

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 45/335

Page 46: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 3. Examples

Here is a more difficult one.

Table 3: A difficult Sudoku Sdifficult

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 46/335

Page 47: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

1.4 Calculi

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 47/335

Page 48: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

A general notion of a certain sort of calculi.

Definition 1.11 (Hilbert-Type Calculi)

A Hilbert-Type calculus over a language L is a pairxAx,Infy where

Ax: is a subset of FmlL , the set of well-formedformulae in L: they are called axioms,

Inf: is a set of pairs written in the formφ1,φ2, . . . ,φn

ψ

where φ1,φ2, . . . ,φn,ψ are L-formulae: they arecalled inference rules.

Intuitively, one can assume all axioms as “true formulae”(tautologies) and then use the inference rules to deriveeven more new formulae.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 48/335

Page 49: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

We now define a particular instance of our general notion.

Definition 1.12 (Calculus for Sentential Logic SL)

We define HilbertSLL � xAxSL

L ,tMPuy, the Hilbert-Typecalculus, as follows. The underlying language is L � LSLwith the wellformed formulae FmlL as defined inDefinition 1.1.Axioms in SL (AxSL

L ) are the following formulae:1 φÑJ, lÑ φ, JÑl, lÑ J,2 pφ^ψq Ñ φ, pφ^ψq Ñ ψ,3 φÑ pφ_ψq, ψÑ pφ_ψq,4 φÑ φ, pφÑ ψq Ñ ppφÑ ψq Ñ φq,5 φÑ pψÑ φq, φÑ pψÑ pφ^ψqq.

φ,ψ stand for arbitrarily complex formulae (not just constants). Theyrepresent schemata, rather than formulae in the language.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 49/335

Page 50: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Definition (continued)

The only inference rule in SL ismodus ponens:

MP : Fml�Fml Ñ Fml : pϕ,ϕÑ ψq ÞÑ ψ.

or short

(MP)ϕ, ϕÑ ψ

ψ.

(ϕ,ψ are arbitrarily complex formulae).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 50/335

Page 51: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Definition 1.13 (Proof)

A proof of a formula ϕ from a theory T � FmlL isa sequence ϕ1, . . . ,ϕn of formulae such thatϕn � ϕ and for all i with 1¤ i¤ n one of thefollowing conditions holds:

ϕi is substitution instance of an axiom,ϕi P T ,there is ϕl,ϕk � pϕl Ñ ϕiq with l,k   i. Then ϕiis the result of the application of modusponens on the predecessor-formulae of ϕi.

We write: T $ ϕ (ϕ can be derived from T ).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 51/335

Page 52: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

We have now introduced two important notions:Syntactic derivability $: the notion that certain

formulae can be derived from otherformulae using a certain calculus,

Semantic validity |ù: the notion that certainformulae follow from other formulaebased on the semantic notion of amodel.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 52/335

Page 53: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Definition 1.14 (Correct-, Completeness for a calculus)Given an arbitrary calculus (which defines a notion $) anda semantics based on certain models (which defines arelation |ù), we say that

Correctness: The calculus is correct with respect to thesemantics, if the following holds:

Φ$ φ implies Φ |ù φ.

Completeness: The calculus is complete with respect tothe semantics, if the following holds:

Φ |ù φ implies Φ$ φ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 53/335

Page 54: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Theorem 1.15 (Correct-, Completeness for HilbertSLL )

A formula follows semantically from a theory Tif and only if it can be derived:

T |ù ϕ if and only if T $ ϕ

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 54/335

Page 55: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Theorem 1.16 (Compactness for HilbertSLL )

A formula follows from a theory T if and only ifit follows from a finite subset of T :

CnpT q �¤tCnpT 1q : T 1 � T, T 1finiteu.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 55/335

Page 56: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

It is well-known, that any formula φ can bewritten as a conjunction of disjunctions

n©i�1

miªj�1

φi, j

The φi, j are just constants or negated constants.The n disjunctions

�mij�1 φi, j are called clauses of

φ.Normalform

Instead of working on arbitrary formulae, it issometimes easier to work on finite sets ofclauses.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 56/335

Page 57: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

A resolution calculus for SL

The resolution calculus is defined over thelanguage Lres � LSL where the set ofwell-formed formulae FmlRes

Lres consists of alldisjunctions of the following form

A_ B_C_ . . ._ E,

i.e. the disjuncts are only constants or theirnegations. No implications or conjunctions areallowed. These formulae are also called clauses.l is also a clause: the empty disjunction.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 57/335

Page 58: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Set-notation of clauses

A disjunction A_ B_C_ . . ._ E is oftenwritten as a set

tA, B,C, . . . , Eu.

Thus the set-theoretic union of such setscorresponds again to a clause: tA, Bu YtA, Curepresents A_ B_ C. Note that the empty setH is identified with l.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 58/335

Page 59: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

We define the following inference rule onFmlRes

Lres:

Definition 1.17 (SL resolution)

Let C1,C2 be clauses (disjunctions). Deduce theclause C1_C2 from C1_A and C2_ A:

(Res)C1_A, C2_ A

C1_C2

If C1 �C2 �H, then C1_C2 � l.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 59/335

Page 60: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

If we use the set-notation for clauses, we canformulate the inference rule as follows:Definition 1.18 (SL resolution (Set notation))

Deduce the clause C1YC2 from C1YtAu andC2Yt Au:

(Res)C1YtAu, C2Yt Au

C1YC2

Again, we identify the empty setH with l.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 60/335

Page 61: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Definition 1.19 (Resolution Calculus for SL)

We define the resolution calculusRobinsonSL

Lres � xH,tResuy as follows. Theunderlying language is Lres � LSL defined onSlide 57 together with the well-formed formulaeFmlRes

Lres.

Thus there are no axioms and only one inferencerule. The well-formed formulae are just clauses.Question:

Is this calculus correct and complete?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 61/335

Page 62: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 4. Calculi

Answer:It is correct, but it is not complete!

But every problem of the kind “T |ù φ” is equivalent to“T Yt φu is unsatisfiable”

or rather toT Yt φu $ l

($ stands for the calculus introduced above).

Theorem 1.20 (Completeness of Resolution Refutation)If M is an unsatisfiable set of clauses then the empty clausel can be derived in RobinsonSL

Lres.

We also say that resolution is refutation complete.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 62/335

Page 63: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

1.5 First-Order Logic (FOL)

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 63/335

Page 64: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.21 (First order logic LFOL, L � LFOL)

The language LFOL of first order logic (Praedikatenlogikerster Stufe) is:

x,y,z,x1,x2, . . . ,xn, . . .: a countable set Var of variablesfor each k P N0: Pk

1 ,Pk2 , . . . ,Pk

n , . . . a countable set Predk

of k-dimensional predicate symbols (the 0-dimensionalpredicate symbols are the propositional logicconstants from At of LSL). We suppose that l and Jare available.for each k P N0: f k

1 , f k2 , . . . , f k

n , . . . a countable set Functk

of k-dimensional function symbols , ^, _,Ñ: the sentential connectivesp, q: the parentheses@, D: quantifiers

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 64/335

Page 65: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)The 0-dimensional function symbols are calledindividuum constants – we leave out the parentheses. Ingeneral we will need – as in propositional logic – only acertain subset of the predicate or function symbols.

These define a language L � LFOL (analogously todefinition 1.1 on page 2). The used set of predicate andfunction symbols is also called signature Σ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 65/335

Page 66: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)The concept of an L-term t and an L-formula ϕ aredefined inductively:

Term: L-terms t are defined as follows:1 each variable is a L-term.2 if f k is a k-dimensional function symbol from L and t1,. . . ,tk are L-terms, then f kpt1, . . . , tkq is a L-Term.

The set of all L-terms that one can create from the setX � Var is called TermLpXq or TermΣpXq. Using X �H weget the set of basic terms TermLpHq, short: TermL .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 66/335

Page 67: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)Formula: L-formulae ϕ are also defined inductively:1 if Pk is a k-dimensional predicate symbol from L and t1,. . . ,tk are L-terms then Pkpt1, . . . , tkq is a L-formula

2 for all L-formulae ϕ is p ϕq a L-formula3 for all L-formulae ϕ and ψ are pϕ^ψq and pϕ_ψq

L-formulae.4 if x is a variable and ϕ a L-formula then are pDxϕq andp@xϕq L-formulae.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 67/335

Page 68: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)Atomic L-formulae are those which are composedaccording to 1., we call them AtLpXq (X � Var). The set ofall L-formulae in respect to X is called FmlLpXq.

Positive formulae (Fml�L pXq) are those which arecomposed using only 1, 3. and 4.

If ϕ is a L-formula and is part of an other L-formula ψ thenϕ is called sub-formula of ψ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 68/335

Page 69: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

An illustrating example

Example 1.22 (From semigroups to rings)

We consider L � t0,1,�, �,¤,�u, where 0,1 are constants,�, � binary operations and ¤,� binary relations. What canbe expressed in this language?

Ax 1: @x@y@z x�py� zq � px� yq� zAx 2: @x px�0� 0� xq ^ p0� x� xqAx 3: @xDy px� y� 0q ^ py� x� 0qAx 4: @x@y x� y� y� xAx 5: @x@y@z x � py � zq � px � yq � zAx 6: @x@y@z x � py� zq � x � y� x � zAx 7: @x@y@z py� zq � x� y � x� z � x

Axiom 1 describes an semigroup, the axioms 1-2 describe amonoid, the axioms 1-3 a group, and the axioms 1-7 a ring.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 69/335

Page 70: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.23 (L-structure A � pUA , IAq)

A L-structure or a L-interpretation is a pairA �def pUA , IAq withUA being an arbitrary non-empty set,which is called the basic set (the universe or theindividuum range) of A. Further IA is a mapping whichassigns to each k-dimensional predicate symbol Pk in La k-dimensional predicate overUAassigns to each k-dimensional function symbol f k in La k-dimensional function onUA

In other words: the domain of IA is exactly the set ofpredicate and function symbols of L.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 70/335

Page 71: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)The range of IA consists of the predicates and functions onUA . We write:

IApPq � PA , IAp f q � f A .

ϕ be a L1-formula and A �def pUA , IAq a L-structure. A iscalledmatching with ϕ if IA is defined for all predicateand function symbols which appear in ϕ, i.e. if L1 � L.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 71/335

Page 72: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.24 (Variable assignment ρ)

A variable assignment ρ over a L-structureA � pUA , IAq is a function

ρ : Var Ñ UA ; x ÞÑ ρpxq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 72/335

Page 73: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.25 (Semantics of FOL, Model A)Let ϕ be a formula, A a structure matching with ϕ and ρ avariable assignment over A. For each term t, which can bebuilt from components of ϕ, we define inductively thevalue of t in the structure A, we call Aptq.1 for a variable x is Apxq �def ρpxq.

2 if t has the form t � f kpt1, . . . , tkq, with t1, . . . , tk beingterms and f k a k-dimensional function symbol, thenAptq �def f ApApt1q, . . . ,Aptkqq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 73/335

Page 74: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)We define inductively the logical value of a formula ϕ inA:1. if ϕ�def Pkpt1, . . . , tkq with the terms t1, . . . , tk and the

k-dimensional predicate symbol Pk, then

Apϕq �def

"true, i f pApt1q, . . . ,Aptkqq P PA ,false, else.

2. if ϕ�def ψ, then

Apϕq �def

"true, i f Apψq � false,false, else.

3. if ϕ�def pψ^ηq, then

Apϕq �def

"true, i f Apψq � true and Apηq � true,false, else.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 74/335

Page 75: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)4. if ϕ�def pψ_ηq, then

Apϕq �def

"true, i f Apψq � true or Apηq � true,false, else.

5. if ϕ�def @xψ, then

Apϕq �def

"true, i f @ d PUA : Arx{dspψq � true,false, else.

6. if ϕ�def Dxψ, then

Apϕq �def

"true, i f Dd PUA : Arx{dspψq � true,false, else.

In the cases 5. and 6. the notation rx{ds was used. It isdefined as follows: For d PUA let Arx{ds be the structure A 1,which is identical to A except for the definition of xA 1

:xA 1

�def d (whether IA is defined for x or not).Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 75/335

Page 76: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition (continued)We write:

A |ù ϕrρs for Apϕq � true: A is amodel for ϕ withrespect to ρ.If ϕ does not contain free variables, then A |ù ϕrρs isindependent from ρ. We simply leave out ρ.If there is at least one model for ϕ , then ϕ is calledsatisfiable or consistent.

A free variable is a variable which is not in the scope of aquantifier. For instance, z is a free variable of @xPpx,zq butnot free (or bounded) in @zDxPpx,zq

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 76/335

Page 77: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.26 (Tautology)

1 A theory is a set of formulae without freevariables: T � FmlL . The structure A satisfiesT if A |ù ϕ holds for all ϕ P T . We write A |ù Tand call A a model of T .

2 A L-formula ϕ is called L-tautology, if for allmatching L-structures A the followingholds: A |ù ϕ.

From now on we suppress the language L,because it is obvious from context. Neverthelessit has to be defined.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 77/335

Page 78: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.27 (Consequence set CnpT q)

A formula ϕ follows semantically from T , if forall structures A with A |ù T also A |ù ϕ holds.We write: T |ù ϕ.

In other words: all models of T do also satisfy ϕ.

We denote by CnLpT q �def tϕ P FmlL : T |ù ϕu, orsimply CnpT q, the semantic consequenceoperator.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 78/335

Page 79: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Lemma 1.28 (Properties of CnpT q)

The semantic consequence operator has thefollowing properties1 T -extension: T �CnpT q,2 Monotony: T � T 1 ñ CnpT q �CnpT 1q,3 Closure: CnpCnpT qq �CnpT q.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 79/335

Page 80: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Lemma 1.29 (ϕ R Cn(T))

ϕ RCnpT q if and only if there is a structure A withA |ù T and A |ù ϕ.

In other words: ϕ RCnpT q if and only if there is acounterexample: a model of T in which ϕ is nottrue.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 80/335

Page 81: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.30 (MODpT q, CnpUq)

If T � FmlL , then we denote byMODpT q the setof all L-structures A which are models of T :

MODpT q �def tA : A |ù Tu.

If U is a set of structures then we can consider allsentences, which are true in all structures. Wecall this set also CnpUq:

CnpUq �def tϕ P FmlL : @A PU : A |ù ϕu.

MOD is obviously dual to Cn:

CnpMODpT qq �CnpT q, MODpCnpT qq �MODpT q.Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 81/335

Page 82: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.31 (Completeness of a theory T )

T is called complete, if for each formula ϕ P FmlL : T |ù ϕ

or T |ù ϕ holds.

Attention:Do not mix up this last condition with the property of astructure v (or a model): each structure is complete inthe above sense.

Lemma 1.32 (Ex Falso Quodlibet)T is consistent if and only if CnpT q � FmlL .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 82/335

Page 83: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

An illustrating example

Example 1.33 (Natural numbers in different languages)

NPr � pN0,0N ,�N ,�N q („Presburger Arithmetik”),

NPA � pN0,0N ,�N , �N ,�N q („Peano Arithmetik”),

NPA1 � pN0,0N ,1N ,�N , �N ,�N q (variant of NPA).

These sets each define the natural numbers, but indifferent languages.

Question:If the language bigger is bigger then we can express more.Is LPA1 more expressive then LPA?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 83/335

Page 84: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Answer:

No, because one can replace the 1N by aLPA-formula: there is a LPA-formula φpxq so thatfor each variable assignment ρ the followingholds:

NPA1 |ùρ φpxq if and only if ρpxq � 1N

Thus we can define a macro for 1.Each formula of LPA1 can be transformed intoan equivalent formula of LPA.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 84/335

Page 85: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Question:

Is LPA perhaps more expressive than LPr, or canthe multiplication be defined somehow?

We will see later that LPA is indeed moreexpressive:the set of sentences valid in NPr is decidable,whereasthe set of sentences valid in NPA is not evenrecursively enumerable.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 85/335

Page 86: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

As for sentential logic, formulae can be derivedfrom a given theory and they can also(semantically) follow from it.Syntactic derivability $: the notion that certain

formulae can be derived from otherformulae using a certain calculus,

Semantic validity |ù: the notion that certainformulae follow from other formulaebased on the semantic notion of amodel.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 86/335

Page 87: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Definition 1.34 (Correct-, Completeness for a calculus)Given an arbitrary calculus (which defines a notion $) anda semantics based on certain models (which defines arelation |ù), we say that

Correctness: The calculus is correct with respect to thesemantics, if the following holds:

Φ$ φ implies Φ |ù φ.

Completeness: The calculus is complete with respect tothe semantics, if the following holds:

Φ |ù φ implies Φ$ φ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 87/335

Page 88: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

We have already defined a complete and correct calculusfor sentential logic LSL. Such calculi also exist for firstorder logic LFOL.

Theorem 1.35 (Correct-, Completeness of FOL)

A formula follows semantically from a theory T if and only ifit can be derived:

T $ ϕ if and only if T |ù ϕ

Theorem 1.36 (Compactness of FOL)

A formula follows from a theory T if and only if it followsfrom a finite subset of T :

CnpT q �¤tCnpT 1q : T 1 � T, T 1 finiteu.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 88/335

Page 89: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

The introduced relation T |ù φ says that eachmodel of T is also a model of φ. But becausethere are many models with very large universesthe following question arises: can we restrict toparticular models ?

Theorem 1.37 (Löwenheim-Skolem)

T |ù φ holds if and only if φ holds in allcountable models of T .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 89/335

Page 90: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Quite often the universes of models (which we areinterested in) consist exactly of the basic terms TermLpHq.This leads to the following notion:

Definition 1.38 (Herbrand model)

A model A is called Herbrand model with respect to alanguage if the universe of A consists exactly of TermLpHqand the function symbols f k

i are interpreted as follows:

f ki

A : TermLpHq� . . .�TermLpHq Ñ TermLpHq;pt1, . . . , tkq ÞÑ f k

i pt1, . . . , tkq

We write T |ùHerb φ if each Herbrand model of T is also amodel of φ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 90/335

Page 91: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Theorem 1.39 (Reduction to Herbrand models)

If T is universal and φ existential, then thefollowing holds:

T |ù φ if and only if T |ùHerb φ

Question:

Is T |ùHerb φ not much easier, because we have toconsider only Herbrand models? Is it perhapsdecidable?

No, truth in Herbrand models is highlyundecidable.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 91/335

Page 92: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Wumpus world reconsidered in FOL

Question:

How do we axiomatize the Wumpus-world inFOL?

function KB-AGENT( percept) returns an actionstatic: KB, a knowledge base

t, a counter, initially 0, indicating time

TELL(KB, MAKE-PERCEPT-SENTENCE( percept, t))action � ASK(KB, MAKE-ACTION-QUERY(t))TELL(KB, MAKE-ACTION-SENTENCE(action, t))t � t + 1return action

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 92/335

Page 93: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Idea:In order to describe actions or their effects consistently weconsider the world as a sequence of situations (snapshotsof the world). Therefore we have to extend eachpredicate by an additional argument.

We use the function symbol

resultpaction,situationq

as the term for the situation which emerges when theaction action is executed in the situation situation.

Actions: Turn_right, Turn_le f t, Foreward, Shoot, Grab,Release, Climb.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 93/335

Page 94: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

PIT

PIT

PIT

Gold

PIT

PIT

PIT

Gold

PIT

PIT

PIT

Gold

PIT

PIT

PIT

Gold

Forward

S0

Forward

Turn (Right)S1

S0S2

S3

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 94/335

Page 95: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

We also need amemory, a predicate

Atpperson, location,situationq

with person being eitherWumpus or Agent and locationbeing the actual position (stored as pair [i,j]).

Important axioms are the so called successor-stateaxioms, they describe how actions effect situations. Themost general form of these axioms is

true afterwards ðñ an action made it trueor it is already true andno action made it false

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 95/335

Page 96: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 5. First-Order Logic (FOL)

Successor State Axiom

Axioms about Atpp, l,sq:Atpp, l,resultpForward,sqqØppl .

� location_aheadpp,sq^ Wallplqq

Atpp, l,sq ÑLocation_aheadpp,sq .�

Location_towardpl,Orient.pp,sqqWallprx,ysq Øpx .

� 0_ x .� 5_ y .

� 0_ y .� 5q

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 96/335

Page 97: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

1.6 Logic Programming

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 97/335

Page 98: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

The following theorem is the basic result for applyingresolution. It states that FOL can be reduced to SL.

Theorem 1.40 (Herbrand)T be universal and φ does not contain quantifiers. Then:

T |ù Dφ if and only if there is t1, . . . , tn P TermLpHqwith: T |ù φpt1q_ . . ._φptnq

Or: Let M be a set of clauses of FOL (formulae in the formP1pt1q_ P2pt2q_ . . ._Pnptnq with ti P TermLpXq). Then:

M is unsatisfiableif and only if

there is a finite and unsatisfiable set Minstof basic instances of M.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 98/335

Page 99: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Our general goal is to derive an existentiallyquantified formula from a set of formulae:

M $ Dϕ.

To use resolution we must form MYt Dϕu andput it into the form of clauses. This set is calledinput.Instead of allowing arbitrary resolvents, we tryto restrict the search space.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 99/335

Page 100: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Definition 1.41 (Most general unifier: mgU)Given a finite set of equations between terms or equationsbetween literals.Then there is an algorithm which calculates amostgeneral solution substitution (i.e. a substitution of theinvolved variables so that the left sides of all equations aresyntactically identical to the right sides) or which returnsfail.In the first case themost general solution substitution isdefined (up to renaming of variables): it is called

mgU, most general unifier

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 100/335

Page 101: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

ppx,aq � qpy,bq,ppgpaq, f pxqq � ppgpyq,zq. Basic substitutionsare:ry{a,x{a,z{ f paqs, ry{a,x{ f paq,z{ f p f paqqs, . . .The mgU is: ry{a,z{ f pxqs .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 101/335

Page 102: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

We outline the mentioned algorithm using an example.

Given: f px,gphpyq,yqq � f px,gpz,aqq

The algorithm successively calculates the following sets ofequations:

t x� x, gphpyq,yq � gpz,aq ut gphpyq,yq � gpz,aq ut hpyq � z, y� a ut z� hpyq, y� a ut z� hpaq, y� a u

Thus the mgU is: rx{x,y{a,z{hpaqs.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 102/335

Page 103: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

A resolution calculus for FOLThe resolution calculus is defined over the languageLres � LFOL where the set of well-formed formulae FmlRes

Lres

consists of all disjunctions of the following formA_ B_C_ . . ._ E,

i.e. the disjuncts are only atoms or there negations. Noimplications or conjunctions are allowed. These formulaeare also called clauses.Such a clause is also written as the set

tA, B,C, . . . , Eu.

This means that the set-theoretic union of such setscorresponds again to a clause.Note, that a clause now consists of atoms rather thanconstants, as it was the case of the resolution calculus forSL.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 103/335

Page 104: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Definition 1.42 (Robinson’s resolution for FOL)

The resolution calculus consists of two rules:

(Res)C1YtA1u C2Yt A2u

pC1YC2qmgUpA1,A2q

where C1YtA1u and C2YtA2u are assumed to be disjunctwrt the variables, and the factorization rule

(Fac)C1YtL1,L2u

pC1YtL1uqmgUpL1,L2q

Consider for example M � trpxq_ ppxq, ppaq,spaqu and thequestion M |ù Dxpspxq^ rpxqq?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 104/335

Page 105: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Definition 1.43 (Resolution Calculus for FOL)

We define the resolution calculusRobinsonFOL

Lres � xH,tRes,Facuy as follows. Theunderlying language is Lres � LFOL defined onSlide 103 together with the set of well-formedformulae FmlRes

Lres.

Thus there are no axioms and only two inferencerules. The well-formed formulae are just clauses.Question:

Is this calculus correct and complete?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 105/335

Page 106: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Question:

Why do we need factorization?

Answer:

Consider

M � tspx1q_ spx2q, spy1q_ spy2qu

Resolving both clauses gives

tspx1quYt spy1qu

or variants of it.Resolving this new clause with one in M onlyleads to variants of the respective clause in M.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 106/335

Page 107: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Answer (continued):

l can never be derived (using resolution only).

Factorization instantly solves the problem, wecan deduce both spxq and spyq, and from therethe empty clause.

Theorem 1.44 (Resolution is refutation complete)

Robinsons resolution calculus RobinsonFOLLres is

refutation complete: given an unsatisfiable set,the empty clause can be derived using resolutionand factorization.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 107/335

Page 108: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Example 1.45 (Unlimited Resolution)

Let M :� trpxq_ ppxq, ppaq, spaqu andlÐ spxq^ rpxq the query.An unlimited resolution might look like this:

rpxq_ ppxq ppaq

rpaq

spaq spxq_ rpxq

rpaq

l

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 108/335

Page 109: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Input resolution: in each resolution step one of the twoparent clauses must be from the input. Inour example:

spxq_ rpxq spaq

rpaqrpxq_ ppxq

ppaqppaq

l

Linear resolution: in each resolution step one of the twoparent clauses must either be from theinput or must be a successor of the otherparent clause.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 109/335

Page 110: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Theorem 1.46 (Completeness of resolution variants)

Linear resolution is refutation complete.Input resolution is correct but not refutationcomplete.

Idea:

Maybe input resolution is complete for arestricted class of formulae.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 110/335

Page 111: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Definition 1.47 (Horn clause)

A clause is called Horn clause if it contains atmost one positive atom.

A Horn clause is called definite if it containsexactly one positive atom. It has the form

Aptq Ð A1pt1q, . . . ,Anptnq.

A Horn clause without positive atom is calledquery:

lÐ A1pt1q, . . . ,Anptnq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 111/335

Page 112: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Theorem 1.48 (Input resolution for Horn clauses)Input resolution for Horn clauses is refutation complete.

Definition 1.49 (SLD resolution wrt P and query Q)SLD resolution with respect to a program P and the queryQ is input resolution beginning with the querylÐ A1, . . . ,An.

Then one Ai is chosen and resolved with a clause of theprogram.A new query emerges, which is treated as before.If the empty clause lÐ can be derived, then SLDresolution was successful and the instantiation of thevariables is called computed answer.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 112/335

Page 113: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Theorem 1.50 (Correctness of SLD resolution)

Let P be a definite program and Q a query. Then eachcomputed answer (for P wrt Q) is correct.

Question:Is SLD completely instantiated?

Definition 1.51 (Computation rule)

A computation rule R is a function which assigns an atomAi P tA1, . . . ,Anu to each query lÐ A1, . . . ,An. This Ai is thechosen atom against which we will resolve in the nextstep.

Note:PROLOG always uses the leftmost atom.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 113/335

Page 114: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Ð ppx,bq

Ð qpx,yq, ppy,bq

Ð ppb,bq

Ð qpb,uq, ppu,bq

l

rx{bs“Success”

“Failure”

l

“Success”rx{as

��

��

��

��

@@

@@

@@

@@

1

1

2

2

3

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 114/335

Page 115: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Ð ppx,bq

Ð qpx,yq, ppy,bq

Ð qpx,yq,qpy,uq, ppu,bq Ð qpx,bq

Ð qpx,yq,qpy,uq,qpu,vq, ppv,bq Ð qpx,yq,qpy,bq

Ð qpx,aq

l

rx{bs

“Success”

“Failure”

l

“Success”

l

“Success”

rx{as

��

��

��

��

��

��

��

��

��

@@

@@

@@

@@

@@

@@

@@

@@

@@...

.

.

.

1

1

1

1

2

2

2

2

3

3

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 115/335

Page 116: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

A SLD tree may have three different kinds ofbranches:1 infinite ones,2 branches ending with the empty clause(and leading to an answer) and

3 failing branches (dead ends).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 116/335

Page 117: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Theorem 1.52 (Independence of computation rule)

Let R be a computation rule and σ an answercalculated wrt R (i.e. there is a successful SLDresolution). Then there is a successful SLDresolution for each other computation rule R'and the answer σ1 belonging to R’ is a variant of σ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 117/335

Page 118: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Theorem 1.53 (Completeness of SLD resolution)

Each correct answer substitution is subsumed bya calculated answer substitution. I.e.:

P |ù @QΘ

impliesSLD computes an answer τ with: Dσ : Qτσ� QΘ

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 118/335

Page 119: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Question:

How to find successful branches in a SLD tree?

Definition 1.54 (Search rule)

A search rule is a strategy to search forsuccessful branches in SLD trees.

Note:

PROLOG uses depth-first-search.

A SLD resolution is determined by acomputation rule and a searching rule.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 119/335

Page 120: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

SLD trees for PYtQu are determined by thecomputation rule.

PROLOG is incomplete because of two reasons:depth-first-searchincorrect unification (no occur check).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 120/335

Page 121: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

A third reason comes up if we also ask for finiteand failed SLD resolutions:the computation rule must be fair, i.e. theremust be a guarantee that every atom on thelist of goals is eventually chosen.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 121/335

Page 122: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Principle 1.1 (PROLOG Paradigm)

Given a program P and a query, the proofs of thisquery (and the computed answers) representthe solution of the formalized problem.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 122/335

Page 123: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Order of atoms

Example 1.55 (Termination depends on the orderwithin a rule)Consider the following two programs:

p1q reverseprX |Y s,Zq :� appendpU, rXs,Zq,reversepY,Uqp2q reverseprX |Y s,Zq :� reversepY,Uq,appendpU, rXs,Zq

together with a definition for append

appendprs,X ,Xq :�appendprX |Y s,Z, rX |T sq :� appendrY,Z,T q

and the query “Q� reversepra|Xs, rb,c,d,bsq”.

Obviously, (1) and (2) are equivalent, but asking the queryQ wrt (1) yields immediately a “fail”. Asking the query Qwrt (2) yields a non-terminating computation.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 123/335

Page 124: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Example 1.56 (TP)

Given a definite program P let TP: 2BP ÞÝÑ 2BP; I ÞÝÑ TPpI q

TPpI q :� tA P BP : there is an instantiation of a rule in Ps.t. A is the head of this rule and allbody-atoms are contained in I u

It turns out that TP is monotone and continuous: so that

Theorem 1.57 (TP and MP)

MP � TPÒω� l f ppTPq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 124/335

Page 125: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Theorem 1.58 (Soundness and Completeness of SLD)

The following properties are equivalent:P |ù @ QΘ, i.e. @ QΘ is true in all models of P,MP |ù @ QΘ,SLD computes an answer τ that subsumes Θ

wrt Q (i.e. Dσ : Qτσ � QΘ.)

Note that not just some correct answer iscomputed: the most general one is.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 125/335

Page 126: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

The main feature of SLD-Resolution is itsGoal-Orientedness, also called Relevance.

Lemma 1.59 (Goal-Orientedness, Relevance)

Given a program P and a query Qpxq, only the callgraph below Q (i.e. the relevant part of P wrt. Q)is necessary to answer this query.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 126/335

Page 127: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 6. Logic Programming

Programming versus knowledge engineeringprogramming knowledge engineeringchoose language choose logicwrite program define knowledge basewrite compiler implement calculusrun program derive new facts

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 127/335

Page 128: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 7. References

1.7 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 128/335

Page 129: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 7. References

[Apt and Bol, 1994] Krzysztof R. Apt and Roland N. Bol.Logic programming and negation: A survey.19/20:9–71, 1994.

[Brewka and Dix, 2005] Gerhard Brewka and Jürgen Dix.Knowledge representation with extended logic programs.In D. Gabbay and F. Guenthner, editors, Handbook ofPhilosophical Logic, volume 12, chapter 1, pages 1–85. ReidelPubl., 2. edition, 2005.Shortened version also appeared in Dix, Pereira, Przymusinski(Eds.), Logic Programming and Knowledge Representation,Springer LNAI 1471, pages 1–55, 1998.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 129/335

Page 130: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

1. Basics about Logic 7. References

[Brewka et al., 1997] Gerhard Brewka, Jürgen Dix, and Kurt Konolige.Nonmonotonic Reasoning: An Overview., volume 73.CSLI Publications, Stanford, CA, 1997.

[Dix et al., 2001] Jürgen Dix, Ulrich Furbach, and Ilkka Niemelä.Nonmonotonic reasoning: Towards efficient calculi andimplementations.In John Alan Robinson and Andrei Voronkov, editors, Handbookof Automated Reasoning (in 2 volumes), pages 1241–1354.Elsevier and MIT Press, 2001.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 130/335

Page 131: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming

Chapter 2. Answer SetProgramming

Answer Set Programming2.1 Motivating Examples2.2 Semantics2.3 Properties2.4 ASP engines2.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 131/335

Page 132: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming

In the previous lecture we have introduced SLDresolution as an efficient procedural mechanism forHorn programs. A nice property was Relevance andthe fact, that a unique Herbrand model exists.Starting with Slide 135 we discuss some famousimportant problems in knowledge representation andpresent several motivating running examples.Although Horn programs are Turing complete, theyare too restricted as a framework for KR. We motivateto use programs with negation as an appropriate toolto formalize problems. But how should the semanticslook like?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 132/335

Page 133: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming

We show (starting with Slide 146) that by assuming afew interesting properties (Red, GPPE, Sub, TAUT,CONTRA), only one canonical semantics survives:answer sets. This leads to the ASP paradigm:representing problems with logic programs withnegation under the ASP semantics.In contrast to PROLOG, ASP is purely declarative anduses efficient database techniques. The declarativenessof ASP can be shown on the greatest common divisorexample.A program with negation determines a set of sets:any NP-problem (resp. Σ2-problem) can be uniformlyrepresented.There exist many efficient implementations of ASP.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 133/335

Page 134: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

2.1 Motivating Examples

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 134/335

Page 135: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Important problems of knowledgerepresentation

There are three very important representation-problemsconcerning the axiomatization of a changing world:

Frame problem: most actions change only little – weneedmany actions to describe invariantproperties.It would be ideal to axiomatize only whatdoes not change and to add a proposition like“nothing else changes”.

Ramification problem: How should we handle implicitconsequences of actions? For exampleGrabpGoldq: Gold can be contaminated. ThenGrabpGoldq is not optimal.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 135/335

Page 136: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Qualification problem: In logic, it is necessary toenumerate all conditions under which anaction is executed successfully.

@x pBirdpxq ^ Penguinpxq^ Deadpxq^^ Ostrichpxq^ BrokenWingpxq^^ . . . q

ÝÑ FliespxqIt would be ideal to only store “birds normallyfly”.The most natural way is to use “not”

φ Ð ψ, not abwhere ab stands for abnormality. Obviously,this forces us to extend definite programs bynegative atoms.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 136/335

Page 137: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Example 2.1 (Inheritance Hierachies)

Suppose we know that birds typically fly and penguins arenon-flying birds. We also know that Tweety is a bird. Nowan agent is hired to build a cage for Tweety. Should theagent put a roof on the cage? After all it could be still thecase that Tweety is a penguin and therefore can not fly, inwhich case we would not like to pay for the unneccessaryroof. But under normal conditions, it should be obviousthat one should conclude that Tweety is flying.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 137/335

Page 138: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

A natural axiomatization is given as follows:

PInheritance : f liespxq Ð birdpxq, not abpr1,xqbirdpxq Ð penguinpxqabpr1,xq Ð penguinpxqmake_toppxq Ð f liespxq

together with some particular facts, likebirdpTweetyq and penguinpSamq.For the query “make_toppTweetyq” we expect the answer“yes” while for “make_toppSamq” we expect the answer“no”.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 138/335

Page 139: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Example 2.2 (Greatest Common Divisor (1))Given two integers n,m, how can we compute the greatestcommon divisor?An answer is to apply Euclids algorithm and to writedown a recursive definition for the predicate gcdpX ,Y,Zq: Zis the greatest common divisor of X ,Y .

gcdpX ,X ,Xq :� #intpXq,X ¡ 1.gcdpT,X ,Y q :� X   Y,gcdpT,X ,Y 1q,Y � Y 1�X .gcdpT,X ,Y q :� X ¡ Y,gcdpT,X1,Y q,X � X1�Y.

This is not declarative: It assumes a lot of mathematicalinsight. Namely an algorithm that is correct and complete.Could we also just describe the properties, withoutexplicitly giving an algorithm?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 139/335

Page 140: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Example 2.3 (Greatest Common Divisor (2))Given two integers n,m, how can we compute the greatestcommon divisor?

% Declare when T divides NdivisorpT,Nq :� #intpT q,#intpNq,#intpMq,N � T �M.% Declare common divisorscdpT,N1,N2q :� divisorpT,N1q,divisorpT,N2q.% Single out non-maximal common divisors Tlarger_cdpT,N1,N2q :� cdpT,N1,N2q,cdpT 1,N1,N2q,T   T 1.% Apply double negation: take non non-maximal divisorgcdpT,N1,N2q :� cdpT,N1,N2q,not larger_cdpT,N1,N2q.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 140/335

Page 141: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Example 2.4 (The Transitive Closure)

Assume we are given a graph consisting of nodes andedges between some of them. We want to know whichnodes are reachable from a given one. A naturalformalization of the property “reachable” would be

reachablepxq Ð edgepx,yq,reachablepyq.

What happens if we are given the following facts

edgepa,bq, edgepb,aq, edgepc,dq

and reachablepcq? Of course, we expect that neither a nor bare reachable because there is no path from c to either a orb.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 141/335

Page 142: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

The semantics of SLDNF corresponds to Clark’scompletion comp.

Example 2.5 (COMP vs. NMR)

PKR : p Ð pq Ð not p

?-q: No (SLDNF).Yes (KR).

P1KR : p Ð p

q Ð not pr Ð not r

?-p: Yes (SLDNF).No (KR).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 142/335

Page 143: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Example 2.6 (Van Gelder’s Example)

Assume we are describing a two-players game likecheckers. The two players alternately move a stone on aboard. The moving player wins when his opponent has nomore move to make. We can formalize that by

winspxq Ðmove_from_to(x,y), not wins(y)meaning thatthe situation x is won (for the moving player A), if hecan lead over (with the help of a regular move, givenby the relation move_ f rom_top,q) to a situation y thatcan never be won for B.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 143/335

Page 144: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 1. Motivating Examples

Assume we also have the facts

move_ f rom_topa,bqmove_ f rom_topb,aqmove_ f rom_topb,cq.

Our query to this program Pgame is ?- winspbq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 144/335

Page 145: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

2.2 Semantics

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 145/335

Page 146: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Instead of giving a definition out of Pandora’s box, we tryto start with a general notion and list properties that asemantics should satisfy.

Definition 2.7 (SEM)A semantics SEM is a mapping from the class of allprograms into the powerset of the set of all 3-valuedstructures. SEM assigns to every program P a set of3-valued models of P:

SEMpPq � MOD3�valLPpPq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 146/335

Page 147: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Formally, we can associate to any semantics SEM in thesense of Definition 2.7 two entailment relationssceptical: SEMsceptpPq is the set of all atoms or default

atoms that are true in all models of SEMpPq.credulous: SEMcredpPq is the set of all atoms or default

atoms that are true in at least one model ofSEMpPq.

When there is only one model, we will omit the outerbrackets and write (instead of SEMpPq � tMu)

SEMpPq �M.

We will also slightly abuse notation and write l P SEMpPqas an abbreviation for l PM for all M P SEMpPq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 147/335

Page 148: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Extending SLD to SLDNF

How should we handle default-atoms?If we reach “not A” as a subgoal, we keep the currentSLD-tree in mind and start a new SLD-tree by trying tosolve “A”.If this succeeds, then we falsified “not A”, the currentbranch is failing and we have to backtrack andconsider a different subquery.But it can also happen that the SLD-tree for “A” is finitewith only failing branches. Then we say that A finitelyfails, we turn back to our original SLD-tree, considerthe subgoal “not A” as successfully solved and go onwith the next subgoal in the current list.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 148/335

Page 149: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Principle 2.1 (A “Naive” SLDNF-Resolution)

If in the construction of an SLDNF-tree a default-atom not Li jis selected in the list Li � tLi1,Li2, . . .u, then we try to proveLi j.If this fails finitely (it fails because the generated subtree isfinite and failing), then we take not Li j as proved and we goon to prove Lip j�1q.If Li j succeeds, then not Li j fails and we have to backtrack tothe list Li�1 of preliminary subgoals (the next rule is applied:“backtracking”).

SLDNF properly handles our Example 2.1.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 149/335

Page 150: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Up to now it seems that SLDNF-resolution solvesall our problems. It handles our examplescorrectly, and is defined by a procedural calculusstrongly related to SLD. There are two mainproblems with SLDNF:SLDNF can not handle free variables innegative subgoals,SLDNF is still too weak for KnowledgeRepresentation.

The latter problem is the most important one.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 150/335

Page 151: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

SLDNF answers quite easily our requirements ofa semantics SEM (stated explicitly in Definition 2.7).

Principle 2.2 (Reduction)

Suppose we are given a program P with possiblydefault-atoms in its body. If a ground atom A does not unifywith any head of the rules of P, then we can delete in everyrule any occurrence of “not A” without changing thesemantics.Dually, if there is an instance of a rule of the form “BÐ ”then we can delete all rules that contain “not B” in theirbodies.

Lemma 2.8SLDNF satisfies Reduction.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 151/335

Page 152: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

When we consider rules of the form “pÐ p”, then SLDresolution gets into an infinite loop and no answer to thequery ?- p can be obtained. This has often the effect thatwhen we enter into negation-as-failure mode, theSLD-tree to be constructed is infinite, although he isnot successful and therefore should be considered asfailed.Principle 2.3 (Elimination of Tautologies)

Suppose a program P has a rule which contains the sameatom in its body as well as in its head (i.e. the head consistsof exactly this atom). Then we can eliminate this rulewithout changing the semantics.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 152/335

Page 153: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

What does SLDNF do on Example 2.4?

SLDNF-Resolution does not derive�not reachablepaq�!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 153/335

Page 154: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Partial EvaluationThe query “not reachablepaq” leads to the rule“reachablepaq Ð edgepa,bq,reachablepbq” and “reachablepbq”leads to “reachablepbq Ð edgepb,aq,reachablepaq”. Bothrules are definitions for reachablepaq and reachablepbq. Sowe can replace the body atoms of reachable by theirdefinitions:

reachablepaq Ð edgepa,bq, edgepb,aq,reachablepaq

reachablepbq Ð edgepb,aq, edgepa,bq,reachablepbq

that can both be eliminated by applying Principle 2.3.So we end up with a program that does neither containreachablepaq nor reachablepbq in one of the heads.Therefore, according to Principle 2.2 both atoms shouldbe considered false.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 154/335

Page 155: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Definition 2.9 (GPPE)

A semantics SEM satisfies GPPE if the followingtransformation does not change SEM:Replace a rule AÐ B�^not B� where B� contains anatom B by the rules

A �B�ztBu

�YB�

i ^ not�B�YB�

i�pi� 1, . . . ,nq

where BÐ B�i ^not B�

i (i� 1, . . . ,n) are all rules with headB.B Ð not EB Ð D,notC1

A Ð B,notC ÞÑ A Ð D,notC1,notCA Ð not E,notC

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 155/335

Page 156: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

We reconsider Example 2.5. The semantics of SLDNFcorresponds to Clark’s completion comp.

Example 2.10 (SLDNF vs. KR (revisited))

PKR : p Ð pq Ð not p

comppPKRq : p � pq � p

?-q: No (SLDNF).Yes (KR).

P1KR : p Ð p

q Ð not pr Ð not r

comppP1KRq : p � p

q � pr � r

?-p: Yes (SLDNF).No (KR).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 156/335

Page 157: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Note that any semantics SEM satsfying GPPE andElimination of Tautologies can be seen asextending SLD by doing some Loop-checking.We will call such semantics KR-semantics inorder to distinguish them from the classicalLP-semantic which are based on SLDNF orvariants of Clark’s completion comppPq:KR-Semantics = SLDNF + Loop-check.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 157/335

Page 158: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

The last principle in this section is related toSubsumption: we can get rid of non-minimalrules by simply deleting them.Principle 2.4 (Subsumption)

In a program P we can delete a ruleAÐ B�^not B� whenever there is another ruleAÐ B 1�^not B 1� with

B 1� � B� and B 1� � B�.

A Ð D,not E,not FA Ð D,not F

ÞÑ A Ð D,not F

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 158/335

Page 159: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Wellfounded Semantics: WFSWe call a semantics SEM1 weaker than SEM2, if for allprograms P and all atoms or default-atoms l the followingholds: SEM1pPq |ù l implies SEM2pPq |ù l.I.e. all (default-) atoms derivable from SEM1 with respectto P are also derivable from SEM2.

Theorem 2.11 (WFS)

There exists the weakest semantics satisfying our fourprinciples Elimination of Tautologies, Subsumption,Reduction, and GPPE. This semantics is called wellfoundedsemantics WFS.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 159/335

Page 160: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Theorem 2.12 (Confluent Calculus for WFS)

The calculus consisting of these four transformations isconfluent, i.e. whenever we arrive at an irreducibleprogram, it is uniquely determined. The order of thetransformations does not matter.For finite propositional programs, it is also stronglyterminating for fair sequences: any program P is thereforeassociated a unique normalform respPq. The wellfoundedsemantics of P can be read off from respPq as follows

WFSpPq � tA : AÐ P respPquY tnot A : A is in no head of respPqu

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 160/335

Page 161: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

What about van Gelder’s Example 2.6Here we have no problems with floundering, butusing SLDNF we get an infinite sequence ofoscillating SLD-trees (none of which finitelyfails).

WFSpPgameq � tnot winspcq,winspbq,not winspaqu

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 161/335

Page 162: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Contradictions

Some semantics associates to a program P a set of2-valued models. Such semantics satisfy

Principle 2.5 (Elimination of Contradictions)

Suppose a program P has a rule which contains the sameatom A and not A in its body. Then we can eliminate this rulewithout changing the semantics.

Contradiction: A Ð C,D,notC

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 162/335

Page 163: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Theorem 2.13 (Answer Sets)

There exists the weakest semantics satisfying our fiveprinciples Elimination of Tautologies, Subsumption,Reduction, GPPE and Elimination of Contradictions.This semantics assigns to each program P a set of answersets, also called stable models.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 163/335

Page 164: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Answer Sets

The underlying idea is that any atom in an intended modelshould have a definite reason to be true or false.Gelfond-Lifschitz transformation: for a program P and amodel N � BP we define

PN :� truleN : rule P Pu

where rule :� AÐ B1, . . . ,Bn,notC1, . . . ,notCm istransformed as follows

pruleqN :�"

AÐ B1, . . . ,Bn, if @ j : C j R N,t, otherwise.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 164/335

Page 165: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Note that PN is always a definite program. Wecan therefore compute its least Herbrand modelMPN and check whether it coincides with themodel N with which we started:Definition 2.14 (Answer Sets)

N is called an answer seta of P, if MPN � N.aNote that we only consider Herbrand models.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 165/335

Page 166: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Relationship between ASP and WFS

They are based on similar principles.Stable models N extend WFS: l PWFSpPqimplies N |ù l.If WFS(P) is two-valued, then WFS(P) is theunique stable model.

For Example 2.6 we have two stable models:twinspaq, winspcqu and twinspbq, winspcqu andtherefore

WFSpPq � twinspcq, not winspdqu �£

N a stable model of P

N .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 166/335

Page 167: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Example 2.15 (Reasoning by cases)

Psplitting : a Ð not bb Ð not ap Ð ap Ð b

Although neither a, nor b can be derived in any semanticsbased on two-valued models (as ASP for example), thedisjunction a_b, thus also p, is true. In this way theexample is handled by the SLDNF semantics, too. WFS(P),however, is empty; if the WFS cannot decide between a ornot a, then a is undefined.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 167/335

Page 168: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 2. Semantics

Example 2.16 (ASP is not Goal-Oriented)

Prelpaq : a Ð not bb Ð not a P : a Ð not b

b Ð not ap Ð not pp Ð a

Prelpaq is the subprogram of P that consists of all rules thatare relevant to answer the query ?- a. It has two stablemodels tau and tbu — a is not true in all of them. But theprogram P has the unique stable model tp,au, so a is truein all stable models of P.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 168/335

Page 169: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

2.3 Properties

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 169/335

Page 170: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

The results above also apply to disjunctive programs.Some modifications have to be made (the uniqueHerbrand model of a definite program has to be replacedby the set of all minimal modles of a positive disjunctiveprogram). We just state the following

Theorem 2.17 (Characterization of ASP)

Let SEM be a semantics for disjunctive logic programssatisfying GPPE, Elimination of Tautologies, andElimination of Contradictions.Then: SEMpPq � ASPpPq.Moreover, ASP is the weakest semantics satisfyingthese properties.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 170/335

Page 171: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Declarativeness

Lemma 2.18 (ASP is Declarative)In contrast to PROLOG, ASP programs do neither depend onthe (1) order of program clauses, nor on the (2) order ofliterals within each clause.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 171/335

Page 172: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Killer-clausesFor quite some time, the problem of ASP to handle oddloops was considered a drawback: Programs with rules ofthe form pÐ not p (and where p can not be derivedotherwise) do not possess answer sets.

Lemma 2.19 (Constraints)Suppose the program P does not contain the predicate p.Then the answer sets of the programPYtpÐ p,q1, . . .qn,r1, . . .rmu are exactly those of P exceptthe answer sets that contain tq1, . . .qnu and do not containtr1, . . .rmu.Thus adding this clause can be seen as a constraint and canbe used for efficient computation.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 172/335

Page 173: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Example 2.20 (3-colorability)Given an undirected graph, assign 3 colors to the nodes,such that no adjacent nodes have the same color.Using the predicates nodepxq, edgepx,yq we can write thefollowing program:

colorpX ,rq_ colorpX ,gq_ colorpX ,bq :� nodepXq:� edgepX ,Y q,colpX ,Cq,colpY,Cq

The first rule can also be written as follows (if nodisjunction _ is available):

colorpX ,rq :� nodepXq,not colorpX ,gq,not colorpX ,bqcolorpX ,bq :� nodepXq,not colorpX ,rq,not colorpX ,gqcolorpX ,gq :� nodepXq,not colorpX ,rq,not colorpX ,bq

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 173/335

Page 174: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Example 2.21 (Hamiltonian Path)

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 174/335

Page 175: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Definition 2.22 (NP-Search)

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 175/335

Page 176: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Definition 2.23 (Search Problem)

A search problem S is a pair xInst,tSolI : I P Instuy where1 Inst is an (infinite) set of finite objects, calledinstances, and

2 for each I, SolI is a finite set (called set of solutions).

An algorithm A solves a search problem S , if the followingholds: for each I P Inst"

A returns “No” , if SolI �H;A returns any S P SolI, otherwise.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 176/335

Page 177: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Separating Data from the Problem

We would like to separate the search problem itself fromthe representation of its instances (see Slide 30).

Definition 2.24 (Uniform Representation)

A search problem S can be represented uniformly inASP, if1 there is a finite program P,2 for each instance I P Inst a finite set MI of groundatoms (and this set can be efficiently encoded)

3 such that SolI � ASPpPYMIq or the solutions can beefficiently reconstructed from the answer sets ofPYMI.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 177/335

Page 178: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Principle 2.6 (ASP Paradigm)

The set of all answer sets of a programrepresents the solution of a problem.

nondisjunctive: The class of problems that canbe uniformly represented in ASP isNP-search.

disjunctive: The class of problems that can beuniformly represented in ASP isΣ2-search.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 178/335

Page 179: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 3. Properties

Very important properties of ASP:Variables: although there are no function

symbols, variables are allowed (but thegrounding is finite),

Predicates: also predicates are allowed andfacilitate concise formalizations,

Modularity: global models should becomposed of local components,

Semantics: there should be an intuitivemethodology to formalise problems.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 179/335

Page 180: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

2.4 ASP engines

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 180/335

Page 181: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Many links can be obtained fromWASP: Working Group on Answer SetProgramming (2001-2005)http://wasp.unime.it(FP 6: IST-FET 2001-37004)

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 181/335

Page 182: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Definition 2.25 (AnsProlognot , AnsProlog_ ,AnsProlog_ ,not )

The language AnsProlognot consists of rules of the form

AÐ B1, . . . ,Bm,notC1, . . .notCn

where A,B1, . . . ,Bm,C1, . . .Cn are positive atoms which may contain freevariables, like ppX ,Y,cq). When A is absent (resp. identical to K): thenwe call the language AnsProlognot ,K.The language AnsProlog_ consist of rules of the form

A1_ A2_ . . ._ An Ð B1, . . . ,Bm,notC1, . . .notCn

where Ai,Bi,Ci are positive atoms, which may contain free variables,like ppX ,Y,cq). Similar to the above, we define AnsProlog_ ,K.Finally the language AnsProlog_ ,not (resp. AnsProlog_ ,not ,K) consistsof rules where we allow both disjunctions in the head as well asnegations in the body.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 182/335

Page 183: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Some implementations

SModels: http://www.tcs.hut.fi/Software/smodels/

DLV: http://www.dbai.tuwien.ac.at/proj/dlv/

GnT: http://www.tcs.hut.fi/Software/gnt/

Cmodels (1, 2): http://www.cs.utexas.edu/users/tag/cmodels/

ASSAT: http://assat.cs.ust.hk/

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 183/335

Page 184: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

aspps: http://www.cs.engr.uky.edu/ai/aspps/

NoMore: http://www.cs.uni-potsdam.de/.linke/nomore/

ccalc: http://www.cs.utexas.edu/users/tag/cc/

XASP: distributed with XSB v2.6http://xsb.sourceforge.net

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 184/335

Page 185: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Disjunction: DLV is designed for fullAnsProlog_ ,not ,K, while smodels isdesigned for AnsProlognot ,K. smodelshas only primitive functionality for _.

Grounding: Both systems compute intelligentgroundings, trying to avoidunnecessary instances.

Relational DB: DLV can be seen as an extensionto SQL3 and thus has functionality foranswering SQL3 queries.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 185/335

Page 186: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Queries: DLV allows brave and cautiousreasoning: queries can be specifiedand tested for truth in in at least oneor in all answer sets.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 186/335

Page 187: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Allowedness: In smodels each variable in a rule mustoccur in a positive domain predicate on theright hand side of this rule. A domain predicateis one with the following property: each pathin the dependency graph of the programstarting with this predicate does not gothrough a negative cycle. This property is alsocalled strongly range restricted. The idea isthat domain predicates can be efficientlycomputed (no recursion through negation).In DLV this is more relaxed: each variable mustoccur in a positive predicate on the right handside.

Special Constraints: smodels allows weight and cardinalityconstraints, while DLV allows weak constraints.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 187/335

Page 188: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Arithmetic: smodels allows rules of the formppT �1q Ð ppT q.In DLV this must be written asppT 1q Ð ppT q,T 1 � T �1.

Classical Negation: In our definition of an answer set(Definition 2.14) and also in the definition ofAnsProlog_ ,not ,K, we did not allow atoms thatare classically negated. In fact, in severalformalisations we used predicates of the formnot_predicate which, intuitively represented thenegation of the predicate predicate. We did thismainly to avoid any confusion with classicalnegation.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 188/335

Page 189: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Cardinality Constraints: smodels allowscardinality constraints to ensure thatan answer set contains at least and atmost a certain number of prespecifiedatoms.

1 {a,b,notc} 2

This means that we are looking foranswer sets which contain at least onebut at most two of the atoms a,b, not c.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 189/335

Page 190: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

Formalizing Sudoku

smodels uses the following constructs:1 row(0..8) is a shorthand for row(0),row(1), ..., row(8).

2 val(1..9) is a shorthand for val(1),val(2), ..., val(9).

3 The constants 1, ..., 9 will be treated asnumbers (so there are operations available toadd, subtract or divide them).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 190/335

Page 191: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

The theoryppX,Y,5q :- rowpXq,colpYq

means that the whole grid is filled with 5’sand only with 5's: eg. ppX ,Y,1q is true for allX ,Y , as well as ppX ,Y,2q etc. because of thePrinciple 2.2 that holds for ASP.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 191/335

Page 192: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 4. ASP engines

More constructs in smodels1 { p(X,Y,A) : val(A) } 1

:- row(X), col(Y)this makes sure that in all entries of the grid,exactly one number (val()) is contained.1 { p(X,Y,A) : row(X) : col(Y)

: eq(div(X,3), div(R,3)): eq(div(Y,3), div(C,3) } 1

:- val(A), row(R), col(C)this rule ensures that in each of the 9 squareseach number from 1 to 9 occurs only once.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 192/335

Page 193: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 5. References

2.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 193/335

Page 194: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 5. References

[Brass and Dix, 1999] Stefan Brass and Jürgen Dix.Semantics of (disjunctive) logic programs based on partialevaluation.J. Log. Program., 40(1):1–46, 1999.

[Brewka and Dix, 2005] Gerhard Brewka and Jürgen Dix.Knowledge representation with extended logic programs.In D. Gabbay and F. Guenthner, editors, Handbook ofPhilosophical Logic, volume 12, chapter 1, pages 1–85. ReidelPubl., 2. edition, 2005.Shortened version also appeared in Dix, Pereira, Przymusinski(Eds.), Logic Programming and Knowledge Representation,Springer LNAI 1471, pages 1–55, 1998.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 194/335

Page 195: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 5. References

[Eiter et al., 2003] Thomas Eiter, Wolfgang Faber, Nicola Leone,Gerald Pfeifer, and Axel Polleres.A logic programming approach to knowledge-state planning, ii:The dlvk system.Artif. Intell., 144(1-2):157–211, 2003.

[Marek and Truszczynski, 1998] Victor W. Marek and MiroslawTruszczynski.Stable models and an alternative logic programming paradigm.CoRR, cs.LO/9809032, 1998.

[Niemelä, 1999] Ilkka Niemelä.Logic programs with stable model semantics as a constraintprogramming paradigm.Ann. Math. Artif. Intell., 25(3-4):241–273, 1999.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 195/335

Page 196: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

2. Answer Set Programming 5. References

[Simons et al., 2002] Patrik Simons, Ilkka Niemelä, and TimoSoininen.Extending and implementing the stable model semantics.Artif. Intell., 138(1-2):181–234, 2002.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 196/335

Page 197: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic

Chapter 3. Modal Logic

Modal Logic3.1 Reasoning about Knowledge3.2 Kripke Semantics3.3 Reasoning about Muddy Children3.4 Axioms for Modal Logics3.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 197/335

Page 198: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic

Modal logic is an extension of classical logic bynew connectiveslll and ♦♦♦: necessity andpossibility.

lllp: p is necessarily true♦♦♦p: p is possibly true

Independently of the precise definition:

♦pØ l p

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 198/335

Page 199: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic

Definition 3.1 (Modal Logic with nmodalities)

The language Lmodaln of modal logic with nmodal operators l1, . . . ,ln is the smallest setcontaining the propositional constants of L, andwith formulae ϕ,ψ also the formulaeliϕ, ϕ,ϕ^ψ. We treat _,Ñ,Ø,♦ as macros(defined as usual).

Note that the l operators can be nested:

pl1l2l1pq _ l3 p

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 199/335

Page 200: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic

Modal logic can be translated to classical logic;

. . . but it looks horribly UGLY then;

. . . and in most cases it’s not automatizableany more.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 200/335

Page 201: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic

Good to know:MSPASS is a theorem prover implementingmany modal logics,also description logics, relational calculus, etcbuilt upon SPASS, a resolution prover forfirst-order logic with equality,check outhttp://www.cs.man.ac.uk/~schmidt/mspass/.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 201/335

Page 202: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

3.1 Reasoning about Knowledge

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 202/335

Page 203: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Example 3.2 (Muddy children – Shoham’s version)A group of n children enters the house after having playedin the mud outside. They are greeted by their father, whonotices that k of them have mud on their foreheads (no kidcan see whether she herself has a muddy forehead, butthey can see all other foreheads).Can the kids determine by pure thinking wether theyhave a muddy forehead?The father announces: At least one of you has mud onher forehead.He also says If you know (can prove) that your forehead ismuddy, then raise your hands now.Nothing happens. The father keeps repeating thequestion.After exactly k rounds, all the children with muddyforeheads raise their hands.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 203/335

Page 204: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

How is that possible? The announcement of thefather does not reveal anything, or does it?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 204/335

Page 205: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Definition 3.3 (Partition Model)

An n-agent partition model over language L is a tuple

xW ,I1, . . . ,Iny, where

W : a set of possible worlds;w PW : an L-structure (each L sentence ϕ is either true

or false in w);Ii: each Ii is a partition ofW :

Ii � tWi1,Wi2, . . . ,Wiru withWi j XWik �H forj � k and

�1¤ j¤r Wi j �W .

The worlds inW can be propositional valuations or evenfirst-order structures. In this lecture, we will mainlyconsider the propositional version.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 205/335

Page 206: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Additionally we define:Iipwq: all worlds in partition Ii containingworld w

Iipwq :� tw1 : w PWi j and w1 PWi ju

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 206/335

Page 207: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Example: Robots and Carriage

1 2

1

2

1

2

pos0

pos1pos2

1 2

1

2

1

2

pos0

pos1pos2

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 207/335

Page 208: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Example: Robots and Carriage

1 2

1

2

1

2

pos0

pos1pos2

1 2

1

2

1

2

pos0

pos1pos2

1 2

1

2

1

2

pos0

pos1pos2

q0

q2 q1

pos0

pos1pos2

q0

q2 q1

1pos0

pos1pos2

q0

q2 q1

1 2pos0

pos1pos2

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 208/335

Page 209: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

How can we formalise the notion of one agentknowing something? And reason about whatagents know and draw conclusions?

We introduce new operators Ki

Kiϕ: “agent i knows that ϕ holds”

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 209/335

Page 210: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Definition 3.4 (Semantics for partition models)

Let A � pW ,I1, . . . ,Inq be an n-agent partitionmodel over L.for ϕ P L: A ,w |ù ϕ if and only if w |ù ϕ,A ,w |ùKiϕ if and only if for all worlds w1, ifw1 P Iipwq then A ,w1 |ù ϕ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 210/335

Page 211: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 1. Reasoning about Knowledge

Example: Robots and Carriage

q0

q2 q1

1 2pos0

pos1pos2

pos1 Ñ K1pos1pos2 Ñ K1pos2pos2 Ñ K1 pos1pos2 Ñ K2K1 pos1pos2 Ñ K1K2K1 pos1

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 211/335

Page 212: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

3.2 Kripke Semantics

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 212/335

Page 213: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

A slight generalisation of partition models leadsto Kripke semantics.

How can one look at a partition model? It is likea set of equivalence classes: for agent i, allworlds in one partition are equivalent.

So let’s generalise and introduce a binaryrelation R on all worlds: w1Rw2 meaning thatworld w2 can be accessed (is reachable) fromworld w1.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 213/335

Page 214: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

Definition 3.5 (Kripke Structure)

A Kripke structurexW ,Ry

is a set of possible worldsW plus a binary relationR�W �W (the accessibility relation)

Note that:Elements ofW are now abstract entities: we assumeno internal structure to them!Still, we would usually like to see them as classical(e.g., propositional) models. How can it be done?Let Π be the set of all propositional symbols. Apropositional model can be represented with a list ofpropositions πpwq �Π that hold in world w.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 214/335

Page 215: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

Definition 3.6 (Kripke Model / Possible World Model)

The truth of formulae is evaluated with respectto a Kripke model (possible world model):

xW ,R,πy,

that is, a Kripke structure plus a valuation ofpropositions π : W Ñ P pΠq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 215/335

Page 216: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

Definition 3.7 (Kripke Semantics of Modal Logic)

Given a Kripke model M � xW ,R,πy, and a worldw PW , we define the satisfaction relation |ù asfollows:

M,w |ù p iff p P πpwqM,w |ù ϕ^ψ iff M,w |ù ϕ and M,w |ù ψ

M,w |ù ϕ iff not M,w |ù ϕ

M,w |ùlϕ iff for every w1 PW with wRw1 wehave that M,w1 |ù ϕ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 216/335

Page 217: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

What if we want multiple modalitiesl1, . . . ,lk?

Then, we need multiple accessibility relationsR1, . . . ,Rk �W �W , one per modality.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 217/335

Page 218: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

Definition 3.8 (Kripke Semantics of Multi-modal Logic)

Given a Kripke model M � xW ,R1, . . . ,Rk,πy, anda world w PW , we define:

M,w |ùliϕ iff for every w1 PW with wRiw1 wehave that M,w1 |ù ϕ.

For knowledge modalities Ki, we assume thatthe corresponding relation Ri is anequivalence.Note: Ki is a “modal box” operator!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 218/335

Page 219: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 2. Kripke Semantics

Example: Robots and Carriage

21q0

q2 q1

pos0

pos1pos2

1q0

q2 q1

pos0

pos1pos2

q0

q2 q1

pos0

pos1pos2

1 1

2q0

q2 q1

1 1

pos0

pos1pos2

q0

q2 q1

1 1

22

pos0

pos1pos2

pos1 Ñ K1pos1pos2 Ñ K1pos2pos2 Ñ K1 pos1pos2 Ñ K2K1 pos1pos2 Ñ K1K2K1 pos1

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 219/335

Page 220: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 3. Reasoning about Muddy Children

3.3 Reasoning about MuddyChildren

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 220/335

Page 221: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 3. Reasoning about Muddy Children

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

mm

c

mm

c

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c

mm

m

mm

m

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

mc

m

3

3

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

mud1 P πpwq iff w� mxxmud2 P πpwq iff w� xmxmud3 P πpwq iff w� xxm

M,mmc |ùmud1^mud2^ mud3

M,mmc |ù K1mud1^K1mud2

M,mmc |ù K1K3mud2^K1 K2mud2

. . .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 221/335

Page 222: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 3. Reasoning about Muddy Children

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

3

3

1

2

mm

c

mm

c

mm

m

mm

m1

2

cm

m

cm

m

mc

m1

2

3

3

3

mm

c

mm

c

mm

m

mm

m1

2

cm

m

cm

m

mc

m

Father: “At least one of you is muddy” K1mud1^ K2mud2^ K3mud3

Father: “If you know that you’remuddy, raise your hand”

Nothing happensK1mud1^K2mud2^ K3mud3

Father: “If you know that you’remuddy, raise your hand”

1 and 2 raise their hands!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 222/335

Page 223: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 4. Axioms for Modal Logics

3.4 Axioms for Modal Logics

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 223/335

Page 224: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 4. Axioms for Modal Logics

As in classical logic, one can ask about acomplete axiom system. Is there a calculus thatallows to derive all sentences true in all Kripkemodels?

Definition 3.9 (System K)

The system K is an extension of the propositionalcalculus by the axiom

Axiom K plϕ^lpϕÑ ψqq Ñlψ

and the inference rule

(Necessitation)ϕ

lϕ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 224/335

Page 225: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 4. Axioms for Modal Logics

Theorem 3.10 (Soundness/completeness of System K)

System K is sound and complete with respect toarbitrary Kripke models.

If we allow nmodalities, the theorem as well asthe definitions extend in an obvious way. Thecalculus is then called System Kn to account forthe nmodalities.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 225/335

Page 226: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 4. Axioms for Modal Logics

Note that we have not assumed anyproperties of the accessibility relation R: it isjust any binary relation.

Assuming that R is an equivalence relation,what additional statements (axioms) are truein all Kripke models?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 226/335

Page 227: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 4. Axioms for Modal Logics

Definition 3.11 (Extending K by Axioms D, T, 4,5)The system K is often extended by (a subset of) thefollowing axioms:

K pKiϕ^KipϕÑ ψqq ÑKiψ [logical omniscience]D Kipϕ^ ϕq [consistency]T KiϕÑ ϕ [truth]4 KiϕÑKiKiϕ [positive introspection]5 KiϕÑKi Kiϕ [negative introspection]

The system consisting of KT45 is also called S5.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 227/335

Page 228: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 4. Axioms for Modal Logics

Theorem 3.12 (Sound/complete Subsystems of KDT45)

Let X be any subset of tD,T,4,5u and let X be anysubset of tserial,re f lexive, transitive,euclideanucorresponding to X.Then KYX is sound and complete with respect toKripke structures the accessibility relation of whichsatisfies X .

Corollary 3.13 (Sound-, completeness of KT45 (S5))

System KT45 is sound and complete with respectto Kripke structures with equivalence accessibilityrelations.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 228/335

Page 229: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

3.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 229/335

Page 230: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

[aqvist84] Åqvist, L. (1984).Deontic logic.In D. M. Gabbay and F. Guenther (Eds.), Handbook ofPhilosophical Logic, Vol II, pp. 605–714. Reidel.

[Fagin et al. 1995] Fagin, R., Halpern, J. Y., Moses, Y. & Vardi, M. Y.Reasoning about Knowledge.MIT Press: Cambridge, MA.

[fipa] Foundation for Intelligent Physical Agents.FIPA home page.http://www.fipa.org/.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 230/335

Page 231: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

[fipa-acl] Foundation for Intelligent Physical Agents (2002).FIPA ACL message structure specification.Approved for standard, 2002-12-06.http://www.fipa.org/specs/fipa00061/.

[HiDBoHoMe98] Hindriks, K. V., F. S. de Boer, H. Hoek, and J.-J. C.Meyer (1998).Formal semantics of the core of AGENT-0.In ECAI’98 Workshop on Practical Reasoning and Rationality, pp.20–29.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 231/335

Page 232: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

[kripke63b] Kripke, S. (1963a).Semantical analysis of modal logic I. Normal propositionalcalculi.Zeitschrift fur math. Logik und Grundlagen der Mathematik 9,67–96.

[kripke63a] Kripke, S. (1963b).Semantical considerations on modal logic.Acta Philosophica Fennica 16, 83–94.

[kripke65] Kripke, S. (1965).Semantical analysis of modal logic II. Non-normal modalpropositional calculi.In Addison, Henkin, and Tarski (Eds.), The theory of models,Amsterdam, North-Holland, pp. 206–220.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 232/335

Page 233: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

[mascardi02] Mascardi, V. (2002).Logic-Based Specification Environments for Multi-Agent Systems.Ph. D. thesis, Computer Science Department of GenovaUniversity, Genova, Italy.DISI-TH-2002-04.

[MascardiMS04] Mascardi, V., M. Martelli, and L. Sterling (2004).Logic-based specification languages for intelligent softwareagents.TPLP 4(4), 429–494.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 233/335

Page 234: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

[Parunak-odell] Odell, J., H. V. D. Parunak, and B. Bauer (2000a).Extending UML for agents.In G. Wagner, Y. Lespérance, and E. Yu (Eds.), Proceedings of the2nd Workshop on Agent-Oriented Information Systems (AOIS’00).Held in conjunction with 17th National conference on ArtificialIntelligence (AAAI’00), pp. 3–17.

[aose54] Odell, J., H. V. D. Parunak, and B. Bauer (2000b).Representing agent interaction protocols in UML.In P. Ciancarini and M. Wooldridge (Eds.), Proceedings of the 1stInternational Workshop on Agent-Oriented Software Engineering(AOSE’00), pp. 121–140. Springer-Verlag.LNCS 1957.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 234/335

Page 235: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

3. Modal Logic 5. References

[vonWright51] von Wright, G. H. (1951).Deontic logic.Mind 60, 1–15.Reprinted in G. H. von Wright, Logical Studies, pp. 58–74.Routledge and Kegan Paul, 1957.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 235/335

Page 236: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time

Chapter 4. Logics of Action andTime

Logics of Action and Time4.1 Dynamic Logic4.2 Temporal Logic4.3 Linear Time Logic4.4 Computation Tree Logic4.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 236/335

Page 237: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time

Modal logic is a generic framework.

Various modal logics:knowledge epistemic logic,beliefs doxastic logic,obligations deontic logic,actions dynamic logic,time temporal logic,ability strategic logic,and combinations of the above

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 237/335

Page 238: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time

Until now:Several operators Ki, each definesan epistemic/doxastic relation onworlds.Description of static systems: nopossibility of change

But:computational systems aredynamic!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 238/335

Page 239: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 1. Dynamic Logic

4.1 Dynamic Logic

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 239/335

Page 240: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 1. Dynamic Logic

1st idea: Consider actions or programs α. Eachsuch α defines a transition (accessibilityrelation) from worlds into worlds.

2nd idea: We need statements about theoutcome of actions:rαsϕ: “after every execution of α,ϕ holds,xαyϕ: “after some executions of α,ϕ holds.

As usual, xαyϕ� rαs ϕ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 240/335

Page 241: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 1. Dynamic Logic

3rd idea: Programs/actions can be combined(sequentially, nondeterministically,iteratively), e.g.:rα;βsϕ

would mean “after every execution ofα and then β, formula ϕ holds”.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 241/335

Page 242: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 1. Dynamic Logic

Definition 4.1 (Labelled Transition System)

A labelled transition system is a pair

xQ,tαÝÑ: α P Luy

where Q is a non-empty set of states and L is anon-empty set of labels and for each α P L:

αÝÑ� Q�Q.

Definition 4.2 (Dynamic Logic: Models)

A model of propositional dynamic logic is givenby a labelled transition systems and anevaluation of propositions.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 242/335

Page 243: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 1. Dynamic Logic

Definition 4.3 (Semantics of DL)

M ,s |ù rαsϕ iff for every t such that s αÝÑ t, we

haveM , t |ù ϕ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 243/335

Page 244: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 1. Dynamic Logic

q0 q1

haltstart

waittry

wait

q0 q1

haltstart

waittry

wait

startÑ xtryyhaltstartÑ rtryshalt

startÑ xtryyrwaitshalt

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 244/335

Page 245: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

4.2 Temporal Logic

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 245/335

Page 246: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Ideas:The accessibility relation can be seen asrepresenting time.time: linear vs. branching

start

start

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 246/335

Page 247: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Typical temporal operators

lϕ ϕ is true in the next moment in timelϕ ϕ is true in all future moments♦ϕ ϕ is true in some future momentϕU ψ ϕ is true until the moment when ψ

becomes true

sendpmsg, rcvrq Ñ ♦receivepmsg, rcvrq

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 247/335

Page 248: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Temporal logic was originally developed in orderto represent tense in natural language.

Within Computer Science, it has achieved asignificant role in the formal specification andverification of concurrent and distributedsystems.

Much of this popularity has been achieved as anumber of useful concepts can be formally, andconcisely, specified using temporal logics, e.g.

safety propertiesliveness propertiesfairness properties

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 248/335

Page 249: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Safety:“something bad will not happen”“something good will always hold”

Typical examples:

l bankruptlpfuelOK_ lfuelOKqand so on . . .

Usually: l ....

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 249/335

Page 250: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Liveness:“something good will happen”

Typical examples:

♦rich

rocketLondonÑ ♦rocketParis

and so on . . .

Usually: ♦....

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 250/335

Page 251: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Combinations of safety and liveness possible:

♦lrich

l♦rich fairness

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 251/335

Page 252: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 2. Temporal Logic

Strong fairness:“if something is attempted/requested, thenit will be successful/allocated”

Typical examples:lpattempt Ñ ♦successq

l♦attempt Ñ l♦success

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 252/335

Page 253: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

4.3 Linear Time Logic

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 253/335

Page 254: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

Linear Time: LTL

LTL: Linear Time LogicReasoning about a particular computation ofa systemTime is linear: just one possible future path isincluded!Models: paths

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 254/335

Page 255: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

Definition 4.4 (Models of LTL)

A model of LTL is a sequence of time moments(states). We call such models paths, and denotethem by λ.Evaluation of atomic propositions at particulartime moments is also needed.

Notation:λris: ith time momentλri . . . js: all time moments between i and jλri . . .8s: all timepoints from i on

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 255/335

Page 256: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

Important: computational vs. behavioral structure

System Computational str.

1 2

1

2

1

2

pos0

pos1pos2

q0

q2 q1

pos0

pos1pos2

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 256/335

Page 257: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

Important: computational vs. behavioral structure

Computational str. Behavioral str.

q0

q2 q1

pos0

pos1pos2

q0

q q0 0

q q q0 0 1

....

pos0

pos0

pos1

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 257/335

Page 258: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

LTL models are defined as behavioral structures!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 258/335

Page 259: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

Definition 4.5 (Semantics of LTL)

λ |ù p iff p is true at moment λr0s;λ |ù lϕ iff λr1..8s |ù ϕ;λ |ù ♦ϕ iff λri..8s |ù ϕ for some i¥ 0;λ |ùlϕ iff λri..8s |ù ϕ for all i¥ 0;λ |ù ϕU ψ iff λri..8s |ù ψ for some i ¥ 0, and

λr j..8s |ù ϕ for all 0¤ j ¤ i.

Note that:lϕ� ♦ ϕ

♦ϕ� l ϕ

♦ϕ� JU ϕ

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 259/335

Page 260: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�'�'

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�'[0]�'[0]

λ |ù ♦pos1

λ1 � λr1..8s |ù pos1pos1 P πpλ1r0sq

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 260/335

Page 261: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 3. Linear Time Logic

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�[0.. ]��[0.. ]�

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�[0.. ]��[0.. ]�

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�[1.. ]��[1.. ]�

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�[1.. ]��[1.. ]�

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�[2.. ]��[2.. ]�

q0

....

pos0

q1

pos1

q2

pos2

q0

pos0

q1

pos1

q2

pos2

�[2.. ]��[2.. ]�

λ |ùl♦pos1

λr0..8s |ù ♦pos1λr1..8s |ù ♦pos1λr2..8s |ù ♦pos1

. . .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 261/335

Page 262: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

4.4 Computation Tree Logic

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 262/335

Page 263: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Branching Time: CTL

CTL: Computation Tree Logic.Reasoning about possible computations of asystemTime is branching: we want all alternativepaths included!Models: states (time points, situations),transitions (changes)Paths: courses of action, computations.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 263/335

Page 264: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Path quantifiers: A (for all paths), E (there isa path);Temporal operators: l(nexttime), ♦(sometime), l (always) and U (until);

“Vanilla” CTL: every temporal operator mustbe immediately preceded by exactly one pathquantifier;CTL*: no syntactic restrictions;Reasoning in “vanilla” CTL can beautomatized.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 264/335

Page 265: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Definition 4.6 (CTL models: transition systems)

A transition system is a pair

xQ,ÝÑy

where:Q is a non-empty set of states,ÝÑ� Q�Q is a transition relation.

Note that, formally, transition relation is just amodal accessibility relation.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 265/335

Page 266: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Important: computational vs. behavioral structure

Computational str. Behavioral str.

q0

q2 q1

pos0

pos1pos2

q0

q q0 0 q q0 1

q q q0 1 1 q q q0 1 2q q q0 0 0 q q q0 0 1

.... ....

pos0

pos0

pos0 pos1

pos1

pos1

pos2

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 266/335

Page 267: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

CTL models are defined as computationalstructures!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 267/335

Page 268: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Definition 4.7 (Paths in a model)

A path λ is an infinite sequence of states that canbe effected by subsequent transitions.A path must be full, i.e. either infinite, or endingin a state with no outgoing transition.

Usually, we assume that the transition relation isserial (time flows forever).Then, all paths are infinite.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 268/335

Page 269: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Example: Rocket and Cargo

A rocket and a cargo,The rocket can be moved between London(proposition roL) and Paris (proposition roP),The cargo can be in London (caL), Paris (caP),or inside the rocket (caR),The rocket can be moved only if it has its fueltank full (fuelOK),When it moves, it consumes fuel, and nofuelholds after each flight.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 269/335

Page 270: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Example: Rocket and Cargo

nofuelroL

caR

fuelOK nofuel fuelOK

nofuel fuelOK nofuel fuelOK

nofuel fuelOK nofuel fuelOK

1

5 6

2

3 4

87

9 10 1211

roL roP

roL roL

roLroL

roP

roP roP

roP

roP

caL caL caLcaL

caR caR caR

caP caP caP caP

roLÑ E♦roP

AlproL_ roPq

roLÑ A jproPÑ nofuelq

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 270/335

Page 271: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Definition 4.8 (Semantics of CTL*: state formulae)

M,q |ù Eϕ iff there is a path λ, starting from q,such that M,λ |ù ϕ;

M,q |ù Aϕ iff for all paths λ, starting from q, wehave M,λ |ù ϕ.

Definition 4.9 (Semantics of CTL*: path formulae)

Exactly like LTL!M,λ |ù lϕ iff M,λr1...8s |ù ϕ;M,λ |ù ϕU ψ iff M,λri...8s |ù ψ for some i ¥ 0,

andM,λr j...8s |ù ϕ for all 0¤ j ¤i.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 271/335

Page 272: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Example: Rocket and Cargo

nofuelroL

caR

fuelOK nofuel fuelOK

nofuel fuelOK nofuel fuelOK

nofuel fuelOK nofuel fuelOK

1

5 6

2

4

87

9 10 1211

roL roP

roL roL

roLroL

roP

roP roP

roP

roP

caL caL caLcaL

caR caR caR

caP caP caP caP

3

E♦caP

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 272/335

Page 273: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Exercise:

How to express that there is no possibility of adeadlock?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 273/335

Page 274: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 4. Computation Tree Logic

Practical Importance of Temporal and Dynamic Logics:

Automatic verification in principle possible(model checking).Can be used for automated planning.Executable specifications can be used forprogramming.

Note:

When we combine time (actions) withknowledge (beliefs, desires, intentions,obligations...), we finally obtain a fairly realisticmodel of MAS.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 274/335

Page 275: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 5. References

4.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 275/335

Page 276: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

4. Logics of Action and Time 5. References

[Emerson 1990] E. A. Emerson.Temporal and modal logic.Handbook of Theoretical Computer Science, volume B, 995–1072.Elsevier, 1990.

[Fisher 2006] Fisher, M. (2006).Temporal Logics.Kluwer.

[Huth00] Huth, M. & Ryan, M.Logic in Computer Science: Modeling and reasoning aboutsystems.Cambridge University Press.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 276/335

Page 277: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time

Chapter 5. CombiningKnowledge and Time

Combining Knowledge and Time5.1 CTLK5.2 Interpreted Systems5.3 BDI5.4 What’s the Use?5.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 277/335

Page 278: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time

We have seen how to model belief,knowledge, time and action using modallogic.How about combining them?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 278/335

Page 279: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 1. CTLK

5.1 CTLK

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 279/335

Page 280: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 1. CTLK

Simple idea: straightforward combination oftemporal and epistemic logic.Language includes both kinds of operatorsModels include both kinds of modal relationsSemantics: union of semantic clauses

Example:

CTLK = CTL + Knowledge

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 280/335

Page 281: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 1. CTLK

Muddy Children revisited

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m

mc

m1

2

3

3

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m

mc

m1

2

3

3

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m

mc

m1

2

3

3

3

mm

c

mm

c

mm

m

mm

m1

2

cm

m

cm

m

mc

m

mc

m

3

1

2

mm

c

mm

c

cm

c

cm

c

cc

c

cc

c

mc

c

mc

c1

2

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m1

2

3

33

3

1

2

mm

c

mm

c

cm

c

cm

c

mc

c

mc

c

mm

m

mm

m1

2

cm

m

cm

m

cc

m

cc

m

mc

m

mc

m1

2

3

3

3

mm

c

mm

c

mm

m

mm

m1

2

cm

m

cm

m

mc

m

mc

m

mudi Ñ E♦Kimudi

mudi Ñ Al Ki mudi

mudi Ñ Alp Ki mudi^ Kimudiq

mudi Ñ KiE♦Kimudi

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 281/335

Page 282: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 1. CTLK

Robots and Carriage revisited

q0

q2 q1

pos0

pos1pos2

1

2

E♦p�

i K1posi^�

i K2posi^�

i K3posiq

Ep♦�

i K1posi^♦�

i K2posi^♦�

i K3posiqNote: the latter is a CTLK* property!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 282/335

Page 283: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 2. Interpreted Systems

5.2 Interpreted Systems

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 283/335

Page 284: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 2. Interpreted Systems

More grounded notion of epistemic stateGlobal states are tuples of local statesQi: set of local states of agent iGlobal states: Q� Q1��� ��Qk�QenvEpistemic relations are based on local states:

xq1, ...,qky �i xq11, ...,q1ky iff qi � q1i

Temporal dimension: runs (paths)

Interpreted systems have been applied tomodeling of synchrony and asynchrony,perfect recall, message passing systems,knowledge bases, distributed systems etc.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 284/335

Page 285: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 2. Interpreted Systems

Definition 5.1 (System)

A system is a set of runs.

Note: a set of runs can be as well seen as abranching-time tree!

Definition 5.2 (Interpreted system)

An interpreted system I is a set of runs R plusvaluation of propositions: π : QÑ P pΠq.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 285/335

Page 286: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 2. Interpreted Systems

Reasoning about dynamics of knowledge:LTL+KnowledgeFormulae evaluated wrt time points xr,my: arun r plus a time moment mThat is,W � R �NEpistemic equivalence between points:

xr,my �i xr1,m1y iff rm �i r1m1

Knowledge interpreted as before:I ,r,m |ù Kiϕ iff I ,r1,m1 |ù ϕ for every xr1,m1ysuch that xr,my �i xr1,m1y

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 286/335

Page 287: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 2. Interpreted Systems

Interpretation of LTL operators:I ,r,m |ù lϕ iff I ,r,m�1 |ù ϕ,I ,r,m |ù ϕU ψ iff I ,r,m1 |ù ψ for some m1 ¡ mand I ,r,m2 |ù ϕ for all m2 such thatm¤ m2   m1.

What about path quantifiers?

I ,r,m |ù Eϕ iff there is r1 such thatr1r0...ms � rr0...ms and I ,r1,m |ù ϕ

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 287/335

Page 288: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

5.3 BDI

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 288/335

Page 289: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

BDI = Beliefs, Desires, and Intentions

BDI according to Cohen and Levesque:Mental primitives: beliefs and goals,Separate operators and relations for eachagent

Time and action: LTL and DL.

Altogether: multi-modal logic

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 289/335

Page 290: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

Operator MeaningBeliϕ agent i believes ϕ

Goaliϕ agent i has goal of ϕ©©©α action α will happen nextDoneα action α has just happened

Additionally:Action constructors “;” and “?”, as in DL;Derived operators: ♦α (sometime α), lα

(always α), pLaterϕq: strict sometime,pBeforeϕ , ψq: ϕ holds before ψ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 290/335

Page 291: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

Examples:

Goalcitizenlsafecitizen

GoalpoliceBelcitizenlsafecitizen

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 291/335

Page 292: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

BDI according to Rao and Georgeff:Mental primitives: beliefs, desires andintentionsTime: CTLSophisticated semantic structure

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 292/335

Page 293: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

Example: Card Play

win

AK1

q0 q0

AQ1

AK2QK2 AQ2 KQ2 win

hasA hasA

hasA hasAwin

AK1

q0

AK2

hasA

hasA

Ba

q0

AQ1

win KQ2

hasA

hasA

Bopt Bopt

DaDa

W1

W2

W3

W4

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 293/335

Page 294: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

BelaE lwin : Agent A believes that there is away to win in one stepDesaA

lwin : the agent desires that everypath leads to a victory, so he does not have toworry about his decisionsHowever, he does not believe it is possible: BelaA lwin

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 294/335

Page 295: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 3. BDI

Of course, it is possible to extend BDI:

horizontally: with other modal dimensions(e.g., BOID);

vertically: to a language of higher order (e.g.,LORA).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 295/335

Page 296: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 4. What’s the Use?

5.4 What’s the Use?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 296/335

Page 297: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 4. What’s the Use?

What do we use these frameworks for?

Analysis & Design

Modeling systems (the frameworks provideintuitive conceptual structures, and asystematic approach);Specifying desireable properties of systems.

Verification & Exploration

Reasoning about concrete systems;Correctness testing.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 297/335

Page 298: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 4. What’s the Use?

What do we use these frameworks for?

Automatic Generation of Behaviours

Programming with executable specifications;Automatic planning.

Philosophy of Mind and Agency

Characterization of mental attitudes;Discussion of rational agents;Testing rationality assumptions.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 298/335

Page 299: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 4. What’s the Use?

Beware!

Not all modal dimensions are independent!

Example: abilities and knowledge

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 299/335

Page 300: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 5. References

5.5 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 300/335

Page 301: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 5. References

[Broersen et al., 2001a] Broersen, J., Dastani, M., Huang, Z., andvan der Torre, L. (2001a).The BOID architecture: conflicts between beliefs, obligations,intentions and desires.In Müller, J., Andre, E., Sen, S., and Frasson, C., editors,Proceedings of the Fifth International Conference on AutonomousAgents, pages 9–16. ACM Press.

[Cohen and Levesque, 1990] Cohen, P. and Levesque, H. (1990).Intention is choice with commitment.Artificial Intelligence, 42:213–261.

[Fagin et al. 1995] Fagin, R., Halpern, J. Y., Moses, Y. & Vardi, M. Y.Reasoning about Knowledge.MIT Press: Cambridge, MA.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 301/335

Page 302: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

5. Combining Knowledge and Time 5. References

[Rao and Georgeff1991] Rao, A. S. and M. Georgeff (1991).Modeling Rational Agents within a BDI-Architecture.In J. F. Allen, R. Fikes, and E. Sandewall (Eds.), Proceedings of theInternational Conference on Knowledge Representation andReasoning, Cambridge, MA, pp. 473–484. Morgan Kaufmann.

[Wooldridge, 2000] Wooldridge, M. (2000).Reasoning about Rational Agents.MIT Press: Cambridge, Mass.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 302/335

Page 303: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux

Chapter 6. Knowledge in Flux

Knowledge in Flux6.1 Revising or Updating Beliefs?6.2 Updates of Logic Programs6.3 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 303/335

Page 304: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux

We have seen in the first lecture that although logicitself is static, it can be made dynamic with thesituation calculus: terms denote situations.Now we introduce the machinery of belief revision.Again, we take an abstract point of view andinvestigate which properties should (or not) besatisfied for a revision operator �: the AGM approach.While belief revision is suitable for changes in a staticworld, it is not for describing dynamically changingworlds: Updating is based on different principles.Both belief revision and updating are not well suitedfor nonmonotonic logics. Therefore we present amethod for updates of logic programs and a languageto express them.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 304/335

Page 305: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

6.1 Revising or Updating Beliefs?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 305/335

Page 306: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

The AGM approach

AGM: Alchourron/Gärdenfors/Makinson.Seminal paper in 1985: [Alchourrón et al.,1985].

Given: A (propositional or first-order) theory K, andsome new information φ.

Wanted: A revision operator � that revises a set ofbeliefs K in the light of new information φ.

Problem: If K |ù φ, then we have no problems:K �φ�CnpKq.If φ is consistent with K, then we can simplydefine K �φ�CnpKYtφuq.What to do when K |ù φ?

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 306/335

Page 307: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Example 6.1 (Swans: white or black?)α: All European swans are white.β: The bird caught in the trap is a swan.γ: The bird caught in the trap comes from Sweden.δ: Sweden is part of Europe.ε: The bird caught in the trap is white.

ε can be derived from the rest.Now we discover that the bird caught in the trap isblack!

That means we want to revise tα,β,γ,δu by ε.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 307/335

Page 308: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Shall we give up α but keep some of itsconsequences:

All European swans except the caught in thetrap are white.All European swans except some of theswedish are white.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 308/335

Page 309: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Some assumptions

Closure: Belief sets K are logically closed:K �CnpKq.

Expansion: Add a sentence φ to K.K�φ :� tψ : KYtφu |ù ψu.

Contraction: Remove a sentence φ from K.K�φ: difficult! Principle of economy:no belief should be given upunneccessarily.

Revision: Revise K by φ. We assume that foreach K and φ there is a unique K �φ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 309/335

Page 310: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Axioms about �

K �1: CnpK �φq � K �φ

K �2: φ P K �φ

K �3: K �φ� K�φ

K �4: If φ R K then K�φ� K �φ.K �5: K �φ is inconsistent if and only if φ is a

tautology.K �6: If |ù φØ ψ then K �φ� K �ψ.K �7: K � pφ^ψq � pK �φq�ψqK �8: If ψ R K �φ, then

pK �φq�ψq � K � pφ^ψq.Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 310/335

Page 311: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Axioms about �

K�1: CnpK�φq � K�φ

K�2: K�φ� KK�3: If φ R K then K�φ� K.K�4: If not |ù φ then φ R K�φ.K�5: If φ P K then K � pK�φq�φ.K�6: If |ù φØ ψ then K�φ� K�ψ.K�7: pK�φqXpK�ψq � K� pφ^ψq.K�8: If φ R K� pφ^ψq, then

K� pφ^ψq � K�ψ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 311/335

Page 312: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Interdefinability of � and �

Harper identity: Define � using �:K�φ� pK � φqXK

Levi identity: Define � using �:K �φ� pK� φq�φ

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 312/335

Page 313: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Are our choices correct?

Theorem 6.2 (From � to � and back)

If a contraction function � satisfies K�1–K�4and K�6, then the revision function � defined bythe Levi identity satisfies K �1–K �6. If in additionK�7 or K�8 is satisfied, then so are K �7 or K �8.

If a revision function � satisfies K �1-K �6, thenthe contraction function � defined by the Harperidentity satisfies K�1-K�6. If in addition K �7 orK �8 is satisfied, then so are K�7 or K�8.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 313/335

Page 314: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Problems with AGM (1)

Belief set vs base: Up to now: K �CnpKq. Butbeliefs are usually given by a finite setonly (a base). So there are basic beliefswhich, should be more persistent thanderived beliefs.

Katsuno/Mendelzon consider thenotion of a base, represented by onesingle formula and use anotheroperator � to distinguish it from �:

ψ�µ Ñ φ iff φ PCnptψuq �µ

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 314/335

Page 315: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Lemma 6.3 ([Katsuno and Mendelzon, 1992])

AGM postulates pK �1q�pK �8q formulated forfinite sets (bases) are equivalent to thefollowing1 ψ�µÑ µ,2 If ψ^µ is satisfiable then ψ�µØ ψ^µ.3 If µ is satisfiable then ψ�µ is also satisfiable.4 If ψØ ψ1 and µØ µ1 then ψ�µØ ψ1^µ1.5 pψ�µq^φ Ñ ψ� pµ^φq

6 If pψ�µq^φ is satisfiable, thenψ� pµ^φq Ñ pψ�µq^φ.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 315/335

Page 316: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Problems with AGM (2)

Revision vs update: Distinguish new informationabout a static world (revision) fromnew information on changes broughtabout by an agent (updating).

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 316/335

Page 317: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Example 6.4 (Updating [Winslett, 1988])

1 There is a book, a table and a magazine.2 β: the book is on the table.3 µ: the magazine is on the table.4 Not both are on the table.

Then a robot is ordered to put the book on thetable. According to K �4, we should end up inthe state Cnptβ, µuq. But why conclude thatthe magazine is not on the table?

This is a dynamically changing world.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 317/335

Page 318: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 1. Revising or Updating Beliefs?

Revision vs updates

We distinguish between revising a static worldand updating a dynamically changing world:Updating does not satisfy K �4.

However, updating satisfies the following:

pα^α1qfφ� pαfφq^pα1fφq

which is not valid in the AGM approach.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 318/335

Page 319: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

6.2 Updates of Logic Programs

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 319/335

Page 320: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

A logic program represents a static world. Byadding new facts, some dynamic change canbe incorporated, but only to a limited extent.What, if new knowledge emerges, that forcesus to change the underlying program? Thiscan be seen as an update of the program.Why not simply applying the theory of beliefrevision or updates (last section)? Theupdate theory does not work well fornonmonotonic semantics!

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 320/335

Page 321: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

In this subsection we discuss the work of [Alferes et al.,2002], [Alferes and Pereira, 2002], [Leite et al., 2001], [Alferes et al.,

2004].They have developed a language to formulateknowledge updates, LUPS.They have also developed a theory of dynamic logicprogramming: given a sequence of logic programs Pi,what is the semantics of the program P1`P2` . . .`Pn,the update of P1 by the successive updates P2, . . .Pn?The semantics of LUPS is reduced to the semantics ofP1`P2` . . .`Pn. This latter construction is out of thescope of this lecture. We concentrate on formulatinglogic program updates.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 321/335

Page 322: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

Example 6.5 ([Alferes et al., 2002])

Consider the logic program

f ree Ð not jailjail Ð abortion

We update this program with the newinformationU1 : abortionÐ . After a while, welearn thatU2 : not jail Ð abortion .

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 322/335

Page 323: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

Classical update-approaches update specific models.

They consider the model t f ree,abortionu as asuitable update (after learning thatU1).However, the model tabortion, jailu is a betterchoice.After updateU2, jail should become false andf ree again true. Again, update approaches donot get these results.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 323/335

Page 324: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

LUPS- an update language

Definition 6.6 (Knowledge state)

A knowledge state KS is a set of rules (a logicprogram). An atom holds in s if it is true in allstable models (answer sets) of KS.

The idea is that successive updatesU1,U2, . . .Unare applied to the initial knowledge state KS0and result in the final state KSn � KS0rU1s . . . rUns.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 324/335

Page 325: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

UpdatesUi

Each setUi consists of (finitely many) update commands ofthe following form:1 assert LÐ L1, . . . ,Ln when Lk�1, . . . ,Lm.2 assert event LÐ L1, . . . ,Ln when Lk�1, . . . ,Lm.3 always LÐ L1, . . . ,Ln when Lk�1, . . . ,Lm.4 always event LÐ L1, . . . ,Ln when Lk�1, . . . ,Lm.5 retract LÐ L1, . . . ,Ln when Lk�1, . . . ,Lm.6 cancel LÐ L1, . . . ,Ln when Lk�1, . . . ,Lm.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 325/335

Page 326: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

1 assert: such rules are added to the KS andpersist.

2 event: to avoid persistence of rules (only addit in the successor state), discard it later.

3 always: while assert rules are added onlyonce, always rules can be automaticallyadded at each step (if the precondition issatisfied). Thus, even without any newupdates, these rules might fire.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 326/335

Page 327: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

Example 6.5 in this terminology:KS0 :� t f reeÐ not jail, jail Ð abortionu

KS � KS0rassert abortionsrassert not jail Ð abortions

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 327/335

Page 328: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

Definition 6.7 (LUPS)

An update program in LUPS is a finite sequenceof update commands of the form mentioned onthe previous slide.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 328/335

Page 329: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

Example 6.8 (Parallel updates [Alferes et al., 2002])A suitcase with two latches opens only when both latchesare up. A toggling action is available (and can be appliedto each latch). This can be represented by

always open Ð uppl1q, ippl2qalways uppLq when not uppLq, togglepLqalways not uppLq when uppLq, togglepLq

Suppose in the initial situation l1 is down and l2 is up, thesuitcase is closed. Then there are two toggling actions(one for each latch). And then a toggling action only for l2.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 329/335

Page 330: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 2. Updates of Logic Programs

U1 � tassert not uppl1q,assert uppl2q,assert not openuU2 � tassert event togglepl1q, assert event togglepl2quU3 � tassert event togglepl2qu

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 330/335

Page 331: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 3. References

6.3 References

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 331/335

Page 332: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 3. References

[Alchourrón et al., 1985] Carlos E. Alchourrón, Peter Gärdenfors, andDavid Makinson.On the logic of theory change: Partial meet contraction andrevision functions.50(2):510–530, 1985.

[Alferes and Pereira, 2002] José Júlio Alferes and Luís Moniz Pereira.Logic programming updating - a guided approach.In Antonis C. Kakas and Fariba Sadri, editors, ComputationalLogic: Logic Programming and Beyond, Essays in Honour of RobertA. Kowalski, Part II, pages 382–412. Springer, 2002.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 332/335

Page 333: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 3. References

[Alferes et al., 2002] José Júlio Alferes, Luís Moniz Pereira, HalinaPrzymusinska, and Teodor C. Przymusinski.Lupsa language for updating logic programs.138(1-2):87–116, 2002.

[Alferes et al., 2004] José Júlio Alferes, Federico Banti, Antonio Brogi,and João Alexandre Leite.Semantics for dynamic logic programming: A principle-basedapproach.In Vladimir Lifschitz and Ilkka Niemelä, editors, LogicProgramming and Nonmonotonic Reasoning, 7th InternationalConference, LPNMR 2004, Fort Lauderdale, FL, USA, January 6-8,2004, Proceedings, pages 8–20. Springer, 2004.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 333/335

Page 334: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 3. References

[Katsuno and Mendelzon, 1992] Hirofumi Katsuno and Alberto O.Mendelzon.Propositional knowledge base revision and minimal change.52(3):263–294, 1992.

[Leite et al., 2001] João Alexandre Leite, José Júlio Alferes, andLuís Moniz Pereira.Multi-dimensional dynamic knowledge representation.In Thomas Eiter, Wolfgang Faber, and Miroslaw Truszczynski,editors, Logic Programming and Nonmonotonic Reasoning, 6thInternational Conference, LPNMR 2001, Vienna, Austria, September17-19, 2001, Proceedings, pages 365–378. Springer, 2001.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 334/335

Page 335: Modeling the Dynamics of Knowledge · 2012-05-09 · illustrate this with the Wumpus world and Sudoku-puzzles . We introduce two sorts of calculi for propositional logics: a Hilbert

6. Knowledge in Flux 3. References

[Winslett, 1988] Marianne Winslett.A framework for comparison of update semantics.In Proceedings of the Seventh ACM SIGACT-SIGMOD-SIGARTSymposium on Principles of Database Systems, March 21-23, 1988,Austin, Texas, pages 315–324. ACM, 1988.

Jürgen Dix and Wojtek Jamroga � ESSLLI (Dublin 2007) 335/335