The mathematics of compositional analysis