Automatic Perturbation Analysis for Scalable Certified Robustness and Beyond