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 7. CULTIVATING TREE OBFUSCATIONS 128<br />
produces the ternary tree (7.5).<br />
Since the input for this operation is a list, we can also perform an obfuscation<br />
on the input list. In Appendix D we use a split list as well as ternary trees to<br />
obfuscate the definition <strong>of</strong> mktree. We prove an assertion for different versions<br />
<strong>of</strong> mktree and we find that using ternary trees increases the cost but not the<br />
height <strong>of</strong> pro<strong>of</strong> trees, but using a split list increases both.<br />
7.2.5 Operations for Binary Search Trees<br />
Now let us consider representing binary search trees with our specific abstraction<br />
function; for a binary search tree t 2 , t 2 ❀ t 3 if<br />
t 2 = (to2 t 3 ) ∧ inc (flatten (to2 t 3 ))<br />
We define operations corresponding to memBST and insert routinely:<br />
memBST 3 p Null 3 = False<br />
memBST 3 p (Fork 3 v lt ct rt)<br />
p == v = True<br />
p < v ∧ even v = memBST 3 p lt<br />
p < v ∧ odd v = memBST 3 p rt<br />
∣ p > v = memBST 3 p ct<br />
insert 3 x Null 3 = Fork 3 x Null 3 Null 3 Null 3<br />
insert 3 x (Fork 3 y lt ct rt)<br />
x < y ∧ even y = Fork 3 y (insert 3 x lt) ct jt<br />
x < y ∧ odd y = Fork 3 y kt ct (insert 3 x rt)<br />
x == y = Fork 3 y lt ct rt<br />
∣ x > y = Fork 3 y lt (insert 3 x ct) rt<br />
where jt and kt are arbitrary ternary trees. Note that the case x > y does not<br />
require a test to see whether y is even. This is because we chose to always map<br />
the right subtree <strong>of</strong> a binary tree to the centre subtree <strong>of</strong> a ternary tree.<br />
7.2.6 Deletion<br />
To define delete for our ternary tree, we first need to define headTree and tailTree<br />
for ternary trees which satisfy analogues <strong>of</strong> Equations (7.2) and (7.3):<br />
headTree 3 = head · flatten 3<br />
flatten 3 · tailTree 3 = tail · flatten 3<br />
Using these equations, we obtain:<br />
headTree 3 (Fork 3 v lt ct rt)<br />
∣ even v = if lt == Null 3 then v else headTree 3 lt<br />
otherwise = if rt == Null 3 then v else headTree 3 rt<br />
tailTree 3 (Fork 3 v lt ct rt)<br />
even v<br />
∣<br />
= if lt == Null 3 then ct<br />
else Fork 3 v (tailTree 3 lt) ct rt<br />
otherwise = if rt == Null 3 then ct<br />
else Fork 3 v lt ct (tailTree 3 rt)