WHEN DO DEVARIM SHEB'LEV COUNT? [Devarim sheb'Lev]
Gemara
49b: A man sold his property, intending to settle in Eretz Yisrael. He did not say so at the time of the sale.
(Rava): Devarim sheb'Lev (unspoken intents) have no bearing in law.
50a: A man sold his property with intention to ascend to Eretz Yisrael. He went, but was unable to settle there.
Version #1 (Rava): Anyone who goes intends to settle. Since he was not able, the sale is void.
Version #2: He stipulated that he was going to Eretz Yisrael. He fulfilled this!
A man sold his property with intention to ascend to Eretz Yisrael. He never went.
Version #1 (Rav Ashi): He could have gone if he wanted. (The sale stands.)
Version #2: Nothing stopped him from going! (The sale stands).
The two versions argue about if there were problems (surmountable, with difficulty) on the way. (The sale is void according to Version #2.)
Rishonim
The Rif brings the Gemara verbatim.
Question: When one intended to say 'Ma'aser' and said 'Terumah', why doesn't it take effect (Pesachim 63a)? His intent is Devarim sheb'Lev!
Answer (Ran Kidushin 20b DH Omar): R. Tam says that Devarim sheb'Lev do not count when he said the words he intended, but intended differently than he said. If 'his mouth and heart are unequal', i.e. he did not say the words he intended to say, his words are Batelim (Shevu'os 26b). It says in Maseches Kalah that R. Akiva vowed with his lips and was Mevatel in his heart. One may tell robbers 'if this is not Terumah, all Peros are forbidden to me', and intend to forbid for only a day. This helps only when there is Ones. The situation proves that he did not intend to forbid permanently. The Ramban says that R. Akiva was Mevatel with his lips, but so quietly that he himself could not hear.
Question: If one said 'I will be' when a Nazir passed in front of him, he is a Nazir. This is Devarim sheb'Lev!
Answer (Ran): His intent is clear from his words and the situation. We learn from a verse that Yados (incomplete expressions) work for Nezirus.
Question: If a person vowed (to forbid something like) 'Cherem', and says that he meant a fishing net, or said 'Korban' and says that he meant a gift given to kings, he is permitted (Nedarim 20a). This is Devarim sheb'Lev!
Answer (Ran): Devarim sheb'Lev are only when his intent contradicts what he said, not when it explains it.
Rambam (Hilchos Mechirah 11:9): If one sold Stam, even though he intended to sell only for a certain reason and his purpose was not fulfilled, he cannot retract. This is even if it seems that he sold only for this reason. This is because he did not specify, and Devarim sheb'Lev are invalid.
Magid Mishneh: He holds like the opinion that even if he was Megaleh Da'as beforehand, since he did not specify at the time of the sale, he cannot retract.
Rosh (11:9): If one sold and in the end he did not need the money, if he was quiet at the time of the sale, even if he gave a Giluy Da'as earlier, this is Devarim sheb'Lev. The sale stands, like it says in Kidushin. Sometimes Giluy Da'as does not help, and an explicit Tanai is needed, e.g. if the situation does not reveal his intent unless he stipulates. Since he needs a Tanai, he needs a Tanai Kaful.
Gra (CM 207:10): This is like Tosfos, who says that even monetary Tanayim require a Tanai Kaful. It is unlike the Rashbam (Bava Basra 137b DH v'Im).
Ran (Kidushin 21a DH ha'Hu): Some infer from here that a monetary Tanai need not be Kaful. If Devarim sheb'Lev were valid, the sale would be Batel, even without a Tanai Kaful! It cannot be that he made a Tanai Kaful, for then Rav Ashi would not say 'since he could go, the sale is valid'. We do not force a person to fulfill his Tanai!
Rejection (Ran): This is no proof. Perhaps there was a Tanai Kaful. In the first case, the Tanai was made beforehand, but not at the time of the sale. In the latter cases, at the time of the sale he stipulated 'if I am able to go...and if I cannot, it is Batel.' Perhaps R. Meir holds that Giluy Da'as helps like a Tanai Kaful, but if one made a Tanai and did not double it, he shows that he wants the act to take effect even if the Tanai is not fulfilled. However, the law is true. We do not require Tanai Kaful for money, and all the more so for Isurim. However, the Rambam requires Tanai Kaful.
Rosh (ibid.): Some matters do not need even Giluy Da'as, for even without it there is a conclusive assessment. We can testify about his intent, e.g. a Shtar Mavrachas (Kesuvos 78b, she only wanted to divert the property from her husband), or one who bought from a man and then bought from his wife (Kesuvos 95a, she merely wanted to please her husband), one who wrote all his property to his wife merely made her an Apotropos (Bava Basra 131b), a Shechiv Mera who gave all his property to others (Bava Basra 146b), one who heard that his son died and gave all his property to others, one who was Mekadesh his sister, pre-nuptial gifts and Kidushin money (they are returned if there will not be Nisu'in), and vows of persuasion (they are invalid). All these cases are clear, so no Giluy Da'as is needed.
Rosh (Kidushin 2:15): Rashi explains that the man sold his land with intention to ascend to Eretz Yisrael. People do not normally sell the land from which they support themselves unless they intend to relocate. Had he sold Metaltelim, even had he specified at the time that he intends to ascend to Eretz Yisrael, his sale would stand unless he stipulated. Sometimes one sells his Metaltelim even if he will stay here.
Rosh (16): In the latter two cases, the Halachah follows Version #2. (In case 1, since he went to Eretz Yisrael, even though he was not able to settle, he cannot retract. In case 2, if he cannot go without difficulties, he can retract.)
Beis Yosef (CM 207 DH v'Im Piresh and DH v'Im Ye'era): The Rif brought both versions of both cases. Also the Rambam did not specify which versions we follow. Tosfos explains 'if he wanted, he could not go' simply. We infer that if he had any way to go, even through hiring a guide, he cannot retract.
Poskim
Shulchan Aruch (CM 207:4): If one sold Stam, even though he intended to sell only for a certain reason and his purpose was not fulfilled, he cannot retract. This is even if it seems that he sold only for this reason. This is because he did not specify, and Devarim sheb'Lev are invalid. Even if he gave a Giluy Da'as earlier, since he did not say so at the time of the sale, he cannot retract.
Source (Gra 12): The Gemara (49b) says that he did not specify at the time of the sale. This implies that he had specified beforehand.
Rema: If there is a conclusive assessment, the sale is Batel. Some say that regarding a gift, Devarim sheb'Lev count.
Shiltei ha'Giborim (56a:8): We follow Devarim sheb'Lev regarding gifts. If he does not intend for the gift, it is invalid. A Shechiv Mera gives Stam, since we know that he gives with intent that he will die, if he recovers he can retract.
SMA (10): In a sale, he receives money. Only then we say that if he did not specify, he decided to sell absolutely.