Translate the following inference to logic notation: If William cooks, then Karen is writing a letter. If it is late, then William is cooking. If Karen writes a letter, then Patricia is sleeping. Patricia is not sleeping. Therefore it is not late.
p -> q. r -> p. q -> s. ~s. Therefore ~r.