17b - Beraisa: The days before and after the days in Megilas Ta'anis are forbidden. Shabbos and Yom Tov are forbidden, but before and after them is permitted.
Question: What is the difference between them?
Answer: We need to be more stringent to strengthen the Isur of the days in Megilas Ta'anis because it is mid'Rabanan.
Rosh Hashanah 19b: Megilas Ta'anis is not Batel regarding Chanukah and Purim. It is Batel regarding everything else.
Ta'anis 18a - Rav and R. Yochanan: The Halachah follows R. Yosi, who forbids the days before and after the days in Megilas Ta'anis.
Shmuel: The Halachah follows R. Shimon ben Gamliel, who permits the days before and after.
18b: Rav Nachman decreed a fast on the 12th (of Adar).
Rabanan: This is Yom Torainus (it is in Megilas Ta'anis)!
Rav Nachman: Yom Torainus was Batel, because Shmayah and Achiyah were killed that day.
Question: Still it is forbidden, for the next day, the 13th, is Yom Nikanor!
Answer Rav Ashi: Yom Torainus itself was Batel because of the tragedy that occurred on it, all the more so the Isur to fast due to the following day is Batel!
Megilah 2a - Shmuel bar Yitzchak): We do not need a source to permit reading the Megilah on the 13th. It was the day of assembly for all Yisrael!
Rosh and Ran (Megilah 1:1 and 1b DH Gemara): Rashi says that the 13th was the day of assembly when Yisrael defended themselves from their enemies, therefore we need no source to permit reading the Megilah that day. This does not show why we may read that day, since it was enacted to read on the 14th and 15th! Also, we celebrate the serenity after the war! The Ri says that the Bavli learns like the Yerushalmi, that the 13th was the day of war, therefore we cannot include it from the verse, since it is unlike "the days on which they rested". Rather, the verse includes 11 and 12. Since we may read before and after the 13th, all the more so we may read not on the 13th.
Rebuttal (R. Tam and She'altos, brought in Rosh and Ran, ibid.): If so, the Bavli should also call it the day of war! We would not include the 13th from a Kal va'Chomer without mentioning the Kal va'Chomer! Rather, it was the day when everyone assembled for Selichos and prayer for the war. When Yisrael fought Amalek (in Parashas Beshalach), Moshe, Aharon and Chur gathered on top of the hill. Moshe declared a fast. This is our only source for Ta'anis Esther. The Ge'onim say that when Purim is on Sunday, we fast on the previous Thursday. This is because we normally say many Selichos and prayers on the Ta'anis, so if it was on Erev Shabbos there would not be time to prepare for Shabbos.
Note: They hold that the 13th was a day of gathering from when Chachamim enacted that villagers may read the Megilah early. If so, why may they (sometimes) read on a Yom ha'Kenisah (Monday or Thursday, when many gather to the cities) before Ta'anis Esther? They may not read early when the 14th itself is a Yom ha'Kenisah! Perhaps the verse includes the 11th and 12th when Ta'anis Esther itself is on these days (when the 14th is on Shabbos or Sunday)! Perhaps it is more difficult for some people to come or to hear the Megilah when they are fasting, so Chachamim also permitted the Yom ha'Kenisah before this.
Rif and Rosh (Ta'anis 2:24): The days before and after the days in Megilas Ta'anis are forbidden. Shabbos and Yom Tov are forbidden, but before and after them is permitted. Because they are mid'Oraisa, we need not strengthen them. Nowadays Megilas Ta'anis is Batel, except for Chanukah and Purim.
Rambam (Hilchos Ta'anis 5:5): Nowadays all of Yisrael have the custom to fast on the 13th of Adar, to commemorate the fast of Benei Yisrael in the days of Haman - "Divrei ha'Tzomos v'Za'akasam."
Hasagos ha'Ra'avad (Megilah 4a): Megilas Ta'anis is Batel regarding individuals. We may not decree a fast on those days. We learn from Rav Nachman. When asked why he decreed a fast on Yom Torainus, he answered that the day was Batel. It did not suffice to say that Megilas Ta'anis is Batel!
Question: Since Megilas Ta'anis is not Batel regarding a fast for the Tzibur or regarding Purim, why do we fast on the day before?
Answer #1 (Ra'avad brought in Ran Ta'anis DH Aval and Rosh, Megilah 1:8): In the days of Mordechai, Yisraelim gathered on the 13th to pray and fight. This is an essential part of the miracle, and Chachamim enacted to fast then, even before Megilas Ta'anis was Batel. The Megilah says (9:31) "Kiymu Al Nafsham v'Al Zar'am Divrei ha'Tzomos v'Za'akasam"! Yom Nikanor (Adar 13) is in Megilas Ta'anis only to forbid eulogies.
Rebuttal #1 (Gra OC 686:2 DH v'Ta'anis): The Yerushalmi connotes that fasting and eulogies were forbidden on the 13th.
Rejection #2 (Ran, ibid.): Maseches Sofrim says that they fasted after Nisan because of Nikanor. This implies that there is no fast on Yom Nikanor. "Divrei ha'Tzomos" refers to the four fasts over the Churban. However, these are fasts of mourning, and "v'Za'akasam" suggests fasts of prayer, like those Esther decreed. We must say that the 13th is not a fixed fast. The Gemara (Rosh Hashanah 18b) asked why a fast was decreed on Chanukah, since Megilas Ta'anis still applies to it. This shows that we may decree a fast on days such as Yom Nikanor which were Batel. Rav Nachman's Talmidim asked him in order to determine whether or not he holds that Megilas Ta'anis was Batel; he answered that even if it was not, fasting would be permitted.
Note: The following answers permit fasting on the day before Purim.
Answer #2 (Rosh, ibid. and Ran Rosh Hashanah DH Gemara): We do not forbid fasting before or after Shabbos and Yom Tov, for they are mid'Oraisa and we need not strengthen them. Purim is Divrei Kabalah (Kesuvim), which is like mid'Oraisa. The Gemara says similarly regarding Tzom Gedalyah.
Question: The Megilah says that the 14th is a Yom Tov for Prazim (people in open cities), and the 15th for Benei Kerachim (people in walled cities). For Benei Kerachim, the 14th is not Asur from Divrei Kabalah, rather, because of Megilas Ta'anis!
Answer #1 (Ba'al ha'Ma'or Megilah 4a): Indeed, Benei Kerachim do not fast on the 13th.
Rebuttal (Hasagos ha'Ra'avad): Benei Kerachim are forbidden on the 14th due to (Purim of) Prazim. It is unreasonable to be even more stringent about Benei Kerachim and forbid them on the 13th, which is permitted to Prazim!
Answer #2 (Hasagos ha'Ra'avad): The only addition Megilas Ta'anis made regarding Purim was to forbid the 14th and 15th in both places.
Rebuttal (Ran DH ul'Inyan): The Yerushalmi asks why the 13th is in Megilas Ta'anis; it is already forbidden because it is the day before Purim! We must say that Divrei Kabalah is only what is said by Nevi'im. The Megilah was (written with Ru'ach ha'Kodesh, but) not written by Nevi'im. However, perhaps the Yerushalmi holds that even Divrei Kabalah need to be strengthened.
Answer #3 (Ran, ibid., citing Ramban): The 13th was Yom Nikanor. The Yom Tov itself was Batel (with the rest of Megilas Ta'anis). It is unreasonable that it remains Asur due to the following day, like the Gemara said regarding the 12th.
Rebuttal (Ran, ibid.): The 12th was Batel because of a tragedy on that day, so it is fitting not to consider it a Yom Tov at all. The 13th was not Batel because of a tragedy, only because Megilas Ta'anis was Batel. It should keep its Kedushah due to Purim, which was not Batel!
Answer #4 (Ran Rosh Hashanah DH v'Hai and Magid Mishnah Hilchos Chanukah 3:1): Megilas Ta'anis is not Batel regarding Purim and Chanukah themselves, but it is Batel regarding the days before and after them. Since Chachamim were Mevatel it, this shows that they sought to be lenient.
Rebuttal (Ran Ta'anis DH ul'Inyan): Rav says that Megilas Ta'anis was Batel. He himself rules like R. Yosi, who forbids the days before and after. This must refer to the days before and after the days that were not Batel, i.e. Chanukah and Purim!
Defense (Milchamos Hash-m, Megilah 4a): Because Chachamim sought to be lenient, we rule like Shmuel who permits the days before and after, against Rav and R. Yochanan.
Answer #5 (Hasagos ha'Ra'avad, ibid.): If the Yomim Tovim of Megilas Ta'anis are Batel (except for Chanukah and Purim), all the more so the days secondary to (before and after) days in it are Batel.
Shulchan Aruch (OC 686:2): We fast on the 13th of Adar.
Mishnah Berurah (2): The fast reminds us that Hash-m sees and hears one in trouble when he fasts and repents with all his heart.
Kaf ha'Chayim (8): The fast subdues the Satan from prosecuting against Yisrael for eating, drinking and rejoicing on Purim.
Shulchan Aruch (ibid.): If Purim is on Sunday, we fast on the previous Thursday.
Bach (DH ucheshe'Chal): When a fast is pushed off (from Shabbos), we do not fast on Erev Shabbos, for it is not honorable to Shabbos to enter amidst fasting.
Rema: This fast is not obligatory.
Gra: This is unlike R. Tam and the Ra'avad, who say that it is obligatory and its source is in the Megilah. Before Megilas Ta'anis was Batel, fasting on the 13th was forbidden due to Yom Nikanor!
Kaf ha'Chayim (17): The Mechaber holds that it is obligatory. It is as stringent as the other mid'Rabanan fasts.
Hagahos Maimoniyos (Hilchos Ta'anis 1:2): R. Shavat proves from Ta'anis Esther that before and after Chanukah and Purim is permitted. This does not prove that optional fasts are permitted. Perhaps Ta'anis Esther is like an obligatory fast, for the Ge'onim enacted it and it is the custom of all Yisrael.
Rema: Therefore one may be lenient when necessary, e.g. for pregnant or nursing women or one who is not dangerously sick. Even one whose eyes hurt very much should not fast; he compensates afterwards. Other healthy people should not separate from the Tzibur.
Beis Yosef (DH Kasuv): Shibolei ha'Leket says that Ta'anis Esther is not even mid'Rabanan. It is a mere custom. Yisrael accepted the days of Purim to recall "Divrei ha'Tzomos v'Za'akasam". Nevertheless, one should not separate from the Tzibur.
Gra (DH Kegon and DH v'Afilu): It is like the other fasts (Tzom Gedalyah, 10th of Teves and 17th of Tamuz). Even healthy people would not be obligated if not for "Poretz Geder..."
Magen Avraham (4): Even if one is travelling and it is difficult to fast, he should fast.
Mishnah Berurah (4,5): The Yeshu'os Yakov says that pregnant and nursing women are inherently exempt. Even if they are not in pain; they need not compensate afterwards. The Eliyahu Rabah requires fasting if she is not in pain (except for a Yoledes within 30 days). The Bach requires all to compensate.