In logic, philosophy, and theoretical computer science, dynamic logic is an extension of modal logic capable of encoding properties of computer programs. A simple example of a statement in dynamic logic is
The ground is dry→[It rains]The ground is wet, which states that if the ground is currently dry and it rains, then afterwards the ground will be wet. The syntax of dynamic logic contains a language of propositions (like "the ground is dry") and a language of actions (like "it rains"). The core modal constructs are [a]p, which states that after performing action a the proposition p should hold, and ⟨a⟩p, which states that after performing action a it is possible that p holds. The action language supports operations a;b (doing one action followed by another), a∪b (doing one action or another), and iteration a∗ (doing one action zero or more times). The proposition language supports Boolean operations (and, or, and not). The action logic is expressive enough to encode programs. For an arbitrary program P, precondition φ, and postcondition φ′, the dynamic logic statement φ→[P]φ′ encodes the correctness of the program, making dynamic logic more general than Hoare logic. Beyond its use in formal verification of programs, dynamic logic has been applied to describe complex behaviors arising in linguistics, philosophy, AI, and other fields.
Language Modal logic is characterized by the modal operators ◻p (box p) asserting that p is necessarily the case, and ◊p (diamond p) asserting that p is possibly the case. Dynamic logic extends this by associating to every action a the modal operators [a] and ⟨a⟩, thereby making it a multimodal logic. The meaning of [a]p is that after performing action a it is necessarily the case that p holds, that is, a must bring about p. The meaning of ⟨a⟩p is that after performing a it is possible that p holds, that is, a might bring about p. These operators are dual to each other, which means they are related by [a]p↔¬⟨a⟩¬p and ⟨a⟩p↔¬[a]¬p, analogously to the relationship between the universal (∀) and existential (∃) quantifiers. Dynamic logic permits compound actions built up from smaller actions. While the basic control operators of any programming language could be used for this purpose, Kleene's regular expression operators are a good match to modal logic. Given actions a and b, the compound action a∪b, choice, also written a+b or a|b, is performed by performing one of a or b. The compound action a;b, sequence, is performed by performing first a and then b. The compound action a∗, iteration, is performed by performing a zero or more times, sequentially. The constant action 0 or BLOCK does nothing and does not terminate, whereas the constant action 1 or SKIP or NOP, definable as 0∗, does nothing but does terminate.
Axioms These operators can be axiomatized in dynamic logic as follows, taking as already given a suitable axiomatization of modal logic including such axioms for modal operators as the above-mentioned axiom [a]p↔¬⟨a⟩¬p and the two inference rules modus ponens (⊢p and ⊢p→q implies ⊢q) and necessitation (⊢p implies ⊢[a]p). A1. [0]p A2. [1]p↔p A3. [a∪b]p↔[a]p∧[b]p A4. [a;b]p↔[a][b]p A5. [a∗]p↔p∧[a][a∗]p A6. p∧[a∗](p→[a]p)→[a∗]p Axiom A1 makes the empty promise that when BLOCK terminates, p will hold, even if p is the proposition false. (Thus BLOCK abstracts the essence of the action of hell freezing over.) A2 says that NOP acts as the identity function on propositions, that is, it transforms p into itself. A3 says that if doing one of a or b must bring about p, then a must bring about p and likewise for b, and conversely. A4 says that if doing a and then b must bring about p, then a must bring about a situation in which b must bring about p. A5 is the evident result of applying A2, A3 and A4 to the equation a∗=1∪a;a∗ of Kleene algebra. A6 asserts that if p holds now, and no matter how often we perform a it remains the case that the truth of p after that performance entails its truth after one more performance of a, then p must remain true no matter how often we perform a. A6 is recognizable as mathematical induction with the action n := n+1 of incrementing n generalized to arbitrary actions a.
Derivations The modal logic axiom [a]p↔¬⟨a⟩¬p permits the derivation of the following six theorems corresponding to the above: T1. ¬⟨0⟩p T2. ⟨1⟩p↔p T3. ⟨a∪b⟩p↔⟨a⟩p∨⟨b⟩p T4. ⟨a;b⟩p↔⟨a⟩⟨b⟩p T5. ⟨a∗⟩p↔p∨⟨a⟩⟨a∗⟩p T6. ⟨a∗⟩p→p∨⟨a∗⟩(¬p∧⟨a⟩p) T1 asserts the impossibility of bringing anything about by performing BLOCK. T2 notes again that NOP changes nothing, bearing in mind that NOP is both deterministic and terminating whence [1] and ⟨1⟩ have the same force. T3 says that if the choice of a or b could bring about p, then either a or b alone could bring about p. T4 is just like A4. T5 is explained as for A5. T6 asserts that if it is possible to bring about p by performing a sufficiently often, then either p is true now or it is possible to perform a repeatedly to bring about a situation where p is (still) false but one more performance of a could bring about p. Box and diamond are entirely symmetric with regard to which one takes as primitive. An alternative axiomatization would have been to take the theorems T1–T6 as axioms, from which we could then have derived A1–A6 as theorems. The difference between implication and inference is the same in dynamic logic as in any other logic: whereas the implication p→q asserts that if p is true then so is q, the inference p⊢q asserts that if p is valid then so is q. However the dynamic nature of dynamic logic moves this distinction out of the realm of abstract axiomatics into the common-sense experience of situations in flux. The inference rule p⊢[a]p, for example, is sound because its premise asserts that p holds at all times, whence no matter where a might take us, p will be true there. The implication p→[a]p is not valid, however, because the truth of p at the present moment is no guarantee of its truth after performing a. For example, p→[a]p will be true in any situation where p is false, or in any situation where [a]p is true, but the assertion (x=1)→[x:=x+1](x=1) is false in any situation where x has value 1, and therefore is not valid.
… excerpt ends here. Continue reading the full article.