ArticleslgStudy

mathematics

Formal language

Formal language is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Formal language rather than just read about it. In short: In logic, mathematics, computer science, and linguistics, a formal language is a set of strings whose symbols are taken from a set called "alphabet". The alphabet of a formal language consists of symbols that concatenate into strings (also called "words").

Formal language — main illustration
Formal language — illustration

Key takeaways

  • Formal language belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Formal language to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Formal language from memory before moving on to harder problems.

Reference excerpt

In logic, mathematics, computer science, and linguistics, a formal language is a set of strings whose symbols are taken from a set called "alphabet". The alphabet of a formal language consists of symbols that concatenate into strings (also called "words"). Words that belong to a particular formal language are sometimes called well-formed words. A formal language is often defined by means of a formal grammar such as a regular grammar or context-free grammar. In computer science, formal languages are used, among others, as the basis for defining the grammars of programming languages and controlled natural languages (i.e., formalized versions of subsets of natural languages). In computational complexity theory, decision problems are typically defined as formal languages, and complexity classes are defined as the sets of the formal languages that can be parsed by machines with limited computational power. In logic and the foundations of mathematics, formal languages are used to represent the syntax of axiomatic systems, and mathematical formalism is the philosophy that all of mathematics can be reduced to the syntactic manipulation of formal languages in this way. The field of formal language theory studies primarily the purely syntactic aspects of such languages—that is, their internal structural patterns. Formal language theory sprang out of linguistics, as a way of understanding the syntactic regularities of natural languages.

History

In the 17th century, Gottfried Leibniz imagined and described the characteristica universalis, a universal and formal language which utilised pictographs. Later, Carl Friedrich Gauss investigated the problem of Gauss codes. In the mid-19th century, George Boole established the field of Boolean algebra, which is a formal way of describing logical operations using truth values and set operators. In his work An Investigation of The Laws of Thought, he demonstrated that logical reasoning can be expressed and manipulated through symbolic equations. Gottlob Frege attempted to realize Leibniz's ideas, through a notational system, first outlined in Begriffsschrift (1879) and more fully developed in his 2-volume Grundgesetze der Arithmetik (1893/1903). This described a "formal language of pure language." In the first half of the 20th century, several developments were made with relevance to formal languages. Axel Thue published four papers relating to words and language between 1906 and 1914. The last of these introduced what Emil Post later termed 'Thue Systems', and gave an early example of an undecidable problem. Post would later use this paper as the basis for a 1947 proof "that the word problem for semigroups was recursively insoluble", and later devised the canonical system for the creation of formal languages. In January 1907, Leonardo Torres Quevedo published a formal language for the description of mechanical drawings (mechanical devices) in his paper "Sobre un sistema de notaciones y símbolos destinados a facilitar la descripción de las máquinas" ("On a system of notations and symbols intended to facilitate the description of machines"), and proposed it in Vienna. Heinz Zemanek rated it as an equivalent to a programming language for the numerical control of machine tools. Noam Chomsky devised an abstract representation of formal and natural languages, known as the Chomsky hierarchy. In 1959, John Backus developed the Backus–Naur form to describe the syntax of a high-level programming language, following his work in the creation of FORTRAN. Peter Naur was the secretary/editor for the ALGOL60 Report in which he used Backus–Naur form to describe the Formal part of ALGOL 60.

Words over an alphabet

An alphabet, in the context of formal languages, can be any set; its elements are called letters. An alphabet may contain an infinite number of elements; however, most definitions in formal language theory specify alphabets with a finite number of elements, and many results apply only to them. It often makes sense to use an alphabet in the usual sense of the word, or more generally any finite character encoding such as ASCII or Unicode. A word over an alphabet can be any finite sequence (i.e., string) of letters. The set of all words over an alphabet Σ is usually denoted by Σ* (using the Kleene star). The length of a word is the number of letters it is composed of. For any alphabet, there is only one word of length 0, the empty word, which is often denoted by e, ε, λ or even Λ. By concatenation one can combine two words to form a new word, whose length is the sum of the lengths of the original words. The result of concatenating a word with the empty word is the original word. In some applications, especially in logic, the alphabet is also known as the vocabulary and words are known as formulas or sentences; this breaks the letter/word metaphor and replaces it by a word/sentence metaphor.

Definition Given a non-empty set Σ, a formal language L over Σ is a subset of Σ∗, where Σ∗ is the set of all possible finite-length words over Σ. We call the set Σ the alphabet of L. On the other hand, given a formal language L over Σ, a word w∈Σ∗ is well-formed if w∈L. Similarly, an expression E⊆Σ∗ is well-formed if E⊆L. Sometimes, a formal language L over Σ has a set of clear rules and constraints for the creation of all possible well-formed words from Σ∗. In computer science and mathematics, which do not usually deal with natural languages, the adjective "formal" is often omitted as redundant. On the other hand, we can just say "a formal language L" when its alphabet Σ is clear in the context. While formal language theory usually concerns itself with formal languages that are described by some syntactic rules, the actual definition of the concept "formal language" is only as above: a (possibly infinite) set of finite-length strings composed from a given alphabet, no more and no less. In practice, there are many languages that can be described by rules, such as regular languages or context-free languages. The notion of a formal grammar may be closer to the intuitive concept of a "language", one described by syntactic rules. By an abuse of the definition, a particular formal language is often thought of as being accompanied with a formal grammar that describes it.

Examples The following rules describe a formal language L over the alphabet Σ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +, =}:

… excerpt ends here. Continue reading the full article.

Illustrations

Formal language: Structure of the syntactically well-formed, although thoroughly nonsensical, English sentence, "Colorless green ideas sleep furiously" (historical example from Chomsky 1957)
Structure of the syntactically well-formed, although thoroughly nonsensical, English sentence, "Colorless green ideas sleep furiously" (historical example from Chomsky 1957)
Formal language: This diagram shows the syntactic divisions within a formal system. Strings of symbols may be broadly divided into nonsense and well-formed formulas. The set of well-formed formulas is divided into theorems and non-theorems.
This diagram shows the syntactic divisions within a formal system. Strings of symbols may be broadly divided into nonsense and well-formed formulas. The set of well-formed formulas is divided into theorems and non-theorems.

Worked examples

Example 1 — a first encounter with Formal language

Start with the simplest possible case. Write down what Formal language claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Formal language before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Formal language ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Formal language

In research
Formal language appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Formal language in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Formal language is common in secondary-school and first-year university syllabi. It links to neighbouring topics Combinatorics on words, Formal languages, Mathematical linguistics, so understanding it makes those chapters shorter.
In everyday life
Look for Formal language outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Formal language” →

How to study Formal language in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Formal language means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Formal language out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Formal language in simple terms?

In logic, mathematics, computer science, and linguistics, a formal language is a set of strings whose symbols are taken from a set called "alphabet". The alphabet of a formal language consists of symbols that concatenate into strings (also called "words").

Why does Formal language matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Formal language?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Formal language.

Tags

  • Combinatorics on words
  • Formal languages
  • Mathematical linguistics
  • Theoretical computer science

Keep exploring