Foundations of theoretical phonology