A Logic of Allies and Enemies

Wiebe van der Hoek Louwe B. Kuijer Y`ı N. Wang´ [email protected] [email protected] [email protected] Dept. of Computer Science Dept. of Computer Science Dept. of Philosophy University of Liverpool University of Liverpool Zhejiang University

Abstract

We introduce the Logic of Allies and Enemies (). This logic describes the dynamics of relations in a social network, under the assumption that agents have an tendency to estab- lish more stable relationships with others in the network, which was studied extensively in structural balance theory. Stability scores are introduced to evaluate the stability of a social network. We demonstrate a number of validities of this logic, apply it to concrete cases, and show that its model checking problem is PSPACE-complete.

1 Introduction

Structural balance theory, also called “social balance theory” or simply “balance theory”, was initiated in Heider’s work on social psychology [15, 16, 17], and later reinvented by Harary et al. using graph theory in [12, 3, 14], where they use signed graphs to represent social networks of agents, with positive signs for allies or friends and negative signs for enemies or antagonists. This has become a basic framework for studying positive and negative relationships, and has since then become an active area in the field of social network analysis. A social network is (structurally) balanced if it meets certain structural conditions on its pos- itive or negative relationships between agents. For example, a “triad” of three agents that are all enemies of one another is considered unbalanced. The concept of structural balance has a dynamic nature in the sense that one may expect an unbalanced network to have a tendency to become bal- anced over time by switching the relationships between agents. There has been a growing interest in a dynamic context of social networks, carrying out empirical studies or building theories of how a social network evolve over time in regard to structural balance theory [8, 18, 32, 2, 20, 1, 33]. In this paper we study the dynamics of social networks from a new perspective, namely that of temporal logic. Following the ideas from structural balance theory, we define stability scores to evaluate the degree of balance of a network, and use it to determine the transition relation between social networks, so that a network evolves to a more stable one by switching a link between two agents. This generates a time tree with its nodes representing social networks, in which more stable ones are closer to the leaves. We develop a Logic of Allies and Enemies (LAE) based on Computation Tree Logic (CTL) [5] to characterize the evolution process. We discuss a few validities of LAE, and show that its model checking problem is PSPACE-complete.

1 To the best of our knowledge, this is the first investigation of social network dynamics using logic. There is existing work in which logic is used to reason about social networks, most notably a number of works [27, 29, 21, 4, 31] use logic of knowledge and belief to describe the way information spreads through a social network. The difference between those works and the current paper is that they describe how a network influences the exchange of information, whereas we describe how the relations in a network influence each other. The structure of the paper is as follows. First, in Section 2, we give a brief introduction to the structural balance theory, from the viewpoint of our work. In Section 3, we give an informal description of the dynamics of social networks. Then, in Section 4, we formalize the dynamics and define the logic LAE. Following that, in Section 5, we consider an extended example. Finally, in Section 6 we show that the model checking problem is PSPACE-complete. We conclude and discuss future work in the last section.

2 Background

Heider [15, 16, 17], furthered by Newcomb [23, 24, 25], argues that attitudes of a person (p) towards an other person (o) and a third object (x) can influence each other. For example, p’s attitude towards o is affected by p’s attitude towards x if x is positively associated with o (say, o owns or likes x), and in a similar way p’s attitude towards o is affected by p’s attitude towards x. The concept balance arises naturally in a p-o-x model. For example, p and o like each other and they both like (or both dislike) x is in a balanced state, while it is unbalanced if one likes x while the other does not. Harary et al. [12, 13, 3] formalized Heider’s model using graph theory, proved some theorems on balance, and provided a basic method for calculating degrees of balance. Many further devel- opments and investigations were made in Harary et al.’s framework. This paper lies also in this strand. In this section, we briefly introduce the concepts and results of Harary et al.’s framework that are relevant to this paper. A signed graph or simply graph consists of a finite set of vertices, together with edges (a set of pairs of vertices1) which are divided into positive and negative ones. The sign of a positive edge is +, and that of a negative edge is −. An undirected graph is a graph whose edges are all unordered pairs. If a graph is not undirected, it is a directed graph, or a digraph.

A cycle is a sequence of the form ha1a2, . . . , an−1an, ana1i, such that each pair aiai+1 in it is an edge and a1, . . . , an are all distinct. In the case with a digraph, a cycle by definition may be −−→ ←−− −−→ a sequence like ha1a2, a2a3, a3a1i (the direction of the edges do not matter) and is therefore also called a semicycle to avoid possible confusion. The sign of a cycle is the product of the signs of all its edges (where + is read as +1 and − is read as −1). When the sign of a cycle is positive, i.e., there is an even number of negative edges in the cycle, we say the cycle is positive, or otherwise it is negative. For example, a cycle of the form +−−+ is positive, because +1 · −1 · −1 · +1 = +1 is positive; and −+−−+ is negative. A graph is balanced if all of its cycles are positive, and unbalanced otherwise. 1Self-loops and parallel edges (i.e., edges that join the same pair of vertices) are usually not considered.

2 The length of a cycle is the number of edges in it. An n-cycle is a cycle of length n. For many real-world situations, cycles of different lengths play different roles regarding structural balance. For example, 3-cycles and 4-cycles are usually more important than, say, an 11-cycle, for determining balance. In general, the influence of a cycle decreases as the distance increases between vertices. A graph is n-balanced if all of its cycles of length not exceeding n are positive. An important special case is that of 3-balance, which only considers “triads” of three actors. For a complete undirected graph, i.e., an undirected graph where every pair of distinct vertices is connected by a (positive or negative) edge, there are four possible cases (up to equivalence of the vertices) for a triad of three agents. These cases are depicted in Figure 1, where a solid line represents a positive edge and a dashed line represents a negative edge. For the graphs illustrated by 1(a) and 1(c), the product of the edges is positive so they are balanced, while for 1(b) and 1(d) the product is negative so they are unbalanced.

(a) +++ (b) ++− (c) +−− (d) −−−

Figure 1: Illustration of four triads, where a solid line stands for a positive edge, and a dashed line stands for a negative edge.

Instead of considering the products of the edge signs, the (un)balance of the triads in Figure 1 can also be seen as deriving from the following four sayings: • My friend’s friend is my friend. • My enemy’s enemy is my friend. • My friend’s enemy is my enemy. • My enemy’s friend is my enemy. In the balanced triads (a) and (c) the sayings hold, whereas in the unbalanced triads (b) and (d) one or more of the sayings are violated. Few networks are balanced in real life, yet it is conjectured and argued that a network has a tendency towards a balanced state over time. Some research, e.g., [25, 32] and the Sampson monastery dataset [28], supports this, and some studies describe the difficulty of a network, espe- cially a big network, reaching a balanced state [9, 7, 18].

3 Pressures on Friendship and Enmity

In some, but not all, variants of balance theory neutral edges are allowed, in addition to positive and negative ones. Here, we allow such neutral edges, so two agents a and b are either friends (+), enemies (−) or neither (0).2 When such neutral edges are present, it is no longer the case that the four sayings are satisfied if and only if the edge product is positive. For example, the triads +00 and ++0 both have edge product 0, but in +00 all four sayings are satisfied while in ++0

2We do not consider so-called “frenemies”, that are both friends and enemies of one another.

3 the saying “my friend’s friend is my friend” is violated. We consider ++0 to be at least partially unbalanced, so in our semantics we follow the four sayings. It is important to note, however, that none of the sayings are hard rules. Even though the enemy of my enemy is supposed to be my friend, it is certainly possible for a, b and c to all be enemies of one another either temporarily or, in some unusual cases, permanently. Instead, they indicate pressure towards a certain relationship. If a and b are enemies, and b and c are enemies, that is a reason for a and c to be friends. So unless there is a counterbalancing reason that pushes a and c apart, one would expect them to eventually become friends or, if they are friends already, to remain friends. The other three sayings exert pressure in similar ways, so we get the following four rules: If a and b are . . . and b and c are . . . then a and c have a reason to remain or become . . . enemies enemies friends enemies friends enemies friends enemies enemies friends friends friends

Note that it is possible for a and b to both have a reason to become friends and a reason to become enemies. For example, if c is a mutual enemy of a and b while d is a friend of a but a foe of b, then c provides a reason for a and b to become friends and d provides a reason to become enemies. In such cases, we take an approach that is different from [12, 3] and the other existing papers about social balance: we simply count the number of reasons to become friends and the number of reasons to become enemies. If the number of reasons for a and b to become friends exceeds their number of reasons to become enemies, then we consider there to be an overall pressure to become friends, and vice versa. If there are the same number of reasons for friendship and enmity, we consider there to be no pressure either way, so the relation will remain as is. The stability score of a relation, then, is the number of reasons for that relation to remain the same minus the number of reasons for it to change. Note that there are no sayings of the form “the friend of the person I don’t care about is my . . . ” or “the person my enemy doesn’t care about is my . . . ”. So if either a and b or b and c are neutral to one another, then those two relationships do not cause any pressure on the relationship between a and c. Likewise, there are no sayings of the form “the . . . of my . . . is someone I don’t care about.” So there is never a reason for the relation between two agents to become neutral. We should emphasize that we are only considering those reasons for becoming friends or enemies that derive from the network of relations. There may be other reasons as well. For example, “John may be the enemy of my enemy, but he punched me in the face yesterday so he is definitely not my friend” is perfectly reasonable. The network dynamics that we represent here are therefore best seen as the likely changes in the social network provided that there are no influences from outside the network (such as face punchings).

4 4 Syntax and Semantics

In this section we first introduce formal definitions of social networks, stability scores and time evolution, based on the understanding and convention from the previous section. Then we intro- duce the syntax and semantics of the Logic of Allies and Enemies (LAE).

4.1 Social Networks

We define a social network to be a 3-signed undirected graph. For technical convenience we treat a pair of vertices without a direct connection as having a neutral edge3 in between. Put in a different way, classical work (say, [3]) studies 2-signed graphs which can be incomplete, while we treat the unconnected vertices as having a neutral edge in between. The formal definition is given below. Definition 1 (Social networks) A social network (network for short) is a pair (V,E) such that: • V is a finite set of vertices; • E : {{a, b} ⊆ V | a 6= b} → {+, −, 0} is an edge function that assigns to each pair of different vertices a positive edge (+), a negative edge (−) or a neutral edge (0).

Note that the domain of E consists of unordered pairs of two different agents. We therefore have E({a, b}) = E({b, a}), by definition. We abuse notation by writing E(a, b) for E({a, b}). When drawing a social network, we represent a positive edge by a solid line, a negative edge by a dashed line and a neutral edge by the absence of a line. This follows a convention established by [3]. We define the attraction between a and b to be the number of reasons for them to become or remain friends, and the repulsion the number of reasons to remain or become enemies. Definition 2 (Stability of edges) Let N = (V,E) be a social network, and let a, c ∈ V . The attraction of (a, c), denoted attr(a, c) is given by

attr(a, c) = |{b | E(a, b) = E(b, c) = +}| + |{b | E(a, b) = E(b, c) = −}|.

The repulsion of (a, c), denoted rep(a, c) is given by

rep(a, c) = |{b | E(a, b) = +,E(b, c) = −}| + |{b | E(a, b) = −,E(b, c) = +}|.

The stability score of an edge ab is given by

 attr(a, b) − rep(a, b), if E(a, b) = +,  score(a, b) = rep(a, b) − attr(a, b), if E(a, b) = −,   −|attr(a, b) − rep(a, b)|, if E(a, b) = 0.

An edge ab is stable if score(a, b) ≥ 0, and unstable otherwise. An unstable edge is improving if its attraction is greater than its repulsion and deteriorating if its repulsion is greater than its attraction. 3We call it a neutral edge for simplicity, but it is in fact an edge for being “neither friends nor enemies”. It can stand for a neutral or indifferent tie or demonstrate that the agents are unrelated.

5 Put in a different way, the attraction of an edge ac is the number of reasons for a and c to become or remain friends, and the repulsion of ac is the number of reasons for a and c to become or remain enemies. A positive edge is unstable if it is deteriorating, a negative edge is unstable if it is improving and a neutral edge is unstable if it is either deteriorating or improving.

Definition 3 (Stability of networks) A network (V,E) is stable if every edge is stable, and un- stable otherwise. The stability score of a network is the sum of the stability scores of its edges.

Definition 4 (Successors) Let N1 = (V1,E1) and N2 = (V2,E2) be social networks. The net- work N2 is a successor of N1 if

• N1 is stable and N1 = N2, or

• N1 and N2 differ in exactly one edge ab, and for that edge it is either the case that ab is

improving in N1 and E2(a, b) = +, or that ab is deteriorating in N1 and E2(a, b) = −.

We write N1 ; N2 if N2 is a successor of N1.

So if N2 is a successor of N1, then either (i) N1 is stable and N1 = N2, (ii) one neutral edge from N1 changes to either + or − in N2 or (iii) one + edge from N1 changes to − in N2 or vice versa. Importantly, in case (iii) the stability score of N2 is strictly higher than that of N1. The reason for this is that in any triangle abc with only non-neutral edges, it will either be the case that all edges reinforce one another or that all edges weaken one another. For example, if E(a, b) = E(a, c) = − and E(b, c) = +, the friendship between b and c is reinforced (“enemy of my enemy”) as is the enmity between a and b and between a and c (“friend of my enemy”). If, on the other hand, E(a, b) = E(a, c) = + and E(b, c) = −, then the friendship between a and b and between b and c is weakened (“friend of my enemy”), as is the enmity between b and c (“friend of my friend”).

If the sign of an edge ab flips from − in N1 to + in N2 or from + in N1 to − in N2, then every triangle containing ab that was mutually weakening in N1 becomes mutually strengthening in N2, and vice versa. Since the edge changed value, the “weakening” triangles in N1 must outnumber the “strengthening” ones. So there are more triangles that change from mutually weakening to strengthening than the other way around. It follows that N2 must have a strictly higher stability score than N1. Note that it is only in case (iii) that we can be certain that the stability score will increase. In case (i) the stability score remains the same, and in case (ii) the stability score might even decrease. The reason for such a decrease is that a neutral edge neither increases nor decreases stability. So once an edge changes from being neutral to being + or −, it will start to influence other edges. And this influence can be destabilizing.

Definition 5 (Time evolution) Let N = (V,E) be a social network. The time evolution T (N) of N is the smallest graph (S, ;) such that • N ∈ S,

• if N1 ∈ S and N2 is a successor of S, then N2 ∈ S and N1 ; N2.

6 The time evolution of N is not necessarily a tree, nor is it acyclic. However, the only cycles are of the form N1 ; N1, where N1 is stable. We can therefore abuse notation by saying that T (N) has a depth, namely the length of the longest cycle-free path. Proposition 1 The depth of T (N) is bounded from above by 2 · |V |5.

PROOF Every reason for an edge to improve or deteriorate can be identified by a triple abc, where the edges ab and bc influence the edge ac. There are |V |3 such triples, so the stability score cannot be lower than −|V |3 or higher than |V |3. Furthermore, there are at most |V |2 edges with value 0. Since every non-reflexive transition requires either one edge to become non-neutral or the stability score to increase, the maximum cycle-free path length is at most 2 · |V |3 · |V |2 = 2 · |V |5.

4.2 Language and Satisfaction

We fix a countable set AG of agents, the members of which are treated as vertices in a network. Definition 6 (Language) The formulas are given by the following grammar rule:

ϕ ::= P aa | Naa | stable | ¬ϕ | (ϕ → ϕ) | AXϕ | A(ϕUϕ) | E(ϕUϕ), where a ∈ AG, stable is a nullary modal operator, and other operators are like in CTL. We shall also use other CTL operators from time to time. They are treated as abbreviations, in particular,

EXϕ =df ¬AX¬ϕ

AFϕ =df A(>Uϕ)

EFϕ =df E(>Uϕ)

AGϕ =df ¬EF¬ϕ

EGϕ =df ¬AF¬ϕ.

Moreover, we write Oab for (¬P ab ∧ ¬Nab).

We interpret the CTL formulas on the graph T (N). However, because T (N) is fully determined by N, it is not necessary to refer explicitly to T (N). Definition 7 (Satisfaction) Given a network N = (V,E), whether N satisfies (notation |=) a formula is determined inductively by the following (where ϕ and ψ are formulas, and a, b ∈ AG):

N |= P ab iff E(a, b) = + N |= Nab iff E(a, b) = − N |= stable iff N is stable N |= ¬ϕ iff not N |= ϕ N |= (ϕ → ψ) iff N |= ϕ implies N |= ψ N |= AXϕ iff for all successors N 0 of N (i.e., N ; N 0), N 0 |= ϕ

N |= A(ϕUψ) iff for all timelines “N0 ; N1 ; ··· ” with N = N0, there is an i such that

Ni |= ψ and for all j < i, Nj |= ϕ

N |= E(ϕUψ) iff there is a timeline “N0 ; N1 ; ··· ” with N = N0 and an i such that

Ni |= ψ and for all j < i, Nj |= ϕ.

7 In particular, both P aa and Naa are unsatisfiable since the edge function E is not defined for a pair (a, a).

A sentence stable(a, b), meaning that the edge ab is stable (see Definition 2) is equivalent to (P ab ∧ AXP ab) ∨ (Nab ∧ AXNab) ∨ (Oab ∧ AXOab), and can therefore be treated as an abbreviation. We list some validities of the logic in the following.

Proposition 2 The following formulas are valid (where a, b, c and d are different agents): 1. (One is neither a friend nor an enemy of oneself) Oaa 2. (The next state of a stable network is itself) stable → (ϕ → AXϕ) 3. (At most one sign is changed in one step) (P ab ∧ P cd) → AX(P ab ∨ P cd) 4. (A network becomes stable eventually) AFstable

PROOF Statements 1, 2 and 3 follow immediately from the semantics. Statement 4 follows from the fact that the depth of T (N) is bounded by 2 · |V |5 (Proposition 1).

5 Example

We pick up an example of relationship changes between the protagonists of during the period 1872–1907 from [2], which is shown in Figure 2, and use it to illustrate how and when social networks evolve reasonably according to the logic LAE. There are different understandings and abstractions of the history, and here we follow what exists in the cited work.

GB AH GB AH GB AH

F G F G F G

R I R I R I

(a) 3 Emperor’s league (b) Triple Alliance 1882 (c) German-Russian Lapse 1872–81 1890

GB AH GB AH GB AH

F G F G F G

R I R I R I

(d) French-Russian Alliance (e) Entente Cordiale 1904 (f) British-Russian Alliance 1891–94 1907

Figure 2: Network updates between the protagonists of World War I (1872–1907), where GB stands for Great Britain, AH for Austria-Hungary, G for , I for Italy, R for , and F for . From [2].

8 The network (b) is not a successor of (a), nor is (c) a successor of (b), in the logic LAE: there is neither a good reason for Italy to ally Austria-Hungary and Germany, nor a good reason for Russia to make the changes, from only the perspective of network structure. This is due to influences coming from outside the network, say the enmity of Russia with Japan in that period, and is therefore not characterized, but yet explained, in the logic LAE. The step going from (c) to (d) has a good reason from balance theory and is perfectly charac- terized by our logic: France and Russia are motivated to enter into an alliance because they have Germany and Austria-Hungary as mutual foes. Formally, the network (d) is a successor of (c). Network (e) is not a successor of (d), where the attraction and repulsion between France and Great Britain are both 1. The stability scores of the two networks are close, with 7 for (d) and 6 for (e). Although this is not a reasonable step characterized in LAE, there is nothing from the network to prevent such an update. Furthermore, while the semantics of LAE does not predict that an alliance between Britain and France would form at this point, it is possible in LAE that such an alliance would form eventually. The only difference is that in LAE we would expect an enmity between Britain and either Italy or Germany to form before the alliance between France and Britain happens. The step from (e) to (f) is explained by our logic. It is not a direct evolution, but can be revealed in the timeline illustrated below:

◦ ◦ ◦ ◦ ◦ ◦

◦ ◦ ; ◦ ◦ ; ◦ ◦ ;

◦ ◦ ◦ ◦ ◦ ◦

◦ ◦ ◦ ◦ ◦ ◦

◦ ◦ ; ◦ ◦ ; ◦ ◦

◦ ◦ ◦ ◦ ◦ ◦ The stability scores of the networks in the above timeline are 6, 12, 22, 28, 44 and 60, respectively. Moreover, we observe that all possible timelines starting from the network (e) reaches (f) on the fifth step and stabilize there. Let us use a, b, c, d, e, f to stand for France, Great Britain, Austria-Hungary, Germany, Italy and Russia, respectively. The formula:

ϕ = P ab∧Nac∧Nad∧Nae∧P af∧Nbc∧Nbd∧Nbe∧P bf∧P cd∧P ce∧Ncf∧P de∧Ndf∧Nef characterizes the network (f). We have the formulas AX5ϕ, AGϕ and EGϕ true in the network (e). We can furthermore show that EGϕ ∧ ¬AGϕ is true in the network (c): there is but not all timelines starting from (c) end with (f). For example, “(c);(d); ··· ;(f)” is a possible timeline, though we do not have a reason for getting the network (e) in it; but the following is also possible from (c):

9 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦

◦ ◦ ; ◦ ◦ ; ◦ ◦ ; ··· ; ◦ ◦

◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ It stabilizes at the network represented by the rightmost diagram in the above. In other words, in addition to the actual outcome with two alliance blocks of France, Britain and Russia on one side and Austria-Hungary, Germany and Italy on the other, in 1890 there was another reasonable outcome, where one power block consists of France and Russia, while the other block consists of Britain, Austria-Hungary, Germany and Italy.

6 Model Checking

Now that we have defined our logic of allies and enemies, it is natural to wonder about the com- plexity of model and validity checking for this logic. In this paper, we consider only model checking and leave validity checking for future work. Formally, the model checking problem is to determine, given a formula ϕ and a social network N, whether N |= ϕ. We show that this problem is PSPACE-complete with respect to |ϕ| + |N|, where |ϕ| is defined inductively as usual and |N| = |V |.

Lemma 1 Model checking for LAE is PSPACE-hard with respect to |ϕ| + |N|.

PROOF We use a reduction from the truth/satisfiability problem of quantified Boolean formulas

(QBFSAT) which is PSPACE-complete [30]. Take any QBF instance Q1p1 ··· Qnpnψ(p1, . . . , pn), where every Qi is either ∃ or ∀. Now, consider a network N = (V,E) given by:

• V = {ai, bi, ci | 1 ≤ i ≤ n},

• for every 1 ≤ i ≤ n, E(ai, bi) = E(bi, ci) = + and E(ai, ci) = −, • all other edges are neutral.

So we have n triangles aibici that each have two positive edges and one negative edge. Each of these triangles is unstable: there is a reason for the negative edge to turn positive (because the friend of my friend should be my friend) and there is a reason for either of the positive edges to turn negative (because the enemy of my friend is my enemy). This means that, over time, the triangles will change from having edges labeled ++− to either +−− or +++. Note that in the new triangles +−− and +++ every edge is stable, so no further change will happen in that triangle.

We can interpret such change as choosing the value of pi, where a change to +−− indicates choosing pi = ⊥ and a change to +++ indicates choosing pi = >. We define the abbreviations init > ⊥ init > ⊥ χi := P aibi ∧ P bici ∧ Naici, χi := P aici and χi := Naibi ∨ Nbici. So χi , χi and χi represent the value of pi not being chosen, having been chosen as > and having been chosen as ⊥, respectively.

We now define ξn by induction on n:

10 > > • ξ0 = ψ(χ1 , ··· , χn ), ( χinit ∧ AX(¬χinit → ξ ) if Q = ∀ • ξ = i+1 i+1 i i+1 i+1 init init χi+1 ∧ EX(¬χi+1 ∧ ξi) if Qi+1 = ∃ It is now easy to see that N |= ξn if and only if Q1p1 ··· Qnpnψ(p1, . . . , pn) is satisfiable. Fur- thermore, both |N| and |ξ| are linear in n, so this is a polynomial reduction from QBFSAT to the model checking problem of LAE.

What is left to show is that the model checking problem of LAE can be solved in polynomial space.

Lemma 2 Model checking for LAE is in PSPACE with respect to |ϕ| + |N|.

PROOF The temporal operators of LAE are those of CTL. The standard model checking algo- rithms for CTL [5] can therefore, with minor modifications be used here. The algorithm is based on a case distinction regarding the main connective of ϕ. We present only one of these cases here, and trust that it is clear how the other cases can be written. The case that we present is the one where ϕ = A(ψUχ).

if N |= χ then return true else if N 6|= ψ then return false else if N |= ψ then if N |= stable then return false else initialize x = true compute N = {N 0 | N ; N 0} for all N 0 ∈ N do if N 0 6|= A(ψUχ) then set x = false end if end for return x end if end if

In this case, as in most other cases, the algorithm recursively calls itself. In each case, however, the recursive calls are either for a strictly smaller formula or for a different network N 0 that occurs strictly deeper in the tree T (N). Since T (N) has no cycles of length greater than 1, it follows that the algorithm terminates. The usual algorithm for CTL runs in polynomial time, but that is with respect to |ϕ| and the size of the computation tree. In our case, this computation tree is T (N), which is in general exponentially larger than N. Fortunately, we do not need to keep all of T (N) in memory at once:

11 we can free all memory needed to compute whether N 0 |= A(ψUχ) before we begin to compute N 00 |= A(ψUχ). In effect, this allows us to search T (N) in a depth-first way using an amount of memory polynomial in the depth of T (N). As discussed in Section 4, this depth is polynomial in |N|. As such, model checking for LAE is in PSPACE.

Corollary 1 Model checking for LAE is PSPACE-complete with respect to |ϕ| + |N|.

7 Discussion

We introduced a logic of allies and enemies, and showed that its model checking problem is PSPACE-complete. For future work we are interested in the validity problem and axiomatization of this logic. Harary et al. [12, 3] show a Balance Theorem (for complete or incomplete, directed or undi- rected graphs):

A complete graph is balanced if and only if it can be partitioned into two disjoint subsets (one of which may be empty) such that all edges between points of the same subset are positive and all edges between points of the two different subsets (if there are) are negative.

Instead of defining balance locally as in the definition introduced previously, where balance is checked for each cycle (in the case of 3-balance we can simply check whether all triads are in the form of Figure 1(a,c)), the Balance Theorem provides a global perspective. Methods are developed for studying structural balance based on the two different perspectives. From the global perspective, Davis [6] studies the conditions corresponding to having more than two clusters or partitions, which leads to a notion of weak balance (in the case of 3-balance, triads in Figures 1(a,c,d), except for that in 1(b), are all weakly balanced). We are interested in studying these in our framework or getting the latter extended to suit for these. Among unbalanced networks, some might be still more “balanced” than others. This gives rise to the concept of degrees or proximity of balance. In the classical definition, balance is defined for cycles of an arbitrary length, and total balance of a network is treated as “∞-balance”. There have been different algorithms of calculating the degree of balance of a network. A basic idea is to take the degree as the ratio of the number of positive cycles to the total number of cycles [3]. Refined methods are introduced in [22, 26, 19, 10] and [11, Section 5.5], such as adding weight to edges, reducing the strength for longer cycles, and so on. For us, however, instead of modeling indirect influence as having less strength, our approach is based on a “step-by-step” characterization by assuming that indirect influences are made gradually along a path, and longer paths will probably take longer time to get balanced. Our approach has its advantage in modeling the evolution of social networks from the perspec- tive of structural balance. Our model supports and perfectly characterizes that there is a tendency towards balance over time, as long as there is no outside influence. Another further research is the treatment of outside influence. As discussed in Section 3, we only take into account those changes in a social network that are the result of interactions in

12 the network. But there can also be other factors; in Section 3 we discussed the example of the enemy of your enemy not being being your friend if they assaulted you. Such outside factors are unpredictable, so we cannot fully model them in a logic. We could partially represent them as “public announcement like” operators, however, where [+ab]ϕ means “if some outside event causes a and b to become friends, then ϕ will become true afterwards.

References

[1] Peter Abell and Mark Ludwig. Structural balance: A dynamic perspective. The Journal of Mathematical Sociology, 33(2):129–155, 2009.

[2] Tibor Antal, Paul L. Krapivsky, and Sidney Redner. Social balance on networks: The dy- namics of friendship and enmity. Physica D: Nonlinear Phenomena, 224(1-2):130–136, December 2006.

[3] Dorwin Cartwright and Frank Harary. Structure balance: A generalization of heider’s theory. Psychological Review, 63(5):277–293, September 1956.

[4] Zoe´ Christoff and Jens Ulrik Hansen. A logic for diffusion in social networks. Journal of Applied Logic, 13(1):48 – 77, 2015.

[5] Edmund M. Clarke and E. Allen Emerson. Design and synthesis of synchronization skeletons using branching time temporal logic. In Dexter Kozen, editor, Logics of Programs, pages 52– 71, Berlin, Heidelberg, 1981. Springer Berlin Heidelberg.

[6] James A. Davis. Clustering and structural balance in graphs. Human Relations, 20(2):181– 187, 1967.

[7] P. Doreian. Event sequences as generators of social network evolution. Social Networks, 24(2):93 – 119, 2002.

[8] Patrick Doreian, Roman Kapuscinski, David Krackhardt, and Janusz Szczypula. A brief history of balance through time. The Journal of Mathematical Sociology, 21(1-2):113–131, 1996.

[9] Patrick Doreian and David Krackhardt. Pretransitive balance mechanisms for signed net- works. The Journal of Mathematical Sociology, 25(1):43–67, 2001.

[10] Patrick Doreian and Andrej Mrvar. A partitioning approach to structural balance. Social Networks, 18(2):149–168, 1996.

[11] David Easley and Jon Kleinberg. Networks, Crowds, and Markets: Reasoning about a Highly Connected World. Cambridge University Press, 2010.

[12] Frank Harary. On the notion of balance of a signed graph. Michigan Mathematical Journal, 2(2):143–146, 1953.

[13] Frank Harary. On local balance and N-balance in signed graphs. Michigan Math. J., 3(1):37– 41, 1955.

[14] Frank Harary, Robert Z. Norman, and Dorwin Cartwright. Structural Models: An Introduc- tion to the Theory of Directed Graphs. John Wiley & Sons Inc, September 1965.

13 [15] Fritz Heider. Social perception and phenomenal causality. Psychological Review, 51(6):358– 374, 1944.

[16] Fritz Heider. Attitudes and cognitive organization. Journal of Psychology, 21(1):107–112, 1946.

[17] Fritz Heider. The Psychology of Interpersonal Relations. John Wiley & Sons, 1958.

[18] Norman P Hummon and Patrick Doreian. Some dynamics of social balance processes: bring- ing Heider back into balance theory. Social Networks, 25(1):17–49, 2003.

[19] Norman P. Hummon and Thomas J. Fararo. Assessing hierarchy and balance in dynamic network models. The Journal of Mathematical Sociology, 20(2-3):145–159, 1995.

[20] Krzysztof Kulakowski. Some recent attempts to simulate the heider balance problem. Com- puting in Science and Engineering, 9:80–85, 06 2007.

[21] Fenrong Liu, Jeremy Seligman, and Patrick Girard. Logical dynamics of belief change in the community. Synthese, 191:2403–2431, 2014.

[22] Julian O. Morrissette. An experimental study of the theory of structural balance. Human Relations, 11(3):239–254, 1958.

[23] Theodore M. Newcomb. An approach to the study of communicative acts. Psychological Review, 60(6):393–404, 1953.

[24] Theodore M. Newcomb. The prediction of interpersonal attraction. American Psychologist, 11(11):575–586, 1956.

[25] Theodore M. Newcomb. Acquaintance Process. Holt, Rinehart & Winston of Canada Ltd, December 1961.

[26] Robert Z Norman and Fred S Roberts. A derivation of a measure of relative balance for social structures and a characterization of extensive ratio systems. Journal of Mathematical Psychology, 9(1):66 – 91, 1972.

[27] Ji Ruan and Michael Thielscher. A logic for knowledge flow in social networks. In Dianhui Wang and Mark Reynolds, editors, AI 2011: Advances in Artificial Intelligence, pages 511– 520, Berlin, Heidelberg, 2011. Springer Berlin Heidelberg.

[28] Samuel Franklin Sampson. A Novitiate in a Period of Change: An Experimental and Case Study of Social Relationships. PhD thesis, Cornell University, 1968.

[29] Jeremy Seligman, Fenrong Liu, and Patrick Girard. Logic in the community. In Mohua Banerjee and Anil Seth, editors, Logic and Its Applications, pages 178–188, Berlin, Heidel- berg, January 2011. Springer Berlin Heidelberg.

[30] L. J. Stockmeyer and A. R. Meyer. Word problems requiring exponential time(preliminary report). In Proceedings of the Fifth Annual ACM Symposium on Theory of Computing, pages 1–9, 1973.

[31] Hans van Ditmarsch, Jan van Eijck, Pere Pardo, Rahim Ramezanian, and Franc¸ois Schwarzentruber. Epistemic protocols for dynamic gossip. Journal of Applied Logic, 20:1– 31, March 2017.

14 [32] Zhigang Wang and Warren Thorngate. Sentiment and social mitosis: Implications of heider’s balance theory. Journal of Artificial Societies and Social Simulation, 6(3):12–23, June 2003.

[33] Xiaolong Zheng, Daniel Zeng, and Fei-Yue Wang. Social balance in signed networks. Infor- mation Systems Frontiers, 17(5):1077–1095, January 2015.

15