# Free object

__: Left adjoint to a forgetful functor to sets__

**Short description**In mathematics, the idea of a **free object** is one of the basic concepts of abstract algebra. Informally, a free object over a set *A* can be thought of as being a "generic" algebraic structure over *A*: the only equations that hold between elements of the free object are those that follow from the defining axioms of the algebraic structure. Examples include free groups, tensor algebras, or free lattices.

The concept is a part of universal algebra, in the sense that it relates to all types of algebraic structure (with finitary operations). It also has a formulation in terms of category theory, although this is in yet more abstract terms.

## Definition

Free objects are the direct generalization to categories of the notion of basis in a vector space. A linear function *u* : *E*_{1} → *E*_{2} between vector spaces is entirely determined by its values on a basis of the vector space *E*_{1}. The following definition translates this to any category.

A concrete category is a category that is equipped with a faithful functor to **Set**, the category of sets. Let **C** be a concrete category with a faithful functor *U* : **C** → **Set**. Let *X* be a set (that is, an object in **Set**), which will be the *basis* of the free object to be defined. A **free object** on X is a pair consisting of an object [math]\displaystyle{ A=F(X) }[/math] in **C** and an injection [math]\displaystyle{ i:X\to U(A) }[/math] (called the *canonical injection*), that satisfies the following universal property:

- For any object
*B*in**C**and any map between sets [math]\displaystyle{ g:X\to U(B) }[/math], there exists a unique morphism [math]\displaystyle{ f:A\to B }[/math] in**C**such that [math]\displaystyle{ g=U(f)\circ i }[/math]. That is, the following diagram commutes:

If free objects exist in **C**, the universal property implies every map between two sets induces a unique morphism between the free objects built on them, and this defines a functor [math]\displaystyle{ F:\mathbf{Set}\to \mathbf C }[/math]. It follows that, if free objects exist in **C**, the functor F, called the **free functor** is a left adjoint to the forgetful functor U; that is, there is a bijection

- [math]\displaystyle{ \operatorname{Hom}_\mathbf{Set}(X, U(B))\cong \operatorname{Hom}_\mathbf{C}(F(X), B). }[/math]

## Examples

The creation of free objects proceeds in two steps. For algebras that conform to the associative law, the first step is to consider the collection of all possible words formed from an alphabet. Then one imposes a set of equivalence relations upon the words, where the relations are the defining relations of the algebraic object at hand. The free object then consists of the set of equivalence classes.

Consider, for example, the construction of the free group in two generators. One starts with an alphabet consisting of the five letters [math]\displaystyle{ \{e,a,b,a^{-1},b^{-1}\} }[/math]. In the first step, there is not yet any assigned meaning to the "letters" [math]\displaystyle{ a^{-1} }[/math] or [math]\displaystyle{ b^{-1} }[/math]; these will be given later, in the second step. Thus, one could equally well start with the alphabet in five letters that is [math]\displaystyle{ S=\{a,b,c,d,e\} }[/math]. In this example, the set of all words or strings [math]\displaystyle{ W(S) }[/math] will include strings such as *aebecede* and *abdc*, and so on, of arbitrary finite length, with the letters arranged in every possible order.

In the next step, one imposes a set of equivalence relations. The equivalence relations for a group are that of multiplication by the identity, [math]\displaystyle{ ge=eg=g }[/math], and the multiplication of inverses: [math]\displaystyle{ gg^{-1}=g^{-1}g=e }[/math]. Applying these relations to the strings above, one obtains

- [math]\displaystyle{ aebecede = aba^{-1}b^{-1}, }[/math]

where it was understood that [math]\displaystyle{ c }[/math] is a stand-in for [math]\displaystyle{ a^{-1} }[/math], and [math]\displaystyle{ d }[/math] is a stand-in for [math]\displaystyle{ b^{-1} }[/math], while [math]\displaystyle{ e }[/math] is the identity element. Similarly, one has

- [math]\displaystyle{ abdc = abb^{-1}a^{-1} = e. }[/math]

Denoting the equivalence relation or congruence by [math]\displaystyle{ \sim }[/math], the free object is then the collection of equivalence classes of words. Thus, in this example, the free group in two generators is the quotient

- [math]\displaystyle{ F_2=W(S)/\sim. }[/math]

This is often written as [math]\displaystyle{ F_2=W(S)/E }[/math] where [math]\displaystyle{ W(S) = \{a_1 a_2 \ldots a_n \, \vert \; a_k \in S \, ; \, n \in \mathbb{N}\} }[/math] is the set of all words, and [math]\displaystyle{ E = \{a_1 a_2 \ldots a_n \, \vert \; e = a_1 a_2 \ldots a_n \, ; \, a_k \in S \, ; \, n \in \mathbb{N}\} }[/math] is the equivalence class of the identity, after the relations defining a group are imposed.

A simpler example are the free monoids. The free monoid on a set *X*, is the monoid of all finite strings using *X* as alphabet, with operation concatenation of strings. The identity is the empty string. In essence, the free monoid is simply the set of all words, with no equivalence relations imposed. This example is developed further in the article on the Kleene star.

### General case

In the general case, the algebraic relations need not be associative, in which case the starting point is not the set of all words, but rather, strings punctuated with parentheses, which are used to indicate the non-associative groupings of letters. Such a string may equivalently be represented by a binary tree or a free magma; the leaves of the tree are the letters from the alphabet.

The algebraic relations may then be general arities or finitary relations on the leaves of the tree. Rather than starting with the collection of all possible parenthesized strings, it can be more convenient to start with the Herbrand universe. Properly describing or enumerating the contents of a free object can be easy or difficult, depending on the particular algebraic object in question. For example, the free group in two generators is easily described. By contrast, little or nothing is known about the structure of free Heyting algebras in more than one generator.^{[1]} The problem of determining if two different strings belong to the same equivalence class is known as the word problem.

As the examples suggest, free objects look like constructions from syntax; one may reverse that to some extent by saying that major uses of syntax can be explained and characterised as free objects, in a way that makes apparently heavy 'punctuation' explicable (and more memorable).^{[clarification needed]}

## Free universal algebras

Let [math]\displaystyle{ S }[/math] be any set, and let [math]\displaystyle{ \mathbf{A} }[/math] be an algebraic structure of type [math]\displaystyle{ \rho }[/math] generated by [math]\displaystyle{ S }[/math]. Let the underlying set of this algebraic structure [math]\displaystyle{ \mathbf{A} }[/math], sometimes called its universe, be [math]\displaystyle{ A }[/math], and let [math]\displaystyle{ \psi\colon S \to A }[/math] be a function. We say that [math]\displaystyle{ (A, \psi) }[/math] (or informally just [math]\displaystyle{ \mathbf{A} }[/math]) is a *free algebra* (of type [math]\displaystyle{ \rho }[/math]) on the set [math]\displaystyle{ S }[/math] of *free generators* if, for every algebra [math]\displaystyle{ \mathbf{B} }[/math] of type [math]\displaystyle{ \rho }[/math] and every function [math]\displaystyle{ \tau\colon S \to B }[/math], where [math]\displaystyle{ B }[/math] is a universe of [math]\displaystyle{ \mathbf{B} }[/math], there exists a unique homomorphism [math]\displaystyle{ \sigma\colon A \to B }[/math] such that [math]\displaystyle{ \sigma \circ \psi = \tau. }[/math]

## Free functor

The most general setting for a free object is in category theory, where one defines a functor, the **free functor**, that is the left adjoint to the forgetful functor.

Consider a category **C** of algebraic structures; the objects can be thought of as sets plus operations, obeying some laws. This category has a functor, [math]\displaystyle{ U:\mathbf{C}\to\mathbf{Set} }[/math], the forgetful functor, which maps objects and functions in **C** to **Set**, the category of sets. The forgetful functor is very simple: it just ignores all of the operations.

The free functor *F*, when it exists, is the left adjoint to *U*. That is, [math]\displaystyle{ F:\mathbf{Set}\to\mathbf{C} }[/math] takes sets *X* in **Set** to their corresponding free objects *F*(*X*) in the category **C**. The set *X* can be thought of as the set of "generators" of the free object *F*(*X*).

For the free functor to be a left adjoint, one must also have a **Set**-morphism [math]\displaystyle{ \eta_X:X\to U(F(X))\,\! }[/math]. More explicitly, *F* is, up to isomorphisms in **C**, characterized by the following universal property:

- Whenever
*B*is an algebra in**C**, and [math]\displaystyle{ g:X\to U(B) }[/math] is a function (a morphism in the category of sets), then there is a unique**C**-morphism [math]\displaystyle{ f:F(X)\to B }[/math] such that [math]\displaystyle{ g=U(f)\circ \eta_X }[/math].

Concretely, this sends a set into the free object on that set; it is the "inclusion of a basis". Abusing notation, [math]\displaystyle{ X \to F(X) }[/math] (this abuses notation because *X* is a set, while *F*(*X*) is an algebra; correctly, it is [math]\displaystyle{ X \to U(F(X)) }[/math]).

The natural transformation [math]\displaystyle{ \eta:\operatorname{id}_\mathbf{Set}\to UF }[/math] is called the unit; together with the counit [math]\displaystyle{ \varepsilon:FU\to \operatorname {id}_\mathbf{C} }[/math], one may construct a T-algebra, and so a monad.

The **cofree functor** is the right adjoint to the forgetful functor.

### Existence

There are general existence theorems that apply; the most basic of them guarantees that

- Whenever
**C**is a variety, then for every set*X*there is a free object*F*(*X*) in**C**.

Here, a variety is a synonym for a finitary algebraic category, thus implying that the set of relations are finitary, and *algebraic* because it is monadic over **Set**.

### General case

Other types of forgetfulness also give rise to objects quite like free objects, in that they are left adjoint to a forgetful functor, not necessarily to sets.

For example, the tensor algebra construction on a vector space is the left adjoint to the functor on associative algebras that ignores the algebra structure. It is therefore often also called a free algebra. Likewise the symmetric algebra and exterior algebra are free symmetric and anti-symmetric algebras on a vector space.

## List of free objects

Specific kinds of free objects include:

- free algebra
- free associative algebra
- free commutative algebra

- free category
- free group
- free Kleene algebra
- free lattice
- free Lie algebra
- free magma
- free module, and in particular, vector space
- free monoid
- free commutative monoid
- free partially commutative monoid

- free ring
- free semigroup
- free semiring
- free theory
- term algebra
- discrete space

## See also

- Generating set

## Notes

## External links

- In nLab: free functor, free object, vector space

Original source: https://en.wikipedia.org/wiki/Free object.
Read more |