Implement tree validation functions.