Complex process whereby loose grains of sediment are converted into rock. Lithification may occur at the time a sediment is deposited or later. Cementation is one of the main processes involved, particularly for sandstones and conglomerates. In addition, reactions take place within a sediment between various minerals and between minerals and the fluids trapped in the pores; these reactions may form new minerals or add to others already present in the sediment