Carbonate rocks are a class of sedimentary rocks composed primarily of carbonate minerals. The two major types are limestone, which is composed of calcite or aragonite (different crystal forms of CaCO3), and dolomite rock (also known as dolostone), which is composed of mineral dolomite (CaMg(CO3)2).
Calcite can be either dissolved by groundwater or precipitated by groundwater, depending on several factors including the water temperature, pH, and dissolved ion concentrations. Calcite exhibits an unusual characteristic called retrograde solubility in which it becomes less soluble in water as the temperature increases.
When conditions are right for precipitation, calcite forms mineral coatings that cement the existing rock grains together or it can fill fractures.
Karst topography and caves develop in carbonate rocks because of their solubility in dilute acidic groundwater. Cooling groundwater or mixing of different groundwaters will also create conditions suitable for cave formation.
Original source: https://en.wikipedia.org/wiki/Carbonate rock. Read more