The mathematical theory that treats formal languages in general is known as formal language theory .
In mathematical logic , a formal theory is a set of sentences expressed in a formal language .