Mathematical formalization of stratigraphic terminology