Deriving Differentiation Rules