320 likes | 349 Views
Explore the syntax, semantics, and applications of Modal and Dynamic Logic, including Kripke Semantics, Proof Rules, and Axiom Systems. Dive into syntax, states, program evaluation, and axiom rules for prepositional and predicate logic in a dynamic setting. Learn the principles, theorems, and derivations to enhance your knowledge in logical reasoning.
E N D
Modal, Dynamic and Temporal Logics SWE 623 Duminda Wijesekera
Modal 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” • <> read as possibility (<> X “possibly X”) • Also called “diamond X” • See http://turing.wins.uva.nl/~mdr/AiML/background.html Duminda Wijesekera
Kripke Semantics of Modal Logic W4 W1 • 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. W2 W3 Duminda Wijesekera
Kripke Semantics of Modal Logic W4 W1 • 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 <> X if X is satisfied in at least one world accessible from W1. W2 W3 • Notation: • W1 |= <> X if and only if • W3 |= X or W4 |= X Duminda Wijesekera
Proof Rules for Modal Logic • Modal Generalization A [] A • Monotonicity of A B A B • Monotonicity of A B [] A []B Duminda Wijesekera
An Axiom System for Prepositional Logic • (A (B C)) (A B) (A C) • A (B A) • (( A false ) false ) A • Modus Ponens A, A -> B B Duminda Wijesekera
An Axiom System for Predicate Logic • x (A(x) B(x)) (xA(x) xB(x)) • x A(x) A[t/x] provided t is free for x in A • A x A(x) provided x is not free in A • Modus Ponens A, A -> B B • Generalization A x A(x) Duminda Wijesekera
Some Facts About Modal Logic • A couple of Valid Modal Formulas: • (A B ) <-> ( A) ( B) • [](A B ) <-> ([] A) ([] B) • (false) (false) • ( A) ([]B) (A B ) • Counter-examples to invalid modal formulas • ( A) ( [] A ) Duminda Wijesekera
Proving Modal Formulas Duminda Wijesekera
A counter-example in Modal Logic Duminda Wijesekera
Dynamic 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). Duminda Wijesekera
Dynamic 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. Duminda Wijesekera
Prepositional Dynamic LogicSyntax • If A, B propositions and a, b programs, • Following are formulas • A /\ B, A B, A, A B, [a]A, < a>A are formulas. • Following are programs • U b = non-deterministic choice a; b = sequential composition (A?) a = test. a* = non-deterministic iteration Duminda Wijesekera
Prepositional Dynamic LogicSemantics • A collection of states: S = {si : i >= 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 } • Ra;b = Ra ; Rb ={ (s1,s3) : s2 (s1,s2) e Ra and(s2,s3) e Rb } • Ra* = U {Rai: i >=0 }. WhereRaiis defined inductively as Ra(i+1) = Rai ; RaandRa0 = Identity. Duminda Wijesekera
PDL 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 |= [a]A, if for all states sj such that (si , sj) e Ra sj |= A • I.e. si |= <a>A, there is a state sj with (si , sj) e Ra andsj |= A Duminda Wijesekera
PDL Axiom System • Axioms of prepositional logic • [a] (A B) ([a]A [a]B) • [a] (A /\B) <-> ([a]A /\ [a]B) • [a U b]A <-> ([a] A /\ [b] A) • [a ; b]A <-> [a] [b] A • [B?]A <-> (B /\ A) • B /\ [a] [a*] A <-> [a*] A • B /\ [a*]( A [a]A) [a*] A Duminda Wijesekera
PDL Axiom System: Rules • Modus Ponens A, A -> B B • Modal Generalization A [a] A Duminda Wijesekera
Some Derived Rules for PDL • Monotonicity of <a> A -> B <a>A -> <a>B • Monotonicity of [a] A -> B [a]A -> [a]B Duminda Wijesekera
Some Provable Properties • [a] (A /\B) ([a]A /\[a]B) • <a> (A \/B) <-> (<a>A \/ <a>B) • (<a>A /\ [a] B) <a>(A /\ B) • [a ]A <-> ( <a>( A)) • <a>false <-> false • <a><b>A <-> <a;b>A, • [a][b]A <-> [a;b] A • < a U b>A <-> (<a>A \/ <b>B) • [ a U b]A <-> ([a]A /\ [b]B) Duminda Wijesekera
Translating Gires’s 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?) Duminda Wijesekera
First-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 [a]A, <a>A 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. Duminda Wijesekera
First-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. Duminda Wijesekera
Axiomatization • Axioms • All axioms for predicate logic • All axioms for PDL • A[t/x] <-> < x:= t>A(x) • A <-> A’, A’ is obtained by replacing any program a by z:=x; a’; x:=z, where a’ is a with all occurrences of x replaced by z, and z does not appear in a Duminda Wijesekera
Axiomatization: Rules • modus ponens A, A -> B B • Generalization A A [a] A x A(x) • Infinitary convergence A -> [an]B for all n B -> [a*]B Duminda Wijesekera
Some Example Reductions I • Reduce: X:=X+1; ((X:=a) U (X:=b)) A(X) • Step1: X=X+1; (X=a) (X=b) A(X) • Step2: X=X+1 (X=a) A(X) <X=X+1 (X=b) A(X) • Step3: X=X+1 A • Step4: A(a) A(b) Duminda Wijesekera
Some Example Reductions II • Reduce: [x:=x+1;(x:=a U x:=b)] B(X) • Step1: [x:=a+1 U x:=b+1]B(x) • Step 2: [x:=a+1]B(x) /\ [x:=b+1]B(x) • Step 3: B(a+1) /\ B(b+1) Duminda Wijesekera
Temporal 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 (MacMillan’s Notation) • O = next time F • [] = always G • = some times X • = until U Duminda Wijesekera
Prepositional Syntax • Atomic Proposition letters p, q etc. • If p, q are propositions then so are. • MeaningLogical NotationModel Checking • Next Time p: Op Xp • All ways p: []p Gp • In the future p: p Fp • p until q: p q pUq Duminda Wijesekera
Prepositional Semantics • A collection of Kripke Worlds including the current one. • Accessibility relation is evolution of time. Duminda Wijesekera
Prepositional 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. Duminda Wijesekera
PTL Axioms and Rules I • Axioms • [](A ->B) ->([]A -> []B) • O(A ->B) -> (OA -> OB) • (O A) <-> (OA) • []A -> (A /\ O[]A) • [](A -> OA) -> (A -> []A) • A B -> B • A B <-> B \/ (A /\ O(A B )) Duminda Wijesekera
PTL Axioms and Rules II • Rules • modus ponens • generalization A [] A A O A Duminda Wijesekera