- 90 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Knowledge Representation and Reasoning' - avidan

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Master of Science in Artificial Intelligence, 2010-2012### Knowledge Representation and Reasoning

University "Politehnica" of Bucharest

Department of Computer Science

Fall 2009

Adina Magda Florea

http://turing.cs.pub.ro/krr_10

curs.cs.pub.ro

Lecture 6

Modal Logic

Lecture outline

- Introduction
- Modal logic in CS
- Syntax of modal logic
- Semantics of modal logic
- Logics of knowledge and belief
- Temporal logics

1. Introduction

- In first order logic a formula is either true or false in any model
- In natural language, we distinguish between various “modes of truth”, e.g, “known to be true”, “believed to be true”, “necessarily true”, “true in the future”
- “Barack Obama is the president of the US” is currently true but it will not be true at some point in the future.
- “After program P is executed, A hold” is possibly true if the program performs what is intended to perform.

History

- Classical logic is truth-functional = truth value of a formula is determined by the truth value(s) of its subformula(e) via truth tables for ,, ¬, and →.
- Lewis tried to capture a non-truth-functional notion of “A Necessarily Implies B” (A → B)
- We can take A → B to mean “it is impossible for A to be true and B to be false”
- He chose a symbol, P, and wrote PA for “A is possible”; then:
- ¬PA is “A is impossible”
- ¬P¬A is “not-A is impossible”
- Then he used the symbol N to stand for ¬P and expressed
- NA := ¬P¬A “A is necessary”
- Because → is logical implication, we can transform it like this:
- A → B := N(A → B) = ¬P¬(A → B) = ¬P¬(¬A B) = ¬P(A ¬B)

Modal operators

- P - “possibly true”
- N - “necessarily true”
- Modal logics - modes of truth:
- Basic modal logic: - box, and - diamond
- The necessity / possibility - necessary, and - possible
- Logics about knowledge - what an agent knows / believes
- Deontic logic - - it is obligatory that, and - it is permissible that

2. Modal logic in CS

- Temporal logic
- Dynamic logic
- Logic of knowledge and belief
- Model problems and complex reasoning

The Lady and the Tiger Puzzle

- There are two rooms, A and B, with the following signs on them:
- A: In this room there is a lady, and in the other room there is a tiger”
- B: “In one of these rooms there is a lady and in one of them there is a tiger”
- One of the two signs is true and the other one is false.

Q: Behind which door is the lady?

Modeling modal reasoning

The King's Wise Men Puzzle

- The King called the three wisest men in the country.
- He painted a spot on each of their foreheads and told them that at least one of them has a white spot on his forehead.
- The first wise man said: “I do not know whether I have a white spot”
- The second man then says “I also do not know whether I have a white spot”.
- The third man says then “I know I have a white spot on my forehead”.

Q: How did the third wise man reason?

Modeling modal reasoning

Mr. S. and Mr. P Puzzle

- Two numbers m and n are chosen such that 2 m n 99.
- Mr. S is told their sum and Mr. P is told their product.
- Mr. P: "I don't know the numbers. "
- Mr. S: "I knew you didn't know. I don't know either."
- Mr. P: "Now I know the numbers."
- Mr S: "Now I know them too."

Q: In view of the above dialogue, what are the numbers?

3. Modal logic - Syntax

- Atomic formulae: p ::= p0 | p1 | p2 | q …. where pi , q are atoms in PL
- Formulae: ::= p | ¬ | | | | | → where and are a wffs in PL

Examples:

- p → q
- p → q
- (p1 → p2) → ((p1) → (p2))
- Schema:
- →
- →
- ( → ) → ( → )
- Schema Instances: Uniformly replace the formula variables with formulae (inference)

Examples:

- p → p is an instance of → but
- p → q is not

Deduction in modal logic

- Axioms

The 3 axioms of PL

- A1. ()
- A2. ( ( )) (( ) ( ))
- A3. ((¬) (¬)) ( )

The axiom to specify distribution of necessity

- A4. ( ) ( ) Distribution of modality

Deduction in modal logic

- Inference rules
- Substitution (uniform) ’
- Modus Ponens , ( )
- The modal rule of necessity |-
- « for any formula , if was proved then we can infer »

4. Semantics of modal logic

- Nonlinear model
- The semantics of modal logic is known as the Kripke Semantics, also called the Possible World approach

Directed graph (V, E)

- Vertices V = {v, v1, v2, …}
- Directed edges {(s1,t1), (s2,t2),…} from source vertex si V to the target vertex tiV for i = 1,2,…

Cross product of a set V, V x V

- {(v,w) | vV and wV} the set of all ordered pairs (v,w), where v and w are from V.

Directed graph

- a pair (V,E), where V = {v, v1, v2, …} and E V x V is a binary relation over V.

Semantics of modal logic

- A Kipke frame is a directed graph
, where: - W is a non-empty set of worlds (points, vertices) and
- R W x W is a binary relation over W, called the accessibility relation.
- An interpretation of a wff in modal logic on a Kripke frame
is a function I : W x L → {t,f} which tells the truth value of every atomic formula from the language L at every point (in every word) in W. - A Kripke model M of a formula (an interpretation which makes the formula true) is
- the triple
, where I is an interpretation of the formula on a Kripke frame which makes the formula true. - This is denoted by M |=W

Semantics of modal logic

- Using the model, we can define the semantics of formulae in modal logic and can compute the truth value of formulae.
- M |=W iff M |=/W (or M |=W ¬)
- M |=W iff M |=W and M |=W
- M |=W iff M |=W or M |=W
- M |=W → iff M |=W ¬ or M |=W

(¬ is true in W)

- M |=W iff w': R(w,w') M |=W'
- M |=W iff w': R(w,w') M |=W'

W1

I(W1,p) = f

I(W1,q) = f

I(W1,r) = a

W0

I(W0,p) = f

I(W0,q) = f

I(W0,r) = f

W2

I(W2,p) = f

I(W2,q) = f

I(W2,r) = f

Examples

p – I am rich

q – I am president of Romania

r – I am holding a PhD in CS

I(W0, p) = ? I(W0, p) = ?

I(W0, r) = ? I(W0, r) = ?

w1

p, q, r

w2

p, q, r

w0

p, q, r

w3

p, q, r

Examples

p -Alice visits Paris

q - It is spring time

r - Alice is in Italy

I(W0, p) = ? I(W0, p) = ?

I(W0, q) = ? I(W0, q) = ?

I(W0, r) = ? I(W0, r) = ?

I(W1, p) = ? I(W1, p) = ?

Different modal logic systems

The modal logic K

- A1. ()
- A2. ( ( )) (( ) ( ))
- A3. ((¬) (¬)) ( )
- A4. ( ) ( )
- X X
- Here is an invalidating model:

R(w0,w1), I(w0,p)=f, I(w1,p)=t

“it is impossible for A to be true and B to be false”

M |=W iff w': R(w,w') M |=W'

Different modal logic systems

The modal logic D

Add axiom

- X X
- In fact, D-models are K-models that meet an additional restriction: the accessibility relation must be serial.
- A relation R on W is serialiff
- (wW: (w'W: (w,w')R))

Different modal logic systems

The modal logic T

Add axiom

- X X
- A T-model is a K-model whose accessibility relation is reflexive.
- A relation R on W is reflexiveiff
- (wW: (w,w)R).

Different modal logic systems

The modal logic S4

Add axiom

- X X
- An S4-model is a K-model whose accessibility relation is reflexiveand transitive.
- A relation R on W is transitiveiff
- (w1,w2,w3 wW:

(w1,w2)R (w2, w3)R (w1,w3)R).

Different modal logic systems

The modal logic B

Add axiom

- X X
- A B-model is a K-model whose accessibility relation isreflexive and symmetric.
- A relation R on W is symmetriciff
- (w1,w2W: (w1,w2)R (w2,w1)R)

Different modal logic systems

The modal logic S5

Add the axiom

- X X
- An S5-model is a K-model whose accessibility relation is reflexive, symmetric, and transitive.
- That is, it is an equivalence relation
- Exercise: Find an S5-model in which X X is false.

S5 is the system obtained if every possible world is possible relative to every other world

Different modal logic systems

The modal logic S5

- X X
- A relation is euclidian iff (w1,w2,w3W: (w1,w2)R

(w1, w3)R (w2,w3)R)

reflexiveDifferent modal logic systems

D = K + D

T = K + T

S4 = T + 4

B = T + B

S5 = S4 + B

S5

symmetric

transitive

S4

B

transitive

symmetric

T

D

reflexive

serial

K

5. Logics of knowledge and belief

- Used to model "modes of truth" of cognitive agents
- Distributed modalities
- Cognitive agents characterise an intelligent agent using symbolic representations and mentalistic notions:
- knowledge - John knows humans are mortal
- beliefs - John took his umbrella because he believed it was going to rain
- desires, goals - John wants to possess a PhD
- intentions - John intends to work hard in order to have a PhD
- commitments - John will not stop working until getting his PhD

Logics of knowledge and belief

- How to represent knowledge and beliefs of agents?
- FOPL augmented with two modal operators K and B

K(a,) - a knows

B(a,) - a believes

with LFOPL, aA, set of agents

- Associate with each agent a set of possible worlds
- Kripke model Ma of agent a for a formula
- Ma =

with R A x W X W

and I - interpretation of the formula on a Kripke frame

Logics of knowledge and belief

- An agent knows a propositions in a given world if the proposition holds in all worlds accessible to the agent from the given world

Ma |=WK iff w': R(w,w') Ma |=W'

- An agent believes a propositions in a given world if the proposition holds in all worlds accessible to the agent from the given world

Ma |=WB iff w': R(w,w') Ma |=W'

- The difference between B and K is given by their properties

Properties of knowledge

(A1) Distribution axiom:

K(a, ) K(a, ) K(a, )

"The agent ought to be able to reason with its knowledge"

( ) ( )(Axiom of distribution of modality)

K(a, ) ( K(a,) K(a,) )

(A2) Knowledge axiom: K(a, )

"The agent can not know something that is false"

(T) - satisfied if R is reflexive

K(a, )

Properties of knowledge

(A3) Positive introspection axiom

K(a, ) K(a, K(a, ))

X X (S4) - satisfied if R is transitive

K(a, ) K(a, K(a, ))

(A4) Negative introspection axiom

K(a, ) K(a, K(a, ))

X X (S5) - satisfied if R is euclidian

Inference rules for knowledge

(R1) Epistemic necessitation

|- K(a, )

modal rule of necessity |-

(R2) Logical omniscience

and K(a, ) K(a, )

problematic

Properties of belief

Distribution axiom: B(a, ) B(a, ) B(a, )

YES

Knowledge axiom: B(a, ) NO

Positive introspection axiom

B(a, ) B(a, B(a, ))

YES

Negative introspection axiom

B(a, ) B(a, B(a, )) problematic

Inference rules for belief

(R1) Epistemic necessitation

|- B(a, ) problematic

modal rule of necessity |-

(R2) Logical omniscience

and B(a, ) B(a, )

usually NO

Some more axioms for beliefs

Knowing what you believe

B(a, ) K(a, B(a, ))

Believing what you know

K(a, ) B(a, )

Have confidence in the belief of another agent

B(a1, B(a2,)) B(a1, )

8. KB(WB) WA contrapositive of 7

9. KA(WA) 3, 8, R2

R2: and K(a, ) inferK(a, )

Two-wise men problem - Genesereth, Nilsson

(1) A and B know that each can see the other's forehead. Thus, for example:

(1a) If A does not have a white spot, B will know that A does not have a white spot

(1b) A knows (1a)

(2) A and B each know that at least one of them have a white spot, and they each know that the other knows that. In particular

(2a) A knows that B knows that either A or B has a white spot

(3) B says that he does not know whether he has a white spot, and A thereby knows that B does not know

1. KA(WA KB( WA) (1b)

2. KA(KB(WA WB)) (2a)

3. KA(KB(WB)) (3)

Proof

4. WA KB(WA) 1, A2A2: K(a, )

5. KB(WA WB) 2, A2

6. KB(WA) KB(WB) 5, A1A1: K(a, ) (K(a,) K(a,))

7. WA KB(WB) 4, 6

34

6. Temporal logic

- The time may be linear or branching; the branching can be in the past, in the future of both
- Time is viewed as a set of moments with a strict partial order, <, which denotes temporal precedence.
- Every moment is associated with a possible state of the world, identified by the propositions that hold at that moment

Modal operators of temporal logic (linear)

p U q - p is true until q becomes true - until

Xp - p is true in the next moment - next

Pp - p was true in a past moment - past

Fp - p will eventually be true in the future - eventually

Gp - p will always be true in the future – always

Fp true U p

Gp F p

F – one time point

G – each time point

Branching time logic - CTL

- Temporal structure with a branching time future and a single past - time tree
- CTL – Computational Tree Logic
- In a branching logic of time, a path at a given moment is any maximal set of moments containing the given moment and all the moments in the future along some particular branch of <
- Situation - a world w at a particular time point t, wt
- State formulas - evaluated at a specific time point in a time tree
- Path formulas - evaluated over a specific path in a time tree

Branching time logic - CTL

CTL Modal operators over both state and path formulas

From Temporal logic (linear)

Fp - p will sometime be true in the future - eventually

Gp - p will always be true in the future - always

Xp - p is true in the next moment - next

p U q - p is true until q becomes true - until

(p holds on a path s starting in the current moment t until q comes true)

Modal operators over path formulas(branching)

Ap - at a particular time moment, p is true in all paths emanating from that point - inevitable p

Ep - at a particular time moment, p is true in some path emanating from that point - optional p

F – one time point

G – each time point

A – all path

E – some path

LB- set of moment formula

LS - set of path-formula

Semantics

M =

M |=t iff t||

is true in the set of moments for which holds

M |=t pq iff M |=t p and M |=t q

M |=t p iff M |=/t p

M |=s,t pUq iff (t': tt' and M |=s,t' q and

(t": t t" t' M |=s,t" p))

p holds on a path s starting in the current moment t until q comes true

Fp true Up

Gp F p

M |=tA p iff (s: sSt M |=s,t p)Ep A p

s is a path, St - all paths starting at the present moment

M |=s,tX p iff M |=s,t+1 p)

38

s is true in each time point (G) and in all path (A)

- r is true in each time point (G) in some path (E)
- p will eventually (F) be true in some path (E)
- q will eventually (F) be true in all path (A)

s

p

s

q

F - eventually

G - always

A - inevitable

E - optional

AGs

EGr

EFp

AFq

r

s

r

s

r

s

q

s

q

s

r - Alice is in Italy p -Alice visits Paris

s – Paris is the capital of France q - It is spring time

39

Each situation has associated a set of accessible words - the worlds the agent believes to be possible. Each such world is a time tree.

- Within these worlds, the branching future represents the choices (options) available to the agent in selecting which action to perform
- Similar to a decision tree in a game of chance

Decision nodes

Player 1

Dice

- Each arc emanating from
- a chance node corresponds
- to a possible world

Player 2

1/18

1/36

Chance nodes

Dice

- Each arc emanating from
- a decision node corresponds
- to a choice available in a
- possible world

Player 1

1/36

1/18

40

Download Presentation

Connecting to Server..