Gradual Domain Adaptation: Theory and Algorithms