Deriving Probability Density Functions from Probabilistic Functional Programs (Logical Methods in Computer Science, 2017)