A Theory of Active Learning in Dynamic Environments