Modelling Computing Systems: Mathematics for Computer Science 9781848003224, 1848003226

This engaging text presents the fundamental mathematics and modelling techniques for computing systems in a novel and li

863 88 13MB

English Pages 500 [507] Year 2013

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Modelling Computing Systems: Mathematics for Computer Science
 9781848003224, 1848003226

  • Commentary
  • Springer
Citation preview

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 undergraduates 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 modern 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 numerous 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 Department of Computer Science Swansea University Swansea, UK

Georg Struth Dept. Computer Science University of Sheffield 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-322-4 (eBook) ISBN 978-1-84800-321-7 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 publication 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. Permissions 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 publication, 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                  xiii

Preface 0 Introduction                                                         !   "      #   $   %         & '                 (                    ) *

+   '            , "  , $    *        . , &     / . 

         

         

         

         

         

         

         

         

Part I: Mathematics for Computer Science                 

                

                

                

                

                

                

                

                

                

                

2 Sets    *           " $  , 4       '        ! 6 '  

   

   

   

   

   

   

   

   

   

   

   

   

   

   

( ) ) 

15

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

             "  2 5 '    # 2      $2 * #22       $                 ( 4%   /  2      )  2 $ #5  # 2 4%   1                

      &               

1    

17 1       ) ) 1      )

57 ) ( (

vi

CONTENTS



    

                                                                                                        

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

            

           

           

           

           

           

           

           

           

           

           

           

           

3 Boolean Algebras and Circuits  .  &$'                , $ !  .  &$'  0% " 1               ( $     !  $   "      #2 $  "  &!!           . 1 3"'           &!! $ . 1 3"'       ." ! $ 4) &!!         ." ! $ 5" &!!         " $  & 0 $ %       &!!  *-

           

          

          

          

          

          

          

          

          

          

          

          

          

87  /   // // / / / / /

4 Predicate Logic  !    ! 5 6 '    7" 8  ! . " ! 6 '    ,  7" 8    *-

  7" 8   . " !! 7" 8   9" )  7" 8       # ! $ !   ( $     &!!  *-

       

       

       

       

       

       

       

       

       

       

       

       

       

109 /      /    

                     *+" ,                      

      

      

      

      

      

      

      

131       

       

       

5 Proof Strategies  & 5  *-              )   $  )         )   $  )  3$       )   $  )   :"   !   )   $  )  

:"       )   $  )  7" 8      ,  7" 8   

       

       

CONTENTS vii



                                                                                  

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

     

     

     

     

     

     

     

     

155  #    

7 Relations                             . /

                     "      . /

          &      . /

              &                 1 2   ' /

                $%& ' /

               !( %   / ' + /

    3&    +  . /

             / 4 2  1 4 2 /

       ).%%    .%%  /

   !  2 /

                 ' /

               2  /

              2  $    3                              

               

               

               

               

               

               

               

179  0 0 0 0 0 00 0 # #      

8 Inductive and Recursive Definitions 0 1  2

.    )        0 1  2

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

.     !.&    0 1  2

.    "       0 / 2 "            0 / 2 3           00             

       

       

       

       

       

       

       

201 # # # #   0 #

     

     

       

     

       

     

       

     

       

     

       

     

       

     

       

       

9 Proofs by Induction 223  $ 2  ' 6 1   2 2                  3% . )( 1   '%                !( 1   '%                     0

viii CONTENTS

  

! , 

                 

          

          " # 

  $        # %&&  '          

  (       *   + *          -'(&     %(     # & -'              

10 Games and Strategies ")"    +.. ")             ") 

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

.%                                     

      

      

      

      

      

        

      

        

      

        

      

        

      

        

      

        

      

        

      

        

      

        

      

        

  ! !  ) "  

      

251  )     !"

Part II: Modelling Computing Systems 11 Modelling Processes """ 1&& $ 2      "" %(         "" # 1        """ $ &   0       "" #  '          ""          "" %               ""   0 0   "" -3 &2 0        "" # & -'          

         

         

         

         

277          

         

         

         

         

         

         

         

         

12 Distinguishing Between Processes "" $ 0 & +                     " (  + -3 &                  " 0 & 4&                      " 0 & %&                       " $ 0 & + 4 5 $ 2  02 6 "" 7 &                      " 7 & 0 & +              " # & -'                       

         

279 ," ,!            ) )

       

309 ) " " "    ,

CONTENTS

ix

13 Logical Properties of Processes        

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

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

333      %+ % %

14 Concurrent Processes  .          (               #2 $ (

          01                   3 '  %  

 $ . '      &     ,    01      

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

357 %, +  % % / , , ,,

15 Temporal Properties %  .  ' 4    %  2 5              %  

! 5              %  6 5  6             % #  $              % .$  #  $ 07     % )1   .         %     8(            %   $

-  )1       % 1'  )1      %% 01

  .  ' 4

%% 2 5              %% 

! 5              %% 6 5  6             % )  )1          %,    01             

               

               

               

               

               

               

               

               

               

               

               

381 / / / / /% /, // 9+ 9 9 9, 9/ 9/ 9/ 99 +

        

        

        

Solutions to Exercises

405

Index

493

List of Figures    

                                      

 

 !  " #                    

$

 %&  ' 



                  



( # ))                          

$

$ $ $ $

   *                  ,-  ¿   /   0        /          

1

2  '# 3                         

 

&  4 & 50 #                  6        ,♂- #    ,♀-          

. . .

7                         $ 8  # 0    #&                . 9#    :

               6

6 6 6 6 6+ 6$ 61



                          #              0 #   #&          #           0 #   8&     &    

      

      

      

   

      

   

      

   

      

   

   

   

   

   

   

+$ +. 1 1 

      

      

      

      

      

      

+1 $$ $1 $ $. 16 1

                          !   #              %(   ;:##    

    =78  $ # 1    +                  $ (! #          1 7                      

      

      

      

      

      

6  $  . .1 .



      

   

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 ; 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 #