23.11.2013 Views

Obfuscation of Abstract Data-Types - Rowan

Obfuscation of Abstract Data-Types - Rowan

Obfuscation of Abstract Data-Types - Rowan

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.

CHAPTER 4. SPLITTING HEADACHES 87<br />

Base Case Suppose that xs = [ ]<br />

unsplit A (split A d [ ])<br />

= {definition <strong>of</strong> split A }<br />

unsplit A 〈d, [ ], [ ]〉 A<br />

= {definition <strong>of</strong> unsplit}<br />

[ ]<br />

Step Case Suppose that xs = y : ys and that ys satisfies Equation (4.26).<br />

Let n = 2d + m so that (d,m) = divMod n 2 then<br />

unsplit A (split A n (y : ys))<br />

= {definition <strong>of</strong> split A }<br />

unsplit A (cons A m y (split d ys))<br />

= {definition <strong>of</strong> unsplit A and Equation (4.25)}<br />

y : (unsplit A (split A d ys))<br />

= {induction hypothesis}<br />

y : ys<br />

Consider this definition:<br />

filter A p 〈n, [ ], [ ]〉 A = 〈n, [ ], [ ]〉 A<br />

filter A p xsp = if p h then cons A b h ysp else ysp<br />

where ysp = filter A p t<br />

(b,h,t) = headTail A xsp<br />

We would like this operation to correspond to the filter operation for lists, i.e.<br />

xs ❀ xsp ⇒ filter p xs ❀ filter A p xsp<br />

To show this, we can prove that<br />

filter p ys = unsplit A (filter A p (split A n ys))<br />

by structural induction on ys.<br />

The complexities <strong>of</strong> the augmented split operations are the same as for normal<br />

lists however most operations require some extra computations. Operations<br />

such as cons A and tail A need to perform some arithmetic and cat A and filter A<br />

need to compute headTail A .<br />

Using augmented split lists we develop two versions <strong>of</strong> the block split that<br />

allows us to introduce some randomness in the splits.<br />

4.4.1 Augmented Block Split<br />

We now briefly describe (without pro<strong>of</strong>s) a variation <strong>of</strong> the block split in which<br />

we store the decision value and the split components. We call this the augmented<br />

block splits — denoted by a subscript B. We would like<br />

xs ❀ 〈l,r〉 b(k) ⇒ xs ❀ 〈k,l,r〉 B

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

Saved successfully!

Ooh no, something went wrong!