Translate the following inference to logic notation: If it is late, then Barbara is a writer. Barbara is not a writer. If Barbara were a writer, then Thomas is cooking. If Thomas cooks, then it is late. Therefore it is not late.
p -> q. ~q. q -> r. r -> p. Therefore ~p.