A variety of algebras is a classical notion from universal algebra that includes nearly all of the usual kinds of algebraic objects, such as groups, rings, vector spaces (over a fixed field), and so on. Those algebraic objects that don't form a variety of algebras, such as fields, can still usually be easily described as a subclass of an algebraic variety (in this case, commutative rings).
A variety of algebras is not to be confused with an algebraic variety, although in fact there is a connection: both concepts are (roughly speaking) given by a set of equations, but an algebraic variety is the set of elements (of a fixed generic structure) that satisfy the equations, while a variety of algebras is the class of structures in which every element satisfies the equations.
A signature (in this context) is a set, whose elements are called operations, to each of which is assigned a cardinal number () called its arity. A signature is finitary if its set of operations is finite (in the strictest sense for the purposes of constructive mathematics) and every arity is finite (so a natural number); similar definitions apply to other arity classes. Given a signature and a set , whose elements are called variables1, a word (in using ) is a (well-founded directed rooted) tree in which each node is labelled by either a variable or an operation, such that every node labelled by a variable has no branches away from the root and every node labelled by an operation has as many branches away from the root as the arity of . An axiom (in using ) is a pair of such words; we write the axiom consisting of the words and as or . An theory (in our sense) consists of a signature and a set of equational axioms in . An algebraic theory is finitary if its signature is finitary and its set of equational axioms is finite (Kuratowski-finite in constructive mathematics); analogous remarks apply to other arity classes.
An algebraic variety is given precisely by a theory in this sense, but it is more usual to think of the variety as being the class (or category) of models, so we continue with the definitions.
Given a theory , a model or algebra of consists of a set together with, for each operation of with arity , a function to from its th cartesian power such that, for each axiom and each assignment of elements of to the variables in that axiom, the equation holds that is given by applying the operations to the elements of as indicated by the trees defining and (the meaning of which we hope is obvious). We say that carries the operations and satisfies the axioms.
Given a algebras and of the same (quasi)-algebraic theory, a homomorphism from to consists of a function such that, for each operation, the diagram
commutes. We say that preserves the operations.
It is fairly straightforward to define a model (and homomorphisms) in any cartesian monoidal category , replacing Set in the two paragraphs above. But note that the operations and axioms still form sets, not objects of ; the theory is independent of the modelling category. In any case, given any theory and any cartesian monoidal category , the models of in (as objects) and the homomorphisms between them (as morphisms) for a category, which is the the variety of -algebras in .
A sorted variety or many-sorted variety is a generalisation. A sorted signature or many-sorted signature consists of a set, whose elements are called sorts, together with operations and arities as before, except that now an arity is a list of input sorts instead of merely a natural number (the length of the list) together with one output sort. Each variable in an axiom comes equipped with a sort, which we may also classify as an output sort; then each branch in (the tree reprsenting) a word must link output sort to input sort. The root of a word gives the entire word a sort; the two words in an equational axiom must have the same sort. Then a model of a sorted variety consists of one set for each sort, and the rest should be obvious. A sorted variety is finitary if it satisfies the finitarity conditions of a variety and its set of sorts is also finite. An ordinary variety as above may be called unsorted or single-sorted to avoid invoking the red herring principle; it is the same thing as a sorted variety with exactly one sort.
Another generalisation is a quasivariety. While an axiom in a variety gives an equation, an axiom in a quasivariety is a Horn clause, stating that one equation (the consequent) holds whenever each equation in some set of equations (the premises) holds. A Horn clause is finitary if this set of premises is (Kuratowski)-finite; a quasivariety is finitary if it satisfies the fintarity conditions of a variety and additionally each Horn clause is finitary. An ordinary variety is a quasivariety in which each Horn clause has an empty set of premises.
For each definition of an appropriate algebraic object, there is a corresponding variety of algebras, a few of which are given below:
The variety of groups is given by a theory with three operations (traditionally called multiplication, identity, and inverse), with respective arities (so multiplication is a binary operation, identity is a nullary operation, and inverse is a unary operation). There are five axioms, given by the following pairs of trees (with their traditional names):
Then a model of this variety is a set together with functions , (which may be identified with an element of ), and such that, for all in , , , , , and . In other words, an algebra in this variety is simply a group. Similarly, a homomorphism of such algebras is simply a group homomorphism. Also, an algebra in this variety in the category is a group object in .
Note that it is not necessary to draw explicit trees; these can be recovered from the succinct equations like ; we will do this below.
The variety of monoids is given by a subtheory of the theory of groups. It has only the operations and the axioms (1),(2),(3). An algebra in this theory is a monoid, and a homomorphism of such algebras is a monoid homomorphism (including the condition that it preserve the identity).
There is no variety of cancellative monoid?s, but there is a quasivariety of them. In addition to the axioms for a monoid, we have an axiom stating that the equation follows from the equation , which we write succinctly as .
The variety of abelian groups is given by a supertheory of the theory of groups. In addition to the operations and axioms of the variety of groups, it has an additional axiom, the commutative law: .
The variety of (associative unital) rings has five operations , with respective arities , and ten axioms. Five of these axioms are those of groups, applied to in place of ; three of these axioms are those of monoids (applied to as before). The remaining two axioms are:
There is no variety or quasivariety of fields; the elements with multiplicative inverses are not identified by an equation. One can, however, define fields as certain rings and then get the correct notion of field homomorphism as a ring homomorphism between rings that happen to be fields.
The variety of (real) vector spaces has infinitely many operations and axioms (so is not finitary). First, there are operations with the arities and axioms of an abelian group (as with rings). In addition, there is one operation of arity for each real number , satisfying these axioms:
There is a similar variety of vector spaces over any given ground field, but there is no variety of vector spaces over arbitrary fields, since we would have to specify the field as well as the vector space. The problem is not really that there is no variety of fields; there is no variety of (left) modules over arbitrary commutative rings either. However, there is a sorted variety of modules over arbitrary rings, with two types, one for the ring and one for the module. Even though this variety includes the non-finitary variety of real vector spaces, it is itself a finitary sorted variety.
A variety of algebras is one way to look at an algebraic theory.
As a logical theory, everything that we wish to say can be said in (typed or untyped, to match the variety) cartesian logic (although one might want to use something stronger, such as full classical or intuitionistic predicate logic with equality). We use one function symbol (of matching arity) for each operation, and each axiom in the variety becomes an axiom in the logic, a universally quantified equation. Then the models of this logical theory are the same as the algebras in the variety.
As a Lawvere theory, an untyped finitary variety of algebras defines a category whose objects are of the form for a natural number. The morphisms of the category are those which are necessary to make the -fold product of , along with one morphism for each operation in the variety. Each axiom of the variety corresponds to a commutative diagram, and is freely generated by these as a sketch. Then the models of the variety in a cartesian monoidal category are the same as the product-preserving functors from to . Conversely, any locally small (and hence small) cartesian monoidal category whose objects are all of the form may be thought of as a Lawvere theory and defines an untyped variety of algebras, with operation for each morphism to and one axiom for each commutative diagram. (This can all be generalised to sorted varieties as well.)
A variety of algebras can be seen as a cartesian version of a (typed or untyped) operad; whereas an operad has models in any symmetric monoidal category, a variety of algebras has models only in a cartesian monoidal category.
A variety of algebras is traditionally identified with its category of models in (or even with simply the class of objects of this category), but it then becomes unclear what an algebra in the variety would be in some other category . However, it is worth noting that is always an algebraic category; see below for the construction of free objects.
Given a variety and a cartesian monoidal category (such as ), let be the category of algebras in in , with homomorphisms as morphisms. There is an obvious forgetful functor ; is a cocomplete -pretopos (or if is just a -pretopos if is finitary), then has a left adjoint, the free functor . In fact, this adjunction is monadic; we can identify the models of in with the modules/algebras of the monad .
Given an object of , we construct the free algebra as follows. First, let be the inductive type in given by the signature of , that is the initial algebra of the endofunctor , where ranges over the operations of and is the arity of . Then each axiom specifies an internal binary relation on ; the colimit of these is . Note that, if is and is a set, then consists precisely of the words (defined as trees above) with variables from .
The word problem for a variety consists of deciding, whenever is a finite set, whether two elements of are equal in . As a problem in algorithmic decidability, the word problem can be very difficult; for example, it is:
even though each of these is a supertheory of the next.