2013 Book ModellingComputingSystems PDF
2013 Book ModellingComputingSystems PDF
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
¼
¼
¼