Automated reasoning for reflective programs