I have heard that on one occasion the Blessed One was staying at Savatthi , in Jeta's Grove, Anathapindika 's monastery. There he addressed the monks, "Monks!"
"Yes, lord," the monks replied.
The Blessed One said: "When a monk is intent on the heightened mind, there are five themes he should attend to at the appropriate times. Which five?
"There is the case where evil, unskillful thoughts — imbued with desire, aversion, or delusion — arise in a monk while he is referring to and attending to a particular theme. He should attend to another theme, apart from that one, connected with what is skillful. When he is attending to this other theme, apart from that one, connected with what is skillful, then those evil, unskillful thoughts — imbued with desire, aversion, or delusion — are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it. Just as a skilled carpenter or his apprentice would use a small peg to knock out, drive out, and pull out a large one; in the same way, if evil, unskillful thoughts — imbued with desire, aversion, or delusion — arise in a monk while he is referring to and attending to a particular theme, he should attend to another theme, apart from that one, connected with what is skillful. When he is attending to this other theme, apart from that one, connected with what is skillful, then those evil, unskillful thoughts — imbued with desire, aversion, or delusion — are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it.
" If evil , unskillful thoughts — imbued with desire, aversion, or delusion — still arise in the monk while he is attending to this other theme, connected with what is skillful, he should scrutinize the drawbacks of those thoughts: 'Truly, these thoughts of mine are unskillful, these thoughts of mine are blameworthy, these thoughts of mine result in stress.' As he is scrutinizing the drawbacks of those thoughts, those evil, unskillful thoughts — imbued with desire, aversion, or delusion — are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it. Just as a young woman — or man — fond of adornment, would be horrified, humiliated, and disgusted if the carcass of a snake or a dog or a human being were hung from her neck; in the same way, if evil, unskillful thoughts — imbued with desire, aversion, or delusion — still arise in the monk while he is attending to this other theme, connected with what is skillful, he should scrutinize the drawbacks of those thoughts: 'Truly, these thoughts of mine are unskillful, these thoughts of mine are blameworthy, these thoughts of mine result in stress.' As he is scrutinizing the drawbacks of those thoughts, those evil, unskillful thoughts — imbued with desire, aversion, or delusion — are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it.
"If evil, unskillful thoughts — imbued with desire, aversion or delusion — still arise in the monk while he is scrutinizing the drawbacks of those thoughts, he should pay no mind and pay no attention to those thoughts. As he is paying no mind and paying no attention to them, those evil, unskillful thoughts are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it. Just as a man with good eyes, not wanting to see forms that had come into range, would close his eyes or look away; in the same way, if evil, unskillful thoughts — imbued with desire, aversion or delusion — still arise in the monk while he is scrutinizing the drawbacks of those thoughts, he should pay no mind and pay no attention to those thoughts. As he is paying no mind and paying no attention to them, those evil, unskillful thoughts are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it.
"If evil, unskillful thoughts — imbued with desire, aversion or delusion — still arise in the monk while he is paying no mind and paying no attention to those thoughts, he should attend to the relaxing of thought-fabrication with regard to those thoughts. As he is attending to the relaxing of thought-fabrication with regard to those thoughts, those evil, unskillful thoughts are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it. Just as the thought would occur to a man walking quickly, 'Why am I walking quickly? Why don't I walk slowly?' So he walks slowly. The thought occurs to him, 'Why am I walking slowly? Why don't I stand?' So he stands. The thought occurs to him, 'Why am I standing? Why don't I sit down?' So he sits down. The thought occurs to him, 'Why am I sitting? Why don't I lie down?' So he lies down. In this way, giving up the grosser posture, he takes up the more refined one. In the same way, if evil, unskillful thoughts — imbued with desire, aversion or delusion — still arise in the monk while he is paying no mind and paying no attention to those thoughts, he should attend to the relaxing of thought-fabrication with regard to those thoughts. As he is attending to the relaxing of thought-fabrication with regard to those thoughts, those evil, unskillful thoughts are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it.
"If evil, unskillful thoughts — imbued with desire, aversion or delusion — still arise in the monk while he is attending to the relaxing of thought-fabrication with regard to those thoughts, then — with his teeth clenched and his tongue pressed against the roof of his mouth — he should beat down, constrain, and crush his mind with his awareness. As — with his teeth clenched and his tongue pressed against the roof of his mouth — he is beating down, constraining, and crushing his mind with his awareness, those evil, unskillful thoughts are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it. Just as a strong man, seizing a weaker man by the head or the throat or the shoulders, would beat him down, constrain, and crush him; in the same way, if evil, unskillful thoughts — imbued with desire, aversion or delusion — still arise in the monk while he is attending to the relaxing of thought-fabrication with regard to those thoughts, then — with his teeth clenched and his tongue pressed against the roof of his mouth — he should beat down, constrain, and crush his mind with his awareness. As — with his teeth clenched and his tongue pressed against the roof of his mouth — he is beating down, constraining, and crushing his mind with his awareness, those evil, unskillful thoughts are abandoned and subside. With their abandoning, he steadies his mind right within, settles it, unifies it, and concentrates it.
"Now when a monk... attending to another theme... scrutinizing the drawbacks of those thoughts... paying no mind and paying no attention to those thoughts... attending to the relaxing of thought-fabrication with regard to those thoughts... beating down, constraining and crushing his mind with his awareness... steadies his mind right within, settles it, unifies it and concentrates it: He is then called a monk with mastery over the ways of thought sequences. He thinks whatever thought he wants to, and doesn't think whatever thought he doesn't. He has severed craving, thrown off the fetters, and — through the right penetration of conceit — has made an end of suffering and stress."
That is what the Blessed One said. Gratified, the monks delighted in the Blessed One's words.