Obfuscation of Abstract Data-Types - Rowan
Obfuscation of Abstract Data-Types - Rowan
Obfuscation of Abstract Data-Types - Rowan
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 98<br />
= {Equation (4.16)}<br />
cons asp x (filter (not · member asp ysp) (unsplit asp 〈xr,xl〉 asp ))<br />
= {induction hypothesis}<br />
cons asp x (minus 〈xr,xl〉 asp ysp)<br />
Subcase 2 Suppose that member asp ysp x = True.<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 (filter (not · member asp ysp) (unsplit asp 〈xr,xl〉 asp ))<br />
= {induction hypothesis}<br />
minus 〈xr,xl〉 asp ysp<br />
Putting all the cases gives the following definition:<br />
minus asp 〈[ ], [ ]〉 asp ysp = 〈[ ], [ ]〉 asp<br />
minus asp 〈x : xl,xr〉 asp ysp = if member asp ysp x<br />
then minus asp 〈xr,xl〉 asp ysp<br />
else cons asp x (minus asp 〈xr,xl〉 asp ysp)<br />
5.3.2 Block Split<br />
Let us now consider how we can obfuscate the set operations using the block<br />
split. As we are now working with ordered lists, we need to strengthen Invariant<br />
(4.18). The representation xs ❀ 〈l,r〉 b(k) satisfies:<br />
((|r| = 0 ∧ |l| < k) ∨ (|l| = k)) ∧ (l ✂ xs) ∧ (r ✂ xs) (5.5)<br />
which ensures that the block split preserves ordering. Using the definition <strong>of</strong><br />
split b(k) , we can easily check that this invariant holds and so we can use this<br />
split with ordered lists.<br />
As with the alternating split, we state the operations for ordered lists —<br />
the pro<strong>of</strong>s <strong>of</strong> correctness can be found in [20]. The member b(k) operation is the<br />
same as usual:<br />
member b(k) 〈l,r〉 b(k) a = member l a ∨ member r a<br />
For insert b(k) , we may have to break the list l into ls + [l ′ ], where l ′ is the<br />
last element <strong>of</strong> l (assuming that l is not empty). Note that since |l| ≤ k then<br />
breaking l into ls and l ′ is a constant operation.<br />
insert b(k) a 〈l,r〉 b(k)<br />
member b(k) 〈l,r〉 b(k) a = 〈l,r〉 b(k)<br />
|l| < k<br />
= 〈insert a l,r〉 b(k)<br />
l ′ < a<br />
= 〈l, insert a r〉 b(k)<br />
∣ otherwise = 〈insert a ls,l ′ : r〉 b(k)<br />
where ls = init l<br />
l ′ = last l