Inference rules for program annotation