View
227
Download
4
Category
Tags:
Preview:
Citation preview
11
Ariel Jarovsky and Eyal AltshulerAriel Jarovsky and Eyal Altshuler
8/11/07, 15/11/078/11/07, 15/11/07
22
Today
• A short review
• Multi-Modal Logic
• First Order Modal Logic
• Applications of Modal Logic:
• Artificial Intelligence
• Program Verification
• Summary
33
44
IntroductionModal 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…
55
Syntax – Language
The formal language:
A non-empty set of propositions (as in classical logic):
Operators:
Parentheses.
Some define the ◊ as:
1 2 3{ , , , }P p p p {¬, , , , , , , Ù Ú à}W,
The Modal Operators
¬ ¬defA A Wà
66
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:
•
¬ , , , ,A A B A B A B A B Ù Ú
A AàW
77
Modal Logics - Semantics
Possible worlds semantics (Kripke, 1959)
The different possible worlds represent the states of a given problem.
88
Semantics - FrameA 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.
99
Semantics – ModelA 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.
: { , }V P W T F
1010
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.
Semantics – Semantic Relation
, , ( , )M w p p P V p w T ‘
, , ,M w A B M w A and M w B‘ p ‘ ‘Ù
, ,M w A x W if wRx then M x A ‘ ‘W, . . ,M w A x W s t wRx M x A ‘ ‘à Ù
‘
1111
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.
1212
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:
: ( ) ( )K A B A B W W W
Λ
Λ
A
AW
1313
Axiomatic SystemsAn 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:
: ( ) ( )K A B A B W W W
Λ
Λ
A
AW
1414
1515
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.
1616
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:
•
¬ , , , ,A A B A B A B A B Ù Ú
[ ]i A i A
1717
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 : { , }V P W T F
1818
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
, , ( , )M w p p P V p w T ‘
, , ,M w A B M w A and M w B‘ p ‘ ‘Ù
, [ ] ( , ) ,iM w i A x W if w x R then M x A ‘ ‘, . . ( , ) ,iM w i A x W s t w x R M x A ‘ ‘Ù
‘
1919
Multi-Modal LogicsA 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.
: [ ]( ) ([ ] [ ] )iK i A B i A i B
Λ
Λ [ ]
A
i A
202020
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.
[1] [2]A BÙ
212121
Example 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- R1 R2
A – TB - T
A – TB - F
A – TB - F
A – TB - F
A – FB - T
A – FB - T
A – FB - T
1 2( , , )F W R R
Dan’s 3rd child birthday
2222
First Order Modal LogicMotivation:
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.
2323
First Order Modal LogicThe common part –
Operators: Quantifies: Parentheses.Variables: v1,v2,…
• Syntactic Categories –• formulas • terms
Will be detailed
{¬, , , , , , } Ù Ú àW{ , }
2424
First Order Modal LogicSignature: 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.
2525
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, ABx.A, x.AA, A
2626
First Order Logic- SemanticsLet 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 σ:
[ ]
[ ]
[ ]
n
n
I c D
I f D D
I p D
2727
FOL – ValuationsA 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])
:V x D
:V o D
2828
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.
2929
Domain- 3 natural definitions
1) The set of all individuals existing in the actual world (D = a).
2) The set of all individuals existing in a given possible world w (D = w).
3) The set of all the individuals existing in any world (D = *=UwWw).
3030
Domain- 3 natural definitionsThe quantifiers have different meanings, according
to the definition of the domain-
1) means- ‘for all x in the actual world’.
means- ‘for an x in the actual world’.
2) means- ‘for all x in the world w’. means- ‘for an x in the world w’.
3) means- ‘for all x’.
means- ‘for at least one x’.*
*
a
a
w
w
x
x
x
x
x
x
3131
3232
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
33
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
34
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
1 2 3{ , , , }P p p p
{¬, , , , ,[ ], }i i Ù Ú
35
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
1[ ]
n
φi
E i φ
Ù
( ) (1) ( 1) ( ), , ( )k k kφ φ φ φ φ φ
kC E E E E E E
Ù
36
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
37
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
38
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
39
The environments defines a global state.A global state is a set (se,s1,…,sn) of
environmentsSe 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
40
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
41
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
{(( , ), ( ', ')) | ( ) ' ( ')}i i iR r m r m r m r m
42
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
43
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:
Applying epistemic logic using possible worlds semantics
(I, , ) ( , ( , ))r m φ M r m φ‘ ‘
444444
45
• 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
46
• 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?
[Martha said] ( )a bK K A BÚ
[b sees a] ( ¬ )a b bK K A K AÚ[b doesn't know] ¬a bK K B
[We want] aK A
Applying epistemic logic using axiomatic systems
47
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
( ) ( )a a aK X Y K X K Y
aK X X
a
X
K XRule R
a a
X Y
K X K Y
Definitions
48
Proof
( ) ( )a a aK X Y K X K Y aK X Xa a
X Y
K X K Y
Dist.: Truth: Rule R:
(¬ ) ( ¬ )a b a b bK K A B K K A K B
(¬ )a bK K A B
( ¬ )a b bK K A K B
(¬ ) ( ¬ )b b bK A B K A K B 2. Distributivity3. Rule R 2
1. [Martha said]
4. MP 1,3
It means that A knows that if B knows that A’s forehead is not muddy then B knows his
forehead is muddy!
49
Proof
( ) ( )a a aK X Y K X K Y aK X Xa a
X Y
K X K Y
Dist.: Truth: Rule R:
(¬ ) ( ¬ )a b a b bK K A B K K A K B
(¬ )a bK K A B
( ¬ )a b bK K A K B
(¬ ) ( ¬ )b b bK A B K A K B
( ¬ ) (¬ ¬ ¬ )b b b bK A K B K B K A ( ¬ ) (¬ ¬ ¬ )a b b a b bK K A K B K K B K A
2. Distributivity3. Rule R 1
1. [Martha said]
4. MP 1,3
5. CPL theorem
6. Rule R 57. MP 4,6
8. Distributivity
9. MP 7,8
(¬ ¬ ¬ )a b bK K B K A(¬ ¬ ¬ ) ( ¬ ¬ ¬ )a b b a b a bK K B K A K K B K K A ¬ ¬ ¬a b a bK K B K K A
50
Proof (cont’d)
( ) ( )a a aK X Y K X K Y aK X Xa a
X Y
K X K Y
Dist.: Truth: Rule R:
9. MP 7,8¬ ¬ ¬a b a bK K B K K A
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
51
Proof (cont’d)
( ) ( )a a aK X Y K X K Y aK X Xa a
X Y
K X K Y
Dist.: Truth: Rule R:
9. MP 7,8
10. [b doesn’t know]
¬ ¬ ¬a b a bK K B K K A¬a bK K B
11. MP 9,10¬ ¬a bK K A
It means that A knows that it is possible in B’s knowledge that A’s forehead is muddy!
52
Proof (cont’d)
( ) ( )a a aK X Y K X K Y aK X Xa a
X Y
K X K Y
Dist.: Truth: Rule R:
9. MP 7,8
10. [b doesn’t know]
¬ ¬ ¬a b a bK K B K K A¬a bK K B
11. MP 9,10¬ ¬a bK K A
12. [b sees a]
13. Distribution
14. MP 12,13
15. MP 11,14
(¬ ¬ )a b bK K A K A(¬ ¬ ) ( ¬ ¬ )a b b a b a bK K A K A K K A K K A ¬ ¬a b a bK K A K K A
a bK K A
It means that A knows that B knows A’s forehead is muddy!
53
Proof (cont’d)
( ) ( )a a aK X Y K X K Y aK X Xa a
X Y
K X K Y
Dist.: Truth: Rule R:
9. MP 7,8
10. [b doesn’t know]
¬ ¬ ¬a b a bK K B K K A¬a bK K B
11. MP 9,10¬ ¬a bK K A
12. [b sees a]
13. Distribution
14. MP 12,13
15. MP 11,14
16. Truth
17. Rule R 1618. MP 15,17
(¬ ¬ )a b bK K A K A(¬ ¬ ) ( ¬ ¬ )a b b a b a bK K A K A K K A K K A ¬ ¬a b a bK K A K K A
a bK K A
bK A A
a b aK K A K AaK A
A knows h
is
forehead is
muddy!
Q.E.D.
54545454
[Vaughan Pratt 1974]
5555
Dynamic LogicWe will concentrate on:
Propositional Dynamic Logic (PDL)
[Fischer & Lander 1977]
5656
What is Dynamic Logic?Program verification ensures that a program
is correct, meaning that any possible input/ output combination is expected based on the specifications of the program.
A modal logic, called dynamic logic, was developed to verify programs.
5757
PDL SyntaxLet ={p1, p2, p3, … } – a non-empty set of
propositions.
An ‘atomic’ program is a smallest basic program, meaning it does not consist of other programs.
Let ={a1, a2, a3, … } – a non-empty set of atomic programs.
5858
PDL Formulas
Formulas:
If p, then p is a formula.
If and are formulas, then , , , ,
are formulas.
If is a formula and is a program, then [],
<> are formulas.
5959
PDL ProgramsPrograms:
If a, then a is a program.If and are programs, then ;(sequential
composition), (nondeterministic choice), and *(iteration) are programs.
If is a formula, then ? (test) is a program.
Operators precedence: Unary operators.The operator ‘;’, and the operator .Classical Logic operators.
6060
Program Operators Interpretation
;: means “do and then ”.
: means “do either or (non-
deterministically)”.
*: means “repeat some finite number of
times”.
?: means “test : continue if is true,
otherwise ‘fail’”.
6161
Modal Operators Interpretation
[] means that “if terminates, then holds” or in other terms “after every terminating execution of , holds”.
<> means that “there is an execution of that terminates with as true”.
6262
Programming Statements
We can write some classical programming statements, such as loop constructs, using PDL program operators:
‘if then else ’ =def (?;)(?;)
‘while do ’ =def (?;)*;?
‘repeat until ’ =def ;(?;)*;?
6363
PDL SemanticsA modal structure is M=(W,{Ra|a},V).
W is a set of program states.Ra is one or more binary relation(s) that
determines which states are accessible from any state in W.
V is a function from {W} to {true, false}.
6464
Accessibility RelationsWe consider (w,w’)Ra as the case that w is
the initial state of program a and w’ is an ending state.
Developed accessibility relations:
We will give the definition of R? after presenting the
definition of .
; {( , ') | '' . . '' '' '}α β def α βR w w w s t wR w w R w
α β def α βR R R
* 0 0
1
{( , ) | ,..., 0, ,
. . ( , ) 0 1}
α def n n
i i α
R u v u u where n u u v u
s t u u R for i n
6565
The relation between a pair (M,w) where M is a model and w is a state, and a formula A, is defined recursively as follows: Similar for the other classical logic connectors.
The Semantic Relation
, , Φ ( , )M w p p V p w true ‘, , ,M w A B M w A and M w B‘ p ‘ ‘Ù
, [ ] ( , ) ,αM w α A x W if w x R then M x A ‘ [ ‘, . . ( , ) ,αM w α A x W s t w x R M x A ‘ < ‘Ù
‘
6666
The R? relation
R? =def {(u,u) | M,u }
For example, we can define the accessibility relation for the while-do program (;)*;?:
0 0
1
{( , ) | ,..., 0, ,
. . , , 0 1 ( , )
0 1, , }
while do def n n
i i i α
n
R u v u u where n u u v u
s t M u φ i n and u u R
for i n and M u φ
‘
‘
6767
Applications of PDL
A correctness specification is a formal description of how a program is to behave.
A program is correct if its output meets the correctness specification.
PDL, and hence dynamic logic, is not well-suited about program behavior at intermediary states. Other logics that do so are process logic and temporal logic.
6868
Applications of PDLPDL is better suited to reasoning about program
behavior with respect to only input and output states.
For example, the accessibility relation for a program only contains information about an input and an output state, i.e., (w,w’)R means that w’ is an output state when program is run with initial state w.
Thus, a reasonable restriction for dynamic logic is to only consider programs that halt (so its correctness specifications are usually in the form of input/output).
70
A PDL ExampleLet a,b be atomic programs.Let p be an atomic proposition.Suppose M=(W,Ra,Rb,V)
W = {s,t,u,v}Ra = {(u,s),(v,t),(s,u),(t,v)}Rb = {(u,v),(v,u),(s,t),(t,s)}
s t
vu
b
b
aa
p
V(p,u) = V(p,v) = true
71
A PDL ExampleProve: Mp[(ab*a)*]p
Proof:M,wp[(ab*a)*]p (xW.(w,x)R(ab*a)*M,xp) (M,wp)
What is R(ab*a)*?
s t
vu
b
b
aa
p
72
A PDL ExampleR(ab*a)*:
Let’s build it from:Rb*={(u,u), (u,v), (v,u), (v,v), (s,s), (s,t), (t,s),
(t,t)}Rab*={(u,s), (u,t), (v,s), (v,t), (s,u), (s,v), (t,u),
(t,v)}Rab*a={(u,u), (u,v), (v,u), (v,v), (s,s), (s,t),
(t,s), (t,t)}R(ab*a)*={(u,u), (u,v), (v,u), (v,v), (s,s), (s,t),
(t,s), (t,t)}
s t
vu
b
b
aa
p
73
A PDL ExampleM,wp[(ab*a)*]p
(xW.(w,x)R(ab*a)*M,xp) (M,wp)
R(ab*a)*={(u,u), (u,v), (v,u), (v,v), (s,s), (s,t), (t,s), (t,t)}
If M,wp then w{u,v} and so:For each accessible state x from w (that are u
and v), M,xp. If M,wp then w{s,t} and so:
There is an accessible state x from w (for instance, s itself), such that M,xp.
Thus, Mp[(ab*a)*]p.
s t
vu
b
b
aa
p
Q.E.D.
74
A PDL Example
Let: = (aabb(abba)(aabb)*(abba))*M []
Proof:M,w [] (xW.(w,x)RM,x) (M,w)
What is R?
s t
vu
b
b
aa
p
75
A PDL ExampleR:
Let’s build it from:Raa = {(u,u), (v,v), (s,s), (t,t)}
Rbb = {(u,u), (v,v), (s,s), (t,t)}
Rab = {(u,t), (v,s), (s,v), (t,u)}
Rba = {(u,t), (v,s), (s,v), (t,u)}
R = {(u,u), (v,v), (s,s), (t,t)}
= (aabb(abba)(aabb)*(abba))*
The identity
relation RI
s t
vu
b
b
aa
p
76
A PDL Example
M,w [] (xW.(w,x)RM,x) (M,w)
R = {(u,u), (v,v), (s,s), (t,t)}
In conclusion,The only state accessible from w is w itself.And so, (xW.(w,x)RM,xp) (M,wp)Thus, M [].
s t
vu
b
b
aa
p
Q.E.D.
7777
SummaryModal logic as an extension of classical logicPossible worlds semanticsLogics and normal logicsAxiomatic systemsExtensions of multi-modal logic.First order modal logicVarious Applications of modal logic- focus on
artificial intelligence and program verification
787878
Recommended