Skip to content

Some exercise solutions for

Verification of Sequential and Concurrent Programs. Krzysztof R. Apt, Frank S. de Boer, Ernst-R ¨udiger Olderog. Series: Texts in Computer Science. Springer. 3rd ed. 2nd Printing. ISBN: 978-1-84882-744-8

2.9 Exercises

2.1

i

(p(qr))(q(rp))(p(qr))(q(¬rp))(p(qr))(¬q(¬rp))(p(qr))(¬q¬rp)(p(qr))(p(¬q¬r))p((qr)(¬q¬r))

ii

(s<ts=t)t<ustt<u

iii

\existx:(x<t(p(qr)))s=u(\existx:x<t(p(qr)))s=u((\existx:x<t)(p(qr)))s=u((\existx:x<t)pqr)s=u

2.2

i

(x+y)[x:=z][z:=y](z+y)[z:=y]y+y

ii

(a[x]+y)[x:=z][a[2]:=1](a[z]+y)[a[2]:=1]if z[a[2]:=1]=2 then 1 else a[z[a[2]:=1]] fi+yif z=2 then 1 else a[z] fi+y

iii

a[a[2]][a[2]:=2]2

2.3

i

σ[x:=0](a[x])=(σ[x:=0](a))(σ[x:=0](x))=σ(a)(0)=σ(a[0])

ii

σ[y:=0](a[x])=(σ[y:=0](a))(σ[y:=0](x))=σ(a)(σ(x))=σ(a[x])

iii

σ[a[0]:=2](a[x])=σ[a[0]:=2](a)(σ[a[0]:=2](x))=σ[a[0]:=2](a)(σ(x))={2if σ(x)=0,σ(a[x])otherwise.

iv

τ[a[x]:=τ(x)](a[1])=σ[x:=1][a[1]:=2][a[x]:=1](a)(1)=1

2.4

i

σp(qr)(σp)(σ(qr))(σp)((σq)(σr))(σp)(σq)(σr)(σpq)(σr)σ(pq)r

ii

σp(qr)(σp)(σq)(σr)(σpq)(σr)σ(pq)r

iii

σp(qr)(σp)(σ(qr))(σp)((σq)(σr))((σp)(σq))((σp)(σr))σ(pq)(pr)

iv

Similar to the above.

v

σ\existx:(pq)σ[x:=d]pq(σ[x:=d]p)(σ[x:=d]q)σ\existx:p\existx:q

vi

Similar to the above.

2.5

i

No. e.g. p(x)(x=0),q(x)(x=1)

L.H.S is always false, since x has to be 0 and 1 at the same time.

R.H.S is true, since p and q can use different x.

ii

Similar to the above.

iii

(\existx:z=x+1)[z:=x+2](\existx:z=x+1)[x:=y][z:=x+2](\existy:z=y+1)[z:=x+2]\existy:x+2=y+1

iv

(\existx:a[s]=x+1)[a[s]:=x+2](\existy:a[s]=y+1)[a[s]:=x+2]\existy:x+2=y+1

2.6

i

σx:p{ definition of  }τ:σ=τ mod xτp{ let τ=σ[x:=d], where dDT }dDT:σ[x:=d]pdDT:σ[x:=d]p{ suppose for any τ such that σ=τ mod x }τ:σ=τ mod xτp{definition of }σx:p

ii

Similar to the above.

2.7

i

\llbracket¬p\rrbracket={meaning of an assertion}{σΣσ¬p}={definition of negation}{σΣσp}c={meaning of an assertion}Σ{σΣσp}

ii

\llbracketpq\rrbracket={meaning of an assertion}{σσpq}={definition of disjunction}{σ(σp)(σq)}={for any τ in the set above, (τp)(τq)}{σσp}{σσq}={meaning of an assertion}\llbracketp\rrbracket\llbracketq\rrbracket

iii

Similar to the above.

iv

pq{for any τp, apply pq}(τp)(τq){definition of implication}τpq{summarize}τ{σσp}τ{σσpq}{definition of subset}{σσp}{σσpq}{meaning of an assertion}\llbracketp\rrbracket\llbracketq\rrbracket

v

Similar to the above.

2.8

i

Since both σ and τ agree on all variables in the expression s, the evaluated result must be the same.

ii

Since both σ and τ agree on all free variables of p, the truth value of p under σ and τ must be the same. Therefore, σp if and only if τp.