Looks like we have implemented this for internal use and never documented it. I debugged into it and found ORG-875 and it really work, so you are in luck with this one, see code below
tree aaa;
aaa.bbb= 1;
aaa.ccc= 2;
aaa.ddd= 3;
exist(aaa.anything,24)=;//this will only check the tree existed and no node checking
if(exist(aaa.anyjunk)==24) type "aaa is a tree";
aaa@=;//this should return 2 for a branch
aaa.bbb@=;//this should return 1 for a leaf
if(aaa.ccc@>0) type "aaa.ccc is valid tree node";
if(aaa.junk@==0) type "aaa.junk is not valid";
if(aaa@==2) type "aaa is a tree branch";
if(aaa.bbb@==1) type "aaa.bbb is a tree leaf";