In category theory, a branch of mathematics, duality is a correspondence between the properties of a category C and the dual properties of the opposite category C<sup>op</sup>. Given a statement regarding the category C, by interchanging the source and target of each morphism as well as interchanging the order of composing two morphisms, a corresponding dual statement is obtained regarding the opposite category C<sup>op</sup>. (C<sup>op</sup> is composed by reversing every morphism of C.) Duality, as such, is the assertion that truth is invariant under this operation on statements. In other words, if a statement S is true about C, then its dual statement is true about C<sup>op</sup>. Also, if a statement is false about C, then its dual has to be false about C<sup>op</sup>. (Compactly saying, S for C is true if and only if its dual for C<sup>op</sup> is true.)
Given a concrete category C, it is often the case that the opposite category C<sup>op</sup> per se is abstract. C<sup>op</sup> need not be a category that arises from mathematical practice. In this case, another category D is also termed to be in duality with C if D and C<sup>op</sup> are equivalent as categories.
In the case when C and its opposite C<sup>op</sup> are equivalent, such a category is self-dual.
We define the elementary language of category theory as the two-sorted first order language with objects and morphisms as distinct sorts, together with the relations of an object being the source or target of a morphism and a symbol for composing two morphisms.
Let ÃÂ be any statement in this language. We form the dual ÃÂ<sup>op</sup> as follows:
Informally, these conditions state that the dual of a statement is formed by reversing arrows and compositions.
Duality is the observation that ÃÂ is true for some category C if and only if ÃÂ<sup>op</sup> is true for C<sup>op</sup>.
Applying duality, this means that a morphism in some category C is a monomorphism if and only if the reverse morphism in the opposite category C<sup>op</sup> (composed by reversing all morphisms in C) is an epimorphism.
This example on orders is a special case, since partial orders correspond to a certain kind of category in which Hom(A,B) (a set of all morphisms from A to B of a category) can have at most one element. In applications to logic, this then looks like a very general description of negation (that is, proofs run in the opposite direction). For example, if we take the opposite of a lattice, we will find that meets and joins have their roles interchanged. This is an abstract form of De Morgan's laws, or of duality applied to lattices.