Translate the following inference to logic notation: If Sarah sleeps, then Sarah is a doctor. If Sarah were a doctor, then Karen is writing a letter. Sarah is sleeping if and only if Karen is writing a letter. Therefore if Karen writes a letter, then Sarah is a doctor.
p -> q. q -> r. p <-> r. Therefore r -> q.