Undergraduate Topics in Computer Science
Series Editor
Ian Mackie
University of Sussex, Brighton, UK
Advisory Editors
Samson Abramsky
Department of Computer Science, University of Oxford, Oxford, UK
Chris Hankin
Department of Computing, Imperial College London, London, UK
Mike Hinchey
Lero The Irish Software Research Centre, University of Limerick, Limerick, Ireland
Dexter C. Kozen
Department of Computer Science, Cornell University, Ithaca, NY, USA
Andrew Pitts
Department of Computer Science and Technology, University of Cambridge, Cambridge, UK
Hanne Riis Nielson
Department of Applied Mathematics and Computer Science, Technical University of Denmark, Kongens Lyngby, Denmark
Steven S. Skiena
Department of Computer Science, Stony Brook University, Stony Brook, NY, USA
Iain Stewart
Department of Computer Science, Durham University, Durham, UK
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 of which include fully worked solutions.
The UTiCS concept relies on high-quality, concise books in softback format, and generally a maximum of 275300 pages. For undergraduate textbooks that are likely to be longer, more expository, Springer continues to offer the highly regarded Texts in Computer Science series, to which we refer potential authors.
More information about this series at https://link.springer.com/bookseries/7592
Donald Sannella , Michael Fourman , Haoran Peng and Philip Wadler
Introduction to Computation
Haskell, Logic and Automata
Logo of the publisher
Donald Sannella
School of Informatics, University of Edinburgh, Edinburgh, UK
Michael Fourman
School of Informatics, University of Edinburgh, Edinburgh, UK
Haoran Peng
School of Informatics, University of Edinburgh, Edinburgh, UK
Philip Wadler
School of Informatics, University of Edinburgh, Edinburgh, UK
ISSN 1863-7310 e-ISSN 2197-1781
Undergraduate Topics in Computer Science
ISBN 978-3-030-76907-9 e-ISBN 978-3-030-76908-6
https://doi.org/10.1007/978-3-030-76908-6
The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2021
This work is subject to copyright. All rights are solely and exclusively licensed 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.
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.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
Preface
This is the textbook for the course Introduction to Computation, taught in the School of Informatics at the University of Edinburgh.
ECTS is the European Credit Transfer and Accumulation System, which is used in the European Union and other European countries for comparing academic credits. See https://en.wikipedia.org/wiki/European_Credit_Transfer_and_Accumulation_System .
The course carries 10 ECTS credits, representing 250300 hours of study, and is taken by all undergraduate Informatics students during their first semester. The course is also popular with non-Informatics students, including students taking degrees in non-science subjects like Psychology. It has no formal prerequisites but competence in Mathematics at a secondary school level is recommended. Around 430 students took the course in 2020/2021. It has been taught in essentially the same form, with occasional adjustments to the detailed content, since 2004/2005.
First-year Informatics students also take a 10-credit course in the second semester that covers object-oriented programming in Java, and a 10-credit Mathematics course in each semester, on linear algebra and calculus. (Plus 20 credits of other courses of their choice.) Together, these courses are designed to provide a foundation that is built upon by subsequent courses at all levels in Informatics. This includes courses in theoretical and practical topics, in software and hardware, in artificial intelligence, data science, robotics and vision, security and privacy, and many other subjects.
Topics and Approach
One aspect that is not quite standard is that our NFAs may have multiple start states; this is a useful generalisation that simplifies some aspects of the theory.
The
Introduction to Computation course, and this book, covers three topics:
Functional programming: Computing based on calculation using data structures, without states, in Haskell. This provides an introduction to programming and algorithmic thinking, and is used as a basis for introducing key concepts that will appear later in the curriculum, including: software testing; computational complexity and big-O notation; modular design, data representation, and data abstraction; proof of program properties; heuristic search; and combinatorial algorithms.
Symbolic logic: Describing and reasoning about information, where everything is either true or false. The emphasis is mainly on propositional logic and includes: modelling the world; syllogisms; sequent calculus; conjunctive and disjunctive normal forms, and ways of converting propositional formulae to CNF and DNF; the Davis-Putnam-Logemann-Loveland (DPLL) satisfiability-checking algorithm; and novel diagrammatic techniques for counting the number of satisfying valuations of a 2-CNF formula.
Finite automata: Computing based on moving between states in response to input, as a very simple and limited but still useful model of computation. The coverage of this topic is fairly standard, including: deterministic finite automata; non-deterministic finite automata with and without