Translate the following inference to logic notation: Thomas is playing a game if and only if Charles is a carpenter. If Charles were a carpenter, then Mary is sleeping. If Mary sleeps, then Charles is a carpenter. Thomas is not playing a game. Therefore Mary is not sleeping.
p <-> q. q -> r. r -> q. ~p. Therefore ~r.