In an English lesson, the teacher said,
I ain't been to Jamaica.
Obviously, she replaced 'haven't' by 'ain't'. If 'haven't' or 'have not' is used to form a perfect tense, can I always replace it with 'ain't' in oral English?
Speaking descriptively, the facts are simple: This is a typical and long-established use of ain't.
Often, complaints against ain't have less to do with the sentence and more to do with the word itself.
Longer answer: Ain't is used for various purposes. It can be used for both am not and have not (as well as their other conjugations and contractions, e.g. he ain't, they ain't).
Some speakers only use it for am not ("I ain't a clown"), while others include do not ("I ain't go to church")1 and even fold in the expletive subject there (making a full sentence of "Ain't no way over that bridge!").
But the main thing to remember is that any use of "ain't" tends to be strongly proscribed because it is marked by region and social class. As the Wikipedia article says, summarizing other authors, ain't has been called the most stigmatized word and the most powerful social marker in English.
What's the nature of the stigma? Many speakers regard ain't as inherently ungrammatical or lowbrow. The word smacks of rurality and low education and unrefinement. It evokes AAVE and Southern and Midwestern US dialects in general (though in reality it is used more widely, including in England). It also often co-occurs with the double negative (ain't no) and other marked elements (e.g. got instead of have).
It's also heavily used in media representing characters from these regions and classes, reinforcing the above.
These perceptions are certainly not reasons why ain't is incorrect or bad, but they are
Anecdotally, many people I speak with here in Canada never use ain't except in dialect imitation or as a joke, often with an implied snicker at people who use it unironically.
I hope the above has been clear, but just in case: There is nothing wrong with ain't nor with how it's used in the sentence you found. But it's impossible to use without creating strong, mostly negative and usually stereotypical, impressions.
1 Some examples replacing do/does/does/did [language/content warning!]: "he ain't go nowhere"; "he ain't go away"; "he ain't want smoke"; "he ain't want no smoke"; "you ain't gots to lie" and "he ain't want no mo"; "he ain't say his name in every song"; "he ain't say shit"; "he ain't say nothin'"; "if he ain't said it, it ain't so"; "ain't see it coming"; "ain't grow up playing ball"; "act like you ain't catch that"; "she ain't go to church"; "you ain't go to church"; "since Grandma died, I ain't go to church" [ambiguous with "haven't gone"]; "See, that why I ain't go to church"; "I ain't forget to pray but I ain't go to church"; "I ain't go to church on Sunday but I still gotta talk the talk". Every one of these is culturally bound and should not be imitated in conversation, but it's well-established.
2 But if your diction or accent gives you away as a non-native speaker, people will tend to regard such usage as more quaint than anything and may offer you corrections like "You really shouldn't use that," as one would for a child...
No. Don't use the word ain't in informal conversation, unless you come from a community that already regularly uses it in everyday conversation, and even then, don't use it in any sort of formal setting (especially work or education).
Stick to "have not" or "haven't".
Once you've REALLY mastered the complexities of English conversation you may choose to use it in limited circumstances, in a deliberately jokey, formulaic and memey way: "ain't nobody got time for that", but be extremely careful not to cause offence by seeming like you are mocking people who use the word regularly. See: https://www.youtube.com/watch?v=waEC-8GFTP4
In formal English, the word ain't
ain't isn't used at all.
In some varieties of informal English though, it's very commonly used. Etymologically, ain't is a contraction for am not, but it can also be used for other negations of "to be" (are not, is not) or with other auxiliary verbs (do not, have not).
English speakers who don't normally say ain't may still use it in some situations:
But in the context of a school lesson, consider ain't to be always "incorrect".
No, you can not. Ain't is non-standard English and should usually be avoided in formal writing. Some consider it as low-class English; however, this word has strong social connections namely with the black culture so I think 'ain't' is dialectical and informal rather than being low culture. I love using this word when speaking with friends. Let's take a look at the history; in the past, it was used in these contexts:
Lords and ladies were using this word in the spoken language in the Victorian era, so it had been associated with the upper class -but it is not anymore.
Later, the contraction 'ain't' was used by some authors related to low-class characters in their books, for instance, by Charles Dickens.
As we're online, it's beneficial to underline that I don't use 'low-class' here to insult anyone but my source and many other sources use this adjective; they don't use the adjective 'low-class' as a rude word either.
Now we can move on. The word 'ain't' can be used as a substitution for 'am not, are not, is not, have not, and has not.' in informal contexts, unless you time travel to the Victorian era. There is also another word in English which is hain't. It's the nonstandard and the older use of have not/has not.
For further reading:
Sorry, as a word or in "context" ... Whichever way you use that non-word, you're doing so at the very high risk of sounding like a person that doesn't speak well. And who wants to sound like that? Even people who use slang, can still speak well. I'm a thug who speaks nothing BUT slang - yet I can speak well. 'Ain't' isn't a word.