Today Introduction Motivation- Why Modal logic? Modal logic- Syntax riel Jarovsky and Eyal ltshuler 8/11/07, 15/11/07 Modal logic- Semantics (Possible Worlds Semantics): Theory Examples Today (cont d) Valuations & Tautologies Logics & Normal Logics. xiomatic systems & possible worlds semantics. Most common modal logics: Temporal Logic Dynamic Logic Epistemic Logic Next week Multi-Modal Logic First Order Modal Logic pplications of Modal Logic: rtificial Intelligence Program Verification History Summary Introduction Modal Logics are logics of qualified truth. (From the dictionary) Modal- of form, of manner, pertaining to mood, pertaining to mode Necessary, Obligatory, true after an action, known, believed, provable, from now on, since, until, and many more Motivation - Why Modal Logic? 1. John knows it s raining. 2. John knows that if it s raining, he should take an umbrella. 3. John knows he should take an umbrella. ssuming that John can apply MP, he can conclude the third sentence from the first and the second sentences. However, how would you deduce that with classical logic?
Motivation - Why Modal Logic? Classical logic is not enough here! p John knows it s raining. q John knows that if it s raining, he should take an umbrella. r John knows he should take an umbrella. p,q r? NO!!!! CPL p,q / CPL r Motivation Here is an example, in which modal logic is useful- the wise children with muddy forehead story This is Martha- These are her children, and B- Motivation Martha puts a spot of mud on the forehead of each child. Each child can see the forehead of the other- knows that B s forehead, and conversely. Neither child knows whether their own forehead. Motivation Then Martha announces, t least one of you has a muddy forehead. Then she asks, does either of you know whether your own forehead? Neither child answers. She ask the same question again, and this time both children answer- I know mine is. How did it happen? Motivation Possible Worlds In classical logic we deal with one model at a time, and we think of this model as telling us how the world is. In Modal Logics there are many possible worlds! Motivation Possible Worlds For example, Yossi may not know whether it is raining in Tel-viv or not, but Yossi may very well know it is raining in Liverpool. Suppose we have two classical models: In one it s raining in Tel-viv. In the other, it is not. In both it is raining in Liverpool. s far as Yossi is concerned, either model could be true state of the world, so both are possible worlds for Yossi.
Initial Representation of Knowledge ctual World s forehead B s forehead Ra Rb Martha said or s forehead B s forehead Ra Rb Each one see the forehead of the other s forehead B s forehead Ra Rb Each one knows the other doesn t know knows B knows Q.E.D. s forehead B s forehead Ra Rb Modal Logic - Syntax We will first focus on Propositional Modal Logic, thus until indicated otherwise we refer to Propositional Modal Logic as Modal Logic. logic is composed of: Formal language Consequence relation (will be defined differently) We will focus on the definition of the consequence relation through semantics, but we will also refer to it through syntax. Syntax Language The formal language: non-empty set of propositions (as in classical logic): P= { p1, p2, p3, } Operators: Parentheses. Some define the as: = def {,,,,,,, } The Modal Operators
Syntax Formulas Formulas are the only syntactic category of Propositional Modal Logics, as in CPL. Every proposition p is a formula. If, B are formulas, then the following are also formulas:, B, B, B, B If is a formula then the following are also formulas: Syntax Modal Operators Readings of Readings of It is necessarily true that. It is possibly true that. It will always be true that. It will sometimes be true that. It ought to be true that. It can be that. It is known that. It is believed that. fter every terminating execution of the program, is true. The opposite of is not known. The opposite of is not believed. There is an execution of the program that terminates with true. Modal Logic - Semantics Is a formula P correct? In one world it is, in another world it isn t. In modal logic, correctness of a formula is context-dependent. For example- n will be happy tomorrow. Everyone I know likes basketball. From now until the program terminates, x>1 holds. Modal Logics - Semantics Possible worlds semantics (Kripke, 1959) The different possible worlds represent the states of a given problem. Semantics - Frame frame is a pair (W,R) where W is a nonempty set and R is a binary relation on W. W is the set of all possible worlds, or states. R determines which worlds are accessible from any given world in W. We say that b is accessible from a iff (a,b) R. R is known as the accessibility relation. Possible Worlds- Examples (1) n is a boy. n will be happy tomorrow. Suppose n is happy on Tuesday nd Friday (and of course that he s a boy in every day ) Each day can be a world. world is accessible only from its previous: Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Possible Worlds- Examples (1) Possible Worlds- Examples (2) Let us write it formally using possible worlds semantics W={ Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, next Sunday, } R={ (Sunday, Monday), (Monday, Tuesday), (Tuesday, Wednesday), (Wednesday, Thursday), (Thursday, Friday), (Friday, Saturday),(Saturday, next Sunday), } There s a terminating execution of the program in which x=12. fter every execution of the program, x>3. Consider the following pseudo-code: Choose x randomly from {10,11} Choose y randomly from {0,1} If y=0 x=x+1; Possible Worlds- Examples (2) w3 Semantics Model W1 W2 Before if, x=10 Before if, x=11 after if, x=10 after if, x=11 after if, x=12 Intuitively: There s a terminating execution of the program in which x=12- TRUE IF WE RE IN W 2 fter every execution of the program, x>3- TRUE IF WE RE IN W 1 ND W 2. w4 w5 Model is a triple M=(W,R,V) while (W,R) is a frame and V is a valuation. valuation is a function V : P W { T, F}. Informally, V(p,w)=T is to be thought as p is true at world w. Semantics Semantical Relation The relation between a pair (M,w) where M is a model and w is a world, and a formula, is defined recursively as follows: M, w p, p P V( p, w) = T M, w B M, w and M, w B Similar for the other classical logic connectors. M, w x W if wrx then M, x M, w x W st.. M, x Modal Logic Example Suppose M=(W,R,V) where W={u,v,w}. Let V(p 2,u) = V(p 1,v) = V(p 1,w) = true lso, let R={(u,v),(u,w),(v,v),(v,w)}. The following graph captures the situation: w p 1 u p 2 v p 1
Modal Logic Example w p 1 u p 2 Note that M, u p. So,. 1, M, v p M, u p 1 1 lso, M, w p2, M, v p2. Thus, M, v p2. Furthermore, M, w p2. nd so, M, u p2 Therefore, we can say that M, u p p p 1 1 2 v p 1 Semantics True & Valid formula P is true in a model M=(W,R,V) (written M P) if M, w P for all w W. formula p is valid in a frame F=(W,R) (written F P ) if M P for all M based in F. schema (set of formulas) is true in a model (or valid in a frame) if all instances of the schema have that property. If Γ is a set of formulas we will write M Γ (or F Γ ). Semantics - Example Prove that ( P P) and ( P Q) ( P Q) are true in all models and, hence are valid in all frames ( P P) : P P is a classical tautology, and since at each world the truth value is calculated according to the classical truth tables, it is true at all worlds in all models. Therefore for any w, M, M, x P P for all x such that wrx. Thus, M, w ( P P) for all w, M. nd it results in F ( P P) (F is any frame). Semantics - Example ( P Q) ( P Q) : Suppose M, w ( P Q) and M, w P. Let x be any world such that wrx. Then M, x P and M, x P Q, so M, x Q(by the definition of the ). So M, x Q. nd finally, M, w ( P Q) ( P Q) for all w, M. Thus, F ( P Q) ( P Q) for all frame F. Semantics - Example Prove that ( P P) and P P are not valid statements. ( P P) : Let W={w} and R=ø. Then for any valuation V, M, w / ( P P), because there is no x such that wrx. P P : Let W={w,x} and R={(w,x)}. Let V(x,P)=T, but V(w,P)=F. Then M, w P, since M, x P and x is the only world such that wrx. However, M, w / P, so M, w / P P. Logics Given a language L(P) (P is a set of atoms) a logic Λ is defined to be any subset of formulas generated from P that satisfies: Λ includes all tautologies; Closure under Modus Ponens. Closure under uniform substitution.
Logics The set L(P) of formulas generated from the set P of propositions, and the set of all tautologies in L(P) are two examples of logics. The elements of a logic are called its theorems. We write to mean that is a Λ theorem of the logic Λ, thus. Λ Λ Normal Logic logic Λ is said to be normal if it contains the formula scheme: K : ( B) ( B) and if it is provided with the modal inference necessitation rule: Λ Λ The (Smallest) Normal Logic K If {Λ i i {1,, n}, n } is a collection of normal logics, then {Λ i i {1,, n}, n } is a normal logic. In particular, the logic denoted K and defined by K = {Λ i Λ i is a normal logic} is the smallest normal logic. Theorem: formula is a theorem of the logic K iff is valid (i.e. true in all frames). Now we come back to syntax... n axiomatic system for a normal logic Λ is made up of the following three components: n axiomatic system of CPL (as HPC) The axiom scheme denoted: K : ( B) ( B) The modal inference rule of necessitation: Λ Λ xiomatic Systems We represent the smallest normal logic Λ containing the formula schemata Σ 1,,Σ n by the notation: Λ= K Σ1 Σ n This logic is defined as follows: Λ = {Λ Λ is normal and Σ Σ Λ } i i 1 n i Syntax & Semantics - Example Let F=(W,R) be a frame. Prove that 1. R is reflexive (i.e. wwrw. ) iff P P is valid in F. 2. R is transitive (i.e. x, y, z.( xry yrz) xrz) iff P P is valid in F.
Syntax & Semantics - Example 1. R is reflexive (i.e. wwrw. ) iff P P is valid in F. Proof: R is reflexive, wrw. For some V, M, w P. So, M, w P. F P P. Suppose not wrw. Let V(x,)=T for all and only x s.t. wrx. M, w, but M, w / So, M, w /, hence M /. Contradiction! Syntax & Semantics - Example 2. R is transitive (i.e. x, yz,.( xry yrz) xrz) iff P Pis valid in F. Proof: M, w P for some V. We need to show M, w P M, x Pif wrx M, y P(if wrx and xry) wry (R is transitive), M, y P Syntax & Semantics - Example 2b. If P P is valid in F then R is transitive (i.e. x, yz,.( xry yrz) xrz) Proof: F P P Suppose wrx and xry, but not wry. Let V(z,)=T iff wrz. M, w, but M, y / xry M, x / So, M, w /. contradiction! Syntax & Semantics Let F=(W,R) be a frame. We saw that 1. R is reflexive (i.e. wwrw. ) iff P P is valid in F. 2. R is transitive (i.e. x, y, z.( xry yrz) xrz) iff P P is valid in F. If we also add: 3. R is symmetric (i.e. wx,.( wrx xrw) ) iff P P is valid in F. It results that a formula is a theorem of a normal logic with these schematas iff is valid in every frame where R is an equivalence relation. Syntax & Semantics Classical names for some schemata and the corresponding binary relations are: D: - Serial s tsrt. B: - Symmetric s, t.( srt trs) L: (( ) B) (( B B) ) - Weakly Connected s, tu,.( srt sru) ( tru t= u urt) W: ( ) Syntax & Semantics Classical names for some schemata and the corresponding binary relations are: T: - Reflexive ssrs. 4: - Transitive s, t, u.( srt tru sru) 5: - Euclidean s, t, u.( srt sru tru)
Syntax & Semantics Some common used logics are: KT: R is reflexive. S4: KT4: R is reflexive and transitive S5: KT45: R is reflexive, transitive and euclidean. Theorem: formula is a theorem of the logic KT iff is true in every frame where R is reflexive. The same as for KT4 & KT45 (with their respective relations) T: - Reflexive ssrs. 4: - Transitive s, t, u.( srt tru sru) 5: - Euclidean s, t, u.( srt sru tru) Syntax & Semantics It has been proved that there are some properties of binary relation R that do not correspond to the validity of any modal schema. For example: Irreflexivity: ntisymmetry: symmetry: s. ( srs) s t.( srt trs s = t) s t.( srt ( trs)) Most common modal logics Most common modal logics lethic Logic The modalities are possibility and necessity. is necessarily true. - is possibly true. The relation R has to be reflexive. Different notions of necessity. Temporal Logic sentence may have a different truth values at different times. The members of W are moments of time. - will be true at all future times. - will be true at some future time. In a dual way, we can talk about the past. Most common modal logics Most common modal logics Dynamic Logic Based on the idea of associating a modal operator with each command of a programming language. - every terminating execution of the program brings about true. - there is some execution of the program that terminates with true. Non-deterministic programs. Logics of Knowledge and Belief (Epistemics Logics) Formalization of knowledge and belief (the muddy forehead story) - is believed/known - The inverse of is not believed/known.