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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

step condition go through: we we can use the stronger inductive hypothesis in the proof of step<br />

case, which is simpler.<br />

Often the key idea in an induction proof is to find a suitable strengthening of the assertion to<br />

get the step case to go through.<br />

What can we do with unary natural numbers?<br />

So far not much (let’s introduce some operations)<br />

Definition 38 (the addition “function”) We “define” the addition operation ⊕ procedurally<br />

(by an algorithm)<br />

adding zero to a number does not change it.<br />

written as an equation: n ⊕ o = n<br />

adding m to the successor of n yields the successor of m ⊕ n.<br />

written as an equation: m ⊕ s(n) = s(m ⊕ n)<br />

Questions: to understand this definition, we have to know<br />

Is this “definition” well-formed? (does it characterize a mathematical object?)<br />

May we define “functions” by algorithms? (what is a function anyways?)<br />

c○: Michael Kohlhase 38<br />

Addition on unary natural numbers is associative<br />

Theorem 39 For all unary natural numbers n, m, and l, we have n⊕(m ⊕ l) = (n ⊕ m)⊕l.<br />

Proof: we prove this by induction on l<br />

P.1 The property of l is that n ⊕ (m ⊕ l) = (n ⊕ m) ⊕ l holds.<br />

P.2 We have to consider two cases base case:<br />

P.2.1.1 n ⊕ (m ⊕ o) = n ⊕ m = (n ⊕ m) ⊕ o<br />

P.2.2 step case:<br />

P.2.2.1 given arbitrary l, assume n⊕(m ⊕ l) = (n ⊕ m)⊕l, show n⊕(m ⊕ s(l)) = (n ⊕ m)⊕<br />

s(l).<br />

P.2.2.2 We have n ⊕ (m ⊕ s(l)) = n ⊕ s(m ⊕ l) = s(n ⊕ (m ⊕ l))<br />

P.2.2.3 By inductive hypothesis s((n ⊕ m) ⊕ l) = (n ⊕ m) ⊕ s(l)<br />

c○: Michael Kohlhase 39<br />

More Operations on Unary Natural Numbers<br />

Definition 40 The unary multiplication operation can be defined by the equations n⊙o = o<br />

and n ⊙ s(m) = n ⊕ n ⊙ m.<br />

Definition 41 The unary exponentiation operation can be defined by the equations<br />

exp(n, o) = s(o) and exp(n, s(m)) = n ⊙ exp(n, m).<br />

Definition 42 The unary summation operation can be defined by the equations o i=o ni =<br />

o and s(m) i=o ni = ns(m) ⊕ m i=o ni.<br />

23

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

Saved successfully!

Ooh no, something went wrong!