Added is_tree invariant (along with its test)