Professional Documents
Culture Documents
Faron Moller
Georg Struth
Modelling
Computing Systems
Mathematics for Computer Science
Undergraduate Topics in Computer Science
Undergraduate Topics in Computer Science (UTiCS) delivers high-quality instructional content for un-
dergraduates studying in all areas of computing and information science. From core foundational and
theoretical material to final-year topics and applications, UTiCS books take a fresh, concise, and mod-
ern approach and are ideal for self-study or for a one- or two-semester course. The texts are all authored
by established experts in their fields, reviewed by an international advisory board, and contain numer-
ous examples and problems. Many include fully worked solutions.
Modelling
Computing Systems
Contents
Preface xiii
0 Introduction 1
!
"
# $
%
&
'
(
(
)
) *
+
' )
, "
, $ * -
., &
/
.
"
2 5 ' #2
$2
* #22
$
( 4%
/ 2
) 2
$ #5
#2 4%
)
1
2 Sets 57
* )
"
$
, 4 & -
'
(
!
6 ' (
vi CONTENTS
!
!
!!
!
!"
#!
$
%
&$'
(
) !
($
*+"
,
,
"
!
&!!
*-
6 Functions 155
!
" #
$%&' "
$%&' (
)*
+ )
!(
,
!- !(
%
7 Relations 179
. /
0
" . /
0
&
. /
0
&
0
12
' /
0
$%&' /
00
!(
% /'
+ /
0
3&
+ . /
#
/
4
2
1
4
2
/
#
).%%
.%%
/
! 2
/
' /
2
/
2
$
3
!
" #
$ !
# %&& '
( )
! *
+ * "
, -'(&
%(
#& -'
!
"
#$
%
&
'
(
)'
* %+
, -! .'
%
/ 01
%
01
%
%
3
' /
%
$ .
' ,
& ,
, 01
,,
! 5 /
% 65 6 /
% #
$
/%
% .$ #
$ 07
/,
% )1 .
//
%
8(
9+
%
$
-
)1
9
% 1' )1
9
%% 01
! 5 9/
%% 65 6 9/
% )
)1
99
%, 01
+
Index 493
List of Figures
(
#
)) $
$
* +$
$
,- ¿ +.
$ /
0 1
$ /
1
1 2 '# 3
. 7
$
. 8 #
0 #& .
. 9#
:
6
6
!
#
%( ;:<:=:7 >## $
=78 $ # 1
+
.
$ (! #
.1
1 7
.
xii LIST OF FIGURES
$ $ $
+
.
.
,
/ 0 %
xiv Preface
! "
#$$%
&
'
( "
)
* "
+
"
&
,
-
-
,
!
&
(
,
!
. /
,
( !
&
,
)
!
0
, )
1 /
' .
&
,
!
Æ
2
)
1 // ) -
-
Preface xv
!
" #
" ##
$
%
&
'
" #
" ##
(
)
%
#
$
&
$
*
(
$
"
(
$
(
$
++
$
)
!
$
%
,
&&
&&
!
'
(
! ) ( " (
*
+
, -
. /
0 ( % "
" " Æ
Chapter 0
Introduction
"
#
$
% %
' (
+
' (
,
. /
(
(
$
%
%
"
&
%
' (
*
Examples of System Failures 3
Æ
!
"
#
"
$
% &
"
'
$
(
)*
+ ,-.,
)/
0 ,1.
'
#
2
3
$
! "
!
#
"
"
$
%
!
&
'
"
" "
"
"
"
"
(
'
"
)
*
+,
- ' .
/ 0 12234
0.1.2 USS Scorpion
5 6378
"
99 9
33 "
"
"
"
"
"
:
"
&
+,
0 ; <
=
$
633>4
"
*
&
'
"
*
:
:
0.1.3 Therac 25 Radiotherapy Machine
1?
+638?*8@4
*
Examples of System Failures 5
! "
#$
%
& $
'
26()
*+,* - *../)
0
&
1
2& )
3
4 5
&
2& )
)
2&
&
6
7)
0
0
)
0
8
8)
9
&
:
%
:
)
&
&
%
&
;
:
1 #< &
$
&
'
&
1 #0
:
&
'
1
"
5
5
!$=)
0 $"!$=
%
>
6 Introduction
!
"
#$
# %%
& "
#
'
(
#
)
#
%
'
(
*!
!
#
+ ,
- .
/
0
'
(
. ( 1
2/// .( 3
45 %6678
$
!
#
,
-
#
"
9 1
0.1.5 Intel Pentium
: 2 3
3.
%665
;
:
"
#
;
"
#
# $
"
%77
<
#
!
* 8
=
>
<
Examples of System Failures 7
Ü
Ý
! " # $
%
- -2!
)! 3 -2 4 - 5
)
- %
%+ 4 .
%+- 6 -2
- " - 76 %-
-2
" 0 % -2 -
76 % - !
0 ! -
- -
88
- -29 7 " 7
% 7 % 0 ! -
+ %
1
7
6 " -
%
*
" % 5- - - +7
+7 7 7 7 +7
1 4 0 % 1 -
% -
- 7% 6 --
!
-
1 0: 7
1 * 1 -
5- ! - !
76 6 76 - 6 0 . +
-
6! % % %
6 76 1
7%
%+ 4!
6 - % 0
7
6 %
%+ 4 " - % %
- 6 % 1
" 1 ) .;6 ' %
& -+
- % %
%- 6(
7- 1 <
& -
;
6 %
%- 6 % -
0
-
6( . - = > - 1-6
% - &-- ! - % - +
6 ;
6(
&1 ) .;6 ' !(
http://esamultimedia.esa.int/docs/esa-x-1819eng.pdf*
!"#
$
%
&
'
"
(
"
&
)
&
&
*
& +
,-
&
.
/
3
.
' 1
4
5
6
System
!
"
!
#
$
%
%
%
$
"
(
!
)
*
!
Model
+,-
. +/- $
0
$
!
System, Model, Abstraction and Notation 11
¯
#$%
¯
& '
#(%
Abstraction
+
,
-
!
"
#
$
%&' (((
)
*
+ !,
-
. $
%
!&
!&&
Notation
4
0
>4
*
6
>
-
9
"
?@
.
4
!7'(4!7'7
6
Specification, Implementation and Verification 13
!
!
"
#
$
%
&
) Specification
"
* Implementation
'
"
#
'
+ Verification
'
"
'
"
,
-
'
"
&
14 Introduction
!
Part I
Mathematics for
Computer Science
Chapter 1
Propositional Logic
% " ! & ' "
" (
" )! $
" # ) %
" * ! + ! , -
% ( ( ! " & -
" ! % &
% % ) ( "
"
%
&
%
/)
" ( %
" "
! %
%
0
"
" $ " % " %
" "
"
" "
!
"
"
conclusion #
Propositions and Deductions 19
premises
atomic propositions
This man
is dead
propositional connectives
or
Example 1.1
! "
# $%
$&'
(
(
( )
* (
+
+
( +
(
+
( ,
-
( *
(
.
( +
/ #
(
*
( .
(
( + .
+
( +
+
(
0
)
1
(
)
+ (
+ (
(
20 Propositional Logic
! " #
$ " %%& %
' (
)
*
) +
,
-
! ! .
%
/ !
!
.0 !
1.!
%
.0 / . 1
' %
% .
% 2
%! % !
%
+
Exercise 1.2 (Solution on page 405)
1
% %%
' 3
%! 1
1 . %
-1
1 . %
4 3
%%
' 3
%! 1
1 . %
4 3
%%
4 1
1 . %
'
!
%
4
%
4
$ 4
.
% 1%
5
1
% 1%
4
.
4
.
% 1%! 6
% 1%
7
% 1%
4
.
The Language of Propositional Logic 21
! "
#
"
$ "
"
%#
&
"
' "
"
%#
&
( "
"
%#
&
) "
#
%#
&
"
.
,
.
,.
, .
, . ,.
propositional connectives
&/
1.2.2 Negation
negation
( )
' 1
+
Example 1.3
! "
# $! % ! &'
1.2.3 Disjunction
disjunction
$
'
(
(
)
*
disjuncts
Example 1.4
Dead
Watch
+
Dead Watch
,
Dead Watch
Example 1.5
-
-
- ,
24 Propositional Logic
KingMoved RookMoved KingMoved
RookMoved
!
"
# $% &' $% ('
& $( )' $* ('
% $( +' $+ ,'
-
$
'
.
/
0 1
2
$
'
3 2
3
-
4
3
1
$ 51
##6
&7'
8
!
1
!
1.2.4 Conjunction
conjunction
conjuncts
Example 1.6
1.2.5 Implication
2
implication
3
26 Propositional Logic
¯
¯
Æ
¯
Example 1.7
JoelHappy
AmandaHappy
JoelHappy AmandaHappy AmandaHappy JoelHappy !
"
#
$
'
(
The Language of Propositional Logic 27
1.2.6 Equivalence
equivalence Ô ¸ Õ
Ô Õ
Ô
Õ
Ô Õ
Ô Õ
Ô Õ
¯Ô Õ
¯Ô Õ
Ô Õ
true
false
È
Ô Ô
ÔÕ Ô Õ
ÔÕ Ô Õ
ÔÕ Ô
Õ
!
"
#
$
% $
! &
"
%
'
"
(
$
"
#
(
) (
$
% ! & * +
%
! &
%
%
&
"
$ $
& ! &
(
% ,
È É Ê "
È É Ê
È É Ê
" ( %
,
-
Ô Õ Ö ×
"
Example 1.10
!
"
#
$
$ %
&
'
(
)
%
)
*
+ '
)
,
. / 0102
3 / 04
È É
È É
!
È É È É
È É
"
# È É
"
$
È É
$
È É
# È É
È É
# È É È É
"
È É È É
!
!
%
&
È É È É
&
Example 1.11
È
É
Ê
É
The Language of Propositional Logic 31
È
É Ê É
É Ê
É Ê É
È É Ê É
!!
"
È É Ê É
Example 1.12
#
È É
!
#
"
$$
È É
È É
È É
È É
%
È
É
É
%
É
&
# È É
!
!
%' (
!
!
$ È É É È
) È É È
* È É È
+ È É Ê Ë
, È É Ê È É È Ê
32 Propositional Logic
...
if CabinPressure < MinPressure then PrepareForLanding;
if FlightHeight < MinHeight then PrepareForLanding;
...
...
if (CabinPressure < MinPressure and FlightHeight < MinHeight)
then PrepareForLanding;
...
!
Pressure Height
"
Land
PrepareForLanding #
$Pressure Land% $Height Land%
$Pressure Height% Land
#
Pressure Land
Height Land
"
Pressure Height
Land
#
Pressure Height
Land
"
Example 1.14
"
!
!
¯
!
!
¯
!
!
!
!
!
!
!
!
!
!
# $% &
'
(
!
)
" * $+,%'$+-+ '
"
..
!
)
Exercise 1.14 (Solution on page 408)
Æ
/
" +,
0
#
RightToCastleLeft 1 RightToCastleRight
¯ LeftSquareAttack RightSquareAttack
¯ KingMoveLeftAttack KingMoveRightAttack
!
" #
# $ $
%
& '"
(
"
JonF )Joel*
$
JonO )Joel* !
$
FonJ )Felix*
$
FonO )Felix* !
$
OonJ )Oskar*
$
OonF )Oskar*
$
+ % #
$
)Oskar*
(
"
Æ
36 Propositional Logic
Example 1.16
“Everyone who sits quietly for the next hour
will get an ice cream when we stop for petrol.”
!
"
“Anyone who misbehaves will not get ice cream.”
Example 1.17
)
“You may have coffee or tea with your meal.”
*
+
“You may have coffee with your meal
or you may have tea with your meal.”
!
"
" !
' ( ' (
#
!
!
!
! )*
+
'
(
,
! modality
may
do
!
!
!
“You have coffee with your meal
or you have tea with your meal,
but not both.”
“You have coffee but not tea with your meal
or you have tea but not coffee with your meal.”
“You do not have both coffee and tea with your meal.”
“You do not have coffee with your meal
or you do not have tea with your meal.”
!
"
#
$
Example 1.18
%
&
$
!
'
$
(
) * $
+
,
$
+
-
#
%
$
+
Ambiguities of Natural Languages 39
Example 1.19
$
“If you understand implication, then you will pass the exam.”
% $
&
' $
!
(
)
* $
+
, $ -
#
.
!
"
# "
)
truth table
* negation #
'
*
T
F +
F T
T F
Truth Tables 41
' $ ' $
F F F F F F
F T T F T F
T F T T F F
T T T T T T
& % & %
' $ ' $
F F T F F T
F T T F T F
T F F T F F
T T T T T T
& % & %
$
Quiet Ice %
&
%
!
' $
Quiet Ice Quiet Ice
F F T
F T T
T F F
T T T
& %
ÓÒÐÝ
Quiet Ice
%
42 Propositional Logic
!
"
#$
Example 1.21
' $
Jim Jules
Cat Jim Jules Jim Jules Cat Jim Jules
F F F F T T
F F T F T T
F T F F T T
F T T T F T
T F F F T T
T F T F T T
T T F F T T
T T T T F F
& %
Jim
Jules
Cat Jim Jules
!
" #
$
%
' $
Cat Jim Jules Cat Jim Jules
F F F F T T F F F
F F T F T T F F T
F T F F T T T F F
F T T F T F T T T
T F F T T T F F F
T F T T T T F F T
T T F T T T T F F
T T T T F F T T T
´¼µ ´¼µ ´¼µ ´½µ (4) ´¿µ ´½µ ´¾µ ´½µ
& %
%
Jim Jules
Cat Jim Jules
!
È " É" Ê Ë # $
#
$
Ò
#
& È É
È É È É
È É Ê Ë
'(
)
Ô Õ
*
' $
Ô Õ ÔÕ
F F F
F T T
T F T
T T F
& %
" Ô Õ
"
"
Ô Õ
%
( &&+ ,
(-
Ô Õ
Equivalences and Valid Arguments 45
!
Cat Jim Jules Cat Jim
Jules
Cat Jim Jules Cat Jim Jules
"
#
$
logically equivalent
tautology
valid
contradiction
unsatisfiable
%
&
&
satisfiable
Example 1.24
(
(
)
* +
+
46 Propositional Logic
!
"
#
*
%
%
# )
+ %
%
$
#
, &
)
' $
Dead Watch Dead Watch Watch Dead
F F F F F F T F T F
F T F T T F F T T F
T F T T F T T F T T
T T T T T F F T T T
& %
- %
. /)
' $
Barks Bites Barks Bites Barks Bites
F F F T T F T T F F F
F T F T F T T T F T T
T F T T T F F F T T F
T T T F F T F F T T T
& %
counterexample
!"
##$
%
)
%
*
!"
$ . / 0 & $ . / $ 0
& #1 / #0 & 12
/ & / (
48 Propositional Logic
Commutativity Laws
Associativity Laws
! " !
"
! " !
"
Idempotence Laws
Distributivity Laws
! " !
" ! "
! " !
" ! "
De Morgan’s Laws
! "
! "
Double Negation Law
Tautology Laws
true true true
Contradiction Laws
false false false
Absorption Laws
! "
! "
Implication Law
Algebraic Laws for Logical Equivalences 49
Contrapositive Law
Equivalence Law
!
"
#
$ %
&
'
'
Example 1.26
true
) '
'
true
Example 1.27
)
!
50 Propositional Logic
true
true
true
!
"
#
$
%
&
!
"
!
#
" $
%
%
"
"
&
%
" &
&
' #
%( ) **
+
Æ
, -
* **
+ .
**&
/*
+ .
*
**
+ .
**
"
**
½ + .
**
/*
*
**&
*
¾ + .
**
/*
*
**&
*
1 2
3
4 5
4
52 Propositional Logic
! "
#
"
#
$
#
$
'
'
!
'
!
'
!
*
'
" Wason Selection Test
,
-
.
/(00 1
*
2345
Additional Exercises 53
!
!
&
/ 0
1
&
!
2
&
'
3
!
()(*
&
3
!
(+,
&
4 )
#
&
&
!
2
!
&
/2
!
2
!
&
5
$
6 5
!
&
!
"
&
!
! )
7
)
! 87
5
9 5 )
$ " 7
$
: )
3
;
! #
5 3
&
& !
3
&
&
5 3
&
& !
2
&
& !
&
5 3
!
&
!
"
(
)
(
(
'
,
! -
!
.
/
0
0
0
1 "
1 0
'
2
.
,
1
1
! "
!
#
$
%
&
' (
) (
*
% )
+, -
.&
!
"
! +/0
! %
%
0 %
!
%
+1 -
!
&
!
%
!
Chapter 2
Sets
%
& ' % & % (&
% & % & % & % &
% & #
'
false true +
, - ./ +
0 1
2 )
! "
#
¯ $ %
&&
'
'
% ( $$ $ $(
) *
+ +
, -
+
.
)
$(
$ /
'
)
0 1 2
3
4
set-builder notation #
#
5
3
Example 2.1
#
$
1 7
#
#
1 7
#
#
#
#
Membership, Equality and Inclusion 59
! "
! " # $
%
!
%
$ % + ,---
3 $ 3 ". 4 3
$ 3 ". 5
60 Sets
!
! ) ) !
)! ) ) !
! ) ) !
! !
*! !
(
(
!
¯
subset
superset
!
"
#
$ % &
Example 2.4
"
!
"
'
'
Venn diagrams (
& )
* + ,
* +
* + , -
.
& /
'
universe of discourse
)
0
1!
62 Sets
Í
, &! $& ' # & )&&' # & &)
! & &) '# &!$&
.&&$ " ' # & # &(
#& " &
& )& #
Sets and Properties 63
!
Primes "
Primes
#$
$
%
"
(
!
$
)
$ $
"
"
"
(
!
#$
$
Example 2.5
*
$
&
$
$
(
Humans
Animals
Example 2.6
.
Ê
/ $$
$
"
64 Sets
Ê
Ê
Ê
Ê
!
"
Example 2.7
#
"
"
*
"
"! +
,"
!
-
*
'
. )
. #
. -
"
/
0!!
)
"
!!
" 1
"
Operations on Sets 65
¯
2.4.1 Union
union
/ 0'
) '
66 Sets
Í
Example 2.8
!
Example 2.9
"
# $
% &
# $
2.4.2 Intersection
intersection
)
"%
"
*
! *
"
Í
Example 2.10
!
Operations on Sets 67
Example 2.11
disjoint
!
"
"
Theorem 2.11 Inclusion-Exclusion Principle
"
2.4.3 Difference
difference
#
$
Í
Example 2.12
Example 2.13
2.4.4 Complement
complement
%#
&
'
'
&
(
(
'$
Example 2.14
Example 2.15
Operations on Sets 69
# $ %
# $ %
# $ % #
# $ % #
& !
' #
# ( !
)" ) '" *
# ( !
)" ) '" *
# +
!
*
# (
!
*
# (
!
*
2.4.5 Powerset
,
powerset $ %
"'
$ % #
,
"!
$ %
#
( "! $ % $ %#
+
) ' "' # (
') ¬Ò $ %
"'
Example 2.16
!
¯
¯
Example 2.17
! "! #
$ %
&
' (
"
Friends #
$ %
&
'
)
"!
! Friends *
" "" $ &
) "!
#
%
' Friends
+
Friends Friends
,
$
-
*
"!
.
2
(
!
1
3
! 1
72 Sets
! " ! " #
$
% %
&
!"
$
Ë % $
Ì % $
% % Ì
Ë
$
' %
Ë % Ì
( %
Ë ! " % Ì ! "
)
Ë Ì
% %
Example 2.19
Students
Ë ClassLists
Ì ClassLists
)
*+
, *+
, *+
, *+
,
' -
.)/ 0
+ + + 1 +
1 + 1 1 +
+ 1
74 Sets
Example 2.21
Keys Values
Keys
Values
!
"
#
$
#
%
IDNumbers & '(
)*+,-
'.
" /0+)-
'1 *23)-
'! 4*5+-
!
"
%
CapitalCities & '.
6
-
'6
7
-
'( -
'
-
Example 2.22
Example 2.23
"
/0 #
/ 0 1(
76 Sets
*
+
, -
!!.
/
"
!
, 0
/)
1 "
2 "
/
3 4
Modelling with Sets 77
All babies are illogical.
Nobody is despised who can manage a crocodile.
Illogical persons are despised.
Example 2.26
!
" #$ !
"
" !
%&
!
'(
"
!
)
*" %%
"
!
"
!
+
*
,
- !
"
, , ,
, , ,
,
78 Sets
¯
!
¯ "
!
#
$
¯ %#
&&
!
'
(
¯ )
!
'
*
¯
&+
&,
'
-
¯
,
&*
'
+
¯ )
-,
!
,
.
/
, ( +
* $
-
%
.
/
- , $ * + ( 0
,
#
!
.
¯ ¯
¯¯¯ ¯ ¯
¯ ¯ ¯ ¯ ¯
¯ ¯ ¯ ¯¯ ¯¯
¯ ¯
¯ ¯ ¯¯ ¯ ¯ ¯¯
¯¯ ¯ ¯ ¯ ¯¯ ¯
¯ ¯
¯
#
$
Commutativity Laws
% %
Associativity Laws
& ' % & ' & ' % & '
Idempotence Laws
% %
Distributivity Laws
& ' % & ' & ' & ' % & ' & '
De Morgan’s Laws
& ' % & ' %
Double Complement Law
80 Sets
Universe Laws
Empty Set Laws
Complement Laws
Absorption Laws
Exercise 2.27 (Solution on page 420)
!
Example 2.27
"
#
$
%
&
! '
(
!
#
! ! !
Logical Equivalences versus Set Identities 81
Example 2.28
! " #
$ " " " #
% #
&
#
false true
Additional Exercises 83
Example 2.29
#
$
Contrapositive Law
% Equivalence Law " "
&
$
' $
(
Exercise 2.31 (Solution on page 421)
)
"
*
+
!
"
## #
$
%
##
& '
##
(
(
) !
* " $ &
+
##
#
*
,
, " $ &
- . symmetric difference
/
#
0
## #
Additional Exercises 85
!
! "
#
$
% %
& &
&
)
'
*'
' +
$ '
/( ' -
%
$ '
(
'
%
"
0 (
'
'
% % *
( ! '
(
''
!
"
#
% 1
' !
,- 2
%
1 !
.' 2
.'
!
% % *
3 !
'
!
2
%
!
,- 2
.
"
%
( !
!
1
!
" '
/
* $
$
%
!
%
( %
* ( !
$
1
! * *% !
' % !
( '
! !
'
/ 5
#
* * (
!
6 . 7
autological
*
'% 8
9
"
: 8
( * 9
"
( * :
%
$ ( * .( 7
"
* heterological
'% 8
"9
8'
( * 9
"
86 Sets
Chapter 3
!
Boolean
algebras
"
#
$ % &
%
& "
logic gates
% '
(
)
%
&
zero unit
+
sum
product
¼
complementation "
' (
'
,
(
+
¼
"
Laws of Boolean Algebra - . &
Commutativity:
Associativity:
Distributivity:
Identity:
Complement: ¼
¼
& & & ' # & & & & ! #
¼
Distributivity:
Identity:
Complement:
Boolean Algebras 89
false true
¼
!
"
# $
%
&'
Commutativity:
Associativity: ! !
! !
Distributivity: ! !
!
! !
!
Identity: false
true
Complement: true
false
($
$
# '
¼
)
$
$
*
(
+ $
$
$
¼
, -$
!!
$ ¼ ¼
90 Boolean Algebras and Circuits
Ü ' Ý Þ ( ÜÞ ' ÝÞ
ÜÝ ' Þ ( Ü ' Þ Ý ' Þ
Ü'Ü ( Ü
ÜÜ ( Ü
Ü'* ( *
Ü+ ( +
Deriving Identities in Boolean Algebras 91
Ü Ü Ü
¼
ÜÜ ¼
ÜÝ Ü
Ü
Ü Ü Ý Ü
Proof:
Ü ÜÝ Ü ÜÝ
Ü Ý
ÜÝ
Ü
Ü
Theorem 3.7
Proof:
Ý Ý Ü Ý
Ý Ü Þ
ÝÜ ÝÞ
ÞÜ ÞÝ
Þ Ü Ý
Þ Ü Þ
Þ
92 Boolean Algebras and Circuits
Ü Ü ¼
Ü
¼
ÜÝ
ÜÝ Ý Ü
Ü
¼ ¼
Ü Ü ÜÜ
¼ ¼
Proof: $
Ü Ý ÜÝ
ÜÝ
ÜÜ
¼
ÜÝ
ÜÜ
¼
!
%& Ý Ü ¼
'Ü (
¼ ¼
Ü
Proof:
Ü ¼
'Ü (
¼ ¼
Ü Ü ¼
Ü 'Ü (
¼ ¼ ¼
ÜÜ ¼
!
%& 'Ü ( Ü ¼ ¼
)
¼ ¼
'Ü Ý ( ¼
ÜÝ ¼ ¼
'ÜÝ( ¼
Ü ¼
Ý ¼
The Duality Principle 93
Ü ÝÜ Ý Ü Ý Ü Ý
¼ ¼ ¼ ¼
!""
#" $% &
Ü Ý Ü Ý
¼ ¼ ¼
Ý Ü
¼ ¼
Ü Ý Ü Ý Ü Ý Ü Ü Ý Ý
¼ ¼ ¼ ¼
Ý Ü
Exercise 3.10 (Solution on page 422)
'
&
"
ÜÝ Ü Ý ÜÝ Ü Ý
¼ ¼ ¼ ¼ ¼
$ ) ÜÝ
Ü Ý
* Ü Ý ÜÝ Ü Ý Ý ¼ ¼
#
"
Ü Ý Þ
ÜÝ Þ ¼ ¼
# &
"
, &
Theorem 3.11 The Principle of Duality
Proof: #
"
" "
"
"
94 Boolean Algebras and Circuits
Example 3.11
ÜÜÝ Ü!
Ü Ü Ý Ü "Ü Ý
Ü "Ý
Ü Ý"
Ü"
Ü
#
$
Ü ÜÝ Ü
%&'
!
'
($
'
)
)
'
$
'
'
(
$
*
-
.( %/"
/ ÜÝ Ü¼ Ý ¼ ¼ ÜÝ ¼
ܼ Ý
0 # ÜÝ Ü Þ Ü Ý
¼
Ü Þ ¼
Ý Þ
% # Ü Ý "
Ü Ý "
bits
!
"
#
$
%
Example 3.12
"!
&
"!
'
(
&
# (
"
)
*
(
"!
) (
(
+
(
"
96 Boolean Algebras and Circuits
OR gates AND gates NOT gates
OR gate
Ü
Ý
ÜÝ
Ü Ý
ÜÝ !
Ü
Ý
Ü Ý !
Ü!
Ü
¼
! Ü
! ! ! ! ! ! !
! ! ! !
! ! !
$
%
&
%
'
Example 3.13
!
"
Ü
Ý Ù
Þ Ú Û
# Ü$ Ý Þ
# Ü Ý
%&
Ù ' ÜÝ ($
Þ
%)#
Ú ' Þ #
Ù Ú
*
¼
)+
* Û ' Ù , Ú
# -
$
$
Û ' ÜÝ , Þ ¼
#
"
Ü Ý Þ Ù Ú Û
. . . . / /
. . / . . .
. / . . / /
. / / . . .
/ . . . / /
/ . / . . .
/ / . / / /
/ / / / . /
0
$ Ü'/$ Ý '. Þ '/$
%&
.$
%)#
1
)+
.$
Û
."
Ü'/
Ý'. .
Þ'/ . Û'.
#
*
Û ' ÜÝ , Þ ¼
È É Ê $
$
98 Boolean Algebras and Circuits
Example 3.14
¯
! "#
$
¯
"#
$
¯
"#
$
¯
! %&
$ '
¯ !
%&
! $ '
( ( ( ( ( ( ( (
( ( ) ( ( ( ( (
( ) ( ( ( ( ( (
( ) ) ( ( ) ( )
) ( ( ( ( ( ( (
) ( ) ( ) ( ) )
) ) ( ) ( ( ) )
) ) ) ) ) ) ) )
"
$ ' $ ' ' $ ' '
Logic Gates and Digital Circuits 99
¨
¨
!
!
!
!
"
!
!
¨
"
!
#
$
# %
&
'
#
'
¯
!
(
¯
!
(
¯
!
!
#
100 Boolean Algebras and Circuits
)*+, . ) ¿
. ) . )
* *
¾
/ . . *
+ +
½
/ . . +
, ,
¼
/ . . ,
)*+,
¯
¯
¯
¯
¯
! !
" "
#
Example 3.16
( ,
&%)
¯ & -
,
(
#
¯ &
#
(
-
¯ &
-
(
¯ &
(
¢ ¢ "
¢ ¢
¢ ¢
,
102 Boolean Algebras and Circuits
!!!"!
!"!!"
#
$
½ ½ ½
!!!"!
!"!!"
!!""!!
!
"
!
!
%
Making Computers Add 103
3.5.3 Building Half Adders
!
"#$% &
%
'
half
adder
(
) &
* %
+
%
,
-
.+ , /
¼ ¼
%
)
% ¼ ¼
+
¼
¼
¼
/ ¼
0
12
+
, / ¼ ¼
,
+ 12
% 1(
(3
4
+
'
4
)
0
)
5
6
% &
+
104 Boolean Algebras and Circuits
¼
¼ ¼ ¼
¼ ¼ ¼
¼ ¼
¼ ¼
¼ ¼¼ ¼¼
¼ ¼
¼
!
"
#
$
¼
%
#&
¼ ¼
¼
3.5.4 Building Full Adders
'
! !
,
(
-
"
,
full adder
./
0
1 2
$
Making Computers Add 105
¼ ¼ ¼ ¼ ¼ ¼
¼ ¼ ¼
¼ ¼ ¼ ¼ ¼ ¼
" # " #
¼ ¼
¼ ¼ ¼
¼ ¼
¼ ¼ ¼
" # " #
¼ ¼
¼
$
%&
'( ÜØ
¼ ¼
Ø
'( ÝÞ
* + $ # * , #
#
-.
#
/
0
¬Ò "
& (
+ !
¼
!"1 2
! !
% " $ &
! ( $
¼ ¼
& & $
&
&
&
$
&
)
" 3
(
!
¼
66
9 NOR gate
0
!"5
& & $
& &
& &
&
Additional Exercises 107
! ""
# $ #
"
% &
¼
!
'
"" (
% %
# % %
¼ ¼
#
× Ü ¼ ܽ Ö
ܼ
Ö
ܽ
×
×
selector
Ö
ܼ ܽ ×
Ö ! × Ü¼ " ×ܽ #
¼
Chapter 4
Predicate Logic
$
%
predicates &
" "
"
Ü # Ü
)
" (
" *
" #
Ü # Ü È
" *
Ü
" È
" predicate È +Ü, - *
Ü
È
.
Example 4.1
+
,
"
- . /
, , . +
,
"
0 1
#
Example 4.2
!
"
"
!
#$
%
!
/
,
-$
. /
0
112 Predicate Logic
!
"
#Ü$
%
Ü
"
% % " &
%
%
"
'
& "
(
%
)
)
%
% %
" " %
"
+
#Ü$
Ü
" % ,
-
'
-
'
Quantifiers and Bound Variables 113
Ü È Ü
!!
Ü È Ü &
"
!
È Ü
'
Ü
#!
universal quantification
(
)
(
*+
,
!
Ü
!
"
Ü
Ü
!! " !
!
!
! '!
!
!
!
!
!
!
-
! Ü
Ü % !
!
#!
'
Ü
'
!
& bound variable &
' '" !
.
/Ü0
Example 4.3
#!
%
Ü À Ü
!
À Ü 1 Ü
114 Predicate Logic
Example 4.4
!"
Ü Ã Ü É Ü
Ã Ü #
Ü
ÉÜ #
Ü
!"
" " "
"
"
"
Ã Ü É Ü
"
Ü
$ Ã Ü
$
Ü
$ ÉÜ
%
Ü
&
ÉÜ
"
"
& "
'
!"
!"
Ü Ã Ü É Ü
Ü Ã Ü É Ü
"
Quantifiers and Bound Variables 115
Ü
Example 4.5
!
Ü
È Ü
È Ü
Ü
Ü
Ü
Ü
! Ü
Ü
Ü !
! !
!
"
# $ Ü%
"
#
"
#
!
Example 4.6
&
Ü À Ü
À Ü ( Ü
&
!
&
À Ü
'
!
)
*+
,
!
&
,
!
!
#
Example 4.7
&
Ü
!
"
# $
% &
'
'
!
"#
!
118 Predicate Logic
Example 4.8
! "
# $%& ' ()* + &
'
'
& $ , $¾ &
!
, ¾ , ¾
-
' &
'
, ¾
&
&
, ¾
&
Example 4.9
.
' //
#
((% ' )$ 0
& 1
2 3
& '
-
4 4
&
&
'
'
' 5
3
5
3 0
4
& 6Oskar7
8 , 0
1
2 3
9
,
6Joel7
9
6Felix7
9
6Oskar 7
1
&
-
( #
!
"
'
Rules for Quantification 121
Example 4.10
Ü !Ü"
# $ $ # !Ü"
Ü
#
%
&
'
Children (
)
) %
%
*
! "
! "
'
! )
" #
'
! "
*
#
! " ! "
! "
# $ $ # ! "
#
%
#
'
! "
*
#
! "
! "
#
) #
%
)
*
- )
122 Predicate Logic
+
, È Ü ÉÜ ' Ü$
È Ü
' Ü ÉÜ ' Ü
"$ È Ü ' Ü ÉÜ
' Ü$
È Ü ÉÜ ' Ü
+
, È Ü ÉÜ ' Ü$
È Ü
' Ü ÉÜ
' Ü
!$ È Ü '$ ÉÜ
'$
È Ü ÉÜ
' Ü
- %$
" % (
Ü
Ü Ü
Ü
Rules for Quantification 123
Ü Ü Ü
!
"
Ü
¼
# $
"
%
&
"
&
' ("
&
&
"
&
)
&
&
*
)
"
)
"
)
!
"
#
¼
+ $
"
%
&
&
&
("
&
&
&
, -
)
"
'
$
)
-
*
-
%
.
"
)
*
)
/
-
124 Predicate Logic
Example 4.11
Ê
Ê
! " !!
!
"
!
!
!
#
!
!
&
' !(( )#
$
All babies are illogical.
Nobody is despised who can manage a crocodile.
Illogical persons are despised.
!
* !
!
+
+
+
+
Modelling in Predicate Logic 125
#
$
%
&
'
(
Example 4.13
#
)
* +, --
. .
/
!
,
. * 0
& --
$
--
#
) $
!
1
"
1
2
,
1
!
3 4.5
.
6
.
."
126 Predicate Logic
$ + ,% $ -%
$. % $. / %
$0 0% $0 .% $0 - % $0 + +%
$ / .% $ , 0% $ - ,%
$/ . .% $/ / ,% $/ + /%
$, 0 % $, -% $, / %
$- . 0% $- 0 % $- , -% $- %
$+ / % $+ ,%
$ % $ . +%
1* #
" #
! !
" ! #$!
! %&!
# #$! !
$ #$! %&!
% %&! !
( %&! #$!
)*
+
,
--
.,
/
,
0
" .,
,
,
.,
1
,
,
# .,
,
,
2
,
3 ,
*
1
,
,
4,
4 --
)
#
*
1
./
+ .
128 Predicate Logic
Ü
! "#
$
% &%
"
' (
"#)
* "#
%
% %
%
)
%
$
$
$
%
"$
%
&%
$
)
"$ $
%
+ "#
"
%
% Ê
%
,
,
¾
¾
Additional Exercises 129
! !
"
#
$ % &
' (
)
*
(*
*
)
*
+ *
(* !, -
& .
*
+
/0 1 2
!"
#
$
%"
# &
!"
& &
$
%"
.
!
&
// 1 2
# '&
!"
( ! '' "
# '&
"
.
!
&
/3 #
"
(
!"
#!
''
"
&
''
"
Chapter 5
Proof Strategies
theorems
$
%
&
'
" #
(
(
(
'
(
*
+
,
' -
.
/ )0
proof strategies
!
"
#
$
'
Theorem 5.1
Ü
Æ
!
"
! #! !
$
#
$
#
%
&
' (
!
)
# $
introduction strategies
#
$
#
!
*
'
(
$
+
134 Proof Strategies
!
"
"
#$
%
&
'
(
' $
&
%
Example 5.2
! "
!
#
$
%
%
&
'
' % %
#
$
( %
Proof:
% %
% %
) % '
%
%
*
136 Proof Strategies
Example 5.3
!
' $
&
%
Example 5.4
"# $
%
Proof: & %
modus ponens
' $
&
%
modus tollens
' $
&
%
!
" ## $!
% & ''(
138 Proof Strategies
Example 5.5
!
"
#
&
%
" "
"
" $ "
&
$ "
Proof Strategies for Negation 139
' $
&
%
proof by
contradiction
reductio ad absurdum
Example 5.6
Proof. !
"
¾
#
" ¾
¾ ¾ " ¾
$ %
&
'(
¾
&
-
&
&
..
(' -
140 Proof Strategies
Example 5.7
!
$
!
!
!
!
%
!
!
&
! '
!)
!
!! (
!
Proof. $
! *
!
!
#
Proof Strategies for Negation 141
!
Example 5.9
"
Proof.
¾
#
"
142 Proof Strategies
& %
!
"
' $' $
Proof Strategies for Conjunction and Equivalence 143
Example 5.11
%
&
' $' $
&
%&
%
144 Proof Strategies
&
È É %&
È É %
È É
È
Ê
É
Ê
È É
' $
Ê
È
&
È É %
Example 5.12
Proof Strategies for Disjunction 145
¯
¾
¾
¾
¯
¾
¾ ¾ ¾
¾
! "
#
"
"
$
"
"
' $
!
&
%
Example 5.13
%
¾
(
%
"
146 Proof Strategies
' $
&
# %
Example 5.14
Ü
Example 5.15
¾
Proof.
¾
¾
+
, -
Fact: "
. $(
. ) !
. *
Proof: /
. ) !
. *
0
. ) !
. *
1
"
. $(
. ) !
. *
' $
&
%
&
%
Example 5.17
. /
Example 5.18
Proof.
' $
&
%
!
" #
!
$
%
' $
&
%
Example 5.19
Æ
!
"#
$
%
%
$
$ &
# $ "
'
-
.
( )
/
#
0
( "
"
)
()*
"
"
Fact:
"
Proof. 1 $ " 2" 34
¾
5
"#
¾
&
6
¾
#
¾ ¾
&
6
#
¾
¾ (¾¾) ¾
152 Proof Strategies
!"
5.6.3 Uniqueness
#
$
%
&
$
! '
(
)
(
$
Example 5.21
&
(
¾
Proof. *
(
+! ¾
#
( + ! ( ++!! (
¾
¾
¿ ¾
¾
'
$ ( $
+ ! ( $
¾ ¾
( + ! (
¾
Example 5.22
,
&
!
)
Proof. *
(
Additional Exercises 153
Ë
Ë
!" Ê #
$
%!
&
$
&
"
"
&&
' %!
' $ &&
!
" &&
(
! !"
)
'
* &
!
!"
"
!
!"
+ %!
¾
,
- &
!
"
. ) *
/
$ (
.
0
"
#
"
154 Proof Strategies
É È
È É È Ê É Ê
È É È Ê É Ê
Functions
!
"
!
#
$
%
"
%
&
*
+ "
.
"
/
-//"
¯
¯ ¯
¯ ¯
¯ ¯
Basic Definitions 157
Ü
range
&
image
%
!
range
&
½
preimage
½
½
'
(
½
½
Example 6.2
%
) " *
) %
*
) " ) *
½
) *
½
) *
158 Functions
score
!
"
#
Example 6.3
$
"
%
(&
%
%
)
+
% "
,
!
"
- .#
!
'
"
/
'
( )
*
( )
()
-
()
0
()
Example 6.4
,
! "
%
%% # %
,
!
' Ê Ê %
Basic Definitions 159
¿
Ü
¿
¿
)
"# " *!(
!
+
graph
( graph (
(
#
*# graph (
!# , *!(
score
! -*! (
¿ (
graph ¿ Ê
160 Functions
Theorem 6.4
graph graph
Proof:
graph graph !
graph
graph
graph graph
!
graph
graph graph graph
"# $%&
one-to-one 1-1 injective
¼ ¼ ¼
¼
¼
¼
!
!
One-To-One and Onto Functions 161
¼
¼
¼
score Class Marks ! "
#
Ê Ê $ ¾
%
$ ¾
Definition 6.5
onto surjective
range
score Class Marks ! "
#
Ê Ê $ ¾
%
Æ Æ $ ¾
&
!
!
$ !
!
! !
!
'
Definition 6.6
bijection
!
(
162 Functions
¯ ¯ ¯ ¯ ¯ ¯
¯ ¯
¯ ¯ ¯ ¯ ¯ ¯
¯ ¯
¯ ¯ ¯ ¯ ¯ ¯
¯ ¯
¯ ¯ ¯ ¯ ¯ ¯
Definition 6.7
inverse
! "
! "
! "
" !
! "
Example 6.7
Ê Ê # ! " $ % &
! " &!$ '
(
)! " $ ) % & " *&
*&! " *& &!$ " )
+
range ! #
range !
Composing Functions 163
Example 6.8
!
"
#
$
%
&
#
&
&
&
½
'
"
( &
&
)
'
* &
&
½
'
&
+ ,-
¯
Æ
Æ
Æ
Definition 6.8
composition
Æ
Æ
!
Æ
"
Æ
Æ
Æ
#
$
%
&
# # # #
$ $ $ $
% % % %
& & & &
Composing Functions 165
Æ Æ
¾
Æ ·½ Æ
Æ Æ Æ
¼ id ½
Æ id
!
! "
!
! "
#
"
"
#
Theorem 6.9
Æ
Proof: $" Æ Æ %
&
$ !
!
' !
!
Theorem 6.10
Æ
Proof: $"
&
Æ
$
$
'
Æ
(
)
)*
Æ
Exercise 6.11 (Solution on page 433)
(
)*
½ Æ id Æ ½ id
166 Functions
Æ Æ Æ Æ
Definition 6.12
'
"
(
!
Theorem 6.12
Proof: )
range# $
'
# $ +
!
#$
+
,
range# $
!
# $
¼
Ý
¼
168 Functions
Proof:
!
"
# $
$ ½ ½
½
½
½
½
½
½
½ range
½ range
%
#
$
½
$
½
&
"
½
# $
!
½ #
$
'
' # $
½
½
½
½
' # $
' # $
# $
½
½
(
½ ½
# $
$
# )
$
Comparing the Sizes of Sets 169
¯
½
½ ½ ½
½
½
½ ½
Example 6.13
' # + $ , % - . / 0 1 +#
# $ % . 0 +# +$ +% +. +0 $#
"
) *
2
(
3
"
Definition 6.13
finite
' +
$
,
170 Functions
cardinality
countably infinite
countable
uncountable
Example 6.14
! " # $ %
! !
&
'
(( ) *
'
++
,'
-
*
½
*
.,/+ " 0
Example 6.15
! "
! #
! $
%
&$
''
%
&$
(
%
&$)
*
+&
$#
,
''
2*
172 Functions
Example 6.16
!
"
" #
!
$
%&
& % %
¼½
&
&
' (
%
$ "
%
) &
The Knaster-Tarski Theorem 173
½ ¾
$ "
"
" ) *+
, &"
-
! !
+
.
/
!
!
0
!
Definition 6.17
0
monotonic
fixed point
174 Functions
Example 6.17
!
" # $ %" %
%"
Ë
Ì
G G
G G
G
G
G G
G
G
G
! "
" "
Theorem 6.19
½
·½
Ë
¾
Ë
¾
+
Exercise 6.20 (Solution on page 434)
! "
# ½ ·½
$ % &
Æ Æ Æ Æ Æ Æ
Æ Æ
¾
Ê Ê
!
"
#
Æ id id Æ
id #
$ % &
"
&
"
* !
"
( (
' +,& -
&"
(
(# ..
/
#
(
0 "
(
' ,
,&
" &&
"
&
)1
2
(#
&
(
& (
(
(
(
(
%
"
# &"
(
&&
,#
(#
+"
# ( (#
(
( +"
#
(
&&
3
(
&&
178 Functions
!
"
!
# !
$ L %
%& !
'( "
!
) ' $(
'( "
!
) ' $(
Chapter 7
Relations
!
"
#
"
#
$
!
%
"
#
!
"#
'
( ) “student , in course , scored a grade of
”
! ' (
*
) ' (
+
-ary relation
!
Example 7.1
! http://www.imdb.com "
#
$
# ! #
& ' (
) $
, -
$ < # : #
1
,
1 <
,
/4 /& /= '/ ''
)
Binary Relations 181
¯
¯
infix
from
to
source target
on
homogeneous
heterogeneous
Example 7.2
# # # $ $ $ # % $ % % %
!
"
"
"
Example 7.3
Children Flavours
! "
#
$
%
& '
($ )
' $ * & +% ,"- )!
'
& '
* "
*
' ! %
' . ) .
/
)
'0
"
)
$
.
' %
' . )
.
/'/ . )
.
1 ""
"
' %
' % )
$
$ . ) . $
Example 7.4
$ +% ,"2 %
$.
184 Relations
Children Flavours
Example 7.5
Exercise 7.5 (Solution on page 435)
!" #$%
" &
% '
&
(
)
&
"
&
&
%
*
+
"
&
%
% %
% !
Binary Relations 185
Example 7.6
!
"
!
#
$ !
%
%
#
$
& "
!
#
!
%
'
'
#$
& "
"
& !
!
!
%
& "
"
!
!
!
%
& #
#
!
%
(
)*
graph &
$
&
186 Relations
Ê
Theorem 7.6
Proof:
Ê
!
graphÊ "
graphÊ Ê "
graphÊ
Ê
Operations on Binary Relations 187
! "
"
#
$%
# $&
Exercise 7.7 (Solution on page 437)
'
½ ¾ ¿
(
½
¾
(
¾
¾
¿
¾
+ ¿ ¾
, ¿ ½
-
inverse
½
½
!
½
188 Relations
Example 7.7
Children Flavours
½ Flavours Children
½
! !
Æ
,
Æ - # $ )
# $
# $
.
%
" %
Æ &
%*
/
%
&
/
%"
%*
Æ
Operations on Binary Relations 189
Æ
!
Example 7.8
&
'%
(
Example 7.9
-
190 Relations
Ü
domain
not
domain
range
domain
range range
Definition 7.10
reflexive
irreflexive
&
& ' &
Definition 7.11
symmetric
% &
antisymmetric
(
#
$
'
%
&
"
$
$
)
$
(
##
$$ ) ##
Definition 7.12
transitive
% &
192 Relations
Exercise 7.13 (Solution on page 438)
Example 7.13
,
$ "
"
# )
# - .# # $
¯
¯
¯
Definition 7.15
partial order
total order
!
Example 7.15
"
#
"
$%
!
"
& ' ' &
Example 7.17
¯
¯
Example 7.18
! "
#
$
" # $
+
,
$
Properties of Binary Relations 195
!
!
&
'
&
(
)
Definition 7.20
partition
Ë ¾
%
!
"
!
Example 7.20
'
%
!
"#$ &
!
!
!
(
&* &
*
! +, !
-
!
*
!
&
.
!
&
)
!
%
!
%
& &
'
%
!
*
&
%
/
! '
*
%
!
!
%
*
(
! !
"#$
-
&
* *
!!
&
!
*
196 Relations
Definition 7.21
equivalence class
Ê
Ê
Theorem 7.22
Ê
Proof:
! Ê
Ê
" #
#
Ê
$ #
%
#
#
Ê Ê
%
Ê
&
'
Ê
Ê Ê
,
" $ "-
$.
Additional Exercises 197
Ü
!
" #
!$
% & '
!
( ) *
+
, ) )
(
) - . / *
.
!
( 0 * , +
!
( ' *
2 !
!$
1
$
3
! 3
! !
!
- !
½ (
% ¾ (
( 4 5
(
2 !
!$
1
+
$ 3
! 3
! !
!
- !
6
!
% 6
!
%!
$
198 Relations
!" #
$ %&&
#
Æ ½
' %&&
#
Æ ½
( )
&&
&&
*
+ !" Æ
, !" id -
- ½
id
$
½
id
. reflexive closure
!"
%
symmetric closure
transitive closure
/&
!"
- 0 + + ,
- 0 + ,
1 2
*
!"
+0 2
½
++ 2
½ * ¾ ¿ ½
·½
- + , +
+, 3
&&"
4
++000
Ê 5
*
-
*
++000
Additional Exercises 199
!
"# "
" " $ %
&' (
&' )
!
" *
&' )
!
" +
*
, -
"
"
" #
&' &' ./Ê % ./Ê ./Ê %
&' . /Ê
Chapter 8
"
#
$
#
$
&
#
!
"
#
$
%
&
Children '
($
)
*
+#"
, # " ! -
$ . ! / ( $
!
!
# # , -%. 0 ! %
$ ! % # %
% " 1$ 2 /
+#"
, ! # /
/ +# # $ 3 % -! ! .
! ! , 4 * "% # #!
# " $ !
/
/ +# # " ! !% ,
! 4 ( $
! " , %
- ! .
-//
! . ! 5 - #
Example 8.1
.(
-
-/
Example 8.2
204 Inductive and Recursive Definitions
!" #
!
#
!
$ " $
#% #
&
# "
#
#% #
#
' #
%
#
#
&
%
"
%
#
%
(
$ #
$ &
"
#
"
#
%
#
'
!
)
*%
#% $
!
"
+ , - -+
Example 8.3
*%
$ " #
$ !
#%
.
!" "
#
"
!!#
#% #
(
!!#
%
"
/ #
!!#
#% #
Inductively-Defined Syntactic Sets 205
!"
#
# $ %& !"
#
#
'( )$
-
-
#
'
" "
*
. " / /
-
"
0
" 0
"
#
"
*
#
" alphabet # symbols characters #
0
string word
length
½ ¾ ¿
"
!
"
empty word "
1
2 "
206 Inductive and Recursive Definitions
Definition 8.4
A
Example 8.4
!
"!
#
$
!
"
#
%
$
!
!
"
#
%
$
!
"
#
$
"
#
&
Backus-Naur Form 207
"
!
!
#
$
%
&'
(&'
*+
,,!
"
*+
,,!
-
.
*+
"
)
% (
successor function ! /0 1
*+
,,! (
2
3 (
.
4
$ .
5
208 Inductive and Recursive Definitions
Example 8.5
true false
!"# $
% true false
&
'
(
!"#
)*) + !' ,
- " . / 01(21
/
'
Example 8.6
!"# $
% := ½ ;¾ if then ½ else ¾ while do
#
% :=
½ ; ¾
if then ½ else ¾
while do
'
3
/
!
/
4:=5
/
3
Backus-Naur Form 209
¯
½ ;¾
½ ¾
½
¾
½
¯
if then ½ else ¾
¯
while do
false
true
!
"
"
#
$
$ %
%
# & ' ( ) ( * ( (
i := 0;
s := 0;
while i < n do
i := i + 1;
s := s + i }
% +
$
$
#
i := 0 ;
s := 0;
while i < n do
i := i + 1;
s := s + i }
$
$
#
s := 0 ;
while i < n do
i := i + 1;
s := s + i }
210 Inductive and Recursive Definitions
i := 0 ;
s := 0 ;
while i < n do
i := i + 1 ;
s := s + i
while i < n do
i := i + 1 ;
s := s + i
Example 8.7
. " binary trees
%
!
&
Example 8.8
- %
.' * (
' * / (0' .
$% %
Inductively-Defined Functions 213
! "
¼
½ #
Example 8.9
Example 8.10
!" #
! $# $# "
%&
'()#
(
*%
+
&
#!
Liber Abaci
" "
%#
$# #
%%
"& %# %
#!
Example 8.11
883 . 1
8
0
4 3 :
%
" "& " " " "
8
5%
Inductively-Defined Functions 215
!
"
Example 8.12
'
½
¾ *
'
½
'
¾
Example 8.14
/
0
$- 1+&
2
+ +,
)
* ++ +
3
$ "
$ 4
Æ
& '
#
) 1+
+ ) +
+
5
/
0
$- 1+&
$ ) 1+
Example 8.15
0
2
Recursive Functions 217
#
! " #
" #
%&'
( )
'
'
' /( 0 + .
& ! .
+ 1 . !+ $ .
$ * & . ! (
$ (
+ ( & .
$+ . . 1 . '
% ' .
* & +
+
' % ¾ ¿
'
+
. ( (
Insertion Sort !
"
# $
"
%
& $
!
'
!
( %"
"
) * + )*
" +
,
,
-
.
!
"
) * +
" +
.
! /%
, 0
Recursive Procedures 219
!
" "
#
$
!
" "
%
%
!
&
Merge Sort
!
'
(
'
$ )
*"
+
,
"
"
-
.
/ 0
*"
+
,
-
1
1
!
2
'
(
!
$ )
*"
+
. !
! !
3
1
1
/ 0
!
220 Inductive and Recursive Definitions
,- /
,- ,01- ,02-
,- 3
4
"
" )
' &
Additional Exercises 221
! "
"
#
"
"
$ %& '
"
( )
( < =
(
(
222 Inductive and Recursive Definitions
♀ ♂ ♀ ♂ ♀ ♀ ♂ ♀
♂ ♀ ♀ ♂ ♀
♀ ♂ ♀
♂ ♀
♀
♂
♂
♀
Proofs by Induction
" #$ %
+ * , * 0 * * / /
4
Ò-
!!
" # $
%&
$
"
'
&
"
¯ Fermat’s Last Theorem
&
(
!
&
" )
!
* +,
!
-- " .
/
$
!
!
!
"
#
!
$
/
!
0
/
0 "
1 2
2
, 3
) 4
&
)
&
(
4
%
5
67
4
!
! !
&
"8 7
&
" ) !
! &
!! !
(
!(
% ! + 9
" 7
!
2
&
(
(!"
¯ Fermat numbers
&
¾ " )
1 2
: : ;
5
< < <
.
! !
$
Convincing but Inconclusive Evidence 225
¼ ¾
!"
" # "$
% &
½
¾
!
" # $
%
% % &
"
'
! !
(
$
! !
)
" *
! !
! !" # $
! !
%
% (
+
% &
+
%"
! (
!
!
( ! "
,
&
!
! )
!
!
" '
" '
&
-
. " /
! 0
& % &
%& &
& %
& 1
&1
,
(
$
!
% (
%& %
& $0
%" *
!
( !
&"
2
!
!
& (
(
(
( !
% (" 3
&
" 4 !
228 Proofs by Induction
!
" # $
%
&
'
(
)
!
*
+
%
"
,
#
,
-
.
/
011
+
/
!
,
!
/
#
0 (Base Case)
!
1
&1'%
(Induction Step)
!
50 !
%
&' µ &50'
The Induction Argument 229
& # #
## '
#
(
)
*
# '
+ + , # '
#
"
# #
- .
" .
' # $
/"
" &
#
#'
#
$ / .
$
%
%
0%
,
#
##
# 0
* . #
1 ##
1
$%
& !
2 , $
230 Proofs by Induction
!
"
#
$
%
&
'(
)"
( & %
(
( %
)
(
)" *
%
( &
%
' & % $ +
$ (
( %
Example 9.3
Proof:
Base Case: #
,
-
!
!
,
-
!
!
(
( ,
&
- % &
,
-, !-
! ,
-
!
The Induction Argument 231
!
"
#
#
#
$
#
%
&
'
(
#
)
* *
+
#
$
#
# ,
#
Exercise 9.4 (Solution on page 446)
*
# , -
¾ ¾ &¾ ¾ .
& / ¾
232 Proofs by Induction
¼ ½
·½
¾
·½
¾ ¿
" (" ( & +
"
$ "
" , ,(
Example 9.6
Proof: 1
Example 9.7
Fact:
!
Æ
" #
convex
$
Proof: %
Æ
Base Case:
!
*
Æ
!
* )
!
Æ
!
Æ
+ Æ
!
,
)
-
)
0 ,
)$
1
0 ,
) )
*
)
234 Proofs by Induction
Exercise 9.8 (Solution on page 449)
"#
!
$% % ¾
-
*
! !
*
Induction Proofs from Inductive Definitions 235
Fact
Proof:
:
even:
odd:
!
!
##' )! #
Example 9.9
½ ¾ ¿
Proof:
Base Case
½ ¾ ¿ ¼ ¼
236 Proofs by Induction
½ ¾ ¿
½ ¾ ¿ ½
½
½
Example 9.10
Fact: ¼ ½ ¾ ·¾
Proof:
Base Case
¼ ½ ¾ ¼ ¼ ¾
Induction Step
¼ ½ ¾ ·½
·¾ ·½
!
"
¼ ¾ ½ ¾ ¾ ¾ ¾ ·½
Example 9.11
Base Case !
¾· ¾ ½ ¾ ¾ ½ ½ ¾
Induction Step: !
· ¾ ´ ½µ· ¾ ´ ¾µ· ¾
½ ½ ¾ ¾ ¾ ½ ¿ ¾
½ ½ ¾
" #
$
%
Ü
¾ ¾ Ü
¾ ¾
Ü
! ¾ " ¾ #
$
%
& Ü
$ '( '
! ¾ "
) ! % )
" *
¾
( $ % ¾
"
) ! % )
" *#
¾
$ % +!$
!
!
, ! ! !
) ! "*
$
'( ' ! "*¾ #"*"
) !
% )
"
!
¾
$ %
/!
(
! $ * !
- . - .
0 ! %
/!
(
!
$ !
- . $
)
0
! %
! - . - . $ * -
1 !
!
! ! 2 3
)
- .
.
Proof: 4 (
) ! quadratic formula !
! !
! %
%
*
( ! $
) $ 1
Fun with Fibonacci Numbers 239
Ü
¾
¾
¾ ¾ ¾
!
(
', !
.!
! + //
$!
+
1 1 2
)
2 3 4
$
&
&5
+ &
&
(
& *
&! *
$&
) )
1
240 Proofs by Induction
&' % ) ) * &
% ½ 0 ¾ 0 ¿ 0 0
/ ½ ¾ 1,
)2
$"
// % & 0 0 % 0 0
Proof:
!
½ 0 ¾ 0 ¿ 0 0
# /
½ ¾ ¿ ½
½
½
½
½
½
·½
½ ¾
½ ¾ ¿
·½
Base Case
½ ¾ ¿ ¼
·½ ½
! !
"
# !
$
½ ¾ ¿
½ ¾ ¿
%! ½!
!
&" ·½ !
" $
½ ¾ ¿ ·½
)
*
+
,
242 Proofs by Induction
Base Case
!
"
#
$#
# %
#
&
&
# range #
'
()
#
&
&
*
)
#
#
Example 9.17 Sorites Paradox
+
,-
)
Claim: !
&
Proof: .#
Base Case
/
Induction Step:
$ 0
+#
& #
1 #
#
1
0
&
sorites paradox
heap paradox
2&
3 ,- /
,- ,- #
'
# 0 #
When Inductions Go Wrong 243
¯
¯
¯
!
"
#
! !"
"
$
%
&
'
(
%
&
Fact
Proof:
Base Case
Induction Step
!
"
#
$ $
$ " $
Example 9.19
Fact
Proof:
Base Case
)
!
!
Induction Step
) *
&!
&
:
!
&
+
(where ):
# &
% & structural induction
! !
&
'
,
!
246 Proofs by Induction
Proof:
:
:
(where ):
Example 9.20
Fact
Proof:
: ! "
½
¾ :
!
#
$!
½
¾ ½
¾ ½ $¾ $!
½ $! $ ¾ $! ½ $¾ $!$!
%
½ $$
¾
½ $
¾
½
¾
&
'!#
&
'!(
¿ ¿ ¿ ¿ ¾
¾ ¾ ¾ ¾
!
"#"$
"
"
)!$'
'
, *(
#"
$$
'
+
!
"# 0
%
.
.
%
- ½ - ½ .
!
" #
$
%
&
' (
)
(
%
(
*+
,
4 * 4 4 4 5
& 4*&
*
Proof: 6
4 * 4 4 4
5 4 * 4 4 4 && 4
5
*& 4& 4
*
5
& 4*&
*
+ 1
23
250 Proofs by Induction
Ý
Proof:
Base Case
!
$
+
Proof:
*
*
*
*
* *
*
/
.
Ý
"
#
!
% !
Æ
&
' '
$
(
"
perfect information
!
"
"
" #
$
%
"
"
%
" "
finite game
# %
$
&'
(
$
"
( " "
winning strategy
drawing strategy
winning position
losing position
!
!
"
#
$
%
&
'
(
)
*
+
,
-
.
$
%
&
'
(
)
*
+
Theorem 10.1
Corollary 10.1
Example 10.1
!
()
*
+
Strategies for Games-of-No-Chance 255
! !
–
" "
"
#
–
" "
"
$
% %
–
" "
"
#
–
"
"
"
"
"
& &
–
" ! "
! "
#
–
" "
"
$ '
( (
" %
% "
) )
" %
% "
* *
256 Games and Strategies
–
–
!" # !"
$
–
%
%
–
&
$
" ! ( ) % * !"
+ !"!
, game tree
'
!
,
-
.
-
,
Strategies for Games-of-No-Chance 257
¾
¾
¾
¿
¾ ¾
¿
¿
¾
¾ ¿ ¾
¿
¿ ¾
¾
¾
¿
¿
¾ ¾
¿
¾
¿
¾
¿
% ! "$ #
% # "#
% ' # # !
) #
$ ! # ! # ! (
$ !
" *
+ % %! ' # # !
%!
+ %
%! ' # # ,
! %! %
# ! ! ! %# " %
# " -(
258 Games and Strategies
not
,
-
'
(
)
"
!*
&
.
%!
!*)
* /
%
) "
!* 0
Strategies for Games-of-No-Chance 259
!
"
#
$
#
%
#
&
'
#
%
"
(
$
#
&
# %
)
one
two
%
*
&
%+
%
)
%
"
*
*
,
*
%
! "
%
-
%
%
.
(
&
(
/
0
%
%
%
&
(
260 Games and Strategies
!
"
# "
"
"
"
10.2 Nim
"
$
"
"
%
"
"
"
"
"
"
+ #
!
!
!
"
! #
Æ
!
!
!
$
!
!
#
'
!
!
!
balanced #
unbalanced !
*
! !
&
!
some ! !
! !
!
* ' ( ( * ' ( (
+ "
,-.
,* ( ' ' 0 (* ' ' (
!
-* ( ' ( -* ( ' (
!
/
.* ( ( ( .* ( ( (
+
!
!
1
!
262 Games and Strategies
first
second
!
"
# $
%
&
'
&
(
&
"
# )
$
+
,
,
-
2 coins: &
+
+
-
second
Fibonacci Nim 263
3 coins:
second
4 coins:
! "
first
5 coins: #
!
!
$ %
!
! $"
second
6 coins:
&
!
&"
first
7 coins:
&
!
&"
first
8 coins: #
!
!
' (
!
! '"
("
second
9 coins:
)
!
)"
first
*
+
!
+
#
!
, - +
..
+
264 Games and Strategies
½ ¾ ¿
½ ¾
Proof:
Theorem 10.7
not
½ ¾
"
!
"
10.4 Chomp
# $
%
&
$ '&
$
$$($$ )* + , * - $ $* $%
'$ *$ $
$ '& $
-
% $
%
)* $ $ % $
% )* ' $ $
%
$
% $ $
$
- $ $ $
* )*
. '& - - $ $
%
# $
& $
/$ - %
$ -0
$
-
$ % $$%-
# $
$
+& -& $
$
,& $
-
$ % $$%-1 '$ 2 '*$ $
*
)*& % 3*$ $
* )* $
- $ $
Chomp 265
!
"
#
$
" " !
%
&
!
%
%
'
(
)
#%
*
%
%
&
*
% $
% %
( !
(
#
% #
$
+
# %
)
% ,
-
%
(
%
& ".
/ %Æ
(
Theorem 10.8
""
Proof: 0
(
)
#
%
#
#
1
%
%
(
#
!
266 Games and Strategies
!
"
"
# $
%
& '
&
%
10.5 Hex
"
&
'
&
(!)
*!+
& , &
-
(!+
*!)
& , &
Æ
- " &.
& .
"
/
'
&
Æ
'
"
&
'
& &
Hex 267
ÆÆ
ÆÆ
ÆÆ
ÆÆ
ÆÆ
Æ
Æ
Æ
Theorem 10.9
Æ Æ
Æ Æ
Æ Æ Æ Æ
ÆÆÆÆÆÆÆÆÆ
Æ Æ Æ Æ Æ Æ Æ
Æ Æ Æ Æ
Æ Æ Æ Æ Æ
Æ Æ Æ Æ
Æ
Theorem 10.10
Proof:
10.6 Bridg-It
!
"
#
"
Æ
#
$
Theorem 10.11
Proof: %
#
& '
#
(
#
)
) Æ
*
#
+
*
#
Æ
, -
Æ
270 Games and Strategies
Theorem 10.12
Proof:
! "
# ! $%
& '
' '
&(
'
) !' !
' ! !
* !
!
Additional Exercises 271
!
"
#
$
%&
#
"
'
"
#
%
$ #
"
(
"
)
*
$
+
,
,
"
-
,
#
*. !
,
¯
#
*.
/
"
#
#
*.'
¯
*.
#
#
#
#
*.
0
!
#
%
"
%
0
1
(
%
"
-
&
!
#
1
"
-
2% 20 2(
Additional Exercises 273
!
" ! !
#
$
!
% # !
#& !
#
! % #
'
( !
" ! !
#
$
!
% # !
#& !
#
! ( % #
)
# '# ! # !
#
* #
+ #
#
#
# '
' &
& % #
'#
# #
* #
& #
#
* # # !
,
' !
" ! !
#
-
& #
!
#
,
'
& !
#
,
'
'
# '# ! #
!
#
"
' 5 6
3
'
#
-
¼ ¼ ½ ½ ¾ ¾ 9
Additional Exercises 275
¼
¼
½ ½
½
! ¾
"# $
"%& '
½ ¾ ¿
(
)
#
"# *
+
,
"%&
+
,#
*
$
0
6 7.)
Part II
Modelling
Computing Systems
Chapter 11
Modelling Processes
#
$
'
' $
1 2 3 4 5 6 7 8.
7 8 9
4 5 6
CE 1 2 3
C 0
&
& %
%
!
"
# "
$% & =
" !
$% ' "
# (!!!!!!
' " "
#
#
"
)
# #
! $%
#
*#"+
Ý ,"# " #
Ý
! "#
Labelled Transition Systems 281
!
"
#
$
./
282 Modelling Processes
Definition 11.1
transition relation
Definition 11.2
#
Actions Actions
¼
¼
½ ¾
¯ ¯ ¯ ¯ º
Example 11.2
$ %
%
Example 11.3 The Man-Wolf-Goat-Cabbage Riddle
& % ' % % ()
* " ++, -
# . %
284 Modelling Processes
* !
+
,
Labelled Transition Systems 285
!
"
!
#$
%&
ÓÓÓ
ÓÓÓ ÓÓÓ
ÓÓÓ
¯ (
$
ÓÓÓ ÓÓÓ
ÓÓÓ
ÓÓÓ ÓÓÓ
ÓÓÓ
)
!" #
,
+ -
, "
+"* .
,
/", ,
, /",
+" ,
$*
" " 3
+
, " " 3 " "
$ $ $ " $* # " ", +
$
+"
+%
" * 4$
" ,1
,
, " 5"
* 677 !% +
", ,$ $ .% + " $ x y $
,$ ,
$ Ü Ý*
"
"$ +" x mod y $
"$ ,
x y := $$ $$, *%
loop begin
x := x mod y;
if x=0 then return y;
y := y mod x;
if y=0 then return x
loop end
8$
,
9-"$: +"
$ + 9loop
begin: 9loop end: "
" $ "* ; -
+
$
,
"$ Ü<=>? Ý <@> ,
" ? "
$ . + =>? @>*
288 Modelling Processes
Ü Ü Ü
Ý Ý Ý
x
x :=
x :=
x :=
od
od
ym
xm
xm
ym
xm
od
od
od
y :=
y :=
y
y
Ü Ü Ü
Ý Ý Ý
!
Example 11.7
)
'
'
Cl
*
Cl
Cl Cl $% +
Cl Cl Cl Cl Cl
290 Modelling Processes
Example 11.8
*
. ( . !
¯ % . .
.
(
!
Computations and Processes 291
!
#
$ $ )
*
'(
$
+
$,
-
"
292 Modelling Processes
#
(
)*
+
,
¯ (process) variables
-
¯ events actions
% !
%
!
!
operations
+
!
$ !
Cl¼ %! &&. !
#
(
0
deadlocked
A Language for Describing Processes 293
0
0 0
Cl¿
!
"
#
"
$
294 Modelling Processes
# ! #
process definition !
$ !
¼
¼
11.3.4 Choice
¯
¯
¼
¼
&
!
'
(
)((
%
296 Modelling Processes
½ ¾
! "
"
#
$
$
%
#
&
%
'
$
"
nil
0
%
)
*
"
' Cl '
" '
Cl
'
Cl $
Cl
Cl $
0 Cl
$
Cl
A Language for Describing Processes 297
¼
¼
¼
¼
¼
¼
0
!
"#
Clock#
"
$
%
%
&
"
"'
"
#
"
&# $
"# "
%
"
$
%
&
#
%
Cl
$
(
Clock
Cl
#
"#
Clock #
%(
" Clock# %
)
$
" )
"
( &
#
%
( (
Cl $
"
$
(
Clock
Cl Cl
+
( $
! " Cl
$
,
-
298 Modelling Processes
Clock
Cl¼ Cl½ Cl Cl Cl
Cl
Clock
% "#
# &
"#
!
!
'
(
) )
ν 10p.10p.( coffee.collect.Πcoffee tea
+ tea.collect.Î )
Î 10p.( 10p.coffee.collect.Î
10p
+ 10p.tea.collect.Î )
Î 10p.10p.coffee.collect.Î
collect
+ 10p.10p.tea.collect.Î
Î
10p.(coffee.collect.Î + tea.collect.Î )
coffee.collect.Î + tea.collect.Î
collect.Î
&
Î
10p
10p.(coffee.collect.Î + tea.collect.Î )
Î ' 10p.10p.(coffee.collect.Î + tea.collect.Î )
!
300 Modelling Processes
' $
10p
10p coffe
e
ν tea
collect
& %
' $
10p coffe
10p e
ξ 10p
tea
collect
& %
' $
10p
10p coffe
e
ο 10p
10p
tea
collect
& %
10p.10p.(coffee.collect.ν + tea.collect.ν )
10p.(coffee.collect.Î
10p
½ + tea.collect.ν )
10p
coffee
ξ ο
Î
10p
10p
coffee
Î
Î
Î
Î
Î
10p
coffee
tea
10p
10p
tea
Î Î
Î
!
"
#
Exercise 11.16 (Solution on page 469)
$
% 0 & 0
% &
% & 0 & 0
%
' (
) #
302 Modelling Processes
!
"!
#
$
% ½ & ' 0
% ¾ & '
% & ' '
%& % ' & ' ' % ' &
%& (
)
*$
Example 11.17
¯ ¼
¼
¼ ¼
¼
¯ ¼
¼
¼ ¼
¼
!
"½ # $
% %
"¾ # $
&
'
(
!
¾
'
)
! " # $ # ! "
! "$
$
!% &' " ( $
) *
) "
"
+
, & + -
- $ $
$
" .
/
%
&+
&
+ 0 #
$
$ 1$ 2 3
/ $
44 (
5 ($ 1 6 ($ 2
7, ( 3 54 ( $ 1 (
8
/
%
$ 1$ 2 3
(
/ $
$
$ 9 - :
$
- (
$ ,$
7 4 $
*
$
( :
/
%
7 - )
!
)
& + / )
(
! ! !
: $
$ $ $ 5$ ; 6
$
%
&+ / )
(
! ! !
: $
$ ,$ 5$ 9$ ;$ 6
4 $
%
5 )$ $
<
( )
<
Additional Exercises 305
! "# $%
&
'
!
(
" )
x mod y
*
+
while x y do x := x-y
return x
!"!
# $
$
$ "
$
% &
$
'
"
$$
(
) *
+
,
$
) -
'
.#
½ / 0 0
¾ / 0
/ 0 /
/ / 0 / /
1 0
0
2 *
+
,
$
)
1 0
/ 0 /
1 0
0
Chapter 12
Distinguishing Between
Processes
#
$
¯ %
¯
&
'#
( %
& . ½' /
%
& ' ½& ' 0
Example 12.1
!
!
"
!
!
#
$
$
Example 12.2
%
!
&
(
)
,
'
312 Distinguishing Between Processes
Theorem 12.2
$
" #
½" #
% "&% ' (()#
Definition 12.2
-game equivalent
" #
-game equivalent
½
½ " #
%
!
!
!
(!
¾ (
%
10p
½ ¿ ¾ ½ ¿ ¿
%
%
* ½
"coffee tea#
*
( ¾ ¿ ¿
%
Properties of Game Equivalence 313
ο
coffee
ξ
tea
tea
ξ
Theorem 12.3
¼
¼
¼
¼
¼
¼
¼
¼
¼
¼
½
¼
¼
¼
¼
½ ¼
¼
¼
¼
¼
½ ¼
½
½
½
¼ ¼
Theorem 12.4
½
Proof: "
½ '(
½
" )
*
½ ½
½
½
½
Bisimulation Relations 315
½
Theorem 12.5
½
¼ ½ ¾ ½
Proof: ! "
#
"
# "
# #
# "
#
!
# # $
"
#
"
#
!
# #
¼ ½ ¾ ½
Cl Cl Cl ·½ Cl'
Clock Clock
#
Cl Cl Cl
·½ Cl'
Clock Clock Clock ½ Clock
"
!
# "
"
)
!
# $
316 Distinguishing Between Processes
Clock Clock
!"#
¾ $
%
!"#&#'
Definition 12.5
bisimulation relation
¼ ¼ ¼ ¼ ¼
¼
¼ ¼ ¼ ¼
¼
¼
(
)
Theorem 12.6
½
Proof:
Bisimulation Relations 317
Example 12.6
Ò Ó
' ½ ½ ¾ ¾ ¾
+ , #
½
-
"
"
Æ (
½
½ " ½ ½
+
$
"
# $&
.
!
" $&
.
! ½ #
Ì
½ ' ¾ !
# !!% /
# !
Clock Clock
Clock ½ Clock / "
318 Distinguishing Between Processes
Definition 12.7
image-finite
Theorem 12.7
½
Ì
Proof:
¾
½ ½ Ì̾
¾ ½ Æ
Ì
!
¾
" ! ½
#
¼ $ ½
%&' !
¼ ( !
( ¼
! ) ¼ ¼ ¼
( ¼ ¼
*
¼ ¼
¼ ¼ ¼
(
% $
&(
0 0 / 0'
Bisimulation Colourings 319
¼
¯
¼ ¼ ¼ ¼ ¼
bisimulation equivalent bisimilar
"
#
$
Theorem 12.8
½
Proof:
%
½
! "
½
# $
$
# %
!
&
Invariant:
'
#
! $
# #
partition refinement algorithm (
$
$
$ #
) *$
+
' $
&
%
, -
-
.
/
, # 0
,
(
-
. / ! 1 ,
( 1
' $
&
%
Bisimulation Colourings 321
& %
*
" #
'
& " "
"
&
&
"
&
# &
& "
&
" " "
" "
+"
&
&" #
#
322 Distinguishing Between Processes
!
"
#
"
!
Clock Clock ¾ Clock ½
Clock
½
!
"
¼ ½ ¾ ¿
#
$
%&'½¼¼
&'' ()
*
+ ,
-.
/
*
0&
% (
$
)
0
1
2
*
324 Distinguishing Between Processes
successor predecessor
limit
!
" !
# $
%
$
$
%
&
$
" '
(
( )
!
*
"
+
"
, & !!
Æ
#
!
!
- transfinite induction
!
!
.
/,
Example 12.10
1
!
"
'
!
2
#
( ( (
, , ,
#
"
"
!
"
½
¼
!
"
#
½
$
¼ ¼ ¼ ¼
!
%
$
&
!
'
(
##
&#
Theorem 12.10
Proof: )
* "
¼
+
* %
¼ ¼
+
* %
¼ ¼
·½
##
¯ +
·½
326 Distinguishing Between Processes
½
¯
·½
·½
¯
¯
Definition 12.10
-game equivalent
Example 12.11
Clock
Cl
Cl Cl
'
Clock ·½
Clock
(
· ··½
½
Theorem 12.11
¼
¯ ¼
¼
¼
¼
¼
¼
¼
¼
¼
¼
Theorem 12.12
Theorem 12.13
¾Ç
Theorem 12.14
½
Proof:
½
! "
# $
%
– # ¼
¼
¼ ¼ ½ ¼
!
¼ ¼
– # ¼
¼
¼ ¼ ½ ¼
!
¼ ¼
328 Distinguishing Between Processes
½
¯
Ì Ì ¾Ç ½ Æ
¾Ç
½
¼
¼ ! "
"
# ¼
$ "
% ¼ ¼ ¼
$ " & #
¼ ¼
' " ¼ ¼
¼ ¼ ¼ #
½
!
"
!
"
!
"
!
"
!
"
!
"
# $
$
%%#
&
' 0
330 Distinguishing Between Processes
¾
¿
½
!
"##
½
$
$
% !
"#%$
&
&
' !
trace set
!
trace equivalent $
$ $
$ ($
deterministic $
$
! $
$
$
$
¼
¼ ¼
)
¼
¼
$
)
$
* + trace bisimulation relation
,
£
,
¼
¼
¼
¼ ¼
-
Additional Exercises 331
¯
¼
¼
¼
¼ ¼
"
#
%
%
%
)* $+,
-
.
Ë /
· %
/
%
Ë %
%
· %
% %
$ %
· %
%
1 % $
· % $
$ % $
% $
Ë
% $ %
$
· 2 % %
%
$
332 Distinguishing Between Processes
¾ ¾ ¾ ¾
¾
!
"# $ "#"" !
%#&
"% $ "#"# !
%#&
"' $ "#"% !
%#&
Chapter 13
!
$ %
! !
%
& '
# %
*
Example 13.1
!
"
# $%&$'()'(*+'++
"
,
-.
(
-
.
)
)(
- / .
0
0
1
)
$%&$'()'(*+'++
/
/
! " #
! " #
$
%coffee&
' & Æ
coffee
coffee
*
+
%coffee&
) "
"
& +
%coffee&
*
true
*
%coffee&
coffeetrue
coffee
true
, -
true
true
#
10p
10p
coffee
10p
10p
tea
Exercise 13.1 (Solution on page 477)
coffeetrue
coffeefalse
coffeetrue
coffeefalse
!
!
"
#
!
!
! "
$ Cl %
% &
$ #
$ Cl % '
%
$ %
$
$ (
#
!
"
! Cl "!
Cl )
!
!
HML
! " # $ %
&
&
# &
satisfiable (
valid
) *
%
& true
true
&
false
false
$
HML - ./.
)
0
## %
338 Logical Properties of Processes
true
false
HML
false
$
¾
#
%
!
#
&'
!
(
#
%
A Modal Logic for Properties 339
¾ ¾
!
" # HML
" $
$
Example 13.3
true
true
* "
)
+ ,
+,
-
HML .
)
-
true
true true
(
true true
!
!
"
!
# $
%! #$
!
# $
%! #
$
&
# $
'
!
# $
# $
" (
2
!
" (
342 Logical Properties of Processes
# !
! "
Example 13.6
false
false
# false
() ()
false
HML
HML
,
Negation Is Definable 343
HML
pos
neg
pos
$ % $ % pos
neg $ % neg
&
Theorem 13.6
pos
neg
(
)
*+,
HML
!
½ ¾ ¿
!
$10p% tea
!
coffee.collect. ½ + tea.collect. ½
tea
&
'
$10p%
¾ ¿
$tea%
(
$coffee% ) !
¾
¿
!
$10p%
$10p%
$tea% !
$10p%
¾
10p.coffee.collect. ½ + 10p.tea.collect. ½
½ 10p.(coffee.collect.
10p
½ + tea.collect. ½)
The Vending Machines Revisited 345
¯ ο
10p
10p.tea.collect.Î ¿
10p
tea ν Î
¼
10p10p teatrue
! 10p10pteafalse
"
10p
10p
tea
#
10p
10p.coffee.collect.
$
%
10p
tea
&
%
'
10p
(
10p
10p.(coffee.collect. + tea.collect. )
10p
10p.coffee.collect. + 10p.tea.collect.
10p
tea
¼
10p 10p teatrue
)
*"
+++,
0 - 0
-
- 0 - 0
.%
/ HML
(
'
346 Logical Properties of Processes
!
!
"
#
$
!
&true' ( ) & ' (
& & ' & ''
&false' ( ) & ' (
& & ' & ''
& ' ( & ' & ' ( * & '
&+, ' ( * & '
"
!
HML
-
Modal Properties and Bisimulation 347
false
true
false
true
false
true
false
true
!
false !
true
Theorem 13.9
½ ¾ : )
½
*
½ ¾ ¾
½
¾
( ½ ¾
½
¾ +
½
¾
½ ¾
½ ¾ : )
½
*
½ ¾ ¾
½
¾
348 Logical Properties of Processes
½ ¾
½
¾
½
¾
½ ¾
:
¼ ¼ ¼
½
¼ ¼
!
¼
"#:
$
"#
¼
¼
¼ ¼
½ %
"#
¼ ¼ ¼
$
¼
!
¼
&
'
(
!
)
HML
'
Definition 13.10
HML HML *
Corollary 13.10
HML
Proof: %
!
&
¼
'
½
¼ ¼ ¼ ¼
( ¼
½ ¾
$" "
¼
Corollary 13.11
Proof:
Clock Clock
Clock Clock ' ( Clock Clock
characteristic formula
*
+ ! %
0
!0% + , -false
.
Theorem 13.11
! % HML
Characteristic Formulæ 351
Proof:
true
true ¼
States
½ !
¼ ¼
" # !
¼ ¼
¾
$ !
$
%
!
¼
¼
$
%
! &
¼ ¼ ¼
'
&
( &
( ¼
)
*
+ ·½
,
¼
¼
¼ ¼
¼ ¼
¼
¼
,
¼
" # ¼
¼
¼
¼ ¼ ¼
¼
¼
-
. ·½
/ ·½
¼
¼
0 ¼ ¼
¼ ¼
352 Logical Properties of Processes
true States
false
States
¼ ¼
States
¼ ¼
¼
¼
¾ ¼
% ½
:
½ ¾ :
½ ¾
½ ¾
½ ¾ ½ ¾
½ ¾ :
½ ¾
½ ¾
½ ¾ ½ ¾
:
¼
¼
¼
¼
:
¼
¼
¼
¼
½
¾
true
true
false
true
true
true
HML
Cl " Cl !
)
false * ! %
+
*
354 Logical Properties of Processes
true true
!
" 0 # 0
"
" 0
$
%
&
'
'
true false 0
true
true
true
true
true
true
true
(
!
0 1
)+ 2-
-.
-. !
3
3
3
3
4 5
+
HML
6-
6-
+
+
- !
7
6-
6-
+
-.
1
6-
6-
+
-
2-
+
+
-.
"$ 8 HML - HML -.
9:* 2-
3 true
true
HML
!"
#$
% & $' '
'
HML
# HML
HML
( )false
*
HML
! +
% && '
'
'
HML
Chapter 14
Concurrent Processes
!
!
Example 14.1
(
!!
"
synchro-
nisation sort Sort
Example 14.2
! Sort
Sort "
Sort " #
"
$
È É
Ê
Sort " $
È É Ê
%
&
Sort
'
360 Concurrent Processes
synchronisation merge
!
"
!
#
$
% ¼
Sort
¼
" %
Sort
¼
¼
# % ¼
Sort
¼
Sort
¼
¼
(
)
*
'
+
(
+
)
14.2 Counters
,
-counter
$
,
!
Counters 361
¯
¯
"
#
"
# ¼
¼
" ¼¼
#
¼¼
" ¼
¼ ¼¼
!
362 Concurrent Processes
¾
$ Rail
Railway Level Crossing 363
¯ Road
¯ Controller
Safety Properties
¯
Liveness Properties
¯ !
¯ !
"
Road #
car.up.ccross.down.Road
SortRoad # up down
Road
car
$
up
$
ccross
$ %
down
Road
car
Road
down up
ccross
Rail #
train.green.tcross.red.Rail
SortRail # green red
Road
Rail
364 Concurrent Processes
train
green
tcross
red
Rail
train
Rail
red green
tcross
Controller green.red.Controller up.down.Controller
Sort Controller up down green red
Controller
up green
Controller
down red
!
Crossing Road Controller Rail
# $ #
"
Mutual Exclusion 365
¯
¯
&
"
'
14.4.1 Dining Philosophers
"
()*+
,
366 Concurrent Processes
Mutual Exclusion 367
!
¯ !
¯ !
¯
!
!
½ "
#
"
#
"
#
"
#
"
#
$
%
&
&
' &
&
!
Sort "
! ( )
Sort "
! ( )
*
!
%
& &
&
$
&
!
368 Concurrent Processes
½
Exercise 14.5 (Solution on page 484)
b1 := true; b2 := true;
k := 2; k := 1;
while (b2 and k=2) do while (b1 and k=1) do
skip; skip;
b1 := false b2 := false
½
¾ b1
Sort
b1
!
"
!
b1
!
"
#
!
! b1
"
! b1
!
$
!
"
!
b2
!
Sort
%" k
&
'( & ' ( & ' ) &
'( ')
' )
& ') & ' ) & ' ( &
& &
Sort& '( ') ' ( ' ) ' (
' ( ' )
370 Concurrent Processes
k
k
½ ¾
!
"
!
#
b1
k $
% &
½
½ È
Ï ½
Ï
È È
È È
È È
Sender in snd S
S
ack Sender err snd S
in
Sender sndS
err
ack snd
S
rcv
rcvMedium
Medium snd
errMedium
err
!
rcv "
out
#
ack
"
Receiver
Receiver rcv out ack Receiver
SortReceiver rcv ack
Alternating Bit Protocol 373
rcv
System Sender Medium Receiver
ack
snd rcv
in
out
err
!
"# $
%
&'
communication
protocols
374 Concurrent Processes
Sender
Medium
Receiver
ack in
S snd S
Medium Medium
ack Receiver Receiver
err snd
out
S
S
rcv Medium
Medium
err Medium
out ack Receiver
Receiver
rcv
!
¯
"
#in$
%
& ' "
#s¼ $
#s½ $
%
"
#ack $
#ack $
%
(
)
*
" #t$
%
"
%
, in ¼ ¼
, s "ack - ack ¼
- t ¼
%
, in ¼
¼
, s "ack - ack ¼
- t %
¼
s
¼
in ack
ack t
ack t
ack
¼
in
s
376 Concurrent Processes
s¼
s½
¯
r r
out
!
rack rack
"
!
#
$
%
Sort
% rack rack
out
r rack
r r
rack r
out
rack rack
!
!
"
#
$
%
Sort % r r ack ack
% s r & s r & rack ack & rack ack
Additional Exercises 377
s¼ s½
r¼ r½
rack rack½
ack ack½
s s
rack
rack
r
r
ack ack
System Sender
Medium Receiver
s r
s r
in ack rack
out
ack rack
in out
!
Exercise 14.8 (Solution on page 488)
" in out
#
¿
!
"
#
$
!
%&'
down
$ green
up
red
(
#
$ &
#
$
(
#
%&
)
)
)
)
!
!
$
$ *
!
)
!"
)
+
,
!!
-
!.
-
/ 0
!
1 0
2
3
22
1 0
4
Additional Exercises 379
b1 := true; b2 := true;
while b2 do while b1 do
if k=2 then if k=1 then
b1 := false b2 := false
while k=2 do skip while k=1 do skip
b1 := true b2 := true
k := 2; k := 1;
b1 := false b2 := false
in out
!
"
#
"
"
$ 0
Sort " $ $
0
Sort " $
%
&
" )!
¼
Sort "
¼
" )! ¼
Sort "
¼
" )!
¼
¼
Sort " Sort "
¼
¼
*
+
!
,
!
-
!
Chapter 15
Temporal Properties
¾ HML
!
" # $
%
&
! '
'
(
)
*
+
,
temporal properties
'
.
.
15.1.1 Always:
! "#
$
!"
& '
(
)*
+
*
*
*
+
.
true
+
-
.
% true
Three Standard Temporal Operators 383
Example 15.1
Clock Clock
!
!" "
HML#
" $ %&
&" ¾ #
" !
#
"
$ %&
'
Clock Clock
!
"
" &
&
$ (
Clock ) true
! Clock ) true
Example 15.2
*
" "
"
&
+ ,-
*
.ccross/false .tcross/false
*
"#
"
0 ccross
0 tcross
15.1.2 Possibly:
0
#
# 1$
2#
"
" &
&
"#
) #
" #
)
Û
*
12
$
&
& ! "
' &
" 3 4 5
"
! (
*
"# (
5
5
5
5 6
" &
& "(
!& 3 4
"
3
& %
)
384 Temporal Properties
! "false
##
$ ! "false
!"
$
$
$
%
$
Exercise 15.2 (Solution on page 488)
&
#
$
$ true
$ !"false
15.1.3 Until: U
'
#
(
)
#
&
#
%
(
$ &
$ ¼ ½ ¾
½ ¾
$ ¼ ½ ¾ ¿
$
$
Recursive Properties 385
true !
"
# $
%
#%
$
%
#%
$ !! &#
Exercise 15.3 (Solution on page 488)
' #
( "
)
*
+
,!
#
%
%
3
3
' #
%
4 '
valuation function
386 Temporal Properties
V Variables States
Variables
States
V true
V false
V
V
V
V
V
V
V
V
V
V
V
V
V
V
!
"
V
V
$
"
!
true V States
false V
V V
V V
V V V
V V V
V States ¼
V
¼
V States ¼
V
¼
Theorem 15.3
V
V
( %)&
Recursive Properties 387
V V
V
Example 15.4
) States
!
States !
V
States !
V
V
V V
V V V
Exercise 15.5 (Solution on page 489)
!"#
$
%
%
15.2.2 Fixed Point Solutions
& ' States States
V
Proof:)
%
0
% 0
%
true: trueV States trueW
false: falseV falseW
: V V W W
:
V
V V
W W
W
Recursive Properties 389
½ ¾:
V V V
W W
W
W
:
V States
V
¼ ¼
States
W
¼ ¼
W
!
! " #
# "
#
! # #!
!
# # $ % V &
'
( )* +
!
&
#!
-
# #
$ % V
! .
)* +'
/ !
'
390 Temporal Properties
true V States
false V
V V V
V V V
V
States
V
¼ ¼
V
States
V
¼ ¼
V V
V
Ì Ò States
Ó
V
ËÒ Ó
V States V
*+ *+ ,
# *
+ $
%! )
& V #
%!
Theorem 15.6
V W
V W
V W
Proof:
! " "
# : V # # W
# : V " V
" W
W
#
:
V " V
" W
W
Definition 15.6
V
#V
States &
& #V
392 Temporal Properties
V
V
HML
Exercise 15.7 (Solution on page 490)
!
neg"true# false neg" # $%neg" #
neg" #
neg" # neg"# neg" # neg" #
neg" #
neg" # neg"# neg" # neg" #
neg" #
&
V neg" #
V
V" # V" #
+
,
- (
( .
.
(
/
(
(
.
Example 15.7
((
(
(
(
.
((
(
(
*
!
Least versus Greatest Fixed Points 393
Example 15.8
¼
false ¼ true
½ ·½
Example 15.9
! "
#
$
!¼ false #¼ true
!½ false #½ true
!¾ false #¾ true
!¿ false #¿ true
%
! & " & '
$
(
# & "
"
""
& "
)
**
+*
,
(
&-
+*
"
*
( *
true
Example 15.10
! "
#
$
Least versus Greatest Fixed Points 395
¼ false
½ true false
¾ true true false
¿ true true true false
¼ true
½ true true
¾ true true true
¿ true true true true
!"
"
# !
#
" !
"
#
$
#
"
% ##&
#
#
##
##&
"
false
' *#
+, ! #
!
# #
!
" #
##
#
!
)
!
"
$ +-. $
( !
&
# #
"
"
#
! States $
#
#
!
396 Temporal Properties
Theorem 15.10
V States V V
Proof:
!
"
falseV
V
!
"
V
V
V
# $V
V
Example 15.11
%
&
'
#$
(
)
)
(
/"
)
States "
States States
States V
States V ' ) V
States V '
) V
States
"
Expressing Standard Temporal Operators 397
Example 15.12
¿ ! " States ¼
¼ ¼¼
! "
safety
properties
¯
false
liveness
properties
!
"
#$#
15.5.1 Always:
%
& ' (
)
*
+
& ' (
15.5.2 Possibly:
%
&
,
*
+
&
15.5.3 Until: U
%
-
Further Fixed Point Properties 399
true
!
"
#
#
$
true !
&
'
(!
!
&
'
)! true
!
&
true '
There is no path.
neg ! " #$
%
&
" #$
'
(
holds at every state along some path.
(
*
(
&
(
+
(
,
(
-
.
!
'
(
/
(
!
Additional Exercises 401
( '
)
!
* almost always holds along some path.
+
,
,
- holds infinitely often along some path.
!
"#
0 $ 0
% &
' % States(
V ) V
.
+
/
+0
(
entry
( entry
exit
1 &
(
2 3
+ *
-
+
4
&
4
¾ true
¾
½
Solutions to Exercises
Chapter 1
!" #$
%
&
&' " ! (
+"
! !
&
+
! &
&"
& !*(
&
"*
,
*- !&
.
(
$
" *
* *
!
" /
*
!
"
* (
+
,
#
#
-
#
. (
/
#
0 (
3&
4
Additional Exercises 407
!
"
#
" # " #
408 Temporal Properties
É È
É
È É
È
É È
È É È
!
" È É Ê È É È Ê
È È
É Ê É
È Ê
#
$
$
Love
!
" Police Sup
# Long Poet
$ Prison
% Cousin Love
& Poet Police
' Sup Cousin
( Prison Long
)
*
*
& '
* + , &
-Poet.
-Police.! Poet Police
( /
0
- Prison.
-Long.! Prison Long
1 *
-Love.!
Prison - $.
Long - ( Prison Long.
Poet - # Long Poet.
Police - & Poet Police.
Sup - " Police Sup.
Cousin - ' Sup Cousin.
Love - % Cousin Love.
-
0 0
0
*0
*.
410 Temporal Properties
KingMoved RightRookMoved
RightToCastleRight
RightToCastleLeft RightToCastleRight
PieceBetweenLeft PieceBetweenRight
KingAttack KingAttack
LeftSquareAttack RightSquareAttack
KingMoveLeftAttack KingMoveRightAttack
MayCastleLeft MayCastleRight
!
!
Additional Exercises 411
JonF JonO FonJ FonO OonJ OonF
OonJ FonJ
FonO
JonO
JonF
!
" #Oskar$
%
&
#Joel$
&
#Felix$
'&
Exercise 1.19 (page 40)
!
(
(
!
)
*
"
!
(
!
! )
! )
)
Exercise 1.20 (page 40)
+
)
," irrespective of
the premise of the conditional statement
' $
F F T
F T T
T F F
T T T
& %
412 Temporal Properties
Í È
' $
È É (È É*
F F T F F T F
F T F F T F T
T F F T T T F
T T T T F F T
& %
' $
È É (È É* ( È É*
F F F F F T T F T T F
F T F F T F T F F F T
T F T F F F F T F T F
T T T T T T F T F F T
& %
Additional Exercises 413
' $
É Ê Ë È É Ê Ë
F F F F F F F T T F T F
F F F T F F F T T F T T
F F T F F F F T F T F F
F F T T F F F T F T T T
F T F F F F T T T F T F
F T F T F F T T T F T T
F T T F F F T T F T F F
F T T T F F T T F T T T
T F F F T F F T T F T F
T F F T T F F T T F T T
T F T F T F F T F T F F
T F T T T F F T F T T T
T T F F T T T T T F T F
T T F T T T T T T F T T
T T T F T T T F F T F F
T T T T T T T T F T T T
& %
F F T T F T T F
T T F F T T F T
' $
F F F T F F F
F T F T T F F
T F T F F T T
T T T T T T T
& %
' $
F F F T F T F
F T F T T F F
T F T T F T T
T T T T T T T
& %
!
"
#
#
Additional Exercises 415
false
416 Temporal Properties
Chapter 2
Exercise 2.1 (page 59)
! "
#
$ %& '
( )
* " +
*
¯
¯
¯
¯
¯
¯
'
%
Police Sup
Additional Exercises 419
Long Poet
NoPrison
Cousin Love
Poet Police
Sup Cousin
NoPrison Long
)
$
$
*
# +
#$
Í
! "
! # $!
$%
&%'
!
# '
(
!) $! $%
%' $%
*
! $
!
# ( )
# ( )
#
Additional Exercises 421
Chapter 3
Exercise 3.3 (page 89)
$ $%$ &
$ %
$
$
&
+$ *
$
)$ , $&
%
- - -
$ % & ) - . %
/ $ $ $
&
$
'
422 Temporal Properties
)
% ! '
%
! *
'+
¼
¼
¼ ¼
¼
¼
ÜÜ ÜÝ Ü Ý ÝÝ
¼ ¼ ¼ ¼
ÜÝ Ü Ý ¼ ¼
) Ü Ý Ü Þ
Ü Ý Ü Þ ¼ ¼
ÜÝ ÜÜ ÜÝ ¼
Ü Ü Ý ¼
Ü Ü Þ ¼
ÜÜ ÜÞ ¼
ÜÞ
$
-
Ü Ý Ý
. Ü Ü
Ý Ý Ý ÜÝ Ü Ý
¼ ¼ ¼ ¼
Ý ' - ÜÝ Ü Ý Ü Ü Ü
¼ ¼ ¼ ¼
Additional Exercises 423
¼
¼
¼ ¼
¼
"
%
$
"
&
¼
' ' ' ' ' '
¼
' ' ' ' '
' ' ' ' ' ' '
' ' ' ' ' ' '
' ' '
' ' ' '
' ' '
' '
424 Temporal Properties
Chapter 4
Exercise 4.2 (page 111)
% & &
' ( " ) " ( '
" & "
* &
( & ¿ &
$ &
$
¾ &
$
* " " * % (
) $ % ' " + * ,
Exercise 4.5 (page 115)
%
"
*
Exercise 4.7 (page 117)
%
"
Additional Exercises 425
Ü
*
&
' (
' (
)
426 Temporal Properties
Ü Ü Ü
Ü Ü Ü
Ü
Ü Ü
Ü
Ü
Ü
Ü
Ü
Ü Ü
Ü
Ü Ü
Ü
Ü Ü
"
#
$
$
$%
%
%
% &
%
'
$
" $
(
)$
*
%
%
+ + $
,
$
" $
"
$
$
%
$
. "
% .
%% " $
$
$
!
%%
% $
% "
Chapter 5
Exercise 5.2 (page 134)
Fact 15.14
Proof:
#
"
$
%
Proof:
!
"
#
$%
4
'
430 Temporal Properties
!
"
# $
%
%
!
#
$
&
-
. /
'
) + ) ( ,
Additional Exercises 431
Exercise 5.20 (page 152)
Fact:
Proof:
– !
– !
!
"
– !
– !
"
$
%
" &
'
(
Chapter 6
Exercise 6.2 (page 158)
rangescore ) * *+ ) ), -* -, ,, + ..
score ½
/ -.
432 Temporal Properties
Ê ! ! Ê
¾
( Æ Æ ) ¾
!
! Æ
¾
!
)
,
!
!
Additional Exercises 433
½
,
)
434 Temporal Properties
% & '
'
Exercise 6.17 (page 173)
( "
) $
%&
%&
) $
%&
%&
* %&
Exercise 6.18 (page 174)
+
'
" %
& %
& $
%
& % & % ' & %
& '
' "" $ !
" $
! , ' '
" $ !
Exercise 6.20 (page 176)
)
%
& -'
-' % &
' %
& % &
%
& '
¾
¾ % &
.
¿ %
& ' / ¿ % &
. #
%
& ' ' ' % &
. '
Additional Exercises 435
L G
Chapter 7
Exercise 7.1 (page 180)
Exercise 7.3 (page 183)
! " # $!
! %&
$!
! ' & ( ) %
$!
* +! ( , -./ )$!
! "0
1 2 )$!
3 * - ! % 4 5 )
-$!
3 * - ! - 6$!
3 * - ! 2 ' & 7 ($!
! #) #) 1*$!
3 * - ! ( 4&$!
3 * - ! 1 8
9$!
%0 " ! % )* "*$!
%0 " ! 9$!
: ; !
7$!
: ; ! % 0
#) "$!
: ; ! % 5
< # 7 &*$!
: ; ! " 1 "$!
" *! 3 $!
" *! =&&0 > $!
" *! 6>$
" ¿ ½ ¾
'
#
% #
'
#
% #
%
438 Temporal Properties
¯
Æ
!
" #
" #
!
Exercise 7.10 (page 190)
"
" $%
Exercise 7.11 (page 191)
"
&'
( !)
#
#
#
"
&'
*
+
"
&'
&'
*
+
*
+
Exercise 7.12 (page 191)
"
, '
-"
"- .
, '
-(! (!- - (!
"
, '
-(!
(!-
*
+
*
+
Exercise 7.13 (page 192)
"
, '
¯
¯
¯
¯
¯
Exercise 7.18 (page 194)
!
Exercise 7.19 (page 194)
½
"
"
"
"
"
"
¾
#
$
% "
&
%
' " '
$
'
"
Exercise 7.21 (page 195)
(
) )
)
440 Temporal Properties
! ! " # $ $ % !&
' ' !' # # ! !" & &
( ( !( $ $
" " ! ' ' & &
% % ! ! !! !!
!$ !$ !# !# !% !%
Chapter 8
"' : ,
"' (*
*
"' - !*
-
$' +
-
!' +
' +
(' +
(' +
' +
.
-
/*
0
*
( ! $ "
!
+
* -
+
"'* "'
Additional Exercises 441
" # $ % & ' (
/ ½
0 !
442 Temporal Properties
½ ¾
Exercise 8.8 (page 213)
! "# # $!" # #
! "" # #!% # %
! " % # ( ! ) # #'
! %# ## # "*
' ! % #" " $)&
¯
½ ½
½
¾
&'
(
½
½
,
-
444 Temporal Properties
¯
¯
!" !" ! !" #!"
!"
& !" ! !" " !" !
Chapter 9
Exercise 9.1 (page 226)
! ( !"! !" ( ( ! !
+ ! !! ! ( !"! % ! !
- ! + ( !(! (! !"! ½ !
! !+ !" !" + + %+ & .
Additional Exercises 445
½
. / .
/ . .
.
/
.
/
/ .
/ 2 34
44 22 2 3 3 3
/ 4 4 4 4 4 4
/ 34 4 / 3434
446 Temporal Properties
!
Exercise 9.4 (page 231)
Proof: *
Base Case: +
# $ ¾ # %¾ #
¾
# ¾ & & '#('$'(#(
)
Induction Step: +
Proof: *
Base Case: +
# % # # # '$'(( & & ¾
Induction Step: +
# % # # # '$( & ¾
Additional Exercises 447
¾
¾
¾
¾
!
"
Proof: #
Proof: #
¼ ½
448 Temporal Properties
¾ ½
¾ ·½
¾ ·¾ ·¾
Exercise 9.6 (page 232)
·½
¾ ¿
Proof:
Base Case:
½
¾ ¿ ¼
Induction Step:
·½
¾ ¿
·¾
¾ ¿ ·½
!
"
·½ ·½
Additional Exercises 449
½ ·½ ·½ ·½ ·¾ ·¾
!
¾
¾
"
!
!
"
Base Case:
(
! ( ( (¾
! #
¾
#
!
¾
"
!
#
! #
!
!
450 Temporal Properties
¾
Exercise 9.9 (page 235)
Proof:
! "
Exercise 9.11 (page 236)
Fact: ¾
¼
¾
½
¾
¾
¾
·½
(
Proof:
Proof:
¾
¾
¾
¼
¾ ¾
¾ ¾
¾ ¾ ¾ ¾
¾ ¾ ¾ ' ¾
¾ ¾
% ·½ ! % ! "
452 Temporal Properties
Ü
½
·½ ·¾
·½ ·¾
¾ ½ ·½
½
Exercise 9.15 (page 239)
!
!
Proof:
½
Base Case ½
¾
¾
¾
¾
Chapter 10
Exercise 10.1 (page 257)
! !
, )
*
* "
- )
"
. -
"
- "
,
"
!
)
*
- "
454 Temporal Properties
!
" #$
'
¯
¯
!
¯ "
#
¯ $
"
¯
$ %
'
%
¼ ¼
¼
¼
¼
&
'
%
&
!
Æ
!
' !
¯
(
'
(
!
456 Temporal Properties
¯
¼ ¼
¼
!
¯ (
$!
¯
!
¯
'!
¯
'!
½
¾ ¾
½ ¾ ½¾
½ ½ ·½
½ ½
½
½ ¾
!
½ ½
½
½ ½ ¾
½ ¾ ¿
½
¾
¾¿
½
#
½ ½ ¾
½ ¾ ½ ¾
$
%
½
½ $
$ $ % $ &
½ ½ ·½
½ ·½ ½
Additional Exercises 459
Chapter 11
Exercise 11.3 (page 286)
! "
" #
$ "%
#
$ " #
&
$ '%
# $
(
'%
# " " " "%$
*
# " % $
+
',
* '-.
#
$
460 Temporal Properties
! " ! !
"#
$" % &! '( %
&
'( % '( %
'( % &!
' )
!# "!
! "
#
!
&
!
Additional Exercises 461
$&
" *!
$&
# *!
$&
! !
$&
! !
$&
(! + # # + ! #
$&
" + (! + " " !
,
$
-% )
! ! " !
. #
. ! ! .
" .
' #
' !
) 1
) 1 &
) 1
%
0
# /
1
2 1
/
462 Temporal Properties
&
'
( )
* "
"
+
+ (
)
x := x mod y
y := y mod x
Ü
!"
x := x mod y "
!"
"
!"
y := y mod x "
#
"
#
x := x mod y !
#
!
#
y := y mod x !
!
x := x mod y #
$
Cl
Cl¼ %
tick%
Cl
tick
Cl
Cl
tick
Cl¼
Exercise 11.9 (page 291)
& $
464 Temporal Properties
¾
½
¾
¾
¿
!
"
½
"
¾
"
¿
"
!
"
"
"
"
"
"
"
"
"
#!
$
%
"
"
&
&
"
$
&&
'
( (
(
!
"
%
"
&
'
"
$
&
'
&&
&
'
&
"
"
½
¼
¾ ¼
¿
"
+ -
. )
10p.coffee.collect. + 10p.tea.collect.
coffee.collect.
tea.collect.
collect.
468 Temporal Properties
¼
Î
10p.coffee.collect.Î
10p.tea.collect.Î
coffee.collect.Î
tea.collect.Î
collect.Î
0
½
¾
¾
¾
¿
¿
¼
Chapter 12
Exercise 12.2 (page 312)
Fact:
!
"
!
Proof: #
!
¼
$
¼ ¼
!
!
%!!
!! &
¯
¼ ¼ ¼
¼
'
¼ ¼
¯
¼ ¼ ¼
¼
¼ ¼
(
!!
!
·½ )
)
¼ ¼
!
!
!
(
!
·½
!
·½
!!
(
¯
!
¼ ¼
'
¼ ¼
! !
!
¼ ¼
¼
·½ '
Additional Exercises 471
¯ ¼
¼
¼ ¼
¼ ¼
¼
½
"
#
#
0 $
0
0
0
0
0 $
0
0
0 $
0
#
0
0 $
0
0 $
0 0
0
0 $
0
0 $
0 0
Proof:
#
%&
'(!'
¼
#
·½ ·½ )
'(! !'!
"
472 Temporal Properties
·½
½ ·½
¼ ¼
¼
¼
·½ ¼ ¼
¼
! " #
·½
¼
¼
#
!
¼ ¼
$ ¼ ¼ ¼
¯ $ ¼
¼
¼ ¼
¼
!
¼
·½ ¼ ¼
$ ¼
¼
¼
¼
¼
Clock Cl
#
½
&
&
&
&
Æ
¼
¼
¼
474 Temporal Properties
¼
¼
¼
¼
¼ ¼
¼
Æ
¼
¼
¼
¼
¼ ¼
¼
¼
¼
¼
¼
Æ
¼
reflexive:
symmetric: ! ½
transitive: $
½
( ')*
½
$
'), +',
-
½
'), .
Æ
#
/0
')1
¼
¼ ¼
¼ ¼ ¼ ¼
Æ
¼ ¼ ¼ ¼
Æ
0 ¾ 0 0 0 ¾ 0 0
' $
& %
' $
& %
& %
& %
¾
Chapter 13
Exercise 13.1 (page 336)
coffeetrue
coffee
true
coffee
coffeefalse
coffee
false
coffee
false
!
"
#$
!"
false
% &coffee'true
coffee
true
(
coffee
( true
!
!"
true
) &coffee'false
coffee
false
* coffee
false "
!
coffeetrue
Exercise 13.2 (page 336)
true
+
+
+
478 Temporal Properties
tick
Cl
Cl
%
true
& true
)
true true
true
*
$
.
Proof: , ,
/ , 0
/ , 0
/ , 0
/ , 0
,
Exercise 13.7 (page 343)
Theorem 13.6: 1
pos
neg
Proof:
pos
neg
pos
neg
negtrue
false !
negtrue"
true !
true
false"
false
posfalse
false !
posfalse"
negfalse
true !
negfalse"
false !
true
false"
pos
neg !
pos"
! "
!
"
neg
pos !
neg"
! "
!
"
480 Temporal Properties
½ ¾
pos ½ ¾
pos pos ¾
½
pos ½ ¾
pos ½
pos ¾
½
¾
½ ¾
neg ½ ¾
neg ½ neg ¾
neg ½ ¾
½ ¾
pos ½ ¾
pos pos ¾
½
pos ½
¾
neg ½ ¾
neg ½ neg ¾
neg ½ ¾
neg ½
neg ¾
½
¾
½
¾
½ ¾
pos
Additional Exercises 481
pos
pos
pos
neg
neg
neg
neg
pos
pos
pos
pos
neg
neg
neg
neg
482 Temporal Properties
Proof:
true: negnegtrue negfalse true
½ ¾ :
neg neg ½
negneg ¾ ¾
½
½ ¾ :
negneg ½
negneg ¾ ¾
½
negneg
:
negneg neg neg negneg
negneg
:
negneg negneg negneg
) $
0 * 0
true false true true false
) true ½ ¾
+ true
, true
- false
. true
Chapter 14
Exercise 14.2 (page 360)
/
0 Sort
0 Sort
0
0 Sort
0
0
$
484 Temporal Properties
¾
¯
b2
k
!
ack snd
S
Receiver rcv out rack Receiver rerr rack Receiver
SortReceiver rcv rack rerr
rcv
!
"rcv# $
%
"rack#
"ack#
&
"rerr#
Medium snd rcv rack M err Medium
M ack Medium rerr rack M
snd
rcvrackM
Medium
errMedium
err
ack rcv
rerr
M rackM
rack
Additional Exercises 487
in
Sender snd S
Medium Medium
Receiver Receiver
err snd
ack
S
S
rcv rack M
M
err Medium
Receiver
Receiver
S S
rack M rack M
rack Receiver out rack Receiver
out
snd rcv
in ack
err
rack
rerr
out
Chapter 15
Proof:
true: V true States trueV
: V V
V
: V V
V
V
V
:
V V
V
V
V
V V
V
:
V
V V
V
V
V V
V
:
V
V
V
V
: V
V
V
V
%
&
:
V neg
V neg
States
V neg
States
V neg
States
V
V
:
Additional Exercises 491
States
V neg
States
V neg
States
V
V
Exercise 15.12 (page 399)
! " !
#
!
$
%
$
&
! !
!$
#
!
%
!
'
%
! ( ( ! !
Exercise 15.13 (page 401)
almost always holds along some path.
)
!
!
!
*
+
492 Temporal Properties
holds infinitely often along some path.
!
" #
Index
F
Æ
É
Ê
T 0
Æ
½
¬Ò
id
V
# (
#
2 4#
&
((
2."
2 (
! "# &
$% &
10# 2 (
& 2 (
# & ' # 0
( # 6#$
)*+) %
,
7
- 2
./ (
- &#
8 #
(
2
#
!$(
-# +,
# ""
$
$
$
%
!#
" .#
! "
#
%
% #
!
3"
# #
$
$
-* 4
-
%
%
#
% &
- "
!
!
! '#
! '#
#
(
-5
6
(
-
-
."
! )
&#
&
7
!((* #"
7
!#
+, -
7 84 #
! '#* .
7 &
7
! (
"
! /0 +" 1#
496 INDEX
6&
07 8
'
!"# $
&
/* ++
,
'
.0" , -
' +
-
&
, %*
-
1
-
30
,'< (
3
3
)
-
!
3
;-
"
)
#
/
$
%
&
'
/
$
'
#
-
'(
%
)
$
*'
mod
%,
)
$
(+
+,
)
,% -
)
3
-
'
.
//
-
)
#0#.
/
(
.- 1
, 2 3
) %
"
-
4 %
)
/
0,
,
/ 3 $
,
/
5
) (
%%
1
'
/ %
- #-
)
/
)
,'
"66
,
)
)
=
%%
1
-
>
%%'
/
1
,< ;
/
1#1.
/
7
)/
)
1#1.
#-
/
1
-
/
8
%
1
5
%
/
1,
(, 5
&
9 '
1
+
( (,(
1
5
)
3
(:(&
;
1
, < +,
)
3
&,
/ nil %
,
?
)
498 INDEX
(
$+ 5
&
nil
!" #
&
#
$
*
#
$$
&
+
#
+
(
, ,('
#
#
#
'
,-$
'
,
. /
(
*
&
,
0' 12
*
6' '
(' *
,'
(
,3
' 0
,3
'. 4
5$
#
*
-
5
+
INDEX 499
+
.
'* $ 0( 0 .
#( "9
Sort1 2 (
#(
500 INDEX
# '
# #
536 #
7&8 "
9 !$
7& , $
!
!
!
"
# $
$
%&
' "
$
"
!$
! !
"
()) )'
'' $
''
!
$
* # "
+
, )
, -
.# !$
/ $
0 $
, 1 2
, 3
, 1
, 4 !$