we use can to talk about ability in the present or future. it is followed by a bare infinitive.
the negative form of can is cannot.
we use could to talk about a general ability in the past. it is followed by a bare infinitive.
the negative form could not.
other forms of can are formed using the verb be able to.
we use must and have to to talk about obligation and necessity. they are followed by a bare infinitive.
the negative forms of must and have to are must not and do not have to. must not means that you are not allowed to do something . but do not have to means you can choose whether you do something or not.
the past form of must and have to is had to.
the negative form of had to is did not have to.
we use need to to talk about something that is necessary. it is followed by a bare infinitive.
the negative form is do not need to. we can also use need not.
the past form is needed to.
we use need not to when somebody knew that it was not necessary to do something.
we use need not have + past participle when somebody did something unnecessary in the past. but they did not know it was unnecessary at the time.