The game of active SETI: 
Breaking the “Great Silence”

Supplementary Material

Harold P. de Vladar

IST Austria. Am Campus 1. A-3400 Klosterneuburg, Austria.

e-mail: Harold.Vladar@ist.ac.at

Readme first

This mathematica notebook contains the step-by-step derivations, function implementations and simulations of the content in the main text. The notebook can be read as a supplementary material, but can also be used to explore the model and framework beyond some of the assumptions of the main text.

The section "Implemented functions" contains a list of the functions that are implemented in this notebook.

The section "Implementing the games" is both, a basic introduction to simple games and a tutorial on how to use the commands implemented in this notebook.

The last section "Definition of the functions" contains just that. However the functions are initialized automatically, and can be used as a "black box".

Disclaimer

This notebook is intended only as a guide on how to apply the game-theoretical framework to the selected problem of METI. However, the two scenarios "communicative" and "belligerent" societies is and ad hoc choice motivated by wide-spread and possibly unfounded ideas on the plausible nature of extra-terrestrial societies. Other choice of behaviours are theoretically possible, and upon the decision of messaging extra-terrestrial civilizations, the author of this document, H.P. de Vladar, takes absolutely no liability on the outcomes of such decision. The mathematical and statistical tools provided in this document are intended as a guidance, and any action regarding messaging extra-terrestrial civilizations is to be properly consulted with pertinent governmental and international organizations.

The conclusions derived in this work and the tools provided in this document are not applicable for an intentional reply to a positive beacon coming from an extra-terrestrial source.

Implemented functions

In order to have the description of a function FOO[], type ?FOO and shift + enter.
For example

?Plot

The following functions are defined in this notebook :

?𝒱

?PlayGame

?S

?SB

?𝔼U

?𝔼U2

?mixStrategy

Implementing the games

The basic structure of games

The payoff matrix of a simple 2x2 row-game is implemented in the function 𝒱

For example, the generic payoff matrix is

𝒱[]//MatrixForm

And the speciffic games considered in this article are :

𝒱["E"]//MatrixForm
𝒱["C"]//MatrixForm
𝒱["B"]//MatrixForm

To "play" a game use the function PlayGame. We need the strategy space, which is given by the two symbols S and SB. For example if both defect in the generic game we get the “suckers payoff”

PlayGame[S,S,𝒱[]]

Similarly, for mixed strategies we may define a probability of cooperation P is the probability instead of a pure strategy. In the following example, we cooperate, and the oponent has a mixed strategy P:

PlayGame[P,S ,𝒱[] ]
PlayGame[P,SB,𝒱[]]

This is handy to compute Nash mix-equilibria :

Solve[PlayGame[P,SB,𝒱[]]==PlayGame[P,S,𝒱[]],P]

Compound games

Let n + 1 be the number of types

n=1;

Define a compound game giving probailities r:

𝒱[i_]:={{ρ[i],s[i]},{t,0}}
R=Table[r[i],{i,0,n}];
r[0]=1-Total[Rest[R]];
R

U=Table[r[i]𝒱[i],{i,0,n}]//Total;
Collect[U,Rest[R]]//MatrixForm

This compound game can also be played normally, for example:

PlayGame[SB,q,U]

Here we search for the surface where the payoffs are equal:

Solve[PlayGame[S,q,U]==PlayGame[SB,q,U],q]

Derivations for two-type compound games.

Setting up the games

Consider only two types of games. For a start these are taken as two general matrices

𝒱[x_Integer]:={{ρ[x],s[x]},{t,0}}
Row[MatrixForm/@{𝒱[0]," and ", 𝒱[1]}]//TraditionalForm

The mean payoff of the compound game is

U2=𝒱[0](1-r)+𝒱[1](r);
U==MatrixForm[%]//TraditionalForm

Relabel as:
ρ=ρ[0]
δρ=ρ[1]-ρ[0]
s=s[0]
δs=s[1]-s[0]

U2=U2/.{ρ[1]->δρ+ρ,ρ[0]->ρ,s[1]->δs+s,s[0]->s}//FullSimplify;
U==MatrixForm[U2]//TraditionalForm

Call q the frequency of ETIS cooperators. Then the boundary between the region where it pays off to S and to SB is given by

PlayGame[S,q,U2]== PlayGame[SB,q,U2]//TraditionalForm

The plot below shows the region where the payoff when searching only is greater than when also broadcasting

Manipulate[

Row[{RegionPlot[q t>(1-q) (s+r δs)+q (r δρ+ρ),{r,0,1},{q,0,1},PlotStyle->Lighter[Gray],BoundaryStyle->{Thick,Black},FrameLabel->{"Occurrence of communicative societies, r","Occurrence of Beacons, q"}],
If[δρ≠ 0,Column[{"\tNo equivalent","\tδ=0 required."}],Column[{"\tEquivalent\n\tparameters","\n\tc = " <>ToString[-s],"\tρ = "<>ToString[ρ] ,"\te = "<>ToString[-δs]}]]
}],
{s,-10,0},{t,0,10},{ρ,0,1000},{δs,-1000,-100},{δρ,0,100}
]//TraditionalForm

The boundary is determined by equating the payoffs

Solve[PlayGame[S,q,U2]==PlayGame[SB,q,U2],q]

the curve falls to zero at negative r:

Solve[((s+r δs)/(s+t+r δs-r δρ-ρ))==0,r]

and it reaches one at

Solve[((s+r δs)/(s+t+r δs-r δρ-ρ))==1,r]

At r = 1 is is

((s+r δs)/(s+t+r δs-r δρ-ρ))/.r->1//FullSimplify

Integrating in the space of frequencies (Π)

We integrate the space of {r,q} below and above the boundary (SuperStar[q]), in order to obtain the proportions of the space where S and SB strategies are convenient, that is the white part of the space in the diagram above. Above it gives

Π[Ω]==Integrate[1,{r,0,1},{q,((s+r δs)/(s+t+r δs-r δρ-ρ)),1},Assumptions->t>0&&s<0&&t>-s&&ρ>0&&δs<δρ≤0&&s+t≤ρ]//FullSimplify//TraditionalForm

Below it gives :

Π[(Ω^c)]==Integrate[1,{r,0,1},{q,0,((s+r δs)/(s+t+r δs-r δρ-ρ))},Assumptions->t>0&&s<0&&t>-s&&ρ>0&&δs<δρ≤0&&s+t≤ρ]//FullSimplify//TraditionalForm

Check that they add to one :

-(((δs-δρ) (δρ-s Log[((s+t-ρ)/(s+t+δs-δρ-ρ))])+δs (s+t-ρ) Log[((s+t-ρ)/(s+t+δs-δρ-ρ))])/(((δs-δρ))^2))+(((δs-δρ) (δs-s Log[((s+t-ρ)/(s+t+δs-δρ-ρ))])+δs (s+t-ρ) Log[((s+t-ρ)/(s+t+δs-δρ-ρ))])/(((δs-δρ))^2))//FullSimplify

Π for the communicative and belligerent compound game

In terms of the communicative and belligerant games,

Π==FullSimplify[Π[𝒱["C"],𝒱["B"]]]//TraditionalForm

Manipulate[
LogLinearPlot[
Π[𝒱["C"],𝒱["B"]]/.{e->eTmp,c->cTmp,ρ->rTmp},
{rTmp,1,20eTmp},PlotRange->{{1,20eTmp},{0,1}},PlotStyle->{{Black,Thick},{Black,Thick,Dashed},{Black},{Black,Dashed}},Frame->True,FrameTicks->Automatic,FrameLabel->{"Reward of communication, ρ","Profitable probability, Π"}]
,{eTmp,100,(10^3)},{cTmp,0.1,100}
]

This gives the approximate point when the probability is 1/2 (assuming c<<ρ):

(((-c+ρ-1) log((e/(ρ-1))+1))/e)≃(((ρ-1) log((e/(ρ-1))+1))/e)=(1/2)

If we call x=(e/(ρ-1)) it can be expressed as

(1/x)Log[1+x]=(1/2)

whose solution is

Solve[Log[1+x]==x/2,x]//Last//N//Quiet

which is approximatelly x ≃ 5/2. Hence

ρ= 1+(2/5)e

Expected Payoffs in Ω

Playing SB

This is the payoff that we get when we search and broadcast :

PlayGame[SB,q,U2];
Collect[%,q,FullSimplify]

Which we integrate in the corresponding part of the space {q, r}, to give U[SB,Ω]

Integrate[s+r δs+q (-s+r (-δs+δρ)+ρ),{r,0,1},{q,((s+r δs)/(s+t+r δs-r δρ-ρ)),1},Assumptions->t>0&&s<0&&t>-s&&ρ>0&&δs<δρ≤0&&s+t<ρ]//FullSimplify

Playing S

This is the payoff that we get when we only search:

PlayGame[S,q,U2];
Collect[%,q,FullSimplify]

Which we integrate in the corresponding part of the space {q, r}, to give U[S,Ω]

Integrate[q t,{r,0,1},{q,((s+r δs)/(s+t+r δs-r δρ-ρ)),1},Assumptions->t>0&&s<0&&t>-s&&ρ>0&&δs<δρ≤0&&s+t<ρ]//FullSimplify

Expected Payoffs in (Ω^c)

Playing SB

This is the payoff that we get when we search and broadcast :

Which we integrate in the corresponding part of the space {q, r}, to give U[SB,(Ω^c)]

Integrate[s+r δs+q (-s+r (-δs+δρ)+ρ),{r,0,1},{q,0,((s+r δs)/(s+t+r δs-r δρ-ρ))},Assumptions->t>0&&s<0&&t>-s&&ρ>0&&δs<δρ≤0&&s+t<ρ]//FullSimplify

Playing S

This is the payoff that we get when we search:

PlayGame[S,q,U2];
Collect[%,q,FullSimplify]

Which we integrate in the corresponding part of the space {q, r}, to give U[S,(Ω^c)]

Integrate[q t,{r,0,1},{q,0,((s+r δs)/(s+t+r δs-r δρ-ρ))},Assumptions->t>0&&s<0&&t>-s&&ρ>0&&δs<δρ≤0&&s+t<ρ]//FullSimplify

Applying U

This function is the particular form of the expected payoff matrix for the 2-type game considered.

𝔼U2[c,ρ,e]//MatrixForm

Some limits

Limit[𝔼U2[c,ρ,e],e->∞]//MatrixForm

Limit[𝔼U2[c,ρ,e],ρ->e]//FullSimplify;
Limit[%,e->∞]//MatrixForm

Limit[𝔼U2[c,ρ,e],c->0]//FullSimplify;
Limit[%,ρ->e]//FullSimplify//MatrixForm

Mixed strategy

Derivation

The mixed strategy is given by equating (UnderBar[U])(SB,Ω) (Subscript[F, B])+(UnderBar[U])(S,Ω) (1- (Subscript[F, B]))==(UnderBar[U])(SB,(Ω^c)) (Subscript[F, B])+(UnderBar[U])(S,(Ω^c)) (1- (Subscript[F, B])), which gives the equation

PlayGame[(Subscript[F, B]),SB,𝔼U2[c,ρ,e]]==PlayGame[(Subscript[F, B]),S,aveU2]//FullSimplify;
%//TraditionalForm

Who’s solution is

Solve[%,(Subscript[F, B])]//FullSimplify

To approximate the curve at low ρ set ρ = c + 1, which gives

(Subscript[F, B])==FullSimplify[Last[mixStrategy[c,c+1,e]]]//TraditionalForm

To find the point when the strategy becomes pure, i.e. (Subscript[F, B])=0 approximate  ρ>>0, giving

(Subscript[F, B])==0≃FullSimplify[Last[mixStrategy[0,ρ,e]]]

((Subscript[F, B])==0)≃((2 e (3-((2 e)/(-1+e+ρ))+((4 (-1+ρ) Log[((-1+ρ)/(-1+e+ρ))])/e)))/(e (2+e-2 ρ)-4 (((-1+ρ))^2) Log[((-1+ρ)/(-1+e+ρ))]))

Notice that the numerator can be written as

3-(2/(1+((-1+ρ)/e)))-((4 (-1+ρ) Log[1+(e/(-1+ρ))])/e)

Therefore, calling  x=(e/(ρ-1))

we hae the transcendental equation

3-((2x)/(x+1))-((4  Log[1+x])/x)==0//FullSimplify

Which does not depend on any parameter, and its numerical solution is

FindRoot[((3+x)/(1+x))==((4 Log[1+x])/x),{x,10}]

which is approximated by 6. Therefore, changing back variables

ρ==1+(e/6)≃(e/6)

Plot the mix strategy and approximations

With[{c=.1},
Show[Table[
{LogLogPlot[mixStrategy[c,r,e],{r,2,(10^12)},Frame->True,FrameLabel->{"Reward for communication ρ","Frequency of METI events, (Subscript[F, B])","Mixed Strategy"},PlotStyle->{{Black,Thick}},PlotRange->{{1,(10^12)},{(10^(-15)),(10^(-2))}}],
LogLogPlot[((2 (c+1))/(2 c+e)),{ρ,1,e/6},PlotStyle->{Gray,Dashing[Large],Thick}]
},{e,{(10^3),(10^6),(10^9),(10^12)}}]
]]//Quiet
{Export["MixedStrategy.pdf",%],Export["MixedStrategy.tiff",%]};

The payoff under the mixed strategy

PlayGame[p,SB,𝔼U2[c,ρ,e]]/.p->((2 (c+1) e (((2 (c^2)-4 c (ρ-1)+(ρ-1) (e+3 ρ-3))/((ρ-1) (e+ρ-1)))-((2 (c-ρ+1) (2 Log[((ρ-1)/(e+ρ-1))]))/e)))/(e (4 c+e-2 ρ+2)-4 (((c-ρ+1))^2) Log[((ρ-1)/(e+ρ-1))]))//FullSimplify
MonomialList[#,e]&/@{Collect[Numerator[%],e,FullSimplify],Collect[Denominator[%],e,FullSimplify]}//FullSimplify;
Divide@@(%[[All,1]])

Which can be further simplifyed to

(((1+c) (1-ρ) (1-2  Log[1+(e/(ρ-1))]))/(2 e ))

Plots of the paper

The next plot compares the approximation and the exact result (See below for comparisons with the simulation results)

METIcostPlot1=With[{e=10000},
Plot[Evaluate[Flatten[{2((1+c) (1+c-ρ) (e (2+4 c+e-2 ρ) (1+c-ρ)+2 (2 (c^3)-6 (c^2) (-1+ρ)-((e^2)+(((-1+ρ))^2)) (-1+ρ)-3 c (1+e-ρ) (-1+ρ)) Log[-1+ρ]-4 (((1+c-ρ))^3) Log[((-1+ρ)/(-1+e+ρ))]-2 (2 (c^3)-6 (c^2) (-1+ρ)-((e^2)+(((-1+ρ))^2)) (-1+ρ)-3 c (1+e-ρ) (-1+ρ)) Log[-1+e+ρ]))/(2 (-1+ρ) (-1+e+ρ) (-e (2+4 c+e-2 ρ)+4 (((1+c-ρ))^2) Log[((-1+ρ)/(-1+e+ρ))])),(((1+c) (1-ρ) (1-2  Log[1+(e/(ρ-1))]))/( e ))}/.{{ρ->10},{ρ->500}}]],{c,1,10},PlotStyle->{{Gray,Thick},{Black,Dashing[Large]}},PlotRange->All,AxesOrigin->{1,0},Frame->True,FrameLabel->{"Cost of METI project, c","Expected Payoff, ⟨U⟩","Application of the mixed strategy"}]]

METIcostPlot2=With[{e=10000},
Plot[Evaluate[Flatten[{2((1+c) (1+c-ρ) (e (2+4 c+e-2 ρ) (1+c-ρ)+2 (2 (c^3)-6 (c^2) (-1+ρ)-((e^2)+(((-1+ρ))^2)) (-1+ρ)-3 c (1+e-ρ) (-1+ρ)) Log[-1+ρ]-4 (((1+c-ρ))^3) Log[((-1+ρ)/(-1+e+ρ))]-2 (2 (c^3)-6 (c^2) (-1+ρ)-((e^2)+(((-1+ρ))^2)) (-1+ρ)-3 c (1+e-ρ) (-1+ρ)) Log[-1+e+ρ]))/(2 (-1+ρ) (-1+e+ρ) (-e (2+4 c+e-2 ρ)+4 (((1+c-ρ))^2) Log[((-1+ρ)/(-1+e+ρ))])),(((1+c) (1-ρ) (1-2  Log[((-1+e+ρ)/(-1+ρ))]))/( e ))}/.{{c->1},{c->10}}]],{ρ,2,e/6},PlotStyle->{{Gray,Thick},{Black,Dashing[Large]}},PlotRange->All,Frame->True,FrameLabel->{"Reward for communication, ρ","Expected Payoff, ⟨U⟩","Application of the mixed strategy"}]]

Simulations

Setting the simulations

Payoff matrices of the compound game :

compV={𝒱["C"],𝒱["B"]}/.{c->1,e->(10^6),ρ->(10^3)}

Number of games to play

Mrep=1000000;

Playing games with pure strategies

PlainGame={Table[PlayGame[S,RandomChoice[{#,1-#}&@RandomReal[]->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->compV]],{Mrep}],
Table[PlayGame[SB,RandomChoice[{#,1-#}&@RandomReal[]->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->compV]],{Mrep}]};
Mean/@PlainGame//N
Variance/@PlainGame//N

Playing games using mixed strategy. The two simulations below  use ρ=10 and 100 resp.

SimResult1=Block[{mS,cV,ee=10000,sols},
Table[
cV={𝒱["C"],𝒱["B"]}/.{c->cc,e->ee,ρ->10};
mS=mixStrategy[cc,10,ee];
sols=Table[PlayGame[RandomChoice[{mS,1-mS}->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->cV]],{Mrep}];
{cc,Mean[sols],Variance[sols]}
,{cc,1,10}]
]

SimResult1={{1,-(199853/1000000),(12004375557778391/999999000000)},{2,-(68391/1000000),(1745644753296791/111111000000)},{3,(26711/200000),(748769949762479/39999960000)},{4,(18903/50000),(17691123692197/833332500)},{5,(2961/250000),(69323999800277/2314812500)},{6,-(22461/100000),(41410148944831/1111110000)},{7,-(13063/1000000),(40188215220358031/999999000000)},{8,(2853/31250),(76755544623334/1736109375)},{9,(381313/1000000),(6604702016199433/142857000000)},{10,-(60983/500000),(2009741891367673/35714250000)}};

SimResult2=Block[{mS,cV,ee=10000,sols},
Table[
cV={𝒱["C"],𝒱["B"]}/.{c->cc,e->ee,ρ->500};
mS=mixStrategy[cc,500,ee];
sols=Table[PlayGame[RandomChoice[{mS,1-mS}->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->cV]],{Mrep}];
{cc,Mean[sols],Variance[sols]}
,{cc,1,10}]

]

SimResult2={{1,(43981/100000),(62332955231639/9999990000)},{2,(734551/1000000),(8445069167828399/999999000000)},{3,(263541/250000),(220118540213773/20833312500)},{4,(1383721/1000000),(594417190342579/47619000000)},{5,(1679469/1000000),(192284169907507/12987000000)},{6,(35689/20000),(7655050886479/399999600)},{7,(2059307/1000000),(53231237851793/2457000000)},{8,(2430061/1000000),(23297752692536279/999999000000)},{9,(104283/40000),(121842957561/4558400)},{10,(1439129/500000),(2429024730740453/83333250000)}};

The next simulations fix the cost (c = 1 and 10 resp.), and vary the reward

SimResult3=Block[{mS,cV,cc=1,ee=10000,sols},
Table[
cV={𝒱["C"],𝒱["B"]}/.{c->cc,e->ee,ρ->rr};
mS=mixStrategy[cc,rr,ee];
sols=Table[PlayGame[RandomChoice[{mS,1-mS}->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->cV]],{Mrep}];
{rr,Mean[sols],Variance[sols]}
,{rr,150,1500,150}]
]

SimResult3={{150,(7471/40000),(13452205734559/1599998400)},{300,(147211/500000),(69599387182277/9259250000)},{450,(534149/1000000),(5227660079845799/999999000000)},{600,(33741/50000),(102472585109/27472500)},{750,(294987/500000),(1160205032669831/249999750000)},{900,(6637/10000),(384281713631/99999900)},{1050,(805363/1000000),(852694225146077/333333000000)},{1200,(861769/1000000),(264163113884377/142857000000)},{1350,(445971/500000),(333566201867159/249999750000)},{1500,(487093/500000),(105345589409351/249999750000)}};

SimResult4=Block[{mS,cV,cc=10,ee=10000,sols},
Table[
cV={𝒱["C"],𝒱["B"]}/.{c->cc,e->ee,ρ->rr};
mS=mixStrategy[cc,rr,ee];
sols=Table[PlayGame[RandomChoice[{mS,1-mS}->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->{SB,S}],RandomChoice[{#,1-#}&@RandomReal[]->cV]],{Mrep}];
{rr,Mean[sols],Variance[sols]}
,{rr,150,1500,150}]
]

SimResult4={{150,(132499/100000),(143886355538333/3333330000)},{300,(934531/500000),(1072260342756671/27777750000)},{450,(1348667/500000),(7761109315823111/249999750000)},{600,(3228287/1000000),(8697612216681877/333333000000)},{750,(3646361/1000000),(22146112772457679/999999000000)},{900,(1045909/250000),(1034627529113719/62499937500)},{1050,(451443/100000),(6013948415131/476190000)},{1200,(4772459/1000000),(10038058264093319/999999000000)},{1350,(1034173/200000),(7469741748373/1481480000)},{1500,(5265237/1000000),(3264890966333831/999999000000)}};

Expected gain of the games

Show[{
METIcostPlot1,
ListPlot[SimResult1[[All,1;;2]],PlotMarkers->"■",PlotStyle->Black],
ListPlot[SimResult2[[All,1;;2]],PlotMarkers->"●",PlotStyle->Black]
},Epilog->Text["(A)",Scaled[{0.1,0.9}]]]
{Export["ExpectedPayoffMixStrategy-A.pdf",%],Export["ExpectedPayoffMixStrategy-A.tiff",%]}

Show[{
METIcostPlot2,
ListPlot[SimResult3[[All,1;;2]],PlotMarkers->"■",PlotStyle->Black],
ListPlot[SimResult4[[All,1;;2]],PlotMarkers->"●",PlotStyle->Black]
},Epilog->Text["(B)",Scaled[{0.1,0.9}]]]
{Export["ExpectedPayoffMixStrategy-B.pdf",%],Export["ExpectedPayoffMixStrategy-B.tiff",%]}

Standard deviation (percentual) of the gains

GraphicsGrid[{
{ListPlot[Table[{#1,Abs[(Sqrt[#3])/#2]}&@@x,{x,SimResult1}],PlotMarkers->"■",PlotStyle->Black,PlotRange->{0,4000},Frame->True,AxesOrigin->{0,0},FrameLabel->{"Cost of METI project, c","Std. deviation of U"}],
ListPlot[Table[{#1,(Sqrt[#3])/#2}&@@x,{x,SimResult2}],PlotMarkers->"●",PlotStyle->Black,PlotRange->{0,200},Frame->True,AxesOrigin->{0,0},FrameLabel->{"Cost of METI project, c","Std. deviation of U"}]},{ListPlot[Table[{#1,Abs[(Sqrt[#3])/#2]}&@@x,{x,SimResult3}],PlotMarkers->"■",PlotStyle->Black,PlotRange->{0,800},Frame->True,AxesOrigin->{0,0},FrameLabel->{"Reward for communication, ρ","Std. deviation of U"}],
ListPlot[Table[{#1,(Sqrt[#3])/#2}&@@x,{x,SimResult4}],PlotMarkers->"●",PlotStyle->Black,PlotRange->{0,200},Frame->True,AxesOrigin->{0,0},FrameLabel->{"Reward for communication, ρ","Std. deviation of U"}]}}
]

Definition of the functions

𝒱::usage="𝒱[] Gives the generic payoff matrix of a game.\n𝒱[t] gives the payoff for the game of type t, where t is E,C, or B.\nThe symbol 𝒱 is a script capital 𝒱, and is entered as \[EscapeKey]scV\[EscapeKey].";
𝒱[]={{ℛ,𝒮},{𝒯,𝒫}};
𝒱["E"]={{1,-c},{1+c,0}};
𝒱["C"]={{ρ,-c},{1+c,0}};
𝒱["B"]={{ρ,-c-e},{1+c,0}};

S::usage="S is a strategy for the games: search only (defect).";
SB::usage="SB is a strategy for the games: search & broadcast (cooperate).";
Strategy::usage="Strategy label of a game; Strategy[1]≡Cooperation, Strategy[2]≡Defection.";
S:=Strategy[2]
SB:=Strategy[1]
Protect[S,SB];

PlayGame::usage="PlayGame[σ1,σ2,𝒱] returns the payoff of 𝒱 when player 1 chooses strategy σ1 and player 2 chooses strategy σ2. If σ1 or σ2 are not strategies but symbols (probabilities), the function returns the mean payoff given the strategy of the other player.";
PlayGame[s1_Strategy,s2_Strategy,game_]:=Part[game,s1[[1]],s2[[1]]]
PlayGame[q_,s2_Strategy,game_]:=Part[game,1,s2[[1]]]q+Part[game,2,s2[[1]]](1-q)
PlayGame[s1_Strategy,q_,game_]:=Part[game,s1[[1]],1]q+Part[game,s1[[1]],2](1-q)

Π::usage="Π[(Subscript[𝒱, 1]),(Subscript[𝒱, 2])] returns the measure of Ω, the fraction of the space where is profitable to broadcast, in terms of the entries of the payoffs (Subscript[𝒱, 1]) and (Subscript[𝒱, 2]). It is necessary that (Subscript[𝒱, 1])≠(Subscript[𝒱, 2]).";
Πc::susage="Π[(Subscript[𝒱, 1]),(Subscript[𝒱, 2])] returns the measure of (Ω^c), the fraction of the space where is profitable to search, in terms of the entries of the payoffs (Subscript[𝒱, 1]) and (Subscript[𝒱, 2]). It is necessary that (Subscript[𝒱, 1])≠(Subscript[𝒱, 2]).";
Π[V1_,V2_]:=Block[{ss=PlayGame[SB,S,V1],tt=PlayGame[S,SB,V1],rr=PlayGame[SB,SB,V1],δs,δρ},
δs=PlayGame[SB,S,V2]-ss;
δρ=PlayGame[SB,SB,V2]-rr;
((δρ (-δs+δρ)+(rr δs-tt δs-ss δρ) Log[((-rr+ss+tt)/(-rr+ss+tt+δs-δρ))])/(((δs-δρ))^2))]
Πc[V1_,V2_]:=Block[{ss=PlayGame[SB,S,V1],tt=PlayGame[S,SB,V1],rr=PlayGame[SB,SB,V1],δs,δρ},
δs=PlayGame[SB,S,V2]-ss;
δρ=PlayGame[SB,SB,V2]-rr;
((δs (δs-δρ)+(-rr δs+tt δs+ss δρ) Log[((-rr+ss+tt)/(-rr+ss+tt+δs-δρ))])/(((δs-δρ))^2))]

𝔼U::usage="𝔼U[(Subscript[𝒱, 1]),(Subscript[𝒱, 2])] returns the matrix of the expected mean payoff, in terms of the entries of the payoffs (Subscript[𝒱, 1]) and (Subscript[𝒱, 2]). It is necessary that (Subscript[𝒱, 1])≠(Subscript[𝒱, 2]).\nThe symbol 𝔼 is a double-strike E, and is entered as \[EscapeKey]dsE\[EscapeKey].";

𝔼U[V1_,V2_]:=Block[{ss=PlayGame[SB,S,V1],tt=PlayGame[S,SB,V1],rr=PlayGame[SB,SB,V1],δs,δρ},
δs=PlayGame[SB,S,V2]-ss;
δρ=PlayGame[SB,SB,V2]-rr;
{{(-(δs-δρ) (2 (tt^3) ((δs)^2)+(tt^2) (-4 rr ((δs)^2)+4 (rr+ss) δs δρ+(-2 (rr+ss)+δs) ((δρ)^2)-((δρ)^3))+(-rr+ss) δρ (rr-ss-δs+δρ) (2 rr (-2 δs+δρ)+δρ (2 ss-δs+δρ))+tt (4 rr (ss δs+(((δs-δρ))^2)) δρ+(-2 (ss^2)+(((δs-δρ))^2)) ((δρ)^2)+2 (rr^2) (((δs)^2)-4 δs δρ+2 ((δρ)^2))))+2 (-rr+ss+tt) (-rr+ss+tt+δs-δρ) (-rr δs+tt δs+ss δρ) (-(rr+tt) δs+ss δρ) (Log[rr-ss-tt]-Log[rr-ss-tt-δs+δρ]))/(4 (-rr+ss+tt) (((δs-δρ))^3) (-rr+ss+tt+δs-δρ)),((δs-δρ) (2 (ss^3) δs (δs-2 δρ)+(ss^2) (((δs)^2) (-2 rr+4 tt+3 δs)+(8 rr-8 tt-7 δs) δs δρ+2 (tt+2 δs) ((δρ)^2))+(-rr+tt) ((δs)^2) (2 (tt^2)+tt (δs-δρ)-(2 rr+δs-δρ) (rr-δs+δρ))+ss δs (2 (tt^2) δs+((δs)^3)-2 ((δs)^2) (rr+δρ)-4 rr δρ (rr+δρ)+4 tt ((((δs-δρ))^2)+rr δρ)+δs (-2 (rr^2)+6 rr δρ+((δρ)^2))))-2 (-rr+ss+tt) (-rr+ss+tt+δs-δρ) (-rr δs+tt δs+ss δρ) (-(rr+tt) δs+ss δρ) Log[((-rr+ss+tt)/(-rr+ss+tt+δs-δρ))])/(4 (-rr+ss+tt) (((δs-δρ))^3) (-rr+ss+tt+δs-δρ))},{(1/(2 (((δs-δρ))^3)))tt (-((δs)^3)-(((ss^2) (((δs-δρ))^2))/(-rr+ss+tt))+(((((ss+δs))^2) (((δs-δρ))^2))/(-rr+ss+tt+δs-δρ))-((δs)^2) δρ+3 δs ((δρ)^2)-((δρ)^3)+2 δs (-rr δs+tt δs+ss δρ) (-Log[rr-ss-tt]+Log[rr-ss-tt-δs+δρ])),(tt ((δs-δρ) ((rr-tt) ((δs)^2) (2 rr-2 tt-δs+δρ)+(ss^2) (((δs)^2)+((δρ)^2))+ss δs (δs (δs-δρ)-2 rr (δs+δρ)+2 tt (δs+δρ)))+2 (-rr+ss+tt) δs (-rr+ss+tt+δs-δρ) (-rr δs+tt δs+ss δρ) Log[((-rr+ss+tt)/(-rr+ss+tt+δs-δρ))]))/(2 (-rr+ss+tt) (((δs-δρ))^3) (-rr+ss+tt+δs-δρ))}}
]

𝔼U2::usage="𝔼U2[c,ρ,r] returns the matrix of the expected mean payoff for a compound game involvinf communicative and belligerent societies. It is necessary that ρ>1. It is equivalent to 𝔼U[𝒱[C],𝒱[B]] \nThe symbol 𝔼 is a double-strike E, and is entered as \[EscapeKey]dsE\[EscapeKey].";

𝔼U2[c_,ρ_,e_]:={{-(1/(2 e (-1+ρ) (-1+e+ρ)))((((1+c))^3) e-2 (((1+c))^2) e ρ+(1+c) e (ρ^2)+(-1+ρ) (-1-c+ρ) (1+c+ρ) (-1+e+ρ) (Log[-1+ρ]-Log[-1+e+ρ])),-(1/(4 e (-1+ρ) (-1+e+ρ)))(e (-2 (c^3)+2 c (2+e) (-1+ρ)+(c^2) (-6+4 ρ)-(-1+ρ) (-2+e-(e^2)+e ρ+2 (ρ^2)))+2 (1+c-ρ) (-1+ρ) (1+c+ρ) (-1+e+ρ) Log[((-1+ρ)/(-1+e+ρ))])},{-(((1+c) (e+((c^2)/(-1+ρ))-((((c+e))^2)/(-1+e+ρ))-2 (1+c-ρ) (Log[-1+ρ]-Log[-1+e+ρ])))/(2 e)),(1/2) (1+c) ((((c^2)-2 c (-1+ρ)+(-1+ρ) (-2+e+2 ρ))/((-1+ρ) (-1+e+ρ)))-((2 (1+c-ρ) Log[((-1+ρ)/(-1+e+ρ))])/e))}}

mixStrategy::usage="mixStrategy[c,ρ,e] returns the mix strategy for the compound game 𝒱[C] 𝒱[B]. It requires that ρ>1."; 
mixStrategy[c_,ρ_,e_]:=Max[0,((2 (1+c) e (((2 (c^2)-4 c (-1+ρ)+(-1+ρ) (-3+e+3 ρ))/((-1+ρ) (-1+e+ρ)))-((4 (1+c-ρ) Log[((-1+ρ)/(-1+e+ρ))])/e)))/(e (2+4 c+e-2 ρ)-4 (((1+c-ρ))^2) Log[((-1+ρ)/(-1+e+ρ))]))]