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 161 — #169<br />

6.2. The Invariant Principle 161<br />

y<br />

2<br />

1<br />

0<br />

0 1 2 3<br />

x<br />

Figure 6.2<br />

The Diagonally Moving Robot.<br />

can’t reach .1; 0/. This follows because the evenness of the sum of the coordinates<br />

is a property that is preserved by transitions. This is an example of a preserved<br />

invariant.<br />

This once, let’s go through this preserved invariant argument, carefully highlighting<br />

where induction comes in. Specifically, define the even-sum property of<br />

states to be:<br />

Even-sum..m; n// WWD Œm C n is even:<br />

! r of the diagonally-moving robot, if Even-<br />

Lemma 6.2.1. For any transition q<br />

sum(q), then Even-sum(r).<br />

This lemma follows immediately from the definition of the robot’s transitions:<br />

.m; n/ ! .m ˙ 1; n ˙ 1/. After a transition, the sum of coordinates changes by<br />

.˙1/ C .˙1/, that is, by 0, 2, or -2. Of course, adding 0, 2 or -2 to an even number<br />

gives an even number. So by a trivial induction on the number of transitions, we<br />

can prove:<br />

Theorem 6.2.2. The sum of the coordinates of any state reachable by the diagonallymoving<br />

robot is even.

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

Saved successfully!

Ooh no, something went wrong!