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 4. SPLITTING HEADACHES 76<br />
Let us now consider an operation cat asp which corresponds to +, i.e. ( +) ❀<br />
cat asp . By writing + as an uncurried operation then we can use Equation (3.9)<br />
so that cat asp satisfies<br />
cat asp (xsp,ysp) = split asp ( + (unsplit asp xsp, unsplit asp ysp))<br />
This is equivalent to:<br />
cat asp xsp ysp = split asp ((unsplit asp xsp) + (unsplit asp ysp)) (4.17)<br />
We derive a definition for cat asp by structural induction on xsp.<br />
Base Case Suppose that xsp = 〈[ ], [ ]〉 asp and so unsplit asp xsp = [ ].<br />
split asp ((unsplit asp xsp) + (unsplit asp ysp))<br />
= {definitions <strong>of</strong> xsp and unsplit asp }<br />
split asp ([ ] + (unsplit asp ysp))<br />
= {definition <strong>of</strong> +}<br />
split asp (unsplit asp ysp)<br />
= {Equation (4.13)}<br />
ysp<br />
Step Case Suppose that xsp = 〈x : r,l〉 asp and for the induction hypothesis,<br />
we assume that 〈l,r〉 asp satisfies Equation (4.17).<br />
split asp ((unsplit asp xsp) + (unsplit asp ysp))<br />
= {definition <strong>of</strong> xsp}<br />
split asp ((unsplit asp (〈x : r,l〉 asp )) + (unsplit asp ysp))<br />
= {definition <strong>of</strong> unsplit asp }<br />
split asp ((x : (unsplit asp 〈l,r〉 asp )) + (unsplit asp ysp))<br />
= {definition <strong>of</strong> +}<br />
split asp (x : ((unsplit asp 〈l,r〉 asp ) + (unsplit asp ysp)))<br />
= {Property (4.16)}<br />
cons asp x (split asp ((unsplit asp 〈l,r〉 asp ) + (unsplit asp ysp)))<br />
= {induction hypothesis}<br />
cons asp x (cat asp 〈l,r〉 asp ysp)<br />
Thus, we can define<br />
cat asp 〈[ ], [ ]〉 asp ysp = ysp<br />
cat asp 〈x : r 0 ,l 0 〉 asp ysp = cons asp x (cat asp 〈l 0 ,r 0 〉 asp ysp)<br />
As an alternative, we could define:<br />
{<br />
〈l0 + l<br />
〈l 0 ,r 0 〉 asp + asp 〈l 1 ,r 1 〉 asp = 1 ,r 0 + r 1 〉 asp if |l 0 | = |r 0 |<br />
〈l 0 + r 1 ,r 0 + l 1 〉 asp otherwise<br />
In Appendix A, we discuss which <strong>of</strong> these two definitions produces the better<br />
obfuscation with respect to one <strong>of</strong> the assertions. We find that + asp gives rise