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

Create successful ePaper yourself

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

CHAPTER 5. SETS AND THE SPLITTING 97<br />

not very interesting from an obfuscation point <strong>of</strong> view because it is very similar<br />

to the unobfuscated operation — except for a reversal in the order <strong>of</strong> the split<br />

components.<br />

Since filter preserves ordering (i.e. (filter p xs) ✂ xs) then we can use the<br />

definition for minus for unordered lists:<br />

minus xs ys = filter (not · member ys) xs<br />

(note that this definition has quadratic complexity).<br />

Using this, we derive an operation minus asp that satisfies:<br />

minus asp xsp ysp = split asp (minus (unsplit asp xsp) (unsplit asp ysp))<br />

The right-hand <strong>of</strong> this equation becomes<br />

split asp (filter (not · member (unsplit asp ysp)) (unsplit asp xsp))<br />

Using Equation (5.1), we obtain<br />

minus asp xsp ysp =<br />

split asp (filter (not · member asp ysp) (unsplit asp xsp))<br />

(5.4)<br />

We derive minus asp by induction on xsp.<br />

Base Case Suppose that xsp = 〈[ ], [ ]〉 asp then<br />

split asp (filter (not · member asp ysp) (unsplit asp xsp))<br />

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

split asp (filter (not · member asp ysp) (unsplit asp 〈[ ], [ ]〉 asp ))<br />

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

split asp (filter (not · member asp ysp) [ ])<br />

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

split asp [ ]<br />

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

〈[ ], [ ]〉 asp<br />

Step Case Let xsp = 〈x : xl,xr〉 asp and for the induction hypothesis, we<br />

suppose that 〈xr,xl〉 asp satisfies Equation (5.4). We have two subcases.<br />

Subcase 1 Suppose that member asp ysp x = False.<br />

split asp (filter (not · member asp ysp) (unsplit asp xsp))<br />

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

split asp (filter (not · member asp ysp) (unsplit asp 〈x : xl,xr〉 asp ))<br />

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

split asp (filter (not · member asp ysp) x : (unsplit asp 〈xr,xl〉 asp ))<br />

= {definition <strong>of</strong> filter with member asp ysp x = False}<br />

split asp (x : (filter (not · member asp ysp) (unsplit asp 〈xr,xl〉 asp )))

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

Saved successfully!

Ooh no, something went wrong!