810 likes | 1.36k Views
Modal Logic. Ariel Jarovsky and Eyal Altshuler 8/11/07, 15/11/07. 1. Today. A short review Multi-Modal Logic First Order Modal Logic Applications of Modal Logic: Artificial Intelligence Program Verification Summary. 2. Previously on modal logics…. 3. Introduction.
E N D
Modal Logic Ariel Jarovsky and Eyal Altshuler 8/11/07, 15/11/07 1
Today • A short review • Multi-Modal Logic • First Order Modal Logic • Applications of Modal Logic: • Artificial Intelligence • Program Verification • Summary 2
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… 4
Syntax – Language The Modal Operators The formal language: A non-empty set of propositions (as in classical logic): Operators: Parentheses. Some define the ◊ as: 5
Syntax – Formulas • Formulas are the only syntactic category of Propositional Modal Logics, as in CPL. • Every proposition p is a formula. • If A, B are formulas, then the following are also formulas: • If A is a formula then the following are also formulas: 6
Modal Logics - Semantics Possible worlds semantics (Kripke, 1959) The different possible worlds represent the states of a given problem. 7
Semantics - Frame A frame is a pair (W,R) where W is a non-empty 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. 8
Semantics – Model • A Model is a triple M=(W,R,V) while (W,R) is a frame and V is a valuation. • A valuation is a function . Informally, V(p,w)=T is to be thought as p is true at world w. 9
Semantics – Semantic Relation • The relation between a pair (M,w) where M is a model and w is a world, and a formula A, is defined recursively as follows: • Similar for the other classical logic connectors. 10
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. 11
Normal Logic • A logic is said to be normal if it contains the formula scheme: • and if it is provided with the modal inference necessitation rule: 12
Axiomatic Systems • An axiomatic system for a normal logic is made up of the following three components: • An axiomatic system of CPL (as HPC) • The axiom scheme denoted: • The modal inference rule of necessitation: 13
Multi-Modal Logics • There exist logic languages with more than one modal operator • Why do you think? • They may use: • Collection of symbols {[i]} • Each modal [i] has its dual, <i> • <i>A= [i]A. 15
Multi-Modal Logics- Syntax • Very similar to the syntax of uni-modal logics, that we already know. • Every proposition p is a formula. • If A, B are formulas, then the following are also formulas: • If A is a formula then the following are also formulas: 16
Multi-Modal Logics- Semantics • A frame F for multimodal language is define as follows – F=(W,{Ri | i}) • W is a non-empty set of worlds • For each i, Ri is a binary relation on W. • A model M is a tupple M=(W,{Ri | i},V) • A valuation V is function 17
The relation between a pair (M,w) where M is a model and w is a world, and a formula A, is defined recursively as follows: Similar for the other classical logic connectors. The Semantic Relation 18
Multi-Modal Logics • A Logic is defined as same as in uni-modal logics (includes all tautologies and closed under MP and substitution). • A logic is said to be normal if it contains the schemata: • And satisfies the necessitation rule for each i. • The smallest normal logic is generally denoted Ki. 19
Multi-Modal Logic - Example ([1]A) Yesterday, Dan had 2 children. ([2]B) Tomorrow, Dan will have 3 children. Let us look on the formula – Intuitively, It has to be true only in the day in which his third child was born. 20 20
Example A – T B - F A – T B - F A – T B - F A – T B - T A – F B - T A – F B - T A – F B - T Dan’s 3rd child birthday Formally, we will define a frame to be- W – the days during the year. R1 – all the pairs (dayi, dayi-1). R2 – all the pairs (dayi, dayi+1). A world w in model M in which [1]A [2]B will be true is- R1R2 21 21
First Order Modal Logic • Motivation: • Every lecturer strikes. • Yossi is a lecturer. • Thus Yossi strikes. • The formal language – • There are two parts – • A common part for all of the languages. • A signature - unique for every language. 22
First Order Modal Logic • The common part – • Operators: • Quantifies: • Parentheses. • Variables: v1,v2,… • Syntactic Categories – • formulas • terms Will be detailed 23
First Order Modal Logic • Signature: the unique part of every language - • A non-empty set of function symbols. • A (maybe empty) set of constants. • A (maybe empty) set of predicate symbols. • Terms: • Every variable is a term. • Every constant is a term. • If f is a function symbol and t1,…,tn are terms, then f(t1,…,tn) is also a term. 24
Definition of a formula • If p is a predicate symbol and t1,…,tn are terms, the p(t1,…,tn) is an atomic formula. • If A, B are formulas then the following are also formulas: • A, AB, AB, AB, AB • x.A, x.A • A, A 25
First Order Logic- Semantics • Let L(σ) be a first order language. • When is a formula true? • A Structure M is a pair M=<D,I>, such that – • D – (domain) a non-empty set of objects. • I – an interpretation function of σ: 26
FOL – Valuations • A valuation is a function from terms do the domain • However, it is generalized to a function from terms to the domain and is defined as: • V[c]= I[c] • V[x] – given by V. • V[f(t1,…,tn)]=I[f](V[t1],…,V[tn]) 27
Domains in First Order Modal Logic This is a problematic issue. Why? “Tomorrow, everyone will be glad”. We’ve already asked “When is tomorrow?” A new question is added- “Who is everyone?” On Sunday- Everyone includes Yossi,Dan and Moshe. On Monday- Everyone includes Yossi,Dan, Moshe, and Gad. On Tuesday- Everyone includes Dan, Moshe and Gad. 28
Domain- 3 natural definitions The set of all individuals existing in the actual world (D = a). The set of all individuals existing in a given possible world w (D = w). The set of all the individuals existing in any world (D = *=UwWw). 29
Domain- 3 natural definitions • The quantifiers have different meanings, according to the definition of the domain- • means- ‘for all x in the actual world’. means- ‘for an x in the actual world’. • means- ‘for all x in the world w’. means- ‘for an x in the world w’. • means- ‘for all x’. means- ‘for at least one x’. 30
Where is modal logic used? • Modal logic is a widely applicable method of reasoning for many areas of computer science. • Artificial Intelligence • Database theory • Distributed systems • Program verification • Cryptography theory 32
AI – Epistemic Logic • Epistemic Logic is the modal logic that reasons about knowledge and belief. • Philosophy, Artificial Intelligence, Distributed Systems. • Important: our examples in that part will be about propositional multi-epistemic logic (no quantifiers, more than one modal) 33
Epistemic Logic – Syntax • Will be minimally defined, more details – next lecture of the seminar. • Suppose there are n agents. • Let be a non-empty set of propositions. • Operators: • [i]φ- agent i knows φ. • <i>φ- agent i knows that φ is true at some state. 34
Epistemic Logic- Syntax • Formulas are defined as usual. • In addition to reasoning about what each agent knows, it may be helpful to reason about: • Everyone knows: • Common knowledge: 35
Applications of Epistemic Logic (semantics) • In a multi-agent system, there are n agents. • Each agent i has it’s local environment, that consists of information of what i’s local state is in the system. • In addition there is a global environment, that includes information that agents might not necessarily know but is still important for the system to run (this information is categorized as seen from a “bird’s eye” view of the system). 36
Examples (1) • A scrabble game: • Agents i’s local environment: • The letters i contained in its hand. • The letters that have been currently played. • Which words were played by each player. • The current score. • The global environment may contains- • The letters that haven’t been chosen by any player. 37
Examples (2) • A distributed system. • Each process is an agent. • The local environment of a process might contain messages i has sent or received, the values of local variables, the clock time. • The global environment might include the number of process, a log file of all the process’ operations, etc. 38
Applying epistemic logic using possible worlds semantics • The environments defines a global state. • A global state is a set (se,s1,…,sn) of environments • Se is the global environment. • Each si is the local environment of agent i. • A run is defined as a function from time to global states. • A point is a pair (r,m) where r is a run at some time m (assume time to be the natural numbers). 39
Applying epistemic logic using possible worlds semantics • A system is defined as a set of runs. Thus, our description of a system entails a collection of interacting agents. • Intuitively, a system is the set of all possible runs. • At point (r,m), system is in some global state r(m). Let ri(m) be the local environment for agent i. 40
Applying epistemic logic using possible worlds semantics • Note that a system can be viewed in terms of a frame. • W = a set of points. • Ri = the relation for agent i. • This means that agent i considers (r’,m’) possible at point (r,m) if I has the same local environment at both point. • This means, intuitively, that if agent i runs in r at time m, then he could continue running in r’ at time m’.
Applying epistemic logic using possible worlds semantics • Let be a set of propositions. • These propositions describe facts about the system as “the system is deadlocked” or “the value of variable x is 5”. • An interpreted system is a tuple (S,V), where S is a system and V is a function that maps propositions in , V(p,s){true, false}, where p is a proposition and s is a state.
Applying epistemic logic using possible worlds semantics • We associate I=(S,V) with the modal structure M=(W,R1,…,Rn,V). Thus, agents’ knowledge is determined by their local environment. • What it means for a formula to be true at point (r,m) in I? • By applying earlier definitions we get:
Time for a break… 44 44
Applying epistemic logic using axiomatic systems • Martha puts a spot of mud on the forehead of each child. • Each child can see the forehead of the other- A knows that B’s forehead is muddy, and conversely. • Neither child knows whether their own forehead is muddy.
Applying epistemic logic using axiomatic systems • Martha announces, “At least one of you has a muddy forehead”. • Then she asks, “does either of you know whether your own forehead is muddy?” • Neither child answers. • She asks the same question again, and this time both children answer- “I know mine is”. • How did it happen?
Definitions • In order to proof the conclusion we have to take an axiomatic system of classical logic (as HPC) and add some axioms and rules of inference: • Distributivity • Truth (Semantically, R is reflexive) • Rule N • Rule R
It means that A knows that if B knows that A’s forehead is not muddy then B knows his forehead is muddy! Proof 1. [Martha said] 2. Distributivity 3. Rule R 2 4. MP 1,3 Dist.: Truth: Rule R:
Proof 1. [Martha said] 2. Distributivity 3. Rule R 1 4. MP 1,3 5. CPL theorem 6. Rule R 5 7. MP 4,6 8. Distributivity 9. MP 7,8 Dist.: Truth: Rule R:
It means that A knows that if B doesn’t knows whether his forehead is muddy then A knows that it is possible in B’s knowledge that A’s forehead is muddy! Remember that: [i]A <i>A Proof (cont’d) 9. MP 7,8 Dist.: Truth: Rule R: