- Home
- Documents
*Knowledge Lecture 1: Lecture 2 This leads to PROLOG as an efï¬پcient inference engine for...*

prev

next

out of 114

View

0Download

0

Embed Size (px)

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/456

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

Lecture 4: Chapter 4: Logics of Action and Time (2). Chapter 5: Knowledge in Flux.

Lecture 5: Chapter 6: Combining Knowledge and Time. Chapter 7: Modalities in Action. Chapter 8: Where the two frameworks meet.

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

1. Basics about Logic

Chapter 1. Basics about Logic

Basics about Logic 1.1 Why Logic? 1.2 Sentential Logic (SL) 1.3 Examples 1.4 Calculi 1.5 First-Order Logic (FOL) 1.6 Logic Programming (LP) 1.7 References

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

1. Basics about Logic

We make the case for using logics as a representation formalism for reasoning about the world. While almost everything can be done with logic, the formalization is often awkward and cumbersome. We illustrate this with theWumpus world and Sudoku-puzzles. We introduce two sorts of calculi for propositional logics: a Hilbert type and a resolution calculus. We introduce first-order logic (FOL) and reconsider the Wumpus world. The dynamics of the changing world can be modeled with the terms: they enable us to explicitly denote the situation we are in and to reason about it: McCarthy's situation calculus.

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

1. Basics about Logic

One of the main features is to ask queries of the form Dφpxq to a theory T . We expect not just a “yes/no” answer, but an instantiation of the variable x. This can be achieved with the resolution calculus for FOL. While resolution is much more efficiently implementable (compared to Hilbert-type calculi), the search space is still huge. Thus it was suggested to restrict resolution and apply it to a smaller class of formulae: Horn clauses. This leads to PROLOG as an efficient inference engine for definite logic programs. However, full declarativeness is lost and PROLOG is not (yet) the answer: emphasis is put on computing answer substitutions.

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

1. Basics about Logic 1. Why Logic?

1.1 Why Logic?

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

1. Basics about Logic 1. Why Logic?

Why logic at all?

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

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

1. Basics about Logic 1. Why Logic?

Why logic at all?

verification: check specification against implementation, executable specification,

planning as model checking

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

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 many abstractions.

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

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

1. Basics about Logic 2. Sentential Logic (SL)

1.2 Sentential Logic (SL)

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

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.1 (Sentential Logic LSL, Language L LSL)

The language LSL of propositional (or sentential) logic consists of

l and J: the constants falsum and verum, p,q,r,x1,x2, . . .xn, . . .: a countable set AT of SL-constants, , ^, _,Ñ: the sentential connectives ( is unary, all others 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-formulae FmlL is defined inductively.

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

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.2 (Semantics, Valuation, Model)

A valuation v for a language L LSL is a mapping from the set of SL-constants defined by L into the set ttrue, falseu with vplq � false, vpJq � true. Each valuation v can be uniquely extended to a function v̄ : 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/456

1. Basics about Logic 2. Sentential Logic (SL)

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 a model of φ. From now on we will speak of models, structures and valuations synonymously.

Semantics The process of mapping a set of L-formulae into ttrue, falseu is called semantics.

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

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.3 (Validity of a Formula, Tautology)

1 A formula ϕ P FmlL holds under the valuation 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 . v satisfies T if v̄pϕq � true for all ϕ T . We write v |ù T .

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

From now on we suppress the language L, because it is obvious from context. Nevertheless it needs to be carefully defined.

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

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.4 (Consequence Set CnpT q)

A formula ϕ follows from T if for all models v of T (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 consequence operator.

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

1. Basics about Logic 2. Sentential Logic (SL)

Lemma 1.5 (Properties of CnpT q) The semantic consequence operator has the following properties: 1 T -extension: 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/456

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.7 (MOD(T), CnpUq)

If T FmlL then we denote withMODpT q the set of all L-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/456

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.8 (Completeness of a Theory T )

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

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

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

1. Basics about Logic 2. Sentential Logic (SL)

Definition 1.9 (Consistency of a Theory)

T is called consistent if there is a valuation (model) v with v̄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/456

1. Basics about Logic 3. Examples

1.3 Examples

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

1. Basics about Logic 3. Examples

Wumpus World

Breeze Breeze

Breeze

Breeze Breeze

Stench

Stench

Breeze PIT

PIT

PIT

1 2 3 4

1

2

3

4

START

Gold �

Stench

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

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

OKOK B

�

P? �

P? �

A �

OK OK