In mathematical logic and descriptive set theory, the analytical hierarchy is an extension of the arithmetical hierarchy. The analytical hierarchy of formulas includes formulas in the language of second-order arithmetic, which can have quantifiers over both the set of natural numbers, , and over functions from to . The analytical hierarchy of sets classifies sets by the formulas that can be used to define them; it is the lightface version of the projective hierarchy.
The analytical hierarchy of formulas 
The notation indicates the class of formulas in the language of second-order arithmetic with no set quantifiers. This language does not contain set parameters. The Greek letters here are lightface symbols, which indicate this choice of language. Each corresponding boldface symbol denotes the corresponding class of formulas in the extended language with a parameter for each real; see projective hierarchy for details.
A formula in the language of second-order arithmetic is defined to be if it is logically equivalent to a formula of the form where is . A formula is defined to be if it is logically equivalent to a formula of the form where is . This inductive definition defines the classes and for every natural number .
Because every formula has a prenex normal form, every formula in the language of second-order arithmetic is or for some . Because meaningless quantifiers can be added to any formula, once a formula is given the classification or for some it will be given the classifications and for all greater than .
The analytical hierarchy of sets of natural numbers 
A set of natural numbers is assigned the classification if it is definable by a formula. The set is assigned the classification if it is definable by a formula. If the set is both and then it is given the additional classification .
The sets are called hyperarithmetical. An alternate classification of these sets by way of iterated computable functionals is provided by hyperarithmetical theory.
The analytical hierarchy on subsets of Cantor and Baire space 
The analytical hierarchy can be defined on any effective Polish space; the definition is particularly simple for Cantor and Baire space because they fit with the language of ordinary second-order arithmetic. Cantor space is the set of all infinite sequences of 0s and 1s; Baire space is the set of all infinite sequences of natural numbers. These are both Polish spaces.
The ordinary axiomatization of second-order arithmetic uses a set-based language in which the set quantifiers can naturally be viewed as quantifying over Cantor space. A subset of Cantor space is assigned the classification if it is definable by a formula. The set is assigned the classification if it is definable by a formula. If the set is both and then it is given the additional classification .
A subset of Baire space has a corresponding subset of Cantor space under the map that takes each function from to to the characteristic function of its graph. A subset of Baire space is given the classification , , or if and only if the corresponding subset of Cantor space has the same classification. An equivalent definition of the analytical hierarchy on Baire space is given by defining the analytical hierarchy of formulas using a functional version of second-order arithmetic; then the analytical hierarchy on subsets of Cantor space can be defined from the hierarchy on Baire space. This alternate definition gives exactly the same classifications as the first definition.
Because Cantor space is homeomorphic to any finite Cartesian power of itself, and Baire space is homeomorphic to any finite Cartesian power of itself, the analytical hierarchy applies equally well to finite Cartesian power of one of these spaces. A similar extension is possible for countable powers and to products of powers of Cantor space and powers of Baire space.
As is the case with the arithmetical hierarchy, a relativized version of the analytical hierarchy can be defined. The language is extended to add a constant set symbol A. A formula in the extended language is inductively defined to be or using the same inductive definition as above. Given a set , a set is defined to be if it is definable by a formula in which the symbol is interpreted as ; similar definitions for and apply. The sets that are or , for any parameter Y, are classified in the projective hierarchy.
- The set of all natural numbers which are indices of computable ordinals is a set which is not .
- The set of elements of Cantor space which are the characteristic functions of well orderings of is a set which is not . In fact, this set is not for any element of Baire space.
- If the axiom of constructibility holds then there is a subset of the product of the Baire space with itself which is and is the graph of a well ordering of Baire space. If the axiom holds then there is also a well ordering of Cantor space.
For each we have the following strict containments:
A set that is in for some n is said to be analytical. Care is required to distinguish this usage from the term analytic set which has a different meaning.