You are previewing Logic in Computer Science, Second Edition.
O'Reilly logo
Logic in Computer Science, Second Edition

Book Description

Recent years have seen the development of powerful tools for verifying hardware and software systems, as companies worldwide realise the need for improved means of validating their products. There is increasing demand for training in basic methods in formal reasoning so that students can gain proficiency in logic-based verification methods. The second edition of this successful textbook addresses both those requirements, by continuing to provide a clear introduction to formal reasoning which is both relevant to the needs of modern computer science and rigorous enough for practical application. Improvements to the first edition have been made throughout, with extra and expanded sections on SAT solvers, existential/universal second-order logic, micro-models, programming by contract and total correctness. The coverage of model-checking has been substantially updated. Further exercises have been added. Internet support for the book includes worked solutions for all exercises for teachers, and model solutions to some exercises for students.

Note:The ebook version does not provide access to the companion files.

Table of Contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright
  5. Contents
  6. Foreword to the first edition
  7. Preface to the second edition
  8. Acknowledgements
  9. 1. Propositional logic
    1. 1.1 Declarative sentences
    2. 1.2 Natural deduction
      1. 1.2.1 Rules for natural deduction
      2. 1.2.2 Derived rules
      3. 1.2.3 Natural deduction in summary
      4. 1.2.4 Provable equivalence
      5. 1.2.5 An aside: proof by contradiction
    3. 1.3 Propositional logic as a formal language
    4. 1.4 Semantics of propositional logic
      1. 1.4.1 The meaning of logical connectives
      2. 1.4.2 Mathematical induction
      3. 1.4.3 Soundness of propositional logic
      4. 1.4.4 Completeness of propositional logic
    5. 1.5 Normal forms
      1. 1.5.1 Semantic equivalence, satisfiability and validity
      2. 1.5.2 Conjunctive normal forms and validity
      3. 1.5.3 Horn clauses and satisfiability
    6. 1.6 SAT solvers
      1. 1.6.1 A linear solver
      2. 1.6.2 A cubic solver
    7. 1.7 Exercises
    8. 1.8 Bibliographic notes
  10. 2. Predicate logic
    1. 2.1 The need for a richer language
    2. 2.2 Predicate logic as a formal language
      1. 2.2.1 Terms
      2. 2.2.2 Formulas
      3. 2.2.3 Free and bound variables
      4. 2.2.4 Substitution
    3. 2.3 Proof theory of predicate logic
      1. 2.3.1 Natural deduction rules
      2. 2.3.2 Quantifier equivalences
    4. 2.4 Semantics of predicate logic
      1. 2.4.1 Models
      2. 2.4.2 Semantic entailment
      3. 2.4.3 The semantics of equality
    5. 2.5 Undecidability of predicate logic
    6. 2.6 Expressiveness of predicate logic
      1. 2.6.1 Existential second-order logic
      2. 2.6.2 Universal second-order logic
    7. 2.7 Micromodels of software
      1. 2.7.1 State machines
      2. 2.7.2 Alma – re-visited
      3. 2.7.3 A software micromodel
    8. 2.8 Exercises
    9. 2.9 Bibliographic notes
  11. 3. Verification by model checking
    1. 3.1 Motivation for verification
    2. 3.2 Linear-time temporal logic
      1. 3.2.1 Syntax of LTL
      2. 3.2.2 Semantics of LTL
      3. 3.2.3 Practical patterns of specifications
      4. 3.2.4 Important equivalences between LTL formulas
      5. 3.2.5 Adequate sets of connectives for LTL
    3. 3.3 Model checking: systems, tools, properties
      1. 3.3.1 Example: mutual exclusion
      2. 3.3.2 The NuSMV model checker
      3. 3.3.3 Running NuSMV
      4. 3.3.4 Mutual exclusion revisited
      5. 3.3.5 The ferryman
      6. 3.3.6 The alternating bit protocol
    4. 3.4 Branching-time logic
      1. 3.4.1 Syntax of CTL
      2. 3.4.2 Semantics of CTL
      3. 3.4.3 Practical patterns of specifications
      4. 3.4.4 Important equivalences between CTL formulas
      5. 3.4.5 Adequate sets of CTL connectives
    5. 3.5 CTL* and the expressive powers of LTL and CTL
      1. 3.5.1 Boolean combinations of temporal formulas in CTL
      2. 3.5.2 Past operators in LTL
    6. 3.6 Model-checking algorithms
      1. 3.6.1 The CTL model-checking algorithm
      2. 3.6.2 CTL model checking with fairness
      3. 3.6.3 The LTL model-checking algorithm
    7. 3.7 The fixed-point characterisation of CTL
      1. 3.7.1 Monotone functions
      2. 3.7.2 The correctness of SATEG
      3. 3.7.3 The correctness of SATEU
    8. 3.8 Exercises
    9. 3.9 Bibliographic notes
  12. 4. Program verification
    1. 4.1 Why should we specify and verify code?
    2. 4.2 A framework for software verification
      1. 4.2.1 A core programming language
      2. 4.2.2 Hoare triples
      3. 4.2.3 Partial and total correctness
      4. 4.2.4 Program variables and logical variables
    3. 4.3 Proof calculus for partial correctness
      1. 4.3.1 Proof rules
      2. 4.3.2 Proof tableaux
      3. 4.3.3 A case study: minimal-sum section
    4. 4.4 Proof calculus for total correctness
    5. 4.5 Programming by contract
    6. 4.6 Exercises
    7. 4.7 Bibliographic notes
  13. 5. Modal logics and agents
    1. 5.1 Modes of truth
    2. 5.2 Basic modal logic
      1. 5.2.1 Syntax
      2. 5.2.2 Semantics
    3. 5.3 Logic engineering
      1. 5.3.1 The stock of valid formulas
      2. 5.3.2 Important properties of the accessibility relation
      3. 5.3.3 Correspondence theory
      4. 5.3.4 Some modal logics
    4. 5.4 Natural deduction
    5. 5.5 Reasoning about knowledge in a multi-agent system
      1. 5.5.1 Some examples
      2. 5.5.2 The modal logic KT45n
      3. 5.5.3 Natural deduction for KT45n
      4. 5.5.4 Formalising the examples
    6. 5.6 Exercises
    7. 5.7 Bibliographic notes
  14. 6. Binary decision diagrams
    1. 6.1 Representing boolean functions
      1. 6.1.1 Propositional formulas and truth tables
      2. 6.1.2 Binary decision diagrams
      3. 6.1.3 Ordered BDDs
    2. 6.2 Algorithms for reduced OBDDs
      1. 6.2.1 The algorithm reduce
      2. 6.2.2 The algorithm apply
      3. 6.2.3 The algorithm restrict
      4. 6.2.4 The algorithm exists
      5. 6.2.5 Assessment of OBDDs
    3. 6.3 Symbolic model checking
      1. 6.3.1 Representing subsets of the set of states
      2. 6.3.2 Representing the transition relation
      3. 6.3.3 Implementing the functions pre∃ and pre∀
      4. 6.3.4 Synthesising OBDDs
    4. 6.4 A relational mu-calculus
      1. 6.4.1 Syntax and semantics
      2. 6.4.2 Coding CTL models and specifications
    5. 6.5 Exercises
    6. 6.6 Bibliographic notes
  15. Bibliography
  16. Index