He was left a lot of money, so he hasn’t to work.
He was left a lot of money, so he does not have to work.
We have not to do a written exam, just an oral one.
We do not have to do a written exam, just an oral one.
Thank you but you hadn’t to go to so much trouble.
Thank you but you didn’t have to go [you should not have gone] to so much trouble.
You do not have feed the animals.
[Please] don’t feed the animals.
You have not to smoke in enclosed public spaces.
You mustn’t smoke in enclosed public spaces.
Haven’t we to go now?
Don’t we have to go now?
I’d like you to help me with this, but it hasn’t to be now.
I’d like you to help me with this, but I can’t now.
You don’t have to come if you don’t want to. = You don’t need to come ...
You mustn’t come before 6 o’clock or you will ruin the surprise. = I absolutely don’t want you to come.
You mustn’t smoke in a non-smoking compartment. = This is the law.
You don’t have to do a written exam, just an oral. = There is no written exam.
to have to behaves like a regular verb. So the negative form is doesn’t have to, don’t have to, didn’t have to. The forms hasn’t to, haven’t to and hadn’t to are not correct.
do / does not have to is used to talk about something that is not our responsibility or is not necessary. There is no obligation.
use must not and not don’t have to to prohibit something, typically in instructions and notices that give warnings or very strong recommendations.
there is no past form of must not, often was / were not allowed is used to express the concept of prohibition in the past.
when giving instructions we often use please don’t rather than you mustn’t.