Education
 

Formal language

From Psychology Wiki

Community portal · Tasks to do · News · Help

Clinical · Educational · Ind&Org · Other fields · Professional · Transpersonal · World

Assessment | Biopsychology | Comparative | Cognitive | Developmental | Language
Personality | Philosophy | Research Methods | Social | Statistics

Language: Linguistics · Semiotics · Speech


In mathematics, logic, and computer science, a formal language L is a set of finite-length sequences of elements drawn from a specified finite set A of symbols. Among the more common options that are found in applications, a formal language may be viewed as being analogous to (1) a collection of words or (2) a collection of sentences. In Case 1, the set A is called the alphabet of L, whose elements are called words. In Case 2, the set A is called the lexicon or the vocabulary of L, whose elements are then called sentences. In any case, the mathematical theory that treats formal languages in general is known as formal language theory.

Although it is common to hear the term formal language used in other contexts to refer to a mode of expression that is more disciplined or more precise than everyday speech, the sense of formal language discussed in this article is restricted to its meaning in formal language theory.

An alphabet might be math, and a string over that alphabet might be math.

A typical language over that alphabet, containing that string, would be the set of all strings which contain the same number of symbols math and math.

The empty word (that is, length-zero string) is allowed and is often denoted by math, math or math. While the alphabet is a finite set and every string has finite length, a language may very well have infinitely many member strings (because the length of words in it may be unbounded).

A question often asked about formal languages is "how difficult is it to decide whether a given word belongs to a particular language?" This is the domain of computability theory and complexity theory.

Contents

[edit] Examples

Some examples of formal languages:

  • the set of all words over math
  • the set math, n is a natural number and math means math repeated math times
  • Finite languages, such as math -
  • the set of syntactically correct programs in a given programming language; or
  • the set of inputs upon which a certain Turing machine halts.

[edit] Specification

A formal language can be specified in a great variety of ways, such as:

[edit] Operations

Several operations can be used to produce new languages from given ones. Suppose math and math are languages over some common alphabet.

  • The concatenation math consists of all strings of the form math where math is a string from math and math is a string from math.
  • The intersection math of math and math consists of all strings which are contained in math and also in math.
  • The union math of math and math consists of all strings which are contained in math or in math.
  • The complement of the language math consists of all strings over the alphabet which are not contained in math.
  • The right quotient math of math by math consists of all strings math for which there exists a string math in math such that math is in math.
  • The Kleene star math consists of all strings which can be written in the form math with strings math in math and math. Note that this includes the empty string math because math is allowed.
  • The reverse math contains the reversed versions of all the strings in math.
  • The shuffle of math and math consists of all strings which can be written in the form math where math and math are strings such that the concatenation math is in math and math are strings such that math is in math.

[edit] See also

[edit] References & Bibliography

This article or section needs to be wikified. Please format this article according to the guidelines laid out at Psychology wiki:Guide to layout. Please remove this template after wikifying.

  • Hopcroft, J. & Ullman, J (1979). Introduction to Automata Theory, Languages, and Computation. Addison Wesley. ISBN 0-201-02988-X
  • G. Rozenberg, A. Salomaa eds. Handbook of Formal Languages. Springer-Verlag. 3 vol.

Automata, Languages and Programming.


Automata theory: formal languages and formal grammars
Chomsky
hierarchy
Grammars Languages Minimal
automaton
Type-0 Unrestricted Recursively enumerable Turing machine
n/a (no common name) Recursive Decider
Type-1 Context-sensitive Context-sensitive Linear-bounded
Type-2 Context-free Context-free Pushdown
Type-3 Regular Regular Finite
Each category of languages or grammars is a proper superset of the category directly beneath it.


[edit] External links


Smallwikipedialogo.png This page uses content from the English-language version of Wikipedia. The original article was at Formal language. The list of authors can be seen in the page history. As with Psychology Wiki, the text of Wikipedia is available under the GNU Free Documentation License.