Dynamic Logic for While Programs: Cheat Sheet, Slides of Logic

A cheat sheet for Dynamic Logic for While Programs. It includes operators, statements, effects, and axioms of Dynamic Logic, as well as first-order axioms and sequent calculus proof rules. a comprehensive overview of Dynamic Logic for While Programs and can be used as study notes or a summary for students studying this topic.

Typology: Slides

2022/2023

Uploaded on 03/14/2023

amlay
amlay 🇺🇸

4.1

(19)

383 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Dynamic Logic for While Programs: Cheat Sheet A.Platzer 1
1: Operators of Dynamic Logic for While Programs
DL Operator Meaning
e= ˜eequals true iff values of terms eand ˜eare equal
e˜egreater-or-equal true iff value of egreater-or-equal to value of ˜e
p(e1, . . . , ek) predicate true iff pholds for the value of (e1, . . . , ek)
¬Pnegation / not true if Pis false
PQconjunction / and true if both Pand Qare true
PQdisjunction / or true if Pis true or if Qis true
PQimplication / implies true if Pis false or Qis true
PQbi-implication / equivalent true if Pand Qare both true or both false
x P universal quantifier / for all true if Pis true for all real values of variable x
x P existential quantifier / exists true if Pis true for some real value of variable x
[α]P[·] modality / box true if Pis true after all runs of HP α
hαiPh·i modality / diamond true if Pis true after at least one run of HP α
2: Statements and Effects of While Programs
Program Operation Effect
x:= eassignment assigns value of term eto variable x
?Qtest check truth of first-order formula Qat current state
α;βsequential composition βstarts after αfinishes
if(Q)αelse βif-then-else run αif Qis true at current state else run β
while(Q)αwhile loop repeats αas long as Qis true
αnondeterministic repetition repeats α n-times for any nN
3: Semantics of Dynamic Logic formula Pin interpretation I
ω|=e˜eiff ω[[e]] ω[e]]
ω|=p(e1, . . . , ek) iff (ω[[e1]], . . . , ω[[ek]]) I(p) where predicate symbol pis interpreted as relation I(p)
ω|=¬Piff ω6|=Pthat is, it is not the case that ω|=P
ω|=PQiff ω|=Pand ω|=Q
ω|=PQiff ω6|=Por ω|=Q
ω|=x P iff ν|=Pfor some state νwith ν=ωexcept for the value of x
ω|=x P iff ν|=Pfor all states νwith ν=ωexcept for the value of x
ω|=hαiPiff ν|=Pfor some state νsuch that (ω, ν)[[α]]
ω|= [α]Piff ν|=Pfor all states νsuch that (ω, ν)[[α]]
4: Semantics of While Program αis relation [[α]] S × S between initial and final states
[[x:= e]] = {(ω, ν ) : ν=ωexcept ν[[x]] = ω[[e]]}
[[?Q]] = {(ω, ω) : ω|=Q}
[[if(Q)αelse β]] = {(ω, ν ) : (ω|=Qand (ω, ν )[[α]]) or (ω6|=Qand (ω , ν)[[β]])}
[[α;β]] = {(ω, ν ) : (ω, µ)[[α]],(µ , ν)[[β]]}
[[α]] = {(ω, ν) : there are nN, µ0=ω, µ1, µ2, . . . , µn=νsuch that (µi, µi+1)[[α]] for all 0i<n
[[while(Q)α]] = (ω, ν ) : µ0=ω, µ1, µ2, . . . , µn=νand µi|=Q, (µi, µi+1)[[α]] and µn6|=Qfor all 0i<n
1
pf3

Partial preview of the text

Download Dynamic Logic for While Programs: Cheat Sheet and more Slides Logic in PDF only on Docsity!

1: Operators of Dynamic Logic for While Programs DL Operator Meaning e = ˜e equals true iff values of terms e and ˜e are equal e ≥ e˜ greater-or-equal true iff value of e greater-or-equal to value of ˜e p(e 1 ,... , ek) predicate true iff p holds for the value of (e 1 ,... , ek) ¬P negation / not true if P is false P ∧ Q conjunction / and true if both P and Q are true P ∨ Q disjunction / or true if P is true or if Q is true P → Q implication / implies true if P is false or Q is true P ↔ Q bi-implication / equivalent true if P and Q are both true or both false ∀x P universal quantifier / for all true if P is true for all real values of variable x ∃x P existential quantifier / exists true if P is true for some real value of variable x [α]P [·] modality / box true if P is true after all runs of HP α 〈α〉P 〈·〉 modality / diamond true if P is true after at least one run of HP α

2: Statements and Effects of While Programs Program Operation Effect x := e assignment assigns value of term e to variable x ?Q test check truth of first-order formula Q at current state α; β sequential composition β starts after α finishes if(Q) α else β if-then-else run α if Q is true at current state else run β while(Q) α while loop repeats α as long as Q is true α∗^ nondeterministic repetition repeats α n-times for any n ∈ N

3: Semantics of Dynamic Logic formula P in interpretation I ω |= e ≥ e˜ iff ω[[e]] ≥ ω[[˜e]] ω |= p(e 1 ,... , ek) iff (ω[[e 1 ]],... , ω[[ek]]) ∈ I(p) where predicate symbol p is interpreted as relation I(p) ω |= ¬P iff ω 6 |= P that is, it is not the case that ω |= P ω |= P ∧ Q iff ω |= P and ω |= Q ω |= P → Q iff ω 6 |= P or ω |= Q ω |= ∃x P iff ν |= P for some state ν with ν = ω except for the value of x ω |= ∀x P iff ν |= P for all states ν with ν = ω except for the value of x ω |= 〈α〉P iff ν |= P for some state ν such that (ω, ν) ∈ [[α]] ω |= [α]P iff ν |= P for all states ν such that (ω, ν) ∈ [[α]]

4: Semantics of While Program α is relation [[α]] ⊆ S × S between initial and final states

[[x := e]] = {(ω, ν) : ν = ω except ν[[x]] = ω[[e]]} [[?Q]] = {(ω, ω) : ω |= Q} [[if(Q) α else β]] = {(ω, ν) : (ω |= Q and (ω, ν) ∈ [[α]]) or (ω 6 |= Q and (ω, ν) ∈ [[β]])} [[α; β]] = {(ω, ν) : (ω, μ) ∈ [[α]], (μ, ν) ∈ [[β]]} [[α∗]] = {(ω, ν) : there are n∈N, μ 0 =ω, μ 1 , μ 2 ,... , μn=ν such that (μi, μi+1) ∈ [[α]] for all 0≤i<n

[[while(Q) α]] =

(ω, ν) : μ 0 =ω, μ 1 , μ 2 ,... , μn=ν and μi |= Q, (μi, μi+1) ∈ [[α]] and μn 6 |= Q for all 0≤i<n

5: Dynamic Logic axioms 〈·〉 〈α〉P ↔ ¬[α]¬P [:=] [x := e]p(x) ↔ p(e) [?] [?Q]P ↔ (Q → P ) [if] [if(Q) α else β]P ↔ (Q → [α]P ) ∧ (¬Q → [β]P ) [;] [α; β]P ↔ [α][β]P

[unwind] [while(Q) α]P ↔ [if(Q) {α; while(Q) α}]P

K [α](P → Q) → ([α]P → [α]Q) I [α∗]P ↔ P ∧ [α∗](P → [α]P )

C [α∗]∀n>0 (ϕ(n) → 〈α〉ϕ(n − 1)) → ∀n≥0 (ϕ(n) → 〈α∗〉ϕ(0)) (n^6 ∈^ α) V p → [α]p (FV(p) ∩ BV(α) = ∅) Det 〈α〉P → [α]P (α is deterministic)

6: First-order axioms ∀i (∀x p(x)) → p(e) (arbitrary term e)

∀→ ∀x (P → Q) → (∀x P → ∀x Q)

V∀ p → ∀x p (x 6 ∈ FV(p))

7: Dynamic Logic sequent calculus proof rules

loop Γ J, ∆ J [α]J J P Γ [α∗]P, ∆

while Γ J, ∆ J, Q [α]J J, ¬Q P Γ [while(Q) α]P, ∆ con Γ ∃n≥ 0 ϕ(n), ∆ ϕ(n), n> 0 〈α〉ϕ(n − 1) ϕ(0) P Γ 〈α∗〉P, ∆ (n new)

var Γ J, ∆ J, Q, ϕ = n 〈α〉(J ∧ ϕ < n) J, Q ϕ ≥ 0 J, ¬Q P Γ ` 〈while(Q) α〉P, ∆ (n new)

M[·] R

Γ [α]Q, ∆ Q P Γ [α]P, ∆ M[·] L Γ, [α]Q ∆ P Q Γ, [α]P ∆ G

P

Γ ` [α]P, ∆

M〈·〉 R

Γ 〈α〉Q, ∆ Q P Γ 〈α〉P, ∆ M〈·〉 L Γ, 〈α〉Q ∆ P Q Γ, 〈α〉P