Speleogenesis

Speleogenesis is the origin and development of caves, the primary process that determines essential features of the hydrogeology of karst and guides its evolution. It often deals with the development of caves through limestone, caused by the presence of water with carbon dioxide dissolved within it, producing carbonic acid which permits the dissociation of the calcium carbonate in the limestone.
Limestone.
The majority of limestone caves are created by calcium carbonate dissolution by the solvent action of meteoric waters circulating through the rock.
In the presence of carbon dioxide saturated water, calcium carbonate reacts to form the soluble calcium bicarbonate.
CaCO3 + CO2 + H2O → Ca(HCO3)2
As meteoric waters precipitate they dissolve atmospheric carbon dioxide to form a dilute carbonic acid solution, which builds up in permeable fissures, bedding planes, joints, and faults within limestone rocks. The exposed limestone then reacts to become calcium bicarbonate which dissolves in the water and is removed from the fault as the solution flows away.
Phreatic passages develop in conditions of complete water-fill meaning that ceilings and walls may be eroded as readily as floors. The form is generally that of an ellipse along the host fissure, whilst more circular forms generally indicate faster solvent flow and deep pockets are often indicative of slower flow.
Vadose passages develop where the water has a free surface (i.e., in the vadose zone), and are varieties of entrenched, canyon-like channels as found with surface rivers. It is common to see a younger canyon entrenched in the floor of a phreatic passage, signifying a lowering of the water table.