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 dolostone, which is composed of the 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.