Added special cases for void sets and lists to checking logic for transitive and transitive reflexive closure