0% found this document useful (0 votes)
44 views

Introduction To The Theory of Computation Third International Edition Michael Sipser

Uploaded by

gilpinfaggo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Introduction To The Theory of Computation Third International Edition Michael Sipser

Uploaded by

gilpinfaggo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Get ebook downloads in full at ebookname.

com

Introduction to the Theory of Computation Third


International Edition Michael Sipser

https://ebookname.com/product/introduction-to-the-theory-of-
computation-third-international-edition-michael-sipser/

OR CLICK BUTTON

DOWNLOAD EBOOK

Explore and download more ebook at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Introduction to the Theory of Computation Third Edition


Michael Sipser

https://ebookname.com/product/introduction-to-the-theory-of-
computation-third-edition-michael-sipser/

Introduction to the Theory of Computation 2nd Edition


Michael Sipser

https://ebookname.com/product/introduction-to-the-theory-of-
computation-2nd-edition-michael-sipser/

Introduction to the Theory of Computation 3ed. Edition


Sipser M.

https://ebookname.com/product/introduction-to-the-theory-of-
computation-3ed-edition-sipser-m/

Smashing CoffeeScript 1st Edition Alex Hudson

https://ebookname.com/product/smashing-coffeescript-1st-edition-
alex-hudson/
Governing Technology for Sustainability Joseph Murphy

https://ebookname.com/product/governing-technology-for-
sustainability-joseph-murphy/

Deadly Companions How Microbes Shaped Our History 1st


Edition Dorothy H. Crawford

https://ebookname.com/product/deadly-companions-how-microbes-
shaped-our-history-1st-edition-dorothy-h-crawford/

Human Development in the Twenty First Century Visionary


Ideas from Systems Scientists 1st Edition Alan Fogel

https://ebookname.com/product/human-development-in-the-twenty-
first-century-visionary-ideas-from-systems-scientists-1st-
edition-alan-fogel/

Inside Your Calculator From Simple Programs to


Significant Insights 1st Edition Gerald R. Rising

https://ebookname.com/product/inside-your-calculator-from-simple-
programs-to-significant-insights-1st-edition-gerald-r-rising/

Energy and Sustainability III 1st Edition Y.


Villacampa.

https://ebookname.com/product/energy-and-sustainability-iii-1st-
edition-y-villacampa/
Quaternary Alloys Based on III V Semiconductors 1st
Edition Vasyl Tomashyk

https://ebookname.com/product/quaternary-alloys-based-on-iii-v-
semiconductors-1st-edition-vasyl-tomashyk/
I n tro du ct i o n to the Theory of

C omputat i o N Third Edition

michael sipser

Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
Introduction to the Theory of © 2013 Cengage Learning
Computation, Third International CENGAGE and CENGAGE LEARNING are registered trademarks of
Edition Cengage Learning, Inc., within the United States and certain other
Michael Sipser jurisdictions.
Editor-in-Chief: Marie Lee ALL RIGHTS RESERVED. No part of this work covered by the copyright
Senior Product Manager: herein may be reproduced, transmitted, stored or used in any form or
Alyssa Pratt by any means graphic, electronic, or mechanical, including but not lim-
Associate Product Manager: ited to photocopying, recording, scanning, digitizing, taping, Web distri-
Stephanie Lorenz bution, information networks, or information storage and retrieval sys-
Content Project Manager: tems, except as permitted under Section 107 or 108 of the 1976 United
Jennifer Feltri-George States Copyright Act, without the prior written permission of the
Art Director: GEX Publishing Services publisher.States Copyright Act, or applicable copyright law of another
jurisdiction, without the prior written permission of the publisher.
Associate Marketing Manager:
Shanna Shelton
Cover Designer: GEX Publishing For permission to use material from this text or product,
Services submit all requests online at cengage.com/permissions
Cover Image Credit: © SuperStock / Further permissions questions can be emailed to
SuperStock [email protected]

Library of Congress Control Number: 2012938665


International Edition:
ISBN-13: 978-1-133-18781-3
ISBN-10: 1-133-18781-1

Cengage Learning International Offices

Asia Australia/New Zealand


www.cengageasia.com www.cengage.com.au
tel: (65) 6410 1200 tel: (61) 3 9685 4111

Brazil India
www.cengage.com.br www.cengage.co.in
tel: (55) 11 3665 9900 tel: (91) 11 4364 1111

Latin America UK/Europe/Middle East/Africa


www.cengage.com.mx www.cengage.co.uk
tel: (52) 55 1500 6000 tel: (44) 0 1264 332 424

Represented in Canada by Nelson


Education, Ltd.
tel: (416) 752 9100/(800) 668 0671
www.nelson.com

Cengage Learning is a leading provider of customized learning solu-


tions with office locations around the globe, including Singapore, the
United Kingdom, Australia, Mexico, Brazil, and Japan. Locate your
local office at: international.cengage.com/region

For product information: www.cengage.com/international


Visit your local office: www.cengage.com/global
Visit our corporate website: www.cengage.com

Cengage Learning reserves the right to revise this publication and


make changes from time to time in its content without notice.

The programs in this book are for instructional purposes only.They


have been tested with care, but are not guaranteed for any particular
Printed in Canada intent beyond educational purposes. The author and the publisher do
not offer any warranties or representations, nor do they accept any
1 2 3 4 5 6 7 8 16 15 14 13 12 liabilities with respect to the programs.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
To Ina, Rachel, and Aaron

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Preface to the First Edition xi


To the student . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
To the educator . . . . . . . . . . . . . . . . . . . . . . . . . . xii
The first edition . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Feedback to the author . . . . . . . . . . . . . . . . . . . . . . xiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . xiv

Preface to the Second Edition xvii

Preface to the Third Edition xxi

0 Introduction 1
0.1 Automata, Computability, and Complexity . . . . . . . . . . . . . 1
Complexity theory . . . . . . . . . . . . . . . . . . . . . . . . . 2
Computability theory . . . . . . . . . . . . . . . . . . . . . . . 3
Automata theory . . . . . . . . . . . . . . . . . . . . . . . . . . 3
0.2 Mathematical Notions and Terminology . . . . . . . . . . . . . . 3
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Sequences and tuples . . . . . . . . . . . . . . . . . . . . . . . 6
Functions and relations . . . . . . . . . . . . . . . . . . . . . . 7
Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Strings and languages . . . . . . . . . . . . . . . . . . . . . . . 13
Boolean logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Summary of mathematical terms . . . . . . . . . . . . . . . . . 16
0.3 Definitions, Theorems, and Proofs . . . . . . . . . . . . . . . . . 17
Finding proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
0.4 Types of Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Proof by construction . . . . . . . . . . . . . . . . . . . . . . . 21
Proof by contradiction . . . . . . . . . . . . . . . . . . . . . . . 21
Proof by induction . . . . . . . . . . . . . . . . . . . . . . . . . 22
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 25
v

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
vi CONTENTS

Part One: Automata and Languages 29


1 Regular Languages 31
1.1 Finite Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Formal definition of a finite automaton . . . . . . . . . . . . . 35
Examples of finite automata . . . . . . . . . . . . . . . . . . . . 37
Formal definition of computation . . . . . . . . . . . . . . . . 40
Designing finite automata . . . . . . . . . . . . . . . . . . . . . 41
The regular operations . . . . . . . . . . . . . . . . . . . . . . 44
1.2 Nondeterminism . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Formal definition of a nondeterministic finite automaton . . . . 53
Equivalence of NFAs and DFAs . . . . . . . . . . . . . . . . . 54
Closure under the regular operations . . . . . . . . . . . . . . . 58
1.3 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 63
Formal definition of a regular expression . . . . . . . . . . . . 64
Equivalence with finite automata . . . . . . . . . . . . . . . . . 66
1.4 Nonregular Languages . . . . . . . . . . . . . . . . . . . . . . . . 77
The pumping lemma for regular languages . . . . . . . . . . . 77
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 82

2 Context-Free Languages 101


2.1 Context-Free Grammars . . . . . . . . . . . . . . . . . . . . . . . 102
Formal definition of a context-free grammar . . . . . . . . . . 104
Examples of context-free grammars . . . . . . . . . . . . . . . 105
Designing context-free grammars . . . . . . . . . . . . . . . . 106
Ambiguity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Chomsky normal form . . . . . . . . . . . . . . . . . . . . . . 108
2.2 Pushdown Automata . . . . . . . . . . . . . . . . . . . . . . . . . 111
Formal definition of a pushdown automaton . . . . . . . . . . . 113
Examples of pushdown automata . . . . . . . . . . . . . . . . . 114
Equivalence with context-free grammars . . . . . . . . . . . . . 117
2.3 Non-Context-Free Languages . . . . . . . . . . . . . . . . . . . . 125
The pumping lemma for context-free languages . . . . . . . . . 125
2.4 Deterministic Context-Free Languages . . . . . . . . . . . . . . . 130
Properties of DCFLs . . . . . . . . . . . . . . . . . . . . . . . 133
Deterministic context-free grammars . . . . . . . . . . . . . . 135
Relationship of DPDAs and DCFGs . . . . . . . . . . . . . . . 146
Parsing and LR(k) Grammars . . . . . . . . . . . . . . . . . . . 151
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 154

Part Two: Computability Theory 163


3 The Church–Turing Thesis 165
3.1 Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Formal definition of a Turing machine . . . . . . . . . . . . . . 167

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
CONTENTS vii

Examples of Turing machines . . . . . . . . . . . . . . . . . . . 170


3.2 Variants of Turing Machines . . . . . . . . . . . . . . . . . . . . . 176
Multitape Turing machines . . . . . . . . . . . . . . . . . . . . 176
Nondeterministic Turing machines . . . . . . . . . . . . . . . . 178
Enumerators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Equivalence with other models . . . . . . . . . . . . . . . . . . 181
3.3 The Definition of Algorithm . . . . . . . . . . . . . . . . . . . . 182
Hilbert’s problems . . . . . . . . . . . . . . . . . . . . . . . . . 182
Terminology for describing Turing machines . . . . . . . . . . 184
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 187

4 Decidability 193
4.1 Decidable Languages . . . . . . . . . . . . . . . . . . . . . . . . . 194
Decidable problems concerning regular languages . . . . . . . 194
Decidable problems concerning context-free languages . . . . . 198
4.2 Undecidability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
The diagonalization method . . . . . . . . . . . . . . . . . . . 202
An undecidable language . . . . . . . . . . . . . . . . . . . . . 207
A Turing-unrecognizable language . . . . . . . . . . . . . . . . 209
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 210

5 Reducibility 215
5.1 Undecidable Problems from Language Theory . . . . . . . . . . 216
Reductions via computation histories . . . . . . . . . . . . . . . 220
5.2 A Simple Undecidable Problem . . . . . . . . . . . . . . . . . . . 227
5.3 Mapping Reducibility . . . . . . . . . . . . . . . . . . . . . . . . 234
Computable functions . . . . . . . . . . . . . . . . . . . . . . . 234
Formal definition of mapping reducibility . . . . . . . . . . . . 235
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 239

6 Advanced Topics in Computability Theory 245


6.1 The Recursion Theorem . . . . . . . . . . . . . . . . . . . . . . . 245
Self-reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Terminology for the recursion theorem . . . . . . . . . . . . . 249
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
6.2 Decidability of logical theories . . . . . . . . . . . . . . . . . . . 252
A decidable theory . . . . . . . . . . . . . . . . . . . . . . . . . 255
An undecidable theory . . . . . . . . . . . . . . . . . . . . . . . 257
6.3 Turing Reducibility . . . . . . . . . . . . . . . . . . . . . . . . . . 260
6.4 A Definition of Information . . . . . . . . . . . . . . . . . . . . . 261
Minimal length descriptions . . . . . . . . . . . . . . . . . . . 262
Optimality of the definition . . . . . . . . . . . . . . . . . . . . 266
Incompressible strings and randomness . . . . . . . . . . . . . 267
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 270

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
viii CONTENTS

Part Three: Complexity Theory 273


7 Time Complexity 275
7.1 Measuring Complexity . . . . . . . . . . . . . . . . . . . . . . . . 275
Big-O and small-o notation . . . . . . . . . . . . . . . . . . . . 276
Analyzing algorithms . . . . . . . . . . . . . . . . . . . . . . . 279
Complexity relationships among models . . . . . . . . . . . . . 282
7.2 The Class P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Polynomial time . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Examples of problems in P . . . . . . . . . . . . . . . . . . . . 286
7.3 The Class NP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Examples of problems in NP . . . . . . . . . . . . . . . . . . . 295
The P versus NP question . . . . . . . . . . . . . . . . . . . . 297
7.4 NP-completeness . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Polynomial time reducibility . . . . . . . . . . . . . . . . . . . 300
Definition of NP-completeness . . . . . . . . . . . . . . . . . . 304
The Cook–Levin Theorem . . . . . . . . . . . . . . . . . . . . 304
7.5 Additional NP-complete Problems . . . . . . . . . . . . . . . . . 311
The vertex cover problem . . . . . . . . . . . . . . . . . . . . . 312
The Hamiltonian path problem . . . . . . . . . . . . . . . . . 314
The subset sum problem . . . . . . . . . . . . . . . . . . . . . 319
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 322

8 Space Complexity 331


8.1 Savitch’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 333
8.2 The Class PSPACE . . . . . . . . . . . . . . . . . . . . . . . . . 336
8.3 PSPACE-completeness . . . . . . . . . . . . . . . . . . . . . . . 337
The TQBF problem . . . . . . . . . . . . . . . . . . . . . . . . 338
Winning strategies for games . . . . . . . . . . . . . . . . . . . 341
Generalized geography . . . . . . . . . . . . . . . . . . . . . . 343
8.4 The Classes L and NL . . . . . . . . . . . . . . . . . . . . . . . . 348
8.5 NL-completeness . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Searching in graphs . . . . . . . . . . . . . . . . . . . . . . . . 353
8.6 NL equals coNL . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 356

9 Intractability 363
9.1 Hierarchy Theorems . . . . . . . . . . . . . . . . . . . . . . . . . 364
Exponential space completeness . . . . . . . . . . . . . . . . . 371
9.2 Relativization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
Limits of the diagonalization method . . . . . . . . . . . . . . 377
9.3 Circuit Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 388

10 Advanced Topics in Complexity Theory 393


10.1 Approximation Algorithms . . . . . . . . . . . . . . . . . . . . . 393

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
CONTENTS ix

10.2 Probabilistic Algorithms . . . . . . . . . . . . . . . . . . . . . . . 396


The class BPP . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Primality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Read-once branching programs . . . . . . . . . . . . . . . . . . 404
10.3 Alternation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Alternating time and space . . . . . . . . . . . . . . . . . . . . 410
The Polynomial time hierarchy . . . . . . . . . . . . . . . . . . 414
10.4 Interactive Proof Systems . . . . . . . . . . . . . . . . . . . . . . 415
Graph nonisomorphism . . . . . . . . . . . . . . . . . . . . . . 415
Definition of the model . . . . . . . . . . . . . . . . . . . . . . 416
IP = PSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
10.5 Parallel Computation . . . . . . . . . . . . . . . . . . . . . . . . 427
Uniform Boolean circuits . . . . . . . . . . . . . . . . . . . . . 428
The class NC . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
P-completeness . . . . . . . . . . . . . . . . . . . . . . . . . . 432
10.6 Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Secret keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Public-key cryptosystems . . . . . . . . . . . . . . . . . . . . . 435
One-way functions . . . . . . . . . . . . . . . . . . . . . . . . . 435
Trapdoor functions . . . . . . . . . . . . . . . . . . . . . . . . 437
Exercises, Problems, and Solutions . . . . . . . . . . . . . . . . . . . 439

Selected Bibliography 443

Index 448

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
PREFACE TO THE
FIRST EDITION

TO THE STUDENT
Welcome!
You are about to embark on the study of a fascinating and important subject:
the theory of computation. It comprises the fundamental mathematical proper-
ties of computer hardware, software, and certain applications thereof. In study-
ing this subject, we seek to determine what can and cannot be computed, how
quickly, with how much memory, and on which type of computational model.
The subject has obvious connections with engineering practice, and, as in many
sciences, it also has purely philosophical aspects.
I know that many of you are looking forward to studying this material but
some may not be here out of choice. You may want to obtain a degree in com-
puter science or engineering, and a course in theory is required—God knows
why. After all, isn’t theory arcane, boring, and worst of all, irrelevant?
To see that theory is neither arcane nor boring, but instead quite understand-
able and even interesting, read on. Theoretical computer science does have
many fascinating big ideas, but it also has many small and sometimes dull details
that can be tiresome. Learning any new subject is hard work, but it becomes
easier and more enjoyable if the subject is properly presented. My primary ob-
jective in writing this book is to expose you to the genuinely exciting aspects of
computer theory, without getting bogged down in the drudgery. Of course, the
only way to determine whether theory interests you is to try learning it.
xi

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
xii PREFACE TO THE FIRST EDITION

Theory is relevant to practice. It provides conceptual tools that practition-


ers use in computer engineering. Designing a new programming language for a
specialized application? What you learned about grammars in this course comes
in handy. Dealing with string searching and pattern matching? Remember finite
automata and regular expressions. Confronted with a problem that seems to re-
quire more computer time than you can afford? Think back to what you learned
about NP-completeness. Various application areas, such as modern cryptographic
protocols, rely on theoretical principles that you will learn here.
Theory also is relevant to you because it shows you a new, simpler, and more
elegant side of computers, which we normally consider to be complicated ma-
chines. The best computer designs and applications are conceived with elegance
in mind. A theoretical course can heighten your aesthetic sense and help you
build more beautiful systems.
Finally, theory is good for you because studying it expands your mind. Com-
puter technology changes quickly. Specific technical knowledge, though useful
today, becomes outdated in just a few years. Consider instead the abilities to
think, to express yourself clearly and precisely, to solve problems, and to know
when you haven’t solved a problem. These abilities have lasting value. Studying
theory trains you in these areas.
Practical considerations aside, nearly everyone working with computers is cu-
rious about these amazing creations, their capabilities, and their limitations. A
whole new branch of mathematics has grown up in the past 30 years to answer
certain basic questions. Here’s a big one that remains unsolved: If I give you a
large number—say, with 500 digits—can you find its factors (the numbers that
divide it evenly) in a reasonable amount of time? Even using a supercomputer, no
one presently knows how to do that in all cases within the lifetime of the universe!
The factoring problem is connected to certain secret codes in modern cryptosys-
tems. Find a fast way to factor, and fame is yours!

TO THE EDUCATOR
This book is intended as an upper-level undergraduate or introductory gradu-
ate text in computer science theory. It contains a mathematical treatment of
the subject, designed around theorems and proofs. I have made some effort to
accommodate students with little prior experience in proving theorems, though
more experienced students will have an easier time.
My primary goal in presenting the material has been to make it clear and
interesting. In so doing, I have emphasized intuition and “the big picture” in the
subject over some lower level details.
For example, even though I present the method of proof by induction in
Chapter 0 along with other mathematical preliminaries, it doesn’t play an im-
portant role subsequently. Generally, I do not present the usual induction proofs
of the correctness of various constructions concerning automata. If presented
clearly, these constructions convince and do not need further argument. An in-
duction may confuse rather than enlighten because induction itself is a rather
sophisticated technique that many find mysterious. Belaboring the obvious with

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
PREFACE TO THE FIRST EDITION xiii

an induction risks teaching students that a mathematical proof is a formal ma-


nipulation instead of teaching them what is and what is not a cogent argument.
A second example occurs in Parts Two and Three, where I describe algorithms
in prose instead of pseudocode. I don’t spend much time programming Turing
machines (or any other formal model). Students today come with a program-
ming background and find the Church–Turing thesis to be self-evident. Hence
I don’t present lengthy simulations of one model by another to establish their
equivalence.
Besides giving extra intuition and suppressing some details, I give what might
be called a classical presentation of the subject material. Most theorists will find
the choice of material, terminology, and order of presentation consistent with
that of other widely used textbooks. I have introduced original terminology in
only a few places, when I found the standard terminology particularly obscure
or confusing. For example, I introduce the term mapping reducibility instead of
many–one reducibility.
Practice through solving problems is essential to learning any mathemati-
cal subject. In this book, the problems are organized into two main categories
called Exercises and Problems. The Exercises review definitions and concepts.
The Problems require some ingenuity. Problems marked with a star are more
difficult. I have tried to make the Exercises and Problems interesting challenges.

THE FIRST EDITION


Introduction to the Theory of Computation first appeared as a Preliminary Edition
in paperback. The first edition differs from the Preliminary Edition in several
substantial ways. The final three chapters are new: Chapter 8 on space complex-
ity; Chapter 9 on provable intractability; and Chapter 10 on advanced topics in
complexity theory. Chapter 6 was expanded to include several advanced topics
in computability theory. Other chapters were improved through the inclusion
of additional examples and exercises.
Comments from instructors and students who used the Preliminary Edition
were helpful in polishing Chapters 0–7. Of course, the errors they reported have
been corrected in this edition.
Chapters 6 and 10 give a survey of several more advanced topics in com-
putability and complexity theories. They are not intended to comprise a cohesive
unit in the way that the remaining chapters are. These chapters are included to
allow the instructor to select optional topics that may be of interest to the serious
student. The topics themselves range widely. Some, such as Turing reducibility
and alternation, are direct extensions of other concepts in the book. Others, such
as decidable logical theories and cryptography, are brief introductions to large fields.

FEEDBACK TO THE AUTHOR


The internet provides new opportunities for interaction between authors and
readers. I have received much e-mail offering suggestions, praise, and criticism,
and reporting errors for the Preliminary Edition. Please continue to correspond!

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
xiv PREFACE TO THE FIRST EDITION

I try to respond to each message personally, as time permits. The e-mail address
for correspondence related to this book is

[email protected] .

ACKNOWLEDGMENTS
I could not have written this book without the help of many friends, colleagues,
and my family.
I wish to thank the teachers who helped shape my scientific viewpoint and
educational style. Five of them stand out. My thesis advisor, Manuel Blum, is
due a special note for his unique way of inspiring students through clarity of
thought, enthusiasm, and caring. He is a model for me and for many others.
I am grateful to Richard Karp for introducing me to complexity theory, to John
Addison for teaching me logic and assigning those wonderful homework sets,
to Juris Hartmanis for introducing me to the theory of computation, and to my
father for introducing me to mathematics, computers, and the art of teaching.
This book grew out of notes from a course that I have taught at MIT for
the past 15 years. Students in my classes took these notes from my lectures. I
hope they will forgive me for not listing them all. My teaching assistants over
the years—Avrim Blum, Thang Bui, Benny Chor, Andrew Chou, Stavros Cos-
madakis, Aditi Dhagat, Wayne Goddard, Parry Husbands, Dina Kravets, Jakov
Kučan, Brian O’Neill, Ioana Popescu, and Alex Russell—helped me to edit and
expand these notes and provided some of the homework problems.
Nearly three years ago, Tom Leighton persuaded me to write a textbook on
the theory of computation. I had been thinking of doing so for some time, but
it took Tom’s persuasion to turn theory into practice. I appreciate his generous
advice on book writing and on many other things.
I wish to thank Eric Bach, Peter Beebee, Cris Calude, Marek Chrobak, Anna
Chefter, Guang-Ien Cheng, Elias Dahlhaus, Michael Fischer, Steve Fisk, Lance
Fortnow, Henry J. Friedman, Jack Fu, Seymour Ginsburg, Oded Goldreich,
Brian Grossman, David Harel, Micha Hofri, Dung T. Huynh, Neil Jones, H.
Chad Lane, Kevin Lin, Michael Loui, Silvio Micali, Tadao Murata, Chris-
tos Papadimitriou, Vaughan Pratt, Daniel Rosenband, Brian Scassellati, Ashish
Sharma, Nir Shavit, Alexander Shen, Ilya Shlyakhter, Matt Stallmann, Perry
Susskind, Y. C. Tay, Joseph Traub, Osamu Watanabe, Peter Widmayer, David
Williamson, Derick Wood, and Charles Yang for comments, suggestions, and
assistance as the writing progressed.
The following people provided additional comments that have improved
this book: Isam M. Abdelhameed, Eric Allender, Shay Artzi, Michelle Ather-
ton, Rolfe Blodgett, Al Briggs, Brian E. Brooks, Jonathan Buss, Jin Yi Cai,
Steve Chapel, David Chow, Michael Ehrlich, Yaakov Eisenberg, Farzan Fallah,
Shaun Flisakowski, Hjalmtyr Hafsteinsson, C. R. Hale, Maurice Herlihy, Vegard
Holmedahl, Sandy Irani, Kevin Jiang, Rhys Price Jones, James M. Jowdy, David
M. Martin Jr., Manrique Mata-Montero, Ryota Matsuura, Thomas Minka,
Farooq Mohammed, Tadao Murata, Jason Murray, Hideo Nagahashi, Kazuo

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
PREFACE TO THE FIRST EDITION xv

Ohta, Constantine Papageorgiou, Joseph Raj, Rick Regan, Rhonda A. Reumann,


Michael Rintzler, Arnold L. Rosenberg, Larry Roske, Max Rozenoer, Walter L.
Ruzzo, Sanatan Sahgal, Leonard Schulman, Steve Seiden, Joel Seiferas, Ambuj
Singh, David J. Stucki, Jayram S. Thathachar, H. Venkateswaran, Tom Whaley,
Christopher Van Wyk, Kyle Young, and Kyoung Hwan Yun.
Robert Sloan used an early version of the manuscript for this book in a class
that he taught and provided me with invaluable commentary and ideas from
his experience with it. Mark Herschberg, Kazuo Ohta, and Latanya Sweeney
read over parts of the manuscript and suggested extensive improvements. Shafi
Goldwasser helped me with material in Chapter 10.
I received expert technical support from William Baxter at Superscript, who
wrote the LATEX macro package implementing the interior design, and from
Larry Nolan at the MIT mathematics department, who keeps things running.
It has been a pleasure to work with the folks at PWS Publishing in creat-
ing the final product. I mention Michael Sugarman, David Dietz, Elise Kaiser,
Monique Calello, Susan Garland and Tanja Brull because I have had the most
contact with them, but I know that many others have been involved, too. Thanks
to Jerry Moore for the copy editing, to Diane Levy for the cover design, and to
Catherine Hawkes for the interior design.
I am grateful to the National Science Foundation for support provided under
grant CCR-9503322.
My father, Kenneth Sipser, and sister, Laura Sipser, converted the book di-
agrams into electronic form. My other sister, Karen Fisch, saved us in various
computer emergencies, and my mother, Justine Sipser, helped out with motherly
advice. I thank them for contributing under difficult circumstances, including
insane deadlines and recalcitrant software.
Finally, my love goes to my wife, Ina, and my daughter, Rachel. Thanks for
putting up with all of this.

Cambridge, Massachusetts Michael Sipser


October, 1996

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
PREFACE TO THE
SECOND EDITION

Judging from the email communications that I’ve received from so many of you,
the biggest deficiency of the first edition is that it provides no sample solutions
to any of the problems. So here they are. Every chapter now contains a new
Selected Solutions section that gives answers to a representative cross-section of
that chapter’s exercises and problems. To make up for the loss of the solved
problems as interesting homework challenges, I’ve also added a variety of new
problems. The Instructor’s Manual contains additional solutions and can be
found on the companion website at www.cengage.com/international .
A number of readers would have liked more coverage of certain “standard”
topics, particularly the Myhill–Nerode Theorem and Rice’s Theorem. I’ve par-
tially accommodated these readers by developing these topics in the solved prob-
lems. I did not include the Myhill–Nerode Theorem in the main body of the text
because I believe that this course should provide only an introduction to finite
automata and not a deep investigation. In my view, the role of finite automata
here is for students to explore a simple formal model of computation as a prelude
to more powerful models, and to provide convenient examples for subsequent
topics. Of course, some people would prefer a more thorough treatment, while
others feel that I ought to omit all references to (or at least dependence on) finite
automata. I did not include Rice’s Theorem in the main body of the text because,
though it can be a useful “tool” for proving undecidability, some students might
use it mechanically without really understanding what is going on. Using reduc-
tions instead, for proving undecidability, gives more valuable preparation for the
reductions that appear in complexity theory.
xvii

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
xviii PREFACE TO THE SECOND EDITION

I am indebted to my teaching assistants—Ilya Baran, Sergi Elizalde, Rui Fan,


Jonathan Feldman, Venkatesan Guruswami, Prahladh Harsha, Christos Kapout-
sis, Julia Khodor, Adam Klivans, Kevin Matulef, Ioana Popescu, April Rasala,
Sofya Raskhodnikova, and Iuliu Vasilescu—who helped me to craft some of
the new problems and solutions. Ching Law, Edmond Kayi Lee, and Zulfikar
Ramzan also contributed to the solutions. I thank Victor Shoup for coming up
with a simple way to repair the gap in the analysis of the probabilistic primality
algorithm that appears in the first edition.
I appreciate the efforts of the people at Course Technology in pushing me
and the other parts of this project along, especially Alyssa Pratt and Aimee
Poirier. Many thanks to Gerald Eisman, Weizhen Mao, Rupak Majumdar,
Chris Umans, and Christopher Wilson for their reviews. I’m indebted to Jerry
Moore for his superb job copy editing and to Laura Segel of ByteGraphics
([email protected]) for her beautiful rendition of the figures.
The volume of email I’ve received has been more than I expected. Hearing
from so many of you from so many places has been absolutely delightful, and I’ve
tried to respond to all eventually—my apologies for those I missed. I’ve listed
here the people who made suggestions that specifically affected this edition, but
I thank everyone for their correspondence:
Luca Aceto, Arash Afkanpour, Rostom Aghanian, Eric Allender, Karun Bak-
shi, Brad Ballinger, Ray Bartkus, Louis Barton, Arnold Beckmann, Mihir Bel-
lare, Kevin Trent Bergeson, Matthew Berman, Rajesh Bhatt, Somenath Biswas,
Lenore Blum, Mauro A. Bonatti, Paul Bondin, Nicholas Bone, Ian Bratt, Gene
Browder, Doug Burke, Sam Buss, Vladimir Bychkovsky, Bruce Carneal, Soma
Chaudhuri, Rong-Jaye Chen, Samir Chopra, Benny Chor, John Clausen, Alli-
son Coates, Anne Condon, Jeffrey Considine, John J. Crashell, Claude Crepeau,
Shaun Cutts, Susheel M. Daswani, Geoff Davis, Scott Dexter, Peter Drake,
Jeff Edmonds, Yaakov Eisenberg, Kurtcebe Eroglu, Georg Essl, Alexander T.
Fader, Farzan Fallah, Faith Fich, Joseph E. Fitzgerald, Perry Fizzano, David
Ford, Jeannie Fromer, Kevin Fu, Atsushi Fujioka, Michel Galley, K. Gane-
san, Simson Garfinkel, Travis Gebhardt, Peymann Gohari, Ganesh Gopalakr-
ishnan, Steven Greenberg, Larry Griffith, Jerry Grossman, Rudolf de Haan,
Michael Halper, Nick Harvey, Mack Hendricks, Laurie Hiyakumoto, Steve
Hockema, Michael Hoehle, Shahadat Hossain, Dave Isecke, Ghaith Issa, Raj D.
Iyer, Christian Jacobi, Thomas Janzen, Mike D. Jones, Max Kanovitch, Aaron
Kaufman, Roger Khazan, Sarfraz Khurshid, Kevin Killourhy, Seungjoo Kim,
Victor Kuncak, Kanata Kuroda, Thomas Lasko, Suk Y. Lee, Edward D. Leg-
enski, Li-Wei Lehman, Kong Lei, Zsolt Lengvarszky, Jeffrey Levetin, Baekjun
Lim, Karen Livescu, Stephen Louie, TzerHung Low, Wolfgang Maass, Arash
Madani, Michael Manapat, Wojciech Marchewka, David M. Martin Jr., Anders
Martinson, Lyle McGeoch, Alberto Medina, Kurt Mehlhorn, Nihar Mehta, Al-
bert R. Meyer, Thomas Minka, Mariya Minkova, Daichi Mizuguchi, G. Allen
Morris III, Damon Mosk-Aoyama, Xiaolong Mou, Paul Muir, German Muller,
Donald Nelson, Gabriel Nivasch, Mary Obelnicki, Kazuo Ohta, Thomas M.
Oleson, Jr., Curtis Oliver, Owen Ozier, Rene Peralta, Alexander Perlis, Holger
Petersen, Detlef Plump, Robert Prince, David Pritchard, Bina Reed, Nicholas

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
PREFACE TO THE SECOND EDITION xix

Riley, Ronald Rivest, Robert Robinson, Christi Rockwell, Phil Rogaway, Max
Rozenoer, John Rupf, Teodor Rus, Larry Ruzzo, Brian Sanders, Cem Say, Kim
Schioett, Joel Seiferas, Joao Carlos Setubal, Geoff Lee Seyon, Mark Skandera,
Bob Sloan, Geoff Smith, Marc L. Smith, Stephen Smith, Alex C. Snoeren, Guy
St-Denis, Larry Stockmeyer, Radu Stoleru, David Stucki, Hisham M. Sueyllam,
Kenneth Tam, Elizabeth Thompson, Michel Toulouse, Eric Tria, Chittaranjan
Tripathy, Dan Trubow, Hiroki Ueda, Giora Unger, Kurt L. Van Etten, Jesir
Vargas, Bienvenido Velez-Rivera, Kobus Vos, Alex Vrenios, Sven Waibel, Marc
Waldman, Tom Whaley, Anthony Widjaja, Sean Williams, Joseph N. Wilson,
Chris Van Wyk, Guangming Xing, Vee Voon Yee, Cheng Yongxi, Neal Young,
Timothy Yuen, Kyle Yung, Jinghua Zhang, Lilla Zollei.
I thank Suzanne Balik, Matthew Kane, Kurt L. Van Etten, Nancy Lynch,
Gregory Roberts, and Cem Say for pointing out errata in the first printing.
Most of all, I thank my family—Ina, Rachel, and Aaron—for their patience,
understanding, and love as I sat for endless hours here in front of my computer
screen.

Cambridge, Massachusetts Michael Sipser


December, 2004

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
PREFACE TO THE
THIRD EDITION

The third edition contains an entirely new section on deterministic context-free


languages. I chose this topic for several reasons. First of all, it fills an obvious
gap in my previous treatment of the theory of automata and languages. The
older editions introduced finite automata and Turing machines in deterministic
and nondeterministic variants, but covered only the nondeterministic variant of
pushdown automata. Adding a discussion of deterministic pushdown automata
provides a missing piece of the puzzle.
Second, the theory of deterministic context-free grammars is the basis for
LR(k) grammars, an important and nontrivial application of automata theory in
programming languages and compiler design. This application brings together
several key concepts, including the equivalence of deterministic and nondeter-
ministic finite automata, and the conversions between context-free grammars
and pushdown automata, to yield an efficient and beautiful method for parsing.
Here we have a concrete interplay between theory and practice.
Last, this topic seems underserved in existing theory textbooks, considering
its importance as a genuine application of automata theory. I studied LR(k) gram-
mars years ago but without fully understanding how they work, and without
seeing how nicely they fit into the theory of deterministic context-free languages.
My goal in writing this section is to give an intuitive yet rigorous introduction
to this area for theorists as well as practitioners, and thereby contribute to its
broader appreciation. One note of caution, however: Some of the material in
this section is rather challenging, so an instructor in a basic first theory course
xxi

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
xxii PREFACE TO THE THIRD EDITION

may prefer to designate it as supplementary reading. Later chapters do not de-


pend on this material.
Many people helped directly or indirectly in developing this edition. I’m in-
debted to reviewers Christos Kapoutsis and Cem Say who read a draft of the new
section and provided valuable feedback. Several individuals at Cengage Learning
assisted with the production, notably Alyssa Pratt and Jennifer Feltri-George.
Suzanne Huizenga copyedited the text and Laura Segel of ByteGraphics created
the new figures and modified some of the older figures.
I wish to thank my teaching assistants at MIT, Victor Chen, Andy Drucker,
Michael Forbes, Elena Grigorescu, Brendan Juba, Christos Kapoutsis, Jon Kel-
ner, Swastik Kopparty, Kevin Matulef, Amanda Redlich, Zack Remscrim, Ben
Rossman, Shubhangi Saraf, and Oren Weimann. Each of them helped me by
discussing new problems and their solutions, and by providing insight into how
well our students understood the course content. I’ve greatly enjoyed working
with such talented and enthusiastic young people.
It has been gratifying to receive email from around the globe. Thanks to all
for your suggestions, questions, and ideas. Here is a list of those correspondents
whose comments affected this edition:
Djihed Afifi, Steve Aldrich, Eirik Bakke, Suzanne Balik, Victor Bandur, Paul
Beame, Elazar Birnbaum, Goutam Biswas, Rob Bittner, Marina Blanton, Rod-
ney Bliss, Promita Chakraborty, Lewis Collier, Jonathan Deber, Simon Dex-
ter, Matt Diephouse, Peter Dillinger, Peter Drake, Zhidian Du, Peter Fe-
jer, Margaret Fleck, Atsushi Fujioka, Valerio Genovese, Evangelos Georgiadis,
Joshua Grochow, Jerry Grossman, Andreas Guelzow, Hjalmtyr Hafsteinsson,
Arthur Hall III, Cihat Imamoglu, Chinawat Isradisaikul, Kayla Jacobs, Flem-
ming Jensen, Barbara Kaiser, Matthew Kane, Christos Kapoutsis, Ali Durlov
Khan, Edwin Sze Lun Khoo, Yongwook Kim, Akash Kumar, Eleazar Leal, Zsolt
Lengvarszky, Cheng-Chung Li, Xiangdong Liang, Vladimir Lifschitz, Ryan
Lortie, Jonathan Low, Nancy Lynch, Alexis Maciel, Kevin Matulef, Nelson
Max, Hans-Rudolf Metz, Mladen Mikŝa, Sara Miner More, Rajagopal Nagara-
jan, Marvin Nakayama, Jonas Nyrup, Gregory Roberts, Ryan Romero, Santhosh
Samarthyam, Cem Say, Joel Seiferas, John Sieg, Marc Smith, John Steinberger,
Nuri Taşdemir, Tamir Tassa, Mark Testa, Jesse Tjang, John Trammell, Hi-
roki Ueda, Jeroen Vaelen, Kurt L. Van Etten, Guillermo Vázquez, Phanisekhar
Botlaguduru Venkata, Benjamin Bing-Yi Wang, Lutz Warnke, David Warren,
Thomas Watson, Joseph Wilson, David Wittenberg, Brian Wongchaowart, Kis-
han Yerubandi, Dai Yi.
Above all, I thank my family—my wife, Ina, and our children, Rachel and
Aaron. Time is finite and fleeting. Your love is everything.

Cambridge, Massachusetts Michael Sipser


April, 2012

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
0

INTRODUCTION

We begin with an overview of those areas in the theory of computation that


we present in this course. Following that, you’ll have a chance to learn and/or
review some mathematical concepts that you will need later.

0.1
AUTOMATA, COMPUTABILITY, AND COMPLEXITY
This book focuses on three traditionally central areas of the theory of computa-
tion: automata, computability, and complexity. They are linked by the question:

What are the fundamental capabilities and limitations of computers?

This question goes back to the 1930s when mathematical logicians first began
to explore the meaning of computation. Technological advances since that time
have greatly increased our ability to compute and have brought this question out
of the realm of theory into the world of practical concern.
In each of the three areas—automata, computability, and complexity—this
question is interpreted differently, and the answers vary according to the in-
terpretation. Following this introductory chapter, we explore each area in a
1

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
2 CHAPTER 0 / INTRODUCTION

separate part of this book. Here, we introduce these parts in reverse order be-
cause by starting from the end you can better understand the reason for the
beginning.

COMPLEXITY THEORY
Computer problems come in different varieties; some are easy, and some are
hard. For example, the sorting problem is an easy one. Say that you need to
arrange a list of numbers in ascending order. Even a small computer can sort
a million numbers rather quickly. Compare that to a scheduling problem. Say
that you must find a schedule of classes for the entire university to satisfy some
reasonable constraints, such as that no two classes take place in the same room
at the same time. The scheduling problem seems to be much harder than the
sorting problem. If you have just a thousand classes, finding the best schedule
may require centuries, even with a supercomputer.

What makes some problems computationally hard and others easy?

This is the central question of complexity theory. Remarkably, we don’t know


the answer to it, though it has been intensively researched for over 40 years.
Later, we explore this fascinating question and some of its ramifications.
In one important achievement of complexity theory thus far, researchers have
discovered an elegant scheme for classifying problems according to their com-
putational difficulty. It is analogous to the periodic table for classifying elements
according to their chemical properties. Using this scheme, we can demonstrate
a method for giving evidence that certain problems are computationally hard,
even if we are unable to prove that they are.
You have several options when you confront a problem that appears to be
computationally hard. First, by understanding which aspect of the problem is at
the root of the difficulty, you may be able to alter it so that the problem is more
easily solvable. Second, you may be able to settle for less than a perfect solution
to the problem. In certain cases, finding solutions that only approximate the
perfect one is relatively easy. Third, some problems are hard only in the worst
case situation, but easy most of the time. Depending on the application, you may
be satisfied with a procedure that occasionally is slow but usually runs quickly.
Finally, you may consider alternative types of computation, such as randomized
computation, that can speed up certain tasks.
One applied area that has been affected directly by complexity theory is the
ancient field of cryptography. In most fields, an easy computational problem is
preferable to a hard one because easy ones are cheaper to solve. Cryptography
is unusual because it specifically requires computational problems that are hard,
rather than easy. Secret codes should be hard to break without the secret key
or password. Complexity theory has pointed cryptographers in the direction of
computationally hard problems around which they have designed revolutionary
new codes.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 3

COMPUTABILITY THEORY
During the first half of the twentieth century, mathematicians such as Kurt
Gödel, Alan Turing, and Alonzo Church discovered that certain basic problems
cannot be solved by computers. One example of this phenomenon is the prob-
lem of determining whether a mathematical statement is true or false. This task
is the bread and butter of mathematicians. It seems like a natural for solution
by computer because it lies strictly within the realm of mathematics. But no
computer algorithm can perform this task.
Among the consequences of this profound result was the development of ideas
concerning theoretical models of computers that eventually would help lead to
the construction of actual computers.
The theories of computability and complexity are closely related. In com-
plexity theory, the objective is to classify problems as easy ones and hard ones;
whereas in computability theory, the classification of problems is by those that
are solvable and those that are not. Computability theory introduces several of
the concepts used in complexity theory.

AUTOMATA THEORY
Automata theory deals with the definitions and properties of mathematical mod-
els of computation. These models play a role in several applied areas of computer
science. One model, called the finite automaton, is used in text processing, com-
pilers, and hardware design. Another model, called the context-free grammar, is
used in programming languages and artificial intelligence.
Automata theory is an excellent place to begin the study of the theory of
computation. The theories of computability and complexity require a precise
definition of a computer. Automata theory allows practice with formal definitions
of computation as it introduces concepts relevant to other nontheoretical areas
of computer science.

0.2
MATHEMATICAL NOTIONS AND TERMINOLOGY
As in any mathematical subject, we begin with a discussion of the basic mathe-
matical objects, tools, and notation that we expect to use.

SETS
A set is a group of objects represented as a unit. Sets may contain any type of
object, including numbers, symbols, and even other sets. The objects in a set are
called its elements or members. Sets may be described formally in several ways.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
4 CHAPTER 0 / INTRODUCTION

One way is by listing a set’s elements inside braces. Thus the set

S = {7, 21, 57}

contains the elements 7, 21, and 57. The symbols ∈ and 6∈ denote set member-
ship and nonmembership. We write 7 ∈ {7, 21, 57} and 8 6∈ {7, 21, 57}. For two
sets A and B, we say that A is a subset of B, written A ⊆ B, if every member of
A also is a member of B. We say that A is a proper subset of B, written A ( B,
if A is a subset of B and not equal to B.
The order of describing a set doesn’t matter, nor does repetition of its mem-
bers. We get the same set S by writing {57, 7, 7, 7, 21}. If we do want to take the
number of occurrences of members into account, we call the group a multiset
instead of a set. Thus {7} and {7, 7} are different as multisets but identical as
sets. An infinite set contains infinitely many elements. We cannot write a list of
all the elements of an infinite set, so we sometimes use the “. . .” notation to mean
“continue the sequence forever.” Thus we write the set of natural numbers N
as

{1, 2, 3, . . . }.

The set of integers Z is written as

{ . . . , −2, −1, 0, 1, 2, . . . }.

The set with zero members is called the empty set and is written ∅. A set with
one member is sometimes called a singleton set, and a set with two members is
called an unordered pair.
When we want to describe a set containing elements according to some rule,
we write {n| rule about n}. Thus {n| n = m2 for some m ∈ N } means the set of
perfect squares.
If we have two sets A and B, the union of A and B, written A∪B, is the set we
get by combining all the elements in A and B into a single set. The intersection
of A and B, written A ∩ B, is the set of elements that are in both A and B. The
complement of A, written A, is the set of all elements under consideration that
are not in A.
As is often the case in mathematics, a picture helps clarify a concept. For sets,
we use a type of picture called a Venn diagram. It represents sets as regions
enclosed by circular lines. Let the set START-t be the set of all English words
that start with the letter “t”. For example, in the figure, the circle represents the
set START-t. Several members of this set are represented as points inside the
circle.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 5

FIGURE 0.1
Venn diagram for the set of English words starting with “t”

Similarly, we represent the set END -z of English words that end with “z” in
the following figure.

FIGURE 0.2
Venn diagram for the set of English words ending with “z”

To represent both sets in the same Venn diagram, we must draw them so that
they overlap, indicating that they share some elements, as shown in the following
figure. For example, the word topaz is in both sets. The figure also contains a
circle for the set START-j. It doesn’t overlap the circle for START-t because no
word lies in both sets.

FIGURE 0.3
Overlapping circles indicate common elements

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
6 CHAPTER 0 / INTRODUCTION

The next two Venn diagrams depict the union and intersection of sets A
and B.

FIGURE 0.4
Diagrams for (a) A ∪ B and (b) A ∩ B

SEQUENCES AND TUPLES


A sequence of objects is a list of these objects in some order. We usually designate
a sequence by writing the list within parentheses. For example, the sequence 7,
21, 57 would be written
(7, 21, 57).
The order doesn’t matter in a set, but in a sequence it does. Hence (7, 21, 57) is
not the same as (57, 7, 21). Similarly, repetition does matter in a sequence, but
it doesn’t matter in a set. Thus (7, 7, 21, 57) is different from both of the other
sequences, whereas the set {7, 21, 57} is identical to the set {7, 7, 21, 57}.
As with sets, sequences may be finite or infinite. Finite sequences often are
called tuples. A sequence with k elements is a k-tuple. Thus (7, 21, 57) is a
3-tuple. A 2-tuple is also called an ordered pair.
Sets and sequences may appear as elements of other sets and sequences. For
example, the power set of A is the set of all subsets of A. If A is the set {0, 1},
the power set of A is the set { ∅, {0}, {1}, {0, 1} }. The set of all ordered pairs
whose elements are 0s and 1s is { (0, 0), (0, 1), (1, 0), (1, 1) }.
If A and B are two sets, the Cartesian product or cross product of A and
B, written A × B, is the set of all ordered pairs wherein the first element is a
member of A and the second element is a member of B.

EXAMPLE 0.5
If A = {1, 2} and B = {x, y, z},
A × B = { (1, x), (1, y), (1, z), (2, x), (2, y), (2, z) }.

We can also take the Cartesian product of k sets, A1 , A2 , . . . , Ak , written


A1 × A2 × · · · × Ak . It is the set consisting of all k-tuples (a1 , a2 , . . . , ak ) where
ai ∈ Ai .

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 7

EXAMPLE 0.6
If A and B are as in Example 0.5,

A × B × A = (1, x, 1), (1, x, 2), (1, y, 1), (1, y, 2), (1, z, 1), (1, z, 2),
(2, x, 1), (2, x, 2), (2, y, 1), (2, y, 2), (2, z, 1), (2, z, 2) .

If we have the Cartesian product of a set with itself, we use the shorthand
k
z }| {
A × A × · · · × A = Ak .

EXAMPLE 0.7
The set N 2 equals N × N . It consists of all ordered pairs of natural numbers.
We also may write it as {(i, j)| i, j ≥ 1}.

FUNCTIONS AND RELATIONS


Functions are central to mathematics. A function is an object that sets up an
input–output relationship. A function takes an input and produces an output.
In every function, the same input always produces the same output. If f is a
function whose output value is b when the input value is a, we write
f (a) = b.
A function also is called a mapping, and, if f (a) = b, we say that f maps a to b.
For example, the absolute value function abs takes a number x as input and
returns x if x is positive and −x if x is negative. Thus abs(2) = abs(−2) =
2. Addition is another example of a function, written add . The input to the
addition function is an ordered pair of numbers, and the output is the sum of
those numbers.
The set of possible inputs to the function is called its domain. The outputs
of a function come from a set called its range. The notation for saying that f is
a function with domain D and range R is
f : D−→R.
In the case of the function abs, if we are working with integers, the domain and
the range are Z, so we write abs : Z−→Z. In the case of the addition function
for integers, the domain is the set of pairs of integers Z × Z and the range is Z,
so we write add : Z × Z−→Z. Note that a function may not necessarily use all
the elements of the specified range. The function abs never takes on the value
−1 even though −1 ∈ Z. A function that does use all the elements of the range
is said to be onto the range.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
8 CHAPTER 0 / INTRODUCTION

We may describe a specific function in several ways. One way is with a pro-
cedure for computing an output from a specified input. Another way is with a
table that lists all possible inputs and gives the output for each input.

EXAMPLE 0.8
Consider the function f : {0, 1, 2, 3, 4}−→ {0, 1, 2, 3, 4}.
n f (n)
0 1
1 2
2 3
3 4
4 0
This function adds 1 to its input and then outputs the result modulo 5. A number
modulo m is the remainder after division by m. For example, the minute hand
on a clock face counts modulo 60. When we do modular arithmetic, we define
Zm = {0, 1, 2, . . . , m − 1}. With this notation, the aforementioned function f
has the form f : Z5 −→ Z5 .

EXAMPLE 0.9
Sometimes a two-dimensional table is used if the domain of the function is the
Cartesian product of two sets. Here is another function, g : Z4 × Z4 −→Z4 . The
entry at the row labeled i and the column labeled j in the table is the value of
g(i, j).
g 0 1 2 3
0 0 1 2 3
1 1 2 3 0
2 2 3 0 1
3 3 0 1 2
The function g is the addition function modulo 4.

When the domain of a function f is A1 ×· · ·×Ak for some sets A1 , . . . , Ak , the


input to f is a k-tuple (a1 , a2 , . . . , ak ) and we call the ai the arguments to f . A
function with k arguments is called a k-ary function, and k is called the arity of
the function. If k is 1, f has a single argument and f is called a unary function.
If k is 2, f is a binary function. Certain familiar binary functions are written
in a special infix notation, with the symbol for the function placed between its
two arguments, rather than in prefix notation, with the symbol preceding. For
example, the addition function add usually is written in infix notation with the
+ symbol between its two arguments as in a + b instead of in prefix notation
add (a, b).

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 9

A predicate or property is a function whose range is {TRUE , FALSE }. For


example, let even be a property that is TRUE if its input is an even number and
FALSE if its input is an odd number. Thus even(4) = TRUE and even(5) =
FALSE .
A property whose domain is a set of k-tuples A × · · · × A is called a relation,
a k-ary relation, or a k-ary relation on A. A common case is a 2-ary relation,
called a binary relation. When writing an expression involving a binary rela-
tion, we customarily use infix notation. For example, “less than” is a relation
usually written with the infix operation symbol <. “Equality”, written with the
= symbol, is another familiar relation. If R is a binary relation, the statement
aRb means that aRb = TRUE . Similarly, if R is a k-ary relation, the statement
R(a1 , . . . , ak ) means that R(a1 , . . . , ak ) = TRUE.

EXAMPLE 0.10
In a children’s game called Scissors–Paper–Stone, the two players simultaneously
select a member of the set {SCISSORS, PAPER , STONE } and indicate their selec-
tions with hand signals. If the two selections are the same, the game starts over.
If the selections differ, one player wins, according to the relation beats.

beats SCISSORS PAPER STONE


SCISSORS FALSE TRUE FALSE
PAPER FALSE FALSE TRUE
STONE TRUE FALSE FALSE

From this table we determine that SCISSORS beats PAPER is TRUE and that
PAPER beats SCISSORS is FALSE .

Sometimes describing predicates with sets instead of functions is more con-


venient. The predicate P : D−→ { TRUE, FALSE } may be written (D, S), where
S = {a ∈ D| P (a) = TRUE }, or simply S if the domain D is obvious from the
context. Hence the relation beats may be written

{(SCISSORS , PAPER ), (PAPER , STONE ), (STONE , SCISSORS )}.

A special type of binary relation, called an equivalence relation, captures the


notion of two objects being equal in some feature. A binary relation R is an
equivalence relation if R satisfies three conditions:

1. R is reflexive if for every x, xRx;


2. R is symmetric if for every x and y, xRy implies yRx; and
3. R is transitive if for every x, y, and z, xRy and yRz implies xRz.

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
10 CHAPTER 0 / INTRODUCTION

EXAMPLE 0.11
Define an equivalence relation on the natural numbers, written ≡7 . For i, j ∈ N ,
say that i ≡7 j, if i−j is a multiple of 7. This is an equivalence relation because it
satisfies the three conditions. First, it is reflexive, as i − i = 0, which is a multiple
of 7. Second, it is symmetric, as i − j is a multiple of 7 if j − i is a multiple of 7.
Third, it is transitive, as whenever i − j is a multiple of 7 and j − k is a multiple
of 7, then i − k = (i − j) + (j − k) is the sum of two multiples of 7 and hence a
multiple of 7, too.

GRAPHS
An undirected graph, or simply a graph, is a set of points with lines connecting
some of the points. The points are called nodes or vertices, and the lines are
called edges, as shown in the following figure.

FIGURE 0.12
Examples of graphs

The number of edges at a particular node is the degree of that node. In


Figure 0.12(a), all the nodes have degree 2. In Figure 0.12(b), all the nodes have
degree 3. No more than one edge is allowed between any two nodes. We may
allow an edge from a node to itself, called a self-loop, depending on the situation.

In a graph G that contains nodes i and j, the pair (i, j) represents the edge that
connects i and j. The order of i and j doesn’t matter in an undirected graph,
so the pairs (i, j) and (j, i) represent the same edge. Sometimes we describe
undirected edges with unordered pairs using set notation as in {i, j}. If V is the
set of nodes of G and E is the set of edges, we say G = (V, E). We can describe
a graph with a diagram or more formally by specifying V and E. For example, a
formal description of the graph in Figure 0.12(a) is

{1, 2, 3, 4, 5}, {(1, 2), (2, 3), (3, 4), (4, 5), (5, 1)} ,

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
0.2 MATHEMATICAL NOTIONS AND TERMINOLOGY 11

and a formal description of the graph in Figure 0.12(b) is



{1, 2, 3, 4}, {(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)} .
Graphs frequently are used to represent data. Nodes might be cities and edges
the connecting highways, or nodes might be people and edges the friendships
between them. Sometimes, for convenience, we label the nodes and/or edges of
a graph, which then is called a labeled graph. Figure 0.13 depicts a graph whose
nodes are cities and whose edges are labeled with the dollar cost of the cheapest
nonstop airfare for travel between those cities if flying nonstop between them is
possible.

FIGURE 0.13
Cheapest nonstop airfares between various cities

We say that graph G is a subgraph of graph H if the nodes of G are a subset


of the nodes of H, and the edges of G are the edges of H on the corresponding
nodes. The following figure shows a graph H and a subgraph G.

FIGURE 0.14
Graph G (shown darker) is a subgraph of H

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
12 CHAPTER 0 / INTRODUCTION

A path in a graph is a sequence of nodes connected by edges. A simple path


is a path that doesn’t repeat any nodes. A graph is connected if every two nodes
have a path between them. A path is a cycle if it starts and ends in the same node.
A simple cycle is one that contains at least three nodes and repeats only the first
and last nodes. A graph is a tree if it is connected and has no simple cycles, as
shown in Figure 0.15. A tree may contain a specially designated node called the
root. The nodes of degree 1 in a tree, other than the root, are called the leaves
of the tree.

FIGURE 0.15
(a) A path in a graph, (b) a cycle in a graph, and (c) a tree

A directed graph has arrows instead of lines, as shown in the following figure.
The number of arrows pointing from a particular node is the outdegree of that
node, and the number of arrows pointing to a particular node is the indegree.

FIGURE 0.16
A directed graph

Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from
the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to
remove additional content at any time if subsequent rights restrictions require it.
Another Random Document on
Scribd Without Any Related Topics
'Where are we now, Betsy?' I asked presently, after trying in vain to
piece together the disjointed fragments of events of which I had been
conscious since the interrupted wedding in the chapel at Crossley Hall.

'On the high road to Brighthelmstone. Travelling as fast as we can


towards our dear home!' cried Betsy delightedly. 'We have had enough of
the great world, you and I, mistress, to last us all our lives. When Sir Hubert
came hastily into Sion House that day you disappeared, declaring you had
been kidnapped, and demanded a litter, horses and men, aye, and me also to
ride inside and nurse you if you were ill—that he might go after you—Lady
Jane saw him herself, and promised everything he asked. Then she added
that she was herself expecting hourly to be sent for to the Tower. "It is not
likely," she said, "that my cousin, Queen Mary, will suffer me to be at large,
when my freedom might, any day, cause danger to herself; therefore if you
succeed, as I trust you will, in rescuing my dear Margery, I pray you take
her to her father's house, where she will be safer than either here at Sion
House, or with me in the Tower. For my own sake," she said, "I would fain
have her near me, but for hers I wish her down at Brighthelmstone with her
own people."'

'Did Lady Jane say that?'

'Yes, mistress; I remember every word, and Sir Hubert agreed that he
would take you to your home. He is therefore doing so.'

'Where is he?' I asked quickly.

'He is riding on before our litter, to see if the road is clear and safe.'

'I would fain speak with him.'

'Mistress, you cannot just now. He is out of sight and hearing. "Take care
of your mistress," he said to me, "and I will ride on in front." There are
other riders behind. We are well protected now. It was such a job to get hold
of you, mistress,' continued Betsy, 'that we don't mean to lose you again.
There was much fighting to do before we could get into the Hall, I can tell
you; but, first of all, we found the Duke of Northumberland's men were not
much good, and we had to travel ever so far to get some picked men, quite
gentlemen some of them, to come over and help.'

'Then Sir Hubert never was a prisoner at Crossley Hall?' asked I,


thinking of the man in the dungeon, and of all that I had gone through in
order to get him liberated.

Betsy laughed at the idea. 'Sir Hubert said he had had a narrow escape of
being taken prisoner when you were,' she said. 'There were six to one, but
he fought valiantly, and they could not take him, though he was unable to
rescue you.'

Lying there in the litter, listening to Betsy's talk and looking on her
familiar face, whilst the sweet country air fanned me pleasantly, bringing
with it, too—or I could fancy so—a breath of the salt sea air in which I had
grown up and lived most of my life, I could almost fancy that the Wheel of
Time had gone back a little, and I was once more in my father's litter with
Betsy, leaving home for the first time for Sion House and the service of
Lady Jane Grey. I had to pull myself together before I could realize that far
from being in my father's litter going to Isleworth, I was in one of the Duke
of Northumberland's litters, returning in it to my old home.

'You will like to see Master Jack and Master Hal again,' said Betsy
cheerily, and of course your father and Master Montgomery too, not to
mention Timothy and John and Joseph.'

'Yes, that I shall,' I said, but half absently, for though I was returning to
them, there was another love drawing my heart away from them back to the
more hazardous life in the great metropolis, wherein was my sweet
mistress, Lady Jane. 'For my own sake, I would rather have her with me,'
those had been her words about me, and it needed not long thinking about
them on my part to make of them my law. Lady Jane would rather have me
with her, therefore I must go to Lady Jane. I said so to Betsy, much to her
amazement and consternation.

'But, mistress, dear mistress, consider,' she cried. 'Before this she has
probably been taken to the Tower, where she will be a prisoner. It will be
very different from what it was before,' she continued. 'She will be in
another part of the Tower, away from the Royal Palace that she was in
before, and they will never allow you to go to her, or, once you go,' she
went on inconsequently, 'you will never be permitted to return. Your life
won't be safe for a minute, when once you are amongst the State prisoners.
They will burn you alive and behead you,' she continued wildly, tears
rolling down her face at the idea, 'and then where will you be, my sweet,
precious Mistress Margery?' and she caught hold of my hands as if she
would keep me away from the Tower by main force.

And then my litter suddenly stopped, and Sir Hubert rode alongside, and,
stooping over his horse's head, looked earnestly into my face.

'My dearest,' he said to me, lifting his hat with one hand and reining in
his horse with the other, 'what is the matter?'

I told him that he was taking me in the wrong direction, for that I
desired, above all things, to return to Lady Jane.

'Well, that is what I desire too,' he said instantly, 'or at least I wish to be
in the neighbourhood of her father, that we may together discuss and plan
measures——' He stopped short, looking suspiciously around. 'You
understand?' he said.

Yes, I understood. He was still not without hope that Mary might be
dethroned, and Lady Jane reinstated as Queen. What it is to be young! All
things seem possible to the very young, especially when they are greatly
desired.

'But Lady Jane Grey wished me to take you to your home, Margery,' he
said, 'and indeed I know you would be safer there.'

'Yes,' said I, 'but that does not matter.'

'Would you not like to be back with Jack and Hal and your father?' he
asked.

For a moment—I was so young and they were so very dear—I wavered.
Then I made answer stoutly, 'I want, above all things, to return to my dear
lady. If you love me, dearest, you will take me to her.'

'And if she chides me for disobedience?'

'I will bear the blame,' I said; 'I will bear all the blame.'

We had a little more talk about it, and then, the language of our hearts
being one and the same, straightway turned about and retraced our steps,
making a detour, that we might avoid the dangerous neighbourhood of
Crossley Hall.

A couple of hours later, Sir Hubert, who had been riding on before,
returned to us, saying anxiously, 'Margery, we are pursued. Quite a large
company of horsemen have appeared in sight from the direction of Crossley
Hall, and they are gaining upon us.'

'Oh,' cried I, 'what shall we do? It would be worse than death to fall
again into the hands of Sir Claudius!'

'You never shall,' said Sir Hubert, 'whilst I live and a strong arm can
prevent it.'

At that moment a solitary horseman, riding towards us from the opposite


direction, stopped short, and, looking hard at us, exclaimed—

'Why, is it thou again? And still pursued by the rabble? Thou wilt be
killed yet!'

'Master Jack Fish!' exclaimed I. 'You remember him, Hubert, and what a
good friend he was to us when we were in that shed?'

'Oh, yes, I remember him perfectly,' and my dear one greeted him in a
very friendly way, rapidly explaining the situation.

'Thou art in great danger,' said Jack Fish gravely. 'Thine enemy will stick
at nothing to be revenged on thee. I caught a good glimpse of his horsemen
when I was on that hill, and there are four times as many of them as there
are of thee.'
'What shall we do?' I exclaimed.

Jack Fish looked at me pityingly. 'Madam,' he said, 'thou in that litter art
in the position of the greatest danger. Thy litter is a target towards which all
will aim. Sir Knight, is it absolutely impossible to separate the lady from
her litter?'

'Well, no,' replied Sir Hubert. 'Margery'—he turned to me—'can you ride
well? Could you accompany us on horseback?'

'Yes. That I could!' I exclaimed. 'I have been used to riding from my
babyhood. A man's saddle? Oh, yes, of course I can ride on that. I can ride
without a saddle, if you like,' and I thought of the many gallops across the
downs I had had in the old days with Hal and Jack.

'Hurrah! Bravo!' cried my lover triumphantly. 'Now we shall circumvent


the enemy!' He was about to choose me a horse, when the sight of Betsy
reminded him of her, and he asked, 'Your maid? Can she ride?'

'That I can, sir,' Betsy answered for herself. 'Am I not a farmer's
daughter?'

'You will do well,' exclaimed Master Jack Fish, and with that, setting
spurs to his horse, he galloped off, not caring for our pursuers to see him
with us.

'He is a shrewd man and a good friend,' observed Sir Hubert. Then he
quickly arranged that Betsy and I should ride two of his men's horses,
whilst their owners rode behind two of the other men.

That done, the party broke up. Sir Hubert, accompanied by me and my
woman, and followed by half his company, continuing straight forward on
the road to London, whilst the other half of the men took the litter in the
direction of Guildford.

In this way we fortunately escaped from our would-be captors, who, we


afterwards heard, had a sharp encounter with the company escorting the
litter, in which they were only beaten off with tremendous difficulty and the
loss of the litter, which fell into their hands.

CHAPTER XX

A Trying Experience

By the time we reached the vicinity of the outlying suburbs of London


City another danger menaced. It was impossible for so large a company of
horsemen to approach the metropolis unchallenged, and we were brought to
a standstill at Ditton by the cry from two police officials—

'Halt, sirs! Halt! Are you for Queen Mary?'


A VOICE OF THUNDER DEMANDED, "ARE YOU FOR QUEEN
MARY?"
Now, we were none of us for Queen Mary, and we were all honest folk
and true, who hated and abhorred a lie; there was nothing for it therefore
but that we should hold our peace and try to rush from the position by
galloping past our questioners, who, when they found that they were
baulked, fired their pistols after us, but fortunately without doing any of our
party a mischief.

'We shall have to separate,' said Sir Hubert when, at last, we deemed it
safe to slacken our pace and pull up our steeds for a brief confabulation.
'Every moment that we are together now increases our danger, for news of
us will fly round in every direction, and any moment we may be
apprehended and taken before the magistrates—that is, if they can get hold
of us. Once in Court,' he added, gravely, 'our fate is certain—I, for one, will
never declare fealty to the Papist Mary.'

'Nor I,' said I, in whispered words, but he heard them, and, turning to me,
said earnestly, 'You are a woman, and I pray you do not get mixed up with
political matters, which might endanger your dear head.'

I could not make any rejoinder, for Sir Hubert's friends now began to
discuss several matters, in which they wanted his guidance before parting
from him. A born leader of men was my Hubert, and there was no hesitancy
in his firm voice as he gave out peremptory advice and commands.

I fancy that I see him now, sitting erect on his fine horse, with
enthusiasm and earnest hope lighting up his countenance, as, after listening
to all, he quietly settled every knotty point in as few words as possible.
Betsy's objections to being parted from me took him a little longer to
overrule than everything else, but he would allow no one except himself to
remain with me. It was only for a few hours, he said, and the smaller my
party the safer would be my position. And he picked out a worthy man to
escort Betsy into London, and take her to London Bridge, where we were to
join her. However, Betsy would not consent to the plan until I also bade her
authoritatively to say no more, but obey in every particular. Then she left
me, weeping and declaring that she should see my face no more, for we
should both perish by the dangers of the way.
'And when you arrive in London,' she went on, in her inconsequent way,
'people will recognize that you have been with Lady Jane Grey, when she
was queen, and then you will be burnt and beheaded as well for high
treason, or whatever they call it, and I shall have all the misery of returning
to Sussex alone, to acquaint your father with the fearful tidings!'

When our company was broken up into twos and threes, Sir Hubert and I
rode on at a brisk pace, and did not draw rein until we reached the River
Thames at Kingston, a very pretty little town.

The glory of the brilliant summer day was waning then; the sunset was
obscured and clouded over by dark clouds; only its reflection lingered a
little over the silvery waters of the Thames.

'We cannot reach London to-day,' said I, looking inquiringly at my


companion.

I had been so happy riding along by his side that I had not realized that
even the longest day comes to an end at last and night will follow. But he—
he should have thought of that.

'No. Of course not. I have ascertained that Sir William Wood and Lady
Caroline are staying with some friends at a house at Kingston. It is
somewhere near the river. I thought that you would like to stay the night
with Lady Caroline.'

'Oh, yes, I should,' I replied, cheerfully, for it was very pleasant to think
of being with a gentlewoman again, after all the rough experiences I had
been through.

'If only I could find the place!' exclaimed Sir Hubert. 'We shall attract
observation if we go about on horseback seeking it. News will arrive here,
if it has not already arrived, of what happened at Ditton, and we shall be
arrested on suspicion.'

'What shall we do then?'


'Leave our horses at an inn, and take a walk along the riverside until we
find the house where our friends are. I know it is a house by the river
because I have been there.'

I made no objection to this, and we went to an inn, where they were


pleased to take our horses, as also to serve us with light refreshment, of ale
and bread and cheese for Sir Hubert and milk and cake for me, after
hurriedly partaking of which we went out and walked down the street.

As we did so I noticed a little group of men standing near the river were
regarding my companion with great curiosity, but concluded that this was
due to the fine manly presence and dignified mien of Sir Hubert.

It was a little startling, however, to find that, while we were searching


for the house we wanted, we occasionally encountered one or another of
these individuals, apparently watching us with interest.

'Those men get upon my nerves,' I said at last. 'We meet them
everywhere.'

Sir Hubert laughed.

'I have been thinking that the men of Kingston have a strange similarity
of appearance,' he said. 'Can they possibly be the same men?'

I answered, 'Yes, I am sure of it. And I do not like to see them so


frequently.'

'But who is this?' exclaimed Sir Hubert with delight.

It was Sir William Wood, who, coming suddenly round a corner, almost
ran into my dear knight's arms.

'The very man I want!' cried he. 'You have been long in coming, Hubert,
my friend!'

'And now that I am here, before we discuss anything, there is this lady,
Mistress Margery Brown, to bring to a place of safety for the night. I hope
Lady Caroline is at Kingston.'
'She is,' replied Lady Caroline's husband, shaking hands cordially with
me, 'but I must tell you that we are hiding here. Our hostess, Lady Mary
Peterson, dared not have us staying with her openly. Even now I have only
ventured to leave the house by a subterranean passage from the cellars to
yonder clump of willows by the river, and if you wish to remain over the
night with us you will have to accompany me that way. But who are those
men?' He asked the question with anxiety, pointing as he did so to two of
the men who were following us about.

They stood near a thick hedge, which partly screened them from
observation.

'Oh, those! I have an account to settle with them,' cried Sir Hubert
angrily, at once giving chase to the rascals.

There was a spice of boyishness always about Sir William, and now, like
a boy, he forgot all about me and ran off to aid Sir Hubert in the pursuit.

I was left alone, and neither Sir Hubert nor Sir William heard my pitiful
little cry—

'Oh, do not leave me!'

By the light of the moon, which had now risen, I saw my escort
disappear, with feelings of great misgiving, and sat down disconsolately
upon a big boulder by the river side.

It was very lonely there. The water flowed placidly by, with scarcely a
murmur. A corncrake in a field behind made mournful music, with
monotonous persistence. A dog howled somewhere on the other side of the
river. From the town behind us proceeded subdued sounds of horses' hoofs,
men's voices, the clashing of steel and, presently, the ringing of the curfew
bell.

What a long time my knights were in catching, or frightening, or


punishing the spies, if the men were spies, and it seemed evident that they
were. Supposing that they had run in the direction of their fellows, and the
two knights following them were caught in a trap, overpowered by numbers
and taken to prison for rebelling against Queen Mary, what could I do all by
myself?

I was horribly frightened, and clasped my hands and strained my eyes in


my endeavour to see one or other of my knights returning for me. But in
vain. No one was visible. Should I go forward and look for them? No;
better to remain where they had left me, lest I missed them altogether.

I sat still, leaning my head upon my hand, and tried to wait as patiently
as I could. Would that dog never cease howling? What was that approaching
on the river? A boat? It must be, for now the soft beating of oars upon the
water was plainly to be heard.

Oh, why did not Sir Hubert, or at least Sir William, return? There were
men in the boat—four men, two were rowing. Why, at a gesture from the
one sitting in the stern of the boat, did the oarsmen stop rowing? Now they
were approaching the bank where I sat. They must have seen me, and
indeed my figure, silhouetted against the sky, must have been conspicuous.

They were getting out now—at least two of the men were—and coming
towards me.

But what was this? Oh joy! The men whom I now saw more clearly were
none other than my two good knights, returning to me in all haste.

Sir Hubert seized my trembling hands.

'You have been left too long, my love!' he said. 'But indeed we could not
help it. What do you think? The men we ran after were no foes, after all. Far
from it, they were friends. When we had knocked them down, and they
found out who we were, mostly from Sir William, whom they had seen
before, they informed us that they belonged to a small party of men that the
Duke of Suffolk had sent out here to look for me. They had come down to
Kingston by boat, and were hoping to meet with me and take me to London
City by water.'

'Then that was why they stared so hard at us, and followed us about?' I
said inquiringly.
'Exactly. They were not sure that it was I, until Sir William and I had
knocked a little sense into them!'

'Shall you go with them?' I asked. 'And I, what shall I do?'

'Well, you mast come too. You want to be with Lady Jane. I think that I
had better take you to her father, whom the queen has pardoned and set free.
He will know best how to get you into the Tower, and to his daughter.'

'But it is night,' I said.

Sir Hubert was eager to go that very moment to the Duke, but, looking
down upon me, he suddenly perceived my weariness and weakness.

'Poor Margery!' he said, with infinite tenderness, 'you are worn out!
What shall we do with her, Sir William?'

'Leave her with me,' said Sir William at once. 'I will take her straight to
Lady Caroline, and we will all three follow you to London to-morrow,
probably by water, as that will attract the least observation.'

After a hurried discussion we agreed to this, and Sir Hubert, who I saw
must have received some political information which greatly excited him,
took a hasty, though affectionate, leave of me there, by the Thames, within
sight of Kingston Bridge, which was so soon to be the scene of a very
daring exploit. And we parted, little knowing what was to happen before we
met again, he going to the boat to be rowed down to London City, I going
with Sir William through the subterranean passage to the great house, where
Lady Caroline received me as a sister, and assisted me to bed with her own
hands.

I was so tired that I fell asleep the moment my head touched the pillow.
But my dreams were troubled. For in them, over and over again, I saw Sir
Hubert in a boat, pulling against the stream, and unable to get on, whilst I,
standing on the river bank, besought him to make haste to Lady Jane, who
in the Tower was in sore need of succour. And still he tried to go to her, but
in vain; the boat heaved and tossed, but did not advance at all, in spite of
every effort. And I wept in my sleep, because he could not go to Lady Jane.
CHAPTER XXI

Queen Mary's Boon

'Oh, help me!' I implored. 'Help me to get into the Tower!'

The Court physician to whom I appealed shook his head gravely.

'It is a difficult matter for an outsider to get in there,' he said, 'and, if I


mistake not, you are one who would be liable to be suspected, by reason of
your having been there before with the unfortunate Lady Jane Grey.'

'Then you remember me? I thought you would. I am Margaret Brown,' I


faltered.

'Mistress Margaret Brown,' said he, very gently, 'I will give you one
word of advice, and that is, go home to your friends.'

'Alas!' I said, wringing my hands, 'I have no friend—save one—so dear


as she who is imprisoned in the Tower. Help me to get to her, Dr.
Massingbird, I implore you. She said that it would be a comfort to her to
have me there, and she is in sore need of comfort!'

'Poor lady! Poor young lady! So sinned against, and yet so innocent; and
made a tool of by that wicked man who has met with his just fate. I mean
Northumberland.'

'Yes,' said I. 'It was he and his ambition that ruined my dear lady.'

We were standing talking together in Thames Street, not far from the
Bulwark Gate of the great Tower of London. For a week I had been making
many endeavours to get into the Tower, but, owing to the great precautions
which were being taken against treachery—especially during Queen Mary's
residence there—every attempt of mine to effect an entrance was in vain. I
had found Betsy all right on London Bridge, where she stayed twelve hours
waiting for me, in spite of every effort made to dislodge her from her
position, and she and I were lodging, with the Woods, in apartments in the
Strand.

Sir William Wood and Lady Caroline had no power to assist me to get
into the Tower; they were obliged to keep as quiet as possible, only going
out at night, owing to Sir William's partisanship of Lady Jane, whilst, for
the same reason, Sir Hubert Blair, too, was compelled to remain hidden
until certain plans were matured. He could not help me, and indeed I had
not seen him since we parted on Kingston Bridge. As for the Duke of
Suffolk, he was quite unable to assist me to go to his daughter, for, having
been liberated after two or three days' imprisonment, owing to the
intercession of his wife who prostrated herself before Mary, pleading that
he was delicate and that his health would suffer if he were not set free, upon
which Her Majesty graciously forgave him, he was most ungratefully
busying himself with secret schemes for ousting her from the throne and
reinstating Queen Jane. Always careless of the latter's feelings, whether she
had her favourite gentlewoman with her in her imprisonment, or not, was a
matter of indifference to him. Others who had made my acquaintance
during the queen's short reign cut me dead, or treated me with scanty
civility upon my reappearing on the scene. There was not one of those fine
Court ladies who had formerly professed to admire and love Queen Jane
who would lift a hand to help her now that she was in affliction and
imprisonment. I was thinking sadly about this, as I returned from my last
fruitless effort to gain ingress into the Tower, when I met one of the
physicians who had attended Queen Jane during her illness in the royal
palace. He was a truly benevolent man, and although he was evidently
going somewhere in a hurry, he got out of his coach when I called to him, to
inquire what I wanted.

'I am very hurried just now,' he said, temporizing, 'The fact is Queen
Mary cannot sleep; evil, unpleasant thoughts trouble her, from the moment
in which she lies down in bed until it is well nigh time to rise again, and
potions and drugs do not cure the malady. But I bethought me of King Saul,
to whom David played when he was distracted in that manner, until the evil
spirits no longer troubled him, so I told Her Majesty that I would slip out of
the Tower and go and fetch a young female singer, who would sing to her so
beautifully that she would fall into a natural sleep. I heard a girl singing
very sweetly in a friend's house in the Strand once, but whether I shall be
able to find her or not I know not. It is growing late. The curfew bell has
rung; the streets will not be very safe to be out in soon, and yet I must try to
find the girl, if Queen Mary is to sleep.'

A bold thought came to me as he was speaking. The good physician was


in search of a girl who could sing well, who in fact could sing Queen Mary
to sleep, and I, who could sing well, wanted above all things to get into the
Tower; it therefore seemed conclusive that I must be the girl to sing for the
queen. But Queen Mary? I would rather that it had been Queen Jane.

'Doctor,' I said entreatingly, 'I am your girl. Your sweet singer, you
know,' I hurriedly explained, seeing that he did not understand. 'I can sing
very sweetly, though I say it myself. Take me to Queen Mary.'

'You!' The good man looked amazed. 'I am afraid it would not do,' he
said. 'Supposing now that Her Majesty found out that you had been in the
Tower with Queen Jane?'

'I don't think that that would make so much difference,' I said. 'A singer
may sing to any one.'

After a little more demur, to my intense satisfaction, Dr. Massingbird


consented to take me, only stipulating that I should conceal my real name
and position from the queen, and appear before her as a professional singer
only. He also made me promise that I would do Queen Mary no harm in any
way when admitted into her presence—for these were days in which
treachery was common.

Under his care, escorted by him, in scarcely an hour from the time in
which we met in Thames Street, I was entering the royal apartments of the
ancient palace[1] in the mighty Tower of London.
[1] This palace of the old kings of England has long since disappeared. It
was at the south-east of the Tower.—ED.

I must confess candidly that, whilst outwardly appearing dignified and


calm, I was inwardly in a state of great trepidation and timidity. Always
overawed by the vastness and gloom of the mighty fortress, even when
there with Queen Jane, while she was in power and every effort was made
to display its riches and magnificence, it can easily be understood, that I
was many times more so now when, late at night under an assumed
character, yet at heart an adherent of the imprisoned ex-queen, I ventured
alone, except for the presence of the physician, himself a servant, into the
palace of the reigning monarch. Curious glances were cast at me by guards
and sentinels, squires and dames, lords and ladies, as we ascended the great
oaken staircase and passed through a long gallery into a spacious hall, with
narrow Gothic windows of stained glass, hung with tarnished cloth of gold
curtains. Here the furniture was large and splendid, the windows were in
deep recesses, whilst there was a gallery round the upper part of the room.

'Wait a little here, until I return,' said my guide, signing to me to sit down
on an old oak chair.

The physician went away, leaving me, as I at first thought, alone, but, in
a little while, my eyes became accustomed to the dim light, and I saw that
in some of the embrasures by the windows, men and women sat, or stood
engaged in earnest conversation. A few of them appeared to be foreigners;
from their dress I imagined they were Spaniards, and two or three of these
were monks, the sight of whom there recalled to my mind Sir Hubert Blair's
prediction in Woodleigh Castleyard, that if Mary reigned, the country would
be plunged into Roman Catholicism and brought into alliance with Spain,
upon which a door would be thrown open for the Inquisition, with all its
horrors.

At that moment I heard a girl, standing in a recess near, saying to a tall


man, who from his dress and bearing seemed to be of noble birth—
'The queen means well. She is cautious about beginning, but in time she
will do all that she is bidden by the Holy Church. At present she is racked
with indecision and gloomy forebodings——'

'But she has the iron will of her father, King Hal—you see him there in
that portrait, painted by Holbein, over the chimneypiece. What a man that
was!' exclaimed the other.

The girl shrugged her shoulders.

'Mary has a very different creed from his, fortunately,' she said, 'and she
hankers after Spain—all may yet be well for our Church!'

I heard no more, for at that moment Dr. Massingbird, returning,


accompanied by a lady of the bedchamber, desired me to go with her to
Queen Mary, who had already retired for the night.

'I have done all I could for you,' added the physician, aside, in a low
tone. 'I have brought you here. But you will have to get out again as you
best can, for I cannot dance attendance upon you any longer.'

I tried to thank him, and to say that I should be all right, but, not
listening to me, he said—

'I have announced you as a poor singer named Meg Brown! having
clipped off a bit of your name. God grant you may come to no harm, my
child!'

Then he hurried away.

I followed the lady to Queen Mary's bedchamber, walking silently after


her into the splendidly furnished bedroom, where I had been before with
Queen Jane. How it reminded me of her! But this was a very different
woman lying upon the great bed, with its silk and gold counterpane.

Mary was about forty years old—a little woman, slender and delicate in
appearance. She did not in the least resemble her father, King Henry VIII.
Her features were not bad, and her eyes were bright—so bright indeed that
they frightened me when, all at once, I discovered them fixed upon my face.

'Who are you?' demanded the queen, in a voice which was thick and loud
like a man's.

I was still more alarmed, and felt at that moment as if those bright,
piercing eyes were looking into the very depths of my heart.

I knelt for one moment, but quickly rose from the ground, with a prayer
in my heart that I might be forgiven bowing in the house of Rimmon and
before the wrong queen.

'I am Meg Brown, madam. At your service,' I said, adding, as she


remained quiet, 'a poor young singing-girl.'

'You don't seem to have much boldness in speech, Meg. How, then, can
you have the courage to sing?'

I clasped my hands tightly together, with an inward prayer for help, and,
in a moment, from the extremity of fear passed to a state of blessed
confidence.

'Only hear me,' I said. 'I can sing, madam.'

'Can you?' The piercing eyes sought to read my innermost soul.

'Yes, madam. Once, when I was a child, Master Montgomery, our curate,
took me to see a poor woman who had lost her baby and was almost dead
with grief. She could not weep, nor sleep, nor eat; the trouble was killing
her. But I sang to her, and she cried like a child, and prayed to God and
recovered. And another time,' I spoke more clearly now, 'when some
serving-men and women had a great quarrel, and were fighting in a truly
terrible manner, I stood up and sang, and sang until they fell upon their
knees and burst out into tears and prayers. After that, Master Montgomery
always fetched me to sing to people when he could do nothing with them.'
'Wonderful!' said Queen Mary, in a rather satirical manner. 'But those
were only poor folk; it remains to be seen whether you can sing to a queen.'

'God,' said I, half to myself and half to her, 'Who helped me to sing to
His poor, can help me to sing to'—I was going to say His queen, but
substituted 'a queen.'

'And is not the poor queen His, too?' asked the woman, who was reading
my heart.

'He knows,' I said, trembling a little, lest she should take umbrage at my
daring. 'He knows them that are His.'

Mary did not say anything to this. She turned her head away from me
with a peevish movement.

I was afraid to speak, and therefore waited in silence until she spoke
again.

'Sing to me,' she said.

'What shall I sing?'

'I am greatly troubled,' she replied at length. 'Sing what you sang to that
poor mother who had lost her child.'

It was one of Martin Luther's cradle songs, translated for me, when a
child, by Master Montgomery, who fitted it to a tender little tune of his own
composing. I loved it well, but it seemed a strange song to sing to the
mightiest woman in the land, the Queen of England. Perhaps, however, as
she said she was greatly troubled, she might be in need of comforting. I
thought of that, and standing there, with my hands tightly clasped before
me, sang as I had never sung before—

Sleep well, my dear, sleep safe and free;


The holy angels are with thee,
Who always see thy Father's face,
And never slumber nights nor days.
There was a quick movement on the bed, and Mary opened wide eyes of
amazement, but she did not interrupt, and I went on singing, until, gaining
confidence, my voice rang out clearly and triumphantly in the last verse—

Sleep now, my dear, and take thy rest;


And if with riper years thou'rt blest
Increase in wisdom, day and night,
Till thou attain'st th' eternal light!

For a little time there was silence in the room, when I ended, and then,
with a heaving sigh, the deep voice came from the bed—

'I'm only a frail woman, though I am queen, and I need wisdom. But go
on singing, child. Go on singing.'

I began a favourite hymn of Master Montgomery's, and it brought to my


mind so many memories that sobs trembled in my voice, as I sang—

When my dying hour must be,


Be not absent then from me;
In that dreadful hour I pray,
Jesus, come without delay,
See and set me free!
When thou biddest me depart
Whom I cleave to with my heart,
Lover of my soul, be near,
With Thy saving Cross appear,
Show Thyself to me.

Mary lay so still when I ended that I thought she was asleep; but no, she
was awake, and as I looked closely at her, I perceived that tears were slowly
stealing down her face.
I fell on my knees by the bedside, but I was not kneeling to her, as she
seemed to think, when opening her eyes and looking at me, she said, in a
softer tone than before—

'Child, do you want something?'

Did I want something? Yes, I wanted something so much, that now when
the time had come for asking for it, I could not say a word,

'Your singing is marvellously sweet,' continued Queen Mary. 'Yet it has


not sent me to sleep. I should like to hear you every night. Will you stay
here in the palace and sing to me every night? You shall have a fair wage.'

'I do not want a wage,' I answered, thanking her. 'But I crave a boon at
your hands, madam.'

'And that is——'

'That I may be allowed to go to Lady Jane Grey——'

'Lady Jane! My cousin? Methinks that you are a bold girl to ask that,'
exclaimed the queen, starting up in bed and speaking very angrily.

I rose slowly, and, with clasped hands, stood before her, pleading my
love for her sweet cousin and beseeching that I might be allowed to attend
Lady Jane in her prison. I described her youth, her innocence, and the great
unwillingness with which she had permitted herself to be dragged into the
dangerous position of queen, and also mentioned the quickness and
satisfaction with which she abandoned the undesired sovereignty.

'You plead well, Meg,' said the Queen, when I stopped, partly because
my breath failed, 'and you have a wonderful voice for singing, aye, and for
speaking. If I let you go to Lady Jane, and allow you to attend her in her
prison, will you come and sing to me when I require you?'

'I will. I will,' I exclaimed delightedly. 'I will sing you to sleep whenever
you like, madam.'
'Nay, not to sleep, Meg, not to sleep,' said Queen Mary. 'As a promoter
of sleep you are a failure, for your singing awakens me out of the sleep of
years, making me feel as if I should never want to sleep again.'

She then rang a hand-bell, and on the entrance of a gentlewoman,


commanded that I should be taken to the Brick Tower, to attend upon the
Lady Jane Grey.

CHAPTER XXII

With Lady Jane

I did not find Lady Jane in bed, in the gloomy quarters where she was
confined. Separated from her husband, who was imprisoned in the
Beauchamp Tower, and left entirely alone, she was passing the time in
prayer, meditation, and studying the philosophic and holy writings, from
which she imbibed deep draughts of resignation and wisdom.

Like a child exhausted with play after having acted a difficult part, and
like one worn with the strain that has been put upon her in the battle of life,
she was simply waiting at the foot of the Cross, and I found her on her
knees, weeping gently as she prayed.

The warder, who conducted me to her apartment, retired, bolting the


door after him, and I stood by it a little while, unwilling to interrupt my dear
lady and noticing with dismay the iron-barred windows of the room and the
stone walls, partly concealed by tapestry. I saw also that the furniture—a
table and some chairs—was of carved oak. and the deep window-seats were
covered with velvet, as was also the seat of the oak chair before which the
poor young prisoner knelt.
Perhaps she heard some one enter—certainly the warder made noise
enough as he closed the door—and therefore, ending her prayer, she arose
and looked round.

The next moment I was folded in her arms, and we were crying together.

'Oh, Margery! My poor Margery!' she said, at last, when we were a little
calmer. 'Where have you been? Why, dear,' looking at me more closely,
'what have they done to you? You look so pale and thin! How did you get
into the Tower?'

'It took me a week to get in,' I said, beginning to answer her last question
first, and then, as we sat together on one of the window seats, I proceeded
to tell her all that had befallen me since I was carried off from Isleworth.

Lady Jane was very sympathizing when she heard of all my danger,
distress and trouble in Crossley Hall, and was delighted that my valiant
knight, Sir Hubert Blair, had rescued me, with a strong hand. But when I
proceeded to tell her that he was now in London bent upon fighting for her
and deep in schemes with her father, to bring about a change of monarchy,
she was greatly concerned and not a little distressed.

'Why did not you stop them, Margery?' she said. 'You know so well that I
do not think it right to be queen, when my cousins Mary and Elizabeth are
living. You are well aware how I disliked to be queen, and how gladly I
gave it up.'

'Yes, madam, I told Sir Hubert Blair all,' replied I, 'but he said that they
looked at the matter in this light. There were the people of England to
consider, the multitude of human beings who, in the one case, would be
plunged back into Roman Catholicism, in the other would enjoy the
Reformed faith, and freedom to worship God in their own tongue and read
His Divine Word for themselves. He said, madam, that you must not think
of your own wishes, but must sacrifice yourself for the good of the people.'

I thought I had stated Sir Hubert's argument clearly and well, yet Lady
Jane shook her head.
'We must not do evil that good may come,' she said. 'And have I any
right to take another person's possession because it seems to me that I can
administer it better than the rightful owner?'

'But think of the suffering that may come upon our good Protestants if
Mary reigns?' I urged. 'They say that she will do everything that her Roman
Church enjoins, and the horrors—the horrors of the Inquisition—may be
brought to this land of ours,' and I poured out all that Sir Hubert had related
of that horrible institution.

'God grant that it may never come to England!' said my mistress, when I
ended. After which she added, thoughtfully, 'I think that Queen Mary is not
so bigoted as some people imagine, and she has behaved very leniently in
several ways since her elevation to the throne. She forgave my father and
set him free, and, although the Emperor Charles, to whom she looks up so
much, has advised her to have me executed, she has refused——'

'I should think so!' I interrupted. 'Oh, dear madam, what a wicked wretch
that emperor must be!'

'People always look at things from their own point of view, or the point
of view of those dearest to them,' said my mistress. 'The Emperor Charles,
considering the welfare of Mary, sees that while I live there will be always a
danger of some enthusiasts, like your Sir Hubert, starting up to try and put
me on the throne again—and in that case, besides the danger to the reigning
monarch, there would be many slain, much blood would be shed, and you
must remember Sir Hubert's argument about the duty of considering the
welfare of the many. If my death will put away this danger to so many, then
I had better die, dear Margery.'

'No! No! No!' I cried. 'It would be the foulest shame in the world for one
so innocent and good as you to be killed—and remember your argument,
they must not do evil that good may come.'

Lady Jane smiled.

'Well done, little Margery!' she said, adding, 'Now tell me how you
managed to get into the Tower.'
I told her, upon which she remarked—

'You see Mary has a good heart—you touched it with your singing, and
she allowed you to come to me,' adding, to my delight, 'To have you with
me is the one thing I wanted, next to my natural wish to be with my
husband. They have separated us, you know, Margery. He is imprisoned in
another tower.'

'It is hard,' I said.

'And I have great anxiety about him,' went on my dear lady. 'Doubtless
the priests are endeavouring to convert him to Romanism, and since they
succeeded with his father——'

'Madame, did the Duke of Northumberland give up his faith?'

'Yes,' she answered sadly. 'He was not brave, not heroic; he gave way on
all sides when death was imminent. But they have killed him. He is dead,
and we must say nothing, except good, of the dead.'

She quoted a Latin proverb to that effect,[1] but it was strange to my


ears, and I have so far forgotten it as not to be able to write it down.

[1] De mortuis nil nisi bonum.—ED.

I could not help thinking that Northumberland's ambition was in reality


his religion, but could not say so after those words of Lady Jane's.

'He was beheaded on Tower Hill,' she continued, 'and oh! God grant that
the same fate may not befall my dear lord!'

The days passed slowly and quietly for me and my dear lady in her
prison in the Tower. Queen Mary did not send for me to come and sing to
her any more. She went to stay for a while at Richmond Palace, and, then
again, we heard that she was at Whitehall, and sometimes she was in her
palace in the Tower, but that made no difference to us. Certain privileges
were accorded by her to Lady Jane, and of course I shared them. For
instance, we were allowed to walk across the green to St. Peter's Church
occasionally, where Lady Jane much enjoyed the fine music, and liked to
join in the services. On these occasions she would look up at the
Beauchamp Tower, as we passed it, wondering how her husband was and
what he was doing. My heart ached for her many a time, when I saw her
wistful face upturned to the windows of the Tower, as she vainly tried to see
the face she loved. At least Mary might have permitted them to meet
occasionally, if she could not permit them to enjoy each other's constant
society. But a day was coming, though I knew it not then, when they would
be allowed to be together, at least for a short time. Lady Jane was also
permitted to walk in the queen's garden—this was a pleasure to her, who so
dearly loved fresh air and flowers. Sometimes she would talk about the
gardens at Sion House, and the Thames flowing by them, and wonder if we
should ever go there again. At other times she would tell me about
Bradgate, where she had been brought up and where her tutor, Mr. Roger
Ascham, used to marvel because she preferred to sit reading Plato to joining
her young companions in the sport of hunting. It was well that she preferred
books, as they were now her solace when it would not have been possible
for her to have had the other pastime.

In the beginning of October Lady Jane was allowed to meet her husband
once more, but the occasion was most melancholy, for they were both being
conducted to the Guildhall, together with Archbishop Cranmer and Lord
Ambrose Dudley, Lord Guildford Dudley's brother, to be tried on the charge
of high treason. Lady Jane pleaded guilty, and they were all convicted of
high treason and condemned to death as traitors. Lady Jane's sentence was
that she was to be beheaded or burnt to death, at the queen's pleasure, and
Judge Morgan, who pronounced it, was afterwards so deeply afflicted in his
mind at the remembrance that he died, raving.

Many people were exceedingly grieved for the poor young creature, who
had been made a tool of by her ambitious relatives, sorely against her will,
and the touching grace and meekness of her demeanour, as well as her
misfortunes, caused them to follow her weeping and lamenting her hard
fate, as she was being reconducted to the Tower.
The queen, however, appears to have had no intention at that time of
carrying out Lady Jane's sentence, nor indeed that of the others who were
condemned with her, but thought it better to please her partisans by keeping
them in prison under sentence of death. To Lady Jane, indeed, Mary granted
more indulgences, such as permitting her to walk on Tower Hill, where I
always accompanied her.

The autumn passed slowly into winter. I often thought of my beloved,


wondering what he was doing and dreading inexpressibly to hear of his one
day being brought into the Tower, through the Traitors' Gate. I wrote to him
two or three letters, sending them off as I found opportunity, in which I told
him guardedly, lest they should fall into the wrong hands, that Lady Jane,
above all things, desired that no effort should be made to replace her in
what she felt had been a false position. But I received no sign that my dear
knight ever got my poor little epistles, and indeed it would not have been
strange if they had never reached his hands.

At length, however, I heard of him. One day there was a great


commotion in the Tower, armed men springing up everywhere, guns
bristling on all sides, the defences of the whole fortress being looked to, and
military commands being called out in all directions.

'What is it, warder? What is happening?' Lady Jane inquired, in her


gentle way.

Then the warder informed us that they were expecting that the Tower
would be assailed by a large force, which was coming to attack it, under a
leader who had begun to carry all before him.

'Who is he?' asked Lady Jane.

'Madam, he is a knight, who owns property and a castle in Kent, where


he began the rebellion. His name,' added the man, 'is Sir Thomas Wyatt, and
he is accompanied by several gentlemen, and amongst them Sir Hubert
Blair, who is notoriously active against the Government.'

'Margery,' said my dear lady, when the warder had retired, 'if we could
have prevented this! If we only could have prevented it!'
'I wrote to Sir Hubert Blair again and again after I knew your wishes,'
said I, 'but I think he cannot have received my missives, or perchance his
friend, Sir Thomas Wyatt, heeds not his advice.'

Even as I spoke I was hoping that these valiant knights, who were
carrying all before them, would indeed succeed in their great enterprise.

'There will be a terrible amount of bloodshed!' sighed my mistress.

'God will be on the side of the right,' said I.

'Yes. On the side of the right,' she rejoined with emphasis. Then she
continued, with another sigh, 'If this fails, my life will be the forfeit, and
justly, too, for the words of those who said Queen Mary would not be safe
upon her throne whilst I live will have proved true.'

Another time, as we were returning from St. Peter's Chapel, she paused,
and, looking at a certain spot on the green, where a scaffold was wont to be
erected for the more private execution of State prisoners, the tears came into
her eyes, and I knew that she was apprehending a similar fate.

However, I had every confidence in my brave and valiant hero, and often
lay awake at night, thinking of all that would happen when he and the Duke
of Suffolk once more placed my Lady Jane upon the throne.

I thought, when all that was settled, and my dear lady, with her husband
by her side, no longer depended so entirely on her Margery for
companionship and love, and my beloved, with his work accomplished, had
leisure to be happy, he and I might have time to get married, and then we
would go together to see my home and my dear old father, Hal and Jack,
and, too, Master Montgomery in his parsonage, and the villagers and our
servants. After which Sir Hubert would take me to his own beautiful place,
Harpton Hall, where we should live together in great happiness and
prosperity. But I am glad to think that I always said to myself, 'If the Lord
will,' and resolved that, even if things went contrary and we did not have
quite such a good time, I would be resigned and thankful for smaller
mercies.
But of what was really going to happen I had not the faintest conception.

CHAPTER XXIII

Wyatt's Insurrection

I heard full particulars afterwards of the insurrection, but at the time,


shut up in the Tower, knew little of its course.

Sir Thomas Wyatt, though professedly a Romanist, having seen the


horrors of the Inquisition in Spain, had risen in revolt against Mary because
of her Spanish marriage. He first raised the standard of revolt in Kent,
where many joined him, and amongst them Sir Hubert Blair, who thought
he could thus best serve Lady Jane, whilst the Duke of Suffolk, who was
openly for his daughter, was making a similar attempt in the Midlands, and
Sir Peter Carew in the West; the latter's object being to place the Princess
Elizabeth on the throne.

At Rochester, where Sir Thomas Wyatt, accompanied by his aide-de-


camp, Sir Hubert Blair, encamped in the ruins of the old castle, and held the
bridge with cannon and well-armed Kentish men, there was a great scene.
The Duke of Norfolk, with a detachment of Guards from London, was to
have forced the bridge, but a certain Captain Brett, who was deputed by him
to lead five hundred men against it, turning, addressed his followers thus—

'Masters, we are about to fight against our native countrymen of England


and our friends, in a quarrel unrightful and wicked; for they, considering the
great miseries that are like to fall upon us if we shall be under the rule of the
proud Spaniards, or strangers, are here assembled to make resistance to
their coming, for the avoiding of the great mischiefs likely to alight not only
upon themselves, but upon every one of us and the whole realm, wherefore

You might also like