15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

mapping ψb. This is the the same process we did for the logics; we are now doing it for number<br />

systems. However, here, we also want to ensure that the meaning mapping ψb is a bijection, since<br />

we want to define the arithmetics on the encodings by reference to The arithmetical operators on<br />

the unary natural numbers.<br />

We can look at this as a bootstrapping process, where the unary natural numbers constitute<br />

the seed system we build up everything from.<br />

Just like we did for string codes earlier, we build up the meaning mapping ψb on characters from<br />

Db first. To have a chance to make ψ bijective, we insist that the “character code” ϕb is is a<br />

bijection from Db and the first b unary natural numbers. Now we extend ϕb from a character code<br />

to a string code, however unlike earlier, we do not use simple concatenation to induce the string<br />

code, but a much more complicated function based on the arithmetic operations on unary natural<br />

numbers. We will see later 14 that this give us a bijection between Db + and the unary natural EdNote:14<br />

numbers.<br />

Commonly Used Positional Number Systems<br />

Example 408 The following positional number systems are in common use.<br />

name set base digits example<br />

unary N1 1 / ///// 1<br />

binary N2 2 0,1 01010001112<br />

octal N8 8 0,1,. . . ,7 630278<br />

decimal N10 10 0,1,. . . ,9 16209810 or 162098<br />

hexadecimal N16 16 0,1,. . . ,9,A,. . . ,F F F 3A1216<br />

Notation 409 attach the base of N to every number from N . (default: decimal)<br />

Trick: Group triples or quadruples of binary digits into recognizable chunks<br />

(add leading zeros as needed)<br />

1100011010111002 = 01102 00112 01012 11002 = 635C16<br />

<br />

616<br />

316<br />

516<br />

C16<br />

1100011010111002 = 1102 0012 1012 0112 1002 = 615348<br />

<br />

68<br />

18<br />

58<br />

38<br />

F 3A16 = F16<br />

<br />

316<br />

<br />

A16<br />

<br />

= 1111001110102, 47218 = 48 78 28 18 = 1001110100012<br />

<br />

11112 00112 10102 1002 1112 0102 0012 48<br />

c○: Michael Kohlhase 239<br />

We have all seen positional number systems: our decimal system is one (for the base 10). Other<br />

systems that important for us are the binary system (it is the smallest non-degenerate one) and<br />

the octal- (base 8) and hexadecimal- (base 16) systems. These come from the fact that binary<br />

numbers are very hard for humans to scan. Therefore it became customary to group three or four<br />

digits together and introduce we (compound) digits for them. The octal system is mostly relevant<br />

for historic reasons, the hexadecimal system is in widespread use as syntactic sugar for binary<br />

numbers, which form the basis for circuits, since binary digits can be represented physically by<br />

current/no current.<br />

Now that we have defined positional number systems, we want to define the arithmetic operations<br />

on the these number representations. We do this by using an old trick in math. If we have<br />

an operation fT : T → T on a set T and a well-behaved mapping ψ from a set S into T , then<br />

we can “pull-back” the operation on fT to S by defining the operation fS : S → S by fS(s) :=<br />

ψ −1 (fT (ψ(s))) according to the following diagram.<br />

14 EdNote: reference<br />

131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!