Study the information about uses of modals to express deduction.
1. We express deduction with must be/can’t be, must have been, can’t/couldn’t have been.
He must be at work. He can’t be out.
2. We use must be in the present to express deduction.
You haven’t eaten for hours! You must be hungry.
3. The negative of must be is can’t be (not mustn’t be).
You have just eaten. You can’t be hungry again.
4. We express deduction about the past with must have been.
You haven’t eaten for hours. You must have been hungry.
5. The negative of had to is didn’t have to.
It was a holiday yesterday, so I didn’t have to be at work.
L.G. Alexander. Longman English grammar practice for intermediate students- Harlow: Longman, 296p.