Question: Why does the Rambam hold we fast the four times of the year over the destruction of the 2 Beis Hamikdash and what is the precedence for this?
Background:
1. The Shelah Hakodesh (Maseches Taanis 70-71) says the point of fasting is not to mourn for what happened in the past because there definitely is no point in that mourning and suffering in of itself since all the prophets, sages, and even non-Jewish philosophers discuss about accepting suffering with love, and that pain over the past is frivolous. We also know that depression is a blockage for the intellectual human being, and for that reason prophesy did not come down unless on a prophet who was joyous at the moment.
2. The Chasam Sofer (Responsa, Orach Chaim 208) adds that if this is the purpose of fasting, then how did the prophets know to invent something which has no precedent in the Torah, to set up days of suffering over something that has already happened?
Answer: If the main purpose of fasting is repentance, then it all makes sense because we see something similar in the Torah, for on Yom Kippur, a day of repentance, the Torah commands us to fast. (See Dirshu Mishna Berura 549,footnote 1.)