Presentation is loading. Please wait.

Presentation is loading. Please wait.

Knowledge Representation and Reasoning

Similar presentations


Presentation on theme: "Knowledge Representation and Reasoning"— Presentation transcript:

1 Knowledge Representation and Reasoning
Master of Science in Artificial Intelligence, Knowledge Representation and Reasoning University "Politehnica" of Bucharest Department of Computer Science Fall 2009 Adina Magda Florea curs.cs.pub.ro

2 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

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

4 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)

5 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

6 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?

7 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?

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

9 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) p → p is an instance of  →  but p → q is not

10 Deduction in modal logic
Axioms The 3 axioms of PL A1.   (  ) A2. (  (  ))  ((  )  (  )) A3. ((¬)  (¬))  (  ) The axiom to specify distribution of necessity A4. ( )  (    ) Distribution of modality

11 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  »

12 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 tiV for i = 1,2,… Cross product of a set V, V x V {(v,w) | vV and wV} 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.

13 Semantics of modal logic
A Kipke frame is a directed graph <W, R>, 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 <W, R> 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 <W, R, I>, where I is an interpretation of the formula on a Kripke frame <W,R> which makes the formula true. This is denoted by M |=W 

14 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' 

15 Examples I(W0, p) = ? I(W0, p) = ? I(W0, r) = ? I(W0, r) = ?
p – I am rich q – I am president of Romania r – I am holding a PhD in CS W0 I(W0,p) = f I(W0,q) = f I(W0,r) = f W1 I(W1,p) = f I(W1,q) = f I(W1,r) = a W2 I(W2,p) = f I(W2,q) = f I(W2,r) = f I(W0, p) = ? I(W0, p) = ? I(W0, r) = ? I(W0, r) = ?

16 Examples w0 p, q, r w1 w2 p, q, r w3 p, q, r 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) = ?

17 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' 

18 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 serial iff (wW: (w'W: (w,w')R))

19 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 reflexive iff (wW: (w,w)R).

20 Different modal logic systems
The modal logic S4 Add axiom X  X An S4-model is a K-model whose accessibility relation is reflexive and transitive. A relation R on W is transitive iff (w1,w2,w3 wW: (w1,w2)R  (w2, w3)R  (w1,w3)R).

21 Different modal logic systems
The modal logic B Add axiom X  X A B-model is a K-model whose accessibility relation is reflexive and symmetric. A relation R on W is symmetric iff (w1,w2W: (w1,w2)R  (w2,w1)R)

22 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

23 Different modal logic systems
The modal logic S5 X   X A relation is euclidian iff (w1,w2,w3W: (w1,w2)R  (w1, w3)R  (w2,w3)R)

24 Different 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 reflexive D reflexive serial K

25 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

26 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, aA, set of agents Associate with each agent a set of possible worlds Kripke model Ma of agent a for a formula  Ma =<W, R, I> with R  A x W X W and I - interpretation of the formula on a Kripke frame <W,R> which makes the formula true for agent a

27 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 |=W K 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 |=W B iff w': R(w,w')  Ma |=W'  The difference between B and K is given by their properties

28 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, )  

29 Properties of knowledge
(A3) Positive introspection axiom K(a, )  K(a, K(a, )) X  X (S4) - satisfied if R is transitive (A4) Negative introspection axiom K(a, )  K(a, K(a, )) X   X (S5) - satisfied if R is euclidian

30 Inference rules for knowledge
(R1) Epistemic necessitation |-   K(a, ) modal rule of necessity |-    (R2) Logical omniscience    and K(a, )  K(a, ) problematic

31 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, )) Negative introspection axiom B(a, )  B(a, B(a, )) problematic

32 Inference rules for belief
(R1) Epistemic necessitation |-   B(a, ) problematic modal rule of necessity |-    (R2) Logical omniscience    and B(a, )  B(a, ) usually NO

33 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, )

34 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, A2 A2: K(a, )   5. KB(WA  WB) 2, A2 6. KB(WA)  KB(WB) 5, A1 A1: K(a, )  (K(a,)  K(a,)) 7. WA  KB(WB) 4, 6 8. KB(WB)  WA contrapositive of 7 9. KA(WA) 3, 8, R2 R2:    and K(a, ) infer K(a, ) 34

35 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

36 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

37 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

38 LB - set of moment formula LS - set of path-formula
Semantics M = <W, T, <, | |, R> - every tT has associated a world wtW M |=t  iff t||  is true in the set of moments for which  holds M |=t pq iff M |=t p and M |=t q M |=t p iff M |=/t p M |=s,t pUq iff (t': tt' 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 |=t A p iff (s: sSt  M |=s,t p) Ep  A p s is a path, St - all paths starting at the present moment M |=s,t X p iff M |=s,t+1 p) 38

39 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

40 Similar to a decision tree in a game of chance
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/36 1/18 Dice Chance nodes Each arc emanating from a decision node corresponds to a choice available in a possible world Player 1 1/36 1/18 40


Download ppt "Knowledge Representation and Reasoning"

Similar presentations


Ads by Google