Title: Modal, Dynamic and Temporal Logics
1Modal, Dynamic and Temporal Logics
2Modal Logic
- Logic of Necessity and Possibility
- Has a philosophical background
- Syntax has two extra symbols
- read as necessity ( X is necessarily X)
- Also called box X
- ltgt read as possibility (ltgt X possibly X)
- Also called diamond X
- See http//turing.wins.uva.nl/mdr/AiML/background
.html
3Kripke Semantics of Modal Logic
- The universe seen as a collection of worlds.
- Truth defined in each world.
- Say U is the universe.
- I.e. each w e U is a prepositional or predicate
model.
W4
W1
W2
W3
4Kripke Semantics of Modal Logic
- W1 satisfies X if X is satisfied in each
world accessible from W1. - If W3 and W4 satisfy X.
- Notation
- W1 X if and only if
- W3 X and W4 X
- W1 W1 satisfies ltgt X if X is satisfied in at
least one world accessible from W1.
W4
W1
W2
W3
- Notation
- W1 ltgt X if and only if
- W3 X or W4 X
5Proof Rules for Modal Logic
- Modal Generalization
- A
- A
- Monotonicity of ?
- A ? B
- ? A ? ? B
- Monotonicity of ?
- A ? B
- ? ? A ? ?B
6An Axiom System for Prepositional Logic
- (A ? (B ? C)) ? (A ? B) ? (A ? C)
- A ? (B ? A)
- (( A ? false ) ? false ) A
- Modus Ponens
- A, A -gt B
- ? ? B
7An Axiom System for Predicate Logic
- ?x (A(x) ? B(x)) ? (?xA(x) ? ?xB(x))
- ?x A(x) ? At/x provided t is free for x in A
- A ? ?x A(x) provided x is not free in A
- Modus Ponens
- A, A -gt B
- B
- Generalization
- A
- ?x A(x)
8Some Facts About Modal Logic
- A couple of Valid Modal Formulas
- ? (A ? B ) lt-gt (? A) ? (? B)
- (A ? B ) lt-gt ( A) ? ( B)
- ? (false) ?(false)
- (? A) ? (B) ? ? (A ? B )
- Counter-examples to invalid modal formulas
- (? A) ? ( A )
9Proving Modal Formulas
10A counter-example in Modal Logic
11Dynamic Logic
- A special kind of Modal Logic where each world is
a system state. - Definition of State
- The set of variables x1, xn.
- x1 a1, xn an. is a state, where each variable
takes a value. - Accessibility is state change perhaps due to
executing code. - x1 a1, xn an is changed to x1 b1, xn an
by the program (x1 b1).
12Dynamic Logic
- Issues
- What kind of program constructs result in what
type of state change - What is the logic
- Two Levels
- Prepositional
- Only deals with state change at (abstract)
symbolic level - Predicate
- Details of variables, values and programming
operators - Deals well with non-determinism, concurrency etc.
13Prepositional Dynamic LogicSyntax
- If A, B propositions and a, b programs,
- Following are formulas
- A /\ B, A ? B, ? A, A ? B, aA, lt agtA are
formulas. - Following are programs
- U b non-deterministic choice
- a b sequential composition
- (A?) a test.
- a non-deterministic iteration
14Prepositional Dynamic LogicSemantics
- A collection of states S si i gt 0.
- For each state si a notion of satisfiability of
atomic prepositions. I.e. si A for each A. - For each each atomic program a, a relation Ra on
SxS. - Raub Ra u Rb
- R(A?) (s,s) s A
- Rab Ra Rb (s1,s3) ? s2 (s1,s2) e Ra and
(s2,s3) e Rb - Ra U Rai i gt0 . Where Rai is defined
inductively as Ra(i1) Rai Ra and Ra0
Identity.
15PDL Semantics - Satisfaction
- Prepositional connectives as usual
- I.e. si A /\ B if si A and si B
- I.e. si A ? B if si A or si B
- Modal Connectives as in Modal Logic
- I.e. si aA, if for all states sj such that
(si , sj) e Ra sj A - I.e. si ltagtA, there is a state sj with (si ,
sj) e Ra and sj A
16PDL Axiom System
- Axioms of prepositional logic
- a (A ? B) ? (aA ?aB)
- a (A /\ B) lt-gt (aA /\ aB)
- a U bA lt-gt (a A /\ b A)
- a bA lt-gt a b A
- B?A lt-gt (B /\ A)
- B /\ a a A lt-gt a A
- B /\ a( A ?aA) ? a A
17PDL Axiom System Rules
- Modus Ponens
- A, A -gt B
- B
- Modal Generalization
- A
- a A
18Some Derived Rules for PDL
- Monotonicity of ltagt
- A -gt B
- ltagtA -gt ltagtB
- Monotonicity of a
- A -gt B
- aA -gt aB
19Some Provable Properties
- a (A /\ B) ? (aA /\aB)
- ltagt (A \/ B) lt-gt (ltagtA \/ ltagtB)
- (ltagtA /\ a B) ? ltagt(A /\ B)
- a A lt-gt (? ltagt(? A))
- ltagtfalse lt-gt false
- ltagtltbgtA lt-gt ltabgtA,
- abA lt-gt ab A
- lt a U bgtA lt-gt (ltagtA \/ ltbgtB)
- a U bA lt-gt (aA /\ bB)
20Translating Giress Style Pre/Post Conditions to
PDL
- Skip True?
- Fail false?
- If A then a else b (A?a) U (?A?b)
- While A do a (A?a) (?A?)
21First-Order Dynamic Logic
- Syntax
- The same definition as predicate logic except for
the additions - If A is a formula and a is a program, then aA,
ltagtA are formulas. - If A is a formula, then A? is a test. (I.e. a
program) - If A is quantifier free then its said to be a
basic test, and otherwise a rich test.
22First-Order Dynamic Logic
- Semantics Transitions between states defined as
- R(X a) (S, S) if S(x) S(a) and
S(y) S(y) for Y ! X - R(A?) (S,S) S A
- Definitions of U, are same as in the
prepositional case.
23Axiomatization
- Axioms
- All axioms for predicate logic
- All axioms for PDL
- At/x lt-gt lt x tgtA(x)
- A lt-gt A, A is obtained by replacing any program
a by zx a xz, where a is a with all
occurrences of x replaced by z, and z does not
appear in a
24Axiomatization Rules
- modus ponens
- A, A -gt B
- B
- Generalization
- A A
- a A ? x A(x)
- Infinitary convergence
- A -gt anB for all n
- B -gt aB
25Some Example Reductions I
- Reduce ?XX1 ((Xa) U (Xb)) ? A(X)
- Step1 ? XX1 (Xa) ? (Xb) ? A(X)
- Step2 ? XX1 ? ? (Xa) ? A(X) ? ltXX1
? ? (Xb) ? A(X) - Step3 ? XX1 ? A
- Step4 A(a) ? A(b)
26Some Example Reductions II
- Reduce xx1(xa U xb) B(X)
- Step1 xa1 U xb1B(x)
- Step 2 xa1B(x) /\ xb1B(x)
- Step 3 B(a1) /\ B(b1)
27Temporal Logic
- Special kind of modal logic to reason about time.
- There are many kinds of Temporal Logics
- Linear and Branching Time
- Future and Past times
- Discrete and Continuous time
- Operators in Temporal Logics (MacMillans
Notation) - O next time F
- always G
- ? some times X
- ? until U
28Prepositional Syntax
- Atomic Proposition letters p, q etc.
- If p, q are propositions then so are.
- Meaning Logical Notation Model Checking
- Next Time p Op Xp
- All ways p p Gp
- In the future p ?p Fp
- p until q p ? q pUq
29Prepositional Semantics
- A collection of Kripke Worlds including the
current one. - Accessibility relation is evolution of time.
30Prepositional Semantics II
- Op if some world accessible from the current
satisfies p. - p if every world accessible from the current
satisfies p. - ? p if some world in the future from the
current satisfies p.
31PTL Axioms and Rules I
- Axioms
- (A -gtB) -gt(A -gt B)
- O(A -gtB) -gt (OA -gt OB)
- (O ? A) lt-gt (?OA)
- A -gt (A /\ OA)
- (A -gt OA) -gt (A -gt A)
- A ? B -gt ?B
- A ? B lt-gt B \/ (A /\ O(A ? B ))
32PTL Axioms and Rules II
- Rules
- modus ponens
- generalization
- A
- A
- A
- O A