You are on page 1of 53

System Architecture An Ordinary

Engineering Discipline 1st Edition


Wolfgang J. Paul
Visit to download the full and correct content document:
https://textbookfull.com/product/system-architecture-an-ordinary-engineering-disciplin
e-1st-edition-wolfgang-j-paul/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Embedded System Design Introduction to SoC System


Architecture 1st Edition Mohit Arora

https://textbookfull.com/product/embedded-system-design-
introduction-to-soc-system-architecture-1st-edition-mohit-arora/

System and Architecture Sunil Kumar Muttoo

https://textbookfull.com/product/system-and-architecture-sunil-
kumar-muttoo/

Computer System Architecture M. Morris Mano

https://textbookfull.com/product/computer-system-architecture-m-
morris-mano/

Cyber-Physical System Design from an Architecture


Analysis Viewpoint: Communications of NII Shonan
Meetings 1st Edition Shin Nakajima

https://textbookfull.com/product/cyber-physical-system-design-
from-an-architecture-analysis-viewpoint-communications-of-nii-
shonan-meetings-1st-edition-shin-nakajima/
System Safety Engineering and Risk Assessment A
Practical Approach Second Edition Nicholas J. Bahr

https://textbookfull.com/product/system-safety-engineering-and-
risk-assessment-a-practical-approach-second-edition-nicholas-j-
bahr/

Inequality in School Discipline: Research and Practice


to Reduce Disparities 1st Edition Russell J. Skiba

https://textbookfull.com/product/inequality-in-school-discipline-
research-and-practice-to-reduce-disparities-1st-edition-russell-
j-skiba/

System Engineering Practices 1st Edition Ian


Faulconbridge

https://textbookfull.com/product/system-engineering-
practices-1st-edition-ian-faulconbridge/

Architecture of an atom 1st Edition Juliacks

https://textbookfull.com/product/architecture-of-an-atom-1st-
edition-juliacks/

Ordinary differential equations : an introduction to


the fundamentals Second Edition. Edition Howell

https://textbookfull.com/product/ordinary-differential-equations-
an-introduction-to-the-fundamentals-second-edition-edition-
howell/
Wolfgang J. Paul · Christoph Baumann
Petro Lutsyk · Sabine Schmaltz

System
Architecture
An Ordinary
Engineering Discipline
System Architecture
Wolfgang J. Paul Christoph Baumann

Petro Lutsyk Sabine Schmaltz


System Architecture
An Ordinary Engineering Discipline

123
Wolfgang J. Paul Petro Lutsyk
FR 6.1 Informatik FR 6.1 Informatik
Universität des Saarlandes Universität des Saarlandes
Saarbrücken, Saarland Saarbrücken, Saarland
Germany Germany

Christoph Baumann Sabine Schmaltz


School of Computer Science FR 6.1 Informatik
and Communication Universität des Saarlandes
KTH Royal Institute of Technology Saarbrücken, Saarland
Stockholm Germany
Sweden

ISBN 978-3-319-43064-5 ISBN 978-3-319-43065-2 (eBook)


DOI 10.1007/978-3-319-43065-2
Library of Congress Control Number: 2016952820

© Springer International Publishing Switzerland 2016


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this
publication does not imply, even in the absence of a specific statement, that such names are exempt from
the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this
book are believed to be true and accurate at the date of publication. Neither the publisher nor the
authors or the editors give a warranty, express or implied, with respect to the material contained herein or
for any errors or omissions that may have been made.

Printed on acid-free paper

This Springer imprint is published by Springer Nature


The registered company is Springer International Publishing AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
Contents

1 Introduction 1

2 Understanding Decimal Addition 7


2.1 Experience Versus Understanding . . . . . . . . . . . . . . . . . . 7
2.2 The Natural Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 2 + 1 = 3 is a Definition . . . . . . . . . . . . . . . . . . . 9
2.2.2 1 + 2 = 3 is a Theorem . . . . . . . . . . . . . . . . . . . 9
2.2.3 9 + 1 = 10 is a Brilliant Theorem . . . . . . . . . . . . . . 11
2.3 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Basic Mathematical Concepts 15


3.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.1 Implicit Quantification . . . . . . . . . . . . . . . . . . . . 16
3.1.2 Numbers and Sets . . . . . . . . . . . . . . . . . . . . . . 17
3.1.3 Sequences, Their Indexing and Overloading . . . . . . . . 18
3.1.4 Bytes, Logical Connectives, and Vector Notation . . . . . . 20
3.2 Modulo Computation . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Sums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3.1 Geometric Sums . . . . . . . . . . . . . . . . . . . . . . . 24
3.3.2 Arithmetic Sums . . . . . . . . . . . . . . . . . . . . . . . 25
3.4 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.4.1 Directed Graphs . . . . . . . . . . . . . . . . . . . . . . . 25
3.4.2 Directed Acyclic Graphs and the Depth of Nodes . . . . . . 27
3.4.3 Rooted Trees . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.5 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4 Number Formats and Boolean Algebra 33


4.1 Binary Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2 Two’s Complement Numbers . . . . . . . . . . . . . . . . . . . . . 37
4.3 Boolean Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.3.1 Useful Identities . . . . . . . . . . . . . . . . . . . . . . . 42
4.3.2 Solving Equations . . . . . . . . . . . . . . . . . . . . . . 44

V
VI CONTENTS

4.3.3 Disjunctive Normal Form . . . . . . . . . . . . . . . . . . 45


4.4 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

5 Hardware 51
5.1 Gates and Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.2 Some Basic Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.3 Clocked Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.4 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.5 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

6 Five Designs of RAM 71


6.1 Basic Random Access Memory . . . . . . . . . . . . . . . . . . . . 71
6.2 Read-Only Memory (ROM) . . . . . . . . . . . . . . . . . . . . . 73
6.3 Combining RAM and ROM . . . . . . . . . . . . . . . . . . . . . 73
6.4 Three-Port RAM for General-Purpose Registers . . . . . . . . . . . 75
6.5 SPR-RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.6 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

7 Arithmetic Circuits 81
7.1 Adder and Incrementer . . . . . . . . . . . . . . . . . . . . . . . . 81
7.1.1 Carry Chain Adder and Incrementer . . . . . . . . . . . . . 82
7.1.2 Conditional-Sum Adders . . . . . . . . . . . . . . . . . . 83
7.1.3 Parallel Prefix Circuits . . . . . . . . . . . . . . . . . . . . 86
7.1.4 Carry-Look-Ahead Adders . . . . . . . . . . . . . . . . . 88
7.2 Arithmetic Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
7.3 Arithmetic Logic Unit (ALU) . . . . . . . . . . . . . . . . . . . . . 94
7.4 Shifter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
7.5 Branch Condition Evaluation Unit . . . . . . . . . . . . . . . . . . 98
7.6 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

8 A Basic Sequential MIPS Machine 109


8.1 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
8.1.1 I-type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
8.1.2 R-type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.1.3 J-type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.2 MIPS ISA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
8.2.1 Configuration and Instruction Fields . . . . . . . . . . . . 112
8.2.2 Instruction Decoding . . . . . . . . . . . . . . . . . . . . 114
8.2.3 ALU Operations . . . . . . . . . . . . . . . . . . . . . . . 115
8.2.4 Shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
8.2.5 Branch and Jump . . . . . . . . . . . . . . . . . . . . . . 118
CONTENTS VII

8.2.6 Loads and Stores . . . . . . . . . . . . . . . . . . . . . . . 120


8.2.7 ISA Summary . . . . . . . . . . . . . . . . . . . . . . . . 122
8.3 A Sequential Processor Design . . . . . . . . . . . . . . . . . . . . 123
8.3.1 Hardware Configuration . . . . . . . . . . . . . . . . . . . 123
8.3.2 Fetch and Execute Cycles . . . . . . . . . . . . . . . . . . 125
8.3.3 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
8.3.4 Instruction Fetch . . . . . . . . . . . . . . . . . . . . . . . 126
8.3.5 Proof Goals for the Execute Stage . . . . . . . . . . . . . . 128
8.3.6 Instruction Decoder . . . . . . . . . . . . . . . . . . . . . 128
8.3.7 Reading from General-Purpose Registers . . . . . . . . . . 132
8.3.8 Next PC Environment . . . . . . . . . . . . . . . . . . . . 133
8.3.9 ALU Environment . . . . . . . . . . . . . . . . . . . . . . 135
8.3.10 Shifter Environment . . . . . . . . . . . . . . . . . . . . . 136
8.3.11 Jump and Link . . . . . . . . . . . . . . . . . . . . . . . . 137
8.3.12 Collecting Results . . . . . . . . . . . . . . . . . . . . . . 137
8.3.13 Effective Address . . . . . . . . . . . . . . . . . . . . . . 138
8.3.14 Memory Environment . . . . . . . . . . . . . . . . . . . . 138
8.3.15 Writing to the General-Purpose Register File . . . . . . . . 140
8.4 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
8.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

9 Some Assembler Programs 145


9.1 Simple MIPS Programs . . . . . . . . . . . . . . . . . . . . . . . . 146
9.2 Software Multiplication . . . . . . . . . . . . . . . . . . . . . . . . 147
9.3 Software Division . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
9.3.1 School Method for Non-negative Integer Division . . . . . 149
9.3.2 ‘Small’ Unsigned Integer Division . . . . . . . . . . . . . 150
9.3.3 Unsigned Integer Division . . . . . . . . . . . . . . . . . . 153
9.3.4 Integer Division . . . . . . . . . . . . . . . . . . . . . . . 155
9.4 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
9.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

10 Context-Free Grammars 159


10.1 Introduction to Context-Free Grammars . . . . . . . . . . . . . . . 160
10.1.1 Syntax of Context-Free Grammars . . . . . . . . . . . . . 160
10.1.2 Quick and Dirty Introduction to Derivation Trees . . . . . . 161
10.1.3 Tree Regions . . . . . . . . . . . . . . . . . . . . . . . . . 163
10.1.4 Clean Definition of Derivation Trees . . . . . . . . . . . . 165
10.1.5 Composition and Decomposition of Derivation Trees . . . 167
10.1.6 Generated Languages . . . . . . . . . . . . . . . . . . . . 168
10.2 Grammars for Expressions . . . . . . . . . . . . . . . . . . . . . . 168
10.2.1 Syntax of Boolean Expressions . . . . . . . . . . . . . . . 168
10.2.2 Grammar for Arithmetic Expressions with Priorities . . . . 170
10.2.3 Proof of Lemma 66 . . . . . . . . . . . . . . . . . . . . . 171
10.2.4 Distinguishing Unary and Binary Minus . . . . . . . . . . 175
VIII CONTENTS

10.3 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175


10.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

11 The Language C0 179


11.1 Grammar of C0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
11.1.1 Names and Constants . . . . . . . . . . . . . . . . . . . . 180
11.1.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . 182
11.1.3 Arithmetic and Boolean Expressions . . . . . . . . . . . . 183
11.1.4 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . 183
11.1.5 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
11.1.6 Type and Variable Declarations . . . . . . . . . . . . . . . 184
11.1.7 Function Declarations . . . . . . . . . . . . . . . . . . . . 185
11.1.8 Representing and Processing Derivation Trees in C0 . . . . 186
11.1.9 Sequence Elements and Flattened Sequences in the C0 Gram-
mar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
11.2 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
11.2.1 Type Tables . . . . . . . . . . . . . . . . . . . . . . . . . 190
11.2.2 Global Variables . . . . . . . . . . . . . . . . . . . . . . . 193
11.2.3 Function Tables . . . . . . . . . . . . . . . . . . . . . . . 194
11.2.4 Variables and Subvariables of all C0 Configurations . . . . 196
11.2.5 Range of Types and Default Values . . . . . . . . . . . . . 197
11.3 C0 Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
11.3.1 Variables, Subvariables, and Their Type in C0 Configura-
tions c . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
11.3.2 Value of Variables, Type Correctness, and Invariants . . . . 202
11.3.3 Expressions and Statements in Function Bodies . . . . . . 204
11.3.4 Program Rest . . . . . . . . . . . . . . . . . . . . . . . . 207
11.3.5 Result Destination Stack . . . . . . . . . . . . . . . . . . . 209
11.3.6 Initial Configuration . . . . . . . . . . . . . . . . . . . . . 209
11.4 Expression Evaluation . . . . . . . . . . . . . . . . . . . . . . . . 210
11.4.1 Type, Right Value, and Left Value of Expressions . . . . . 212
11.4.2 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
11.4.3 Variable Binding . . . . . . . . . . . . . . . . . . . . . . . 215
11.4.4 Pointer Dereferencing . . . . . . . . . . . . . . . . . . . . 217
11.4.5 Struct Components . . . . . . . . . . . . . . . . . . . . . . 217
11.4.6 Array Elements . . . . . . . . . . . . . . . . . . . . . . . 218
11.4.7 ‘Address of’ . . . . . . . . . . . . . . . . . . . . . . . . . 219
11.4.8 Unary Operators . . . . . . . . . . . . . . . . . . . . . . . 219
11.4.9 Binary Operators . . . . . . . . . . . . . . . . . . . . . . . 221
11.5 Statement Execution . . . . . . . . . . . . . . . . . . . . . . . . . 222
11.5.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . 223
11.5.2 Conditional Statement . . . . . . . . . . . . . . . . . . . . 224
11.5.3 While Loop . . . . . . . . . . . . . . . . . . . . . . . . . 224
11.5.4 ‘New’ Statement . . . . . . . . . . . . . . . . . . . . . . . 225
11.5.5 Function Call . . . . . . . . . . . . . . . . . . . . . . . . 227
CONTENTS IX

11.5.6 Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230


11.6 Proving the Correctness of C0 Programs . . . . . . . . . . . . . . . 232
11.6.1 Assignment and Conditional Statement . . . . . . . . . . . 232
11.6.2 Computer Arithmetic . . . . . . . . . . . . . . . . . . . . 234
11.6.3 While Loop . . . . . . . . . . . . . . . . . . . . . . . . . 234
11.6.4 Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . 236
11.6.5 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . 242
11.7 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
11.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

12 A C0-Compiler 253
12.1 Compiler Consistency . . . . . . . . . . . . . . . . . . . . . . . . . 254
12.1.1 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . 254
12.1.2 Size of Types, Displacement, and Base Address . . . . . . 256
12.1.3 Consistency for Data, Pointers, and the Result Destination
Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
12.1.4 Consistency for the Code . . . . . . . . . . . . . . . . . . 262
12.1.5 Consistency for the Program Rest . . . . . . . . . . . . . . 264
12.1.6 Relating the Derivation Tree and the Program Rest . . . . . 270
12.2 Translation of Expressions . . . . . . . . . . . . . . . . . . . . . . 275
12.2.1 Sethi-Ullman Algorithm . . . . . . . . . . . . . . . . . . . 275
12.2.2 The R-label . . . . . . . . . . . . . . . . . . . . . . . . . . 280
12.2.3 Composable MIPS Programs . . . . . . . . . . . . . . . . 286
12.2.4 Correctness of Code for Expressions . . . . . . . . . . . . 288
12.2.5 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
12.2.6 Variable Names . . . . . . . . . . . . . . . . . . . . . . . 291
12.2.7 Struct Components . . . . . . . . . . . . . . . . . . . . . . 293
12.2.8 Array Elements . . . . . . . . . . . . . . . . . . . . . . . 294
12.2.9 Dereferencing Pointers . . . . . . . . . . . . . . . . . . . 295
12.2.10 ‘Address of’ . . . . . . . . . . . . . . . . . . . . . . . . . 296
12.2.11 Unary Operators . . . . . . . . . . . . . . . . . . . . . . . 297
12.2.12 Binary Arithmetic Operators . . . . . . . . . . . . . . . . 298
12.2.13 Comparison . . . . . . . . . . . . . . . . . . . . . . . . . 300
12.2.14 Translating Several Expressions and Maintaining the Results 301
12.3 Translation of Statements . . . . . . . . . . . . . . . . . . . . . . . 302
12.3.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . 303
12.3.2 New Statement . . . . . . . . . . . . . . . . . . . . . . . . 304
12.3.3 While Loop . . . . . . . . . . . . . . . . . . . . . . . . . 305
12.3.4 If-Then-Else . . . . . . . . . . . . . . . . . . . . . . . . . 307
12.3.5 If-Then . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
12.3.6 Function Call . . . . . . . . . . . . . . . . . . . . . . . . 308
12.3.7 Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
12.3.8 Summary of Intermediate Results . . . . . . . . . . . . . . 315
12.4 Translation of Programs . . . . . . . . . . . . . . . . . . . . . . . . 316
12.4.1 Statement Sequences . . . . . . . . . . . . . . . . . . . . 316
X CONTENTS

12.4.2 Function Bodies . . . . . . . . . . . . . . . . . . . . . . . 317


12.4.3 Function Declaration Sequences . . . . . . . . . . . . . . . 318
12.4.4 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
12.4.5 Jumping Out of Loops and Conditional Statements . . . . . 320
12.5 Compiler Correctness Revisited . . . . . . . . . . . . . . . . . . . 322
12.5.1 Christopher Lee and the Truth About Life After Death . . . 322
12.5.2 Consistency Points . . . . . . . . . . . . . . . . . . . . . . 323
12.5.3 Compiler Correctness for Optimizing Compilers . . . . . . 324
12.6 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
12.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

13 Compiler Consistency Revisited 333


13.1 Reconstructing a Well-Formed C0 Configuration . . . . . . . . . . 334
13.1.1 Associating Code Addresses with Statements and Functions 335
13.1.2 Reconstructing Everything Except Heap and Pointers . . . 337
13.1.3 Reachable Subvariables . . . . . . . . . . . . . . . . . . . 340
13.1.4 Implementation Subvariables . . . . . . . . . . . . . . . . 342
13.1.5 Heap Reconstruction Is not Unique . . . . . . . . . . . . . 347
13.1.6 Heap Isomorphisms and Equivalence of C0 Configurations 348
13.1.7 Computations Starting in Equivalent Configurations . . . . 351
13.2 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . 355
13.2.1 Pointer Chasing . . . . . . . . . . . . . . . . . . . . . . . 356
13.2.2 Garbage-Collected Equivalent Configurations . . . . . . . 360
13.2.3 Construction of a Garbage-Collected MIPS Configuration . 362
13.3 C0 + Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
13.3.1 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
13.3.2 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . 366
13.3.3 Semantics and Compiler Correctness . . . . . . . . . . . . 367
13.4 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
13.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

14 Operating System Support 375


14.1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
14.1.1 Types of Interrupts . . . . . . . . . . . . . . . . . . . . . . 376
14.1.2 Special Purpose Registers and New Instructions . . . . . . 376
14.1.3 MIPS ISA with Interrupts . . . . . . . . . . . . . . . . . . 378
14.1.4 Specification of Most Internal Interrupt Event Signals . . . 381
14.1.5 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
14.1.6 Hardware Correctness . . . . . . . . . . . . . . . . . . . . 384
14.2 Address Translation . . . . . . . . . . . . . . . . . . . . . . . . . . 384
14.2.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . 385
14.2.2 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
14.3 Disks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
14.3.1 Hardware Model of a Disk . . . . . . . . . . . . . . . . . 392
14.3.2 Accessing a Device with Memory-Mapped I/O . . . . . . . 395
CONTENTS XI

14.3.3 Nondeterminism Revisited . . . . . . . . . . . . . . . . . 397


14.3.4 Nondeterministic ISA for Processor + Disk . . . . . . . . . 400
14.3.5 Hardware Correctness . . . . . . . . . . . . . . . . . . . . 404
14.3.6 Order Reduction . . . . . . . . . . . . . . . . . . . . . . . 406
14.3.7 Disk Liveness in Reordered Computations . . . . . . . . . 410
14.3.8 C0 + Assembly + Disk + Interrupts . . . . . . . . . . . . . 414
14.3.9 Hard Disk Driver . . . . . . . . . . . . . . . . . . . . . . 417
14.4 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
14.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424

15 A Generic Operating System Kernel 429


15.1 Physical and Virtual Machines . . . . . . . . . . . . . . . . . . . . 431
15.1.1 Physical Machines . . . . . . . . . . . . . . . . . . . . . . 431
15.1.2 Virtual Machines . . . . . . . . . . . . . . . . . . . . . . . 431
15.2 Communicating Virtual Machines . . . . . . . . . . . . . . . . . . 434
15.2.1 Configurations . . . . . . . . . . . . . . . . . . . . . . . . 434
15.2.2 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . 435
15.3 Concrete Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
15.3.1 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . 439
15.3.2 Virtual Address Translation via C Data Structures . . . . . 441
15.3.3 Simulation Relation for Virtual Machines . . . . . . . . . . 442
15.3.4 Encoding an Abstract Kernel by a Concrete Kernel . . . . . 444
15.3.5 Simulation Relation for the Abstract Kernel of CVM . . . . 446
15.3.6 Technical Invariants . . . . . . . . . . . . . . . . . . . . . 449
15.3.7 Formulating the Correctness Theorem . . . . . . . . . . . 450
15.4 The runvm Primitive . . . . . . . . . . . . . . . . . . . . . . . . . 452
15.4.1 Overview of the runvm Primitive . . . . . . . . . . . . . . 453
15.4.2 Program Annotations . . . . . . . . . . . . . . . . . . . . 454
15.4.3 Maintaining k-consis . . . . . . . . . . . . . . . . . . . . . 455
15.4.4 Maintaining consis . . . . . . . . . . . . . . . . . . . . . . 458
15.4.5 Maintaining inv-vm . . . . . . . . . . . . . . . . . . . . . 459
15.5 Simulation of CVM Steps . . . . . . . . . . . . . . . . . . . . . . 461
15.5.1 Scratch Memory . . . . . . . . . . . . . . . . . . . . . . . 461
15.5.2 C0 Step of the Kernel . . . . . . . . . . . . . . . . . . . . 463
15.5.3 ISA Step of a User Without Interrupt . . . . . . . . . . . . 464
15.5.4 Restoring a User Process . . . . . . . . . . . . . . . . . . 466
15.5.5 Testing for Reset . . . . . . . . . . . . . . . . . . . . . . . 470
15.5.6 Boot Loader and Initialization . . . . . . . . . . . . . . . . 472
15.5.7 Process Save . . . . . . . . . . . . . . . . . . . . . . . . . 474
15.6 Page Fault Handling . . . . . . . . . . . . . . . . . . . . . . . . . . 478
15.6.1 Testing for ipf Page Fault . . . . . . . . . . . . . . . . . . 478
15.6.2 Auxiliary Data Structures . . . . . . . . . . . . . . . . . . 481
15.6.3 Swapping a Page Out . . . . . . . . . . . . . . . . . . . . 485
15.6.4 Swapping a Page In . . . . . . . . . . . . . . . . . . . . . 487
15.6.5 Liveness . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
XII CONTENTS

15.7 Other CVM Primitives and Dispatching . . . . . . . . . . . . . . . 490


15.7.1 Accessing Registers of User Processes . . . . . . . . . . . 491
15.7.2 Accessing User Pages . . . . . . . . . . . . . . . . . . . . 491
15.7.3 free and alloc . . . . . . . . . . . . . . . . . . . . . . . . 492
15.7.4 Application Binary Interface and Dispatcher for the Ab-
stract Kernel . . . . . . . . . . . . . . . . . . . . . . . . . 497
15.8 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
15.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500

References 503

Index 507
1
Introduction

This text contains the lecture notes of a class we teach in Saarbrücken to first-year
students within a single semester. The purpose of the class is simple: to exhibit con-
structions of
• a simple MIPS processor
• a simple compiler for a C dialect
• a small operating system kernel
and to give detailed explanations for why they work.
We are able to cover all this material within a single lecture course, because we
treat computer science as an engineering discipline like any other: for any topic there
is appropriate math which is intuitive and adequate to deal with it, both for specifi-
cations and for explanations for why constructions work. High school mathematics
happens to suffice to deal with all subjects in this text.
As a warm-up exercise we study in Chap. 2 how to prove some very basic proper-
ties of decimal addition. Chapter 3 contains reference material about basic mathemat-
ical concepts which are used throughout the book. Elementary properties of binary
numbers, two’s complement numbers, and Boolean algebra are treated in Chap. 4. In
particular the correctness of algorithms for binary addition and subtraction is shown.
Of course we also include a proof of the fact that every switching function can be
computed by a Boolean formula.
A digital hardware model consisting of circuits and registers is introduced in
Chap. 5 and some simple circuits are constructed. Chapter 6 contains various con-
structions of random access memory (RAM) that are needed later in the text. Several
adder constructions (including conditional-sum adders and carry-look-ahead adders),
an arithmetic logic unit (ALU), and a simple shifter are covered in Chap. 7. In
Chap. 8 a subset of the MIPS instruction set architecture (ISA) is introduced and
a simple sequential (i.e., not pipelined) MIPS processor is constructed. Although the
correctness proof of the basic processor is straightforward, it exhibits an important
concept: processor hardware usually does not interpret all ISA programs; only pro-
grams which satisfy certain software conditions are correctly executed. In our case
we require so-called ‘alignment’ and the absence of writes into the ROM (read-only

© Springer International Publishing Switzerland 2016 1


W.J. Paul et al., System Architecture, DOI 10.1007/978-3-319-43065-2_1
2 1 Introduction

memory) region. Because we have a correctness proof we know that this list of con-
ditions is exhaustive for our simple processor. In the text we contrast this with the
situation for commercial multi-core processors and arrive at slightly worrisome con-
clusions.
Example programs written in assembly code are presented in Chap. 9. In partic-
ular we present algorithms for multiplication and division and show that they work.
These algorithms are used later in the compiler for the translation of multiplications
and divisions in expressions.
Chapter 10 contains a fairly detailed treatment of context-free grammars and their
derivation trees. The reason why we invest in this level of detail is simple: compilers
are algorithms operating on derivation trees, and the theory developed in this chap-
ter will permit us to argue about such algorithms in a concise and — hopefully —
clear way. In particular we study grammars for arithmetic expressions. In expressions
one uses priorities between operators to save brackets. For instance, we abbreviate
1 + (2 · x) by 1 + 2 · x because multiplication takes priority over addition. Fortunately
with this priority rule (and a few more) any expression can be interpreted in a unique
way, both by readers of mathematical text and by compilers. We feel that this is fun-
damental and have therefore included the proof of this result: in a certain grammar,
which reflects the priorities of the operators, the derivation trees for expressions are
unique.
Next, syntax and semantics of the programming language C0 are presented in
Chap. 11. In a nutshell C0 is Pascal with C syntax. Although we avoid address arith-
metic and type casting, C0 is quite a rich language with recursive data types, point-
ers, and a heap. Its complete grammar fits on a single page (Table 12). We begin
with an informal description and elaborate somewhat on the implementation of tree
algorithms in C0. The semantics of expressions is defined via the unique derivation
trees studied in Chap. 10. The effect of statement execution is defined by a so-called
small-step semantics hinging on C0 configurations with a program rest. A big-step
semantics would be simpler, but it would not work in the context of kernel pro-
gramming, where the C0 computations of a kernel must be interleaved with the ISA
computations of user processes.
A non-optimizing compiler translating C0 programs into MIPS programs is de-
scribed in Chap. 12. We assume that the derivation tree T of an arbitrary C0 program
p is given, and we describe by induction over the subtrees of T a target program p0 in
MIPS ISA which simulates source program p. Having formal semantics both for C0
and MIPS ISA makes life remarkably simple. We invest some pages in the develop-
ment of a consistency relation consis(c, d), which formalizes how C0 configurations
c are encoded in ISA configurations d. Then we use this relation as a guide for code
generation by induction over the subtrees of derivation tree T : arguing locally we
always generate ISA code such that in runs of the source program and the target
program consistency is maintained. Once the consistency relation is understood this
is remarkably straightforward with two exceptions. First, for expression evaluation
we use the elegant and powerful Sethi-Ullman algorithm. Second, there is a ‘natural
mismatch’ between the way program execution is controlled in ISA (with a program
counter) and in C0 (with a program rest). For the correctness proof of the compiler
1 Introduction 3

we bridge this gap with the help of the very useful technical Lemma 90. There we
identify for every node n in the derivation tree, which generates a statement s in the
program rest, the unique node succ(n) which generates the next statement after s in
the program rest, unless s is a return statement.
At this place in the text we have laid the foundations which permit us to deal
with system programming — here the programming of a kernel — in a precise way.
Kernels perform so-called process switches, where they save or restore processor
registers in C0 variables, which are called process control blocks. In higher-level
programming languages such as C0 one can only access C variables; the processor
registers are not directly accessible. Thus in order to program ‘process save’ and
‘restore’ one has to be able to switch from C0 to assembly code and back. We call
the resulting language ‘C0 + assembly’ or for short ‘C+A’. A semantics for this lan-
guage is developed in Sect. 13.1. We begin by studying an apparently quite academic
question: given an ISA configuration d, what are all possible well-formed C0 con-
figurations c satisfying consis(c, d)? We call every such configuration a possible C
abstraction of d. It turns out that the construction of such C abstractions is unique ex-
cept for the heap. During the reconstruction of possible C abstractions Lemma 90 is
reused for the reconstruction of the program rest, and reachable portions of the heap
are found essentially by a graph search starting from pointer variables in the global
memory and on the stack. In general, heaps cannot be uniquely reconstructed, but an
easy argument shows that different reconstructed heaps are basically isomorphic in
the graph theoretic sense. We call C0 configurations c and c0 equivalent if their heaps
are isomorphic and their other components are identical and show: i) computations
starting in equivalent configurations continue in equivalent configurations and ii) ex-
pression evaluation in equivalent computations leads to the same result, unless the
expression has pointer type.
This result opens the door to define the semantics of C+A in a quite intuitive
way. As long as abstracted C code is running we run the ISA computation and C
abstractions in lock step. If the computation switches to inline assembly or jumps
completely outside of the C program (this happens if a kernel starts a user process),
we simply drop the C abstraction and continue with ISA semantics. When we return
to translated C code we reconstruct a C abstraction at the earliest possible ISA step.
Which C abstraction we choose does not matter: the value of expressions, except
those of pointer type, does not depend on the (nondeterministic) choice.
Finally, there is a situation where a user process whose program lies outside of
the kernel returns control to the kernel, and the kernel performs the aforementioned
‘process save’. The return to the code of the kernel is very similar to a ‘goto’, a
construct absent in the original definition of the structured programming language
C0. As a warm-up exercise for the later treatment of this situation we augment C0
with labels and gotos. Compilation is trivial. Providing small-step semantics for it is
not, but is again easily solved with Lemma 90.
The pointer chasing on the heap for the reconstruction of C0 configurations is
also known from garbage collection. For interested readers we have therefore in-
cluded a short treatment of garbage collection, although we will not make use of it
later.
4 1 Introduction

Chapter 14 defines and justifies extensions of the programming models encoun-


tered so far for system programmers. On the hardware side MIPS ISA is extended
by mechanisms for interrupt processing and address translation. Extending the pro-
cessor construction and proving its correctness is fairly straightforward. There is,
however, a small new kind of argument: the external interrupt signals eeviisa seen by
ISA instructions i have to be constructed from the external hardware interrupt signals
eevth observed during the hardware cycles t.
Next we define a hardware model of a hard disk, integrate it into the processor
construction, and try to abstract an ISA model of the system obtained in this way.
This becomes surprisingly interesting for a simple reason: the hardware of the se-
quential processor together with the disk forms already a parallel system, and it is
basically impossible to predict how many ISA instructions a disk access needs until
its completion after it has started. Nondeterminism appears now for good. Processor
steps and steps when disk accesses complete are interleaved sequentially in a non-
deterministic order. In order to justify such a model one has to construct this order
from the hardware cycles in which processor instructions and disk accesses are com-
pleted; the interesting case is when both kinds of steps complete in the same cycle.
Abstracting the external interrupt event signals eeviisa observed at the ISA level also
becomes slightly more involved, because processor steps consume external interrupt
signals, whereas disk steps ignore them. This difficulty is solved by keeping track of
completed processor steps in the configurations of the resulting ‘ISA + disk’ model,
much in the style of a head position on an input tape.
It turns out that not all orders of interleaving have to be considered. As long as
the processor does not observe the disk (either by polling or reacting to an interrupt
signal generated by the disk), the completion of a disk step has no influence on the
computation of a processor. This allows us to restrict the possible occurrences of disk
steps: it suffices to consider disk steps which immediately precede instructions when
the processor observes the disk. A result of this nature is called an order reduction
theorem. Order reduction is amazingly useful when it comes to integrating the disk
into the C+A model: if we disable external interrupts while translated C code is
running and if we do not allocate C variables on I/O-ports of the disk, then translated
C code cannot observe the disk; thus we can ignore the disk and external interrupts
other than reset while translated C code is running.
Disk liveness, i.e., the termination of every disk access that was started, holds in
the ISA model with order reduction only if certain natural software conditions holds.
After this fact is established in a somewhat nontrivial proof, one can construct disk
drivers which obey these conditions, and show their correctness in the ‘C+A + disk
+ interrupt’ model in a straightforward way.
In Chap. 15 we finally specify and implement what we call a generic operating
system kernel. In a nutshell a kernel has two tasks:
• to simulate on a single physical processor multiple virtual processors of almost
the same ISA, and
• to provide services to these virtual processors via system calls.
1 Introduction 5

This suggests to split the kernel implementation into two layers, one for each of the
above tasks: i) a lower virtualization layer and ii) an upper layer which includes the
scheduler and the handlers for system calls. In this text we treat the lower layer and
leave the programmer the freedom to program the upper layer in any way she or he
wishes. With all the computational models developed so far in place and justified, we
can afford the luxury of following our usual pattern of specification, implementation,
and correctness proof. We have to explain the differences between physical and vir-
tual processors; roughly speaking virtual processors cannot use address translation
and not all interrupts are visible. In particular the virtual machine sees page faults
only if it tries to access pages that are not allocated by it. Page faults due to invalid
page table entries are invisible and must be handled transparently by the implemen-
tation of the kernel.
Then we formally specify a computational model, which is realized by the virtu-
alization layer. The user of the virtualization layer simply sees a number of virtual
user machines communicating with a so-called abstract kernel. The latter is an arbi-
trary (!) C0 program which is allowed to call a very small number of special functions
that we call CVM primitives. The entire specification of the CVM model including
the semantics of all special functions takes only four pages. No reference to inline
assembly is necessary in the specification. Only the semantics of ISA and C0, and
the parallelism of CVM are used.
CVM is implemented by what we call a concrete kernel written in ‘C+A + disk
+ interrupts’. Again we identify the simulation relation we have to maintain and then
hope that this will guide the implementation in a straightforward way. Now system
programming has a reputation for being somewhat more tricky than ordinary pro-
gramming, and even with completely clean computational models we cannot make
the complexity involved completely disappear. It turns out that we have to maintain
three simulation relations:
• between the physical machine configuration d and the virtual user machines vm.
This involves address translation and process control blocks.
• between the C abstraction k of the concrete kernel configuration (if present) and
the physical machine d. This is handled basically by consis(k, d), but if users are
running we must maintain a substitute for this C abstraction.
• between the C abstraction k of the concrete kernel configuration and the configu-
ration c of the abstract kernel. Because the code of the abstract kernel is a part of
the concrete kernel this requires a very rudimentary theory of linking and gives
rise to a simulation relation k-consis.
Moreover, each of the involved relations changes slightly when the simulated ma-
chine (user, concrete kernel, or abstract kernel) starts or stops running. Identifying
these relations takes six pages (Sects.15.3.3 to 15.3.5) and is the heart of the matter.
From then on things become easier. A top-level flow chart for the CVM primitive
runvm, which starts user processes, handles page faults transparently and saves user
processes when they return to the kernel, fits on a single page (Fig. 235). We have
to annotate it with a nontrivial number of invariants, but identifying these invariants
is not very hard: they are just the invariants needed to maintain the three simulation
6 1 Introduction

relations. Programming the building blocks of the flow chart such that the invari-
ants are maintained is mostly done in a straightforward way. Showing that it is done
correctly would of course be impossible, if we would lack a formal semantics for a
single one of the instructions that we use. But this is not our problem any more.
Throughout the book we give in the introduction of each chapter comments on
how we teach this material, what we cover in full detail and where we refer students
to the lecture notes. At the end of each chapter we give a summary of what we think
were the key ideas in the chapter. This is what we advise you to memorize i) for
examinations and ii) — if you can do it — for life. This is not as immodest as it
may appear: as a lecturer of a basic course one has a very large responsibility. If not
even the lecturer believes that some things in the lecture are worth memorizing for
life, then he or she should by all means change the content of the lecture. Explaining
why implementations of systems meet their specification by mathematical proofs
not only speeds up delivery in the classroom. It also opens the way to what is called
formal verification. There, one uses so-called computer-aided verification systems
(CAV systems) to i) formulate the correctness theorems in machine readable form
and then ii) verify by computer that the proofs have no gaps. In this way one can
check that even complex systems work according to their specification for all inputs,
something that cannot be done with conventional testing. For very simple systems
this was done as early as 1987 [BJMY89], for complex processors in 2003 [BJK+ 03],
for non-optimizing compilers in 2008 [LP08], and for optimizing compilers in 2009
[Ler09], for a complete kernel written in C including all lines of assembly code in
2008 [IdRT08], and for the C portions of a small industrial kernel in 2010 [KAE+ 10].
Throughout the text we will refer the reader to related work in formal verification.
Developing a theory of system architecture like the one in this book for multi-
core systems is an ongoing research effort. Again, throughout the text we will inform
the reader about the state of this research at the time of writing.
2
Understanding Decimal Addition

2.1 Experience Versus Understanding

This book is about understanding system architecture in a quick and clean way: no
black art, nothing you can only get a feeling for after years of programming experi-
ence. While experience is good, it does not replace understanding. For illustration,
consider the basic method for decimal addition of one-digit numbers as taught in the
first weeks of elementary school: everybody has experience with it, almost nobody
understands it; very few of the people who do not understand it realize that they
don’t.
Recall that, in mathematics, there are definitions and statements. Statements that
we can prove are called theorems. Some true statements, however, are so basic that
there are no even more basic statements that we can derive them from; these are
called axioms. A person who understands decimal addition will clearly be able to
answer the following simple
Questions: Which of the following equations are definitions? Which ones are theo-
rems? If an equation is a theorem, what is the proof?

2 + 1 = 3,
1 + 2 = 3,
9 + 1 = 10.

We just stated that these questions are simple; we did not say that answering them
is easy. Should you care? Indeed you should, for at least three reasons: i) In case
you don’t even understand the school method for decimal addition, how can you
hope to understand computer systems? ii) The reason why the school method works
has very much to do with the reason why binary addition in the fixed-point adders
of processors works. iii) You should learn to distinguish between having experience
with something that has not gone wrong (yet) and having an explanation of why it
always works. The authors of this text consider iii) the most important.

© Springer International Publishing Switzerland 2016 7


W.J. Paul et al., System Architecture, DOI 10.1007/978-3-319-43065-2_2
8 2 Understanding Decimal Addition

2.2 The Natural Numbers


In order to answer the above questions, we first consider counting. Since we count
by repeatedly adding 1, this should be a step in the right direction.
The set of natural numbers N and the properties of counting are not based on
ordinary mathematical definitions. In fact, they are so basic that we use five axioms
due to Peano to simultaneously lay down all properties about the natural numbers
and of counting we will ever use without proof. The axioms talk about
• a special number 0,
• the set N of all natural numbers (with zero),
• counting formalized by a successor function S : N → N, and
• subsets A ⊂ N of the natural numbers.
Peano’s axioms are
1. 0 ∈ N. Zero is a natural number. Note that this is a modern view of counting,
because zero counts something that could be there but isn’t.
2. x ∈ N → S(x) ∈ N. You can always count to the next number.
3. x 6= y → S(x) 6= S(y). Different numbers have different successors.
4. @y. 0 = S(y). By counting you cannot arrive at 0. Note that this isn’t true for
computer arithmetic, where you can arrive at zero by an overflow of modulo
arithmetic (see Sect. 3.2).
5. A ⊆ N ∧ 0 ∈ A ∧ (n ∈ A → S(n) ∈ A) → A = N. This is the famous induction
scheme for proofs by induction. We give plenty of examples later.
In a proof by induction, one usually considers a set A consisting of all numbers n
satisfying a certain property P(n):
A = {n ∈ N | P(n)}.
Then,
n ∈ A ↔ P(n),
A = N ↔ ∀n ∈ N : P(n),
and the induction axiom translates into a proof scheme you might or might not know
from high school:
• Start of the induction: show P(0).
• Induction step: show that P(n) implies P(S(n)).
• Conclude ∀n ∈ N : P(n). Property P holds for all natural numbers.
With the rules of counting laid down by the Peano axioms, we are able to make two
‘ordinary’ definitions. We define 1 to be the next number after 0 if you count. We
also define that addition of 1 is counting.
Definition 1 (Adding 1 by Counting).
1 = S(0),
x + 1 = S(x).
2.2 The Natural Numbers 9

With this, the induction step of proofs by induction can be reformulated to the more
familiar form
• Induction step: show that P(n) implies P(n + 1).

2.2.1 2 + 1 = 3 is a Definition

One can now give meaning to the other digits of decimal numbers with the following
mathematical definition.
Definition 2 (The Digits 2 to 9).

2 = 1 + 1 = S(1),
3 = 2 + 1 = S(2),
4 = 3 + 1 = S(3),
..
.
9 = 8 + 1 = S(8).

Thus, 2 + 1 = 3 is the definition of 3.

2.2.2 1 + 2 = 3 is a Theorem

Expanding definitions, we would like to prove it by

1 + 2 = 1 + (1 + 1) (Definition of 2)
= (1 + 1) + 1
= 2 + 1 (Definition of 2)
= 3 (Definition of 3).

With the axioms and definitions we have so far we cannot prove the second equation
yet. This is due to the fact that we have not defined addition completely. We fix this
by the following inductive definition.
Definition 3 (Addition).

x + 0 = x,
x + S(y) = S(x + y).

In words: adding 0 does nothing. In order to add y + 1, first add y, then add 1 (by
counting to the next number). From this we can derive the usual laws of addition.

Lemma 1 (Associativity of Addition).

(x + y) + z = x + (y + z).
10 2 Understanding Decimal Addition

Proof. by induction on z. For z = 0 we have

(x + y) + 0 = x + y = x + (y + 0)

by definition of addition (adding 0).


For the induction step we assume the induction hypothesis x + (y + z) = (x + y) + z.
By repeatedly applying the definition of addition we conclude

(x + y) + S(z) = S((x + y) + z) (by definition of addition)


= S(x + (y + z)) (by induction hypothesis)
= x + S(y + z) (by definition of addition)
= x + (y + S(z)).

Substituting x = y = z = 1 in Lemma 1, we get

(1 + 1) + 1 = 1 + (1 + 1)

which completes the missing step in the proof of 1 + 2 = 3.


Showing the commutativity of addition is surprisingly tricky. We first have to show
two special cases.
Lemma 2. 0 + x = x.
Proof. by induction on x. For x = 0 we have

0+0 = 0

by the definition of addition.


For the induction step we can assume the induction hypothesis 0 + x = x and use this
to show

0 + S(x) = S(0 + x) (definition of addition)


= S(x) (induction hypothesis).

Lemma 3. x + 1 = 1 + x.
Proof. by induction on x. For x = 0 we have

0+1 = 1 = 1+0

by the previous lemma and the definition of addition.


For the induction step we can assume the induction hypothesis x + 1 = 1 + x and
show

1 + S(x) = S(1 + x) (definition of addition)


= S(x + 1) (induction hypothesis)
= S(x) + 1 (definition of counting by adding 1).
2.2 The Natural Numbers 11

Lemma 4 (Commutativity of Addition).

x + y = y + x.

Proof. by induction on y. For y = 0 we have

x + 0 = x (definition of addition)
= 0 + x (Lemma 2).

For the induction step we can assume the induction hypothesis x + y = y + x and
show

x + S(y) = S(x + y) (definition of addition)


= S(y + x) (induction hypothesis)
= y + S(x) (definition of addition)
= y + (x + 1) (definition of counting by adding 1)
= y + (1 + x) (Lemma 3)
= (y + 1) + x (associativity of addition)
= S(y) + x (definition of counting by adding 1).

By induction one shows the following in the same way.


Lemma 5.

(x + y) · z = x · z + y · z (distributivity),
(x · y) · z = x · (y · z) (associativity of multiplication),
x · y = y · x (commutativity of multiplication).

The proof is left as an exercise.

2.2.3 9 + 1 = 10 is a Brilliant Theorem

The proof of 9 + 1 = 10 is much more involved. It uses a special biological constant


defined as
Z = 9+1
which denotes the number of our fingers or, respectively, toes1 . Moreover it uses a
definition attributed to the brilliant mathematician al-Khwarizmi, which defines the
decimal number system.
Definition 4 (Decimal Numbers). An n-digit decimal number an−1 . . . a0 with digits
ai ∈ {0, . . . , 9} is interpreted as
n−1
an−1 . . . a0 = ∑ ai · Z i .
i=0
1 We use the letter Z here because in German, our native language, the word for ‘ten’ is
‘zehn’ and the word for ‘toes’ is ‘Zehen’, thus it’s almost the same.
12 2 Understanding Decimal Addition

Substituting n = 2, a1 = 1, and a0 = 0 we can derive the proof of 9 + 1 = 10. We


must however evaluate the formula obtained from the definition of decimal numbers;
in doing so, we need properties of exponentiation and multiplication:

10 = 1 · Z 1 + 0 · Z 0 (definition of decimal number)


= 1 · Z + 0 · 1 (properties of exponentiation)
= Z + 0 (properties of multiplication)
= Z (definition of addition)
= 9 + 1 (definition of Z).

Observe that addition and multiplication are taught in elementary school, whereas
exponentiation is only treated much later in high school. In this order we cannot
possibly fill the gaps in the proof above. Instead, one defines multiplication and ex-
ponentiation without relying on decimal numbers, as below.
Definition 5 (Multiplication).

x · 0 = 0,
x · S(y) = x · y + x.

Definition 6 (Exponentiation).

x0 = 1,
S(y)
x = xy · x.

By Lemma 2 we get

x · 1 = x · (S(0)) = x · 0 + x = 0 + x = x.

i.e., multiplication of x by 1 from the right results in x. In order to progress in the


proof of 9 + 1 = 10, we show the following.
Lemma 6. 1 · x = x.
Proof. by induction on x. For x = 0 we have

1·0 = 0

by the definition of multiplication.


For the induction step we can assume the induction hypothesis 1 · x = x and show

1 · S(x) = 1 · x + 1 (definition of multiplication)


= x + 1 (induction hypothesis).

Using Lemma 6, we get

x1 = xS(0) = x0 · x = 1 · x = x. (1)

We finish the section by showing a classical identity for exponentiation.


2.3 Final Remarks 13

Lemma 7. xy+z = xy · xz .

Proof. by induction on z. For z = 0 we have (leaving the justification of the steps as


an exercise)
xy+0 = xy = xy · 1 = xy · x0 .
For the induction step we assume the induction hypothesis xy+z = xy · xz and show

xy+S(z) = xS(y+z) (definition of addition)


= x(y+z) · x (definition of exponentiation)
= (xy · xz ) · x (induction hypothesis)
= xy · (xz · x) (associativity of multiplication, Lemma 5)
= xy · (xS(z) ) (definition of exponentiation).

2.3 Final Remarks

Using decimal addition as an example, we have tried to convince the reader that
being used to something that has not gone wrong yet and understanding it are very
different things. We have reviewed Peano’s axioms and have warned the reader that
computer arithmetic does not satisfy them. We have formally defined the value of
decimal numbers; this will turn out to be helpful, when we study binary arithmetic
and construct adders later. We have practiced proofs by induction and we have shown
how to derive laws of computation without referring to decimal representations.
We recommend to remember as key technical points:
• Peano’s axioms.
• the inductive definition of addition as iterated counting

x + 0 = x,
x + (y + 1) = (x + y) + 1.

• for parties: 2 + 1 = 3, 1 + 2 = 3, 9 + 1 = 10. Which are theorems?


Everything else is easy. Rules of computation are shown by induction; what else
can you do with an inductive definition of addition? And of course multiplication is
defined by iterated addition and exponentiation is defined by iterated multiplication.
A proof of the usual rules of computation governing addition, subtraction, multi-
plication, and division of the rational numbers and/or the real numbers can be found
in [Lan30]. The recursive definitions of addition, multiplication, and exponentia-
tion that we have presented also play a central role in the theory of computabil-
ity [Rog67, Pau78].
14 2 Understanding Decimal Addition

2.4 Exercises

1. For each of the following statements, point out which ones are definitions and
which ones are theorems for x, y ∈ N. Prove the theorems using only definitions
and statements proven above.
a) x = x + 0,
b) x = 0 + x,
c) x + (y + 1) = (x + y) + 1,
d) (x + 1) + y = (y + x) + 1,
e) x · 0 = 0,
f) 0 · x = 0,
g) 5 + 1 = 6,
h) 7 + 4 = 11.
2. Prove Lemma 5.
3. Prove the following properties of exponentiation for a, b, c ∈ N.

(a · b)c = ac · bc ,
(ab )c = ab·c .

4. We define a modified subtraction of natural numbers

−0 : N → N

by (
x − y, x ≥ y,
x −0 y =
0, otherwise.
Give an inductive definition of this function, starting with the successor function
S(x).
Hint: clearly you want to define a modified decrement function D(x) = x −0 1
first. Do this by an inductive definition.
3
Basic Mathematical Concepts

After a few short comments on implicit quantification, in Sect. 3.1 we treat very
basic definitions like intervals [i : j] of natural numbers. We consider different ways
to number sequence elements; usually sequence elements are numbered from left to
right starting with index 1, but in number representations it is much nicer to number
them from right to left starting with index 0. We elaborate very briefly on the formal
consequences of this. We also introduce vector operations on bit strings.
Section 3.2 on modulo arithmetic was included for several reasons. i) The nota-
tion mod k is overloaded: it is used to denote both the congruence relation modulo a
number k or the operation of taking remainder of integer division by k. We prefer our
readers to clearly understand this. ii) Fixed-point arithmetic is modulo arithmetic, so
we will clearly have to make use of it. The most important reason however is iii) to
give with Lemma 12 a tiny twist to a trivial result about the solution of congruences
mod k by applying it not only with the standard set [0 : k − 1] of representatives. In
Sect. 7.2 this will yield a very quick proof of the remarkable fact that addition/sub-
traction of binary numbers and of two’s complement numbers is done by exactly the
same hardware1 .
The very short Sect. 3.3 on geometric and arithmetic sums is simply there to
remind the reader of the proof of the classical formulas for the computation of ge-
ometric and arithmetic sums, which are much easier to memorize than the formula
itself. The formula for geometric sums is later used to bound the range of numbers
represented by bit strings, and the formula for arithmetic sums is used in the correct-
ness proof of an example program to show the absence of overflows.
Section 3.4 contains some very basic graph theory. Lemma 14 contains the result
that path length in directed acyclic graphs is bounded. This little result is remarkably
important for several reasons: i) its short proof is a great illustration of the pigeonhole
principle; ii) it justifies the definition of depth of nodes in directed acyclic graphs.
This is later used to show — by an induction on the depth of nodes — that the
behavior of switching circuits is well defined; iii) it is used to show the equivalence
of a recursive definition of rooted trees and the classical graph theoretic definition of

1 Except for the computation of overflow and negative signals.

© Springer International Publishing Switzerland 2016 15


W.J. Paul et al., System Architecture, DOI 10.1007/978-3-319-43065-2_3
16 3 Basic Mathematical Concepts

rooted trees. This result is later used to relate our formalization of derivation trees
for context-free grammars with classical graph theory.
Except for Sect. 3.2 the chapter contains fairly simple reference material. We
recommend the reader should glance at it, notice what is there, but worry later about
detailed understanding. In lectures we reorder the topics; initially we just sketch the
material of this chapter, and elaborate details when it is used.

3.1 Basics
3.1.1 Implicit Quantification

One uses the quantifiers ∃ and ∀ as abbreviations of ‘there exists’ and ‘for all’. Quan-
tifiers range over sets. So one writes

∀x, y ∈ N : x + y = y + x.

If the set over which one quantifies is clear from the context, one usually does not
specify this set in the quantifier again. Thus one could also write

∀x, y : x + y = y + x.

Rules of computation are often formulated in an even shorter way, for instance

x + y = y + x.

This is an example of a general principle. Formulas without quantifiers are often


treated like statements. The convention is that one assumes all variables in the for-
mula to be universally quantified. So, in a context where we speak about real numbers

x·x ≥ 0

is interpreted as
∀x ∈ R : x · x ≥ 0,
which is true, whereas in a context where we speak about the complex numbers, it is
interpreted as
∀x ∈ C : x · x ≥ 0,
which is false because i2 = −1.
Implicit quantification is very frequently used. It keeps notation uncluttered and
saves time at the blackboard. We will return to implicit quantification in Sect. 4.3.
3.1 Basics 17

3.1.2 Numbers and Sets

We denote by
N = {0, 1, 2, . . .}
the set of natural numbers including zero, by

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

the set of integers. Unless explicitly stated otherwise we identify natural numbers
with their decimal representation, as we always have done since elementary school.
We denote by
B = {0, 1}
the set of Boolean values. We also use the term bit to refer to a Boolean value.
For integers i, j with i < j we define the interval of integers from i to j by

[i : j] = {i, i + 1, . . . , j}.

Strictly speaking, definitions using three dots are never precise; they resemble intel-
ligence tests, where the author hopes that all readers who are forced to take the test
arrive at the same solution. Usually, one can easily find a corresponding and com-
pletely precise recursive definition (without three dots) in such a situation. Thus, we
define [i : j] in a rigorous way as

[i : i] = {i},
[i : j + 1] = [i : j] ∪ { j + 1}.

The Hilbert ∈-Operator ∈A picks an element from a set A. Applied to a singleton set,
it returns the unique element of the set:

∈{x} = x.

For finite sets A, we denote by #A the cardinality, i.e., the number of elements in A.
Given a function f operating on a set A and a set A1 ⊆ A, we denote by f (A1 ) the
image of set A1 under function f , i.e.,

f (A1 ) = { f (a) | a ∈ A1 }.

For a few complexity arguments in this book we use big O notation for comparing
the asymptotic growth of functions f , g : N → N.

f = O(g) ↔ ∃N0 ∈ N, c > 0∀n ≥ N0 : f (n) ≤ c · g(n).

In computer science logarithms are to the base two unless explicitly stated otherwise.
This text is no exception.
Another random document with
no related content on Scribd:
in South Africa, and to produce what, thank God! he had failed
in producing—a racial war." Mr. Chamberlain retorted that Sir
William Harcourt's attitude was unpatriotic and injurious to
the cause of peace. He denied aggressiveness in the policy of
the government, asserting that the South African Republic had
been spending millions on armaments imported from abroad, in
view of which the strengthening of the British garrison at the
Cape by an additional regiment and three batteries was no
unreasonable measure. Mr. Balfour, also, begged the House and
the country to believe that the troops were sent only as a
measure of precaution, to maintain admitted rights.

{478}

SOUTH AFRICA: The Transvaal: A. D. 1897 (May-October).


The British assertion of suzerainty and declination of
proposal to arbitrate disagreements.

On the 7th of May, 1897, the Acting State Secretary of the


South African Republic addressed to the British Agent at
Pretoria a communication of great length, reviewing the
positions taken by Mr. Chamberlain in his several arraignments
of the government of the Republic for alleged violation of the
London Convention of 1884, and proposing an arbitration of the
questions involved. "The complaint," he wrote, "which Her
British Majesty's Government has advanced in an unmistakably
pronounced manner over an actual or possible breach of the
Convention has deeply grieved this Government, as it thinks
that it has fulfilled its obligations. It sees in the
fulfilment of the mutual obligations under the Convention one
of the best guarantees for the maintenance of a mutual good
understanding and for the promotion of reciprocal confidence.
To this good understanding and that confidence, however,
severe shocks have been given by events which cannot be
lightly forgotten. And if it were not that this Government
wishes to guard itself against adopting a recriminating tone,
it might put the question whether, for example, the incursion
of Dr. Jameson, whether considered as a breach of the
Convention or a grievance, is not of immeasurably greater
importance than the various matters adduced by Her British
Majesty's Government would be, even if the contention that
they constitute breaches of the Convention could be accepted.
There should, in the view of this Government, be a strong
mutual endeavour to restore the shocked confidence and to calm
the excited spirit which this Government with sincere regret
sees reigning throughout almost the whole of South Africa.
This Government is anxious to co-operate for this end, for the
desire of the Republic, with the maintenance of its
independence and rights, is for peace, and where for the
reasons given it has been unable to entertain the proposal of
Her British Majesty's Government in the matter of the Aliens
Law,—and it appears very difficult to arrive at a solution of
the question by means of correspondence,—it wishes to come to
a permanent good understanding along a peaceful course, not
only with respect to its undisturbed right to make an alien
law, but also with regard to all points touching the
Convention which are referred to in the two Despatches under
reply by Her British Majesty's Government. While it respects
the opinion of Her British Majesty's Government, it takes the
liberty, with full confidence in the correctness of its own
views, to propose to Her British Majesty's Government the
principle of arbitration with which the honourable the First
Volksraad agrees, in the hope that it will be taken in the
conciliatory spirit in which it is made. …

"Although this Government is firmly convinced that a just and


impartial decision might be obtained even better in South
Africa than anywhere else, it wishes, in view of the
conflicting elements, interests, and aspirations, which are
now apparent in South Africa, and in order to avoid even the
appearance that it would be able or desire to exercise
influence in order to obtain a decision favourable to it, to
propose that the President of the Swiss Bondstate, who may be
reckoned upon as standing altogether outside the question, and
to feel sympathy or antipathy neither for the one party nor
for the other, be requested to point out a competent jurist,
as has already oftener been done in respect of international
disputes. The Government would have no objection that the
arbitrator be subject to a limitation of time, and gives the
assurance now already that it will willingly subject itself to
any decision if such should, contrary to its expectation, be
given against it. The Government repeats the well-meant wish
that this proposal may find favour with Her British Majesty's
Government, and inasmuch as the allegations of breaches of the
Convention find entrance now even in South Africa, and bring
and keep the feelings more and more in a state of suspense,
this Government will be pleased if it can learn the decision
of Her Majesty's Government as soon as possible."

Mr. Chamberlain's reply to this proposal was not written until


the 16th of the following October, when he, in turn, reviewed,
point by point, the matters dealt with, in the despatch of Mr.
Van Boeschoten. With reference to the Jameson raid he said: "Her
Majesty's Government note with satisfaction that the
Government of the South African Republic see in the fulfilment
of the mutual obligations under the London Convention one of
the best guarantees for the maintenance of a mutual
understanding and for the promotion of reciprocal confidence.
Her Majesty's Government have uniformly fulfilled these
obligations on their part, and they must strongly protest
against what appears to be an implication in the Note under
consideration that the incursion of Dr. Jameson can be
considered as either a breach of the Convention by Her
Majesty's Government or a grievance against them. That
incursion was the act of private individuals unauthorised by
Her Majesty's Government, and was repudiated by them
immediately it became known. The immense importance to the
Government of the South African Republic of that repudiation,
and of the proclamation issued by the High Commissioner under
instructions from Her Majesty's Government, is recognised
throughout South Africa. Her Majesty's Government maintain
strongly that since the Convention of 1881 there has never
been any breach or even any allegation of a breach on their
part of that or the subsequent Convention, and, as the subject
has been raised by the implied accusation contained in the
Note under consideration, Her Majesty's Government feel
constrained to contrast their loyal action in the case of the
Jameson raid with the cases in which they have had cause to
complain that the Government of the South African Republic
failed to interfere with, if they did not countenance,
invasions of the adjacent territories by its burghers in
violation of the Convention, and they feel bound to remind the
Government of the Republic that in one of these cases Her
Majesty's Government were compelled to maintain their rights
by an armed expedition at the cost of about one million
sterling, for which no compensation has ever been received by
them."

Concerning the proposal of arbitration, the reply of the


British colonial secretary was as follows: "In making this
proposal the Government of the South African Republic appears
to have overlooked the distinction between the Conventions of
1881 and 1884 and an ordinary treaty between two independent
Powers, questions arising upon which may properly be the
subject of arbitration.
{479}
By the Pretoria Convention of 1881 Her Majesty, as Sovereign
of the Transvaal Territory, accorded to the inhabitants of
that territory complete self-government subject to the
suzerainty of Her Majesty, her heirs and successors, upon
certain terms and conditions and subject to certain
reservations and limitations set forth in 33 articles, and by
the London Convention of 1884 Her Majesty, while maintaining
the preamble of the earlier instrument, directed and declared
that certain other articles embodied therein should be
substituted for the articles embodied in the Convention of
1881. The articles of the Convention of 1881 were accepted by
the Volksraad of the Transvaal State, and those of the
Convention of 1884 by the Volksraad of the South African
Republic. Under these Conventions, therefore, Her Majesty
holds towards the South African Republic the relation of a
suzerain who has accorded to the people of that Republic
self-government upon certain conditions, and it would be
incompatible with that position to submit to arbitration the
construction of the conditions on which she accorded
self-government to the Republic. One of the main objects which
Her Majesty's Government had in view was the prevention of the
interference of any foreign Power between Her Majesty and the
South African Republic, a matter which they then held, and
which Her Majesty's present Government hold, to be essential
to British interests, and this object would be defeated by the
course now proposed. The clear intention of Her Majesty's
Government at the time of the London Convention, that
questions in relation to it should not be submitted to
arbitration, is shown by the fact that when the delegates of
the South African Republic, in the negotiations which preceded
that Convention, submitted to Her Majesty's Government in the
first instance (in a letter of the 26th of November, 1883,
which will be found on page 9 of the Parliamentary Paper C.
3947 of 1884) the draft of a treaty or convention containing
an arbitration clause, they were informed by the Earl of Derby
that it was neither in form nor in substance such as Her
Majesty's Government could adopt."

Great Britain, Papers by Command.


C.—8721, 1898.

SOUTH AFRICA: Natal: A. D. 1897 (December).


Annexation of Zululand.

See (in this volume)


AFRICA: A. D. 1897 (ZULULAND).

SOUTH AFRICA: Cape Colony: A. D. 1898.


The position of political parties.
The Progressives and the Afrikander Bund.

"The present position of parties at the Cape is as unfortunate


and as unwarranted as any that the severest critic of
Parliamentary institutions could have conjured up. … The Cape
has always had the curse of race prejudice to contend with.
Time might have done much to soften, if not to expunge it, if
home-made stupidities had not always been forthcoming to goad
to fresh rancour. The facts are too well known to need
repetition. It is true not only of the Transvaalers that 'the
trek has eaten into their souls,' and up to the time of
emancipation and since, every conceivable mistake has been
committed by those in authority. Thus, when the breach was, to
all appearances, partly healed, the fatal winter of 1895 put
back the hands of the clock to the old point of departure. As
Englishmen, our sympathies are naturally with the party that
is prevalently English, and against the party that is
prevalently Dutch; but to find a real line of political
difference between them other than national sentiment requires
fine drawing. … According to our lines of cleavage both
Bondsmen [Afrikander Bund] and Progressives are Conservatives
of a decided type. Practically they are agreed in advocating
protective duties on sea-borne trade, although in degree they
differ, for whilst the Bond would have imposts as they are,
the Progressives wish to reduce the duties on food stuffs to
meet the grievance of the urban constituencies, and might be
induced to accord preferential treatment to British goods. On
the native question neither party adopts what would in England
be considered an 'advanced' programme, for education is not
made a cardinal point, and they would equally like, if
possible, to extend the application of the Glen Grey Act,
which, by levying a tax on the young Kaffirs who have not a
labour certificate, forces them to do some service to the
community before exercising their right of 'putting the
spoon,' as the phrase is, 'into the family pot.' Neither party
wishes to interfere with the rights of property or the
absolute tenure of land under the Roman-Dutch law. A tax on
the output of diamonds at Kimberley has been advocated by some
members of the Bond as a financial expedient, but it is
understood to have been put forward rather as a threat against
Mr. Rhodes personally than as a measure of practical politics.
Questions of franchise are tacitly left as they are, for no
responsible politicians wish to go back upon the enactment
which restricted the Kaffir vote to safe and inconsiderable
limits. The redistribution of seats was the subject of a Bill
upon which the last House was dissolved, after the rebuff that
the Ministry received upon a crucial division, but it has been
dealt with rather for practical than theoretical reasons. Two
schemes of redistribution have been formulated, and each has
been proposed and opposed with arguments directed to show the
party advantage to be derived. For political reform, in the
abstract, with or without an extension of the suffrage, there
is no sort of enthusiasm in any quarter. Railway
administration furnishes, no doubt, an occasional battle-field
for the two sides of the House. Roughly, the Progressives
favour the northern extension, and are willing to make
concessions in rates and charges to help on the new trade with
Rhodesia; whilst the Bond declare themselves against special
treatment of the new interests, and would spend all the money
that could be devoted to railway construction in the farming
districts of the colony itself. Mr. Rhodes, however, has
warned the Cape that any hostile action will be counteracted
by a diversion of traffic to the East, and it is unlikely that
any line of policy will be pursued that is likely to injure
the carrying trade of the southern ports. Between the
followers of Mr. Rhodes and the followers of Mr. Hofmeyr there
is no wide divergence of principle on public affairs of the
near future, so far as they have been or are to be the subject
of legislation; where the difference comes in is in the
attitude they severally assume towards the two republics and
the territories of the north, but when talk has to yield to
action it is improbable that there will be much in their
disagreement."
N. L. W. Lawson,
Cape Politics and Colonial Policy
(Fortnightly Review, November 1898).

{480}

SOUTH AFRICA: The Transvaal: A. D. 1898 (January-February).

Re-election of President Kruger.


Renewed conflict of the Executive with the Judiciary.
Dismissal of Chief-Justice Kotze.

The Presidential election in the South African Republic was


held in January and February, the polls being open from the 3d
of the former month until the 4th of the latter. President
Kruger was re-elected for a fourth term of five years, by
nearly 13,000 votes against less than 6,000 divided between
Mr. Schalk Burger and General Joubert, who were opposing
candidates. Soon afterwards, the conflict of 1897 between the
Judiciary and the Executive (see above: A. D. 1897,
JANUARY-MARCH), was reopened by a communication in which
Chief-Justice Kotze, of the High Court, called the attention
of the President to the fact that nothing had been done in
fulfilment of the agreement that the independence of the Court
and the stability of the Grondwet should both be protected by
law against arbitrary interference, and giving notice that he
considered the compromise then arranged to be ended. Thereupon
(February 16) President Kruger removed the judge from his
office and placed the State Attorney in his seat. Justice
Kotze denied the legality of the removal, and adjourned his
court sine die. In a speech at Johannesburg, some weeks
afterwards, he denounced the action of President Kruger with
great severity, saying: "I charge the President, as head of
the State, with having violated both the constitution and the
ordinary laws of the land; with having interfered with the
independence of the High Court; and invaded and imperilled the
rights and liberties of everyone in the country. The
guarantees provided by the constitution for the protection of
real and personal rights have disappeared, and these are now
dependent on the 'arbitrium' of President Kruger."

SOUTH AFRICA: Rhodesia and the British South Africa Company:


A. D. 1898 (February).
Reorganization.

In February, the British government announced the adoption of


plans for a reorganization of the British South Africa Company
and of the administration of its territories. The Company,
already deprived of military powers, was to give up, in great
part, but not wholly, its political functions. It was still to
appoint an Administrator for Rhodesia south of the Zambesi,
and to name the majority of members in a council assisting
him, so long as it remained responsible for the expenses of
administration; but, by the side of the Administrator was to
be placed a Resident Commissioner, appointed by the Crown, and
over both was the authority of the High Commissioner for South
Africa, to whom the Resident Commissioner made reports. At
home the status of the Board of Directors was to be
considerably altered. The life directorships were to be
abolished, and the whole Board of Directors in future to be
elected by the shareholders,—any official or director removed
by the Secretary of State not being eligible without his
consent. The Board of Directors was to communicate all
minutes, etc., to the Secretary of State, and he to have the
power of veto or suspension. Finally, the Secretary of State
was to have full powers to inspect and examine all documents;
Colonial Office officials named by him were, in effect, to
exercise powers like those of the old Indian Board of Control.

SOUTH AFRICA: Cape Colony: A. D. 1898 (March-October).

Election in favor of the Afrikander Bund.


Change in the government.
Elections to the Upper House of the Cape Parliament, in March,
gave the party called the Progressives, headed by Mr. Rhodes, a
small majority over the Afrikander Bund—more commonly called
the Bond. The Parliament opened in May, and the Progressive
Ministry, under Sir Gordon Sprigg, was defeated in the Lower
House in the following month, on a bill to create new
electoral divisions. The Ministry dissolved Parliament and
appealed to the constituencies, with the result of a defeat on
that appeal. The Bond party won in the elections by a majority
of two, which barely enabled it to carry a resolution of want
of confidence in the government when Parliament was
reassembled, in October. The Ministry of Sir Gordon Sprigg
resigned, and a new one was formed with Mr. Schreiner at its
head.

SOUTH AFRICA: The Transvaal: A. D. 1898-1899.


Continued dispute with the British Government
concerning Suzerainty.

During 1898 and half of 1899, a new dispute, raised by Mr.


Chamberlain's emphatic assertion of the suzerainty of Great
Britain over the South African Republic, went on between the
British Colonial Office and the government at Pretoria.
Essentially, the question at issue seemed to lie between a
word and a fact and the difference between the disputants was
the difference between the meanings they had severally drawn
from the omission of the word "suzerainty" from the London
Convention of 1884. On one side could be quoted the report
which the Transvaal deputation to London, in 1884, had made to
their Volksraad, when they brought the treaty back, and
recommended that it be approved. The treaty, they reported,
"is entirely bilateral [meaning that there were two sides in
the making of it] whereby your representatives were not placed
in the humiliating position of merely having to accept from a
Suzerain Government a one-sided document as rule and
regulation, but whereby they were recognized as a free
contracting party. It makes, then, also an end of the British
suzerainty, and, with the official recognition of her name,
also restores her full self-government to the South African
Republic, excepting one single limitation regarding the
conclusion of treaties with foreign powers (Article 4). With
the suzerainty the various provisions and limitations of the
Pretoria Convention which Her Majesty's Government as suzerain
had retained have also, of course, lapsed."

On the other side, Mr. Chamberlain could quote with effect


from a speech which Lord Derby, then the British Colonial
Secretary, who negotiated the Convention of 1884 with the Boer
envoys, made on the 17th of March, that year, in the House of
Lords. As reported in Hansard, Lord Derby had then dealt with
the very question of suzerainty, as involved in the new
convention, and had set forth his own understanding of the
effect of the latter in the following words: "Then the noble
Earl (Earl Cadogan) said that the object of the Convention had
been to abolish the suzerainty of the British Crown. The word
'suzerainty' is a very vague word, and I do not think it is
capable of any precise legal definition.
{481}
Whatever we may understand by it, I think it is not very easy
to define. But I apprehend, whether you call it a
protectorate, or a suzerainty, or the recognition of England
as a paramount Power, the fact is that a certain controlling
power is retained when the State which exercises this
suzerainty has a right to veto any negotiations into which the
dependent State may enter with foreign Powers. Whatever
suzerainty meant in the Convention of Pretoria, the condition
of things which it implied still remains; although the word is
not actually employed, we have kept the substance. We have
abstained from using the word because it was not capable of
legal definition, and because it seemed to be a word which was
likely to lead to misconception and misunderstanding."

Great Britain,
Papers by Command: C. 9507, 1899, pages 24 and 34.
SOUTH AFRICA: The Transvaal: A. D. 1899 (March).
Petition of British subjects to the Queen.

A fresh excitement of discontent in the Rand, due especially


to the shooting of an Englishman by a Boer policeman, whom the
Boer authorities seemed disposed to punish lightly or not at
all, led to the preparation of a petition to the British
Queen, from her subjects in the South African Republic,
purporting to be signed in the first instance by 21,684, and
finally by 23,000. The genuineness of many of the signatures
was disputed by the Boers, but strenuously affirmed by those
who conducted the circulation of the petition. It set forth
the grievances of the memorialists at length, and prayed Her
Majesty to cause them to be investigated, and to direct her
representative in South Africa to take measures for securing
from the South African Republic a recognition of their rights.
The petition was forwarded to the Colonial Office on the 28th
of March.

Great Britain, Papers by Command: 1899, C. 9345.

SOUTH AFRICA: The Transvaal: A. D. 1899 (May-June).


The Bloemfontein Conference between President Kruger and
the British High Commissioner, Sir Alfred Milner.

There seems to be no mode in which the questions at issue


between the British and the Boers, and the attitude of the two
parties, respectively, in their contention with each other,
can be represented more accurately than by quoting essential
parts of the official report of a formal conference between
President Kruger and the British High Commissioner in South
Africa, Sir Alfred Milner, which was held at Bloemfontein, the
capital of the Orange Free State, during five days, May
31-June 5, 1899. The meeting was arranged by President Steyn,
of the Orange Free State, with a view to bringing about an
adjustment of differences by a free and full discussion of
them, face to face. In the official report of the
conversations that occurred, from which we shall quote, the
remarks of President Kruger are given as being made by the
"President," and those of the High Commissioner as by "His
Excellency." The latter, invited by the President to speak
first, said:

"There are a considerable number of open questions between Her


Majesty's Government and the Government of the South African
Republic on which there is at present no sign of agreement. On
the contrary, disagreements seem to increase as time goes on.
… In my personal opinion the cause of many of the points of
difference, and the most serious ones, arises out of the
policy pursued by the Government of the South African Republic
towards the Uitlander population of that Republic among whom
many thousands are British subjects. This policy, the bitter
feeling it engenders between the Government and a section of
Uitlanders, and the effect of the resulting tension in South
Africa, and the feeling of sympathy in Great Britain, and even
throughout the British Empire generally, with the Uitlander
population, creates an irritated state of public opinion on
both sides, which renders it much more difficult for the two
Governments to settle their differences amicably. It is my
strong conviction that if the Government of the South African
Republic could now, before things get worse, of its own motion
change its policy towards the Uitlanders, and take measures
calculated to content the reasonable people among them, who,
after all, are a great majority, such a course would not only
strengthen the independence of the Republic but it would make
such a better state of feeling all round that it would become
far easier to settle outstanding questions between the two
Governments. … The President, in coming here, has made a
reservation as to the independence of the Republic. I cannot
see that it is in any way impairing the independence of the
Republic for Her Majesty's Government to support the cause of
the Uitlanders as far as it is reasonable. A vast number of
them are British subjects. If we had an equal number of
British subjects and equally large interests in any part of
the world, even in a country which was not under any
conventional obligations to Her Majesty's Government we should
be bound to make representations to the Government in the
interests of Her Majesty's subjects, and to point out that the
intense discontent of those subjects stood in the way of the
cordial relations which we desire to exist between us. I know
that the citizens of the South African Republic are intensely
jealous of British interference in their internal affairs.
What I want to impress upon the President is that if the
Government of the South African Republic of its own accord,
from its own sense of policy and justice, would afford a more
liberal treatment to the Uitlander population, this would not
increase British interference, but enormously diminish it. If
the Uitlanders were in a position to help themselves they
would not always be appealing to us under the Convention. …

"President.—I shall be brief. I have come with my commission,


in the trust that Your Excellency is a man capable of
conviction, to go into all points of difference. … I should
like His Excellency to go point by point in this discussion,
so that we can discuss each point that he thinks requires
attention, not with a view to at once coming to a decision,
but to hear each side, and we can go back on any point if
necessary, and see if we can arrive at an understanding. I
would like to give concessions as far as is possible and
practicable, but I want to speak openly, so that His
Excellency may be able to understand. I should like to say
that the memorials placed before Her Majesty's Government came
from those who do not speak the truth. I mean to convey that
we do give concessions wherever we think it practicable to do
so, and after we have discussed it in a friendly way Your
Excellency will be able to judge whether I or the memorialists
are right. I have said that if there are any mistakes on our
side, we are willing to discuss them. Even in any matter
concerning internal affairs I would be willing to listen to
his advice if he said it could be removed in this way or that
way. But when I show him that by the point we may be
discussing our independence may be touched, I trust he will be
open to conviction on that subject. …

{482}

"His Excellency.—I think the point which it would be best to


take first, if the President agrees, … would be the Franchise.
… There are a number of questions more or less resting upon
that. … I should like to know a little more about the
President's views. I want to know more because if I were to
begin and say I want this, that, and the other, I know I
should be told this was dictation. I do not want to formulate
a scheme of my own, but I can, if necessary.

"President.—As long as I understand that it is meant in a


friendly manner, and you mean to give hints, I won't take it
that they are commands. It has already been arranged that you
give me friendly hints and advice, and I will not take it as
dictation, even though it should be on points on which I
should consider you have no right to interfere. … I would like
you to bear one point in view, namely, that all kinds of
nations and languages, of nearly all powers, have rushed in at
the point where the gold is to be found. In other countries …
there are millions of old burghers, and the few that come in
cannot out-vote the old burghers, but with us, those who
rushed in to the gold fields are in large numbers and of all
kinds, and the number of old burghers is still insignificant;
therefore we are compelled to make the franchise so that they
cannot all rush into it at once, and as soon as we can assure
ourselves by a gradual increase of our burghers that we can
safely do it, our plan was to reduce the time for anyone there
to take up the franchise, and that is also my plan. … As His
Excellency doubtless knows, I have proposed to the Volksraad
that the time should be reduced by five years, and gradually
as more trusted burghers join our numbers, we can, perhaps, go
further. There are a number who really do not want the
franchise, but they use it as pretext to egg on people with
Her Majesty. … You must remember, also, on this subject, that
the burghers in our Republic are our soldiers, who must
protect the land, and that we have told these men to come and
fight when we have had difficulties with the Kaffirs. They
wanted the vote, but they would not come and fight. Those who
were willing to help obtained the franchise, but it appears
that many do not want to have it.

"His Excellency.—They did not want to take the obligations


without the rights of citizenship, and in that I sympathize
with them. If they should obtain that right, then naturally
they would have to take those burdens upon them.

"President.—Those who want the franchise should bear the


burdens.

"His Excellency.—Yes. Immediately they get the franchise they


take upon themselves the obligations connected therewith."

[From this the talk wandered to the subject of commandeering,


until the High Commissioner brought it back to the franchise
question.]

"His Excellency.—If I made a proposal to admit strangers under


such conditions as to swamp the old burghers it would be
unreasonable. But the newcomers have, at present, no influence
on the legislation of the Republic, which makes an enormous
difference. They haven't got a single representative. The
First Volksraad consists of 28 members, and not one member
represents the feelings of the large Uitlander population.

"President.—Men from any country could after two years vote


for the Second Volksraad, and after two years more sit in the
Second Raad. There are Englishmen who have obtained the full
franchise in that way, and are eligible for the Volksraad. And
now I have proposed to shorten the last ten years of the
period required for the full franchise and make it five years.

"His Excellency.—There are a great many objections of the


gravest kind to the process by which men may now obtain
burgher rights. First of all, before he can begin the process
of gradually securing burgher rights—which will be completed
in 14 years at present, and in 9 years according to the
President—he has to forswear his own allegiance. Take the case
of a British subject, which interests me most. He takes the
oath, and ceases to be a British subject by the mere fact of
taking that oath; he loses all the rights of a British
subject, and he would still have to wait for 12 years, and
under the new plan 7 years, before he can become a full
citizen of the Republic. British subjects are discouraged by
such a law from attempting to get the franchise. Even if they
wanted to become citizens, they would not give up their
British citizenship on the chance of becoming in 12 years
citizens of the Republic.

"President.—The people are the cause of that themselves. In


1870 anyone being in the land for one year had the full
franchise.

"His Excellency.—That was very liberal.

"President.—In 1881, after the war of independence, some of


our officials and even members of our Raad then said that they
were still British subjects, although they had taken the oath
of allegiance, and I had to pay back, out of the £250,000,
what I had commandeered from them. That was the reason the
oath had to be altered. …

"His Excellency.—In 1882, after all this had happened, there


was a franchise law in the Transvaal, which demanded five
years' residence, but it did not require the oath that is now
taken. It required a simple declaration of allegiance to the
State, though all this that the President refers to happened
before. Why was not it necessary to introduce this alteration
then?

"President.—The people who, before the annexation, had taken


that oath, but had not forsworn their nationality, 1887, sent
a lying memorial, as they are sending lying memorials now, to
say that everybody was satisfied, as they now say that
everybody is dissatisfied.

"His Excellency.—I think I must just explain a little more


clearly my views on the point we are now discussing. … I think
it is unreasonable to ask a man to forswear one citizenship
unless in the very act of giving up one he gets another, and I
think it is also unnecessary to ask him to do more than take
an oath of fealty to the new State, of willingness to obey its
laws and to defend its independence, when it is known and
certain that the taking of that oath deprives him of his
existing citizenship. I think the oath should be a simple oath
of allegiance, and that it should not be required of a man
until the moment he can get full rights in a new State. Now
that was the position under the law of 1882, and all these
reasons which the President has been giving are based on what
happened before that.
{483}
Why were they not considered and acted upon when the law of
1882 was made? … As for the period required to qualify for the
full franchise, I do not see why the length of time should be
longer in the South African Republic than in any other South
African State. They are all new countries. In the new country
which is springing up in the north, and which is getting a new
Constitution this year, the period is one year. The people who
have conquered that country for the white race may find that
the newcomers are more numerous than they are. But I do not
expect that anything like that will be done in the South
African Republic; something far short of that would be
reasonable. What I do think and desire, and that is the object
of my suggestion, is this: that the numerous foreign population
engaged in commerce and industry—to which the country, after
all, owes its present great position in wealth and influence—
should have a real share in the government of the Republic,
not to over-rule the old burghers—not at all—but to share the
work of Government with them, to give them the benefit of
their knowledge and experience, which is in many cases greater
than that of the old burghers, so that through their gradual
co-operation a time may come when, instead of being divided
into two separate communities they will all be burghers of the
same State. It is not enough that a few people should be let
in. It is obvious, however, that you could not let in the
whole crowd, without character or anything—I do not ask
it—but you want such a substantial measure that in elections
of members of the Volksraad the desires of the new industrial
population should have reasonable consideration. They have not
got it now, and when the questions that interest them come
before the Volksraad it is too evident that they are discussed
from an outside point of view. The industrial population are
regarded as strangers. … I do not want to swamp the old
population, but it is perfectly possible to give the new
population an immediate voice in the legislation, and yet to
leave the old burghers in such a position that they cannot
possibly be swamped.

"President.—I hope you will be open to conviction on that


point. I would like to convince you on the subject, and to
show you that it would be virtually to give up the
independence of my burghers. In the Republic the majority of
the enfranchised burghers consider they are the masters. Our
enfranchised burghers are probably about 30,000, and the
newcomers may be from 60,000 to 70,000, and if we give them
the franchise to-morrow we may as well give up the Republic. I
hope you will clearly see that I shall not get it through with
my people. We can still consult about the form of oath, but we
cannot make the time too short, because we would never get it
through with the people—they have had bitter experience. I
hope His Excellency will think about what I have said, and
weigh it well.

"His Excellency.—I see your point, and want to meet it.

"President.—I will think over what has been said, and will try
and meet every difficulty.

At the opening of the Conference on the second day the


President spoke of reports of an increase of British forces in
South Africa, which the High Commissioner assured him were
untrue. The latter in turn referred to accounts that had
appeared of an extensive purchase of arms in the Transvaal;
and was assured by the President that the armament of the
burghers was only for their proper preparation to deal with
the surrounding natives. The President then produced a
memorial purporting to be signed by 21,000 Uitlanders,
contradictory of the representations contained in the memorial
sent to the Queen in March (see above). After discussion upon
this, the conversation returned to the question of the
franchise.

"His Excellency.—What makes this whole discussion so difficult


is the intense prejudice on the side of the present burghers,
and their intense suspicion of us. They think Her Majesty's
Government wants to get their country back in one way or
another. Her Majesty's Government does not; but what it does
desire is that it should have such a state of rest in the
country as will remove causes of friction and difficulty
between the Republic and Her Majesty's possessions in South
Africa, and the whole of the British Empire, and my
suggestions here are directed to that end. I do not want to
say it over and over again, I say it once for all. …

"President.—I should like to make a slight explanation to His


Excellency. His Excellency yesterday mentioned that in some
States those going in from outside speedily got burgher
rights, but he must not forget, as I said before, they are

You might also like