Foundations of Sets, Relations, and Functions