The mathematics of language