You are on page 1of 507

Undergraduate Topics in Computer Science

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.

For further volumes:


www.springer.com/series/7592
Faron Moller r Georg Struth

Modelling
Computing Systems

Mathematics for Computer Science


Faron Moller Georg Struth
Department of Computer Science Dept. Computer Science
Swansea University University of Sheffield
Swansea, UK Sheffield, UK
Series editor
Ian Mackie
Advisory board
Samson Abramsky, University of Oxford, Oxford, UK
Karin Breitman, Pontifical Catholic University of Rio de Janeiro, Rio de Janeiro, Brazil
Chris Hankin, Imperial College London, London, UK
Dexter Kozen, Cornell University, Ithaca, USA
Andrew Pitts, University of Cambridge, Cambridge, UK
Hanne Riis Nielson, Technical University of Denmark, Kongens Lyngby, Denmark
Steven Skiena, Stony Brook University, Stony Brook, USA
Iain Stewart, University of Durham, Durham, UK

ISSN 1863-7310 Undergraduate Topics in Computer Science


ISBN 978-1-84800-321-7 ISBN 978-1-84800-322-4 (eBook)
DOI 10.1007/978-1-84800-322-4
Springer London Heidelberg New York Dordrecht

Library of Congress Control Number: 2013943907

© Springer-Verlag London 2013


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of
the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology
now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection
with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and
executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this pub-
lication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s
location, in its current version, and permission for use must always be obtained from Springer. Permis-
sions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable
to prosecution under the respective Copyright Law.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
While the advice and information in this book are believed to be true and accurate at the date of publica-
tion, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors
or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.

Printed on acid-free paper

Springer is part of Springer Science+Business Media (www.springer.com)


CONTENTS v

Contents
 
 

  
        
Preface xiii

0 Introduction 1
 
 
  
                  
    

                 
                            
 
  ! 
 "
            
 #   $ 

%
              
 &
'
                        (
( 
                          )
) *

+

 '                 )
  
, " 
, $    *              -
 
. , &

   /
.          

Part I: Mathematics for Computer Science 15


1 Propositional Logic 17
 '     0
                    1
 
#22
'    # 2               
 '    /$
                 
 *
2                           
 0 3                          
  3                          
 &                           
( 4%

                        )
) 
 '    # 2            )
1 '


 '



              1
-  

                       
 " 
2 5 '    # 2                
 $2
* #22
               
  $
                           
( 4%

 /  2
                
)  2
$ #5  # 2 4%

            )
1   

                      

2 Sets 57
 
 *                              )
 "
$
 , 4   &                  -
 
  ' 

                        (
 !
6 '                       (
vi CONTENTS

 
                         
 
                           
   
                        
 
                           
                          
                              
  
! 
 !   
           
 !! 
  !  
  !"              
 # !
$ 
%                         
 &$'
 ( )   !

                 
 ( $
 *+"
,  , "  !

            
 &!!

 *-
                        

3 Boolean Algebras and Circuits 87


 .  &$'                          
 
,
$ !


.  &$'             /
 0% "
1 

                       
 ( $
    ! 
$
 
"
                
 #2
$  "  &!!                      //
 .
1 3"'                      //
 &!!
$ .
1 3"'                  /
 ."
!
$ 4) &!!                    /
 ."
!
$ 5" &!!                    /
 "
$  & 0 $ %                  /
 &!!

 *-
                        /

4 Predicate Logic 109


 !
   ! 5 6
'                   /
 7"
8  ! . " ! 6
'                 
  
,  7"
8
                 
  *-

 7"
8
                
  . " !! 7"
8
                 
 9" )  7"
8
                      /
 # !
$
!
  ( $
                    
 &!!

 *-
                         

5 Proof Strategies 131


 & 5
 *-                          
  )   $
 )  

                 
  )   $
 )  3$
                  
  )   $
 )   :" 
 ! *+"
,         
  )   $
 )  
:" 
                 
  )   $
 )  7"
8                  
 
,  7"
8
                 
CONTENTS vii

 
                    
  

                          
   

                         

6 Functions 155
   
                             
 
! 
   "                    #
 $%& ' "                          
 $%&  ' (
)*
 + )
                    
 !(
, 
 ! - !(

%                   
   

                        

7 Relations 179
   
                             
  . /
                           0
 "      . /
                0
 &
     . /
                   0
 
&
                      0
 1 2
  ' /
                      0
 $%& ' /
                     00
 !(
%   / '
+ /
          0
 3&
 
 +  . /
                   #
 /
4
2
 1
4
2
/
             #
 ).%%
   .%%
 /
         
 !  2
/
                     
 
 ' /
                     
 2

/
                    
 2

$ 
  3                
   

                        

8 Inductive and Recursive Definitions 201


0 1  2
. 

 )
                      #
0 1  2
. 

 ).   )
                #
0  - 5  "%                         #
0 1  2
. 

  !.&
                  #
0 1  2
. 

 "                      
0 /
2
"                           
0 /
2
3

                        0
00   

                        #

9 Proofs by Induction 223


 $ 2  ' 6 1   2
2

             
  3% . )( 1   '%
             
 !(
1   '%
                    0
viii CONTENTS

 
                           

   
             
                         !
" #    $                 !
 # %&&  '                   
    (                 )
! *
  + *                    "
, -'(& 
   %(               
 # & -'                         

10 Games and Strategies 251


")"    +.. .%                 
")                                  )
")                              
") %(                                
") /'                                 
") 0 .
                               
")! # & -'                         !"

Part II: Modelling Computing Systems 277

11 Modelling Processes 279


""" 1&& $ 2                    ,"
"" %(                       ,!
"" # 1                       
""" $ &   0                      
"" #  '                         
""                         
"" %                              
""   0 0                 
"" -3 &2 0                      )
"" # & -'                         )

12 Distinguishing Between Processes 309


"" $ 0 & +                      )
" (  + -3 &                   "
" 0 & 4&                       "
" 0 & %&                        "
" $ 0 & + 4 5 $
2  02 6  
"" 7 &                       
" 7 & 0 & +               
" # & -'                         ,
CONTENTS ix

13 Logical Properties of Processes 333


  
 

 


                
      
                  
  
 !                        
  "    
#$
                 
%   
 &
'                 
 (
 )' *                      %+
, -! .' 
                         %
/    01

                       %

14 Concurrent Processes 357


 .  
                        %,
 ( 
                              +
 #2 $ (

                        
    01
                          %
    

                   %
 
 3
'                    /
%  

 $ .
'                    ,
    &                       ,
,    01

                       ,,

15 Temporal Properties 381


%  .  ' 4
              /
%  2
5                         /
%  

! 5                         /
%  6 5  6                        /
% # 
$ 
                       /%
% .$  # 
$ 07 
              /,
% )1   . 
                  //
%     8( 
                     9+
% 
 $

-
 )1  
               9
% 1'  )1  
              9
%% 01

  .  ' 4


           9,
%% 2
5                         9/
%% 

! 5                         9/
%% 6 5  6                        9/
% )  )1   
                 99
%,    01

                       +

Solutions to Exercises 405

Index 493
List of Figures

  
                   
                   

  !  " #                     $

  %&  '                     

 (
#

))                           $

$ 
  *                    +$
$ 
     
  ,-  ¿             +.
$ /
  0                  1
$ /
   
                1

1 2  '# 3                          

 &  4 & 50 #                  6


        ,♂- #    ,♀-          

. 7
                        $
. 8  #
0    #&                .
. 9#
   :                6

6                         +1


6 
                          $$
6   #                          $1
6  0 #   #&                     $
6+ 
 #                       $.
6$
 0 #   8&                 16
61  &  
               1

    
                        6
  !   #                 
  %(   ;:< :=:7 >##         $
  
  =78  $ # 1         
+                       .
$ (! #      
 
      .1
1 7                            .
xii LIST OF FIGURES

  
                     
                     
                            

 
                           
 
                          

 !           HML         


 "         HML            #

$   %                        


$ &   ' 
                        
$  (
                        $

# "        )( ) )           


# *     #                  $
# *                       $
#$  +!   ,    -   .        $
##  +!    ( /                $
#  +!                        $
#     (
                  $
Preface

  
    
  
  
  
   
  
    
 

           


   

             


 

                 

                   

            !   "

      !     "


# $  

       %&   %&    ' 

          (       

  $            $   $

        

)              * 

     +         ( 


,  

             
       
         + 

    *      $    $   -  

                

     
          . 

           .    

                 

                 

%  


&

 $              

             

                 

                 $  

      


     $  #  

'                  

                / 

   $  #   '          

           


)     

             
,

            / 0 %   
xiv Preface

 
   
        



    
   
        
 
 
  

        
  

      
   
    
       
     
 ! "  
   #$$%


 
    
    

&
      
 ' 
        

                
  (  " 
 

 
     
  

   
  )
 
  
  
*  " 
+
               " 
   
          

 &
      
 
  
  
  
     
   
,  
   
  
 -  
  
 
      -   
   

   
 
   
  
   
     
  

     , 
         


    


  
  
  
       
     
    
      
   

 
   !  
  
   
 
 
 
    &
      
   

       
(  
  
,  
 
  
  !   
 


       
    

    
   .      /
  
   ,  
    


(  ! 
 
    
      


     

    

     



  
           


    &

   
 ,   
  

 
    )  
  
 ! 
   
  
     


  
0     
  

 
    
  

,  )    
   1 /    

 
  
  '   .    

    
 &
      
    
     

 ,        
 
     
 

     
  
 
!

  Æ   
      

    

 2     
   



 

 
 
      
 
)

1 //    ) -     -    
Preface xv

  
            
    
     
      
       
   

   
          
      
      
           
                 !

" #
         " ##
  
 $   
 
%  & 

'
      " #        
        
  


 
  
 " ##   

(
    
       
    
          )      
      %           
        #
  $
         
                     

    
                

      &
   
       
   $                * 
            

      
     

(
               $ "
 


 
     (
           
 
$              
     
             (

 $              ++   
   

      $             )

   
      
 
 

               !    
   
$    

 %   ,

#               


 $&
  
     
             


       

     -
    
                   

  
   

   (
      
    


     
   
  

         
   #
  
 

   
          

   

           
     
   
 

           #
   . 
    
     

          
    
     
xvi Preface

      
               
       
         
 
              
      

 Specification                


  
                
            

 Implementation Synthesis         



                   
            

 Verification                



                 !
        
   
      
  

              "   #  


                
   
                      
            "   #   !
       $   
      %    

                

   
 &&              
 
                  
 &&
                     

                 
!           
     '                 
                     
    
(                  

    ! )  (     " (   
*  
  
        

 
    +       
   ,   -
.                  /
     

0  (  %  " 
"  " Æ
Chapter 0

Introduction
    
     

  



   
         

 


     


       

    
     
 

 

 



  
     
    


   
        
 
   

  
  
  
 
   
  
     


     
  

       


   
 !

 "  
   #  
 
    

  
 
 $
 
 %   %    




  &  


  
 
  



   
 
  


 
 
  

  
 
  
 
  
 


 
   
 
  
  ' (


      ) 


   
*

  
 
   
    

  


 +
 
  
     ' (


,
 
        
   

 -    



     
 
    


      


         
   


   .  /  
     

 
  
  
 
 
   (

  


    

    
 

             


 

   


  

   
 
 
Æ 

 0

      


 +
 1   
   

     %          

   (
  
  
    
   

           


 


F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_1, © Springer-Verlag London 2013
2 Introduction

   


    
     
 


            


    
 

     
          
  
     

   
    
            


 

     

    

  
 

   
  
       
      

       
          


  

     
       
  

 
    
 
     
   


     


    
     
 

  !


    
        


 

"   


  
  Æ 
 #
 


           $ 


   

 

          




     
 
    $    


 
   %    

        

 
              


  
   % 

"   
  

 



        

     
   
 
       


     
   
  
 
  


           



      

  
            
      

   

     &
      
%
 

   


  

  
     

 

0.1 Examples of System Failures


"
        

     
  
 

       


    
  
    



      
     

  
   


          
   


 
 
    '      ( 

      
 
  

 
      



 
 
 
 

0.1.1 Clayton Tunnel Accident


)         

      



  
              *   
Examples of System Failures 3

  
   
         
          
     

   
                    
 
           
   
     
            
       Æ 
        
          
     
 
    
  
         
                
      

             
            !        
    
            

         "           #
"      
   $    
 %   & 
   "        
             
    
'      $   (
         )*
+ ,-.,                  
  
    )/    0  ,1.
       
     '    

      
 
           
                      
   #    
        
                    

                  
                  
                      
     
2      3       $    

         


 '    #
 
      -!4* -!,*  -!/4   5 

 " 
                
    6   '  7 6            
     "      
       
8  -!)- -!/,  -!/*    # " 
    
                6  (  9  
6               6  
   $
6      (
         
3          
           
                     
     
     :        0  

        5 
 
      
 


          : 


4 Introduction

 
   
   
   



 
 
   

   
 
 
     
 

     
   
 
 
      
    

 
     
 
   
 




       
 
 
    
 
      
       
 ! "
  !
 
     #


 
 "    



   
      
   "
 

 $ 
 
      


   
 
    %     
   
 !  

 &
 '
 
   "     
 

  "   "
 
   
  "
 "

      
      

  
      
   





  

 
"
 

"
  


 
  
  
 
  



 
 (      
   
 
 '
 

    
  
       
 "
   

    
    ) 
 
  
    *
 +, 
  - ' .       


 
   


  /  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.1.4 London Ambulance Service


% ;
*.. 
  $
"

 
 


  !$=) 
 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

  
 Ü   Ý       

          
! " # $
%

! &" " '  


  '!(  )*!   +! , - *
0.1.6 Ariane 5
. / !     0 %  1   


-  -2 !

 )!      3   -2     4 -   5
  )
-  % 
%+ 4 .
%+ - 6          -2 
  -       "    -   76 %-   
     -2   

   

 

" 0   %   -2  - 

 76  %  -    !
    0   !     -       

- - 

  88
   -   -2 9 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*

0.1.7 Needham-Schroeder Protocol


?  - -     .   !   6  -   -  
     6  !       -
6 -6 6  
%      6   6  ! - 6  -  -    
!  

6      -  % 6    -   -6     "
8 Introduction

 


    

     

    
      
   
  
      
 
 


 
  
           

 


       
 !"#   
    
 
  
  $   
%     
& 
  
                 

 
 
              
    
   


' 
            
   "
      
        
(               
    
 "      
    

&    
        
) 
     &         
          
    
 &    
* 
   &     +    


 
  
     
    
       
            ,-

   
 
&     


    
  

 
   
             
       .     
 

   

          & 


  
   '/01    '2      
          3        
        

    
 4 
     
&    '//2       
 
                

      
  
       
          .     
'    -       
     

     & 


       
(       
&       "
      & 
        
)    
&           
 
& 
            
 
 

5 
     &      &    
   & 
         
System, Model, Abstraction and Notation 9

  
          
 
      

              


      
      
          
                  
             

    
     
            
   
    
  
  
  
     
   
       
  
          

       
   
     
 
      
     !"   # $
%     &  '    
  
    (
 
     )!*+  ,*, ,*) & ,-- +

.      


 /    
       
 
/   
        
      Æ
     0   
  
   

/      
       

    1             
 2    
         .  
   
          

  
 
 
   /    


                
   3             
 
     
     

       
          
  .   
         
 
     
               
            '  1
      4    
  
     
                5 
 
6  
  
       

0.2 System, Model, Abstraction and Notation

   % ( % ( %  (  %(   


    .         
     6
          /  

10 Introduction

System
  

         


  

   
  
 
    
 



     


   
  



  
       
 
 

 
    

 
 


  

 
      
  
  

 
  

  
     
  


  
     
     



  
  
     
  
  
    
!  
      
"
    
  
   

 
    
     !
# 
$    
    
  % 

   

 
  
     
 


  
 
 % 
  
     
  

  
     %  


     $ 

    
 
             

  


           

 
  
 
" 

!        


    
 &
 '    

  ( 

  

 
    !
    


 
  

 ) 

    


   
        
  


 

    * 
    

!  
  

Model
+,-  

        
 


 
   
  . +/- $

  
 
       



    


 

 

  
     


   

   
  
0 
   

       
$   
 
    !  
 

   
        
   
  

     
   

System, Model, Abstraction and Notation 11

   


           

               
          
       
  

             
                

                
      
   
      
       
    
                   
 
 
             
 Æ                
    
      
                 !
  
      "  
   
 
 
    

¯ 
         
  

     
        
 
              
      #$%     

¯ 
          
 
     
 &     '          
        
       
                  
 
           
  #(% 
   

)                  


           
      
         
         

    *               

                   
   '         
   
 
       

Abstraction
    

          

    +     

,         
    -   
  

    
             

               


 
12 Introduction

   
    
      
      
  

     
 
 
    
  

     

     
!      
  
   
  


 
     "

  #

  $

      %&' (((

 )
   *
 + !,   
    

  
  

 
            
          
    - . $ 

% 
   
   !&  
  !&&  


       /


  
     
  
 
 0  
    

  

  
    
/ 1

 2
   
3       4

  
    
 
    5

 / 6
3        !78,  # 
#   
     
   
   
  
  
 1

   


    / 2

 
 
  
  
   
   9 

    !78!  :         4

   
   
 
   
 
   
;
   %4  /   
  
  4

    <  
 
     
    
   
  
 
   
 

  =   4
      
   

   /  

 
. 

  
  
   
 
   

      
      

 

   



5  
   
    
     
   

    
   
 
      
   

  
Notation
     
  

    4

    
  
 0    >4
    *    
6      
      
   >  

 

-
 
 

 
     
   9 
   


     
 
    

 
 
 
  
     
   
    

"
 ?@
. 
4
    

  


 !7'(4!7'7 
 
   6 
  
 
Specification, Implementation and Verification 13

 
   
           
  

 
    
       
  

     

  
  
  


   
 
           
  ! 
 
  
 

  !  " 
#   

 
  

     
   $
 %   

 &  
      
  
              
   

0.3 Specification, Implementation and Verification


"  
  



 
      
 
 #  '    

 
    


 !  
  "
      (  
          

  
  
 


 

 


) Specification   
   

  
 

    
   
  "     


 
   

 
 


* Implementation   
   

    '


     
  
  "     

 
 #

 
  
 
    '

+ Verification   
   


  
      

 
      '
 "   
 

   

    
 
 
  

 '

"  

  
  
      
  
 
   
       
 

    
  
 
 
   



    
 ,  
 
  
   

                  

 
 
  
   
  

 
  
          

-
    

 
   
 
 


 


    
  

 
' 
  
  
      "  

   
&       



 
         
   


 
   
     


 
14 Introduction


   


 
      
 
 
  
  
   
        
   
   
 
         

  

          
   
   

  
   !      
     

 
Part I

Mathematics for
Computer Science
Chapter 1

Propositional Logic

  
          
  

               

     !  "  #     

  #  "           $ "   $ 

%  "       !    &  ' " 

     "            (  

   "   )!         $  

%       &   


%      "  

  %!  &     !     "#  

  "      # ) %          

" *  !        +  ! ,  -  

     %  (   ( ! " & - 

   

.   !          *     

   %                  "   "  

  "    !    %     &  

%        %   )  ( "    

"         %   &   %  /) 
"    ( %     "     " ! %  
%   0

          "        


       "         

"          " 1%        

      %%   %% "        

  " $     " %   "   %

       "        "  

  (    " $         

 !     "      . %    " 


     "      " "

    %      "      "   

                   

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_2, © Springer-Verlag London 2013
18 Propositional Logic

  
          
  


       
          
 

                

  
 
   
       
 

                      

     


 
 
       

  
              
  

  
          

                    

     
           
   
  

  
      
 !      


    "          

     #       


   

           


     
   


               "
 

    
 
    
       


 

1.1 Propositions and Deductions


$
      

% Either this man is dead or my watch has stopped.


& My watch is still ticking.
Therefore
' This man is dead.
            (   )

      
               

       

"         statements   propositions   


 
             (   )

*           


  
  

  #                 +

   

% This man is dead.


or
% My watch has stopped.

$ " deduction  inference  


        

          #        


  +

   
   conclusion         # 
Propositions and Deductions 19

    
   
     

 

  
 premises   
 

 
    
   
      

 
  
   
    
   
    
    
   
  
    

            

    
  atomic propositions 
  This man
is dead     

 
     
  
propositional connectives    or        

  

      
  
    

   
   
    
    

 
       
  
 
 

Example 1.1

   
  
   !   "
 #  $%

  $&' 
    
         
 (    

(    
         
(   )    *  (  
 


  
  +

 +
 
 
(  +    
( 
 


  +
   (   ,


-  
 
     


(    *

   (   
 . 
  
(  +   
 

/ #     


(  
 *

  
 
    
(    . 
  
         (   
(  + . 
    +
    (      +
 

   +
       
  (
  

    0   

     
  


 
     

          )
 
   

    
  

1
  
  
   
 
       ( 

 
           )
      

 
       +   (    

+   (     
     
 

                
       

   

          

 
 
 
(     
20 Propositional Logic

Exercise 1.1 (Solution on page 405)

    
      
 
 
   
 ! " #
$ " %% & %  
 
 '    ( 
 ) 
*   ) +     
,           
-       !  ! .  %
  
     / !    !  .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

   
 
       
   
 

       

        
       
  
   
 


Exercise 1.3 (Solution on page 406)

  


 
  

! " 


# 

 

  " 


$ " 


" 
 
 %# 

 
&
  " 


' " 


" 
 
 %# 

 
&
 


 

( " 


" 
 
 %# 

 
&
   


 

) " 


#   
 
 %# 

 
&
  " 



1.2 The Language of Propositional Logic


 syntax    
   
  

*
 object language 
      
meta-
language + 



   
 +    
  


    
  


    
 ,
 
 
 *


  
 -     
  


*        
   
   
. 
      *  
 sym-
bols 


      *     ,
 formulæ      -   
 
       

  
  
  -             

22 Propositional Logic

1.2.1 Propositional Variables


 

        
    


     
       
   
  
  

   
           
¾
         
        
  ! "  
 
   
     
     
 
     #    
  #              
               

$         %
    
  
    

   Propositional
variables             

      & 
    
$  ' 
    
(
 '!#)             

  
 # *

   
 
  
 
 &   ' 
  (
 Dead    +
     ) ,-

     


  




   
  
  
     
 
     
  .

 
 ,
  
     
.
            ,.  
, . 

  , .   ,.  

    
     propositional connectives  &/
  

 () , . () , . ( ) , . (       ) ,.  (    



    ) ,. 0 
       


      

  

1.2.2 Negation
 negation       ( )   
      
   
   

 '  1

    

  +

   
            
 
          
         
  
   

Example 1.3

 Dead       (      )  Dead   ( 


            )  

 (    
The Language of Propositional Logic 23

 

  


 
       
  

            


 

          
 
  
 

Exercise 1.4 (Solution on page 406)

   

     
 
    
    
 
  
! "
       
 
# $! % !  &'

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       
    
                  

             
   
           

        
          
        
   
       
      
  
     
    
               
  

  

Exercise 1.5 (Solution on page 406)


  !    
  "

# $%  &' $%  ('
& $(  )' $*  ('
% $(  +' $+  ,'

-      
$    
'       
                  
                   
                  
                   
                .  
   /      
    0    1    

       2   
  $  '    
    3            2   
      
    
  
       

  3       
      -     

      
  4 
   3     
 1        
   $ 51  ##6
  &7'

Exercise 1.6 (Solution on page 406)

8   

  !         
           1    
 ! 

# 9        :    3   


  8 1     ;    
&       2
% <      2 
The Language of Propositional Logic 25

1.2.4 Conjunction
 conjunction     
       
  
              
              
   
   
  
  
                
      conjuncts 
Example 1.6

 Dead      


   
   Watch   
  
  !        Dead Watch    

  
        "   #    

   
  $
%                 
  
                
    
 

Exercise 1.7 (Solution on page 407)

&           '


( )*  +, )*  -,
+ )-  ., )/  -,
* )-  0, )0  1,

1.2.5 Implication
2    
    implication      

    
               3
       
           
                 
        
    
    
   
 
  
26 Propositional Logic

¯   
¯  
Æ      

¯  
 
    

    




    
      premise 

      conclusion 

Example 1.7

  


  SignalDanger       
 
    
  TrainStop       

   SignalDanger  TrainStop       

     
  
   
 
 
      
   

     
            
  
        
    

Exercise 1.8 (Solution on page 407)


 JoelHappy   
    AmandaHappy  
 
       
      

JoelHappy  AmandaHappy   AmandaHappy  JoelHappy  !



  

" 
    
  

# 
    

  

$ 
     
   

Exercise 1.9 (Solution on page 407)

%     


  
   
 
  


&

  
   
    
 

'   
 
  
  (
The Language of Propositional Logic 27

1.2.6 Equivalence
 equivalence Ô ¸ Õ    
  Ô Õ    Ô 
   Õ   
          Ô Õ  
  Ô Õ        Ô Õ    
    
               
¯Ô     Õ

¯Ô     Õ

¯Ô      Æ      Õ


 
     ¸      
  
 µ  !
        
       
        Ô ¸ Õ       Ô µ Õ Ô ´ Õ
"   Õ µ Ô#   
Example 1.9

$     TrainEnter     


        
        TunnelClear     
     
    TrainEnter ¸ TunnelClear      
     
              
  
                  
                  

1.2.7 The Syntax of Propositional Logic


%   

         


  
 &   '  
       
  propositional formula  
¯ atomic formula           È É
 Ê 
¯ compound formula            
     

  ( ))


     
   
* true "   
     # false "    
     #
  &   
 syntax        

*  
      

    !
        ( ))       well-
formed formula "wff #
+    ( )) "        # 
 Ô Õ           metavariables
      
28 Propositional Logic

 Ô  Õ   
    
    

true  

false 

È     

Ô  Ô  

ÔÕ Ô  Õ   

ÔÕ Ô  Õ  

ÔÕ  Ô  Õ   

ÔÕ Ô   
 Õ   

         


  

1.2.8 Parentheses and Precedences



   
  

      





    !   
"  
 


 #
  $
 

 
% $     
         ! & 



  
     
"      % 
 ' 
    
   "   
( 
$

"  #   

  (         
) (    

    


 
 $
 %     ! & * +   %     
  

   
      ! &  
          %  % 
& 

"  
 $ $            & !   & 
 
  (        % , 
   

  
 
    
         
 
        È  É  Ê  "    
È  É  Ê 

È  É  Ê 

          

  
 " ( %
  ,

 
  -
 

   .     $        



 


"  
) (       

    
 
" $
    %      "     %     
"     %      "     %   /
  
    (
 "     $ $  
    
 

    

Ô  Õ  Ö  ×

   "    

The Language of Propositional Logic 29

     
  

    
 
  

     
      
     

 
 
 
  
   
 
   

   


    


        
 
 

         

 




 
 
              

     
   

    


Example 1.10

! 
    "    #   
 $     
 
 
     
     $     % 
 


    
   
      
 
     
  & 
  '
   (

 )   
  % 
 

 )    
*    
     
     
   
 
    
 
    
  
+      '
  

 )        
             ,        
               

Exercise 1.10 (Solution on page 407)

-    




  
 

      



 

. / 0102 

         
 
   
   

   

3 / 04 

         
 
 
  
 
   

5 /     


          
 
   
 
         
       &
  (
               
30 Propositional Logic

1.2.9 Syntax Trees


   
     

      
     syntax tree         
             
   
 È É  È  É  
     



È É 
È É
!    
   È É  È  É     


                
  
        

 È  É 

    

   "
 # È  É 

   "     $  
È É   $   È  É
 # È  É  

          È  É
 # È É  È  É 

   "    

  È É  È  É
!  
            
 
              
!          
    

    
 
        
 
    %    
   
&     
  È É  È  É   
 
  &    

Example 1.11

'   


  È  É Ê  É (   

    
     


È 
É
 Ê
É
The Language of Propositional Logic 31

   
               

          
      
  
 È
É  Ê      É       
      
    É  Ê         

   
   É  Ê  É    

  È   É  Ê  É 
           
!!   
"

     
    

È  É Ê É 

Example 1.12

#     
  È  É    

!   


 #       
       
  "   $$
  

 È  É   

  È  É   


 È  É   

  È  É   
%

 È    
  
     

 É   

  É   
%

 É    
  
     

 & 
 
         
  

   
      


 #   È  É    

! 


Exercise 1.12 (Solution on page 407)

     

   

! 
%' (    

!

    
               !
       

$  È  É  É  È 
) È  É  È 
* È  É  È 

+ È  É   Ê Ë 
 
, È  É  Ê  È  É  È  Ê 
32 Propositional Logic

1.3 Modelling with Propositional Logic




       

 

    
    
 
     
 
       
            


     

       



Example 1.13

   
        


  
...
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  
"   

       
  


 


    
    
   
 
    

  


#       

&     '

  
      & 
 
$Pressure  Height%  Land
Modelling with Propositional Logic 33

  


               
                  
      
  

       
              

Example 1.14

                     


!    !

" 
 

        !     
 
 

        !     
¯           !     
     !
¯           !    
      !
                 !
     !
                  
!    !
                 !
     !
             !   
       !
          # $% &    
 '        
      
           (
       
          !          
 )      "  *   $+,%'$+-+ '
    "        
      

..   !          
     
  )

Exercise 1.14 (Solution on page 408)

"       /&  0     1    '


   
 
$ & 
      
  
34 Propositional Logic

Æ   
   

     

     
    

   
     

      
    

    
        

 
         

             


  !""  #   
$ % &   # "  
'         
(     #     
) *     #    
+,  - .  "  

Exercise 1.15 (Solution on page 410)

/          "  +,    0
        #

 RightToCastleLeft 1 RightToCastleRight

2 #             1  


 MayCastleLeft 1 MayCastleRight

2      #        1  


 KingMoved
/   #"
 LeftRookMoved 1 RightRookMoved

/  1    #"


 PieceBetweenLeft 1 PieceBetweenRight

/        "      1  


 KingAttack
/   "  
Ambiguities of Natural Languages 35

¯ LeftSquareAttack RightSquareAttack
 
  
     

¯ KingMoveLeftAttack KingMoveRightAttack
 
   
     


       



 
      


     
  

Exercise 1.16 (Solution on page 410)

      !
" #        
  
  
  
      
        
 
          
       
      
  #   $   $   
 
            
     


          %      

        


& '" 
    
   
        
        
         

  
      (    
    "
  
 
JonF )Joel*     $  

JonO )Joel*   !
$  

FonJ )Felix*     $  

FonO )Felix*   !
$  

OonJ )Oskar*     $  

OonF )Oskar*     $  


+ %  #     $  
  )Oskar* 
    
(  
  "      
    

    


1.4 Ambiguities of Natural Languages


,  
       
       # 
    - 
 &&.
 
     

  /
"
        
 
 
   
  
    -  0         



Æ         
  
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.”

#    


   
      
 
 
,       , -     

Ambiguities of Natural Languages 37

 
      
       
 
  
   
    
   
    
 
 
   
        
     
   
      
    
   


     !
   
    
  
 "  

 "   !

“You may have coffee with your meal


and you may have tea with your meal.”
#
      
    

  
       
 
 
 !
  
          !
    

 
“You may have coffee with your meal
and you may have tea with your meal,
but not both.”
$   % 


   !    
  


    
      
 ! 
    

& You may have coffee with your meal


 & You may have tea with your meal


    

' ( '  (
#
    !
 !     
 !  
!  )*  +
     '
  (    

         
 

      

 ,

 
   ! modality 
  may
    

   do
            
 !
   
 
   !  
    
  
 ! 
    

 & You have coffee with your meal


 & You have tea with your meal


      
     
   
 !
       
     
'- (  

38 Propositional Logic

    
“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

% 

   &     
   


 


   


         $  
  
  
      
  ! ' $ 

   ( 


    
  )   * $     
 


+

“If Carlos is a man, then Carlos is the King of Spain.”

,  $    
  
 +

“If Carlos is a woman, then Carlos is the King of Spain.”

-   
    
     
      
 
     

   

 
    #



 %
      
      
  

$ 
   
   
 
+
Ambiguities of Natural Languages 39

“If Carlos is a woman, then Carlos is the Queen of Spain.”


    
    

   
   
 
   
  
       
             
   


   
     
    
    
“If I told you once, I told you a hundred times!”
                
 
               
   
           
           
         
!  
    
“If he ever pays me back, then I’ll be a monkey’s uncle!”

             



        "     
  
    
  ! #  
             
  
    
   

Example 1.19

$  

        
“If you understand implication, then you will pass the exam.”

 
 
 
   

% $   
           & 

    
      

' $    
          
!     
      
   
   

     ( 
   
  )           
    

         
      

      
      
 
 

* $    
          

     
      
   
 
    
 

  +    

, $  -     
         
    #       
  
 


             . 
 


         


        

    
40 Propositional Logic

 
  

  

 

    

  
     
 
 
 
  


Exercise 1.19 (Solution on page 411)

 
     
     

     

    
       

 
  
    
 
 
   
  
  
   

  

 
  

  

  
  ! 




"

Exercise 1.20 (Solution on page 411)


   
     
   # "

1.5 Truth Tables


$
   

  
    %
 

 
    &  
  
  

    '

  
  
  
%
 
   

   
   
    # 
(     
     
 
 




     
    


 

   
 

 

 )
 


 
     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
& % & %

        


    

      
  
Example 1.20

   


       
!
“Everyone who sits quietly for the next hour
will get an ice cream when we stop for petrol.”

"   


       
Quiet # You sit quietly
Ice # You get an ice cream

$      
           
Quiet  Ice % 
  &          %   

    !
' $
Quiet Ice Quiet  Ice
F F T
F T T
T F F
T T T
& %
 ÓÒÐÝ            
 

Quiet     Ice 
 %   
        
42 Propositional Logic

 
              
                  
      
                 
                
                    
                  

                
             
    
         
          
             
 
!               
   
 "      
    

                   
      #$

Exercise 1.21 (Solution on page 411)

%     &' (()       *


“If you understand implication, then you will pass the exam.”

!              


          

Example 1.21

+                  


  ,  ,           ,  , 
  #               
-       
Cat . Catherine goes to the party
Jim . Jim goes to the party
Jules . Jules goes to the party
+ #         
Cat  Jim  Jules 
!      +         , 
,  #       /       
                    
    Cat Jim  Jules          
   0      !     
   
Truth Tables 43

' $
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
& %

  


   
      


                Cat Jim  Jules  

               
   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) ´¿µ ´½µ ´¾µ ´½µ
& %
        
     
   
  

    %

&    


        '   

            
     Cat Jim  Jules
( 
                 
   
44 Propositional Logic

  
     Jim Jules

     

     

         Jim Jules



      

   
 

 
      Cat   Jim Jules

    
  
     

 
  
   
   

 
  

Exercise 1.22 (Solution on page 412)

!     
   
   
 
    



 È " É" Ê  Ë # $ 
       

 
 #
$ 
    Ò  

 
 #

Exercise 1.23 (Solution on page 412)

%            


  

 

&  È  É
 È É  È É
 È É  Ê  Ë 

Exercise 1.24 (Solution on page 413)

  '( 
 ) 
 Ô  Õ      
  *
' $
Ô Õ ÔÕ
F F F
F T T
T F T
T T F
& %

 
" Ô  Õ

"  
"   Ô  Õ
     

 
%           
 ( &&+  ,   (-

 Ô  Õ
  

  

     
Equivalences and Valid Arguments 45

1.6 Equivalences and Valid Arguments


    
 

        



 

 
   
       
  
Cat  Jim  Jules  Cat     Jim
 Jules

    !
 
    
Cat  Jim  Jules Cat Jim
 Jules 

  
  
Cat  Jim  Jules   Cat Jim  Jules  


" 
       #     
   
                
    
 
  
 
  
 


 
    
           
  

    
 
 $     


    
   logically equivalent 
 

 

           
  




   tautology    


 
   valid  
contradiction    
  

 

     
    
  
 

 
 
   unsatisfiable 
 

 

    
 
 
  
 %


 & 
  
     

 &
 
   satisfiable 
Example 1.24

         


     
        

    

 "       
 '
 !  
 
(      
        #
   
         
F T T F T F
T F T T F F
   

  
       
    ( 
    
 
   
   
       
   ( 
 
  
    


)  
  *  +        


   +         
46 Propositional Logic

  
   

      

Exercise 1.25 (Solution on page 413)

   
  

         


      

     

     
          
        

      

!     

"            


 #       $

 %   %  &    '    ()

 Either this man is dead or my watch has stopped.


 My watch is still ticking.
Therefore
 This man is dead.

"
    # 
  * 
     


  %
 %
        # )

 Dead Watch  Watch  Dead

+ %
 

         %
   $


 
#        ,     &


       
 
    )

' $
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
& %

-    %   
        .  /)

 If my dog barks, then my dog doesn’t bite.


 My dog doesn’t bark.
Therefore
 My dog bites.
Algebraic Laws for Logical Equivalences 47

 


   
   
' $
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
  

    

Exercise 1.26 (Solution on page 414)

!" ##$        
    

%

  
 

 & Pressure  Land  Height  Land


'    
    


   
       

& Pressure  Height  Land(


 & Pressure  Height  Land

)    



   
     
   
%

   
 *
    

   !" 

  
 


 
     

 

1.7 Algebraic Laws for Logical Equivalences


+
       
  

   
 
 

   *
   *
    
 ,   
 
 
       
 *
    
  
     
 

- "   
     $  ./0 & 12
  

 

$  . / 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

Excluded Middle Laws


   true    false

Absorption Laws
  
! "    
! " 

Implication Law
    
Algebraic Laws for Logical Equivalences 49

Contrapositive Law
     
Equivalence Law
     
 

  
 
        
    

 
    
  
 
 
 
     
 
       
   
             
  
 
!

      

  
   

   
  

     

" 
  
  
   #   
$  % 
  

&     
    ' 
   
' 
 

     


   
 (
  

Example 1.26

)     '          


     

' 

!

            
     

true       

    true

   

 



)  '  
  
 '      
  

   
    true

Example 1.27

)  
      
  
   
 
!
50 Propositional Logic

     
      


      
   

  true   

   true 
    
  

 true 



  
 
   
    
   
  
   
      
       


 
 
   

   

     
      


  true   

 true 



Exercise 1.27 (Solution on page 415)



  





!          
"          
#           
$              
%             
&             

1.8 Additional Exercises


! '  
 


(

 )!*    



+
 ),

 
  
 - +
 ). 

   

   
+
 )
 

(+
Additional Exercises 51

   
 

 
 
    
 
     



    


 
  


 !


 
 




 


" 

 
 


 !


 
 


# 
  


" $ 
  
 


 % 
 
% 
 
"  
 
   



"
   & 



 

 % 
  
 
"   & 
  
   & 

' #
    
  %( )  ** 

+

   
   
   
    
        
    
 
 
   Æ      

, -
 
  *    ** 

+ . 
**& 

 
/*
+ . 
 
*      
**
+ . 
**     




 "
 
   
  ** 
 

½ + . 
**     



 



 /*
  
  
*   
**&
 *
¾ + . 
**      

   

 

/*    
 
*   
**& 
*

 )     


 0     *
    

    
**

1 2 
 
 
     
 3   

    4 5       

   4
52 Propositional Logic

   
   
   
      

              
 
      
  
     
  
     
         
      

   
  
 !     "      
 # 
   
        
   
   
   "   
 
 #
    $
    
     
 
  

 #
    $
   
     
 
  


% &  CatAway   


'  !   MicePlay   

'     
        
 
 

 '        
  ! 
 '          ! 
 '          !  

( )      



         
      
 
 
 $
   
  
 
  

  
 









    *

“Every card with a circle on one side


always has stripes on the other side.”
  
       
 
 

  
   
   
 +

'  
   "   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  
  ! 
 

  &


)   < 


 
 &  
54 Propositional Logic


  
  

 
 
  
  

 



 
 


 

  

 
  

      

 
  
     

 


   
 


   

  
 

 
  

    
 

    

         
   
 
             

   
 
         ! 
"




#$ %    


  
 &

  '   

  (
   

 '   

 )
   

 (
   

  (
   

#*  


   ++      

'  ,

     


  ! -

       
   
!  
   .

  

 

/   
 

  
    


 
       
  0
 
  


 
    0

 
    
 0
   
1  "


   
 1  0
 
  ' 
   

2
 
        .  

   ,
 
 
   

   
 
 

 30 


1
 
 

  1


1  

  


   !       !  

   ) 4 1 



 
Additional Exercises 55

  
 
 

 

     
 


 
 
 
  
  

 


  
 

   
  

  
 

   




 


 
!  " 
 
   
!

 
#

 
 $ 

 
 
 
 
  
%




&
 ' (   
) (  
*
% )

+, -
 
  .&
!
  "
! +/0


! %
   %
0  %
 
  
  ! 


  %

 



+1 -
 
    ! 
&
!


 
%           
!           
         

       
   
      

            
           
         
        
Chapter 2

Sets
  
        
  

              

                

            

             !  "

              

   

#      $     

%    &  '   % &  % (&  
% &  % &  % &  % & 
 %  & #          
                

           ' 

2.1 Set Notation


) set    *         # *

           elements  


members #   *       cardinality 
                

              

         


   '

  false true +
 ,  - ./ +

     +

  0 1
 2  )  

  ) 3  4 5   6  !  +

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_3, © Springer-Verlag London 2013
58 Sets

    

   

  
      
 
        
        
       
     
     

    

   
    ! "   

    
#
¯ $  %
    &&    
          '
         
   
   '
   % ( $$ $ $(
           
  

  


          

 )  *
 
   +     + 
      
   , -   +    
  
 
 
 
  

  
     
    
 .    
      ) 
  $(  $ /     '    

 )   0  1 2
            

       


 3
  
    
             
  
   4  
  

        

 
set-builder notation #

 #      

           
  5       3 

   6           


  
 

Example 2.1

 

   

 
   #
$  

   

    0 / 


#
 #       0 / 
 


  

   


  
 1 7
#
# 
 1 7
 

  

   

  #

#
     
  

   

   
       #
#     
        
Membership, Equality and Inclusion 59

     


         
                      
             
  
              
               
   
      

! " 
    


 ! " # $      


  $ # " ! " # $    

  

% 
   !      


  %      
     


&        '          

             


   
 
          
(                  

                      


       
Exercise 2.1 (Solution on page 416)

)      


        
 
"  %      !
     * 
#  %              
 

$  %     +  ,--- 
 

.  %    /  0   Æ      


 

2.2 Membership, Equality and Inclusion


(         
       1
       2       Membership
 

    
       
  
 
  
3   $ 3 ".  4 3       $ 3 ".  5

60 Sets

   
 

             

            
       


    
 !

"         !

Exercise 2.2 (Solution on page 416)

# $    %  &   %    &$


 & !

!  '    %   ( )     )   *  !


)!  '    %  ) (      )   *  !

Exercise 2.3 (Solution on page 416)

#&     %      $+

! )   )  !
)!  )    )  !
!  )       )      !
!   !
*!    !

,&   -        equal  


    .    ! ,   $     
    &  $      $    $    &
   /  ! "$    

     (       


  
  (
   
   !

0  $           1  $Æ&  - 


   &2         &      !

Exercise 2.4 (Solution on page 416)

#&     %   3$ +


Membership, Equality and Inclusion 61

¯      
     
     
       
       

  
subset
     
   
 

     

       
 
 

   
     
  
superset   
    
     
          

  
   
 
   
   

  
       !
     

 
   
     
"    
          
  

  
    
     
    #
         

 $   % & 
   


     
       
Example 2.4

"

  
     
    
     


   

  
       
 
     
 
 
   
 

 
     
 !







"   
 
 
    
  
 
   
 '
        '
 Venn diagrams  (


 

  
     
 
  

  
     &  )
  
     
    * +  , 
   * + 
*  + , - 
   . 

  &   /  
    '
   
     
   universe of discourse    

     
       )
  
0    
     1!
62 Sets

Í
 
    



 
   

           

              !"  ##   $    


#         %  #" &'
              #   !   ( '  
 #&! & !&    
        (       
   

&   #  )&  "  


       (   
)&  "      
)             

Exercise 2.5 (Solution on page 416)

*# &)  )&&'  && &  +


        
              
            

 ,  &! $&  ' # &  )&&'  # & &) 
!  &   &) '#  &!$&      

 -  reflexive         & )& $"  


 -  antisymmetric      )             
 -  transitive      )             

.&&$  "       '  # &  # & (    
 #&     " & 
   & )& #  
Sets and Properties 63

2.3 Sets and Properties


  
  
 

      


     
 
   
Primes           

 
     
 
 
 !    
Primes   "
    


   Primes 

   #$

$ 
   
%    
    
 

 " 
  
 

  $        & ' 


   #$
 $


   


(

 !    
 $ 
    

  


)

  $ $
   "


   " 
  
   


 
  "    
  
    

(
 !     
 
   #$


 $

      
    


Example 2.5

* 

 $

 

    
&  
 
   $       
   
$

$  ' +$$!


        
 

    
,

  
       
 -  Animals    

    
  Humans 
   
 $  
Humans    Animals "
   


(
 Humans        Animals  
  
  

Example 2.6

.    
Ê     
/  $$
  $
"
 
64 Sets

   Ê      
    Ê      
   Ê      
    Ê      

       
         

        
    

       
      

      
    
      ! "  

Example 2.7

#
"    

$   %  & #'  (  

    " 

  $     %  &    #'    ( 


    !!  "   )     
       

  "          

   $    %  &   #'   (  

2.3.1 Russell’s Paradox


)        
" !  
      

  

* 
        " "!   +     

  
 ,"                   

  !                    

-                     

  
        
            

    


  

*   ' 
     . )    


. #
  



. -   "           
 
     / 

 0!! 

 )
  "  !!  "  1   

     
  "   




Operations on Sets 65

¯    
        
                   
      

                 

                 


       
          
 

    !   Russell’s Paradox    


  "              
   #  
$           !
                 

%                 


&      
   '       
   #             
 # 
(            &
               

Exercise 2.7 (Solution on page 416)

      #    


)    '    

*     + ,      + (  "- .  


  +

2.4 Operations on Sets


$                 
                   
&  
$            
          

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

 % & ' ( )   & ( * + %,   % ' ) 



68 Sets

             

Example 2.13

                    


           !        
 

"  #$                  


              ! !   
  

2.4.4 Complement
complement             %#    & 
  '   '      &   (
  ( 
   

'$
   
  

     '  &    $      )#   * 


&$    #       

Example 2.14

+'&  '   '        ,  -  $


     ,  -  $

        , - 

Example 2.15

+'&  '   '          $ 


& &                    !
 !    .   & &          
              

Operations on Sets 69

Exercise 2.15 (Solution on page 416)


     
                

 
     


   


     
 

     


  !  " 
     
#  #
 

# $  % 
  

#  $  %
  

# $  %  #
  

# $  %  #
  

Exercise 2.16 (Solution on page 417)

& !
    '  #
# (  !

   )" ) '"    *
   

# (  !

   )" ) '"  * 

# +
  !
    
    * 

# (  
    !
       *
   

# (  
    !
       *
   

2.4.5 Powerset
,
 powerset  $ %    
      "'   
  

 $ %        #
,
"!
  $ %
  #
(   " !  $ %   $ %#
  

+ 
 ) '       "' # (
   
  
') ¬Ò $ %
        "'   
 

¬Ò $%           -  #


70 Sets

Example 2.16

      
 

         

       


   

         


       
      
           


!    
        

   
   
 
  
    
 
      
   
 
    

       


   

         


        
     
         
   
 

           


"   #  $% &' (     )  


  #  $% &' (  

 
#   $%  &'  (  
#  $%  #  &'  #  (  
$% &'  $% (   &' (  
#  $% &'  #  $% (  
#  &' (   $% &' (  

#  $% &' (   

       


   

         



     
     
 %       
    
Operations on Sets 71

¯  
              



¯  
         
 

   
     

     
      

 

Example 2.17

  

    
 

   
 ! "! #
 

$  %
 & 
 ' (      
     " 

 

Friends   #
  $  %
 & 
 ' 

     
   

  
  
      )

"!
 
 !   Friends *   "  " " $   & 


!   !               


     

 ) "!


 #
  %
 '     Friends

Exercise 2.17 (Solution on page 417)

+
         Friends  Friends
    ,
 $  -

"  ./  ( !    


0   1

Exercise 2.18 (Solution on page 418)

*    
      "!  

.      

       

2         
( !    
     1

Exercise 2.19 (Solution on page 418)

3
  
!                 1
72 Sets

2.4.6 Generalised Union and Intersection


  
            
  

            



                       
     

          

  

                        
       

              
            
  
!   "       ! "  #      
            $

!  " % ! "     !   " % !  "   


  $

 %     %  


                    
&
 !"
$ 
   
 
Ë %  $  


Ì %  $ 

 
     %        % Ì    
Ë     

         $

' %
Ë     % Ì  
( %
Ë  ! "    % Ì  ! "
)
Ë Ì
 %    %        
  

#         


     *      Ë

    
 
              
       
+        Ì  
    
  
   
                   
 

  
Example 2.19

+    ,+'-'   


       

      ClassLists   
   

 ,+'-'  ClassLists #   Students
  
                
Ordered Pairs and Cartesian Products 73

Students
Ë ClassLists
  Ì ClassLists 
    
    

 

     



Exercise 2.20 (Solution on page 418)

        Ì ¬Ò    Ë ¬Ò  

2.5 Ordered Pairs and Cartesian Products


 ordered pair           first coordinate 
 second coordinate           !    
   "     # $           
!   #  !   $        %  
          "      
   
  
     &   
             
 Cartesian product          
      '           
           
    (      


          
     Ê  Ê      Ê ¾          
! 
Example 2.20

 ) 
 *+

,  *+

,     *+

,  *+

, 
   ' -  
       .)/    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
-
'( -
' 
  -
 

8     


          Æ    
     . " 
   &  '  - %           
        
  '  -
 
  # 
 
  
      
 
       
 

 
      $      
          

   
    
       


   
  #   Ê & Ê Ê Ê 
¿

9       


   
     
    
 


    $ 
      
  &  &  
Ordered Pairs and Cartesian Products 75

Example 2.22

   
    
   
                 
  
      
           

 
    
         
  
     


Example 2.23

 pixel      


       
    

    !  
!   "#  $$%   
  # 
    &  
    
"  #           
 '  RGB model
  
   (    
     % !¿  % ! )   Ê * %   
             % 
      #
  + #    , 
  % % %   
          
#
     
-        
 
    % % %  %  % %     .  
 (
    *
Pixel )   !  
! 
Colour ) % !¿

   (            
Point ) Pixel Colour
     
   #  "      
             (       
                   

Exercise 2.23 (Solution on page 418)

"  
          
 
 /0  #         / 0 1(
      
        

           
76 Sets

2.6 Modelling with Sets


  



   

  
   
 
    
 
  
     
    
  
       
 
 
  
     
Example 2.24

      


 
 
  
 

  
   
  
! " 
  
 

# 
 

 
           

         
      
  
     
  

    
  $

 

     %


 
& 


  
  

 

!   ' 
(        

  
   


  
 
) 
 
 

Exercise 2.24 (Solution on page 418)

*
 
 
     +  , -
 !!. 
  
 
           
  
 
       
    /
 "
   
 
 
  

!   
     
, 0 /) 
  
1 "       

 
2 "        /
3 4    
 

   
Modelling with Sets 77

 
    
         
 

Exercise 2.25 (Solution on page 419)


           
 
    
All babies are illogical.
Nobody is despised who can manage a crocodile.
Illogical persons are despised.

         !  


  
 
  !     !! 

Exercise 2.26 (Solution on page 420)

         



   
   
  
All oceans are full of water.
No ponds are oceans.
Therefore no ponds are full of water.

Example 2.26

 ! 
 " #$    !

      
   
  "  
 "     !
 %&  

    !

 '(  

  
 "
  
  

 
   !

  
  ) 
   *" %%  

  
 " 

   !
"   
 
 
      !
 +  
  *  
,
- !          
  "    
 

       

  

, , ,
, , ,
,
 
78 Sets

 
  
 
     
 
 
 

 
          
    

   

    
 
 



      
   
   
 
¯     
 
 
     
  
 
   ! 
       
¯ "
   
  ! 
       

 
#   
       
 $ 
 
  

   
¯ %#    &&  !         '  
  
     
  

   
  

    
  ( 
 
   
   
¯ )    

  !     
 '  
  
           
  
  
      
  * 
 
   
   
¯    &+  
    &,        '
    
      
 - 
 

  
   
¯    ,  
      &*       
 '    
      

+ 


   
   
¯ )      
 
  
 -,   
    

    
       
 
 !
     
 , 
 
   
   
 .

        /

  

, ( +
* $
-
 

%      
.

  
   
/   

  
  
 
   - , $ * + (  0    , 
#   
   
      
   ! 


     .

         


 
   
/
Algebraic Laws for Set Identities 79

  

¯ ¯
¯¯¯ ¯ ¯
¯ ¯ ¯ ¯ ¯
¯ ¯ ¯ ¯¯ ¯¯
¯ ¯
¯ ¯ ¯¯ ¯ ¯ ¯¯
¯¯ ¯ ¯ ¯ ¯¯ ¯
¯ ¯
¯
 

  
  
 
 


 
   
 
 

      



        

 

 

   

2.7 Algebraic Laws for Set Identities


  
   

  
  
     !  "




  "


 
  
    

  
  
 #
 
  
 
  

  
   
   

 $ 
   

         
   
   
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

 
   
              " 
  #
         

    

     

  

Exercise 2.28 (Solution on page 420)

$ 
    
      
%                   
 &
 !     '                ( 
 
 
 !           #
   !     !    !    
Logical Equivalences versus Set Identities 81

     


    
       
             
Í


Example 2.28

   
         
  
        ! "    #
 $ "    "          "  #
    
     %        #

Exercise 2.29 (Solution on page 421)

& 
      #

2.8 Logical Equivalences versus Set Identities


     
          
  ' 
 $  (  $   ) *#+ 
 )      
  ) ,#+# - 
  
       . .#
Commutativity Laws Commutativity Laws
     " 
     " 
Associativity Laws Associativity Laws
     !    !        ! "   !  
     !    !        ! "   !  
Idempotence Laws Idempotence Laws
     " 
82 Sets

  

Distributivity Laws Distributivity Laws


                            
                          

De Morgan’s Laws De Morgan’s Laws


           
            

Double Negation Law Double Complement Law


   

Tautology Laws Universe Laws


 true  true  
true   

Contradiction Laws Empty Set Laws


 false   
false  false  

Excluded Middle Laws Complement Laws


  true  
  false  

Absorption Laws Absorption Laws


         
          

 
 
 


    
     
             false    true 
   
   
    
     

           

 


   
     

  
Additional Exercises 83

Example 2.29

 Implication Law  


 
  
   

   
  

              
  
    

 
  
        
       true 
 


    
     
 
 
 
 !  "

Exercise 2.30 (Solution on page 421)

#  
  
   

     
 

$  
 
 Contrapositive Law       
% Equivalence Law     "    "

&
 
   
 
    
 

   


$ 
 
 
 '     $
  
  

  
             
 

(  
Exercise 2.31 (Solution on page 421)

)

  
   
 
     
 
   "  
*  
           
 
   
  
   
    
  
 





  
   

+ 
 


2.9 Additional Exercises


 ,
   % - . /
   . / 0  1 2
     % . 0 1

)

   
3
"      
"    
84 Sets

    
    
 

                  
       
 


     !    
    
"  
       

 ## #  

              
        
            
           
             
$ 
    


    %
 ##


 

   
  
   
   

& ' 
 ##
 

   


   (


    (


    
 
) !
 *      " $  &   

 
  
 +



 ##
   # 

  
 *  
    

,      

,  " $   &  


- . symmetric difference 

  /  
  


 

 #  
    



  
         0
 
       
 

 ## #  

        
Additional Exercises 85

         

 

   
     


 
         

 !
   ! "


 
  #  $
 
 %    %

           
& &

              
     
&

    ' ( !(


     

) 

 
   
        '


    
 
  
 *'   '  +

  % ,-  .'   ( " '


 !    

 ' 

 
  $ ' 
 /(   ' -  
%  
 $ ' 



(  ' 
  
%   " 0 (  


  ' 


    


     

 ' 
 
% % *

( !  ' 
(  '' 

 





! "
#   
% 1 
' !   ,- 2

 
%   
 1 !    .'  2  


.'     

 !
 
% % *
3 !
 ' 
 

   ' 4  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 and Circuits

   


         
       




 

 
  
   
   

  


  
    
 

  


 
  
  
  
  ! 
Boolean
algebras 


 

    

 

 


"  
 

  
 
  
  


      
 
     
 



#


 
  

$ % & 



  

   
  
  

     
 

   
  
   

 %    
  



 & "  
 
  
 
 logic gates 
  
 
   
  
% ' 
 ( 

& '  


 (   

 F ' (  T '
 (   
 

)  



  
   
 


 
 
          
  


  
  
    
  
 

 *      


  !  
 


3.1 Boolean Algebras


 Boolean algebra   
  
 '
 
(
 

 

  
 %  &   
  zero unit    
   




  
 +   sum  product      
  
 
¼
  
    
  complementation " 
    
'  (    
 
 
 
 '

   ,  
(

  
  
+    ¼
"   
 
 




 Laws of Boolean Algebra    - . &

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_4, © Springer-Verlag London 2013
88 Boolean Algebras and Circuits

Commutativity:     
    
Associativity:         

        

Distributivity:         
         
Identity:   
  
Complement:  ¼
 
 ¼
 

        

         !       "   


 
    
# $     # " !! %"  
        "       

Example 3.1 The Boolean Algebra of Sets

                  &   




   & & &  '  # &  & &  &  !  #
¼
  

$  ! &             & ! 


!( "   ) !  *+
Commutativity:         
        
Associativity:         
    



        
    



Distributivity:           
    
 

           
    
 

Identity:      
      
Complement:       
      
Boolean Algebras 89

Example 3.2 The Boolean Algebra of Propositions

    

 

       
    
      false true     
 
 
¼
  



    
   ! 

" 
   

   

  
 
 # $
%
 &'
Commutativity:      
     
Associativity:   !        !  

  !        !  

Distributivity:     !    ! 
   !  
    !    ! 
   !  
Identity:   false    
  true    
Complement:     true  
    false  

Example 3.3 The two-valued Boolean Algebra

 ($    


  
$   
 

   
   
  #   '
  
      ¼
       
       
     
     
)    
  
   
   $ 
$  


 

 



Exercise 3.3 (Solution on page 421)

*
            (  
   
+ $     
 $
   
       
  $
     
 
 
      
 ¼


  ,   -$   
    !! 
$      ¼ ¼
90 Boolean Algebras and Circuits

3.2 Deriving Identities in Boolean Algebras


  
    
       

                
       
       
    !    
       
        

     
   "      
     
 #                $
      !  %&       

Theorem 3.3 Further Distributive Laws

Ü ' Ý Þ ( ÜÞ ' ÝÞ
 
ÜÝ ' Þ ( Ü ' Þ Ý ' Þ 
 

Proof: "    )         ! 


Ü ' Ý Þ ( Þ Ü ' Ý 

( ÞÜ ' ÞÝ
 
( ÜÞ ' ÝÞ
   

Theorem 3.4 Idempotence Laws

Ü'Ü ( Ü

ÜÜ ( Ü


Proof: "    )         ! 


Ü ' Ü ( Ü ' Ü*
 
( Ü ' ÜÜ ' Ü ¼


( Ü ' ÜÜ ¼

 
( Ü'+

( Ü
  

Theorem 3.5 Domination Laws

Ü'* ( *

Ü+ ( +

Deriving Identities in Boolean Algebras 91

Proof:   


 


  
     
Ü    Ü  Ü  Ü   
¼

 Ü  Ü  Ü 

  ¼

 ÜÜ ¼
 
   

Theorem 3.6 Absorption Laws

 ÜÝ  Ü
Ü  

Ü Ü  Ý   Ü  


Proof:  
 


   

  
 
  
Ü  ÜÝ  Ü  ÜÝ  
 Ü  Ý 

 ÜÝ    
 Ü 
Ü   


    

       
  
 
Theorem 3.7

 Ü Ý ÜÞ  ÜÝ  ÜÞ  Ý Þ

Proof:
Ý  Ý Ü  Ý    

 Ý Ü  Þ  

 
 ÝÜ  ÝÞ 

 ÞÜ  ÞÝ  

 
 Þ Ü  Ý  

 Þ Ü  Þ  

 
Þ   
 
92 Boolean Algebras and Circuits

  
   

      
 


 
         
Ü  Ü    ¼

ÜÜ    !      "  


  Ý #  
¼

  Ü  



    

¼

Theorem 3.8 Uniqueness of Complement

 ÜÝ 
ÜÝ     Ý Ü
   Ü
¼ ¼
 
     Ü  Ü    ÜÜ  
¼ ¼

Proof: $
  Ü  Ý    ÜÝ   
ÜÝ    

 ÜÜ 
¼


ÜÝ    
 ÜÜ  ¼


 !   %& Ý  Ü  ¼


Theorem 3.9 Involution Law

'Ü ( 
¼ ¼
Ü

Proof:
Ü ¼
 'Ü (  
¼ ¼


 Ü Ü ¼

 


 Ü 'Ü (
¼ ¼ ¼

 ÜÜ ¼
 

 !   %& 'Ü (  Ü ¼ ¼


Exercise 3.9 (Solution on page 422)

)         
¼ ¼

Theorem 3.10 De Morgan Laws

'Ü  Ý (  ¼
ÜÝ ¼ ¼


'ÜÝ(  ¼
Ü ¼
Ý ¼
 
The Duality Principle 93

Proof:   


 


  
     
 




Æ
 


Ü  ÝÜ Ý     Ü  Ý  Ü Ý   
¼ ¼ ¼ ¼


 
   !""
# " $%   &



Ü  Ý   Ü Ý 
¼ ¼ ¼

Ü  ÝÜ Ý   ÜÜ Ý   ÝÜ Ý   


¼ ¼ ¼ ¼ ¼ ¼

 Ý   Ü  

 
 
¼ ¼

  
 
 
Ü  Ý  Ü Ý   Ü  Ý  Ü Ü  Ý  Ý   
¼ ¼ ¼ ¼

 Ý  Ü    
 
 

  

   
Exercise 3.10 (Solution on page 422)

'
 &
" 
 ÜÝ  Ü Ý   ÜÝ  Ü Ý
¼ ¼ ¼ ¼ ¼

( ) ÜÝ  ÜÞ  Ü Ý  Ü Þ


 Ý  Þ ¼ ¼

$ ) ÜÝ  
 Ü  Ý  
* Ü         Ý  ÜÝ  Ü Ý   Ý ¼ ¼

3.3 The Duality Principle


+  "   , & 
dual  "  
 &&
      
& 
 - & 
   

"

& , & 





"

 " 




 #   "
   Ü  Ý Þ    ÜÝ Þ   ¼ ¼

#  &   "
   , & 
Theorem 3.11 The Principle of Duality

   
           
Proof: # 


      "   


  
" "   
  

" " 
94 Boolean Algebras and Circuits

 
   
     
    

            
  

Example 3.11

  
      
       ÜÜÝ  Ü!

Ü Ü  Ý  Ü  "Ü  Ý   

Ü  "Ý 
 

Ü  Ý"  

Ü"  

Ü  

#     
    

   
  
   $
    Ü  ÜÝ  Ü  
  %&' 
    
 ! 
       '  
  
 
($
       '  
  )  
  

      
  
  )  
     

    


         
  
   
 

   '    
  
        $
 
  
 
  '       
  
 '   
   (  

 
  $
      
       *   

     


   
'  
  
  
  (  # ' 
     
  
  

 *    
 + , '   
     

+ ,    
 
   

Exercise 3.11 (Solution on page 423)

-   
  

   
   .(  %/"

/ ÜÝ  ܼ Ý ¼ ¼ ÜÝ ¼
 ܼ Ý 

0 # ÜÝ Ü Þ  Ü Ý
¼
Ü Þ ¼

 Ý Þ
% # Ü Ý " 
 Ü Ý "

1 Ü "  '    ' Ý ÜÝ ¼


 ܼ Ý  Ý
Logic Gates and Digital Circuits 95

3.4 Logic Gates and Digital Circuits


 


  
    
    
      
    
  
     


  
   
  
  

   
   

  

   
   

  

  


      

  
 

 
  
          
   
 
  
     bits 
 
!     
 

  
 

   

     
  
           
 
    
     "     #  

  
     
  $   


     
 
%   
      
 
     
       
Example 3.12

 
   "!       
 
 
  
  
  
  &
        
  

 "! 
' 
   

    
 
     
  
    (     
&
  
         


# (


    
 
    
 
    
 
"  
    
         
  

 

   
       
  ) 
   

        
 
  *
(
      "!    
  
 

  
  
   
   
   
   
)   (
      
       
   
     
           
  

     
 
         
   

     
 
    
 (   
 + 
   



 (
  "
         
 

96 Boolean Algebras and Circuits

   
      
      
     
 OR gates  AND gates  NOT gates 
 OR gate     

      
 Ü
 Ý  
   
 ÜÝ  
  Ü  Ý 
ÜÝ  ! 


"        




Ü Ü Ý
Ý

 AND gate     



      
 Ü
 Ý  
   
 ÜÝ  

  Ü  Ý 
Ü Ý  ! 


"        




Ü Ü Ý
Ý

 NOT gate     



     
  Ü 

   
 Ü   ¼

  Ü!
Ü 
¼

!  Ü

"        




Ü Ü ¼

#             




Ü Ý Ü Ý Ü Ý ÜÝ Ü Ü ¼

! ! ! ! ! ! !
! ! ! !
! ! !

$ 
  
  
 
         
%
 &   

   
%  '

    


(&  )) *
    
       ÜÝ 

ÜÝ  #  
           

  
Logic Gates and Digital Circuits 97



      
       
  

  
    
    
      
     
       
  
 

    
  
      
 
    

  
 

Example 3.13

!
   

 "
Ü
Ý Ù
Þ Ú Û

#      Ü$ Ý   Þ 
  #   Ü   Ý  
 
 %&  
        Ù ' ÜÝ  (   $
   Þ    
 %)#  
    
     
Ú ' Þ  # 
      Ù   Ú
    * 
 
¼

       
 )+  
   *   Û ' Ù , Ú 
# - 
  
 $   
 $  

    Û ' ÜÝ , Þ  ¼

#   
     
 
 

  "

Ü Ý Þ Ù Ú Û
. . . . / /
. . / . . .
. / . . / /
. / / . . .
/ . . . / /
/ . / . . .
/ / . / / /
/ / / / . /

0
   $        Ü'/$ Ý '.   Þ '/$  
 

  %&    .$   
 
  %)#  1    


    
 )+    .$  
 
  Û 

 ."
Ü'/
Ý'. .
Þ'/ . Û'.

#  
      *    
Û ' ÜÝ , Þ   ¼

   
  


È É  Ê $ 
$


98 Boolean Algebras and Circuits

Example 3.14


     

        
   

 
 



 
 
          
     
       
       

    
      


   
 
 
     
¯
       
 ! "#       
     $ 
¯
       
  "#     
      $ 
¯
        

 "#       
     $ 
¯
     
   
 ! %&      

      $  ' 
¯ ! 
        
  %&    

 !    $  '  
     
  
    
       
   
      
( ( ( ( ( ( ( (
( ( ) ( ( ( ( (
( ) ( ( ( ( ( (
( ) ) ( ( ) ( )
) ( ( ( ( ( ( (
) ( ) ( ) ( ) )
) ) ( ) ( ( ) )
) ) ) ) ) ) ) )
"   
  
     
  
 $  '  $  '  '  $  '  ' 
Logic Gates and Digital Circuits 99

  

   
       
        
     
 

Exercise 3.14 (Solution on page 423)

 exclusive-OR gate  XOR gate 


      

 

  ¨
  ¨
!
!
!

!

 "

 ! 
  !


   ¨
" 
         

   
      
  ! 
#        




Exercise 3.15 (Solution on page 423)

$
                # %


           





Exercise 3.16 (Solution on page 424)

&
  


         
 

     
  
 
 '  

   
 #      '
 



   
  

   

 


¯       
   ! 
(
¯
      
 
  ! 
(
¯      
 
 
  ! 

   
    
   
      

    ! 
 #       



100 Boolean Algebras and Circuits

3.5 Making Computers Add


   
            


 
   
       
   
               

3.5.1 Binary Numbers


                   
                  
        
          

                 
                 
  
            
     
    !         
    
"             
   
                         
           
       
   #           
      
  $  % 
     $ 
      &       

         %  ' ( % 



    )*+,
         
-

¯  ,         , $

¯  +             +    $

¯  *            *      


!   "$ 

¯  )              )      


!          "

 

)*+, . ) ¿
. )  . )

*  *  
¾
/ . . *

+  + 
½
/ .  . +

,  , 
¼
/ .  . ,
)*+,

0          


    
              '
         
   ' 
   !"     ( %    
        
-
Making Computers Add 101

¯     

 
    


¯     

 
 
      

 

¯     
 
 
      

 
 


 


¯     
 
 
 
      

 
 

 
 
 

 

 
 

¯      
 
 
      

  
 

  
 

 

 

 


  

        
     !  !

     "  "

       
       
#

$%    &  &       &%  & '   %


   &          &   
 
   

&%
   &    
 &
(   
  
 
 
    
 
&%  
  %)  %
(
* &   
  &  + 
  



  

Example 3.16


      ( , 
&%)

¯ &    - 
,
(   
 #

¯ &     
#
(   
 -

¯ &     
-
(   
 

¯ &     

(   
 

.         & ,  -     &%  )



   ¢   ¢ -  -
 ¢   ¢   

 ¢   ¢ !  

 ¢    ¢ "  
 ¢    ¢   

 ¢    ¢   
,
102 Boolean Algebras and Circuits

3.5.2 Adding Binary Numbers


 


       
       

                  

 
   
 
             
                

      
       
 
        
                

    
         
 
     
                     
         
         
     
  
         
   
         
Example 3.17

    
     !!!"!  !"!!"
      
        #
         

    $
½ ½ ½

!!!"!
!"!!"
!!""!!
   
              !
     
            "  
        
             !
  
 
   !    
%  

Exercise 3.17 (Solution on page 424)

              %  &


  
      
  
 #
       '  
    
 

  (     
 )#    #
 ¿ ¾         *        *#  
                  $





  


 

 
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

         
 ¼  ¼ ¼ ¼ ¼ ¼

 
              
          
¼ ¼ ¼

                 


¼ ¼

         


 !"#       
 ¼ ¼ ¼

 
          
¼ ¼ ¼ ¼ ¼ ¼

 "   #  "   #
¼ ¼
 
   
¼ ¼ ¼

   
¼ ¼


         
¼ ¼ ¼

"   #   " #
¼ ¼
     ¼

     

$       
        %& 
 
    
'( ÜØ
¼ ¼

Ø


'( ÝÞ    

3.5.5 Putting It All Together


'  )        *       
  
   
       +  
     ,*   

      ,*     ¿¾       
 
 -*            



 
 '(

 .(

 .(

 .(
 

/          0      


  
 )        %
          
            


 

  
106 Boolean Algebras and Circuits

3.6 Additional Exercises


   
    
   
    
  
  
    
    
 
    
     
   !   
!  "
#     
 $  # % &  

 & 
  
 '    &   (    
  
 
      lcm  ")    
  
 
       gcd  ")   $ &
¼

*      + $  # * , #    
  

 #
 -. 
 #          
/ 
  0  
 ¬Ò  "  
   
   
   

   
 &  (    + !    
¼

   
 !"1 2
! ! 

% "     $ &    !   (  $ 
¼ ¼

" 3             "


, "     $     !   (   $ &
¼ ¼

" 3             "


4  NAND gate 
    0  
!"5

   
& &  $ 
& 
&
&

 
     $   
   &       

      )  
  
   

"     


  6 78  67 
   

 

" 3      
     (    !
¼


  66 


9  NOR gate 
    0  
!"5

  

& &  $

& & 
& &
&
Additional Exercises 107

  



     
      

      
      
 

 
  

  !     " "
  
# $     #
 
    "
   %   &
¼


  ! 

' 
 
  " "       (  

  %  % 
#   %  % 
¼ ¼

  % 


¼ ¼

 #  # 


      
 #&     
(     
 # ) 

 
  







#





 *  +(  , 


  "   "   -
 #     .        #
#   +   )"    + , )"
/  "    01   +    01   
+ ,  &      )"    "2 &
   

  
     
 
  
       
 

    

 "    
3  multiplexer   
   
  ¼  ½   


   )    4
108 Boolean Algebras and Circuits

× Ü ¼ ܽ Ö

ܼ 
 
Ö
  
ܽ 
  
 
×    

 × 
selector        Ö    
  ܼ    ܽ        ×


 
    
     Ö ! × Ü¼ " ×ܽ #
¼
Chapter 4

Predicate Logic

  
  
    
       
 
 
 

   


          

   


          

 !       " 


#

 
 
  


  
 
  
$  
 
      
    

     


        
    "

             

%   
      
 
 predicates &

  
     "   "  
     

  &  quantifiers &       


 "    

 " 


4.1 Predicates and Free Variables


'
   (    "   #

Ü # Ü   
 

)        
    
 " ( 

 

 "  *
  
 "  #

Ü # Ü  È 
    "  *
 Ü  
 "    È 

 "  predicate     È +Ü,     -  *
 Ü

 È .  
        
 

 "   "   


   Ü "    $   "  

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_5, © Springer-Verlag London 2013
110 Predicate Logic

     
 
 
   

  
 
     

         
  
  
    


          


      


   
  
   
        

        
            
 
  
    

      


   
 !  

  "
             
    #

       free variable  $     
    
 
           %    &
       &      
  '     (
  '  ))
     #
   ! 

  
  
  

  
      
 truth set 

   #
     
  
  
    

      *
      "      
     
  
  
    

Example 4.1

+ 
         
 ,  "

  -   .   / 

, , . +  , 
  
    "

  0  1

#


  .     ,   


 
  -    /   .
 +    ,     
 
  
  
     .   , 

        


   2      
    
 
    
      $

     


0   1  0   1        

   0   1  0   1 #
  3  3   
  
  
      
#
  
     

    
  
        
       
   4
 
        
   #
    
  

Quantifiers and Bound Variables 111

    


 
  
  

  

   
     
 
   

Example 4.2

 
         
 
   
 
 
          


 
                

  
 
           !      

     
     
       "
   "   
 
! 

 


   
  
   
#$ 

   
 

Exercise 4.2 (Solution on page 424)



          
 %

   & ' 


   (
)    & ' 
     (
    & ' 

  (
      & '  
 
  
 *  &  (

             


 #
 

4.2 Quantifiers and Bound Variables


+ ,  - $ . /

 0

      

       1 
    



 

  
   
          
  !   
   
/      
   
      
     


,   
- $  
. /
  
0


112 Predicate Logic

    
        
 
     


Children       


 
    
     
    
      


   
   
  
 
!     
  

   

  "       

#Ü$
%  
     Ü  
  
   "    
       %   %  " &      

%
   %       "
  
  

  '
  

& "     
   

# $  # $  #$  #


$
   % " 

(
    
   
  
  
     

#Ü$  "   



  )      " 



         
      %
   

 " 

# # $   # $   #$   #


$$

#  # $  # $   #$   #
$$

#  # $   # $  #$   #
$$

#  # $   # $   #$  #
$$
         
  
  


      )   

 
  
  


      )    
  


 


      )  
  
  
  




     

    
  
   % 
  
  



  
       % % 
 " "  %  

*        


         


   

                


"   
+   
     #Ü$  
  Ü
 

" %  ,  


-
 
'



#.$  #/$  #0$  #11$  #1.$  


2        
        , 
  

  #Ü$  


  Ü     , %  ,  



-
  '


Quantifiers and Bound Variables 113

        







 
     
 


   
      quantification !!  " 


 !
  

 
 
 


  !


  

  
  
 



  !


 #!



 
 

4.2.1 Universal Quantification


$!

 

 !  

È Ü   
 


 Ü 
!


  

 
%

Ü È Ü
!!   
 


  Ü È Ü &

   
  "  !


È Ü   
  '

  Ü
#!  
 universal quantification 
(
 

  

 )
   (
   *+    , 



 !  Ü   
   !

  " 

Ü  Ü
!! " !

! ! 
 ! ' !
 !
 

!  
!


  
 !

  !
 !

-
! Ü  Ü    %  !  

 ! 

#!
 '
Ü    

 '
 ! 
&    bound variable & 
 ' '" !
.
/Ü0

Example 4.3

#!






   





 %

Ü À Ü
!

À Ü 1 Ü   

 
114 Predicate Logic

  

     
  
  

   

 



   
  
      

        
   
 
        
  
 



Example 4.4

 

                   
  
 !"   
Ü  Ã Ü   É  Ü  
 Ã Ü #
Ü       
ÉÜ #
Ü          
  

     
  





         

 !" 
  
 
   
   

  

   " "   "
" 



     
  
    
    "              
" 

à Ü   É Ü 
  
   
   


 



         " 
 Ü  

    $    Ã Ü  
  $  
 Ü  



 $   ÉÜ  
   %
  
 Ü
  





 
&   
   
    ÉÜ   

     
    
 
 
 

 "
"


  &       "   
'
 !"   
 !"  

Ü  Ã Ü   É Ü  
 

Ü Ã  Ü   É Ü 
   
  " 
Quantifiers and Bound Variables 115

Ü     
     
           

   
              
                      
    

Example 4.5


    

      
    

        
        
      

                    

                  
              

Exercise 4.5 (Solution on page 424)

!    

     
     
      
              

" #     $ 

% &    $ 

' (    $ 

4.2.2 Existential Quantification


)          
       
                


     
116 Predicate Logic

  Ü 
   È Ü 
   
   
    È Ü   
    
Ü 
     
 

                

       Ü   
    

   
 

Ü   Ü
               
      
      
     

  
     ! Ü  Ü   Ü  !    ! !  ! 
" #  $ Ü%       " #     " # 
    !       
     

Example 4.6

&    

        


    '

Ü À Ü
  À Ü ( Ü      
&    
       !     
  
        
&       À Ü  
   '    
         !     ) 
 *+                     ,
     !        &    ,
  !    !              
  
    
  #            
       

Example 4.7

&    

                 



 
                  
       
    '
Quantifiers and Bound Variables 117

 
Ü                
     
 


      
     
   



       
 

 

Exercise 4.7 (Solution on page 424)

   
  
 


     
 
 
   

       
       

        
  
          
          
 
      
    


     
   


 
  
 

    


    

   
          


 !
   


"    
      

# $  
 
  


% &

     
 


Exercise 4.8 (Solution on page 425)


     
'

      

    


          
 
          '

  
 !
"#     
 !
     
 
118 Predicate Logic

4.2.3 Bounded Quantifications


   
 bounded quantification       
                 
              
  
    
    
    
  
     
     

     

           
 
  
    
  
    
 

   
   
     

      
           !       
!          
"  
    
 
   
    
     

         #  
                $
 #      !
      
                   
          
"  
Quantifiers and Bound Variables 119

  



     
 

 
  
     



 

  
           

 


  
         

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
&
            

  

   -  
  
 
    
 


 

( # 

  
 
 

         


 # 
     
 


         


) 

   '    

 
  
120 Predicate Logic

          


 
       Oskar    

  

Exercise 4.9 (Solution on page 425)

          


        
       

! 
     
   
" 
          

4.3 Rules for Quantification


#               $   % $  & 
 $          $   % $  '    &
      
($ )&                $   % $
 &   $          $   % $  '    &
      
*       + ,    

 
    

  
    

    $%  ($ -   ) - .$&


     ($ -   ) -  .$ /$ 
   $%    $    0      *

          



         


 
  
   '


             



      


 
  
    
Rules for Quantification 121

Example 4.10

 
    
 

      

 


 
   
 





 

Ü !Ü"

 #  $   $ #  !Ü"
 

 

 



  Ü   


  # 



 % 

 

 
     &
'
Children (       

  
 ) 
)  %


 

 
 

           %   




  
 *  
 

 ! "   


 ! " 


'


    ! )  " #     



'
  ! "
 

*       
  #


 ! "    ! "
    

+ %   




 #  %
    
  ,
 


 


 '




 

 

 ! "
 



 #  $   $ #  ! "
 

 

 



  
 
 

 
 

 

   
#


%
 

 
    

 
 

  

 #



   

 
 

'
 ! " 

*       
  #


 ! " 
   ! "
  

Exercise 4.10 (Solution on page 425)

  
 # 

 
 
) #  
 
 %

)   
 
 *
  

 

 


 - )  
122 Predicate Logic

   
   

     
   
   
   
  
   

       

       
        
        

             


                

             

                 


!        "  #      $  % &


        '    '   # $ 
          (

 ÜÈ Ü  ÉÜ  ÜÈ Ü  ÜÉÜ


 ÜÈ Ü  ÉÜ  ÜÈ Ü  ÜÉÜ
 ÜÈ Ü  ÉÜ  ÜÈ Ü  ÜÉÜ
) ÜÈ Ü  ÉÜ  ÜÈ Ü  ÜÉÜ
*          

 +       
, È Ü  ÉÜ     ' Ü$    È Ü  
   ' Ü  ÉÜ      ' Ü
" $  È Ü     ' Ü  ÉÜ    
' Ü$  È Ü  ÉÜ      ' Ü
 +        
, È Ü  ÉÜ     ' Ü$  È Ü    
' Ü  ÉÜ     ' Ü
!$ È Ü       ' $  ÉÜ     
   ' $   È Ü  ÉÜ       
  ' Ü
- % $        "  %  (

Ü 
Ü  Ü Ü  
Rules for Quantification 123

 
   
     
 

 

  
 

 

 
 



Ü  Ü    Ü  



 



 

!
 
"
  Ü     
¼
    
# $ 
" 

%   
  &
  

"      


  &
 ' ("     
  &
  

     

  &
 


     " 

  &
    
)


   
  &
       
 
&
 

*
   
  
)
 




  
 
     




 

" 
)
 

  

" 
)
  
 
      




 



 

!
 
"
#            
¼

+ $ 
"  
%      
 
&
  


   


  &
      

  &
 
("    
 
&
      
 
&

 
      

  &
 
,  - 
 
) 

"  


           '
           
$  
 
)


    
 -  


  
  

   
*
 -  


%    
 


            
.


" 

  


 
)
*
 
 
)

/

 -

          
124 Predicate Logic

Example 4.11

 
    
     

    
  
     
 
       

   
        
 
   
 Ê     
    
         
   Ê   
          


    
     ! "   !!  
 
  
 !
 " 
 
        

!
  
 
              !
!  # ! 
  !  
  
  

4.4 Modelling in Predicate Logic



 !    $ !       
  
 


    % 
     
     
Example 4.12

& 
 ' !((     )# 
   $ 


    
All babies are illogical.
Nobody is despised who can manage a crocodile.
Illogical persons are despised.

 

   ! 
        * !
! 
   
  +     
  +    
  +    
  +       
Modelling in Predicate Logic 125

    



  
    
   
 Ü    
     
      
    
    
      
 
 
      
        !

 
   
    "     

    
  
 "  

   
     
  
  
 
       
 
 

Exercise 4.12 (Solution on page 426)

#
      
  
   
  

 

  
  
   

  
 
 
$                 %  &
      
    

 
'
  
   (

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* # "  #  

Additional Exercises 127

    
     
   
 



  
 
     




        !   !
  "      !  #$!
        !  %&!

  #     #$!   !

  '     #$!  #$!

  $     #$!  %&!

  %     %&!   !

  (     %&!  #$!

  &     %&!  %&!

) * 


 


 
 

  +
   , 
   
--


 .,
 
   
/ 
,
   0    
" .,
     
,
 ,
       

 .,
 1    
,
 ,
       

# .,
     
,
 ,
            
2  

    

  ,
  

 
    
    

 

      3 ,    
    
  *   
      1
   ,
 
   ,

 

Exercise 4.13 (Solution on page 426)

4,

4 --
) 
#

4.5 Additional Exercises


 5
      

 
 ,     

,
 


*



1    
 

  
  
./

  
    +   .  

   
   
128 Predicate Logic

 Ü  
   

 
 
  

      
      
 
         

    
 

  


   
   

   
    
     
  
   

! "#   
      
 $
% &%

 
" 
   

  


' (  
     
       
 "#)
  
 

  


             


                 

* "#  



  
 %
   % %

  

   %


       )

   % 
 
 
$
   
     $   
$
 
 
 
 %
 "$
         %
&%  
 
$
)

      "$ $
     
  
   %   
 

+ "#
" 
     





%     % Ê    
     %
  

   ,   
   ,   
   ¾   
   ¾   
         
Additional Exercises 129

 
     

  
  
    
      
     
  
  
    
           !  !

 
   "

 
  
        

       #
      

       
$ % &
' ( ) *       





   (*  *         
    
     )   
* 

    
     + *
 
(* !,  - 
& .         
*  
   
   
    +

/0 1 2 
   

  

    !"
#  
 $ 
  %"
# & 

   !"
&  & 


$ 
  %"
.   
        !    
 
   &
// 1 2   
 
  

# '&

 
! "
( !  ''    "
# '&

 
 "
.   

       ! 
 
 

  &
/3 #
    

   "

( 
  
   !"
#! 
     ''

"
& 
  
     ''

"
Chapter 5

Proof Strategies

   
    

 

 
     
    
     


 

     
  

          

 
      
         
   

 
           
    
   

   
     
      
 

 
      

           





 

     
     

  


   
 
  
    
     

                 

               


! proof  "
#      
      

   Æ              




  
 
 
   theorems   
 
 


 
   $ 
% 
  
  
  
  


    
&    
          
   
   
       

'
    
  
    

      

" #    
    

    





    
  
    
 (  
  


      (   
      
  (

       


 
  
   )  
 



 
              

 

'
  
 
(
 
    
  *





       +
    
  
  

  
   
   ,  

 
  

 
  
   
    
   
  


     '  -
.



  /  )0 

 1  )      


        
 

    /2   3      1        

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_6, © Springer-Verlag London 2013
132 Proof Strategies

 

  


 

         

  
  
     proof strategies   

  
            
   
       
     

   
  !      
        


   "   
#        
 
         $     

5.1 A First Example


!        %            
           &
     
    
    &     
 

     
        
    
         !       
      
   &
Í 

'
     
    
 
  
  

    

 
Theorem 5.1
      

      

Proof: '         (        


    )   *      
    &
  
    
    
+     
              ,
                     

        
A First Example 133

  Ü     
  

    
         
  

     
   
   
  

 
 
 

      
 
  Æ    

    

    


       
 

       
 

 

     


 
 


    

  

 
   
  
  ! 
  
     
    
"  
!  # !   ! 
   
 
  

  $  
     
 
  

      
  #  
 $   
    

  #  
  

    %  

& 
       

       
                   

   $    


 

    
       

         


   

  
  
   

  '      (
           
   !  
 
  


)     
   
 
 

   

       
          

  

  $



 
  
  
   

 
      
    
       
   

 

 
 
           #      $ 
   
 
introduction strategies     

#  
 $
 
     
     
     
 #      
  

   !  
 

 
 * 

 
 
   

'    
 
 


 
( 

    
    
 
    

  
  

          
 


 
        
       

 
       
  
  


     

          $    
 


       
+       
  

 
 
     

       

  

134 Proof Strategies

 
  

    
  
 



 
 
  
 
    

     
  
  
  

   
   
  
  

  
  
    
 

 
 
 
   
 



 
  
 


   
 
 

 


  
  

 

 


!  
    
 



 


 


 
 
 
 



 


 

 

  "
 
 "
  


  


      
 
 
  
 


   
  
 
  
   


   
 
 #$ 
  


   
 %

     
      


Exercise 5.2 (Solution on page 427)

&
     
 '
    (


       

5.2 Proof Strategies for Implication


)   
 
     


  
 
  "
 
      *    +
 


   
   ,
 
 
 


    



   

,  
 
 -   


      
 

        


   
     

   

   

Proof Strategies for Implication 135

' $
  

 

 

 

&


     %
    
 

      

 
     
      

Example 5.2

 
    
  
  
   


     
  
   

   !  "   
     
   
!   
       # 
  
 

 
  
         

   

          $
        % 
 %   
&
 
     

 


 '     
'  %  %   
#
  
   
$
(     %  
Proof:     
            %  %
            %    %  
)   %  '      %   


       %    

  
 

       
 *     
         
  
  
136 Proof Strategies

Example 5.3

   


        
Proof:    
   

       


    
       

      
       
       

Exercise 5.3 (Solution on page 427)

   


   

   


   
         
         !        

 
                 
 
    
' $
  

 

  


 

&
      %

          


      



Example 5.4

        "#  $     
   
    % 
 
Proof: &   % 
 

      


      %  
         
    
Proof Strategies for Implication 137

   
   



     
 
     

 
     
     

 
  
 
   
  
      

       
    
  
            modus ponens  
  
 
 
' $
 

   

 
 

  

 

&
   %

      
    
   
            modus tollens  
  
 
 
' $
 

    

 
 

  

 

&
   %


    
  
 
 
   !

 
  
   " ##  $!  % & ''(
138 Proof Strategies

Example 5.5

 
      

Proof:        


               
   
    

     

Exercise 5.5 (Solution on page 427)

             !   

        
  
 "        #

5.3 Proof Strategies for Negation


     "   

    
     

           $ 
       "    

 
   %             

$   $
    
 
  
$ 
 
$
' $
 

 


 

  

 

&

   %

      "     "    " 
    "      $ "       
      & 
$ "

Proof Strategies for Negation 139

' $
  

 

  



 

&


    %


   
 
 
 

    proof by
contradiction

    reductio ad absurdum 


   
  
  
 
   
 
     

Example 5.6


    

      
Proof. !     

       
 "  
    
    
     
 
 
  

   
     
¾
 #
         " ¾     
    ¾    ¾ " ¾ 
$     %   &
 '(  
   ¾

    )   " 


   

    
        
*  ¾ " ¾ " %)¾ " +¾  ¾ " ¾      
   
  



     
    
   
     ,
        

  


    
  
    

 
      &      
   


      
 
  

    
  
 
 -  
  &     
 
&
 ..  (' -    
    
 

   
 
 
  


  

     
 

140 Proof Strategies

Example 5.7

   



 
 

Proof.    
   
 
 

      ½ ¾  ¿      
    ½  ¾  ¿        
 
 

          




     
 ½  
   
        

   !  ! 

 
"        !  !
       

!   
! 
  !
 !  ! 

 
    
  
 
 

 
 !#    
 

 
 

 
Example 5.8

       
!       
   
$      
! 
      !     !
 

 
!        
   %   
    !
  !
     
   
  &

! '

"   ! !     


!         
   
     '        (   
!

  
 
       
    

 
     

 
 !)       

       
   !
!! (
 

       
 
!         
Proof. $         
     

!     *    
      ! 
 
!  

      #        
 
Proof Strategies for Negation 141

    
 
   
    
    

       
 
   
   

         
    



                

  
 
 
     
      
 
        
     

A Different Proof.     


   
    


        
                   
                 
             
    

  
 
   
      
  
        
 
   
 !
      



              
       

Example 5.9

     
   
  

 
"
   
 
  
 
Proof.     

       
 ¾
    #      
 


  
 
   

Exercise 5.9 (Solution on page 427)

"
  
           
    

142 Proof Strategies

Exercise 5.10 (Solution on page 428)

  


      
     


   
 
  

     
 

5.4 Proof Strategies for Conjunction and Equivalence



  


     

   

 
           
  
          
   
' $
 


  

 
 

 

 

   
& %


  


     
   
 



 
 ! 
"  
      
      
   
        

 
     


' $' $
   
 
     
 
 
   

    %&    %


&
 
   


    
 

  
  #   
$ % 


 %  
 
   &
Example 5.10

 
               
Proof Strategies for Conjunction and Equivalence 143

Proof:   Ü 


  
     
         
     
        

Example 5.11

        


 
Proof:     

         
              
  
   

        


   
            
     

            

                 

             


' $
 

   

 
 

  

 

     %
&
     
        
         
     

           
' $' $
   

       

   

&
     %&
     %
144 Proof Strategies

5.5 Proof Strategies for Disjunction


   
    É  Æ     
  
     
    
 
      
' $' $
   
 
  È   É
 
   

&
 È É  %&
 È É  %
                 
 È  É   
     
 

  
            È 
   Ê 


  É 
   Ê
  
      
 È É 
          
   

       
' $
  Ê

 

  È

 

  Ê



 

  É

 

&
 È É  %

Example 5.12

      Ò   


  Ò¾ 


 !  
"  #
Proof: $  Ò    


Proof Strategies for Disjunction 145

¯   
         
¾
  ¾
 ¾



     
   

¯   
           
¾
   ¾   ¾      ¾    



     
   



  
¾

     
    

! "  
       #
 " "    
  
 
     $      

 "     
   
 "        

' $
!  


 


  


 

&

     %

Example 5.13

% 
        
¾  
 
       

Proof: !   


  
¾   &
 
 
   

 
   
        


  '        
   
¾

( 
        

Exercise 5.13 (Solution on page 428)

% 
 
 "        
  
 
     
146 Proof Strategies

Exercise 5.14 (Solution on page 429)

 
         
     
         
 
            
   
    
              
       
  
        

 
         

' $
 

   


 

         


     

 

  


 
    
!     

 

  

 
        

    " 

&
  
    #  %

Example 5.14

   "   # "  #  


Proof. $    "   # % "   #  "   #
             "   #   
Proof Strategies for Quantifiers 147

Ü       

           

Example 5.15

            ¾  
Proof.                

¾  
      

¾     

Exercise 5.15 (Solution on page 429)

               !   "    " 

Exercise 5.16 (Solution on page 429)

             #    !  ¾    


 $ % &   '     ¾
  !  (  )  *

Exercise 5.17 (Solution on page 430)

+          , -
Fact:  "
. $(    . ) !
. *
Proof: /    

                

   . ) !
. *

0   . ) !
. *
1 
 "
. $(    . ) !
. * 

5.6 Proof Strategies for Quantifiers


5.6.1 Universal Quantification
/     #
     ,  ,   2#
3
2
                   !

   , !
  / 
   4         ,    2
  
3
 
0 ,  , ,            !    

3
 ! ,   0    
,   !      
148 Proof Strategies

' $
  
 


  



 

&
  
  %

             


    
                
    
      
        
             
    
            ! 
 "# $ %            
         &    ' ( 
 )           
*           
+  #          
             ,-
'            
   
                  
    
          

' $
 


   



 

&
 
 %

Example 5.17

.       /      

Proof.       /  +           


               0

      

        


Proof Strategies for Quantifiers 149

        


   
  
   

  
                 
    

          
   
                 

Example 5.18

                

Proof.  
               

             
               
       
 
             

             

                

Exercise 5.18 (Solution on page 430)

                 

5.6.2 Existential Quantification


 !  "
 #
         $ #  $

    %      
  
 
  

        
  &    %  
  %   
 
       
      #  

              
   
 
 
 
150 Proof Strategies

' $
   
   
    
 


   


 

&
     %
             
                   

   
            
           
  
  
  
 !
   
     "    #

   

      !
$   
 %                  

         
  
    

                   
   


  

 
' $
 


    


 

        

 

  


 
&
      %

Example 5.19

&     ' (   )


*( '     
Proof.   '  *)
(      ' ( ( ' +    
  
   +    
  ) ' *)  ) ( ' , 
(  (
  *( ' *)(
* (  ' , 
 (
Proof Strategies for Quantifiers 151

   





 
 

 

 
 

   


Æ  
  
         


  

 
    
    ! 

" # 
  
  $ 

    
 % 
 
      %   $  $  &      

 

  #  $ " 
' 


  "   


 ( )     ( )    *

      "     ( )  "    


(         
)        ( )
 +   
 ( ) %   
 
      
   , #  
 "   
    %    

  $ 
 
 

Exercise 5.19 (Solution on page 430)

- 
      . 
    

 ( )  

/

  
 #  0      ( "  "
    )      
     

  


  ()* 
"   
 
     
   
"  

Example 5.20 A Strange Proof of Existence

Fact:
    "     

   


Proof. 1 $ " 2" 34 
   
 ¾
5
" # 
       

  ¾ 
 &    6   

  ¾

      #      
  ¾  ¾ 
 &    6      


      # 

  ¾   (¾¾)  ¾
        

  
152 Proof Strategies

  
  

  

 
 
 
       
        

  
   
  

   
 


Exercise 5.20 (Solution on page 431)

 
            
 
 

  
   
!"
5.6.3 Uniqueness
#


  
      
  
    $ 

%   


 &

 

$  

  
   

  

! '  
      
 
            (
)  
         ( 

 $ 
  

 


  
 


Example 5.21

 
  

  

  &
      ( 
¾

Proof. *
  (  
 +! ¾

#
   (  + ! ( ++!!  ( 
¾
¾
¿ ¾
¾

' 
 
$    ( $ 
  + ! ( $
¾ ¾

  (  + ! ( 
¾ 

Example 5.22

,  
     
  
 

  &

   

     


! 

)  
    
Proof. *
  (  

Additional Exercises 153

  


Ë
 
   
   
             
  
  
Ë 

   
 

       
     

Exercise 5.22 (Solution on page 431)



       

            

5.7 Additional Exercises

 
       !"   Ê #    
    $ 
 
 %!
 
 &    
  $   


 &  
 "
  "
&&

' %!
     
  ' $    &&  


 ! "  &&  
( 

    ! !"  
 

) 
 '     
*   & 

   


 !      !"     
"
 !      !"     

+ %!
     
 ¾  
, 
     

 -  &  ! " 

.   )  *
/ 

         
  
 $   (
. 
 0 "      #

            
"             
154 Proof Strategies

   
  

  É  È 
 È  É  È Ê  É Ê
 È  É  È  Ê  É  Ê
   
  

  Ü  È Ü   É Ü    Ü È Ü  Ü ÉÜ


 Ü È  Ü É Ü   Ü È Ü Ü ÉÜ
  Ü  È Ü  É Ü    Ü È Ü Ü ÉÜ
 Ü È  Ü  É Ü   Ü È Ü  Ü ÉÜ
             Ü È Ü
   
   
Chapter 6

Functions
 
             
 
    
           

  

  
        
  

 
 
            


   
  
          


    
    ! "   

  
      
           

     
  
 
      
  ! 



     
     
   #

    


 

  
   " 
 

 

  

 $ 
  
   

 %

  

         


  
     
"  
         

 

 
 
  
   %


     

 
&

6.1 Basic Definitions


' function          
 

  ! 

 
      
    (   
  
  

   " 
           
)  


   
    
     

 *   

 
    
 
  +     "      
 

 (     , -     



   


Example 6.1

.   

     
   
    "


   

    
  
/ 
 -//"    

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_7, © Springer-Verlag London 2013
156 Functions

¯  
¯ ¯
¯ ¯

¯ ¯

 

       

        

    ! "


# $% # " &# $
' " (  )* ++
,  - " . 

/0 #   # 

Class 1   # ' ,  #


( - ! &# )* . 
     # 

Marks 1  +   % 2  "  ++



)#   

score Class Marks


 ##0  30 score ( 1 4 #  score  # 
(  #  0 # 0 score (  

5           #    


  6   
5 #  30

score ' 1 score ! 1 "

/0 *     *    *   


5 #
0      *     #  ## *
       7  *  #  7  
       

     
Basic Definitions 157

   
  Ü           
 
  
 

            


  
                  domain 
    codomain            argument  
         value          
                ½ ¾    
     arity           
       

  binary function      


         infix         
!
  
  

   " # "  $   #" "  $


% range            range      
        


         

range          

&    
        image 
 
   
              



              



       
 

%   !
 range  
&    
½

         preimage   
                 

  
     
  
½
           

½
'    
                 
  
   (  
        

  
 
½
              

       
½
     

Example 6.2

        ) " *      +   



 )   "    *  

%      
) " * 

)  %          

"  %       

*     
 ) "        ) *  

½
   
     
) * 
½
  ) * 
158 Functions

Exercise 6.2 (Solution on page 431)

   
     score 
   
   
 
 
  
    
 
! 

      " # 
  
 
  
 
 

  

Example 6.3

$


       "
    


%   

 &    


 id '     "  
     
  ' id () *  
  
      
 ' ¬Ò ( )        
  
  
       '  *  

       (& 
 %      %  

      )
+       % "        ,
 !

 
 
 "     
   
     
- .#     
 !      
  '
   " 

  /         '

  ( )
     
   
*
  

Exercise 6.3 (Solution on page 432)

  "     " 


   
    Humans  
     ,
       !   "%    
   

 
 ( )

    
 
  ()

   
  

-  ()

     

0  
 ()

   

  

Example 6.4

,   
    ! "
 % 
%% # % 

 ,
 !    ' Ê Ê    %
Basic Definitions 159

    ¿ 


  
 

Ü
  


       
    ¿ 

     ¿ 

       Ê           Ê 




!   !  "#   !  ¿  $   
  !    
          
 ¿
   

  %
 
 



&   
   #
#        ' 

'
 (    

  
      

)
 "#  " *!(       
     
 !        
   + 
         graph
  (  graph (
     
           
 (   #     
 *#           graph (
!#     ,  *!(   score  
  ! -*!  (

graphscore   ,   % ,   . +


 /
0
  - %    /
1   2
 / 3   /
&!
 . #  44 $

! % 5

     ¿ (

graph     ¿     Ê  
160 Functions

   
         
  
 
            
  
         
        
Theorem 6.4
        
        
  

              graph   graph 

Proof: 
                   
          graph      graph !

   graph     
        graph

   graph   graph         
        !
   graph     
graph   graph       graph         


Exercise 6.4 (Solution on page 432)

     
  "# $%&

6.2 One-To-One and Onto Functions


'
          
       
   

  
              
  (
      ) 
     
     
¼ ¼

* #  


    ¿     
 
      +   ,  +    ,
- 
      
   )  
  
        
 
Definition 6.4

 
     one-to-one 1-1  injective    
¼ ¼ ¼

                 

    
¼
      ¼
 ¼

            !  
 
   !  
One-To-One and Onto Functions 161


 ¼
    ¼
   ¼

Exercise 6.5 (Solution on page 432)


 
  
   
  




 
  

 


  
   
 

  
 score  Class  Marks   ! "

#  
  Ê Ê  $       ¾ 
%  
     $      ¾ 

Definition 6.5
      
onto surjective     
 

   
    range        
     
  


    

      

Exercise 6.6 (Solution on page 432)


 
  
  
 


 


 

 


  
  


  
 score  Class  Marks   ! "

#  
  Ê Ê  $       ¾ 
%  
  Æ Æ  $      ¾ 

& 
     
 
  
  ! 
 
!   
 $  !  
 !  


     




  !  !
  
      
   

 
!  
 
    


 
 ' 
 
   
  

Definition 6.6

    
bijection   
      

Exercise 6.7 (Solution on page 432)


 

          !
 
 
     
   
  
   
  

  ( 

162 Functions

  

¯ ¯ ¯ ¯ ¯ ¯
¯ ¯
¯ ¯ ¯ ¯ ¯ ¯
¯ ¯
¯ ¯ ¯ ¯ ¯ ¯
¯ ¯
¯ ¯ ¯ ¯ ¯ ¯

       
  

       

 
 
         


   

    
             
    
  
    
     
 
    
 
Definition 6.7

   


 inverse 
    
 



 
  
 

   
 
  


 ! "  
 ! "       ! "     

   


 " !


 
 
      
   ! " 

Example 6.7

  
 Ê Ê #   ! " $ % &    
 

! "  &!$ '
 (


)! " $ ) % & " *&
 

*&! " *& &!$ " )

+
       


  
   


  
range !     #      
 range !

Composing Functions 163

Example 6.8

              
 
   
   
   
         


          
 !
 
 
  
    
  
        
            
        
" 
        

      
     
    
   
  



 
#   
   

    
 $   

                 

 %
     &      
 
#
          &    
    &
    
& 

 ½      
'
 
"  

 
(   &     

  &
 
) 
  

       
'
  * &   
  
  
    
 
         
& 

 ½   
'



Exercise 6.8 (Solution on page 433)

  
&  

 + ,-

6.3 Composing Functions


#  &  

        

 

   
       

164 Functions

¯   
  
 
    
  

    
 



       
  
  

  
     
      
 
 

   
 
         

   Æ     
 
  


 
  Æ 
    

 

  

Definition 6.8
  
       
   
        

 
 composition    
 
   Æ      

  
 Æ       


  
   
   


 

  
   
   
  ! 




  
  
  Æ  
    
 
 
      

  
 
 

  "

     Æ 
   Æ    

 

    
      

 Æ       

Exercise 6.9 (Solution on page 433)

 
 
          #
$
%
&   
 


# # # #
$ $ $ $
% % % %
& & & &
Composing Functions 165

 Æ    Æ 
   
   

  
 


¾
 Æ       ·½ Æ    
 
  Æ Æ  Æ
 

 

      ¼  id  ½   


Æ id  
     
 
  !
! "
   



 !
! "
 #  
"  
 "
 #  
 
 

 
 

 
Theorem 6.9
       


    Æ   

Proof: $"  Æ    Æ  %

        
& 
 
  



   
$    !
!     
'      !
!      

Theorem 6.10

          


    Æ   
Proof: $"   
& 
 
  



  Æ 
 
 
$   
       
$  
  
 
 
'     
  Æ 
 

Exercise 6.10 (Solution on page 433)

(

          )
)* 

  
Æ   
Exercise 6.11 (Solution on page 433)

(

      )* 

 ½ Æ  id  Æ ½  id 
166 Functions

Exercise 6.12 (Solution on page 433)

 
             
        Æ  Æ    Æ  Æ 

6.4 Comparing the Sizes of Sets


                   
 
                   
                  
   
   
!
  
            
                  
                 " # 

  
     $ " # %& '    
  
  
       
     ((     
  
 )   
  *  + ,  -   $ " # %& '  
  .           " # 
 
         
 *  ' 
+  " #
,  $
-  %&
/   )          $ " # %& '  
   * + , -              
                   )  
    
           
0 
   )    1 #      
      
" #        )  
  $ " # %& '         
 
 2
&      
      

 

   ((           
    
                  

         
 0  
     
           &        & 

   
"     
 
Comparing the Sizes of Sets 167

   
             

                     

                   

                     

    !      


            
                        

                     

                    

   !              


                         

                      

                    

        " #    $    !   %  

       
           

              &       

           "       


      
'  
            

Definition 6.12
     
 
   
 
   
     
 
  
 
   

 '    
 
    
   

(        !        


  "    ( !          

            !  ( 

        "        

   

Theorem 6.12
           

 
   
 


      
 
  
 
    

Proof: )

      **   !    

 ¼   Ý &   !         

    range# $    ' 
# $    +        !

 #$     +  ,
    range# $     !  # $   ¼ 
Ý    
¼
                     
                     
168 Functions

  
 

    
     

 
      

 
        

           
       
   
       


 

Theorem 6.13 Schröder-Bernstein Theorem


         

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

  
  
    

     
 


     
     
   
   


  
  
 
    
      ! " # $ % 

        ! !
& ' 
  

  ((     )  * '
  
 ++
,'  

 


Exercise 6.14 (Solution on page 433)

-
 
*   ½
     

    
*

.,/+ " 0

Exercise 6.15 (Solution on page 434)

1 *       '         



)
* 

            )   
    

      
  ,/+   
2           )
         /  /     / 
 
 
  3 
)     /  
    

/' / + '  
)   /    / 
 
Comparing the Sizes of Sets 171

  


 
   
  



 

      


  

 


 
 
 




    
 
 
 
  
     


 
   
   


  


   
    
  


   

   

  
  



 
       


 



 
  


    
 
 

 
       
     
 

  
  

 
 
    




Example 6.15



   
  
    
  

 



  


 
 

  
  
 
  
  


   
 
    

  



 

  


  
 
 
 

  
    
  ! "  
  
  
    
  ! #  

 
  
    
  ! $  
  

    

  %
&$ 
  
 ''       
 

  

  %
&$  
   
 

  


 

 

 
       

 
    

(

  
    
  
 
%
&$)  
  
   
* 
 
   
+& 
      

 



    $#


    
 

, 
 
  

- " # $ + . & / 0 1 "-



" # " " $ + $ # " " .
" " # $ " " # $ + . "


    

         
  

 
 
  


 

 
   


''     



2*
 
      

  
  

   
    
172 Functions


    

   
   

      
    

      
   

      
    

      
      


    
     

Exercise 6.16 (Solution on page 434)

             

Example 6.16

    !  
      
     
    "   "    #       ! $    
%&          & %  %    
  
    
 

  
 


 ¼½
       
  
 

   
   
    
 

   
  
     
 

   
 
      
 
  
 
         



        
    

       &  
 
     
 
& 
  '  (  %   $  "    % 
 )     &
The Knaster-Tarski Theorem 173

    
           
     
  
 
 

   ½  ¾       

          

      

       !   "   #


  !
   
  !  

$     !         %    


&

       

    '    
      !
   (
!
   #
  !

                    

$  "        
   "   
  
 "   ) *+
  ,        & "    
 
 -     
 !        ! 
+
  
         
    

   
  
 .   
 

Exercise 6.17 (Solution on page 434)

/   
    !     
  

  
    !          
0 

( 0 /        0       #


 !
  


!



6.5 The Knaster-Tarski Theorem


)      +   
.     
   


    +   ! 
     "+  !     ! &
 "    
 !     1    
 
 

!
     "+  

Definition 6.17

    
  0                
     

   monotonic    
             
     fixed point      
      
174 Functions

¯    greatest fixed point    


    


    
     
  


 
      
 

    least fixed point    


    

 

  
     
   
 


      
 

  
             
             
   

Example 6.17

       
                    
      
 

Exercise 6.18 (Solution on page 434)

!
 "                # $  %"   %

  %"       
 

& %  % %        



    '" "

Theorem 6.18 Knaster-Tarski Theorem

         

 
     
  


   
 
   

   
Ë     

   
Ì     

Proof: ( %       


     
       
        " ) " #$
 #*+
&     G 
Ë         &' (

 '    G  G  %       G % '
       G
,    G -  
  G  '       '
 "     ."     / G 
      "     '"   %  
     G ."    G  0 
  % '    "    G G
The Knaster-Tarski Theorem 175

 

G G 
      


G  G 
  
G   
  

    
    G 
 G G




G         



       
   
     
         
  
     
  
 G 
  G 
!  " 
            
" " 
   
 

       
      
      
        

Theorem 6.19
     
    ½   
    
     ·½   
      

   

   
Ë
 ¾      

Ë      
¾ 

    # ·½     #   


     # ·½       #   

    #      #   
   #   

Proof:        


          

     
   $  %&   %'(
) 
     ¼  #    ¼  ½   ¼    
) 
      
   ½    
 ½ 
  

   #   ½     # ·½  * 


    #   ½      #    


      
            
      
         
   

       +

# ¼   ½   ¾       # ·½   #   

,             


      

       " 
     *
      
176 Functions

  
            

   
Exercise 6.20 (Solution on page 434)

        
               
! "   
 #    ½    ·½       
$ %   &    
       
 

6.6 Additional Exercises


! '     (   (     &&     
              & 
      
                 
     &  
     !  $ )        
(  & ½( ¾  ¿ 
          &&   
graph ½    !
    $  )  
graph ¾    !
    $  )  
graph ¿    !     $  )
 

'           **(    ( 


    +  
$ ,    &          
 **    
     **
 **  (         &    &
   **  
) -  &&           !  $  '   (
         **(    
 
. %
      / !0   !    ! 1 !  
!    &&     1       "
   + 
Additional Exercises 177

 

     
     
   
 

     
     
     

 Æ   Æ  Æ   Æ   Æ   Æ  
   Æ  Æ   
  ¾       
 

 Ê  Ê 
 !
"  
#         Æ id   id Æ 

id         #          

    
$ %            &
" 
&
"


 '   Æ 


(  ) )      (  ) ) 
( '    Æ 
(  ) )      (  ) ) 
 '   Æ 
(       (  
 '    Æ 
(       (  

* !
"          (      ( 
 ' +,& -     
       
      & "
  (
 (# ..

 / 

# 
  (
 0 "
    



  (
    
   
   

'  ,
  ,&
 
 " &&
   " 
& 


)1 
  
2    
  (#
 
  
  & 
  (
  & (  


   (
 (  
    
 (
 (  
  

%
  "
# & "
  (
&& 
 , #   

 (# 
     
 

 +"
#   (   (# 
  (
   

( +"
#
  (
&& 
  


 3
  (
&& 
  

178 Functions




  
  

      
      


  
 
  


    
  
  
     

    
 !  

 "
    
 !  
 # !
  $  L   % 

    %&   !
 '( "
    
 !  
 ) ' $(
'( "
  !


      
 ) ' $(
Chapter 7

Relations
   
            
 

    

 
      
   
   

 
      
    
  
 

  
  
     
   
 
       
     
         
 
   
!    
 
  " #      

          "




 #     
 
      $    
 
  !
 
   
%       "  # 
 
  

          


  &
 


  !
              "#


 
              
  
 

7.1 Basic Definitions


    
       
   

 ' 
( ) “student , in course  , scored a grade of

      
  

        
             
   

!  '   (
 
    
 
        

 
 *       
 


 )  '   (  
    
     
  

+ -ary relation 
           !

   


    '
  ,  ( 
     

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_8, © Springer-Verlag London 2013
180 Relations

 
  
             

   
           
 

       

Example 7.1

  
    ! http://www.imdb.com   "  

#     
  
        $ 

% #    #           # 

   #    !  #     

       

         & '      (

) $               

                


 

           *( )+   


#

   

 
         

  

 , $  -

 ,        -

  ,   -

    ./    0 !1

/' ,   '34.  5 6   7  !


2

/. ,     '348  5 6   7  !

./ , 59   ./'.    6   5  !


     #              :   ; 

 #  #   :      $   #  ( )

$  <   #    :  #       

 1

 ,     
 1   <  
,       
/4 /& /= '/  '' 

Exercise 7.1 (Solution on page 435)

>  #  #  :        


    (

)  
Binary Relations 181

Title Year Star Director


    
      

           
        !     " # $
 %  &  ' ( "$)"   #   *  + $  , &$
 $ 
   -" . /   !    # & -$
  0 1 !! ,  '  " # $
  '
 ! ' 2  ! ,  '  " # $
 3 /  4 "  3 ,  ' 5 # 
      3    6 7 " 
   . 
  $0"" 3 ,  ' 5 # 
  . 8 $ 7 3 ,  ' 5 # 
 
   $" 3! -$  $ 5 # 
    $ 7 3 -$  $ 5 # 
 % #  4  +  9"  ' $  -0 
  -     " ! +  9"  , 
0$$" 
   1 6"  +  9"  '  .0$ 
$ 4
 !  .$   

+  9"    - 
 3  " , 
     ' $  -0 
  : $- ;  
3      '  /"$ 

2; 

     - '  "

 
   

         


          !

7.2 Binary Relations


Binary "  # $ %        & '  #
  ' &    &  (&  
¯    
     #
182 Relations

¯        

  

¯       
        
          
        infix  
        
    
                
 
       from    to           
     source  target
   
 
                         
on    
        homogeneous
   
                 heterogeneous 

Example 7.2

                  !


  

        "
     "   

 # # # $ $ $ # % $ % % % 
           
   
       !      
   "

   
  "      

                  


        !          "

     "      

Example 7.3

&  !       '   ( )  !     


     ( *! !           (
   !                 
         

  Children  Flavours


 

Children  &  )  *!    


Flavours  + ,   ,'  ,  - 
       "
Binary Relations 183

  
  
    
    

  
   


 
  
 Children  Flavours
    ! "
 

#
 

 
 


 
$
 %
 &  ' 

     ! "


    

Exercise 7.3 (Solution on page 435)

($ )

 
' $  *  &  +% ,"- )!

'  
  
     &  '
 
  
   *   "
   

*  
   ' ! %
 ' . ) .  
/
 )
 
 '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


      
  !   "   
  
  
       !
  
 # 
   
 
  $ !  %      %      

 
#
  $

 & "  ! #

    ! %  

   '   
      '     

 
 #$
 

  & "     "     

  & !    !   

  !    %      

  & "     "    
!    !   

  !    %      

 & #    #   

  !    %      

Exercise 7.6 (Solution on page 436)

  

             

  (  )*     
     

7.2.1 Functions as Binary Relations


+
'        $       #     
      
          
  *, 
 

             #
$

graph  &  
   
  $  
&    
186 Relations

  

     
 
  
  

    
  
  

 
  

  
      
       

 

  
 Ê    
Theorem 7.6
  
      
    
   
  
  

        

Proof:
 
     

 
 
  
  
 Ê         

 !   
 

    graphÊ "         
  graphÊ   Ê  "     
graphÊ
      

    " graph   


     
   

 
   
    
  

   

7.3 Operations on Binary Relations


#      
   
 
$       


     
    #

    
   

      
   
 
 

 


 
   
   
 
  
 

 
 ! 
7.3.1 Boolean Operations
%   
   
  
   

    


 
 ! 
  
  & '  ( )* 
 
 
  
     
  
 
    
 
 "    

  

     

        
 


 
  
 
 

 
           
    
  
Operations on Binary Relations 187

   
           

              
    
  
 


       

  
         
  
              
    !   "     
  "
    
           
# 
 $%     
         #   $&
Exercise 7.7 (Solution on page 437)

'   
          
   
 
   
      
½ ¾ ¿

     
          (
½
¾

          (
¾
¾

          
¿
¾

      )


*  ½ ¾

+ ¿ ¾

, ¿ ½

7.3.2 Inverting Relations


-                   
             .  
 


       


 
     

 
 
        
 (  


                   

               
-                    inverse
             
½

   
 
  
½

!   
   
           

   
    
         
½

     
     
    
   
    

188 Relations

Example 7.7

 
     Children  Flavours
      
     ½ Flavours  Children
 

  ½

       
     
       
       
! !

    " #  ! $             "


%  #!   $   ½           &   

Exercise 7.8 (Solution on page 437)

'     ½ "  


      (

7.3.3 Composing Relations


 %  )     )"    )     &"
  " %    &
%*  %    +   
  
        
    "  composition

        Æ   
    , 
 Æ -  # $         )  
# $   #  $   

.
%       
      " % 
      
 Æ   &
%*  /  %
&   /  %"   
%*   


   

   

   

   
    
Operations on Binary Relations 189

      


           

            
   

   
 
         Æ   
       

 
       
   
     
 
                        
   !
Example 7.8

                    


      
  
  "
  Æ  
#         
          
  $ % 
               
           
  Æ
  "
  Æ  

Exercise 7.9 (Solution on page 437)

   
              
 
    
   
     & 
  '% 
 ( 

7.3.4 The Domain and Range of a Relation


)   
          
  domain    
domain* + "            * +  ,
  range    
range* + "            * +  
#         
      


     
   
     
           
    
      


         
 
   
       
Example 7.9

-    

  
        
190 Relations

 Ü      
   
 
       
 
    



domain        not    

range        all   

domain 
           
range 
          

Exercise 7.10 (Solution on page 438)

                


     

domain 
         range  range 
   

7.4 Properties of Binary Relations



                   


                  


                
7.4.1 Reflexive and Irreflexive Relations

!      
      
 

               


   
    "          
    #  
$  $    $ $    
    %  

Definition 7.10
  
 
reflexive          

  

  
   

  
  
  
irreflexive          
  
 


  
  



     
       &  
   
     &   '    &   

    ( &               


Properties of Binary Relations 191

    


  
 
 
       
  

Exercise 7.11 (Solution on page 438)


     
        
        

7.4.2 Symmetric and Antisymmetric Relations


   



!  
    
!  
 "
     
  
#$     ##  


Definition 7.11
  
  
symmetric       
  
   
  
    %    &
  
antisymmetric       
   
   
    

    ' 



    %    &   '  

( 
  #   
 $    
   
   ' 

  %
 

 &

Exercise 7.12 (Solution on page 438)


     
 
  
   "
          

7.4.3 Transitive Relations


    


  
$     

 

    $
       )
    
  

     $  
( 
##   
   
 $$    ) ## 



Definition 7.12
  
  
transitive       
  
   
 
   
   

     %     &    
192 Relations

 
           
Exercise 7.13 (Solution on page 438)

       


           
 

Example 7.13

                


!     "
   # $         
$        "
 
%   #   #  #       
 #    # 
& ' #         $  #   #  $
           (  $ $  )
   #          
     $   *    +     )
 #    #         
  $   *            , 
   $      #      
 

Exercise 7.14 (Solution on page 439)

      

 
  
 
  ,   
     $       "
   "
  #  )
#  -    .# # $ 

7.4.4 Orderings Relations


/     #              
  ,   '
  


 
   
              0  1 2 ! % &   
3               # $      
       $ #    1       
        #     ,       
          $       ,      
    ,    3  # 


 
    
 1
Properties of Binary Relations 193

¯   
      
     

¯  
     
          


            

¯       
        
  

      
   

                     


            

Definition 7.15
  
     
  partial order        
 

 
 
 
 
  total order        
 

    
  
  
    


      !

Example 7.15

 "       #                
    

 " 
                  $%
                   !
       

 "                       
     &    '     '    & 

7.4.5 Equivalence Relations


(  
      
           
                    
          
         

(                      


                    
            )  
     
  *

   
           

 
                 

                     


    
194 Relations

    


Æ          
Definition 7.16
  
    
  equivalence relation        

  
 
 


Example 7.17

¯  
       
 
¯  
  
        
 
        
  
  
        
        
        
   
        
      
  

Example 7.18

    
        
    
            
     
           ! "    

    
            
#   
    
         
                $
  " # $            
            

Exercise 7.18 (Solution on page 439)

%                & %  


  & %   
 & '  
 
(         " # $    
) 
      "
 # $
    
*        "
 # $
 "
)# 

Exercise 7.19 (Solution on page 439)

      
     +   
  

      
 ,           $
Properties of Binary Relations 195

½ ½  ¾  ½  ¾ 


 



¾  ½  ¾  ½  ¾ 
 


 



  





     


7.4.6 Equivalence Classes and Partitions


 
 




   !
"#$ 
%
 
 


   !
!

      
&   

 
'
&
  



     

 

    (

  )  
   
  
 
Definition 7.20

partition       

             
        

   
          
 Ë ¾  
  

    

  blocks         




   
%

        
   
 ! 
 "      
 !     

Example 7.20

'
 
%


   !
"#$ & !  
!
!
 
 (    
  
 & * &  
 
*
  
 !  +, ! - 
!
* 
 
!     
  

   
&    .
!
&
 )  
 !  
 
   
%

  
 
 ! 
%
   & &
 

Exercise 7.21 (Solution on page 439)

'   
%
 !  
 *  


    &

%

  /

 ! '   

 
*
  %
 !
 !  
    
%




* 
(  
 
!   !
"#$ 

 





 - 


    &





 *    * 

!!
  

&   
!    
 * 



196 Relations

  
   
     
  
 
 


    

Definition 7.21
   
          equivalence class  
       
   Ê         

        
  Ê        

Theorem 7.22



    

 Ê         

           
Proof:     
  
   


 !  Ê 
 

 

 
    Ê 
"       #  




 

 
     
   #  

Ê
$   #  


  
%     
  

#  



  #

 

  
  


     Ê   Ê    
  
        %   
        

   

       
  
     
 

    Ê
  
   &  
 
      '
   Ê 

 
 
     Ê  Ê  

Exercise 7.23 (Solution on page 440)

(      #  


    
  

  

 
    !) 
 *" +

Exercise 7.24 (Solution on page 440)

,      
   " $    "-   
  


  $.   
Additional Exercises 197

Ü     
           

  
    
                
       

     
 
 
!   
 
        " #    
 
 


7.5 Additional Exercises


     

!$ 
%  &  '  
   
! 

      
( )    * 
  +
, )    )         
(
) -  .    / * 
   .
     !  
( 0   *   ,  +
  
     !  
( '   * 

         


 #       

    % 


% #    
   
     
 &1   
       
 
 &1   
      
     
%  
  
   
 &1   
       

     %  
  
   

 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

Inductive and Recursive


Definitions

   

 
       


   
 
    
 
 



 
     
      
 
           
     
  

!          


 
    

   
  

     "
#  



 
  $ 
     

 


   
  #
    
   $ 
 


  
      
 
  
  
  


  
 
           


   


   

    
   

  
   

 

     
 

  

     
  
 



    
       


%         


    
  

    


          
  


 &      #
      
    

   


8.1 Inductively-Defined Sets

                   

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_9, © Springer-Verlag London 2013
202 Inductive and Recursive Definitions


 
  
      

 
           
      ! " # $ % & 
Children ' ($ )  *  
+#"  ,    #  "      !  - 
$ . !     / ( $      ! 
!
  
# # , - %.  0      !  %   
  $     !   %   #  % 
   %     "  1$ 2     /
+#"     ,     ! #   /
/ +#   # $ 3    % -!  ! . 
   !  ! , 4 *  "%   # #!
#  "    $  !       
  /
/ +#   # "       ! !%  ,
! 4 ( $   !    " ,   %  
        -  !    .  
  -// ! .   !     5     - #
   

   #!   %  ! " !  ./


/ 6   # #        "   #
         1$ 2    4

/ +#   #   #  
  %     # 
, #      %   4
)  % # %  ,  ,         "
     #    $  / 6  
  %  # , /
Definition 8.1
 inductive definition     
  
   basis clause       
   
   
           

 

 
     
   inductive clause             
    
  
 
    
     
Inductively-Defined Sets 203

  extremal clause  


 
  
  
       
  
    
  
               smallest
  
     
  

Example 8.1

   


           
 


 


   
       
         
! "
  

   # 
 


   
  $
        
    
     

     
#  
          
       % 


      
       
       
    
   

      & ' !
      
 
    
   
      ' 
     


     ' 
    
  

  
    ' !
          


 
#  (                
 
  
              


       
    !)
     
 
         
 

  *


    %      
       

       +      
  
     
, 
   
        ! -     

       

 #  
 
 
  
     

         
% 


     
     
Exercise 8.1 (Solution on page 440)

.( 
 



 

    -  
 -/   
Example 8.2

 

   
204 Inductive and Recursive Definitions

  
 

  
  
  
    
   
        
 

  
  
!"   # !
   
 #
   
! 
   $   "  $        
  
 
 

   # % #
&    
  #  "   
  #           

   # % #



#
   ' #  
%   
  #    
 #
&
% " 
% 
#  
 %
  

Exercise 8.2 (Solution on page 441)

(   
$   #
   $    & 
" 
#
  "
  #
     %  #
   '  
 

 ! 
  )

Exercise 8.3 (Solution on page 441)

*%
  # % $       
 !   "
 
  + , -  -+ 
      

Example 8.3

*%
$    "  #
$   !        # %

  

 
  
    
     


     
        
      

. 
!"     "    
 #
     "
 
  

 
!!#
     # % #
   
    
 
  


           
(
!!#
 %
 

        " 
 
 
   / # 
!!#
     # % #
   
  


 
    
Inductively-Defined Syntactic Sets 205

           


                  
                 
                 
 

                  
          
    

  
                        
        
     

   
   

Exercise 8.4 (Solution on page 441)

!"
    #       #   $ % & !"
   #     
     
  # 
'( )$

8.2 Inductively-Defined Syntactic Sets


              #    
    *
     

 "  
#   

Children   +   ( ,-   

   -
                 


    
 -    
#

   '
   
    "  " 

*
              


   
 
.   "    /          /   
                 

    -
        "        
 

    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

  
        
   



       


             
        
      
 
   
  
                  
 
  !       !    
 

                   
 "   
    
     
 
 !    
  
 !     

Exercise 8.5 (Solution on page 441)

#
   
       
      

   $    
   %  
&'    
  (&'    
 

8.3 Backus-Naur Form


)         
         
    "  Backus-Naur Form (BNF)     "
               



 
   *+  
 ,,!   
      "   
  
   *+  
 ,,!   
        -    
     .   
*+ 
  "         
    
)               
% (   successor function  ! /0 1    
    *+  
 ,,! (  
2       3       (
.  
              
 
 4  $  .   
  
      
     5          
208 Inductive and Recursive Definitions

Example 8.5

    

       

     
  

   

 true  false   

    
    

 

   
      

              
   
  
    

 !"# $ 
   

   
 % true  false            
&  
  '        

 
 

Exercise 8.6 (Solution on page 441)

(


 

          
  

!"#  
  
 
)*)  + ! ' ,   


 - "  .       /   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 ¾  
 
 
   

    ½  ¾     


  

               ½ 

  true        ¾  
  false


¯ 

 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 

                    


             
     
                 
                      
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

    %            %    


    &               
         ! 

8.4 Inductively-Defined Data Types


'              ! 

       #     ( $    
Inductively-Defined Data Types 211

   
          
     

   

!         "       


#$ 
  
             
%       empty list  &      ' 
                & '
    
   ( ) *    
 "    
  (  )  *                
 
(  & )  & *   ' '
+        
       ",
         "        " 
  
-    
            
     "    

Example 8.7

.   "   binary trees         

    &½   ¾ '

%        leaf    in- 


ternal node  &½  ¾ '      
½  ¾    
      
 & & '  & &  & '' ''  
 
  
  
 

%         


"       /
   
           
 
dictionary    
           
&  '              

 &
  '     
    
            
  
 
 "            

 0  +1 -

  "         


212 Inductive and Recursive Definitions

 



  





Exercise 8.7 (Solution on page 441)

  

    
 
   

   


  
 
     
       
   !  
  
        "
 
  

8.5 Inductively-Defined Functions


#     

      
    

       $   
 
  ! 
         % 
  !    


 
       
 
 
  %     & 
¼   ½               

 

     
   % 
  
 

 !      
  &       
     
Example 8.8

$ factorial function ' 


 
   
    !
 (  )
' * (+,   

- %   
 

   
.' * ( 
' *   / (0'    .
$ %   %
Inductively-Defined Functions 213

   
    
      
        
         

  
 

Exercise 8.8 (Solution on page 442)

           ! "

¼ 

   ½ # 

   $        %

Example 8.9

& harmonic numbers       !


# # #
    
# 

  !      '


 
( 
  
#    



Exercise 8.9 (Solution on page 442)

     !      '

Example 8.10

& Fibonacci numbers       '


 
(
  ( 
     #      
& )   !     ! ! $  $ 
    !   ' &   *!   ! 
214 Inductive and Recursive Definitions

            


              
     !" #  ! $ # $ # "
   % &         ' ()#   (
  *%      +    & #! 
    Liber Abaci     

 "  " %# 
     
 $ # # %%      
  " & %# %    #!

Exercise 8.10 (Solution on page 442)

,%%     %   "(# ##         


   %   ##  %  " %   ##     
    '"  %   ##  "       
     - ./!    0  "   !   % 1

 " ! &      #   0   


 )    #   0     
2    successor function .1 3 4      
 0  
 #   % 5% 
#    #    0  %      6 


Example 8.11

7   &      0       #

 883 . 1
 

 &   %&  9 "    0    

 8     

"   " #  " 8


. 1 3 : 
. .11 3 .. 11


 0        4 3 :      
    %  "  "  & "  " "   "   8

. 41 3 . 1 4 


   5%
Inductively-Defined Functions 215

     
 
  
   


Exercise 8.11 (Solution on page 443)

          

    
          !     
        "

#         $  $  $%


 " &            $  
           "

Example 8.12

& '     



     $  "
    


         
  

& '              $  "


 ( ) 

    
      
 

&  '    $       $  "


 ' 

 ' 
½
¾     *  '
½   '
¾ 

Exercise 8.12 (Solution on page 443)

                


      " +    $    (,  )  "

Exercise 8.13 (Solution on page 443)

& append   ½ ¾ -     ½  ¾ '" .


*  ( ) ( /)  (   /)"         
  "
216 Inductive and Recursive Definitions

Exercise 8.14 (Solution on page 443)

  
                  
                 


!              


   "


   
   

8.6 Recursive Functions


# 
 
       
      
    

           
  $     
      #            

   
      
       $  
  
   " 
%
 $&         recursive func-
tions 

$  
 
            
       
    
      

 '    $  '   %
  $   "
&    

 (       !    
    "$   )   * + * +,  
  - "     $ 
    )  + * + )   *  )  . * . ) 


Example 8.14

/ 0
$- 1+&     2        
   +    +,
   ) 
   * ++    +
3
       $   "     $   4   

   Æ     
 
    &   ' 
 

         
  #        ) 1+  

  +    ) +   
  +

Exercise 8.15 (Solution on page 443)

5  
 / 0
$- 1+&       $   ) 1+   

  +    ) +   


  +

Example 8.15

0   
         2  
Recursive Functions 217

   

 
     

      
         
   
   

   

    
 

          !   "   #        

 #        

    !   "   #        

 !            !   "   #        

 $        #   $   

  !       #      


     !   "   #        

 "   #        
 %&'    
      (  )    
 
  '
   
    

        

*  +       (  ,     -    .   


 ' '  &

      

   '  
'  /( 0     + .
         & !   .    
      + 1   .    !+   $   .
   $ * &     .    !   ( 
     $ (
+ (  &          .
   $+   .  .  1   .  '   
 %   '   .
*   &                 + 
+ 
'  %      ¾   ¿     
' 
  +
.   (      (   

 $!#      $!#     


2 Collatz conjecture    
    %  

.    .     .
 
218 Inductive and Recursive Definitions

8.7 Recursive Procedures


   
    
 
   
 

 
        
   
  


   
  
   
    

   
  
          
 
 
 
  

    

   
     
Example 8.16 Insertion Sort

 
     
 
 



  
  
 
   Insertion Sort  !   "
# $ 
          

  
 
  "


      
% 
        
     

 
& $    
   


 


 !     
 
       

  
 '   
!
  
  
 
  

( %"   


         
  
   
    
  
  

   


     

   
   




  
     
  
  
 
 

  "

) * + )*

 "  +    


 

    ,

  
    

  

  

    ,


Exercise 8.16 (Solution on page 444)

-    
   
 
   
  
.  

   !   "
   ) * + 

    "  +    
 

.   

       !  /% 

 ,      0
 
        
Recursive Procedures 219

  
           

   

   




   
         


  
   




   
      
  
      
     
  
 
 
    
    
 ! 
" "
 
   
 
   
  
  
    
  
#
       
 
     
  

     $ 
    !       

" "
  

           
 


  

  %  
   

% 
 


 
 
   
  
   
!    
   



Example 8.17 Merge Sort

&
 


    
    Merge Sort  
! 


 '

 (   
 

        
  

'
      
 
$ )        

*" +   , "
"  

      
 

 
  -
. 
 
 

   
/ 0  

   
 

   
  

 !  




    
 
 


 

    #  !    
     
  $'  
 " +    
     
 

     
*" +    , -
   1 
  
 
  1 
    


 
      
     




  !
  2
   
  

 


  
        
 '

 (  

            
   ! 
 

  


$ )      

*" +     
  


 
 

 
      
. ! 
 
 !      ! 


3
   
  1     1   
  
 
/ 0   

   


    

 ! 
 

  


220 Inductive and Recursive Definitions

 
      

Exercise 8.17 (Solution on page 444)

       Towers of Hanoi    


                
             !    
                
     "             #
                  
       
$             %
            %  
  &

8.8 Additional Exercises


 '    (           )
 *          
  +  & ,
'       
  ( -
. '         

,- /  
,-     ,01-   ,02-  
,- 3           
  
4         "   
        " )        
    
'            &
Additional Exercises 221

  
 
   
 



 

      
     
       


 
       
    


       

       
   
   
 

!    "
  
 
 "
     #
"

 "   
   
 
   

 
   
     $  %& '
 "


 



             ( )

)   *+, -"


   
 " "
 
"
.    "
  
 
 "
 
 
  
/
 
        $ %&   " 

     
   "
    
   
 
 

&    "
  
   "
  
/  " 
 
   
"  -"
"    

      
  

%    "
  
 
 "
   
/  


" 
  0 "      1 2 !3  ( 1! 2 3
' "  

  "
   1 2 !3 
4 5  
  "
      
 "


 ,  
  
     


   
 0  
        
," %2 6  
      




 /7 6  
 
  7
    "
  
 
 "

  "    

   8"  

   " "

   
 
  


 -"#9 
      


 
 
  

 :/; ,"
     "
   ,  


  ( < =

    

   (
   

   (
 
  
222 Inductive and Recursive Definitions

♀ ♂ ♀ ♂ ♀ ♀ ♂ ♀
♂ ♀ ♀ ♂ ♀
♀ ♂ ♀
♂ ♀


 
     ♂    ♀ 

             


!    "# $ #   %     ! &   
   
  '(   )    "       
"  * + 
 '(   )            
   * +&
 '(   )    &       
&  * ¿ &
 '(     ! "
Chapter 9

Proofs by Induction

   

   

   
  

       

 

       

      

       
 


               

    inductive reasoning           

                  

    


   !          

            


 

"  #$      %     

   ÜÈ &Ü'      Ü           

        È &Ü'     (    


    Ü             (     

        )    (         


                       

    

9.1 Convincing but Inconclusive Evidence


           
  Ò     
Ò&Ò*+' -
,

Claim: .  Ò  / +*,*0* * Ò 1


Ò&Ò*+' 
,

2      


  3            (

   + * , * 0 *    * /      /

4     
         Ò-

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_10, © Springer-Verlag London 2013
224 Proofs by Induction


   
 
    

      
 
    

      
 
    

      
 
    

     
 
    

              
 
    

 
 
     

  
  !! 



 
 
" #     $
  
 %& 
      $
 
 
       "
'     
  & "
¯ 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

  
               
         
¼  ¾       
          
           
           
          
!" " #  "$      
 % &
 

          ' (' (  (


   ")
 " " ")  )   ""  "  
""       )     *"  +
 "  "
          " 
'   ,, '
  #   -"           
. ")   -"   
   "/
¯ Goldbach’s conjecture #      
 
  )
     %     " "   #  
" # )       "
 " "# "  

  " ,  . #  ,,, ,,, ,,, ,,, ,,, ,,,/ 0   
 " -"#    )     ) 
     "
   " "    "- "  " 1 * 2 "#
   )
 " " " "#  "    % "
%
¯  ((#   3)      4") 56"  "$  
" . # "   ,7/ "         )

 
    "   " " %# 

     "  "   "#  "# 
"   ¢¢ .    "/#   '  ¢   

 ."/ "   " 0    (,1    

" 56" 1 "$     "$ 
  " 
  " 8,,#,,, 3"
# " "   
&)" ) 
&
# 56" 1 "$  "
  (8   9 0  3&
)"
  "     "   " "
 " ¢,
.  #   ""    :"/       " "  
 "   (,  , 
¯ 9"    "" )  
226 Proofs by Induction

 
 

½ 
 
¾  

  

   
 
 

 
      


          



         
                
     !        !  
    !           
  "              
   
# $ %&& '(& '% ((  (& ))' ))$ &(* '+'

   !       ,         -


           .      
              /0  1 
2, * &      3 !  .       
   $$$  % 4           -
   !   5    5 !        
     !     

Exercise 9.1 (Solution on page 444)

4  !                


              !    
6                  
.  .           7
 ,   $ ( )  &         
$ ) *  +            
  
8       !    ,  7
A Primary School Induction Argument 227

9.2 A Primary School Induction Argument


   



 

    


  
              
 

  


 !       
" # $
 %

  


          %  % &
 "
' 


  !   !  
     ( 
 $ 
  
  !   !
  
     )  
   " *
  !  !
     ! !" # $   !  ! 
 

%

   
  % (  
    + 

    % &
  +    

      %"

   !   (
 !
     !
 
     (     !  "
, 
  
 &

    !  
   ! )  
 !       !  
   " ' 
 

    
  " ' 
 
     &
 
  
 -  .  " /   
 
 
  
  !   0
        &         %  &

 %&  &

 
 &  %
  
 
 &  1


 &1

,   
   
 ( 
 $   



  
  ! 
  % ( 

   
%&  % 
&  $ 0
     %" *
   ! 
    
 (  !

    
&"
2

      !    
 
    


    ! 
  & ( 
   ( 


   ( 
  (   ! 
  % (" 3 



   
      & 
  " 4 ! 
 
228 Proofs by Induction

 
  
  
       
  
     
       
   

     
     

  
 

 

! 
   

  
 
 
   

  " # $ 


 
 
   

  
   %           

    
 &
  '
     
  

   ( 
    

        


      )  
       
 

      
!  
  * 
 
+            
 
 
 
   %
            

 
    "  

Exercise 9.2 (Solution on page 445)

,


          
    #

Exercise 9.3 (Solution on page 445)

,  
 
    



 -
 .  /


        
    011   

     
  
 
 +     
/
 !   
  
 ,
!    
/
  #

9.3 The Induction Argument


2
 
   !     !   !3  
 
 
      
   !    

  
    .  
 mathematical induction
   
 ! 

    & '  

  ¾     
 


 4

0 (Base Case)       !
 1 
   &1'%

 (Induction Step)       !
 50 !      %

 

 &' µ  &50'
The Induction Argument 229

 
     

        inductive hypothesis     


    
   ! "#    
         $      
¼
%  

     
&       #  #      
  # #       '     # 

       (          )
*       #   '      
+ +      ,   #    '   
  #          "   
   #    #         
           
-  .         "  .  
 
        '   # $
/"                   
    "   &  #         
    #'             # 
     $ /    .         $ 
      %          %    
     0%            
           ,       
#       ##    #   0
*   .      #     

    1     # #          
   1             $%    
                & !   

   2 ,    $         
230 Proofs by Induction


 

   

   

              


   
 
         
  

   ! 
  
    
  
   " 
 # 
 
   $   
%
       & 
'(      )"    
 ( &  %



 (  
  ( %     )  
 
  
  (      )" *  
 
  %  
     
  (          &  
% 
 '   &     %  $  +
 $ (
       (  %

   
   

Example 9.3

Fact:     


, -
!    
!


Proof:     

Base Case: #  


, -
!      
!


Induction Step: # (


    

, -
!   
!


  (
 (  ,
  &

 - % &


, -, !-
!   , - 
!

The Induction Argument 231

  
           
             
  
          

 
         
    
!   "              
# # 

   
    

   
     

    
   #

 
 
$    
  
     #  
 %
 &    


         


   


   

   

     

'        
 (     #   ) 
*     *  +

 
     
   
   #  $      #        #   ,  

 # 
  
Exercise 9.4 (Solution on page 446)

*   
       #   ,       -
 ¾  ¾  &¾      ¾  .  
   &  /         ¾
232 Proofs by Induction

          


 

Exercise 9.5 (Solution on page 447)


            

¼  ½ 
 ·½  
¾ 
          

!    "     #     $    %


&       $

Exercise 9.6 (Solution on page 448)


               
  
·½
    ¾  ¿    
    

'             ·½ ((      ((  


)*           "         
    
    ¾  ¿    
 


  "       ( " (  & + "
     $                " 
"         , ,(   

Example 9.6

Fact: -    ( $     . (    (  


/  %(  0%( ( 

Proof: 1    

Base Case: - %( (   0%( ( 2 ( . (


Induction Step: -     "       (
$ (       . (
      0%( (        "  
(    %( ( *
 !     0%( (           
  %( (      *  "     %
(     0%( ( 
The Induction Argument 233

  
      
 
  

   

Example 9.7

Fact: 
    
    



    
 !
Æ
  
" #  
convex    
$   
   
  

Proof: %   
Æ
Base Case: 
    
    
 ! 

Induction Step: &

     


 
 
"'   
    
    



   
Æ
 !  
( 
  

 
     
 

)   '   
    
   
  


   
Æ
 !  
#  *   ) 
   
 * )    * $  


     


    
 
 * 
 

Æ
   
     !   
 
  
  *  )  

 ! 
Æ
 !
Æ
+   Æ
! 

Exercise 9.7 (Solution on page 449)

,
    
 
      
    
)
  
    -  )      
 

      


¾

 
 .  
    
 /       

 





 
 
    0 ,   
    )$

    1  
  
  0 ,
 )  )    
  *
  )


  
  
  



234 Proofs by Induction

 
       
      


Exercise 9.8 (Solution on page 449)

   


     
 
function 
if  then return 
else return   ! 

 
     
  "#    
    !    

$%     %    ¾    

9.4 Strong Induction


&                 
                
  '              
   %  (      )     
        strong induction    
                    
   
 

             *  %
 
      
+                , & 
  %             %
        %             
     
         
Example 9.8

-


   *

   !   !     *

     
Induction Proofs from Inductive Definitions 235

Fact       


Proof:
     
    

 :   

 even:       

          

 odd:       

         

Exercise 9.9 (Solution on page 450)

  
    
    !  

  !

" #  $  %#   


    

        

9.5 Induction Proofs from Inductive Definitions


& ' # '  $   #
     (!

!  %)! # * +   , ! %)! # *  

-   ##


      #
.$

    
 ##' )! #

Example 9.9

Fact: , ##  

½  ¾  ¿         

Proof:
  

Base Case   
½  ¾  ¿    ¼     ¼ 
236 Proofs by Induction

Induction Step:  

½  ¾  ¿    
 ½   ¾   ¿    ½  
  ½       
 


         
   ½   
   

Exercise 9.10 (Solution on page 450)


 
             

      
     

 

Example 9.10

Fact: ¼  ½   ¾        ·¾   
  

Proof:   

 
Base Case   
¼  ½  ¾      ¼  ¼        ¾  
Induction Step  
¼  ½  ¾        ·½
 ·¾    ·½   

 


 ·½  ·¾     ·¿   

Exercise 9.11 (Solution on page 450)

!
"   

  
¼ ¾   ½ ¾  ¾ ¾      ¾  ·½

  

#          


  
  
$  
    " 

    %  &
 '
   
    

"
Fun with Fibonacci Numbers 237

Example 9.11

Fact:       


   ¾    ½  ½  ¾ 

Proof:             


 
Base Case 
!
        
½· ¾ ½ ½ ½ ¼ ¾

Base Case   !            
¾· ¾ ½ ¾ ¾ ½ ½ ¾ 
Induction Step:    !
       
· ¾ ´ ½µ· ¾ ´ ¾µ· ¾

           
½ ½ ¾ ¾ ¾ ½ ¿ ¾

   


  ½    
¾ ½ ¾  ¿  ¾

  ½    ½ ¾ 

"   #        
$      
  %     
      
        
     
        
          
 

9.6 Fun with Fibonacci Numbers


%        & &
 

9.6.1 A Fibonacci Number Test


'   &    &   $  
         &   
    (
)    * "     
         
   +  $ +  (
) "    ,
     &  !
  
          
(  -     
¾
238 Proofs by Induction

  
Ü    
   ¾    ¾   Ü 
   
   ¾   ¾  
Ü    
 
  !  ¾   "   ¾   #   $
%
  &   Ü  
 $     '( '
   !  ¾    "
  ) ! %    ) 
 " *
 ¾      (   $ %   ¾  
 "
  ) ! %    )   " *#
 ¾  
     $ % +!$
!      !    
   , !  ! !
 ) !    "*
 $
    '( '    !  "*¾   #"*"
  ) !
%    )    "  !   ¾     $ %

 ) ! !    "*     -  ½ "*.


+! $  )      !   $ ! ) ! ! 
   
Exercise 9.12 (Solution on page 451)

/!
(    
! $    * !   -  . -   .
 0 ! % 


   

 

Exercise 9.13 (Solution on page 451)

/!
(    
! $ !   -  . $    )  0
! % 


   

 
! -  . -   . $    * -  1  !    
!
! ! 2 3    )   - .        .

Theorem 9.13 Fibonacci Test

  
          


     
 
Proof: 4   (  ) ! quadratic formula ! !    !
! %  % 


   *
   ( ! $  )   $  1


 

   


Fun with Fibonacci Numbers 239

 
      
 Ü      
¾
 ¾  

 
  

   
 
 
 ¾  ¾   ¾ 
  !
 

" #$ %!       


    &
 & 
¾
  ½
 &         &       !
¾
' 
            &     
 
    &

(  &       
  #$ %!) 

     

  &    * 


 &! 

9.6.2 A Carrollean Paradox


+

 
  (   ', !

Exercise 9.14 (Solution on page 452)

-         ¾·½   ·¾     

  .!

',  &    &   //


   0
'

! +  //
    

 $!

Exercise 9.15 (Solution on page 452)

+(        1 


        

    

        

       ) 
    

 


   

  

+   1 1    2         )

  2   3 4    $     &  &5
+ &  &           

(  &  *   &! *  $&
   


) )          1 

240 Proofs by Induction

 
 

   

   

  
        
    
    
        
   

9.6.3 Fibonacci Decompositions


            ! " #  
      "     "  "   
$"
  %&'   "    !   "  "  
  (

&' % )  )  *  &

 "         !    


   
 !           + ,
 "    
  "       -    

Example 9.15 Zeckendorf’s Theorem

Fact: .# !   /   $"    ! 

%  ½ 0  ¾ 0  ¿ 0  0 
 /  ½  ¾          1,
         )2
$"
// % & 0  0  %  0  0  
Proof:       
!    
   

 ½ 0  ¾ 0  ¿ 0    0    
  # /              

Base Case 1  % 2(     ½ ½   )  /   


Induction Step 1   2(
When Inductions Go Wrong 241

½ ¾ ¿   ½ 

  ½  
½   
 


  ½   
 ½      ½   
  ·½   
 
          
  ½  ¾      
½ ¾ ¿
 
      ·½
     
      
Base Case               ½ ¾ ¿ ¼

Induction Step            ·½   

    ·½     ½ 
           !      !  
      "    
#       !        $  
   
           
½ ¾ ¿


  ½  ¾  ¿       
%   !       ½!
    !
     
&"  ·½  !
 "     $       
    
          
½ ¾ ¿ ·½ 

9.7 When Inductions Go Wrong


' "  
$   "  (  (
   
Example 9.16

       
   )  
  *   +
  
, 
 
242 Proofs by Induction

  

       
 



 

     
Base Case        

Induction Step      

   
 

   
 

 
  
   
 !
     

   
 "

  #
 
  $#



  
# %
 
 
  #

      
 


 &
 
 & 

 #  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

¯    
    
    
     

¯    
     
    
     



¯    
      
    
      


  

            
 

  

         
      


  
 
 
            



 
     

      

   
   

 
 
! 
    
 
  

   

    
      
  "
 
 
   

   #
    ! !"
  
    
   
  "  
    
     
 
 $
 
  

%

Exercise 9.17 (Solution on page 452)

&   
    

 '

 (    
      %

& 
  

    
  


   
  

       

Base Case )  * +,     


   

  
 

Base Case )  * +,     


   

 


Inductive Step   +, -      


 
  


)

 .      
   
 
  


 . 



  
  /
¼ ¼¼
/     

 



 
    
  0  , *
¼
 ¼¼
 1  
¼
 
  
          
 
¼¼ ¼ ¼¼
      - 
   
    
   
244 Proofs by Induction

9.8 Examples of Induction in Computer Science


 
             
  
 
Example 9.18

   


 
         

                


 
              


            


      
    
 if   then return   
! else if    then
" if    then return   
# else return   
$ else
%    :=     &
'    :=    &!  
( return       
)       
          
*
 +       
  +       
     "        ( 
       
   ,   
           *
               &   -
            
       
 +
      . .
!   !          
       "
 +
       ! 
"  
!   
 +
  !        %/  
  !        '/  
 !        (
   
   ! &  ! & !   
!
   0         
 .
! 
 ! &  ! & !  
!
Examples of Induction in Computer Science 245



Fact   
   
       
 

Proof: 
 
  
Base Case        
    
Induction Step         
        
       
  !
  
 
    
 "
 

#

   $  $ 
  

  $ " $    
 






  

# %  %  


&  
'   structural induction !


  &   
  
 
 
 

   


Example 9.19

(  &  &  



     

     

Fact 

   
  

Proof: 
 
  



Base Case 

  )  
 !     
 !

   

Induction Step 

  ) *  
  &  ! 
 

&
 
     
     

  : 
 
   

  

!   &

 
  
 +


    


 (where  ): 
   
 

# & 
 %     &   structural induction  

 
  
    
        

 
 !       !   
 
   &

  
       
 '  
 , 
 ! 
246 Proofs by Induction

   
        
   
 
             

Proof:   
   
            
      
           
   
    
     
   
               

 :       
 :   
 
          
      
  (where   ):       

          


   

Example 9.20

Fact        
         

Proof:   
   
    
    

 

  :     !   "    

  ½
 ¾  :  
    !
#       $!
    ½
¾     ½
¾     ½ $ ¾ $!  
  ½ $! $  ¾ $!   ½ $ ¾ $!$!   

Exercise 9.20 (Solution on page 453)

%   
     ½ $$ ¾     ½  $   ¾  
 ½  ¾     
 &      
  '!#    
 &     
 
 
 '!(

9.9 Additional Exercises


! %       "   
  
Additional Exercises 247

 ¿  ¿  ¿    ¿      ¾

  
  
 ¾  ¾  ¾     ¾ 
     


           
 
 

            

    
   

                
    

    

    

    
 
     
   
           !  " #"$ 

           


      

 %&  "   &    $$   ' 

         


       

    




 %&  "   &    (      $)   

" 

 *(   #"          $$ '   +   +   +


  $$   &

       
       
   


"   )!$'

 '          

 '     
 
    

 '      


   

 &  "   &      $$     

, *(   #"
 
 
      $$ '
 


  +
   
   


 &  "   &  




  $$  

 


- %    !    $ ) )  . )!$ / ,

0 "!!      ! "$ "&   1&  


!         $      &  "1
     ")      &             
  )          $    $     
248 Proofs by Induction

 
           
   

          
 
     
         
                
!   
         



"# !     


     


    $       
 %    
    &
' "       

       
%  
(
)* +   %   
    
 
     
!                
     
    
  

"# !       


)) ,     -  -   
   .    

  

  / ) .   , 
      %     -  -   
 
  . 
 ,       
  
 .  
      . 


!   
     -  -   
   

%    *

"# 0  
        
   %  
     .

   .  
   %
- ½  - ½ .
 

)- ,       


   %  .   
 
%   - 
 %  .    

%       .       
    ,        %    %  %
 1 
  2 
%    .    

,         1 


  
  
    
        


Additional Exercises 249

  
       
   

   
    
               
                   
                   
     


! " #  
   $         
    %      
       
         &
' (   
    
     
 

)        

 (   
   
   
 
        
  
                 
       
        
     
             

    
      

       %      
              
        
      
(               
    *+
    ,   
 
      


                


 - .
%   

.  
             
     
       
  /
      
          
 
0 1         23 

 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               

 

Induction Step:   

  
            

         !    

                  "

            #   

      $ 

%& '       ( )   


*     

  +

Proof:
     

Base Case         *    *  


Induction Step:   

    *   


          

     
     *
    

    *
    *
*


* *
   
*

%, -                 

    
            

       .       

    



           

    

      
    

.                  


   '    
 
         

  /     
   
 

           


        

       

  
   .  
 

     

Ý   

             

                      


Chapter 10

Games and Strategies

   

            

     
 


Games-of-chance             


  

           




           


 
  
       
    
 



       
  
   
  !

       
           

     
       

   

" 
    # 
       

   
 
     
  

$     games-of-no-chance       

 

      
  !    

 
 

  


    



            


 

 
             

  
     

% !
   
 

    


   

 
   
   
 

 Æ


 &  

 '  '  

   (     


  
 
  



 
    
   





  
 
   
       

          


    

   
    
  

$
  
(  
         

)    (   


    
 



    

  "    


           



 


  

           

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_11, © Springer-Verlag London 2013
252 Games and Strategies

 
 

   
       
 

        

10.1 Strategies for Games-of-No-Chance


  
   
     
    
   


 
 A 
  
   
  
    
      
 B 
  

     
     


    
   perfect information       
   

        !  
        
 " 
                     
 
   " 
           
"  #   


   
$       

  
      

 
  

   
     

  
       
 
%    "   
 
   
 
    "  
        %   "  " 

   
 
    
        
   
 finite game     
 
     

   # %
     
$  

   

 
    
     
         
  

     
   
  &'        
            
 
       
    

         
  
 

     (    

 


   
    
 
   
 
  
   

$      
 
  
     


    

      
    
 
  

   "
(  "   "         
  

     
        
    


    attacker-defender games  #


 
%  
                 
% 

  

    # 
        
        

   
 
    
(
  
       "
  
 
    

    

 strategy 
 
    
    

  "      

     
   

        

        
 
Strategies for Games-of-No-Chance 253

  
  winning strategy         

  

  


   
 
 
 




     
  drawing strategy
  
        winning position 
   
 

    

 
  
  
  losing position 


   
 
 
    

 
  
 
  
    
   
     



  
       
 
 
  

    
          
  


  
      
 
 
   

  
     
  
  
 

   
 
     
 
    
 
  



  
  


     !  

  


     

   

 
      

 
 !   
    " 
  
 

    
   
  #    
   


$
%  

 

 
 
&
   



     


'  

 

 
 
(
   



     


)  

 

 
 
*
   



     


+  

 

 
 
,
   



     


-  

 

 
 
  
        
. 
    
   

 $
%
   



 
  


&  

 

    
'
   



 
  


(  

 

    
)
   



 
  


*  

 

    
+
   



 
  


254 Games and Strategies

  
      

          
                    
                    

           
    
     
                   
 
 
     
             
             
     
     
        

             
   

Theorem 10.1
  
           

                  

Proof:        


   
      
     
  ! "#       

        
  
       
   
     
  
          
       $ 
    
           
         $     
     !
¯        
  
        
¯         $        
 
   
       
                      $ 
  
 %&           
'
        $            
      
 %              
  
          

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

¾
¾ 
¾ 
¿

¾ ¾
¿

¿ 

¾
¾ ¿ ¾ 

¿ 
¿ ¾


¾
¾ 
¿

¿ 
¾ ¾
¿ 

¾
¿
¾ 

¿


            

   ! "" "   #   ""


"  "   $  %!  " % #&  %!  #
   " "& %   #   %'" "(

  %    ! "$ #        
%  #              "#    

Exercise 10.1 (Solution on page 453)

)                " # !


!                ! #
*     # 


   %     '  #   #    !
            )    #  
$ !   #    !  # !      (
 $ !  " *
 +   %  %! '   #   #    ! 
             % ! 
 +   %    %! '   #   #   ,
 !               % !  % 
# ! ! !   %# "   % 
# " -(
258 Games and Strategies

   
 
    
     
   not            
       
      

Exercise 10.2 (Solution on page 454)

                


                 
       

! " #  


             $ 
   
     

% &   

     
  
'  #  

   '    


        
' 
(     

   )
* "  
  
            
$    #      

% & +      #    

  
  ,
-       
        ' 

        
      
(    

)

Exercise 10.3 (Solution on page 454)

"    

 
  
       
!*     

 &

 
 


.    
     %!  !*) 
   
        *  /  
%     
) "            !* 0     
 
Strategies for Games-of-No-Chance 259

 
        
 

 
           
  
 
 
 
    
 


 !               

   "
#

 $
#
  % 
   
      


 
#
  &  
        

 '
#
       % 
 



 
"
(

 $
#
 

Exercise 10.4 (Solution on page 456)

& 

     
   # %
 


    

 

  

 

        
    
 )   
 
  
 
    one
 two  
 
  
    



 
   
 
  


     %


  *  

  
 
      


  
&
%+ 
   
%


 
 

) %  "
    
 
 
   
 
 *    


 
 *      
 
  ,     
 


 
      

 
 
 
     


 
 
 
     
  
  
 
* 


 
   
 
   
 
 

   

% 
 

 !    "   
 
 
  %
    -
   
 
  %
   
   % 

 

 .
 
(
 
 
  
  
  
&  ( 
  /  0  %   
 
   % 
 
         

%
    &  
 
   
 
  
   

( 
 


   

 

260 Games and Strategies

    
      
 
  
            
      
                  

!
  "   
   
  

    

#        "       
  "

       
       " 

      "  

10.2 Nim
         
 "       $ 
     
       
        
   "     
        " 

           
   %   
            " 
       " 
 "  
  "      
"   
      
          
"

& #       first      "    


'
        (  
) #  "   

                  second



   "    
' "
        
    ( 
  
   ( 
 " 
  *  
                  first

   "    
'  
      
         *        

    )      




+ #     

   "          first 


   "  
 
'                ,  "
  *      
       

    )      



         "       

 second 
   "    
'
Nim 261

    
         
  

         
     



   
           

     
 

    
     
    
   

    

        

      
        

         
 

      
    
       

 !   
 !  !    
"      

 !  # 
           Æ     

     

           

                   ! 

 !   
    !   
    !   


  $    
           
 

     !     % !        

      !   
 

&                    

  
     
  
     
 

     
          


        !     
  

  #     
        '    !
 

    !   ()      (    

         ()     &   

 ! !
        
 balanced #  

    
 unbalanced        !   

 *

( & !    !


        
 

 every  !         !  


   

!  !       
 

 &        ! 
         


   some  !     !    !  !


      !      
 

* ' ( ( * ' ( (
+  " 
  ,-.        
,* ( ' ' 0  (* ' ' (
   ! 
        
-* ( ' ( -* ( ' (
 !
  /          
.* ( ( ( .* ( ( (

   !         !


 
( ' ( ' ' '
   !  
        ! 

+   
   !    !      

       
 

$    !   !              

             
 1     !
262 Games and Strategies

  
   
  first   
  
          


       
  


  
 
     
  second   
  
      
 
      

   
   
      

      

Exercise 10.5 (Solution on page 456)

   
    
           
        
       
 
       
       


 ! 
  "       


 
  
      
# $
 


Exercise 10.6 (Solution on page 456)

%
      
 
 
   &
  
 
  
 
   
       

   
'   
       &
    


          (     


 &
           
"  # )
 
      
  
     

   

     
   $
 


10.3 Fibonacci Nim


 "    
 
        
 
    
           
  &
 

    
       *      

  
   
       
    
 
  

     
+      
    

 

 

 
  
        ,

    
      ,

 - 
   


  

 

 
 
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

Theorem 10.6 The Fibonacci Number System

  
         


 
  ½   ¾   ¿    
 ½ ¾               
                

Proof:

 

     


Theorem 10.7
               

       not  

   ! 


 
     
        " 
 
                  
½

½ ¾ 
   

   
               
  
     "   


Exercise 10.7 (Solution on page 457)

!
  "

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

    
 

 

Proof:             


                   
              
 !   "    " #$       %
           #$      
Æ% 
  #  &     #   #%
 $      $      
     Æ          ## #    %
              # 
              %  
 '      $          
        Æ       !      
     #   $        Æ    
  #           #      !   "
   %          #    #   
" #$         Æ%         #
   #     #$   (   #
      #$      
)                #
  
268 Games and Strategies

 
Æ Æ  
Æ Æ
Æ Æ  Æ Æ 
ÆÆÆÆÆÆÆÆÆ 
Æ  Æ Æ  Æ Æ  Æ Æ 
 Æ  Æ  Æ Æ
 Æ  Æ  Æ Æ Æ
 Æ  Æ Æ Æ
 Æ
 
       

Theorem 10.10

  
  

  
  

Proof:              
           

              


    
!                 
       "#      
  
$ %             &
           
      
 '      
       & 

%       


        
                   
                
       
(               
                 
  )
Bridg-It 269

 
  

10.6 Bridg-It
      
         
     
         
                   
            !  
  "       #  
     "     Æ   #
  $              


Theorem 10.11

    

  

 
Proof: %               
  #           & '   #
         (      #   
    )         ) Æ  
     *   #            
 +    *   #            
 Æ          , -       
                    
    Æ              
    
270 Games and Strategies

 
       

                  


  

Theorem 10.12

  
  

  
  
Proof:                 
 

               
             ! "   
   # !          $%
     &         '  
        '      '  
               &(    
      '         
  )        !'    !
         '      ! !  
        

Exercise 10.12 (Solution on page 459)

*   !     !        

Additional Exercises 271

 
    

10.7 Additional Exercises


     
           !
  "      #   

$% &             


    
$#% '              
       #  #( $)  
 *  +         "  
"               
   " #  !     
           "    
             
 #   ,    %

    


           +
!   "      #   

$% &             


    
272 Games and Strategies

   
  
   

 
  
  

      
 

 
 
    


   
 
  

!      
 
    
 
 
" 


      

      

 #

  

   
    
   

$
  


%&   
 

 #
    
" 

      '     
"

#  %

 
 


$ #
     " 

  
 (   

  "
 
  

 )
 
     *
$   

 
   
      
    + 


  
, 
  
  
  
  
  
, 
  "

 -
 
, 
     
 


             
  


  

 
#

  *. !
 ,
¯  
  


   
 
#

 
*. 


 /      "  
 

   

  #
  
#
  
    

  


 
   
  *.'  
¯  
  


   
   
 
*. 

#
 #

#
  
    
 



 
 
#

  *.

0   
 
  

!      
     
 
 
 
#


        
  %    
  "

    %    0    1    (    %  
    

  "
 
  

-
 

  
     
       
   
 

&   
 
  

!      
     
 
 
 
#



     1   

  "
 
  

-
 

  
     
       
  
    2%   20   2(
Additional Exercises 273

   
       
  
 
          
   

        !
"   !   !    #   
 
   
     $    ! 
 % #   !    #&   !
#  
!     % #  
   
'  
 
     
  
 
          
   

     (   !
"   !   !    #   
 

  
     $    ! 
 % #   !    #&   !
#  
!   (  % #  
   
)   
    # '# ! # !
   
    #   
* # 
+ #
  #
#  
   # '   
'   &  
&  % #    
 '#

 # #  * #  
 &    #

  #  
* #  # ! 

,
'  ! 
"   !   !    #    
 -  
& #        !  
 
#  
,
'  
 &  !  
  #

  
,
'
'  
    # '# ! #
!    
       #   

 * # . + #


  #
#  

  #   #& '  #     #
! 
  ,
' ... ! 
"   !   !    #    

 $    &  !  
 '   
   %     &        

 !     / !&   /       & 
 '  
        
     
      #  '  
 0     %
#  '#      
!    & 
&        1  0 !     #  
!    # 
     
274 Games and Strategies

  

  
 
    
    
   

 

  

 

       




     !
"  
# 
   

  



 $ 
  



 $  
  


   
 # 



      ! %   &


 '


  
 !
 (  

 #

 # 
  
 
 

 )   
* +
# #   


    # 
' 
'
 

      

 
 " 
 
'  ,

  not -   
 (



 #  
 

 *
   

 # , 
-
 
 

  #   
.   ! 
   

.  
 

    


/  


 

 #

  
 &

  

'   #
'  

    


 


# 
 '     '  

  '           
 



# 0
1 2  3 #   #   

1  
     

%
 *
 (   
  

1  *
  " 
 
    
       &
 44    5 6 7  8      
   

" 
 '     5 6        

3 '     #    -   
 
¼  ¼  ½ ½  ¾ ¾  9
  
     
  
Additional Exercises 275

 
¼  ¼   

    

 
   ½    ½    

     


        ½         
     
 
    



   ¼  ½  ¾        

  

 
              
     ! ¾       
 
   

"# $
     
       
   "%& '   
 ½  ¾  ¿    
   (
   


   )
#
"# * 
 
  +  ,  
 "%&  
      +  ,#

-  . .)


  )
.      
/
$

 0            )

         )
 


 1

. )           
 )

 
 2 3 4 
5
   
Russell 
   

&

¯  2 ) 

       


¯  
) )  
     
 )
  2
   
  

*
 $

 0    
6 7.)
Part II

Modelling
Computing Systems
Chapter 11

Modelling Processes

  
 
      
   

 
  
 


                     

                    

      !           "

                    

   #     
$           

            %     

       %        

                  

  &   '              

               

( !                    

                 '  &

        #       #   

  )               '  

                 

                    

*   !          +   

    (  ,,, '         

             #  

                  

   -      .      



    .    
      

      )           

       .   / 0  C      

         '     C    



     .     
    

1            ,23  45   


       6          

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_12, © Springer-Verlag London 2013
280 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

  
      

  
 

                

   
          

 

        
              

 
          
   !

       
  
     

 
           "  
      
  
        
    
 #  
$        


     


11.1 Labelled Transition Systems



            
   
 

           %       
   
     

 &
    

     
    
  
  
  
     
     
  
  
  
    

        


 
 
   
"     
       
     
'()        
     ' )     
  
 ( "          #    $  
      
            
 
      #     
  $     
       
     ( #   
 
  $         !
 
    
  *


 


+          



  
         , 
      

  

  
             
 #%
  
 -          
 
          *      
      

     $
"    

 
        

  
 

  ./
      
  
282 Modelling Processes

  
   
  
           
  
   
  






                 


                 
    
                 
         
       
  labelled transition system 

Definition 11.1

labelled transition system LTS   


! States Actions 
 
    States  states
    Actions  actions  events 
     States  Actions  States  transitions     



      transition relation

 

  

         
    
                       

      


         



  
           
   
   

Definition 11.2

   !" ! States Actions   extended transition relation


 States  Actions  States   #   
  

  
                    
 
       #         
              Actions    Actions

  
 
   
  ¼

     ¼

!     ! ½ ¾           


 
Labelled Transition Systems 283

  

 
     

½ ¾
¯  ¯ ¯  ¯ º
            
              
              
             
Example 11.2

        

  States    


 !
  Actions   !  
    "  # "   # " 
#
"   # "   # "  #
"   # "  # "  
#
"
   # "
 
#

"    # "   # "   #

$        %    
       %   
Example 11.3 The Man-Wolf-Goat-Cabbage Riddle

& %       '  %      % () 
 *   "    ++,  -    

 
 
 # .   %
284 Modelling Processes

  
            

          
          
                   
                
                  

          
  

   
        
  
             
                


                    


                 
              
           
 

 !               


               

                 
               " 
        
 
  #      
      #      

$                


   
       %

     


& !               
               

               

                
  "        ' (
 )    
  '             #      

$                 


   
       %

  

  
* !                
            +
  
           ,    
  
              

$                 


   
       %

  

  
Labelled Transition Systems 285

   
 
 
   
 
  

 
     
           
         
      
       
     
   

           

 
 
 
 
     

   
   

    

   


  
   

!   
  
 
   
       "


 
   

    
 
!   
   
  
       

     
    
  
      


     
 
       

 #$
    %&

¯                  ÓÓÓ    


              ÓÓÓ   
¯      '       

   ÓÓÓ    ÓÓÓ  ÓÓÓ  ÓÓÓ

  
ÓÓÓ   
ÓÓÓ ÓÓÓ   
ÓÓÓ

¯ (     $ 
    

 ÓÓÓ   ÓÓÓ  
ÓÓÓ

  ÓÓÓ  ÓÓÓ  
ÓÓÓ

    
    

 
  
  
 
 )

  
  
 

   
   

   
   
 
   
   

     %&       (  ##* (


  %&   

 
 

  +   
,-  

  

     
       

    
. 
   
       
  
 
 
 
     

   

  %&
   
 


 

286 Modelling Processes

  

 
  
 

    

      


   

 
 



  
   

 


     

 
 
   

       
    

 
  
 

  
 
      

Exercise 11.3 (Solution on page 459)

       !   " ! #


  "   $   ! "    ##   
%  # $   "   " !    &  
! !    "    # 
    ! 
           $   
    #  '! "  ! !
!    
( !  )  !    "*
Computations and Processes 287

Exercise 11.4 (Solution on page 461)

  
  
        

 
  !" #

$%  &


  
 '"$  

 ( "
)* $%   $
  +

, 
    
   + -
,   "
 +"* . 
  ,


/",   ,

 /",    ,$     



, /",  
 +" ,

$ +  +  +" 



    $
    $   0$     $$*
&   , $ +1

Exercise 11.5 (Solution on page 461)

"  $,   " , 


+
  "  + + " 
$2"        +  +" $  +  $
 +"  + "  

 $ *
"  "  3

 +
, "  "   3 " "
 $   $ $ " $* # "  ", +  
$  

  $    

+"  

+% 
" * 4$ 

        " 



"  ,*
# $, 


  "   , 1

11.2 Computations and Processes


$  +

, 
,  "  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
Ü  Ü  Ü 
Ý  Ý  Ý 

 
            

           ! " 


      # $%&   $'%  ( % 
      $'% $  $% Ü)   Ý ) 
*     %    x := x mod y+    
 ,       ! '!    $%  x
        '!  %'%%   !  
   

Exercise 11.6 (Solution on page 462)

     !      


 -  !   . / 
 -  !     . / 
0 -  !    . / 

  ( %     '         


 % '% %     1      %%  
  %   ,    '       
'%"  ' '   %    !    
 %  '     

¯  2    %  , #   '  &+


¯  2    %   #   '  &+ 
¯  2     '  '  #  %  ,&
Computations and Processes 289


 

 



 
      

               
              
                
             ! 
                
 

Exercise 11.7 (Solution on page 463)

"#        $  %  $  % 


              
               
&          '     
              (  
    

Example 11.7

)    '         
'  



Cl

*           Cl    
Cl  Cl     $%    +   


  








Cl Cl Cl Cl Cl
290 Modelling Processes

   Cl  


         
    
    
          
            
 
   
               
          !
  

Cl¿ Cl¾ Cl Cl

   Cl 


         
     Cl Cl  Cl 
        "
#  $   
  %        
 
         Cl &   ¾  '   Cl 

                
    

¡¡¡ Cl Cl Cl Cl Cl

(                    


                  
                   
 )  Cl        
    
Cl       
 *          
                 

     *
         Cl     
     

Exercise 11.8 (Solution on page 463)

+      ,  Cl              



                
    -

Example 11.8

*   
       
        
.  (      .    !
¯ %  .          .   
   .  
                ( 
             !
Computations and Processes 291

  
   
  
    
   
   
    

   
   
   

   
   

¯      


 
¯            

    
  
      

 
      



  ! 
 
       



     "   


      "      

      "      


     "   

#              


             
  
  

      
!      
$  %     & '( 

Exercise 11.9 (Solution on page 463)

# 
     
      $ $ )
 
       
 

     
 

  
    
 
  
  *
    '(   

        
  

$  
+ 
$,

Exercise 11.10 (Solution on page 466)

-
     
 

   
  

     "
  

    

   
 
   
     

   

    
 

      

   

     

292 Modelling Processes

    


 
   
     
   

       
 
 

  
  
   

   
  
  

  



  
     
 
  
  
 

 
  
     
     


 
 
   



  
  
   
 

 
  

11.3 A Language for Describing Processes


           !  "   
    
  

 
     
#  !
   $ ! 
  

 
 
 #

  %! &&'   
 
  # 

 
   

                #

 
 (    
       
  )  *      +
 
      
 
  ,       
    
¯ (process) variables      
- 

¯ events  actions      
%  !  
     
 

    



 %     
   !  
  

!  
   
  
   
    operations  
 +
   

 
    !

   
 
   

      


           

11.3.1 The Nil Process 0


, 
   !  
  0       


nil       
  

   

  

 

0

$ !


Cl¼  %! &&.   ! 
 #
 (       
   

0  
  deadlocked 
A Language for Describing Processes 293

11.3.2 Action Prefix


     
           action prefix
                  
    
     
 

 

        Cl½    


      
 
    

0


      



0 0

 
               
Cl¿              

  0


      

 


  0  0 0 0

    
        !    
  
     "  #
   "
  $   
   

 
             



  
294 Modelling Processes

11.3.3 Process Definitions


 
              
               


      
  defining equation
 
              
               
              
                 
    
             
               
   
 
       !    "
    
                
  


   
   #  !   #           
                  
  


 
 process definition    !      
        
        
          $    !  
   
     
      ¼

 
¼

$     


           
 
    
   
A Language for Describing Processes 295

11.3.4 Choice
     
      
       
                  
  
¯ 
               
    
      
¯ 
              
      
      
   
         

     
     
    
  
               

  choice               


                 
                


  !       "  
 
 ¼
   
¼

   ¼
  ¼

#    



 
       

        
        

       
       
 
               
       ! 
 $  
 
 $ 
  
%               
 
    


 
   



  &   !    '    
   

   
(
        
       )((
  
        
%                 
        
   
   

 
296 Modelling Processes

Exercise 11.11 (Solution on page 467)

 
 
           
              
   
½  ¾  

                  


 
         
   
               
        


          


   
             
 


!     "              


        "      #     

 
 
$    

 

 
$   
 
%                     
          # 
            

#                 


 
     

    #       
    

  

 
     
&                 
   
     %             ' 
$ 
        "        nil   0  
%               

    # (


Example 11.11

)  
   *
 "   
      
   ' 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

 

&      


  

   

 
 *

Exercise 11.12 (Solution on page 467)

+
(    $

   !  "   Cl 
  $

, 
 -
298 Modelling Processes

Clock



  









    
Cl¼ Cl½ Cl Cl Cl 





 



 




Cl 
Clock

 
  

Exercise 11.13 (Solution on page 467)

              


         !        
   "  !     #!      
$        "#   !         
  !   


     
    

     
    
 
     
    
% "#               
  #  &      "#     
   !       !  ' 

 (  

 )   )   

 *"  '  !      "#         


   #        
Distinguishing Between Behaviours 299


ν 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.Î

 
        

11.4 Distinguishing Between Behaviours


               
     10p         coffee  
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.ν )

Exercise 11.14 (Solution on page 467)

              


      ν         ξ  ο 
  !        ν     ξ   ο 
  
10p 

           coffee  
"  !
  

   10p   

       
 
Distinguishing Between Behaviours 301

   
  10p   
  
    
 
  coffee    

    

 
      
   
 
 
     
 ξ  ο  
 Î 
 
  10p    

    
 
  10p    

    
 

  coffee    

      

   
        

   
     
             

 Î    

   

 Î       

 
    
 Î 

  
 Î 

 Î

      10p 
  
    
      coffee
  
      tea
  
 
  10p    

    
   
  10p   
  
    
 

  tea    

Exercise 11.15 (Solution on page 468)

   
  
  
      
 Î  Î  

 
 Î
  
    
  
     
 !     
  
      
   


    
 
   "    
    


   #  
Exercise 11.16 (Solution on page 469)

$
% 0 & 0

%  & 
 
 % & 0 & 0

% 


' (    
        
   
 
) #  
         
302 Modelling Processes

11.5 Equality Between Processes


   
               
                 
                    
                   
                     
      
¯      
¯    

Exercise 11.17 (Solution on page 469)


                  
!       "!        
#                 
         $     
% ½ & ' 0  
% ¾ & '  
% & '    ' 
%& % '  & '   ' % ' &
%& (  
    
)          * $          
       
Example 11.17

   ' 0       $        


    
¯ ' 0     
¯   ' 0 
               
+  $     ' 0         
    0                
0        
)!          !  
 !              )
      !         
Additional Exercises 303

 
    
       
 
  
     
 
  
  
 
 


               
 

 
¯  ¼

  ¼
    
¼ ¼
   

¼

¯    ¼

¼
    
¼ ¼
¼

 

    
      


 

 

    !

 
 
    
    

 
 
   
"½ # $   
%    % 
"¾ # $   
   
&   
   

 
    

   
    
 
 
    

   
  

Exercise 11.18 (Solution on page 469)

'
   
      ( 
 
  

 
!

  


       ¾ 


'  
       )  
 



     

11.6 Additional Exercises


* +     **, 
--   
  
  . --    

  **/  
   

  
    
  *0 (
 $  
   
1 2 &    "  
  
     


 
34    --5 
3&   
  --5# $
  
304 Modelling Processes

 
      
     
         
 
   ! " #   $    # ! " 
   ! "$ 
          $

 
 !% &'   "     (  $
 
   )    * 
    

)        "      
 " 
      +
, & + -  
   
   -  $  $

 
      $      
" . 
            

           /
 

          %
&+       
        

    
   
&
+ 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

,- .    


        
  "% mod 
, - /             


# 0          1  

2 0 3   2   2 


,- .      
       
, - &             


4 5     Clock% 


   1 

Clock% 2 Cl


1          Clock   &  6666


6 .  
              
5
  
     
      ! 
 7 
 
  
         
66 8  !   
  1    

 
     ,  
-        
          
     
     1    9*
 666 '    
 

2 







 

¯  
 
¯     2            
306 Modelling Processes





  
 

 
 






 

 

 
 














  
 

 
 





 
  
 

 
 
 





 
      

                  


         

              !   


 "

   #    # 
  

$    !            


 %           !   
    &

 " '       (


  " '          (
  " '       (
 " '       (
              & 
  
Additional Exercises 307

  


  
   
 
    


     
    


  


  
   
 
    
 
 

  
 
!"!
# $ 
$
 


$ "  
$  
% &
  $
 
'    
"
    

$ $   
(
 

) * 
 
+ 
   ,
$  ) -
' 


 
  
 .# 


 ½  / 0 0 
 ¾  /  0 

   /  0  / 
    /   /  0  /  / 

   1  0  
  0  

2 * 
 
+ 
   ,
$  )

  1  0  
  /  0  / 
  1  0  
  0  
Chapter 12

Distinguishing Between
Processes
   
    
 
 
  



           


 

               

             ! " 

# 
          
   
   
 
      $  

 
         
   

    

¯  %              


                 #

¯                  

             
 

                

&   
  
'#     
  
 

             (   %

    

12.1 The Bisimulation Game


    
        & 

        ' )  $    

          %        

 ) * +   %      ¾   


, - 

         &    . ½' /  
%   
 &   '  ½&   ' 0    


            

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_13, © Springer-Verlag London 2013
310 Distinguishing Between Processes


 

  
 
 

   

  
   

                


     
               
    
                     
    
            !   
         "    
#                 
   $           

      !        
     
         "  
             
     !            
          !        
   %             !
every time it is her turn "     !   !   
 &         ! !   
           &      
                    
  ! #&               
       ! '!        
The Bisimulation Game 311

 
 
  
       

 
 

 

 

Example 12.1

      


 
 

   


     


            

     
   

   

 ! 

     

  
      


  

 !       
 "    

   

   

 ! 

      
  

 
    
 
 
 !    
        



#  
 
   

 $
  

   
     $  
 


      

Example 12.2

%
   
   
 


  
 !
    
 
  
       
      &

 "        


 

   
 

     ' (

  
       



   

          
)   
 
       &     * 
         
   *
 "    
   

  * 
   !

    + (

  
       



  ' 

          
)   
 
   &     '     
 
   &
& "    
   

  + 
   !

    ' (

  
       



  & 

        
           



(
          )  
      


  

         
  
  ,  
  
   

 '    
     
       
  
  
312 Distinguishing Between Processes

  
               
           
    

   !              


               
       

Theorem 12.2

    "  #  ½ "  #


        
  
            

Exercise 12.2 (Solution on page 470)

$
        "   #     
        
         ½"  #
       %          "&%  '  (()#

Definition 12.2
             -game equivalent
 
  

  
            
  "  #   
       -game equivalent

   ½ 

  
           
  ½ "  #
 %          
     !
                ! 
!
      (! 


  ¾        (
                 
  %    
          
  
 10p    

 ½  ¿ ¾  ½  ¿ ¿
                 
  %  
           
%  
      *         ½  
"coffee  tea#     
            
   *           

( ¾  ¿ ¿ 
                 
  %  
             
Properties of Game Equivalence 313

ο   
   coffee     
    

           ξ   
   tea       
          tea       ξ   
  
     


Exercise 12.3 (Solution on page 471)

          


 0  0     
    0  0!  
"  

       # $%  % 

12.2 Properties of Game Equivalence


&           %       '%    ( 
               %  
  

% 
        '%   

Theorem 12.3
    

 
     


  
¼
¼
 
¼
   ¼
 ¼

   
 ¼
¼
 
¼
   ¼
 ¼

 ½     
   
 ¼
¼
 
¼
   ¼
½  ¼

   
 ¼
¼
 
¼
   ¼
½  ¼

      




  
 ½

   
   
½

   

Proof:    % (% )*  '%        %   



   

 
 (          
     )    
314 Distinguishing Between Processes

  
      
      
    ½     
   
    
             
   
¼ ¼

                   


¼ ¼

                   


¼ ¼

     


     
      
     
      ½     
   
   
                
  
¼ ¼

                     


¼ ¼

                  


½
¼ ¼

       


!   " #$%      &      
 

&      

Theorem 12.4

 

½    
 

Proof: "       
½  '(   
  
      
     
½

 
            
                
"  )    
  
      
  *              

          


"       
    
½

      
        
½ ½

     


  
           
                

               
        
   ) 
       " 
 

           
"       
      
½

    
 
     ½  
½

 ½  
     
  
          
                
Bisimulation Relations 315

    
           
 
             
 
           
       

 
          

Exercise 12.4 (Solution on page 471)


   

   
    
 
  
½     
  
   
  

       
Theorem 12.5
 
 
½      
 ¼ ½ ¾    ½

     
       
Proof:  !     "       #
   
       
"   # "  
 # #   
    # "
  #  !  # # $ 
  
    "       #
  


"
  #  !  # #         

"   # "  


 # #  #
   % 

  

 
&   
     "   



     ¼  ½  ¾      ½ 
     
     
 
    

    Cl  Cl  Cl  ·½ Cl'   
     Clock  Clock
     

 Clock ½ Clock  "    


( 
  "  !   #)


   *+ 

Exercise 12.5 (Solution on page 472)


  
 #  
     Cl  Cl  Cl 
   ·½ Cl'  

     Clock  Clock  Clock ½ Clock 
  

12.3 Bisimulation Relations


, #  ½ 
  -#.
  
     



  
   "        !  # " 
   "    
   )
 !  #  $   

316 Distinguishing Between Processes

  
          Clock  Clock 

    
     
      
 
         
      

 
   
 
 
   
 

      

        

        
         
  
    
  


    
 
  
            
  
 
   
       
     
 
      
      
   


        
 !"#      

       
  ¾  $ 
   
   
 
  

     %     
 !"#&#'
           
    
 

   
    

Definition 12.5
bisimulation relation    
          
 

        
               
¼ ¼ ¼ ¼ ¼

      ¼
        
¼ ¼ ¼ ¼

            

  



 
¼
 ¼

(  
     
  

  
  

   
    )  
    
 
 

       
       


      
        

          

    
    

 

Theorem 12.6
    
                
           
       
  

        
  ½    
   
   
Proof:   
           
 

  
 

        


        
    
Bisimulation Relations 317


 


  

 
   
 

  
   

        ½    


  !   !"     #     $
  #  %       "        &
    ' ½ 

Example 12.6

"  #        (   # "


 !$  )$  *    #     
   

Ò Ó
'  ½   ½   ¾   ¾   ¾              
+         , #     ½ 

Exercise 12.6 (Solution on page 473)

-         ,     

Exercise 12.7 (Solution on page 473)

-    "             "
      Æ  (     ½   

    ½  "  ½    ½ 

+ $     "    #  $& 
. !  "  $&  . ! ½  #    
Ì
  ½ ' ¾    !    # !!% /      # ! 
  Clock  Clock      Clock ½ Clock /   " 
318 Distinguishing Between Processes

     
         
      
                   
                

Definition 12.7
  image-finite 
  
      

    
        

Theorem 12.7

    


½ Ì 
 ¾   


Ì
Proof:         ¾         

   ½         ½  Ì̾  
 
            ¾   ½   Æ
Ì
!       ¾           
  "    !    ½   
                     
         #    ¼ $  ½ 
         %&'  !         
      ¼   ( !          
        (        ¼      
     !  )     ¼   ¼   ¼     
                    (  ¼  ¼ 
*               ¼  ¼
   ¼   ¼ ¼
  (          

Exercise 12.8 (Solution on page 474)

                  !


 
    ! $         !  

     ! + ,        !   ! 

          ! 
  !   !) 
        ! 
         -
                     
         &     '
 $      .!    

 $                


                  
      

% $                &( 
    0   0 / 0'
Bisimulation Colourings 319

12.4 Bisimulation Colourings


  
        

 
   
  
      
     
         
      
        
      
 
  
       
    
  
       

  
  
Definition 12.8
bisimulation colouring      
        
         

     
          
     
    every 
    
¼


          
   ¼

!               


  every            
   
          
¯                  
¼ ¼ ¼ ¼ ¼

  
¯                  
¼ ¼ ¼ ¼ ¼

 
       bisimulation equivalent  bisimilar   
    
            
"         
    
   
 
     
    #     
 
   
    
    $    
 

         
  
 
    
Theorem 12.8

    
  ½  
Proof:    
           
  
  %
    
      


  &  '()  


    '(*   %

                
    
      
      ½  
320 Distinguishing Between Processes


                
        
  
½    
 
                
!   " 
 ½         
       
    
        #           $
$                 
 #  %            
 

 !    
          &
 

Invariant:        
    
'   
       #       
   
     
 !   $       
#              #   
     partition refinement algorithm   (  
$  $  $ #  
)    *$
           + 
  ' $
 
   

    

   
&
  %
                 
   
 ,           -
     



-  .           / 
 
 
 ,   #       0  
     
 ,    (    



-  . /     !     1   , 
(   1
 
' $
 
   

    

   
&
  %
Bisimulation Colourings 321

   


              
  
               
  
          
     
     
            
!   "            " #  
 
       !   $  %
' $





  
& %

   


      
    #
      #        &

        
       
  
       
        
        
 
    
    
 
      
       
              "   "
       
'  #     '    (   
  
     "    "     )
               
Exercise 12.9 (Solution on page 475)

* 
           "  #   
 '            
    
  &    "    "   
   "          

&           
      
&   "          & 
#  & 
 &  "      &   

            "    "  "
  
   
      "    "  
+"    &             
    &"      #     #  
322 Distinguishing Between Processes

   
  
  
        

       
       
   
           
 
  
   
              
         
     
  
     
      
    
          
  !   
     "         
      
        
 
     
    
#
  

"

 
!

Exercise 12.10 (Solution on page 475)

#      


        $   
    %&%   
     

'         


(        
     
           
      !           

 

% )              


        
 
& )              
         
 
* )             
         
 
" +  


  (        

12.5 The Bisimulation Game Revisited: To Infinity and


Beyond!
            ! 
  
        ! !
     ½  ½
 ! 
 ,     -
 %&.    
The Bisimulation Game Revisited: To Infinity and Beyond! 323

   
  Clock  Clock     ¾   Clock ½
Clock             ½     
                  
         !           
            "      
     ¼ ½ ¾ ¿       
           
#               

 
             $
                
   
  
 
 
   

   
         %&'½¼¼
      &''  ()
             *    
 +     ,       
    

  
           
  
    - . 

/          
   
 
         
       
 *             0&     

   01      


    0   
 
)      $  
   "    
 
2   3 45
      % $
  (  
 
    6     )  

                 
     %7  4&4(       $
        %7 4&4( /   
  %
       (       "
  
     ordinal numbers         
   ½ 

12.5.1 Ordinal Numbers


              
             *

' & 1     0&  01   0  0 0&  0 01


          %   (
  
      
        $    
    )           
   0
  1
         
 

            2    
                 
             *
324 Distinguishing Between Processes

  
  successor    predecessor
 
  

 
  
    

  
 
  limit 

     

  
 !
 
 "    ! 
# $

 
% 

  $
$
 
%
  & 

    
    $
 

  
 
"  '

 

  

  
  
   
    (   

( )
   
 
 
 !    
*


    
 
 "
+
 "     
     
, &       !!      
 

Æ     


     
      

   

    
    

#
 !

! 
 -   transfinite induction
   
  !

!   

  .
 /,

0   $ 


 "





    
"
 
    $
  !         "

+ 
-   

 
   
 
   

Example 12.10

1 
       !
   "   '
  !
 
 

   
  
 
 


 2 
 #  

  
    

           
  
       
   
          
 (   (   (   
 ,   ,   ,   
 
#

     
     
  
"  

" 

 !
      
  
"     

12.5.2 Ordinal Bisimulation Games


& .
   $   "

 
   
 


! $  $
 "  '     
  "
The Bisimulation Game Revisited: To Infinity and Beyond! 325

      
         
 

 
    ½       
  
 

                 
    
  
 

 
   
 




    
   
    
 
 



  
 ¼   
     
 
  
  !

 


    

    
  
 "    
    
 


#  
 ½   

  $     
   
  
           
¼ ¼ ¼ ¼


 


  


    

  !

   

   
  %   
  
  $         
 
&  
          
 
 

      
  
  
   
  !

 

         


 

          '
    
  

     
 
     
    


 
  
    
  
       ( 
 
  
 

     
 
   


      

 
 
     
   
 
  ##   &#   
    

 
  
 

    


 
 

Theorem 12.10

     
           

           
Proof: )
 
  
  
   * "
   
    

  
  ¼   
+ 

 *  %        

   
       

     

 
¼ ¼

+ 

 *  %        

   
       

     

    

¼ ¼



  

     

 
   ·½   
 


  
 

    ##

¯ + 

 

 

 
    


   ·½   
          
326 Distinguishing Between Processes

     
              
       
       
 
     ½   
¯      
           
  ·½       
          
  
   
     
    
    
            
          
   
  
              
  
              ·½   


               ¼   ¼ 


     
       

¯              
      
                 
           

¯             
      
           
   
 

                  
               

Definition 12.10
   
         -game equivalent  
          
         

      

Example 12.11

!  "#  $%&    Clock  Clock   Clock  Clock


     Clock  Clock     
   Clock ·½Clock       Clock  Cl 


 
    ·½ Clock  Clock        

Clock

 Cl                Cl  Cl 
'        
Clock ·½ 
Clock

Exercise 12.11 (Solution on page 477)

(
              ·     ··½  

)   #         $%%    * 


  *  )     
  #   
The Bisimulation Game Revisited: To Infinity and Beyond! 327

  
   

 


  

  
  
  
  
        


 
    
 
   


  ½ 

Theorem 12.11
 ¼    

 
       
 
¯  ¼

  ¼
 
 ¼
   ¼

¼

 
    ¼

¼
 
¼
   ¼

¼

                   

Theorem 12.12



 




 

Theorem 12.13


 
 

        



 

   
        






  


               

 ¾Ç
Theorem 12.14

½  

Proof: 
   ½    
!  "  
  

    
 #   $      
 
      %   

  

– # ¼  
 
 ¼
 
  ¼    ¼ ½  ¼ 
 !  
 ¼   ¼
– #   ¼ 
  ¼

 
 ¼    ¼ ½  ¼ 
 !  
 ¼   ¼
328 Distinguishing Between Processes

   
   ½ 
¯                

            
      Ì  Ì ¾Ç   ½  Æ 

         ¾Ç         
     
     ½  
                  
          
 ¼     
         
           
    ¼       !         " 
                    
          "       
     #        ¼    
   $ "
   %       ¼  ¼   ¼ 
 $ "         &      #
¼  ¼
'  "           ¼   ¼
  ¼  ¼ ¼ #      

12.6 Additional Exercises


 (      " "  $$  
        "  
    
  )
     
  
 
  * 
 
 

   * 


  * 
 (      " "  $$  
        "  
    
  )
     
  
 
  *   
  * 

   *  *  

  *  * 
 
 
 
  * 
* 
& (  "     
Additional Exercises 329

 
  
½   
 
       
  
  
  
 

   
 



   

   
 



     


 
  

   
 
 


   
  
 

 

    


 

   

    



 
   
     
   
   

 !    

    "   

 !    

   "   

 !    

    "   

 !    

    "   


 !    

    "   

 !    

    "   


# $  

     $
  %%# 

  



&

  ' 0 
330 Distinguishing Between Processes

¾  
¿    
          

     
 
     
   
     
  
 
  
    
  

   


  
    
 

 
   
 
 
  

    
  

½ 
  
 
   

  !

 "##      

½ 
 $

 
 
      
$  

 

      


%  !

 "#%$   
 
 



 

& 

 
  
   

 
        




  
     
& 
      
   
 

' !
trace set   
  

 

         
 
! 
     
trace equivalent $ 
   $ $  
  $       ( $  
  deterministic $  
  $     

   

     
!  $  
   
 
        



 
    

 
$      

  $         
       $ 

¼
  
  ¼ ¼

     )

         
   
¼
 
¼

 
    
         $  


  
   
  )

          
    


  $ 
   
* + trace bisimulation relation     
  
 

  
 
  
 



,

  

  £
 

  


,
 


   


   ¼

  ¼
 
 ¼
     ¼ ¼
-  
Additional Exercises 331

¯ 
¼
   ¼
 
  ¼
    ¼ ¼


 
  
   
         

        


           

             


 

     
         


  

    ! refusal set              


  " #  !  $
 ¦ failure        
 
             failures

equivalent     %         



   

" #     
   %      %
 

 % 

"# &     


  ½  ¾  ¿     ½ % ¾
    ¾ % ¿         
   
    

" # '         %    


    (

  
)*  $+,

 -   
          .

          
Ë /
        · %
/
       
      


    

0              .

  %
Ë %
  % 
· % 



 %  % 

 $ % 
· % 


 %  

 1 % $
· % $

 
$ %   $






%    $  





 Ë
 %    $  %
  $ 
 · 2 % %
%
   $  




                /    (

       



  .     


332 Distinguishing Between Processes

   
            

               
      
  ¾     ¾   ¾     ¾     
       
  ¾   
   
     !   
  
      
       
      
"#  $ "#"" !  %#&
"%  $ "#"# !  %#&
"'  $ "#"% !  %#&
Chapter 13

Logical Properties of Processes

   
             

 

         


 
 



         


      

  
            

  

         !       

      


    !     



         

"               




   
            

 #          


      

             $ %     

  
!     !        
  

                   


            
    

         % 


        

   &        '   

       


           

          %        

 
             

      


     %     

        


           

              %   


 &  '    
      

 
                

         

(         


 
)     

  
    #         %  

    

    *       
   

       



        +

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_14, © Springer-Verlag London 2013
334 Logical Properties of Processes

 
   
 

      

    
  
 


 


  
    
   



   
   
 
 
 


Example 13.1

 
  



  
 
   

    
  

 
   !    
  
   
 

   
"
# $%&$'()'(*+'++   
  
 

  
  
 
 
 
"
 ,



  
 

 -.   
  (

 



 -

. 

 )  

 


 

   
  
   
 )(

   
  - / .  

 
 
 

    
 0
  

    



   
  
   
  
  
 0

1  


   


  
  


  
   
    
   

 


)
   
 
 
 
 
   
 

  
 
     
 $%&$'()'(*+'++
 
  /
 /

13.1 The Mays and Musts of Processes


2



 0 

   
  
   3
  4   
/ 


 

  

      10p 
          

     10p 
          


     coffee 
 
#      10p 
          

        10p 

         


     tea 
 
      
 - 
.    


  
     /     

  

  
 5 
  
 5
 
The Mays and Musts of Processes 335

  
        
    
   
  

      
  
             
          
 
              
         
  ! "  #   

 ! "  #      
   
$ 
            %coffee&

'  & Æ
    

coffee

 (           (     ) 

    coffee
            
*     


   
    
 
 
     +          

 
        %coffee&
 )     "
  "            
 
     & +      
    
            %coffee&
   
 
        
   *     
  
  true 
 
       
   * 
         %coffee&
    

coffeetrue


    

    coffee
  
          true  
,   - 
      true        true 
     #     
       
 
  
   
            


. 10p 10p coffeetrue


/ 10p10p teatrue

        )         


         (         
            (      
336 Logical Properties of Processes

      10p 
          

     10p 
          

  
 
     coffee 
  
       
   
      10p 
          

        10p 

         

  
 
     tea 
  
       
   
Exercise 13.1 (Solution on page 477)


    
   

 coffeetrue
 coffeefalse
 coffeetrue
 coffeefalse

Exercise 13.2 (Solution on page 477)

 
       

      

  
  ! 
  !
  " 
  
# 
   ! !  


  

Exercise 13.3 (Solution on page 478)

 
       
!   " 
 $ Cl %
% &  $  # 
  $ Cl %   ' 
% $    %   $
   
 $ (  #     
!
  " 
  
  !  Cl "!   Cl  )  ! !
 

   

13.2 A Modal Logic for Properties


*
  !  
 
      %   
!
 
    % " !      

A Modal Logic for Properties 337

   
           


    HML           
         
    

         ! " # $  %

  %%& true  false            ! " 

'       HML     


      #
                
 

 &   satisfies     ( 


    
                (


  &
 
   &           
  #  &

       satisfiable (        

     valid 
)              *  
           
%

  & true    
   true     

  &
 false    
   false    


  &        &


 

                   




  &          & 


 & 
                #     
   

  &          &    & 


                     
#      

  &        &          


                   + ,
        
      

  & ! "       &   


    
   ! "               
          #    + ,   
 

 $       HML     - ./.
)  0    
   ## %
338 Logical Properties of Processes

true   
false   

   
   
   
 
   
   
 
   
   
  
        
  
         
    
    
  HML

       


           
   
!         
   
   "
              
 

              
   
!         
        

       #
       
           $   
 
¾  #       % 

!         


   
  &'
               

     !          (  


 

             ( 


  


false   

 
         $   
¾  #       %
!         
       

       #
   &'    
      !         ( 

               ( 





  true   

            $   


 

 #       % 
A Modal Logic for Properties 339

 
         

    
         ¾      ¾   
     
   
              
 
   
         
 
         
  
   
     
    
       
             
             !      
      "  #   HML      "    $  
 $   
Example 13.3

%       &


    0
   0 '  0

 
 


 (   



 )  
   
 "                 
          "         
     &

 true     true
   
  


  
  
 
 

  
    


      
        
   true  
 true
       
  

 
  
  
 
   
    


              

* "       )  
      + , 
+,    
         
 - 
       HML .   )      
-  

340 Logical Properties of Processes

  
   

 
    
   true    


  
  

    


           
                 
  
       
            
   
   
      !  "#true
$%    
           
 
       %       % &
'  
     (
     
   
         true  
          
          
&
)       
       *
  (  
         
   
        HML  (

true   true

  
       (
true   true

Exercise 13.4 (Solution on page 478)

+      


 (
 

,       *


-  . true /  .  true 0  . "# true
1  . true 2  .  true -3  . "# true
4  . "#false 5  . "#false --  . "#"#false
6  . " #false 7  . " #false -1  . "#" #false
Negation Is Definable 341

Exercise 13.5 (Solution on page 478)

 

 
      
 
 
 
              
 

 
       !  
!  "

  ! 

# $ 
   


 %!  #$ 

  ! 

# $ 
   


 %!  # 
$ 

&  
 
 # $ 

'  
 ! 
 # $ 
     
 # $ 


13.3 Negation Is Definable


 
 ' 
%(   

 

!  " ()
 
  
!  (  ( *  
  ( %
 
  
   &'
+
   !  
  

 ,

 

  
% " ()
  
 ! !      -  
 !

    -  .   .  /
%(
 %
  

 
     

-
 0  1  
 0 1  

  ! 

-  
!    
 
   
 
   

    


 " (  

 

      

 
   

    
 2
  
!    

 



 

      

 
   

    


 " (  

     
 

   

    

342 Logical Properties of Processes

  
               
 
               
                   
        
             
   

               

                    ! " 


  #  $%
        
        
  

&       !


          

 
   
 


    

 
   
 


    


      

   

Exercise 13.6 (Solution on page 478)

#    !
            ! " 
  
        
  

  

Example 13.6

'            ()      


 true
 
             
*   
  
   true  false  !
    +
  


 false
        
         false  
#  false                   
        ()         ()    

          false  
  HML              
      HML             , 
Negation Is Definable 343

  
   HML    
   
 pos   

     
   
          

  pos             


   

       
  neg     
  


          


    
     

      neg       


     
 

        


     ! "   

            


    #

postrue  true negtrue  false


posfalse  false negfalse  true
pos   neg  neg   pos 
pos    pos   pos neg     neg   neg
pos  
    pos   pos neg       neg   neg
pos  
       pos 
  neg       $ % neg 
 

pos  
$ %   $ %  pos 
  neg   $ %     neg 
 

& 

     pos   neg     '  




        '        

  

Theorem 13.6
  

      HML

  pos           
  neg        
 

Proof:                    

( 

Exercise 13.7 (Solution on page 478)

)   
*+,

Exercise 13.8 (Solution on page 482)

)               negneg    


344 Logical Properties of Processes

13.4 The Vending Machines Revisited


   

     
   
  
  Î  Î  Î 
      
   
 
    HML              
½ ¾ ¿


 
 
        HML    
 
  
   !  
        
½ ¾ ¿

  
  
    
  
 
  
  


      
   



  "10p#"10p# tea true


½  

! 
  
  
 
  
     
$10p%                  tea 
! 
   
           

    $10p%       


½

coffee.collect. ½ + tea.collect. ½

  
           tea  
  
&
   

  
 '        
         $10p%        
¾ ¿


  $tea%       (   $coffee%  ) ! 
¾    
 ¿

 10p 10p "tea#false


¼
½   

    (! 


         *  )
½

+  "10p# 10p "tea#false


¾  

! 
  
  
 
  
   $10p%   
       

$10p%         

    $tea%   ! 
   
   
       
   
 $10p%     
¾


10p.coffee.collect. ½ + 10p.tea.collect. ½

      



$10p%       
coffee.collect. ½

       $tea%  


&
   

  
 '         
      $10p%   ,
½ ¿

 ½  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



     

  

 


Exercise 13.9 (Solution on page 482)

)
 
  

 *"

+++,

 
  0 - 0   
- 
 

  - 0 - 0  

.%
   /  HML      


   ( 
 
  
     
 '  
    

   
  
346 Logical Properties of Processes

13.5 Modal Properties and Bisimulation


   
           
      

        
 
            
         

       
           
  

            



  
     
  
  !
      
    

 " 
  

  
   
     

  

     
       


 
         !
 !
 " 
 
  
   #   


        
$    
         !

         
      

      


 HML $      
        

 
    

      
      
"        !  
     


        %     
      
             
       
    

       
 
  
   
   % 
  

  
        
     
 
     
 
Definition 13.9

 modal depth  & '   


   HML    
 


 
 &true' ( )  & ' ( &  & '   & ''
 &false' ( )  &  ' ( &  & '   & ''
 &  ' (  &  '  &   ' (  *  & '
 &+, ' (  *  & '
"  
  
          
 !
  
           HML  
 - 

Modal Properties and Bisimulation 347

 
 false   true 


   
 
    
    


   false   true
   false   true

  false 

 


  true
  
  !
false    !

true  

"     


 
 
 
  

       
 #
 $
  "

 
     %   & 
 
 
       $
 

Theorem 13.9

             
     

              
 

Proof: '          


  
    #
   &

  true: "   


     

   
  true 

 

  false: "   


     

     false
 


  : (     


  
 
   
    
   

  ½  ¾ : )  
½      
       * 
½ ¾ ¾
 ½ 
  ¾  

(   ½  ¾   
 
  ½
 
  ¾  + 
    
    
 
  ½


  ¾ 
  
  ½  ¾ 

  ½ ¾ : )  
½      
       * 
½ ¾ ¾
 ½ 
  ¾  
348 Logical Properties of Processes

  ½  ¾  

 ½ 
 ¾  
       
  

  ½ 

  ¾ 
 
  ½  ¾ 

   :
    
     
      
   

    
 
¼ ¼ ¼

       



        ¼ ¼


 ½           


¼ ¼

  
 
  
 !
¼

  "#:   
     
      
$  
  "#    
 ¼
    
  ¼

  
       


¼ ¼

    
 ½  %      "# 
¼ ¼ ¼
 



  $          
¼



  
 !
¼


& 
 '           
    
  (
 !
     )  HML 
'  
 
  

Definition 13.10

HML     HML *    

    HML


           
  
     -logically equivalent    
        
    HML            
         
     

  
     logically equivalent    
       
    HML           
        
     

Modal Properties and Bisimulation 349

 
          
Corollary 13.10

     
         HML  
 

     


  

Proof:               HML 


                   
     
                   
     HML   !         
      !        "  !  
    HML          HML #
          $  "  !     
!              "$   "
 
Theorem 13.10

    


         
Proof: %          !    
                 
      
     &         ¼   

'         ½        
              
¼ ¼ ¼ ¼

  ( ¼

  
 ½  ¾   
    $  "  "           ¼

     )                  


  ½  ¾                  ¼

     )         *  


     ½   ¾       
+  ½  ¾           ½  ¾        
350 Logical Properties of Processes

Corollary 13.11

 
           
Proof:      

        




           



    Clock  Clock   
    
  !  "#$%     
   &

 
           Clock  Clock


     Clock Clock 

     
Clock Clock ' ( Clock  Clock 

13.6 Characteristic Formulæ


)     
 ! %  
 HML 


characteristic formula    
  

  *
 +  ! %   
   

  
     
 0 

 !0% + , -false
  
         
    
 .

Exercise 13.11 (Solution on page 483)

 /       


 0 
 !0% + true ,-false ,-,-false
" )    
 !0 0 0%

       


1   
 
  ( 
  
 2(    

     

(       



   

1*       
    
        .
  
   


Theorem 13.11
            
  
   
        ! %  HML          
Characteristic Formulæ 351

      

 
            
  


  
Proof:  
   
   
 
    true 
 true   ¼ 

   States        



   
   
     

½      !  
 
¼ ¼

  
 " #    !    
¼ ¼

¾
$        !
 $ 
% 
      

     
!   
                ¼

       

        ¼

 $ 

% 
      

     

 
        !   &   
   
         

     
        
   
¼ ¼ ¼

'
&           
    (   &
          (         ¼

    
   ) 
           
   *  
     
   
+   ·½  

 ,    
 ¼
     
¼


    
 
¼ ¼
   ¼ ¼

    
    ¼

¼


 ,   
 ¼
" #    ¼

  ¼


      
 
 ¼
  
¼ ¼ ¼

    
    ¼

¼

-
     .  ·½ 

/      ·½ 

,         .      


 
¼ ¼ ¼

       
 
¼

¼
   0       ¼ ¼

     
     

¼ ¼
352 Logical Properties of Processes

true States
false 
 
  
  
  
 States       
¼ ¼



 States       
¼ ¼

            HML

    
¼

      !  " #        


¼ ¼ ¼

     !  


¼ ¼
   $       ¼ ¼

         ¼ ¼

 
   ¼

¾ ¼

%  ½   

13.7 Global Semantics


$   " &!  '         HML  ! (
      !  HML      &   ! 
 !   )   &      &    
      
$  " '            "   (
  &   States           ! 
   ! *    '   &    &   
Theorem 13.12

       

Proof: +!          !    (


   
 true:  true   States   true
Additional Exercises 353

 false: false       false

  :        
            

  ½ ¾ :
 ½ ¾
  ½  ¾
   ½ ¾      ½  ¾
 

 ½ ¾ :

½ ¾

 ½  ¾
   ½ ¾       ½ ¾



  : 

¼


 ¼


¼


 ¼
        

  :   
¼
 ¼


¼
 ¼
         

Exercise 13.12 (Solution on page 483)


     
 ½

 

 
¾

 
   
  true
    true
      false
 

  true
    true
      true
 

13.8 Additional Exercises


 !   
   HML 

 
" 

 # Cl  $% & '
 (  
  ( !   

  HML 

   Cl "   Cl  !  

 )
 
    false *   !  %  



 +
  *
354 Logical Properties of Processes

 
     

    
 
       
      
    
    


    true  true

   true  false

  
         !

 
 " 0 #   0


 " 
  
 " 0 

$ 
   

    
 % 
  &
 '  
  '       

   
           
true   false  0

true
true

 true

 true

 true

  true

 true

(  
        !

  
   

 
 

)% !    ! 



  
      
*  
  !  !  !  
   
 

   
Additional Exercises 355

    
               
  

¯  true   true


   true  false
  false  false

              !  "" 


 #$%

 !     


     
            & '( 

            & '


)  *  !        +   
 
  ,          -./
 
true  
true
 
true  
false
  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   

;  HML      2-  3   !  0


  ##$+      3 + 
  + 
 
   -.  HML 
356 Logical Properties of Processes

  HML    


HML
    


  


  true 
   


  HML     
   
! "
 #$
 % & $'         ' 
  '  
     

HML 
#  HML    
HML
    


  


  ( )false 
 

    *   

 
  HML     
  
!  +
 % && '       
 ' 
  '        

HML 
Chapter 14

Concurrent Processes

  
  
  

        



    

  


  


 

          


 

        


      

      
      

       


     

             




    


  synchronisation merge  


       ! 

14.1 Synchronisation Merge


    
       

   
  !        

   !  "    


#
$      

             

      


      !

Example 14.1

%           "  #

" "  &     


      " 

 &      


"    
" '

 "    &  


" " &    

  # " 


      "   & 
 

    

   "   


       

 
(

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_15, © Springer-Verlag London 2013
358 Concurrent Processes

 
   




 

     


   


    
         

   
              


 
    
          
  

                  
 


  
               
  



     
  
         
     
                
 
                 
                   
    !!         "


   


  

  
  


#             


   
   
              
   
    
$   %               
              
Synchronisation Merge 359

  



      

  
 
      
  
  
 

 
       
   

  
   

   
  
           synchro-
nisation sort Sort   
     
    


 
 
         
 

         

   


  
 
 
           
  
  
   
  
    

 

     
  
   

   

Example 14.2

!  Sort 
  Sort "    Sort "   #
"

     

 
   
   
  



        
       

  
  
  

        
  
 
   $


È  É

Ê 


     

    
    
   

     
      

 
 

    
    
 
    
      
    
 
      
 
   
   

     
   

  Sort     "   $

È É Ê 




    

   
   


  
  
 
 
  


  

   %  
 

       

     &   
 
   

   

    

   

   Sort   

    

 


    


   '    
360 Concurrent Processes

    


            
          

Sort   Sort  Sort 

    
   
  
    
 
 
   synchronisation merge      
   

        
   
     
 
  
   

 
  

     

       
    !
"     
 
  
   

  
  

     

       
    !


#     
 
  
         


  

         

  

$ 
  

 

 % ¼
  Sort    

¼
 
" %  
  Sort    
¼
¼

# % ¼

 
  Sort
¼
 Sort   
¼
 ¼

&       


'  
  (
      
 

    
  

Exercise 14.2 (Solution on page 483)

    
 
 (
     
  
  )

*     
'   
           

      +        
   

      
(
       
  

  
 
  
 
  +      

 )

14.2 Counters
 ,
-counter 
    
  

$
  
      

 ,

 
  
  
   
!
Counters 361

¯         
      

¯      
   

           !


 " 
  #    

          !




  

 

$        %   !


 " 
  #  ¼



¼
"   ¼¼
#   


¼¼
"    ¼

          !

 


¼ ¼¼
  

   

&            '   (  %  

$   Sort)* " 


              

 !

 
 


    
    
   

 
  
362 Concurrent Processes

  


             
 

 
        


             
         


     
  
         
  
   
 
              
    


          

    
            

      
     


  
 
   


Exercise 14.3 (Solution on page 484)

    ¾  

14.3 Railway Level Crossing


    
 
 
     ! " #  
         



 $ 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




 
  
   

 

    



  
 

  

      


 

Exercise 14.4 (Solution on page 484)

    

        
  

    
    

¯ 
  

 

      
¯ 
  


          
    
      

14.4 Mutual Exclusion


  

   
      
  

 
  
  
  
     

    !
 "    #
 $%     
 


        
     
 
 
Mutual exclusion             
    

    critical section &   

   



      &
  
  
   
  


     
  
 
    
     
   
 
  " 
'
           
14.4.1 Dining Philosophers
"    
  
    
   ()*+
   ,

      
  

  

       
     

366 Concurrent Processes


 

 

 



 
   

              


           
    !             "#
  $               
 "       
   %
             
"    Ý &        " 
          "       
  &  "         
   "           
 &             
       
' "      (        
     " (  !     

 &         "
Ý 
 
    
  

 

   
   

    
  



 
    


Mutual Exclusion 367

   
   
     
 
 


 
  
                  
       

 
  
 
  
     

    !
¯  ! 
      
¯  ! 
        
¯ 
 ! 
       
            !

½ "   
   #   
  

 "   
   #   
  

 "   
   #   
  

 "   
   #   
  

 "   
   #   
  
               
     
   
   $ 
 
     
  

  
%         &      
  
      &                 
'  &                   
&   

     & !



 "       
  
  

 "       
  
  

 "       
  
  

 "       
  
  

 "       
  
  
           
      & 
 

  

 !
Sort  "   
 ! (    ) 
Sort  "   
 ! (   ) 
* 
   
  
   
 !  

                 
         
        

  
   
            

%  
   
      &     &  

  &  
    $            
& !
368 Concurrent Processes


½    
 
 
  
            
 
Exercise 14.5 (Solution on page 484)


            
 
      

14.4.2 Peterson’s Algorithm


    
 
        



           
    
! "    #$%#
                
           &    ' b1  

      (  )      b2   

      (  )    *     k  

#  +      , -  (  

  )      &     b1  b2  
       
 k   
             (   
  
         
  )
 ' while true do  ' while true do
                   

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  

    k  +  
    
          .   
     
              ( b2   )  
      
        ( k  

#)          *        
       b1    "          

                   
        b1 b2  k           
Mutual Exclusion 369

   


½ ¾      b1 

      
 
 


                
    
 
  
                
Sort             
   

       

  
      b1 
  !
 
"  
      !
  
      b1 

  ! !


 # 


   !      
  
   
 

  
           

 
  

           !  b1 

 
"      
 
  

     


      !  b1 
! 
        


    
 

 # 


  !      
  
    


  
            
     
 
  !      b1  
 
 
"      
 
  !      b1  

  ! 
        

 

 
 
 

$        
  !   
    

"

  
 
!
    
    
 


    b2 
!
  
            
     
 
 
 
           
  
   
Sort              
   
% "     k 

    
& 
 '( &  ' ( &  ' ) &
  
'( ')
' )
&  ') &  ' ) &  ' ( &

  
& &
Sort&   '( ') ' ( ' )  ' (
' ( ' )
370 Concurrent Processes

 
  k               

    
  k            
           
  
               ½  ¾   

                

               !
"         !   # 
  
          
   b1     
  
k  $

 %  &


#               "   


        $
while (b2 and k=2) do skip

#             


   b2   
          
   k       &  
  '
             
   b2   
          
   k       &  
         !
        
           $
%   

( &   (    ( &  
)                    
!  "     
   
  b1     
        $
 %

      
#             
  

$
Sort  %   & 
 
      
         
#                 $
 %   &  


 %    ( &    (   ( &  




 %       




Sort  %     & 

#                    


   !$
A Message Delivery System 371

½   
½ È 

    
  
Ï ½

Ï 


 ¾     


Ê ½ Ê 
   



   
 
        
   
È È
  

    
 
 È È       

Exercise 14.6 (Solution on page 485)

 
 
     È  È      
 

    
  

14.5 A Message Delivery System


  
           ! 

  

              
     

  
            " 
! 
  
   
 
    #  $ ! 
  
  
                   %
 "
 
           
      
  $  
       &    !   

     
    !    
   


  !  
     
     

 
           

   '  
  (in)  *!    
   
  '    
(snd)  *!         
 
 
 
        

   '     (ack)  *" 

          ! 
        
 $
     &  
 
 
       
 
 !  

 
     
  

  
   '     (err)  *" 
   
  
 
  +   

      

    + 
   
 

   

   
     
   Sender  ,    
372 Concurrent Processes


Sender in snd S
S

ack Sender  err snd S

SortSender snd ack err

 
 
     
in
Sender sndS
err

ack snd
S

           snd 




       
      rcv 



    
      
     
  
 
             err 




    
       
 
   
                
Medium 
    

snd rcv Medium  err Medium



Medium
SortMedium snd rcv err 

 
 
     
rcv
rcvMedium
Medium snd 
errMedium
err

!
  
             rcv "


       
out 
   


#

   ack 
        
"
  
             
Receiver 
    

Receiver rcv out ack Receiver
SortReceiver rcv ack

 
 
     
Alternating Bit Protocol 373

rcv

Receiver out ack Receiver

ack ack Receiver out

  

 
 
 
 
 






System  Sender Medium Receiver

 
    


ack
snd rcv
in  
   out
err





    
  
 
  




  

    
  


  
 

     

  

 

 
   


   
   
    


 



   
  

    
   
  


  
 





  
  !  "# $

Exercise 14.7 (Solution on page 485)

%
      
 

 





  

  

  &'

 

  
  
  

14.6 Alternating Bit Protocol


    
 
   
  (    




  
 
 

 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


      

          !       


 "    #   "      " !   
"    !#   "  "   "  ! 
"$             "    
        !   #    
 !   "  "  %       "#   #
       "        " !" 
"  &     #           
# "     !       
 "  !    !        

'  #             ""(  


   #   !"( !   !  "     ) "  
             " 
        # "          
  "  ! "   # !       "  
Alternating Bit Protocol 375

 
    

     



     
     
   
 


     

            

 
           

     
   
       
 





  
         
 
    
       

     
   

 
     
        
  



   
 !
 
 
  
 

 
       
   
 
 

     



        



   
 
  

 
 

¯        
      "
 
#in$ 
%
 
  
  
   
   &  ' "    
#s¼ $
 #s½ $   
%   
 


   
  
       "    
#ack $
 #ack $
  %

( 
    


       
    )     
         

*  

     


      
 
         
    

  
"  #t$ 
%  
     "  
  
 

   %

          +


    
   

 , Sort" % , s  s 

 
, 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 

% r outrack  & r rack 





% r outrack  & r 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 
 
  
 

   #

 
              

14.7 Additional Exercises


$ % & '
 

  (#       
    
#

  
378 Concurrent Processes

  


  
   



 
 
 
 

 
  ¿ 

    
    

  
  !    

"      
 
   

 

 

  
  

 
  
  
   #  

 

  
     
 $    
!



 
   %&'

down
 

$ green

up

red

 (

#   $ &    

#      $

 (


#    
%&  

 ) 
) 
 )  ) 
!

   
!  


 $ 
 $ *

!     

 ) 
 
  




  !"  

 ) 
 
  
 
 
  
   




+  ,   
 

   
 


 !!

  

 -   

   

   
 

 


 

   !.
 -   

   
   

  



  

   

/ 0
  
!
  

 1 0   


 2

 3

22
1 0    
4     
  
Additional Exercises 379

½ while true do ¾ while true do


  
    
 

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   


      

 


    

  
     
   
 

 ¾ HML

   
    
   


  
  
     !
   
" # $ 
      
 %  
   
   

 
 


 
          


 
   

    & 


  
 
   
!   '    


     '            


   
       (
    

  
      
       
    

                


 

) *    
       
  + 

 

, 

  



   temporal properties    


   
  
    
      

 -      



  
      

     



    
     
    


  '  
   

    
  

   


 

¯ Safety properties 


         

     

     
     

 . 
 
  
   
    
  

    


¯ Liveness properties    

 


  

       



     
 

  
   
   

 . 
  


       


 


F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4_16, © Springer-Verlag London 2013
382 Temporal Properties

   


 
    
   



 

  

   
   

  
 


   
   
 

15.1 Three Standard Temporal Operators


  
  
 
   
  


 

 


 

 
 



 
    

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)

' # 
   

  
   
    
  (   "
  
 

)  
   * +
   ,!  #    
 
 



15.2 Recursive Properties


' 
 

 
   
     
    

   
  # # HML  
# -
"%      "
   

  
  

  
      
'            %      %   #  
$
    %      %       
'  

      # HML%     
  

       # #  

  .
%     

 ( /01 #       
      
2     #      
        
     
      %      %     -
"% 
             %          

     %      %     
 
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

Exercise 15.4 (Solution on page 489)

(    %)&
Recursive Properties 387

15.2.1 Solving Recursive Equations


    
          
           HML
    
                    
          
    
   
        
    
    
        
    !

 V   V

              V    " 


       #   V  V$ %     "   
       V             
  States 
 

  V 
 

 V&   '       V         


    !

  
 
V &   ' $ % 
 V $ %
 

Example 15.4

(           


   

               
   
     
!

   
        
   
          

      



       
)  States    
   !
  
  States !








 V  
 States !
 
     
             V   

*                  +


       ,  
  "      
388 Temporal Properties

  
   V
V V 
V   V  V 

            
   
 

          
Exercise 15.5 (Solution on page 489)

               


  V   


   !"#
$         
%     %    
                       
       
15.2.2 Fixed Point Solutions
&  '  States   States   

    V   

(      %       


fixed point 
  % '   States  %       )
 * +( ,
(  (  -!.   !/#   %        
    0   %            0    
 %      % (    %      %    
%  
     
Theorem 15.5
    HML 
         V 
W       V  W       V  W 

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

   :  V    States         V


¼ ¼

    States         W


¼ ¼

 W

 
:  
V    States         V
¼ ¼

    States         W
¼ ¼

 
W 
            
              
                
     !  !      " # 
  #  "         #    
 !            #     #! 
 !          #  #   $ %  V &
                   
 '
          (  )* +      
   !

          & 

      #!   

,#          #!     


        HML         
        modal mu-calculus     #  
#           #   ! 

Exercise 15.6 (Solution on page 490)

-         #  # 
 $ %  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  

            

15.3 The Modal Mu-Calculus


  !             HML "  
  " ! #  $      %   
   %!    &       #  '(
) 

 true  false          

     

         *+  *+   ,  
  #    *  +  $     
      %!     )      
 &        V   #      
  %!  


-  $ %          V " %  # 


       #      $   V "   $
                
   HML    ./ #        $   
 $  &      %!     $   0,
  12&  34&   0,   
  #           V    
5     HML   &  #   !  


      


The Modal Mu-Calculus 391

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 true   


 #V false   
 #V          #V    #V 
 #V          #V    #V 
 #V
      #V    
    
 #V $ %      #V   
    
 #V        V 
 #V        States &    

  #V   

 #V
      States &   
 & #V  

392 Temporal Properties

     
  
            
               
V     
V

  


 
  
    
    

  
    
     
 
 HML  

 

 
            


Exercise 15.7 (Solution on page 490)

   

 
    
        


!
neg"true# false neg"   # $%neg" #
 

neg"false# true neg"$% #  neg" #  

neg" #
 neg" # neg"# neg" # neg" #
neg" #
 neg" # neg"# neg" # neg" #
neg" # 
&
  V neg" #   
    V     V" # V" #

15.4 Least versus Greatest Fixed Points


' 
  

 (   
 (
(   
(
 
(    
    
   )
   
  (

    (
(     (
     
    (

  
   
 (

*
    

     (

   
  (
(   

  + 
,  
-  (
(       .  
     

  .  
  ( 
 

    
      /   
   
 (
(
      .  

Example 15.7

 ((
  
(  (
(     . 


    
  ((    
  (
(    

 * 


  !
   
  
Least versus Greatest Fixed Points 393

 
  
   
 
     
  
 
  
     
      
            

Example 15.8

       


       

  


  
   
 true   
          
       
        
        !
   
      
 true  

 true   true  

 true   true  " true   #

 true   true  " true  "  ##

15.4.1 Approximating Fixed Points


$
  
           %
     &          %
' 
               (  )
 
         ' 
% 

  '  !   '         


  
       % 
 
false  true      '    %  %  
 
Definition 15.8
   
           mu-approximant   
   nu-approximant         
  

394 Temporal Properties


¼
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
 

'     " !      !


# ! !
 
  ! 
     #(#
      
  
  
  
  true) !

  #   !  
   
  ! 
     
(#
     

     
  
  false ' ! ! !  
   #      

 
 
 #
"   !
  # #      


 

' *#
 +, ! #
 !        
  
 
# #
    !  
"  # 
# #     
  #
   
     
     
     !        
 )

  !  
"
 $  +-. $

 (   !  &

        
   # #
" 

  "  #
 
 
         
!   States $   #   #
  !

396 Temporal Properties

Theorem 15.10
     V    States    V         V 


Proof:    
     
 

 
   
   
  
    
!       "  
 
   falseV   
 V
!  
 
  "   

 
     
     V     

  V    
V

  #    $V
    V



Example 15.11

%
    & 
         
 
    '

    #$
(      
 

       V '  )    


*
  
  
) ()  +,  +-.   
 ) 
)   "   

  

)
  
     
  )  (  


 
     /"    
 )  
 
 States "  

 
States  States
 
States    V
 
States      V '  )     V
 
States      V '   

)    V

  States     
"    
  
    
 

Expressing Standard Temporal Operators 397

   

              


 
               
 


   
        

Example 15.12

      


    

  
 

   false 
       
 ! "     States         
¼ ¼

#       $  $ %&' 


  $   
 
States   

 !States"  States
$ 
 
   
      
 
 
 
           

  
 

(   
  $  $      

 ¼ ! " 
 ½ ! "     States    
 ¾ ! "     States        ¼

 ¿ ! "     States       ¼

     ¼ ¼¼


  ! "  
  
 
       
 
   

    
 

 
    
           
 
 
   

       

15.5 Expressing Standard Temporal Operators


         
 
  $
      

) 
    
           
      
   *  ! $ true    

"
   $  $      
   
398 Temporal Properties

  


    
 
  
 


   
 
  

   

 

 
   

 



 
 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   !

Exercise 15.12 (Solution on page 491)

%!        


  !

&
     '
(!       
     !



&
    '

)!       true         


        !

&
    true    '

15.6 Further Fixed Point Properties


     *             #

 + !
There is an path.
,        
         +
          !
                  
               

           

"            #


      
        
        

  #
  $
    !
400 Temporal Properties

There is no path.
    

 

    
  
 
  
  
      
  
 


   
neg   ! " #$ 

%
      & 

 " #$      

   

  
 
    

   


   '      

 
                 
  


(
 holds at every state along some path.
      

  
  (

   

 holds somewhere along some path.


) 
        
 
    
   

(
 
   
 
     (   
& 

 "    
 
  


     



  
  
 
  
 

*    
(    

     

 
   

  
  
 
   &     
  

    
         (   
  
+
 
 
        (   
  
,     
   
  (
    - 

   .  


     !   


  ' 
  

 
 
   ( 
 / 
  (
 

 
 

     !   
Additional Exercises 401

 holds at every state along every path.


     
   

  
 
 
  

  
    
 
   
    
       
     
  
   
     
 

 !
            
     
     "  
   
            

   
 


    #      
 
  

  
$   
  %   


       
      
 &    
   
 
 
'


     
Exercise 15.13 (Solution on page 491)

( '   
 ) 
   

 
 !      
   


 


*  almost always holds along some  path.
+
 ,
   
 
        
 
      ,    
     

  
 
     
 

     
-  holds infinitely often along some  path.

15.7 Additional Exercises


* (  

   weak until 

 
  
       
        
 

  
     
    
 
       
     
 
    



-  
  .
 */-         
    

    
 0 true  false
402 Temporal Properties

    

       


        

 
   
  
    
          

 
        



     !
" #     

     
  0 $  0
 % &  
' %                States(
 V  )  V 


 %   )V  (    (    V (        


 *     +
, %   
  &  -(   States )   V
    )  V  

. 
     

      +
           

            

             

/ 
  

        +0
 ( 

      entry     
 
         (     entry
       exit  
1 &      
    

   
         (      2 3

    

              

         +  *
- 
     

      +
 4        


 &     

          


 (                 
       
 4    (   

     
 4   

     (          


 4    (         
 4    (       
 5   )  $ 
(
)  (  )
  
 (     
    

 #

6 )   true  23 23

Additional Exercises 403


¾   true    
 
       ¾  
½
 
          
 
 

    

      
Solutions to Exercises

   
       
 

Chapter 1

Exercise 1.1 (page 20)


                



    

      !" #$ 


 
      %   
&  
 


'        


    

  " 

    &'    "      ! (  

   "      ! 

Exercise 1.2 (page 20)


 )    & 
) " ! 

 

&"
  & *  ! *  *   " ! 
 * 
  *

 +" 
 !  !  
  & 
+


! & 
  &"
  &  ! *( 
&
" * 

 ,
 
 *-  !&    



 .  
( 
 $ 
 
 " *
  


 *    * 
!   

 )    & 


) 



!  
  "             * (

!   


 
&   *  + * !  

 
   "  /


       

  *

 )    & 


) 

  !
 
 

 
&   


 )    & 


) 

.   " 


& *

 ! 
  &
&    *

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4, © Springer-Verlag London 2013
406 Temporal Properties

   
        


   

   


         
   
            

 


      
 
  
  


 
         
   
 ! 
 "  
   #
   $  
%

$  
 
   %  
   


    
  
    



     & 
  &     

Exercise 1.3 (page 21)


' (     

) (     
 ( 
 
 # 
   
         
 


   

!

  "    
* (      
 +     
   , 
    # 
   
       
 
  
  # 
      


      
 
- 
    # 

       
. (     
 /
        
# 
          
    
  
0 (      
       

Exercise 1.4 (page 23)


' $(    
  
  
%
) $+    
   %
* ) 1 ) .

Exercise 1.5 (page 24)


' (    
  
   !      

   "
) (    
   
  
* (      
  

Exercise 1.6 (page 24)


' +
  (  
   2       

        3&
 4         

Additional Exercises 407

     
 
      
         
     
 
  


                
 
         
 
!  
  
  "    
   
 
     
  
    
#        

 

Exercise 1.7 (page 25)


$   

      %     " &  %  

#
   

   %    
    
    % 
  

Exercise 1.8 (page 26)


$ AmandaHappy  JoelHappy
 AmandaHappy
 JoelHappy
 AmandaHappy  JoelHappy

Exercise 1.9 (page 26)


 
    
 
!    '  " (
! 
(#  
 
  
   
    
  
!  

    

Exercise 1.10 (page 29)


$    ) "   #
    ) "   #
    ) "   #  "    #

Exercise 1.12 (page 31)


$     
     
 *

 
 

       
      
 

  

 
     

 "  #  "   #
408 Temporal Properties

   
  

  É  È 
     
  

É
È É

          
    
   
  È
É  È     
 È É  È 
!   
  

" È É  Ê  È É  È Ê 
     
  


È  È 
É Ê É
È Ê

#  
     
  
       
   $  
    
$    
   


    

Exercise 1.14 (page 33)


 
  
 
  

 
%  





  
       
  & 
 

  
'  (
 
   
) 
 

  

$
   

*     
$

       +  

   


  
  

Love ,- . $     /


Police ,- . 
  
  
/
Sup ,- .     )/
Long ,- . 
  
/
Poet ,- . 
 /
Prison ,- . 
   /
Cousin ,- .   )0 /
Additional Exercises 409

   
      
    
 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

Exercise 1.15 (page 34)


  
 
 
     
   

 
   
        
           
    


 
KingMoved LeftRookMoved
 RightToCastleLeft

KingMoved RightRookMoved
 RightToCastleRight
  
 
 
  
 
  
   

 

        
      
   
 
          
       
 
 
         
         



RightToCastleLeft RightToCastleRight
PieceBetweenLeft PieceBetweenRight
KingAttack KingAttack
LeftSquareAttack RightSquareAttack
KingMoveLeftAttack KingMoveRightAttack
 MayCastleLeft  MayCastleRight

Exercise 1.16 (page 35)


    !   
     
    

 
 !
     " 
    
 
 
 
  
   
    !
    
        ! 
     
   

  
 !
     " 
  
 #  FonJ OonJ   FonJ OonJ 
  JonF OonF   JonF OonF
 JonO FonO  JonO FonO
$       
   !  %  
# FonJ  OonJ  JonF  OonF  JonO  FonO

        ! 
 
 
    

   
    !
    
Additional Exercises 411

 JonF JonO   JonF JonO 


  FonJ FonO   FonJ FonO
 OonJ OonF  OonJ OonF


         
 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 

Exercise 1.21 (page 42)


-,
           
 You understand implication
 You pass the exam


         



    

' $
   
F F T
F T T
T F F
T T T
& %
412 Temporal Properties

  
    
      
   
 Í    È       
 

    
   


Exercise 1.22 (page 44)

         


 
 

   
      
  
 


       


 
         
 !      

  Ò 


       

    
 " #    
 


  $
  %       
 


       
  &
 '  (  )*  
    

  

Exercise 1.23 (page 44)



' $
È É (È  É*
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
& %

Exercise 1.24 (page 44)


' $
Ô Õ Ô   Õ
F F F F T F
F T F T F T
T F T T T F
T T T F F T
& %

Exercise 1.25 (page 46)


 Ô  Ô Õ  
     
' $
Ô Õ Ô   Ô Õ
F F F F T F F F
F T F T T F T T
T F T T F T F F
T T T T F T F T
& %

 Ô Õ  Ô  Õ    


' $
Ô Õ Ô Õ  Ô  Õ 
F F F F F F T F F F
F T F F T F F F T T
T F T F F F F T T F
T T T T T F F T T T
& %
414 Temporal Properties

         


 
     
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
& %

Exercise 1.26 (page 47)


 

       
   



' $
Pressure Height Land   
F F F T T T
F F T T T T
F T F F T F
F T T T T T
T F F F T F
T F T T T T
T T F F F F
T T T T T T
& %

 
    
  
 
  
    

 
     

    


  
 


    
!     
  
          

  
    
"
  
 #             

 
 #      
    



   
Additional Exercises 415

Exercise 1.27 (page 50)

      
        

 false     

   false  

   

     
      

    

    

      
        

           

             
  

          

     
      

            

         

    
       

          

            

             
  

          

      
        

         

            

         
416 Temporal Properties

Chapter 2
Exercise 2.1 (page 59)
    
 
 
     
             
   
    !      "  
#      $  % & '  (  ) 
 *  " + 
  *     

Exercise 2.2 (page 60)


  # , - . 
  

Exercise 2.3 (page 60)


       !   #   


Exercise 2.4 (page 60)


/    / 
Exercise 2.5 (page 62)

  !      


Exercise 2.7 (page 65)


0      ' 1   ! !       !+ +  '
     ! 
        


   2' 
 
  !  
      
  3
+ ! 4!      

2  
    
Exercise 2.15 (page 69)
 5     
2+   
  /   6 
 7   8   /   ,  - 6 
  7   8 /    6 
# 7   8   /   # 
 7   8   / , - 
Additional Exercises 417










 

 
       


Exercise 2.16 (page 69)


         ! " ## 

 $  % "   &     & 



 $  % "  
 & 
 $    % " 
  
 $     % "    
Exercise 2.17 (page 71)
'   & ( )%  & ))%  & * %  & +"   & ,% - 
 .      /
&  
              
               
           
           
              
              
                   
                 
           
       

* # 0))!% "  " ))-  1


418 Temporal Properties

¯    
    
   
¯          
    
 
¯    
       
 
¯    

       
   
¯    
        
     
¯    
    
 
   

Exercise 2.18 (page 71)


             
              
Ò Ó
                      

Exercise 2.19 (page 71)


         

Exercise 2.20 (page 73)


Ì Ë
¬Ò     ¬Ò   
 
 
      !         "
 


      !           

Exercise 2.23 (page 75)


   #     #            

Exercise 2.24 (page 76)


$   
        %
Love  
      
    
Police  
       
 
Sup  
      
  
  &
Long  
   !
    
Poet  
    
NoPrison  
      

      
Cousin  
         &

'
       
    
       %

 Police  Sup
Additional Exercises 419

 Long Poet
   NoPrison
 Cousin Love
 Poet Police

 Sup Cousin
 NoPrison Long

              
   

  NoPrison   


!   Long   NoPrison Long 
!   Poet   Long Poet 
!   Police   Poet Police 
!   Sup  " Police Sup 
!   Cousin 
 Sup Cousin 
!   Love   Cousin Love 

!        # # #   


        # $%    & %    & 
   %  &  $ '%        '

Exercise 2.25 (page 77)


(   $         $      # & $ 
$      &  & $   $      & $  
#  $  !   &$     

     )    
 $ $ *     # +  #$

Í 


,   $ $      #  $     


 #       &    %    &  & $
     #  $ 
420 Temporal Properties

 

 
               
 
     

Exercise 2.26 (page 77)


      

Í       


  
  

       !    "      
    !     #       $! 
$%   &%'        ! 
   # '    ( !)   $!  $%  
      %'   $%    
 *      !  $     
  !      

Exercise 2.27 (page 80)


        

Exercise 2.28 (page 80)


 (  ) # (  )  (  ) 


#   (  ) 

 

# (  )    


#   
 
Additional Exercises 421

Exercise 2.29 (page 81)


¯   
     
         

                
            
Exercise 2.30 (page 83)
         
              

Exercise 2.31 (page 83)


!  "#
 $   %
      
            % $    &   '
    & $     
    $  
      % %  
   
 $& $ $      $        (
     $$ % $   $$   
 % $
$  % )$    % &   &  '
         
$          *$         F

 $   %
 % $  '
       


Chapter 3
Exercise 3.3 (page 89)
   $ $%$   & 
$     % 
$ 
$  &  
      +$ *  
$ 
 )$ , $& 
  %
 -    - - 
 $ %     & ) -   .  %
 /  $ $  $      &  
 $
   '
422 Temporal Properties

               


                  
                  
              


  


Exercise 3.9 (page 92)


      
  
   
       
!      "#      ¼

$          %  & '    "(


¼ ¼ ¼

)   % ! '  %
         ! *
       '+
¼
 ¼
      
¼ ¼
  

  ¼

   ¼



  
  
 

Exercise 3.10 (page 93)


 ÜÝ  Ü Ý   Ü  Ý Ü  Ý 
¼ ¼ ¼ ¼ ¼
     

 ÜÜ  ÜÝ  Ü Ý  ÝÝ
¼ ¼ ¼ ¼

  

 ÜÝ  Ü Ý ¼ ¼

 

  

 )  Ü  Ý  Ü  Þ 
Ü  Ý  Ü  Þ    ¼ ¼

ÜÝ  ÜÜ  ÜÝ ¼

  


 Ü Ü  Ý  ¼
 

 Ü Ü  Þ  ¼
   

 ÜÜ  ÜÞ ¼
 

 ÜÞ 
  


 '  )!   '  %     ",  Ý  Þ 


"  Ü  Ý    Ü  Ü  Ý  Ü  ÜÜ   Ý    Ý    Ü  
¼ ¼ ¼

$       -  Ü  Ý    Ý  
.  Ü    Ü   
 Ý  Ý  Ý  ÜÝ  Ü Ý 
¼ ¼ ¼ ¼

%    Ý  ÜÝ  Ü Ý   Ý    / - Ý   



¼ ¼

Ý   ' -   ÜÝ  Ü Ý  Ü  Ü  Ü
¼ ¼ ¼ ¼
Additional Exercises 423

Exercise 3.11 (page 94)


 ¼
 Ü    ¼ ¼
    ¼ ¼

    
 ¼
   
¼
 
        
    
         
 
¼ ¼

Exercise 3.14 (page 99)


 
           
 
 

      ¼

! "    


 #


 

Exercise 3.15 (page 99)


 
 

   

 #  $

 
     

$
" #
 " 

 
 


 

 
 
"
    

%
 $
"      
&
 

      

  ¼
' ' ' ' ' '
  ¼
' ' ' ' '
     ' ' ' ' ' ' '
     ' ' ' ' ' ' '
  ' ' '
   ' ' ' '

   ' ' '
' '
424 Temporal Properties

Exercise 3.16 (page 99)


    
     
       ¼ ¼

                  ¼

     !         



 
 
 
 
     
¼ ¼
    ¼

Exercise 3.17 (page 102)


"#  ""  $%

Chapter 4
Exercise 4.2 (page 111)
%  &      &    
     ' ( " ) " ( '    
"  &     " 
*  &
        
       
(  &           ¿ &     
$  &  
 $    
   ¾ &
 $  
     * " " * % (
) $ % ' " + * ,    
Exercise 4.5 (page 115)

%           

"         

*            
Exercise 4.7 (page 117)

%      

"           
Additional Exercises 425


 Ü              

  

          
   
  
         

   

Exercise 4.8 (page 117)





 
 
  
 


  

 

             


   

  
 
  
 

        


 
  


            



  
 
 


 
 

   
     
  

  
 


  !



     
 
     "
  
 
    # 

      


  
 

  


Exercise 4.9 (page 120)



      
$ %  
&  
     
½ ½ ½

 %  
       
¾ ¾ ¾ ½ ¾ 

Exercise 4.10 (page 121)


$   
  


   ' 
  (
) 
  *

 
 
  
* 
 
  
 

&     
  

  '   (  
 
'   (
) 
  

     
 
426 Temporal Properties

 Ü   Ü   Ü 
 Ü   Ü   Ü 
 Ü  
 Ü    Ü  

 
 Ü Ü 


 
    Ü Ü  
 
  

 Ü  
 Ü    Ü 
 Ü  
 Ü    Ü 
 Ü  
 Ü    Ü 

Exercise 4.12 (page 125)



   Ü   
   




  
 

 




         !      


         !      

"

# 
$
 
$ 
 $% 




 % 

%   

 % &

 

% 
'

 
    $
  

 


"   $
 
  (
)$
 
 *
% 



 

%



 +  + $
,   

  

$
  
  
  


-         !      


         !      

"   $
   "

$
 
 $
 %   

 $

 . "

 % .   


%% "  $
  

  
 $
 $ 
 
 
!

%% 

 % $

    % "



Exercise 4.13 (page 127)


      
      
      
      
      
      
      
      
      
Additional Exercises 427

Chapter 5
Exercise 5.2 (page 134)

Fact 15.14

       
Proof:     
  
      
  
  
       
                

        
 
       
                 
   
   
          

Exercise 5.3 (page 136)


Fact:                 
Proof:         
         
   
  ! "#$   ! " #$        
  ! %"#$&%" #$& ! ' # " # " # $
! "%" #  # & # $
! "
#$     
! " #  # 
        

Exercise 5.5 (page 138)


             (    
   (
        ')  '#) ! *
    (  
    ')     (
        * +(* +)(  *#+#(#*#+#)#( ! ')
 
  (       * +(* +)(     (
Exercise 5.9 (page 141)
Fact:         
428 Temporal Properties

Proof:    


        

 

    

      


  
  
        
 

  

     



  

Exercise 5.10 (page 142)


Fact:  
    

  
      

 
Proof:    
  
  
     


 
      
 
        
 !     
   


  
      
" 
 

          
   
  
     

#
 
     
      
     
" 
          
    
     $
  
  
  
  %

 

  
    

  
      

  

Exercise 5.13 (page 145)


Fact: & 
  
 
   
 
   
  

Proof:    
  
 
     
   
     
 
#     !         '   
 

  (')   ' !
 
     
  
   ' 
        (  )
#
   

   
     

     
 
  
!        

Additional Exercises 429

Exercise 5.14 (page 146)


Fact:          

Proof:   

                  

           

    
     

Exercise 5.15 (page 147)


Fact:               

Proof:                  


  

         !         
"

    #   $%      

         !         


  

&            

                    

                     

         


Exercise 5.16 (page 147)


Fact:        '   ¾  $ ( ) * +  ,

Proof: &      -         .


   '   /
   $   '   ¾   $

  '  

   '     (  ,   '      (

   '     0  1   '      )

   '     2  3   '      ,

   '     )  +   '      +

   '     *   '      *

 4        '        
    

430 Temporal Properties

Exercise 5.17 (page 147)


     

 Ü   
 

 
      



 

Exercise 5.18 (page 149)


Fact:       
  
      
Proof:  
      
      

  
      !              

  "

 #         $

% 
 
  
  

%             
 
      

        
 

       !            

     
  #  

 
 $ 
   
  
      
& 
         
 
  
     

Exercise 5.19 (page 151)


Fact:  '  # # ()$  $


Proof: *
   ' 
  
 )+ ) ( )(, 


 
%
 # ()$ +) ) ( )(, )+ ) ( )(, ( )



,) )(, ) )(, ( )

,) #)(,$ ) ), #,$  

-

  
 
. /
 ' 
  

  # ()$    


   
0  
 

    


¾
(  '
%
  
   
 
   


 

) + ) ( ,  
Additional Exercises 431

    
  
  


  
  

     
Exercise 5.20 (page 152)

Fact:            

Proof:   
      
      

 
 
        
  

– !   
       
     
– !  
      
     

!    "
      
  
      
        
    

– !    
     

   

 
     
 
      
– !   
    

   

 
     
 
      


     "
       

Exercise 5.22 (page 153)


Fact:  
   
 
"    
        
Proof: 
 #
" 
" 
 
      

 " 
  
  
      
  

   
  
  
 

  


 

$

%   "  & '    

 
     (           

Chapter 6
Exercise 6.2 (page 158)
 rangescore  ) * *+ ) ), -* -, ,, + ..

 score ½
  / -.

432 Temporal Properties

Exercise 6.3 (page 158)


    
          
    
  
 
    
 
     
  
 
 

  
 
              
  
  
 
           

Exercise 6.4 (page 160)


graph         

Exercise 6.5 (page 161)


  
  score    
  !    ! score"  
score#$  % ! score&   score'
  
   ( Ê  Ê  )      ¾    
  !  
 !        * 
!            Ê 
  
   (     )      ¾   
  
Exercise 6.6 (page 161)
  
!    !       +
 
  score 
  
   ( Ê  Ê  )         
    +
¾

     Ê  !    !      Ê    ¾   
  
   ( Æ  Æ  )      ¾   
!  
 !      Æ    ¾  

Exercise 6.7 (page 161)


 ½   
  


! 
      

  


   
 

    

  


 
   


 
  !   
   
 
  


  

   


    

  

  

   

   
 
  !  

   
 
   
 )


   


    

   

   

 

,     
! 
      

  

     
 

    

  


 
   
  
   
!
Additional Exercises 433

Exercise 6.8 (page 163)

      

        

           

          

Exercise 6.9 (page 164)


 Æ  Æ

   
   
   

Exercise 6.10 (page 165)


    
 
   
            
 
         Æ 
          

         
       

Exercise 6.11 (page 165)


!   
     " 
#     $      
% #  & '(    ½   )     )   *   
        )  +   ½   )      ,  
Æ
  ½  ) id 
!  
     -(  % #  &    ½   )  
 )  +    ½   )    
 ,     ½ ) id  Æ
Exercise 6.12 (page 166)
 Æ  Æ    )   Æ    )    
)  Æ     )  Æ   Æ   

Exercise 6.14 (page 170)

½

      ,
   )
    
434 Temporal Properties

Exercise 6.15 (page 170)


   Æ  ½  
  
      
Exercise 6.16 (page 172)
           !" #
      
$
     

     

 % &   '       


          

 '
   
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> $ 

Exercise 7.5 (page 184)


* ! ! %"! :;!  "   >     !  *  +!
3 * - ! %0  "  ! : ;    "   *!  4?
)!             >  > 
* 4 

   ! $! ! $! ! 3-$! ! %"$!
436 Temporal Properties

   


 
 


 
 
   
       

       



    

        !

  



         " #!



  $ 
    
   
 


 
 
 

     



      

        !


  

Exercise 7.6 (page 185)




 $  %&'  (

 %&'  (



( 
    
Additional Exercises 437


  
    
       

     
 
   
      


  
   
  
     
    
    

    

   


        
 
  

  

  

Exercise 7.7 (page 187)


 ½ ¾ ¿ 
! ¿  ¾  ½

" ¿  ½  ¾

Exercise 7.8 (page 188)



 ½

 
Exercise 7.9 (page 189)
      Æ       
   #

$
   
  %  &
        
          

 '

 #   
 


   
 

 %    #
     
 ' 
 #   
 


    
 
%    #
 %    
438 Temporal Properties

¯   
Æ 
 

 
 
  
      
         
! 
     
" #
   

      

 



   
" #   

       ! 
 


 

   
Exercise 7.10 (page 190)
"
 

       "  $%
Exercise 7.11 (page 191)
"    
  &'  
(  !) 
   
 
  
    
    #      
   #  
     #
"    

  &'  
    

  *
+    
     



   
      
"     
&'   

  &'  

      
 
*
+   
  
*
+ 
Exercise 7.12 (page 191)
"    
 
 ,  '    
  
-"       "- . 
 
 ,  ' 
  
  
-(!  (!-  - (!
"     
 
 ,  '    

  -(!       (!-  

   
 *
+   
        
 
*
+ 
   
Exercise 7.13 (page 192)
"    
  
 ,  '    
  

/0-  -(!       /0(!


"     

    
 
*
+ 
  
      
 
*
+      
    #
      
 
*
+   
    
Additional Exercises 439

Exercise 7.14 (page 192)


 
 

¯
     
      


   


  
¯
   
 
    


  


     

   

¯ 
  

    

    


  
  

  

¯
     
      


   
  
¯  

 
    
    
         

¯
 
      
    

       
Exercise 7.18 (page 194)
      
     
   




  
     
 
   
 

 
      

 

!  
     
 
   
 

 
      

 

Exercise 7.19 (page 194)
½  

 
         
 " 
            "      
  
 "         
 
   "  
      
  "         
 "  
      
¾ 
 

 
   
 
    
   
   #    $ 
 %   "  
&    
 %  
 '   "   ' 

    $ 
 '  
 " 
       
Exercise 7.21 (page 195)
 (
  
    
   

)   )    
     
    
  
 )  
440 Temporal Properties

Exercise 7.23 (page 196)


  
   

   
   
    

    
        
  
   

       
    

    
         

Exercise 7.24 (page 196)


   
   
   
   
   
 

   !  ! "  #  $  $ % !& 
'  ' !'  #  # !  !"  &  &
(  ( !(      $  $ 
"  " !  '  '  &  & 
%  %  !  !  !!  !! 
!$  !$  !#  !#  !%  !% 

Chapter 8

Exercise 8.1 (page 203)


"   : )  * (   *    !*    +    !* !   +
   !* $   + 
  
    !* "   

"'   : ,
 "'  (*   
  *     
 
 
"'    -  !* 
   -   
 
  $'   +
   -  

    
 
     
 

 !'   +      
 
    
 
  '   +
     
 
    
 
  ('   +   
  
 
    
 
  ('   +      


    
 
  '   +       
 
    
 . -  /*    
 
  

    
 
0 
  *  
      (  ! $ "      
  
 !   
 
+ 
 
   
 
  
     
  *  -     +

   
 

"'* "'   
Additional Exercises 441

Exercise 8.2 (page 204)


     
 smallest      
    
 


     
       
   
   

          


   


Exercise 8.3 (page 204)


 
 
        
  

  

  

   

  
     


Exercise 8.4 (page 205)


!   
          

    

 
  
        

 
         
  
    
    

   
   
    

Exercise 8.5 (page 207)


     !   
       


  

           
   " # $ % & ' ( 

            


      

Exercise 8.6 (page 208)



    )*+ ,    -      

 . true  false   ½




 
 

   
           
/  ½ 


 
    0    ! 
       


!    0  ½ 




      0    !  !  

Exercise 8.7 (page 212)



              
   )*+ , 1

 
442 Temporal Properties

   
½ ¾

  
      
        
               
  
              
   
            

 
              
    
Exercise 8.8 (page 213)
  ! "# # $!" # #
   

   ! ""  # #!% # %
 

   ! " &  # %!' # (


 

   ! " %  # ( ! ) # #'
 

   ! " *  # #' ! #$ # "*


 

   ! " '  # "* ! #" # &'


 

+     


           

Exercise 8.9 (page 213)


,     
#!#!#!#!#!# %( " %*
 # " & % * ' "$
-                   .
   ! ## $!# #
   !" # # ! #" &" # *
   ! &# & ! # ## # )&&
" & ' 

 ! %# ## # "*
  ' ! % #" " $)& 

   ! *# "* ! # #&/ " ")&


#" * '$ 

   ! '# #&/ ! # %( " %*


'$ ' "$
Exercise 8.10 (page 214)
0           
     
  
 1  
 1          #     #      
   "      2   #  0      &
 
      "           %   
  &  
Additional Exercises 443

¯   
   
   
    ½   ½
      
      
 
 
 
   ½       
  
 

   
   ¾

Exercise 8.11 (page 215)


   
  
        

Exercise 8.12 (page 215)


 ! "  

  #     


$
  %

 !&  '"  &  ! '"


 &  !'"
 &'  ! "

 &'

 ( 

Exercise 8.13 (page 215)



! "   ¾
 #   ¾   #   ¾ 

Exercise 8.14 (page 216)


 true   false 

  
½     
  
½     
 
      
                         
 

   
     


Exercise 8.15 (page 216)


) *        
 $
      

     
      
    +  

  ,  
         -    

     
 
444 Temporal Properties

¯       

¯       

¯       





¯         

¯       

¯       

¯       





¯        

¯       

Exercise 8.16 (page 218)


 


             

Exercise 8.17 (page 220)


          

   !"   !"   ! !"   #!" 
!" 

  !"      !!  !  !" !  ! 


$! 

%  !" !  ! !" !" ! 

&  !"      ! !"  " !" ! 

'! !" ! (   !  &


) (!   !  * + !" ( ,( % (


Chapter 9
Exercise 9.1 (page 226)
! (  !"! !" (   (  !   ! 
+  !  !! ! ( !"! %    !  !
- !  + ( !(!  (! !"!  ½   !
 !  !+   !"  !"   + + %+ &  .
Additional Exercises 445


               
    
           
   
                
    ½   

       



 ¿  ¾    

!      
  " #    
    

 $     %       
    

                 &  
 
     
   '           
 
  
      
      
'   
          ( )    
$              
 *  
        ( )( )( )        
          
   
   '  
        
  ( )  ( )( )( )
   
+    
  ,  , 
Exercise 9.2 (page 228)
# 
     
 
 +   +  -
      .        + .   
  .   


       . /         .
 

/  .  .



. 
 
/ 
 
. 
 
/ 

/ . 



Exercise 9.3 (page 228)


0 1      ,     

  

  


   
 /       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: #
 
  

Base Case: $   


!!!
    "   !!  !   
Induction Step: $       
  
    "     

  

 
  
   
   
"       
 
      
         

        
            
    "        

  
         
 
 
  
    

   


  
Exercise 9.5 (page 232)

    ! ¼  ½     ·½       ¾  

Proof: #
 
  

Base Case:       !    

¼        ½  
448 Temporal Properties

Induction Step:   


    
    
¼  ½   ·½  
   
   
        
¼ ½  ·½  ·¾  
              

      
    
    
¼ ½ ¾   ·½
  ·½    ·½   
     

 ¾ ½    
¾ ·½  
 ¾ ·¾    ·¾   
Exercise 9.6 (page 232)
   
   
·½
    ¾  ¿       
    

Proof:  
  
Base Case:          
½
    ¾  ¿   ¼     
Induction Step:   
    
    
·½
    ¾  ¿       
   
   
        
·¾
    ¾  ¿    ·½    
              

      
    
    
  
        !    
"
      
 
   ·½   ·½

   
   
Additional Exercises 449

½   ·½ ·½  ·½ ·¾ ·¾
  

  

 
 

Exercise 9.7 (page 233)


    

    
  
  

   
    ¾    


Proof:     

Base Case:    


    ¾    


Induction Step:    


  

!    


    ¾    

     
 


  ¾     

"  
  !

     
  

!    
      "
   

       # ¾        ¾    



  

      !
  

$ %   !    &



        '

 " #       
  

  

 &  
       &¾ &  & 


Exercise 9.8 (page 234)



( # (
   ¾ #    (    
      # (
Proof:     

Base Case:   

( 
!    (  (  (¾ 

Induction Step:    


  

!  #  

     ¾

 # ! 


!    


          

     ¾ 

" 
  !
  # 
 !  #    ! 

        !

       
450 Temporal Properties

          

  ¾           

 ¾  
Exercise 9.9 (page 235)

 

 
 
  
 

Proof:  
          


 
     

 
 
  
     

        
          
              

 

 
  
 ! "           
  
 

Exercise 9.10 (page 236)


#
     

  



Proof: $      %&    


 
  "  
 

Base Case   '



  (  ( 
Induction Step:   '



 
 ½
  


 




      

     

 

   
  
   





Exercise 9.11 (page 236)
Fact: ¾
¼ 
¾
½ 
¾
¾   
¾
  ·½ 
   (

Proof:     

Base Case   ('


¾
¼ 
¾
½ 
¾
¾   ¼
¾
 ¼
¾
 (¾  (   ¼ ½
Additional Exercises 451

Induction Step  


¾ ¾ ¾ ¾ ¾
¼  ½  ¾      ·½ 
¾
  ·½  ·½     
   

 ·½   ·½   ·½ ·¾ 


Exercise 9.12 (page 238)
Fact: 
 
  ¾  ¾         
      ·½      

Proof:     

Base Case         ¼  ½       

 ¾
    ¾
  ¾
     ¼  

Induction Step     !"         #  


$
%   %

¾    ¾  

  Æ            # #  


& 
          ·½    ·½  ·¾    
  ¾      ¾  ¾  '  ¾    ¾  ¾
 ¾    ¾
  ¾    ¾    
Exercise 9.13 (page 238)
Fact:    "  #     

 ¾    ¾  

   !   ·½   !   


Proof:              %
   
 !        
(        #     ¾  % 
    !       %      ½  ¾ 
   !     
     ¾    ¾  %  
           #    


¾    ¾  ¾           ¾
 ¾    ¾   ¾  '  ¾
  ¾    ¾  
  %      ·½   ! % !   " 
452 Temporal Properties

Ü 
  ½

    ·½  ·¾ 
  
·½  ·¾


Exercise 9.14 (page 239)


Fact: ¾·½  ·¾
    
Proof:    
Base Case  
 ½¾ ¼ ¾ ¾  
¼
Induction Step   

¾·½  ·¾ ·½    ½
 ·½  
   

·½   ·½  ½  ·½ ¾

¾  ½ ·½


 ½        


 
Exercise 9.15 (page 239)
             
           !
 !  
      

Exercise 9.17 (page 243)


    "    #    ¼ ¼¼

!          


¼ ¼¼
Additional Exercises 453

   

   

    

  

 

    

Exercise 9.20 (page 246)


Fact:   ½ ¾     ½     ¾  
     ½  ¾ 

Proof:   

     
 ½ 
Base Case ½   


   ¾     ¾         ¾ 


Induction Step ½    


    ¾ 

     ¾  
   

     ¾ 
         ¾    
     

          ¾  

Chapter 10
Exercise 10.1 (page 257)
    
 
     

  

  ! " # $ % & ' (

    !  ! 

       


 
  )   
 * 
   
   +           

)        


       

   

 ,  )   *  
  
    
 

*  "   
 -   )    
  " 
 
   
  
  
 .   -        
 


           " 
     


 
  -    "

, 
         " 
     
 !

 )     
     
 

  *  

  -  "  

454 Temporal Properties

  
   
        
      
   
   
  
          
   
 
!              

          
  

 
"     #$        

    


  
          "
            

Exercise 10.2 (page 258)


  
    
       % 
      
        &
%   
        
   


   
        
       
              '  
               
  '          
  
         
      
    '           
     
'        
( )

  

         

 '   

   '    




   !        
           '        

          
  

 
    

Exercise 10.3 (page 258)


*            ' +
¯ , -   
        ( - 

. -   
    (     ( - 
¯ / -   
          
&
+   (     , -       . - 
¯ " -   
        / - 

0 -   
    (     / - 
Additional Exercises 455

¯   
 
   

   




                
¯    


 
  
     !


   


 
  
    
¯ "   
 
   

   




       #         
¯ $   


 
  
    " 


¯    
 
   

   




               $ %

&     '!    


  

 
   


 ' 
    %


 ¼ ¼


   ¼


 ¼


 ¼

 


&    
     
 
 

 

   
        

 '



  
  
  
 
  
      %
&   

 
  !  Æ 
  

¯     '


   
%%! '     
       
   !
    !
  
   
¯     '
   
    
 
¼

 !     
 '   !   
 
 
¯
       (  
'    
   (       !    
 
  
     
456 Temporal Properties

¯     
          
   
¼ ¼

     
       
 
  
¼

              



  
 !

Exercise 10.4 (page 259)


"    #
¯ $                  

     !
¯ %                
  $!
¯ &            
   !
¯ '         
      
   ( 
%    !
¯ )              

!
¯ (                
  $!
¯               

!
¯                
  '!
¯                
  '!

Exercise 10.5 (page 262)


"       
 
         
     
    *     
     
 
     ! + ,           
   
   
    - 
       
   
        
.   *   
 !
/                   
            .       
       !
/          
0       
     !

Exercise 10.6 (page 262)


"         
         
  
    
  -       
      
      !
Additional Exercises 457

    
      
 

    
     
   
 

  


  
 
        
  




  
 
   
          
   
    
 
        

             
 
  

  
     



Exercise 10.7 (page 264)


  ½ ¾ !  ! ½ ¾
     "#   $ 
 ½
 "#   
  
 

     
 
   
    %     "!#  
&      


Lemma 1.   ! ""## '"#



 
   
 "#       
   
(  

      may       

     not

   
   "#   ( 
            $ 
    
 
      "#  
    

 
 
 
 ' " #    
"#  ""##
Lemma 2.  !    "#  "#  '

 
   
  
 "#       

    (  

      must  
    
    is

  (  
   
  
 "#       
 
 
 
"#      
 
 
     
  
 


  )!*         


 +
  ½
    
 "½ #      
 

 

  
    
   ¾      
,
)    
 
 "¾ #  
 





   
  $
  ,
'     
   
     ¿       
 


    
  
 "¿#  $  
    

     

 
  
 
       


Proof of Lemma 1. ,     


½ ¾      
 
    
  
458 Temporal Properties

  

       
    
           ½    

          
     

    ¾      ¾        

 ½ ¾   ½¾
  ½   ½ ·½

  ½   ½

  ½
    

Proof of Lemma 2. 


            

 
       
   ½   ¾        

  ½   ¾      

! 
     ½   ½        

 
     ½  
 
½  ½  ¾      

"     ½  


½¾  
¾



  ½    ¾  ¿       

 ½  ¾        ¾  ¿       

  
½
¾    
¾¿           

 
      
    ½ 
#  
 ½    ½   ¾       

  ½   ¾         ½   ¾          

  $
  %    
½   
½     $ 
$ $  % $ &    
 
   
 ½   ½   ·½  



     ½   ·½   ½       
  
Additional Exercises 459

Exercise 10.12 (page 270)


   
     
        
  

 
             
 
      
 
   
      
         
 
    
 


 
      
   



  
     

   
 
 
           
 
   
 
   
   

    
    

  
          
 
   

  

 
      
  


 

  
     

   
 
             
 
   

           

    
  

Chapter 11
Exercise 11.3 (page 286)



     
  

 

  

  
  
    
 


 

  
  
 ! " 


  

 
 

   
   
     

 
 
  
  
    
  
    
  
  " #  
  
  
$  "%
#  
  
  
$  " #
& 
 




  
 
$    '%      

  #   $
      
 
  

     
                
  
  
 
 (
   '%   
   




          )%     


     
   *     

  
   

 
 # " "  " "%$
    
  
*      
   

 

 

  
 
  #    " % $ 
      

 
      
 

        +
         
 
    

  
     


  

  

 ',      
*  '-. 
   
 

 
   

 #     

 
 
  
      
   
$   
460 Temporal Properties


   


  



   


  




 
 


  
 




  
   




  
  
 
 

 


 


 

 


 




 


 
 
         

        !  " ! !  
   "#            
  $"   % &!  '( %
&   '(  %   '(  % 
  '(   % &!      ' )
          !#  "!  
!  "
                    
 #   !       &        ! 
Additional Exercises 461

   
            
  
     


Exercise 11.4 (page 287)


       
          

     ! "  !  #$  
       "%

  #%
 &
    $          ! ! 
            ' !
   (       
      )

 $& 

"    *!

 $& 

 #    *!

 $& 
 
!    !

 $& 
 
 !   !

 $& 


  (! + #   # +   !  #

 $& 


  " +   (! + "   "  !

,  
  $      
-%  )

! !  " ! 


  . #  
 
. !  ! .



 " . 

 ' #  
 
' !

Exercise 11.5 (page 287)


            
 %  

%
  )

) #   $  '    


) .  %  .  %$   
 %    /

) .  %  .  %$   
 %     

0$      /        


   )

) 1     
) 1   &    
) 1   
 %    

0  
#         /     
   
1  
   2  1  
        /  
  
  
462 Temporal Properties

  
   

  
 

   
 
       

   



    
   
  

        


   

    
   

   
   
    
 
   
      
  

 
 

   
       

   

!       

   "  "  
   

    
  
 
         
 

   
 # $#% "   

    

  &  


   



    
 



'   
      (  ) 


    * "

         
          
  
 
       
      

"     

   
 
         +   
   


  + (   )   

Exercise 11.6 (page 288)


, #  
      
   
    


      
  
  
-
  
. /01 . 2/ . ,/

. ,20
. 34
.1
  
. 2/ . ,/ .4

. ,20
. 34
.1

5        



 
Additional Exercises 463

   
 
  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 #


Exercise 11.7 (page 289)




 



  




 



   






Exercise 11.8 (page 290)




Cl Cl¼

 
 $
  
 Cl   Cl¼ %
  
 tick%   

  
 Cl 
tick
Cl   Cl
tick
Cl¼ 
Exercise 11.9 (page 291)
&         $     
464 Temporal Properties

¾        
     
       



  

        

    


   
 
½        


¾         


¾         


¿         




!   
    


 


"  
½      

 


"  
¾       

 


"  
¿       

 


"  


! 


"    
  

 


"   

 


"   




"   "

 


"  "
 
 


"  "
 
#!  

 

      

$

 



  

  
       


   
    
 %



"          
  "
& 
&



  
  "

$

 
 



  &&
 

'

 
  

 

  
 
   (  ( 
         

  ( 
   



!      


 


"    
 %


" 
 
 
&
'

     


  
 
"

$

 
 


 
&
'

 &&
 


  &


'

  

 
 
&
"

 


"        

 

  
 

   

     

Additional Exercises 465

       
  

¼

      

¾ ¼

          



        

¼

       
       

       
      

¿ 

       

  


  
  
         
    
   
             


                    




                    





      
    
               


          




          




         




         




         




        




               


          
          
         
         
466 Temporal Properties

  

  

   

  

Exercise 11.10 (page 291)


 
          

 
 








    


  
    
     
        
            
      
              

                      
     
    
        
        
  
!
 
   " !
   


        #$ %         &  
 '        (   

   
 ' )         '    )   *   
   (       

      
   
      
      &   
 (          !  
  
  
  
  
   
+  
 &  #$ %    
 

                    
    (             '  
   
(   
       
  
               
  
!         
   
  ( 

 
 ,    -.         
       /        0(   
-.       
             
 
    ( 
     
      1

  ( #                 
 2              ( 
   

Additional Exercises 467

   

     
       

   
 


Exercise 11.11 (page 296)


   
 
!

  


  

   




"     
 


 #   


   

  #    




$  %   #  



  
 &
 ' 
  

  (

 
  

  


Exercise 11.12 (page 297)



Cl % tick Cl # tick Cl 

Exercise 11.13 (page 298)


)

  #  #     % *




     % )*
 %   #  
      +  ,*
   #   #      +

+ -  
    .  )

Exercise 11.14 (page 300)


-    
  
     (



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.Î

Exercise 11.15 (page 301)


      10p 
         
    10p 
        
    tea 
Additional Exercises 469


 

0  

  
 
  

 
      

Exercise 11.16 (page 301)


        

                  
        !!     !    
   !!   !     
"                
 !!  !               
       !!    

Exercise 11.17 (page 302)


 # $  %! 
reflexive: &!!
  ! 
 '
symmetric:    '      '   
  
  ! 
(#  
       !       ) '
!  
  ! 

transitive:    '  '
     '

       ! 
(#
  !  * ' +
  ! 
* '
+

Exercise 11.18 (page 303)


 !      ' ¼ !   $      '  ½
  ! %       ' ½
470 Temporal Properties

   
  
    ½         
   ¾             ¾
   
  
    ¾         
   ¿             ¿



 
    
   
 
 
    

     

    ¼

Chapter 12
Exercise 12.2 (page 312)
Fact: 
           !   


  "
     
 !   


   

Proof: # 



         
 !      


   

  ¼    
 $
   
      
       
 
¼ ¼

     !   


       
 !  



    %!!  
     
  !!  &
¯  
 
         
  
¼ ¼ ¼

         


 !   


   
¼

        '

¼ ¼

¯  
 
          
   
¼ ¼ ¼

         


 !   


   
¼

        ¼ ¼

(   !!  
        !      

     ·½   )            )
¼ ¼

  
 !  
!
 
      
 !


    


   
     
  (    

 


      
 !  
     ·½   

    
 !     


   
 
   ·½     

      !!       ( 
  
¯    
     
      
 ! 
¼ ¼


  


   
        '   

¼ ¼

   
 !    !       !  



   
           
   
  
¼ ¼

   

     



       
¼

 ·½   ' 
Additional Exercises 471

¯ ¼
   

   
   
¼

  
     

 
      

 
¼ ¼


 
 
  
   


  
  

   

 
      ¼ ¼
       

¼


 
  
      

 
 

½   

Exercise 12.3 (page 313)


 ¾      ¼    ½     
    

    
  
         


 

     
    
  
     
  

      



  
  
  


   
   

  


   

   

 ¿          !  


  
  



       
  
 
   

  


  

   "

 #   
    

  
   
 
  
  


   
   

   

 
 
 #      
   
0 $  0
  


     
  

 

0

 

 0


   
   
   



 0 0 $  0 
   

  0 0 $  0
 # 
    

   
   

  0 0 $  0


     0 $  0 0  

   
  


  0 0 $  0
     0 $  0  0 
 

      
 
 

Exercise 12.4 (page 315)


Fact: #        

            

    

Proof:  
   
#
   %&    '(!'   

 ¼ 
#
 
 
  

 ·½  ·½  ) 

 

  
    

     '(!  !'! 



 

   
     
    
 "
472 Temporal Properties

·½

 ½ ·½


  
 
¼ ¼
 ¼

   
          ¼


   ·½               ¼ ¼

¼
 !  "  #      ·½      
¼

         
¼
   # !
¼ ¼
  $ ¼ ¼ ¼

 
 
¯ $ ¼
   ¼
     ¼ ¼
 ¼


  !   
            ¼


     ·½               ¼ ¼

   !  "  #    


¼ ¼
·½      
 
¼
   ¼
   # ! ¼
  $¼ ¼ ¼

 
 
 $   ¼
 ¼
  ¼
   ¼
 ¼

  #   #    "    ·½  

Exercise 12.5 (page 315)


Fact: %     Cl Cl   Cl  ·½ Cl

Proof: &     '  # !  

Base Case: Cl¼ ¼ Cl #   


Induction Step: ("      Cl Cl     !
       Cl ·½ ·½ Cl

 '      "     #  "   !


    Cl ! Cl   ) "      
  #  Cl¼ ! Cl ! 
    # #     
 Cl


Cl   !       
Fact: %     Clock Clock    Clock  ½ Clock
Additional Exercises 473

Proof:   


      
      
   
            Clock 
Clock           Clock  Cl    
 
 

 
            
  
      
           

       Clock  Cl    
   

   Clock  Cl        Cl Cl   

 

 

   !"!     Clock Clock   


  

  #
 

          Cl   Cl


 

  ½


Exercise 12.6 (page 317)


       
   
          

       $   !%
       
   
   
     &
½ ½

'                




 

  

'                




 

   

    &


'                




 

  

    &


'                




 

   

   &
  

'                




 

   

'                




 

  

   &
  

'                




 

   

'                




 

  

Exercise 12.7 (page 317)


(      
   
         



            Æ        
        
   

  

                 



¼
  


¼

¼
474 Temporal Properties

¼
 ¼
 
       ¼

   ¼


   ¼ ¼
    
¼
  Æ
¼
 

    ¼
 
       ¼

   ¼


   ¼ ¼
 
   
¼

 
¼

 
¼
 ¼
    
¼
   Æ
¼
 

 Æ     


 

Exercise 12.8 (page 318)


    
          
  

    
      
 
   

    


     
  !     ½ 
    "
    #

reflexive:      
          


     
     


 
    

symmetric:  !     ½ 
  
  

transitive: $ 
           

        ! %      


      ! &'      
 
 
          
¼ ¼ ¼ ¼
 
 

               ¼ ¼ ¼

  ½  
  
    
    (  ')* 
½

+',    simulation relation    



   

      



#   
– 
¼
   ¼

   ¼
 
¼
 ¼


$ 

 
 '),  +', 

   


   
      

      


        


 
    
   -  



  ½
   
  
 

        
 


 '), .

        Æ     


  
  
#     
    

/0
 ')1

2      


   
       

Æ        


    
Additional Exercises 475


¼
  
         
     ¼ ¼

    
          
  
¼ ¼ ¼ ¼

               Æ 
¼ ¼ ¼ ¼

 Æ  
     

               


  

      
       
  

     
     

        0 ¾ 0  0  0 ¾ 0  0

Exercise 12.9 (page 321)


                
  !
 "#"      
          

          
 
   ! 
             
    
   

    

    
       

       $    
  ! 
    
       
      % 
                 
   

Exercise 12.10 (page 322)


&       
   "#"

' $




 

 
& %

   !       


         
 
   !           
            !       % 
     
     '       
  
        

     (
   
        % 
       

)  
 (        
476 Temporal Properties

' $

  

   

 
& %

   


              
               

         
         
    
         
  
                   
                 
           
' $

  

   

 
& %

     


           
                 
               
   
                 
   
       
    
   
  
' $

  

   

 
& %

   


      
    
        
            
        
Additional Exercises 477

Exercise 12.11 (page 326)



 Clock
¼   Clock
      


 
 
   
  
  

    ¾  
   
    

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

Exercise 13.3 (page 336)


tick ticktrue
 



         tick    
 

 
           tick    

   

Cl      Cl 
    
   
 

Exercise 13.4 (page 340)


  ! "  #  $  
% & ' (   %   $ 

Exercise 13.5 (page 341)


   true
 

   
   

%    
true
 

   
   

&  true
 

   
 )          
 
 true   true    
true
 

   
   

*   



    
$   

      


 +        true
 $   ,   -  
  

  

     . 



Exercise 13.6 (page 342)


Fact:     

Proof:  ,      ,  
  /    , 0

  /    , 0

 /     , 0

 /     ,  0

  ,  
Exercise 13.7 (page 343)
Theorem 13.6: 1  

       HML2


Additional Exercises 479

  pos  

    

  neg  

  
 
Proof:  


        
   
  pos  

    

  neg  

  
 

  
   
   

     

 
   pos 

    

   neg 

    


     


   
  true
  postrue
  true !   
postrue"

  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 ½  ¾

   neg ½    neg ¾      


 
   ½    ¾        
   ½
  ¾         
   ½ ¾      
 

 ½  ¾ 

   pos ½  ¾ 
  pos   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

Exercise 13.8 (page 343)


Fact:     
 negneg    

Proof:  
 


       



   
  true: negnegtrue  negfalse  true

  false: negnegfalse  negtrue  false

 ½ ¾ : 
 
 
   

neg neg ½  
 negneg ¾   ¾ 
½

  negneg ½ ¾   negneg ½   neg ¾   negneg ½


negneg ¾   ½ ¾

 ½ ¾ : 
 
 
   

negneg ½  
 negneg ¾   ¾ 
½

  negneg ½  ¾   negneg ½  neg ¾   negneg ½ 


negneg ¾   ½  ¾

    
 
 
   

negneg   
:
  negneg   neg neg   negneg   

   
 
 
   

negneg   
:
  negneg   negneg    negneg   


Exercise 13.9 (page 345)


  

   
        
  

 

 !"  ###$ %    "
  


   HML
 

     &' 
    

   


     &' 


   
  
 
   &'

     
 
   &' 
 (
    false   false
Additional Exercises 483

¯    


         

                 


             
     true  true
     

     



 !   
 neg     neg 
Exercise 13.11 (page 350)
" #     
 true  false   false
      

#      0


$ %  &            '


$  &          !




     


$ % &            (


 
) $      0 * 0 

 true  false   true  true   false 
            

Exercise 13.12 (page 353)


"    true   ½

 

)    true  ½ ¾
 

+   true   
    

,   true 
   

-    false 

 

.    true    

   

Chapter 14
Exercise 14.2 (page 360)
/ 
 0  Sort  
 
 0  Sort    



$  ! Sort   Sort 


0   
 0  Sort  
 0


  0
$
 
 
484 Temporal Properties

Exercise 14.3 (page 362)


 
   
 
¾   ¾ ¼
  ¾ 
¼
  ¾¼¼
    

Exercise 14.4 (page 365)


             
    
               

            
  

             
 
  
                
           
       
 
               
                
           
      
    !           
                  
      
 "  
¯         
    
¯              
  "         
   
               #
                     
    
          
      $   
        #
 
               
             

Exercise 14.5 (page 368)


        "       
  "   "     
 %     

          "    
 % 
   
     "     "     

     "  
        & 
    
  
    ' "  "

                

        (  "    $ " )   
    *  + 
    " +   

Additional Exercises 485

Exercise 14.6 (page 371)


  
          
                 
                 
              
        
     
¯                 
     b1          
   b2     
  k    
½ ½

  
¾

¯ 
              

                 
      b2          

  k        !     
 

             




Exercise 14.7 (page 373)


!   "    #      
      
  ! $  
      
 
    

      %   
    
 

  !        &
Sender ' insndS S ' ackSender ( errsndS
 

SortSender ' snd ack err

           &


in
Sender 
snd S
err

ack snd
S

!      


      
 $"
     
          )rcv*   

       )out*           $"
  
    )rack*           
                  "
  
 
    )rerr*     
486 Temporal Properties

  
   
      

   

          

 


Receiver  rcv out rack Receiver  rerr rack Receiver
SortReceiver  rcv rack rerr

         

rcv

Receiver rerr outrackReceiver

rack rackReceiver out

              

 
   
      
   

   
     
   !     
   
   "rcv#    $      %


      
  

   "rack#   
     
   
    
   "ack#
 &   
  
     

   "rerr#  
     
      
    
  

 


Medium  snd rcv rack M  err Medium

M  ack Medium  rerr rack M

SortMedium  snd rcv err

         

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

rack rerr rcv

S S
rack M rack M
rack Receiver out rack Receiver

out


        

                


           
  
             !  
  

System " Sender Medium Receiver

 #  !# 

snd rcv
in  ack
err
 rack
rerr

   out

 $ !               


       
   #   
 
              
488 Temporal Properties

Exercise 14.8 (page 377)


¯     Ë Å Ê
      ˼ Šʼ  
   in             
  Ë Å Ê 
¼

            in    


 Sender       ˽ 
         Sender        
Medium  ack        Sender    ˽  
Medium    Å 

    ack        Sender     


       ×  Ø        
 Medium       ack          
Receiver  rack   

 Receiver        rack      out


        Receiver    ʽ 
        ˽  Š ʽ     
    

Chapter 15

Exercise 15.2 (page 384)


   true
 !   
true
  È È 
"#false
  È "#È 
    
 !   

Exercise 15.3 (page 385)


$ È    È      
        É  È       È   
   %     &     '      
È   É   
(    '            É
  true    true      
(  $ È true  È 
Additional Exercises 489

Exercise 15.4 (page 386)


Fact: V    
    V 

Proof:
            
    
   
 true: V true   States    trueV  

 false: V false       falseV  

 : 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  


Exercise 15.5 (page 388)


  
V  
  States         
490 Temporal Properties

Exercise 15.6 (page 389)


  
        V    

                V  

      States                 


      
!    " 
   #    
!      $ 
           %   
&         
      V  

    States           

       '       


(           
(             
(             
)%          
#             V    


    %             
 
           &         
     

Exercise 15.7 (page 392)


' "    *  %%    *    
+ "          ,    
  %    HML &
- . % -!-
 :

V neg  
V    V   
V   

V 

  :

V neg   
V  neg 
 States        
V  neg  

 States   

  
 
V  neg  

 States   

  
  

V  


V 

  :
Additional Exercises 491

V neg  V neg 

    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    
    

F. Moller, G. Struth, Modelling Computing Systems,


Undergraduate Topics in Computer Science,
DOI 10.1007/978-1-84800-322-4, © Springer-Verlag London 2013
494 INDEX

       

     # #(  

   # (   


  #     

  
    
2 4# 
   
 &   
       (( 
    2."  
 2 (
 ! "#  &  
 $%  &  
  10# 2 ( 
 &    2 ( 
# & '  # 0 
(   # 6#$ 
)*+)   %  
  , 
  7
   
 
-   2 

(    2 8-  

./ ( 

    8 / 

   8 5 " 

    
 

(#  &  &#      

   8 )   

 &  &#  8 # 

0      80 # 

  & #  8! 9 

    ( 

1& (   - & # 

- &# 

     

2# 3-   - 

2#1.# "    7


   8 # 

2 4     

      

5    &  &# 

 (   
 

 

 &#  8: 5#  

 #  8:! 5# 

    #  


INDEX 495






2    

 #  


 !$(
-# +,
 

 


# ""

   
 $ 


$ 

   
 $ 

   
 %





  
 !#
" .#

 
     

  
     
 
  ! "
  

    #
 %  


     
 % # 


   
 !
3"

  
 # #

$ 
   

$ 

 
 -* 4

  

 -
%


 

 

% 
   #

% & 
   


   


   
  

- " 

!
!
   



 
   





    

! '# 
   


! '#
#

   

 (


  -5

6

 ( 
 - 


 
 -
."

! )
 

&# 
     
 
&
 7   


!((* #"
 7  



!#
+, -
  7  84 #

! '#* .


 7 & 



 7  
 
! (
"
 
 
    

! /0 +"  1# 
 

496 INDEX

  
   6&
 07 8 '

    + +* 

    6  92 ,

    6 /9  & ,

    &    

   


      62 : ',

     HML ,

     6 .  3 2 # &  &

!"# $ 

%  & ' &    

%   $


+  2  ,$  $-
 ( )   
    '
%* +  , 
  2 ,
 
&     ',

 -
&/%  ,
  -
!9"  -
  ''
+  *

     )
+  '
'
+  2  

&  
      /*  + + , '

&  '    

& '      

./ /   '  &    

./ / /   '      '

. 0      


 %  -

.0"  ,   -


 '    + -

.   1  '     

.2 3 $    

&&     -

.2    & '

.2    '    

&+ '$  %    -

. 4 52   %*  ',

&  
  ,  %*  -

& %* +  ,  %*   

 1 
   -

  -    

    $' ! & '$

6   , !    

    !   9


 "  -

6 3       2  


INDEX 497

  
  30
,'< (  

     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

   

 
 

   0  

     + 

     





  
( 

  

$+ 5  

     $+  

&  
      
nil  
  !" #  
&   
  #  
$ *
  
# 

$$   

# '   $  



$  


# '     



$  %&' 
#     

%   
  *

 


  
    &

   


 

    



$   

  (  #) *


5&  
    $ 

  
    
  
    + 
   # 
    +   (

       
,   ,(' 
# 
# #    
' 
,-$ 
'   
, . /  (
*
   &   
,  0 ' 12
*
 



 

  
6' '   (' *

,' (   

,3
' 0  

,3
' . 4   
5 $  # 
*
- 
5  +  

$ #  & * 


5  + 
$ $ 


$    $ ( '  ( 

$      - ' & 




+       # #   

  # #       #   *

 #         

 #        

  * $  

INDEX 499

 
+  
   
  
   
    


     
  .



        .



      . 

     ' . 3  
       

  
   
    

     


 
!"   '  
 #    
    4   

 

$ %  &     
 "      5  
   
'( ) * 
   
     
(   .  
    
(    
+    

+   
 HML 
+ 
    6

'( ,
 -"  #(  
   . 

'( ,
. $  
   

( 
 HML 

   .  
   

   

   .    

  # . 78


  
 (  # . *  .  
-     
' /
 . 
 

 . *  

     . 


  


 

      
'* $ 0(  0    . 
   

#( "9 
Sort1 2  (  
     
#( 
 
500 INDEX

 
    # '   
      # # 
      
    
        536 # 
 
  7& 8    "
   9 !$
      7 & ,   $
  
     !
      !
 
  !
 
   
 
 " 
 #    $
   $
  
 %& 
  '   "
  $
     "
  !$

    

  ! !

   "
()) )' 

 '' $

 ''   

    !

     $

  
* # "

   +
 
, )   
, - 
 .# !$
/  $
0 $
,   1 2 
,   3 
,  1  
,   4 !$

You might also like