3 isHittingSetTree
(Tree
) :-
4 isHittingSetTree2
(Tree
, []). %function to add variable
for uniqueness checking
6 isHittingSetTree2
(leaf
, _
). %when end of branch has been reached
7 isHittingSetTree2
(node
([], []), _
). %when a node turns empty
8 isHittingSetTree2
(node
([X
|Xs
], [Y
|Ys
]), Z
) :-
9 not(member
(X
,Z
)), %check if label has already been used up
in the tree
10 append
(Z
, [X
], Appended
), %append label to list of checked labels
11 isHittingSetTree2
(Y
, Appended
), %go into depth
12 isHittingSetTree2
(node
(Xs
, Ys
), Z
). %go into width