Evolution of cooperation with contextualized behavior

How do networks of social interaction govern the emergence and stability of prosocial behavior? Theoretical studies of this question typically assume unconditional behavior, meaning that an individual either cooperates with all opponents or defects against all opponents-an assumption that produces a pessimistic outlook for the evolution of cooperation, especially in highly connected populations. Although these models may be appropriate for simple organisms, humans have sophisticated cognitive abilities that allow them to distinguish between opponents and social contexts, so they can condition their behavior on the identity of opponents. Here, we study the evolution of cooperation when behavior is conditioned by social context, but behaviors can spill over between contexts. Our mathematical analysis shows that contextualized behavior rescues cooperation across a broad range of population structures, even when the number of social contexts is small. Increasing the number of social contexts further promotes cooperation by orders of magnitude.