Red-black trees implementation in Prolog