06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

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.

“mcs” — 2017/3/3 — 11:21 — page 223 — #231<br />

7.5. Induction in <strong>Computer</strong> <strong>Science</strong> 223<br />

Fact.<br />

.rs D uv AND jrj D juj/ IFF .r D u AND s D v/ (7.28)<br />

r .s t/ D .r s/ t (7.29)<br />

rev.st/ D rev.t/ rev.s/ (7.30)<br />

(a) Prove that s D rev.s/ <strong>for</strong> all s 2 RecPal.<br />

(b) Prove conversely that if s D rev.s/, then s 2 RecPal.<br />

Hint: By induction on n D jsj.<br />

Problem 7.8.<br />

Let m; n be integers, not both zero. Define a set of integers, L m;n , recursively as<br />

follows:<br />

Base cases: m; n 2 L m;n .<br />

Constructor cases: If j; k 2 L m;n , then<br />

1. j 2 L m;n ,<br />

2. j C k 2 L m;n .<br />

Let L be an abbreviation <strong>for</strong> L m;n in the rest of this problem.<br />

(a) Prove by structural induction that every common divisor of m and n also divides<br />

every member of L.<br />

(b) Prove that any integer multiple of an element of L is also in L.<br />

(c) Show that if j; k 2 L and k ¤ 0, then rem.j; k/ 2 L.<br />

(d) Show that there is a positive integer g 2 L that divides every member of L.<br />

Hint: The least positive integer in L.<br />

(e) Conclude that g from part (d) is gcd.m; n/, the greatest common divisor, of m<br />

and n.<br />

Problem 7.9.

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

Saved successfully!

Ooh no, something went wrong!