Executable Functional Abstractions: Inferring Generative Programs for Advanced Math Problems