How do you explicitly form the dual of the Yoneda lemma? I'm self learning Category theory from Mac Lane's Category theory, and I'm trying to find the dual statement of the Yoneda lemma:

For every $K : D \rightarrow \text{Set} $ that is locally small and for every $r \in D$, there exists a bijection $y : \text{Nat}(D(r, -), K) \cong Kr$ by $\alpha : D(r, -) \rightarrow K \mapsto \alpha_r 1_r$.

I'm having trouble understanding the concept of duality and how I would take the dual of this.  Can someone EXPLICITLY explain the steps of how they would take the dual of this statement?
 A: Any category comes naturally equipped with two distinct functors into $\text{Set}$: there is the covariant functor $h^r\colon a\mapsto\text{Hom}(r,a)$ and the contravariant functor $h_r\colon a\mapsto\text{Hom}(a,r).$ There is a duality between them, in the sense that $h_r$ for the category $D$ is $h^r$ on $D^\text{op}.$ Turning the arrows around changes $D$ into $D^\text{op}$ and $h_r$ into $h^r$.
So to each object we can associate a presheaf or a co-presheaf. The covariant and contravariant Yoneda lemmas tell us that both associations are embeddings:


*

*if $K$ is a covariant functor $D\to \text{Set}$, then we have the natural isomorphism $\text{Hom}(D(r,-),K)\cong K(r)$, with the isomorphism given by $\alpha\mapsto \alpha_r(1_r).$

*if $K$ is a contravariant functor $D\to \text{Set}$, then we have the natural isomorphism $\text{Hom}(D(-,r),K)\cong K(r),$ with the isomorphism given by $\alpha\mapsto \alpha_r(1_r).$ 
To be even more explicit, let us note that the covariant Yoneda lemma applies to any category. In particular, if you turn the arrows around of $D$, you get the dual category $D^\text{op}$, which has $D^\text{op}(r,s)=D(s,r)$. If $f\colon s\to r$ is an arrow in $D$, then $f^\text{op}\colon r\to s$ is an arrow in $D^\text{op}.$ 
Now let's apply the Yoneda lemma to this category $D^\text{op}$. If $K$ is a covariant functor $D^\text{op}\to\text{Set},$ then we have $\text{Hom}(D^\text{op}(r,-),K)=\text{Hom}(D(-,r),K)\cong K(r).$ But a covariant functor $D^\text{op}\to\text{Set}$ is nothing but a contravariant functor $D\to\text{Set}.$ Thus we see that the contravariant Yoneda lemma is nothing but the covariant Yoneda lemma applied to the category $D$ with its arrows reversed.

So the covariant and contravariant Yoneda lemmas are dual in the sense that they are identical theorems, states for two categories which are dual to one another. But another way to get dual statements in category theory is to dualize everything in sight. Every line of the theorem. Any statement in the language of category theorem has an equivalent dual statement. For example, the statement that $A\times(B+C)\cong A\times B+A\times C$ is a natural isomorphism (which holds in any distributive category) has a dual statement $A + (B\times C)\cong (A+B)\times(A + C).$ We turn all limits into colimits.
To achieve this for the Yoneda lemma, let's not just replace $D$ by its opposite, but also $\text{Set}$ by its opposite, and turn all products into coproducts, etc.
This is called the co-Yoneda lemma, which states that $$\int^{r\in D}D(r,s)\times K(r)\cong K(s)$$ (and also comes in a contravariant version), and is the formal dual of the Yoneda lemma, in the sense that the coend is the dual limit of the end, and tensor product is the dual of hom.
To go into a bit more detail on this, note that the set of functions between two sets $\text{Hom}(S,T)$ is isomorphic to a product $T^S=\displaystyle\prod_{s\in S}T.$ Products admit categorical descriptions in terms of universal properties, and as such they have duals, calls disjoint unions, or sums, formed by reversing the arrows in the universal diagram.
The dual of the weighted product $\displaystyle\prod_{s\in D}K(r)^{D(s,r)}$ is the weighted sum $\displaystyle\sum_{s\in D}D(s,r)\times K(r).$
The covariant Yoneda lemma says that two functors $D\times \text{Set}^D\to\text{Set}$ are isomorphic, the two functors being "take hom, i.e. weighted product" $(r,K)\mapsto \text{Hom}(h^r,K)$ and "evaluate" $(r,K)\mapsto K(r)$. The contravariant Yoneda lemma says the same thing about the two functors $D^\text{op}\times \text{Set}^{D^\text{op}}\to\text{Set}.$
Dualizing literally everything in sight, we have isomorphism of two functors $D^\text{op}\times (\text{Set}^\text{op})^{D^\text{op}}\to\text{Set}^\text{op}$ and of two functors $D\times (\text{Set}^\text{op})^{D}\to\text{Set}^\text{op}.$ Weighted products in $\text{Set}^\text{op}$ are weighted sums in $\text{Set},$ therefore these isomorphisms are the co-Yoneda lemma. Instead of taking the dual of our starting category, we take the dual of the functor category in which the isomorphisms live.
