Composition of Games as a Model for the Evolution of Social Institutions

The evolution of social institutions (e.g. institutions of political decision making or joint resource administration) is an important question in the context of understanding of how societies develop and evolve. In principle, social institutions can be conceptualized as abstract games with multiple players and rules about individual decision making and individual and joint outcomes. Here we propose a formal approach for the composition of games (e.g. Prisoner’s Dilemma – PD) to model the evolution of social institutions. Following a generalized description of the approach, we describe two examples of application for the composition of PD games. We assess the impact of the composed games on the level of cooperation. We discuss the implications of the proposed approach and how it may help to develop effective models of social institution


Introduction
Social institutions form the underlying decisional structures and processes of societies (Boyd and Richerson, 2008;Fukuyama, 2012). These institutions comprise of sets of rules, roles, norms and values that are organized in a specific pattern and which operate accordingly to produce social outcomes that can be interpreted as decisional outcomes (Boyd and Richerson, 2009;Fukuyama, 2012). For example, communal fishing or forest committees in rural communities manage the common resources for the benefit of every family in the community or judges and judicial support organizations manage the application of law in the case of disputes and deliver justice according to the law to the parties involved. Understanding how institutions change and evolve is important to understand how societies evolve. However, at the moment this understanding is effectively based on particular documented case studies, and most overarching theories are at best partial, often questionable at least in parts, and also often simplistic (Boyd and Richerson, 2008;Fukuyama, 2012;Olson, 1994;Turchin, 2006;Mokyr, 2017;Smaldino, 2019;Pletzer et al, 2018;Powers and Lehmann, 2013;Elster, 1989). One approach to model social institutions is to use inspiration from game theory and games as understood in the context of this theory (Rand and Nowak, 2013;Axelrod, 1997;Pletzer et al, 2018;Powers and Lehmann, 2013). According to this approach, a social institution is conceptualized as a multiplayer game, with a set of interaction rules, decision options and pay-off calculation rules. For example, voting games are used to calculate models of coalition forming (Roth, 1988).
The theory of cooperation and the use of game theory and games in this context provide an example of how the games approach to modeling of social institutions can lead to a model of the evolution of individual behavior in the setting of a social institution (Powers and Lehmann, 2013;Rand and Nowak, 2013;Smaldino, 2019;Boyd and Richerson, 2009). Evolutionary game theory models and simulations can be used to show how cooperation emerges and stabilizes in social settings, where the cooperation is represented by sharing or solidarity decisions (Powers and Lehmann, 2013;Rand and Nowak, 2013;Smaldino, 2019;Pletzer et al, 2018). While evolutionary game theory is good to show how cooperation may emerge, it is also limited in the sense that it does not provide further tools to analyze how cooperative behavior may trigger institutional changes, leading to the evolution of the modeled social institutions.
Here we propose the composition of games to model the evolution of social institutions. We assume that social institutions are modeled by games interpreted in game theoretical setting. We describe how such games can be composed in a consistent manner, using a set of composable components, such that they lead to meaningful new games. We describe how this approach can be used for the investigation of the evolution of social institutions.
We describe two particular cases of using the proposed game composition framework to develop new multi-player games from Prisoner's Dilemma games. We analyze the impact of these games on the evolution of cooperative behavior and the stable patterns of cooperative behavior. Our results show that composed games lead to higher levels of cooperation than the one corresponding to the component games, and that considering further factors as well (e.g. available resources, population size) they lead to more successful populations than the ones that rely on the component games only.
The rest of the paper is structured as follows. First we review related works. Then we describe institutions as games and the composition of games. This is followed by the description of the cases of game composition that we consider and the analysis of the impact of the new games on the level of cooperation and other features of simulated populations of agents. Then we discuss the implication of the proposed game composition framework and the application examples to the modeling of the evolution of social institutions. Finally, the paper is closed by the conclusions section.

Related Works
Cooperation theory aims to explain the cooperative behavior among self-interested individuals, such as in the case of humans, animals or cells that appear to act together for a common purpose and benefit (Rand and Nowak, 2013;Axelrod, 1997;Pletzer et al, 2018). The theoretical explanations of cooperation follow a few main lines of reasoning. The argument based on inclusive fitness and kin selection (Rand and Nowak, 2013) assumes that individuals are willing to support others who share their genes, maximizing the spreading of the shred genes. Reciprocal altruism (Rand and Nowak, 2013) assumes that a cooperative action supporting another individual may get reciprocated later and those who are willing to reciprocate will gain an advantage from this in the context of evolutionary selection. The image scoring (Rand and Nowak, 2013) argument assumes that individuals observe the behavior of others and are willing to cooperate with others who have been seen to be engaged in cooperation before. A further approach based on a joint investment argument (Roberts and Sherratt, 1998) assumes that cooperative action is seen as a joint investment which triggers the continuation of cooperative action in order to avoid loss of the joint investment. Further theoretical approaches consider particular circumstances, such as the network structure of interactions or spatial location of individuals (Mitteldorf and Wilson, 2000;Rand and Nowak, 2013). Cooperation theory generally relies on the use of game theory tools for the conceptualization of situations that offer the opportunity of cooperation.
Social institutions deliver decision making mechanisms within the society, which are used to allocate resources, resolve conflicts and channel the representation of interests of individuals, groups and communities (Boyd and Richerson, 2009;Fukuyama, 2012;Olson, 1994;Elster, 1989). In general, participation of individuals in social institutions has the potential to deliver common benefits (this is true even in competitive cases, where one or some of the participants end up as winners and the others as losers). Social institutions also use incentives (i.e. individual payoffs, which may take the form of punishments and rewards) to nudge and compel individuals to follow the rules of the institution and contribute to the generation of common benefits (Sigmund et al, 2010;Traulsen et al 2012;Balafoutas et al, 2014;Han et al, 2017). Thus, models originating from cooperation theory fit for the purpose of modeling at least the simple cases of behavior in the context of social institutions. Consequently, cooperation theory and the corresponding games have been used to describe and analyze models of social institutions (Powers and Lehmann, 2013;Smaldino, 2019;Boyd and Richerson, 2009).
Computational simulations using agent-based models are part of the core cooperation theory research (Rand and Nowak, 2013). Such simulations aim to capture key features of behavior in relatively simple models of agents that represent individuals. The computational simulation of such agents, their decision making and behavior, and of communities of agents in which agents interact according to their behavioral rules, serves as method for study of the evolution and emergence of cooperative behavior. The simplest two participant games are the Prisoner's Dilemma (Andras, 2016) and the Rock-Paper-Scissor (Andras, 2018), which have been implemented in a wide variety of agent-based models of cooperation evolution.
The evolution of social institutions has been the subject of many investigations in the context of social sciences (Boyd and Richerson, 2008;Fukuyama, 2012;Olson, 1994;Turchin, 2006;Mokyr, 2017;Elster, 1989). For example, Fukuyama (2012) explored the impact of institution evolution on the potential of historical states and societies to grow and maintain themselves. Turchin (2006) analyzed how the levels of cooperation relate to the presence of successful social institutions in competing historical societies. For the purpose of modeling the evolution of social institutions researchers have used agent-based modeling approaches and analyzed how models of evolution of cooperation can be used to capture aspects of evolution of social institutions (Powers and Lehmann, 2013;Andras, 2018).
One of the most advanced analysis of games and game playing has been developed in the context of two player multiturn strategic games, such as chess, go and other similar, but simpler, games (Mellies and Mimram, 2007;Ramanujan and Simon, 2008;Basset et al, 2014;van Benthem, 2002;Clairambault et al, 2012). In the context of the analysis of game playing strategy in such games, researchers have proposed the use of composition of strategies and defined how formally described strategies can be composed (Ramanujan and Simon, 2008;Basset et al, 2014). While this kind of game and game playing analysis is very interesting and has numerous application (e.g. in the case of industrial robotics) and in an abstract sense even resembles the playing of roles in social institutions, it is of limited use for the analysis and modeling of evolution of actual social institutions, due to the highly specific nature of the analyzed games (i.e. multi-turn, two player, with a set of very specific rules on possible moves and situation/outcome assessment).
A further relevant aspect of the evolution of social institutions is the evolution of the conceptual language used in the context of these institutions (Skyrms, 2014). The development of new concepts that capture aspects of the social and physical environment, which become relevant because of the operation of existing institutions, is required for major innovations in social institutions. There is considerable work on the development of the language to conceptualize novel aspects of the environment (Skyrms, 2014;Barett et al 2019;Barett et al 2018;Lacroix, 2019). However, in this paper we do not address this aspect of evolution of social institutions and we restrict ourselves to modeling institutional evolutions at the level which does not require conceptual innovations in the language used to communicate for the delivery of roles within the social institutions.

Composition of Games
In this paper we conceptualize social institutions as games with a number of participants and a number of decision stages and outcomes for each participant. The participants in the game follow the rules of the game and choose from a set of decision options, possibly in a single stage or through multiple stages. The participant decisions get aggregated according to the rules of the game and possibly after several stages of aggregation lead to game outcomes for each participant. In  A simple example of such games is the Prisoner's Dilemma game, in which there are two participants, each participant can principle, this generic formulation of games captures a wide variety of social institutions, such as community decision making over resources, resolution of conflicting claims over resources, selection of representatives for community decision making and so on. The participants choose from the same two decision options (cooperate and defect), and the game rules define the outcome for the two participants depending on their decision choices according to the following table. This game for example can be seen as a representation of social decision making about commonly used resources (e.g. fishing areas, pasture land, water for irrigation).

Participant
To define the composition of games we introduce here the key components of games in terms of diagram elements. The elements are Decision, Aggregation, Splitting and Impact blocks. Each of these is described below. Each block has an associated set of rules, which describe how the block operates over its inputs to generate its outputs.
The Decision block as shown in Figure 1A. The Decision block has an input line carrying the identification of a participant of the game and has an output line carrying a decision label. The Decision block represents the decision choice made by the participant. For example, in the board of a company the representatives of the shareholders make a decision about supporting or opposing an investment proposal. Formally a Decision block can be defined as a sample generator for a random variable DB, where the random variable is defined over a set of possible decisions DS = {d1, …, dn} with a probability distribution over this set PD = {f1, …, fn} such that f1 + … + fn = 1. The probability distribution PD depends on the participant (e.g. status, resources, location) and also on the context (e.g. the knowledge about other participants and past experience of playing the game). Thus PD is formally set as the value of a function defined over the Cartesian product of sets of possible values for participant features and context factors.
The Aggregation block is shown in Figure 1B. This block can have multiple decision input lines and has one or more decision output lines. The Aggregation block represents the conversion of a set of decisions into another set of decisions, according to the rules of the game. As a real world example, we may consider the case of decision about the location of a waste incinerator, where the relevant local authorities make decisions about their high level preferences (e.g. they may prioritize creation of jobs over pollution, or they may express their need for a district heating resource, and so on), then these decisions are translated through negotiation into another set of decisions that constrain the possible options for the location of the waste incinerator. The Aggregation block can be defined formally as function from one Cartesian product of decision sets to another Cartesian product of decision sets, A: The Splitter block has a single decision input and a number of decision outputs. This represents the derivation of a set of decisions from a single decision in the context of the rules of the game. For example, when a community association decides about organizing a local parade on a certain date in a certain location, this decision is converted into a number of operative decisions about who is in charge of various aspects of the event, which entertainment and security service providers need to be contacted and engaged and so on. The Splitting block can be defined formally, similarly to the Aggregation block, as function from one decision set to a Cartesian product of decision sets, S: We note that the primary outcomes following from decisions are represented in this approach as decision labels. For example, the decision about the location of waste incinerator, following the above example, is considered as a decision label with the specific location included in it.
The final diagrammatic elements are the Impact blocks, which translate the outcome decisions into impact on  Table 1. The Impact Block updates the resources of the participants according to the calculated payoffs represented by the outcome decisions.
participants in the game. An Impact block has one or more decision inputs and has one output line carrying the identification of a participant. The Impact block alters the features (e.g. resources) of the corresponding participant according to the rules of the game about how outcome decisions are translated into impact on the participant who gets the outcome decision. A real world example is when a contested planning application for an estate development leads to an outcome decision that requires the alteration of the planned development, and as an effect the developer has to change the development budget assigned for the development project. Formally the Impact Block is a function over a Cartesian product of decision sets with values in a Cartesian product of sets that represent possible impacts on participant features.
We note that the ordering of input and output lines of the blocks in general may matter, if the corresponding game rules treat inputs and outputs in a non-commutative manner. For a practical example, consider the case decisions over industrial patent disputes, where the timing of the filing of the patent applications determines the priority and the outcome of the decision. Similarly, the outcome decisions in the context of a dispute over an industrial contract may imply an inherent ordering of the application of the impacts, for example one company may need to deliver a particular action, before the other company can deliver a further required action, or one company may need to implement a required action in a particular location, while another company may also need to implement the same action, but at a different location. It is also possible that decisions of the same kind carry a weight associated with them. For example, in the case of voting in the board of a company the vote of the shareholders is weighted by their shareholding volume.
Using the above introduced diagrammatic elements, we can represent the Prisoner's Dilemma game as shown in Figure 2.
A diagram composed of decision, aggregation, splitting and impact blocks, where the blocks are connected by their output and input lines, represents a valid game, if for each participant input line there is a participant impact output line (some of the impact outputs may implicate no change to the respective participant) and the way how the blocks are connected is consistent with the corresponding decision, aggregation, splitting and impact rules that apply to the respective blocks. The diagram of a valid game should be such that the formal functions associated with the diagram blocks are composable in a meaningful way.  Diagrammatic composition of games means the combinations of two games using their diagrammatic representation, such that the resulting diagram describes a meaningful game. The outcome decisions of one game may be used as initial decisions for the other game. Or in a more general sense, elements of the two games may be composed in novel ways to generate a meaningful game. As above, the composition of game blocks has to be meaningful in terms of the functions associated with the blocks. Below we provide two examples of composed games in Figures 3 and 4.
The game with the diagram in Figure 3 is a combination three Prisoner's Dilemma games, played by three participants in all three combinations of pairs between them, and with the outcomes summed up for games played by each participant.  participants (2r, 2r, 2r), (r + s, 2t, r + s), (2s, t + p, t + p), (2p, 2p, 2p). The game with the diagram in Figure 4, similarly is a combination of three Prisoner's Dilemma games, in a similar manner, however with the difference that the payoff decisions are rewritten by an additional aggregation block into a new payoff for each participant. One consistent option for the new payoffs is to have altered multipliers for the summing up of the Prisoner's Dilemma payoffs. In this case the final possible payoffs, for the three participants, are (1r, 1r, 1r), (2r + 2s, 2t, 2r + 2s), (3s , 3t + 3p, 3t + 3p), (4p, 4p, 4p), where 1, 2, 3, 4, 2, 3, 2, 3 are parameters. The first composed game is an aggregation of simpler games, the second composed game adds an additional layer of composition by mapping the aggregation of the direct composition of simpler games onto a new set of context dependent outcome decisions. The diagrammatic representation of games that we introduced here allows to compose games relatively easily in a meaningful way, i.e. such that the game blocks have appropriate inputs and outputs an these are combined in a meaningful manner.
The evolution of social institutions can be captured through the composition of games representing social institutions. Social institutions evolve by adding further rules to their decision making processes, involving additional decisions, or involving additional participants. These steps of institutional evolution can be formulated in the context of game composition by adding of new aggregation blocks or splitting blocks to the game, or by extending the set of decision blocks and impact blocks, or by increasing the number of input lines to aggregation and impact blocks, within the diagram of the game. The addition of aggregation blocks or addition of extra input lines to aggregation blocks or impact blocks may also mean the integration of novel games as components, through composition with the original game. Thus, by representing social institutions as games and using the diagrammatic representation of games as described above, we can implement models of scenarios of evolution of social institutions.
To make the modeling of social institution evolution complete, we need to define some measure of success for social institution. This then allows the simulation of evolution of alternatives of social institutions and the analysis of which one generates more successful outcomes for their social environment. Naturally, the measures of success may vary. The simplest options are to consider the size of the population of modeled societies characterized by different institutions or sets of institutions, or to consider the resource wealth of the simulated societies, or to consider the sustainability of the exploitation of the environmental resources, and so on.

Composed Games and the Evolution of Cooperation
We present here simulations of agent societies with different kinds of social institutions based on the Prisoner's Dilemma games. We aim to analyze the impact of different social institutions on the level of cooperation as this emerges and varies in the simulated agent societies. This analysis demonstrates the usefulness of the game composition based conceptualization of social institution evolution.
We consider three variants of agent societies with different social institutions driving the interaction and joint decision making of the agents. First, we consider an agent society where the agents generate new resources by playing in pairs the Prisoner's Dilemma game represented diagrammatically in Figure 2. Next, we consider an agent society where triplets of agents play the game composed from Prisoner's Dilemma games represented in Figure 3. Finally, we consider an agent society where the resource production is managed by playing the game with the diagram representation in Figure 4, by groups of three agents. The performance of the agent societies is measured in terms of population size, average amount of resources of agents and the level of cooperation within the agent society, i.e. the percentage of agents who are involved in a Cooperate / Cooperate interaction. We note that in the case of games played by triplets of agents, the Cooperate / Cooperate interactions are considered for each pair of agents within the triplet.
The general simulation settings follow the settings reported in previous papers (Andras, 2016(Andras, , 2018. The agents exist in a two-dimensional world, where they move by random movements. The boundaries of the world are reflective in terms of movement of agents (i.e. if an agent's move would move it beyond the boundary, it gets bounced back from the boundary by the amount of movement that would go beyond the boundary).
The agents get involved into playing a game, which is used to generate resources for the participating agents. Depending on the game the agents form pairs or triplets to play the game. Only agents that are located sufficiently close in their two dimensional world can play together a game.
Each agent starts with a randomly set age and when it reaches the maximal age (in our simulations this is set to 60 time turns) it reproduces asexually. Agents own resources, additional resources are generated by playing games, and each time turn has a set resource cost (1 resource unit in our simulations). When agents come to the point of reproduction, only agents with sufficient amount of resources can reproduce in our simulations the required amount of resources is set to be the resource amount which is half standard deviation below the mean resource amount for the current population. The number of offspring depends on the amount of resources of the agent that is reproducing, more available resource implying larger number of offspring. The offspring agents divide equally their parent's resources. The initial location of the offspring agents is set by a small random movement added to the position of the parent agent (i.e. the offspring are clustered around the position of their parent, following their generation). Agents that lose all their resources die without offspring.
The outcomes of the games in terms of additional resources are set as described earlier. In the case of the Prisoner's Dilemma game, the outcomes are given by Table 1, with the specific setting of the payoff values as r = 3, t = 4, s = -2 and p = -1. In the case of the composed Prisoner's Dilemma game represented by the diagram in Figure 3, the payoffs are as indicated in the previous section, i.e. (6, 6, 6), (1, 8, 1), 3,Figure 5: The steady state level of cooperation in the three simulated agent societies. PDagent societies that play the Prisoner's Dilemma game in pairs. 3PD Combinedagent societies that play the combination of three Prisoner's Dilemma games between a triplet of agents. 3PD Modifiedagent societies that play the combination of three Prisoner's Dilemma games followed by the decision rewriting modification, between a triplet of agents. The data shown is calculated as a moving average over 21 time turns. The standard deviations are not shown to not clutter the figure. 3), (-2, -2, -2). In the case of the composed Prisoner's Dilemma games represented by the diagram in Figure 4, the parameter values are set as 1 = 2.5, 2 =1, 3 = 2, 4 = 2, 2 = 1, 3 =1, 2 = 2.5, 3 = 0.85, thus the payoffs are (7.5, 7.5, 7.5) , (1, 10, 1), (-5, 2.4, 2.4), (-2, -2, -2).
The agents play the game in a probabilistic manner. Each agent has an inclination to cooperate, which is represented by a number  in the range of (0,1). The agent makes it decision choice by generating a random number  in the (0,1) range. If  < , the agent decides to cooperate, otherwise to defect. In the case of games played by triplets of agents, each agent makes a single decision, as indicated by the diagrams of the games. The agent's offspring inherit the cooperation inclination of their parent with a small random deviation.
The simulations in each case are played for at most 1,200 time turns. In each time turn agents are matched into pairs or triplets, depending on the game they play. It is always possible that some agents are left out from the game playing if they do not get selected into playing pairs or triplets. In each time turn the agents move once, following the closing of all played games.
We also have considered simulations where we disperse the offspring of the agents, so these do not form clusters after their generation. However, in all three cases of the games that we consider here, the spread-out offspring scenario led often to early die out of the agent populations, so these are not reported in the paper.
Our simulations aim to produce long-lived agent communities in which we can measure the performance indicators for the agent society over many time turns (i.e. for the full 1,200 time turns). Thus, the simulations need to start with a sufficient number of initial agents (typically in the range of 1,500 -4,500 agents). Furthermore, we also implemented the use of a general multiplier  that is applied to all payoff values, to make sure that the game playing Figure 6: The relative population size of the three simulated agent societies during the steady state period. The games are as in Figure 5: PD, 3PD Combined, 3PD Modified. The data shown is calculated as a moving average over 21 time turns. The standard deviations are not shown to not clutter the figure. generates sufficient amount of resources that sufficient number of agents survive for their full life time and also that the population does not explode overly quickly beyond a manageable number of agents (the maximum allowed number of agents is set to 68,000). The value of  is set in the range of 0.3 -3.5, depending of the game played. We ran around 20 simulations for each of the three settings with the different games played by the agents.
For the purpose of analysis we consider the characteristics of the agent societies during the steady state of their evolution, which in the case of our simulations is the final third of the simulated evolution, i.e. the time period between time turns 800 and 1,200. We calculated the average indicators across all simulations of the same kind and also the standard deviations of these indicators. Figure 5 shows the level of cooperation in the three social settings of the agent societies, where the social institutions are implemented as the three kinds of games played by the agents. The results show that the steady state level of cooperation is the lowest in the case of the agent society where the agents play the basic Prisoner's Dilemma game (diagrammatically represented in Figure 2). The highest level of steady state cooperation is achieved in agent societies that use the combination of three Prisoner's Dilemma games with the added rewriting of the decision outcomes (see the game diagram in Figure 4). The agent societies with a social institution implemented as the game represented in Figure 3, achieve a middling level of steady state cooperation.
In our interpretation this result shows that social institutions of increasing complexity can facilitate the increase in the steady state level of cooperation between self-interested individuals. While the examples of representations of social institutions are very simple (i.e. Prisoner's Dilemma game and its combinations and a relatively simple alteration), these examples capture a key aspect of difference between social institutions, which is their decisional complexity, measured by the number of elementary decisions that lead to the final outcome of the interactions between the agents / individuals. The most complex social institution that we considered increases the benefit of full triplet cooperation relative to other outcomes, with the exception the outcome for the cheater, who plays with two cooperators. This modification of the outcomes, by rewriting the outcome decisions through the use of the Aggregation Block 2 (see Figure 4) delivers the increase of the steady state level of cooperation (see Figure 5).
Next we consider the size of agent populations during the steady state period. Given that different simulations required different starting population sizes, to avoid early die-out and prevent rapid over-growth, we consider for the purpose of comparison relative population sizes. The relative size of a population is calculated as the ratio between the current size and the initial size of the population.
The results in terms of population size are shown in Figure  6. The results show that the agent populations with more complex social institutions achieve higher relative population size than the agent society with the simplest social institution. The data indicates that the relative size of populations for agent societies with more a complex social institution is larger than the relative size of populations for agent societies with a less complex social institution.
Finally, we considered the amount of resources available to agents in the simulated agent societies. For, this again we looked at relative resource volumes, again to avoid the impact of different initialization conditions and other differences in parameters, which make direct comparison of values difficult to interpret. The relative resources are calculated by dividing the current amount of average resources of agents by the initial amount of average resources of agents. We consider in particular the resources available to agents who participate in cooperation interactions in a given time turn. We note that in general, in a given time turn, the average resource of agents who decide to cheat is higher than the average resource of cooperators, and the average resource of agents, which cooperate, but have a cheating partner, is less than the average resource of cooperators. Figure 7 shows the result of comparison of average resources of cooperators during the steady state period. The periodic variations in the lines correspond to the periodic minor variations in the size of the agent populations, which are induced by the varying of the  value. The data shows that the agent societies with the most complex social institution have the lowest average relative amount of resources for cooperators, while the highest average relative resource amount is in the case of agent societies with the simplest social institution.
The interpretation of this result is more complicated than the previous result interpretations. In a sense the lower average resource amount may reflect the larger relative population size and possibly also the higher level of cooperation, which implies lower level of occasional cheating by the agents. Cheating in general leads to higher resource accumulation, however, too much cheating risks to lead to the die out of the population. Thus the results seem to suggest that more complex social institutions require (or induce) higher level of cooperation, which reduces the frequency of occasional cheating and consequently leads to lower relative average resource levels across the population. On the other hand, less complex social institutions appear to require lower level of cooperation, allowing more opportunity for occasional cheating, which raises the relative average resource level across the population. Of course, all these are in the context of relative resource levels. Following the investigations of products of the considered social indicators we could not establish any further meaningful interpretation that could be helpful. However, we note that the product of relative resource amount and relative population size and of the difference between the overall resource gain for all cooperation and having one cheaters and the rest cooperators among the playing agents, gives similar values for all three games across the considered simulation time period. This supports the above reasoning in a general sense, i.e. the differential in the benefits of cooperation and cheating and the required level of cooperation are likely to induce the observed difference between the average resource amounts of cooperators across the three simulation scenarios corresponding to different complexity social institutions.

Discussion
We have introduced above a conceptual framework for the composition of games to model evolution of social institutions. We demonstrated the use of this conceptual framework using two different compositions of Prisoner's Dilemma games and by discussing the interpretation of the results in terms of social institutions of different complexity. However, we have not presented any general approach to derive novel decision, aggregation, splitting and impact calculation blocks that can be used to enhance existing game representations of social institutions or to make the composition of partially matching games meaningful. The two case of composed games that we presented explore the proposed conceptual framework, but both cases are hand-crafted to make the composition of games meaningful. In principle, the hand-crafting applied in the presented composed games can be generalized in the sense of capturing the decisional and environmental space of the games considered for composition using the game blocks. Considering all decisions coming out of the games to be composed, in general, we need to add aggregator blocks or modify aggregator blocks such that all decisions are captured as inputs for the aggregator blocks and the such that the aggregator blocks provide a composite combination of the outputs of the decision blocks. In addition to this, novel game blocks may get added to take into consideration both the decisional environment and the external resource environment. This may happen on the basis of some meaningful analysis of these environments that may reveal previously not considered regularities. For example, in the context of combination or Prisoner's Dilemma games, one such external environment factor may be the variability of pay-offs depending on some environmental uncertainty or risk indicator (e.g. in biological cases a such factor can be predation risk). Similarly, if games with many participants, the distribution of individual decisions or temporal variation of individual decisions may impact the outcome and quantifying and considering this offers the inclusion of additional decision, aggregation, and other game blocks to enhance the game.
A further issue is the automated composition of games, which would be required for large scale analysis of models of evolution of social institutions using the proposed approach. Having the previously outlined way of considering environmental factors and completing games with component blocks is useful for this, but still leaves the question of how to automate the block completion to make the composed meaningful. The answer to this issue is provided in principle by the use of applied category theory (Fong and Spivak, 2019). This approach provides a way of defining formally what meaningful game composition means and also a way for automated completion of composite games to reach their meaningful composition. So far, this is an answer in principle, since more work is needed on the category theoretical translation of the proposed game composition methodology, which will be done in the future.
We note that the proposed methodology allows a coherent and transparent conceptualization and model implementation of incentives (punishments and rewards) used by social institutions (Sigmund et al, 2010;Traulsen et al 2012;Balafoutas et al, 2014;Han et al, 2017). These can be implemented in principle by using splitting blocks that separate different aspects of decisions and appropriate aggregation blocks that apply the reward or punishment in function of the incoming decisions. For example, the aspects of individual decision making and derived decisions, such as the level of fairness, the contribution to the joint effort, the extent of bluffing and lying, can be separated off using decision splitting blocks and then combined using aggregation blocks to determine the due reward or punishment. The proposed approach can also be used for the coherent and transparent composition of models of social institutions with incentive mechanisms.
Finally, let us summarize the limitation of the work presented in this paper. To a good extent, these are already highlighted in the previous two discussion points. The work that we present here is limited to two hand-crafted cases of composed games and their comparisons. As we pointed out, given the general conceptual framework that we have introduced here, there are clear ways of moving toward wider range and more general games, by calculated completion of partially complete compositions of games and also in terms of automated composition of games.

Conclusions
In this paper we have presented a conceptual framework to the modeling of evolution of social institutions using composition of games. We demonstrated the use of this framework by considering two particular compositions of Prisoner's Dilemma games. The results show that the structurally more complex compositions lead to higher levels of cooperation and larger relative size of the simulated agent populations. We have also discussed briefly the calculated completion of partially complete composed games and the principled approach to automated composition of games.
The proposed conceptual framework provides a way to derive and analyze complex multi-participant games that can approximate much better real world social institutions than the currently used simple and usually two-participant games such as the Prisoner's Dilemma game and other similar games. This may lead to much better understanding of social institutions evolve and how they support more or less social integration and social optimization of resource distribution to support overall growth.
Future work will focus on calculated completion of partially complete composed games, on environment-derived enrichment of games by adding in environment analysis based game blocks (including new decision blocks), and on category theory based automated composition of games.