# Embedding and Implementation of Quantum Computational Concepts in Digital Narratives

Nikitas M. Sgouros

► To cite this version:

Nikitas M. Sgouros. Embedding and Implementation of Quantum Computational Concepts in Digital Narratives. 14th International Conference on Entertainment Computing (ICEC), Sep 2015, Trondheim, Norway. pp.140-154, 10.1007/978-3-319-24589-8_11. hal-01758430

HAL Id: hal-01758430

https://inria.hal.science/hal-01758430

Submitted on 4 Apr 2018

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Embedding and Implementation of Quantum Computational Concepts in Digital Narratives

Nikitas M. Sgouros

Department of Digital Systems, University of Piraeus
18534, Piraeus, Greece
sgouros@unipi.gr

**Abstract.** Quantum computational concepts introduce a host of new ideas for describing and implementing computational processes based on notions of superposition, entanglement, interference and measurement. This paper explores how such quantum mechanical ideas can be used in the development and implementation of computational narrative environments. In particular we focus on the use of quantum computing concepts for the representation of character state and beliefs, the development of point-of-view and context-sensitive processes for decision making along with the representation of the notion of conflict. We describe the implementation of these ideas in QuNL, our novel, special-purpose declarative language for narrative construction along with QuNE its associated interpreter. Both systems are available on the Web for testing and experimentation.

**Keywords:** Quantum Computing, Computational Methodologies for Entertainment, Narratives.

## 1 Introduction

Narrative forms an important backbone on which major entertainment forms ranging from movies or theater to games are based. One of the most significant forms of narrative centers on Aristotle's view of tragedy [1]. In the Aristotelian conception of narrative an original conflict between antagonistic forces develops out of an initial situation. The conflict moves from this initial situation towards its antagonistic climax through a sequence of escalating conflicts consisting of actions and counter-actions and then towards an unambiguous solution at the end. The evolving performance conforms to the demands of *unity* and *totality* [1]. Unity means that the performance consists of a single dramatic sequence, or if there are more than one, that one ("the primary plot") predominates clearly over the others. Totality means "that everything is there that somehow belongs to it" and, in negative terms, "that all elements that are not indispensable are omitted".

Central to this narrative conception is the notion of the 'hero' i.e., the protagonist whose beliefs, goals, behavior and final fate is the subject of the story. Another important notion is that of the 'anti-hero' i.e. a protagonist that opposes the hero and possesses incompatible qualities to those of the hero. The existence of the hero and anti-hero forms a dipole around which a clash erupts, escalates and finally resolves
transforming our experience at the end of the event. This is a basic description that we believe fits a lot of stories, game plots, theater plays, operas etc. that can be conceptualized as the conflict between a hero and anti-hero enacting the battle between good and evil, wealth and poverty, love and hate etc. While the aristotelian principles of narrative have been successfully applied over the ages to events with a predetermined fixed plot structure such as stories, movies or theater plays, their application in interactive events, such as games, where the participants have significant degrees of freedom in their behavior and, therefore, a fixed plot structure is not guaranteed to be followed, is more problematic. The problem stems from the fact that the outcome of the conflicts taking place in a game is inherently indeterminate. Consequently, computational abstractions for interactive narrative should take into account the indeterminate nature of these events and describe them as such.

This paper explores how narrative elements can be framed in quantum computational terms. We describe how quantum mechanical notions such as superposition, entanglement, interference and measurement can handle important narrative aspects such as the representation of character state and beliefs, the development of point-of-view and context-sensitive processes for decision making along with the representation of the notion of conflict. Furthermore, since quantum models are inherently indeterminate they can provide ways to capture the effects that context has on the observation and evolution of an interactive narrative.

We explore the use of quantum computational concepts in narrative generation through the construction of QuNL, a declarative language for describing subjective elements in narrative construction and QuNE a special-purpose interpreter for executing QuNL programs on a classical computer. QuNL programs are fed to QuNE (Quantum Narrative Engine), a special-purpose interpreter that constantly evaluates the applicability of protagonist actions and establishes the effects of each applied action. QuNE is implemented in C++ and an on-line version is available at (http://www.epinoetic.org/Assets/QuNL.html) along with a description of the QuNL language (http://epinoetic.org/?page_id=37). A QuNL code example that can be fed to QuNE can be found at (http://www.epinoetic.org/Assets/QuNLexample.txt).

The rest of this paper is structured as follows. Section 2 provides a brief overview of the basic notions in quantum theory and computing that are relevant to our research. Section 3 describes our quantum concepts for character state and beliefs in narrative. Section 4 describes our quantum theoretic notion of conflict in narrative, while section 5 shows how narrative evolves using quantum computational notions. Finally, section 6 presents related work and discusses our research results.

## 2 Quantum Computing Overview

Although at first sight it might seem idiosyncratic to suggest that a theory that deals with the behavior of subatomic particles can serve as the basis for thinking about computational forms of narrative, we believe that there are very interesting insights to be gained from drawing parallels between these two areas of research. In this section we seek to describe in a simplified manner the major features of quantum theory that are relevant to this endeavor (see [2] for a thorough introduction).
Quantum theory is concerned with modeling the behavior of subatomic particles. The behavior of such a particle *p* is characterized by its *state*. The state of a particle can be expressed in terms of a basis consisting of a set of n vectors. We refer to these basis vectors as *pure states* $|x_i\rangle$ using the Dirac *ket* notation that is popular in quantum theory. Each $|x_i\rangle$ is a n-dimensional vector, for example $x_0=[1,0,...,0]^T$, $x_1=[0,1,...,0]^T$, ..., $x_{n-1}=[0,0,...,1]^T$, such that the set of $x_i$'s forms an orthonormal basis of the complex vector space $C^n$. The state $|\psi_p\rangle$ of particle *p* is a linear combination of the $x_i$'s, therefore

$$|\psi_p\rangle = c_0^* |x_0\rangle + c_1^* |x_1\rangle + \dots + c_{n-1}^* |x_{n-1}\rangle$$

where the $c_i$'s are complex numbers referred to as *complex amplitudes*. Unlike classical physics a particle can be in a *superposition* of states, therefore our particle *p* can be in all of the $|x_i\rangle$ states simultaneously. Consequently the current state of the system corresponds to a vector in Hilbert space. The particular blending of states it is in is described by the vector of complex amplitudes $[c_0, c_1, ..., c_{n-1}]^T$ in its state description. Although *p* is in a superposition of states, when we *observe (measure)* it, it ends up (collapses) in only one of its $|x_i\rangle$ pure states. Therefore while a quantum system can exist in a multitude of states simultaneously it is the measurement process that interacts with the current superposition of the system and actively creates a single state for the system to be in. The probability $Pr(\psi_p = x_i)$ that *p* will be observed in state $|x_i\rangle$ is given by the normalized squared length of the state's amplitude:

$$Pr(\psi_p = x_i) = \frac{|c_i|^2}{\sum_{i=0}^{n-1} |c_i|^2}$$

In the following we always assume that $\sum_{i=0}^{n-1} |c_i|^2 = 1$, therefore:

$$Pr(\psi_p = x_i) = |c_i|^2$$

The computation of these probabilities proceeds by first projecting the state vector onto the relevant pure state vector and then squaring the length of the resulting projection.

Another important feature of quantum theory is the way quantum particles are combined to form more complex systems. In classical physics the combination of two independent systems each with n and m degrees of freedom respectively, results in a system with n+m degrees of freedom. This is not the case in the quantum context where the combination of the two systems results in a system with n*m pure states. This happens because the state of the new system is computed using the *tensor product* ⊗ of the two initial states and it contains all the combinations of its initial states. However, not all states of multi-particle systems can be decomposed into a tensor product of a set of more simple states. We refer to the ones that cannot be decomposed in such a way as *entangled* states. Entanglement seems to be a fundamental phenomenon in quantum mechanics for which there might be no equivalent in classical physics. The states of entangled particles are correlated, therefore if we observe the state of one of them then the states of the rest are instantaneously affected even though they may be quite far away from each other. It is not clear yet how particles become entangled in nature although in quantum computing there exists sequences of operators that act on *qubits* (a qubit is a unit of information on a two dimensional state space) and set them in an entangled state.

Another basic notion in quantum mechanics is that of the *observables*, i.e., the parameters that can be observed in each state of the state space. Observables can be thought of as the set of questions that we can pose at a specific state of the system. As
we noted before, each time we pose a question to a system (i.e. we perform a measurement on it) the system exits its superposition and settles in one of its pure (definite) states. What is interesting is that, in general, when we pose a sequence of questions to the quantum system, its final state depends on the order in which these questions are posed, therefore measurements do not commute in general. We refer to this ordering effect as *interference* between the various measurements. In essence, interference is one way of capturing the effect of the context in which a measurement is performed. Another effect of ordering in the measurement process is that while a system can reach a definite state after a measurement, it can then enter a new superposition after a subsequent measurement corresponding to a different question is performed. Therefore, it is not always the case that a sequence of measurements removes uncertainty by setting the system into a definite state since this depends on the choice of basis in which the measurement is performed. Heisenberg's well-known uncertainty principle which states informally that there is an inverse relationship between the accuracy of measuring the position and momentum of a quantum particle illustrates this phenomenon in the case of observables that do not commute.

In terms of dynamics, a quantum system evolves either through the application of a unitary operator on its current state which transforms it into a new state or through the execution of a measurement. A unitary operator is a linear operator that modifies the direction of a vector in a Hilbert space without changing its length. In quantum computing each operator is represented by a unitary matrix and referred to as a quantum gate. The application of a sequence of unitary operators on a state is deterministic. In contrast, as we indicated before, the execution of a measurement is probabilistic. In general then a quantum computation can evolve using both methods under the following sequence of steps:

1. the system is placed into an initial state, e.g. $|\psi\rangle$

2. a sequence of unitary operators (quantum gates) is applied to $|\psi\rangle$

3. the output of step 2 is measured giving us the final state of the system.

## 3 Representation of Character State and Beliefs

The quantum-theoretic notion of superposition forms the basis for representing the state of our narrative protagonists. At each point in time each protagonist has a unique state that can be expressed as a superposition of alternative pairs of qualities. These pairs of qualities correspond to different points of view (moral, economic, health, social etc.) for referring to the protagonist state.

In particular, we represent the various qualities of the hero and anti-hero as unit vectors in two dimensional complex space $C^2$. These vectors are organized in pairs each of which defines a basis for describing the state space of a protagonist. For example, if the narrative is about poor versus rich then we can define two such qualities forming a $60^\circ$ and a $-30^\circ$ angle with the x axis respectively (see Fig. 1) as:

$$|\text{poor}\rangle = [\cos(60^\circ), \sin(60^\circ)]^\mathrm{T} \quad \text{and} \quad |\text{rich}\rangle = [\cos(-30^\circ), \sin(-30^\circ)]^\mathrm{T}$$

These qualities form an orthonormal basis $W = \{|\text{poor}\rangle, |\text{rich}\rangle\}$ for describing the state space of a protagonist in terms of wealth. In this case the states of our hero and anti-hero can be represented as two superpositions with respect to W. For example, if
at time $t_1$ our hero is more likely to regard himself as poor while the anti-hero more probably regards himself as rich then these protagonists can be in the following superpositions:

$$|\text{hero}(t_1)\rangle = 0.8*|\text{poor}\rangle + 0.6*|\text{rich}\rangle \\ |\text{anti-hero}(t_1)\rangle = 0.6*|\text{poor}\rangle + 0.8*|\text{rich}\rangle$$

where $|\text{hero}(t_1)\rangle$ and $|\text{anti-hero}(t_1)\rangle$ represent the states of the hero and anti-hero, respectively, at time $t_1$.

What these relations indicate is that both protagonists in terms of wealth are simultaneously 'poor' and 'rich', i.e. they are in a superposition of these two possible inconsistent states. If the hero at time $t_1$ seeks to make up his mind on whether he is rich or poor this is equivalent to measuring his state and in this case there is a 64% ($=0.8^2$) chance that he will be measured 'poor' and a 36% ($=0.6^2$) that he will come out as 'rich', while the reverse holds for our anti-hero.

A protagonist then can be conceptualized as a quantum system generating various qualities. At each point in time each protagonist has a state represented as a unit vector in $C^2$. The squared length of the projection of his state vector on a quality vector corresponds to the probability with which the state can generate the particular quality when measured.

Such a protagonist state can be simultaneously described in terms of various qualities. Each protagonist can use his own set of bases for describing his state. The orientation between the various bases that describe a protagonist state provide a geometric representation of the correlations between the qualities forming these bases. In essence, this set defines the system by which each protagonist internally encodes the correlations between his qualities along with his conception of the qualities of the other protagonists, thus providing a method for differentiating each protagonist as a character and furnishing him with a distinctive world view.

For example, there can be two different bases for morality $M_{\text{hero}}$ and $M_{\text{anti-hero}}$ for our hero and anti-hero respectively. We define the $M_{\text{hero}}$ basis as $M_{\text{hero}} = \{|\text{good}_{\text{hero}}\rangle, |\text{evil}_{\text{hero}}\rangle\}$ while the $M_{\text{anti-hero}}$ basis can be $M_{\text{anti-hero}} = \{|\text{good}_{\text{anti-hero}}\rangle, |\text{evil}_{\text{anti-hero}}\rangle\}$ with the orientation of their unit vectors shown in Fig. 1. The hero can internally describe his state using the W and $M_{\text{hero}}$ bases while the anti-hero can internally describe his state using the W and $M_{\text{anti-hero}}$ bases. As a result, each of the protagonists has a different conception of morality because each one views the world using a different morality basis. Furthermore, $M_{\text{hero}}$ and $M_{\text{anti-hero}}$ can form different angles with the W basis. Consequently, each protagonist has a different conception of the correlation between morality and wealth because of the particular orientation between the morality and wealth basis in his basis set that controls how each basis can be expressed in terms of the other. Thus each protagonist possesses his personalized belief system.
<figure><img src="image_2.png" /><figcaption>Fig. 1: Orientation between the bases $M_{\text{hero}}$, $M_{\text{anti-hero}}$ and W on the xy plane. The unit vectors of the $M_{\text{hero}}$ basis are in blue, the ones of the $M_{\text{anti-hero}}$ are in black while the unit vectors of W are in red. Each one of these bases consists of orthonormal vectors.</figcaption></figure>

Furthermore, such a quantum geometrical abstraction allows us to represent how each protagonist observes the state of the other protagonists in his own belief system. This is performed through the expression of the state of the other protagonists using the various bases that express the observer state. For example, if we assume that the vector $|\text{hero}(t)\rangle$ in Fig. 1 represents the current state of the hero forming a 20° angle with the $|\text{evil}_{\text{anti-hero}}\rangle$ vector and consequently a 70° angle with the $|\text{good}_{\text{anti-hero}}\rangle$ vector then the state of our hero as seen by the $M_{\text{anti-hero}}$ basis of the anti-hero is written as:

$$ \begin{aligned} |\text{hero}(t)\rangle &= \cos(20^{\circ})|\text{evil}_{\text{anti-hero}}\rangle + \sin(20^{\circ})|\text{good}_{\text{anti-hero}}\rangle \Rightarrow \\ &\Rightarrow |\text{hero}(t)\rangle = 0.93969*|\text{evil}_{\text{anti-hero}}\rangle + 0.34202*|\text{good}_{\text{anti-hero}}\rangle \end{aligned} $$
Therefore, according to the anti-hero's morality our hero is probably an 'evil' man as there is a 88.3% chance to be observed as 'evil' compared with a 11.7% chance to be observed as 'good'. This view is inconsistent with the conception of the hero for himself in terms of morality since his state is closer to the |good<sub>hero</sub>> vector than the |evil<sub>hero</sub>> one. Therefore, the hero possibly regards himself as 'good'.

In general, each protagonist is not expected to have access to the 'true' state of the other protagonists neither to the details of the 'true' bases in which they express their state. As a 'true' state or basis of a protagonist we refer to the state and bases that he actually uses in his behavior. Therefore, each protagonist can use his own conception of the state and the bases that are used by others. For example, from the point of view of the anti-hero the |hero(t)> state that he used to view the hero's morality in the previous computation may not be the 'true' state of the hero but what the anti-hero thinks it is. As a result, there is not necessarily some global 'true' knowledge shared by all protagonists and each one of them behaves according to his subjective conception of the environment. This greatly increases the expressive power of our narrative model allowing us to represent misconceptions or misunderstandings between the protagonists. These situations of discrepant awareness can have significant dramatic potential according to theories of drama [3].

If we conceptualize the whole narrative as a quantum system composed of protagonist subsystems then the state of the whole system can be computed as the tensor product of the protagonist states. In general, if |i> = [x, y]<sup>T</sup> and |j> = [z, e]<sup>T</sup> then their tensor product is computed as:

$$|i> \otimes |j> = [x*z, x*e, y*z, y*e]^T$$
and if $|A> = (a^*|i>+b^*|j>)$ and $B = (c^*|k>+d^*|p>)$ then

$$|A> \otimes |B> = a^*c^*|ik>+a^*d^*|ip>+b^*c^*|jk>+b^*d^*|jp>$$

where |ij> is used as a shorthand for |i> ⊗ |j>.

For example, if we want to describe the state $|\psi(t)>$ of the narrative at time t in terms of morality bases $M_{\text{hero}}$ and $M_{\text{anti-hero}}$ where:

$$|\text{hero}(t)> = 0.8^*|\text{good}_{\text{hero}}> + 0.6^*|\text{evil}_{\text{hero}}>$$
$$|\text{anti-hero}(t)> = 0.6^*|\text{good}_{\text{anti-hero}}> + 0.8^*|\text{evil}_{\text{anti-hero}}>$$

then:

$$|\psi(t)> = |\text{hero}(t)> \otimes |\text{anti-hero}(t)> \Rightarrow \\ \Rightarrow |\psi(t)> = 0.48^*|\text{good}_{\text{hero}}\text{good}_{\text{anti-hero}}> + 0.64^*|\text{good}_{\text{hero}}\text{evil}_{\text{anti-hero}}> + \\ + 0.36^*|\text{evil}_{\text{hero}}\text{good}_{\text{anti-hero}}> + 0.48^*|\text{evil}_{\text{hero}}|\text{evil}_{\text{anti-hero}}>$$

This representation now means that, at time t there is a 23.04% (= 0.48²) chance that both our protagonists are observed as being good with respect to their individual bases, a 40.96% (=0.64²) chance of our hero being observed as good and the anti-hero as evil etc.

QuNL allows us to define the various bases and basis unit vectors that represent alternative points of view in the unfolding narrative using the *Basis* statement. Each *Basis* provides a reference frame for representing the protagonist states with regards to two opposing qualities. For example *wealth@hero* can be defined as a basis that corresponds to a 2D coordinate system with an x-vector called 'rich' with value [cos(30.0), sin(30.0)] and a y-vector called 'poor' with value [cos(120.0), sin(120.0)]
where the angle values are in degrees. The following QuNL statement describes all this information:

Basis wealth@hero <- rich [cos(30.0), sin(30.0)] poor [cos(120.0), sin(120.0)];

In addition, a Basis can be defined with respect to an already defined basis as in:

Basis health@hero <- healthy sick #Angle 10.0 #WithRespectTo wealth@hero;

In this statement a new basis 'health@hero' is defined consisting of an x-vector named 'healthy' and a y-vector called 'sick' each of which forms a 10 degree angle with the corresponding x- and y- vectors of the 'wealth@hero' basis. The #Angle and #WithRespectTo keywords are used to indicate the relative angle and the reference basis respectively.

QuNL also provides the *Protagonist* statement for describing the initial state of a story character. For example, the statement:

Protagonist hero <- #Amplitude [cos(45.0), sin(45.0)] #WithRespectTo health@hero;

describes the initial state of a protagonist named 'hero' as a unit vector with value [cos(45.0), sin(45.0)] in the coordinate system defined by Basis 'health@hero'.

In conclusion, our quantum-inspired conception of a protagonist state can capture ambiguity and internal conflicts in his character through the notion of a superposition. In this conception the observed (measured) qualities of the protagonist emerge in real time at the point of measurement reflecting the interaction between the protagonist state and its environment. This is because the measurement process changes the state of the protagonist by projecting it into one of its basis vectors. Furthermore, this quantum conception offers a geometric interpretation that can capture the correlations between the qualities of a protagonist through the construction and orientation of several bases that form a personalized belief system. This geometric interpretation can also be used to capture the correlations between the states of different protagonists.

# 4 Quantum Theoretic Conceptualization of Conflict

Conflict is an essential concept in aristotelian narrative as it provides a way of resolving the questions posed by an event and of propelling the story forward. As a result, conflict is a transformational event. In order to operationalize conflict we turn to the notion of entanglement and explore its potential use in our narrative model.

In quantum theory it is not always the case that the current state of a composite system can be expressed as the tensor product of its subsystems. For example, let us consider the state $|\psi(t_3)\rangle$ such that:

$$|\psi(t_3)\rangle = \frac{1}{\sqrt{2}} * |\text{good}_{\text{hero}}\text{evil}_{\text{anti-hero}}\rangle + \frac{1}{\sqrt{2}} * |\text{evil}_{\text{hero}}\text{good}_{\text{anti-hero}}\rangle$$

State $|\psi(t_3)\rangle$ corresponds to a scenario in which the $|\text{good}_{\text{hero}}\rangle$ and $|\text{evil}_{\text{anti-hero}}\rangle$ vectors are perfectly correlated and the same holds for the $|\text{evil}_{\text{hero}}\rangle$ and $|\text{good}_{\text{anti-hero}}\rangle$ vector pair. Consequently whenever the state of the hero coincides with the $|\text{good}_{\text{hero}}\rangle$ vector the state of the anti-hero will automatically coincide with the $|\text{evil}_{\text{anti-hero}}\rangle$ vector and vice versa. An analogous situation holds between the $|\text{evil}_{\text{hero}}\rangle$ and $|\text{good}_{\text{anti-hero}}\rangle$ vector pair. In addition, the entanglement relation specifies that there is a 50% chance
for the event |good<sub>hero</sub>> and |evil<sub>anti-hero</sub>|> to happen and the same holds for the
|evil<sub>hero</sub>| and |good<sub>anti-hero</sub>|> combination. As a result, each of our protagonists has a
50% chance to be observed as 'good' and if this happens then the other one becomes
'evil'. More specifically, state |ψ(t<sub>3</sub>)|> has three distinctive features:

(1) It can be proven that it cannot be decomposed into a tensor product of its two protagonist components, therefore it is not a product of the usual rules of state synthesis. This is because |ψ(t<sub>3</sub>)> is analogous to what is called a Bell state in quantum mechanics [2]. In particular, two other state combinations that a tensor product would generate (|good<sub>hero</sub>|good<sub>anti-hero</sub>|> and |evil<sub>hero</sub>|evil<sub>anti-hero</sub>|>) are absent from |ψ(t<sub>3</sub>)>. As it does not emerge out of the 'normal' rules of system synthesis, |ψ(t<sub>3</sub>)> essentially corresponds to a disruption in system evolution.

(2) There is perfect correlation between the states of the system involved in it. More specifically, the hero and anti-hero states in |ψ(t<sub>3</sub>)> exhibit perfect correlation because if the state of the hero is measured as |good<sub>hero</sub>|> then we automatically know that our anti-hero is in the |evil<sub>anti-hero</sub>|> state and vice versa.

(3) It is indeterminate because although the states involved are perfectly correlated we do not know in advance in which one of these correlations the system will collapse after measurement.

We refer to state $|\psi(t_3)\rangle$ as an *entangled* state.

In the case of conflict although it is quite hard to come up with an exact definition, we can nevertheless adopt a consensus view that associates conflict with a disruption of the status quo of a system. This disruption arises out of a maximal level of contradictions in the evolution of the system. In this respect conflict and entanglement are both disruptive events in the life of a system. Similar to entanglement, conflict in narrative:

(1) results in establishing correlations between the states of the parties involved usually in the form of a winner and a loser.

(2) its final result is indeterminate. There is always an element of surprise in conflict and even the most powerful can end up on the losing side. This fact provides the dramatic suspense that is necessary to engage the audience in the event. Furthermore, both parties have something to gain or lose, i.e., there is always risk in conflict.

Therefore, entanglement can be used to establish 'zero-sum' types of correlations between the protagonists where one man's win is another man's loss such as the state represented by |ψ(t<sub>3</sub>)>. Such 'zero-sum' correlations correspond to the archetypical notion of conflict in aristotelian narrative. This is the case because each story needs to have a clear, unambiguous resolution and placing our protagonists in orthogonal states (e.g. life/death, love/hate, freedom/jail) in the end provides the clearest conceptual separation of their final fate.

In QuNL entanglements are established using the *Entangle* statement. This statement takes three arguments each one enclosed in brackets ([]) that describe how the states (e.g. ?subj and ?obj) in its first argument will be correlated (variables in QuNL are denoted as identifiers beginning with '?'). The second argument of this statement defines the probability P with which the correlation described in its third argument can be established through measurement. Finally, the third argument describes the pair of unit vectors of two bases (e.g. A and B) in which the values of the entangled states will collapse after measurement with probability P. Then the probability of the ?subject and ?object states collapsing on the other pair of unit
vectors of bases A and B is 1-P and is computed automatically by the system. For example in the following Entangle statement:

(Entangle [?subj ?obj] [?p*?h] [rich(wealth@?subj) poor(wealth@?obj)])

we have that P = ?p*?h, A = wealth@?subj, B = wealth@?obj and the statement establishes the following entanglement relation between the ?subj and ?obj states:

$$ (?p*?h)*|rich(wealth@?subj)poor(wealth@?obj)> + $$

$$ (1-?p*?h)*|poor(wealth@?subj) rich(wealth@?obj)> $$

# 5 Narrative Dynamics

In our quantum conception of narrative the state of each protagonist is represented as a unit-length vector in Hilbert space. The story uses a number of bases in which each such state can be expressed thereby representing the belief system and the qualities of each protagonist and allowing each state to have multiple interpretations depending on the basis in which it is expressed. Based on this conception we can identify three ways to affect narrative evolution (its dynamics): (1) Protagonist decisions (2) Protagonist actions (3) Belief Revision

Protagonist decisions are equivalent with the process of measuring his state in some basis. Consequently we can represent each decision as a collapse of the protagonist state in one of the basis vectors, thereby modifying the state vector.

Protagonist actions are more general than decisions in that they modify the superposition corresponding to the protagonist state without necessarily causing it to collapse to any basis vector. This is achieved by modifying the amplitudes of the pure states involved in a superposition. In essence protagonist actions correspond to unitary operators in quantum theory. In addition protagonist actions can change the state of other protagonists. For example, if the hero finds a well-paid job then his state in Fig. 1 should rotate closer to the |rich⟩ vector since the possibilities of improving his wealth are now brighter.

Furthermore, protagonist actions can result in the entanglement of protagonist states. For example, our hero may try to become rich by stealing the anti-hero's treasure chest. If the stealing action succeeds it will result in the hero becoming rich and the anti-hero poor while if it fails the hero will remain poor and the anti-hero rich. Therefore the stealing action can be thought of as establishing the following entanglement between the hero and anti-hero:

$$ |\psi(t_5)\rangle = \alpha * |rich_{\text{hero}} - poor_{\text{anti-hero}}\rangle + \beta * |poor_{\text{hero}} - rich_{\text{anti-hero}}\rangle $$

where a and b squared will reflect the probability of the stealing action either succeeding or failing respectively.

Whenever conflict entanglements are established they create clear correlations between states, therefore they impose a set of constraints on how different state vectors change. The amplitudes of the entangled states may not remain fixed but they can change during the event reflecting the effects of the protagonists behavior. For example, if the hero consumes a magic filter that makes him invisible then his chances of succeeding in stealing the anti-hero's treasure should improve and that should be reflected in the amplitudes of the entanglement he participates related to his
stealing action. Therefore, modification of the state of a protagonist can either cause an entanglement to be resolved if it collapses to a state participating in such an entanglement or it can change the probabilities of the events described in the entanglement.

Each protagonist action can be triggered in a particular context. Such a context can consist of actions that have already taken place or of probabilities for the appearance of certain states and the relations between them. For example, a stealing action such as the one we described above can be materialized under a context in which the subject of the action is primarily 'evil' and he thinks that the person he wants to steal from is probably 'rich'. If the thief is the hero and the victim is the anti-hero this means that in order for the stealing action to occur the probability of the hero's state collapsing to the $|evil_{hero}|$ vector in Fig. 1 should be above a certain threshold while the probability of the anti-hero's state collapsing to the $|rich|$ vector should be greater than another threshold.

Finally, belief revision corresponds to a change in the protagonist's conceptualization of his state. This happens when the protagonist modifies one or more of the bases he uses to express his state. For example, our hero may convince himself that being rich is not such a bad thing. This will be materialized by transforming (rotating) the $M_{hero}$ basis in Fig. 1 so that the $|good_{hero}|$ vector comes closer to the $|rich|$ vector.

Each protagonist uses a set of alternative bases in which he can express his state. However, each protagonist can have a clear preference over which of the vectors of each basis his state should be closer to or, optimally, coincide with. We call a set of such vectors the protagonist's *preferred* states. For example, our hero may regard the vectors $|good_{hero}|$, $|rich|$ described in Fig. 1 as belonging to the set of his preferred states. This set then represents the set of goals that he wants to satisfy in the narrative. Depending on the geometry of the vectors involved it is not always possible to maximally satisfy all these goals. The optimal scenario for the protagonist would be if all the vectors in its preferred states were identical, therefore collapsing its state to any one of them would maximally satisfy his goals. If this is not the case then the protagonist should seek to transform his state vector through a sequence of decisions and/or actions to a position that represents an optimal compromise between achieving all these goals. Alternatively, he could revise his beliefs by transforming their respective bases so as to achieve either a maximal or an optimal positioning of the basis vectors included in his preferred states set with his state vector. Finally, he could decide to drop some of the goals in his preferred states set reflecting the fact it is hard or worthless to achieve them.

The distance between the current protagonist state and its optimal position in the preferred set of each protagonist can provide us with a measure of the *dramatic tension* that exists in his behavior. This distance is equal to the sum of the inner products between the state vector and each of the vectors in his preferred state set. The sum of the dramatic tensions for all protagonists can be used to estimate the overall dramatic tension in the event.

In QuNL the *Ethos* statement defines a set of qualities that a protagonist seeks to achieve as closely as possible ('ethos' is hellenic for the guiding beliefs of a person) therefore it corresponds to his preferred states. For example, the statement:

Ethos hero <- rich(wealth@hero) healthy(health@hero);
denotes that the protagonist 'hero' seeks to move his state as close as possible to the positions of the vectors 'rich' of basis 'wealth@hero' and 'healthy' of basis 'health@hero'.

Aristotelian narrative typically proceeds through the involvement of the protagonists in a sequence of developments that causes a rise in the overall level of dramatic tension. At some point tension reaches a maximum value corresponding to a climactic point in the event. This point triggers the resolution of all outstanding events leading to the story end. According to Aristotle, this resolution should be total and unambiguous affecting all unresolved events in the story and delivering a clear message in terms of ethics to the spectator. We model resolution as the measurement of some protagonist state in the event that makes it collapse to one of its basis vectors. This can be the result of a decision or an action taken by a protagonist or of a measurement executed on an entangled state (e.g. the outcome of a conflict). The performance of such a measurement can trigger a cascade of resolutions affecting all entangled states in which a protagonist is involved with his new pure state along with the establishment of new states for the rest of the protagonists that participate in these entanglements. Ideally the resolution of the psychagogical event should take place at its climactic point that is the point in which overall dramatic tension in the event reaches its maximum value.

In QuNL a Praxis statement represents the subjective imprint of an action ('praxis' is hellenic for 'action') that a protagonist may use in order to achieve the qualities in his Ethos. The following statement defines a Praxis named 'Steal'.

Praxis Steal <-
#Bindings (?subj != ?obj)
#Context ( ?p <- Prob ?subj = evil(morality@?subj)
?p > 0.7
?h <- Prob ?obj = rich(wealth@?subj)
?h > 0.9
)
#Effects (
(Entangle [?subj ?obj] [?p*?h] [rich(wealth@?subj) poor(wealth@?obj)]);

Each Praxis statement contains three fields, `#Bindings`, `#Context` and `#Effects`. The `#Bindings` field contains statements constraining the values of the Praxis variables independent of the context in which the Praxis can be executed. For example in the case of the Steal action above the `#Bindings` statements denote that the subject of the action should be different from the person to which the action is directed.

The `#Context` field contains a set of statements that describe the context under which the action can take place. For example, in the Steal Praxis statement above the statement:

$$ ?p <- Prob ?subj = evil(morality@?subj) $$

computes the probability with which the superposition of the protagonist state bound to the value of the variable ?subj can be found through measurement to be equal to the vector 'evil' of the basis 'morality@?subj' where again the variable ?subj is appropriately bound. The value of this probability is then assigned to the variable ?p.
The following statements in the context of the particular Steal action then indicate that in order for this action to be considered for execution the prospective thief has to think of himself as being primarily evil (with a probability > 0.7) and he also has to think of the victim as being rich (with a probability > 0.9).

In addition the Praxis context can contain a *Metro* statement ('metro' is hellenic for measure). A Metro statement causes a measurement of a state in a given basis. For example, the statement

?d <- Metro #State hero #WithRespectTo romance

will cause a measurement of the state 'hero' in the basis 'romance'. The result of the measurement will be the name of the unit vector of the basis 'romance' in which the superposition 'hero' will collapse. This result will be stored in the variable '?d'. Finally, the #Effects field describes the effect of this action according to the persons involved in it. In our example execution of a Steal Praxis statement entangles the wealth states of the protagonists involved. In general in its current version a *Praxis* statement can have three effects:

1. Create entanglements between various protagonist states.

2. Transform one or more superpositions.

3. Stop narrative generation because a final resolution for the story has been found.

A QuNL program is fed to the QuNE interpreter which loops continuously seeking to identify all Praxis statements that can be executed during each cycle. For each protagonist the interpreter selects randomly and executes one of the Praxis statements that can run and the loop continues until there are no Praxis statements available for execution or narrative generation is stopped as a result of a Praxis execution.

# 6 Related Work & Discussion

Our research seeks to actively explore the use of quantum computational concepts in computational narratives. In this respect we described how quantum theory provides us with innovative means of expressing and formal methods for computing subjective elements of stories such as character construction, contextual and point-of-view decision-making, discrepant awareness and goal-directed behavior. Our research is inspired from and complements similar research efforts in social sciences and education [4-7] that seek to leverage the power of quantum theory and geometry in their respective fields.

A large part of the research in creating computational forms of narrative focuses on the use of AI planning techniques that are enriched in order to capture character intentionality and event causality in stories e.g. [8-10]. These methods assume that there is a definite event and character state at each point in the narrative along with explicit plan or rule-based structures for computing narrative developments. We differ from these approaches since we use indeterminate and vector-based rather than set-theoretic and determinate representations for narrative concepts such as protagonist state and beliefs and express the effects of protagonist actions in terms of either potentialities (unitary operations) or correlations (entanglements) rather than definite causal effects. Furthermore, each protagonist does not form a multi-step action plan
but he reacts to narrative developments in context-sensitive ways. In essence our
narrative model describes a computational mechanism by which each protagonist
forms subjective views of the unfolding narrative and incorporates these views into
decision-making and action selection processes. Such a quantum-based abstraction
can work alongside classical AI narrative systems where the quantum model will be
responsible for taking context-sensitive decisions and/or selecting appropriate actions.
Since actions are executed in a non-quantum reality their results can be fed to a
classical AI system for further refinement and execution. The outcomes of action
execution can then be fed back to our quantum model so that a new decision/action
selection process can begin.

Although our narrative approach is based on quantum theory, it is not faithful to
quantum mechanics. For example and to the best of our knowledge there is no model
of entanglement in quantum physics that allows the amplitudes of an established
entanglement relation to become modified. Future work will seek to represent
narrative elements in multi-dimensional vector spaces, investigate how our ideas can
be applied to other entertainment forms such as music or visual arts and develop user-
friendly authoring tools for creating quantum-based narratives.

**Acknowledgements.** Presentation of this research was partially supported by the University of Piraeus Research Center.

References

1. Aristotle, Poetics

2. Nielsen, M. A., Chuang, I. L., Quantum Computation and Quantum Information, Cambridge University Press (2010)

3. Pfister, M., The Theory and Analysis of Drama, Cambridge University Press (1991)

4. Busemeyer, J. R., Bruza, P. D., Quantum Models of Cognition, Cambridge University Press (2012)

5. Haven, E., Khrennikov, A., Quantum Social Science, Cambridge University Press (2013)

6. Goff, A., Quantum tic-tac-toe: A teaching metaphor for superposition in quantum mechanics, American Journal of Physics 74 (11), (2006)

7. Kitto, K., Boschetti, F., Attitudes, Ideologies and Self-Organization: Information Load Minimization in Multi-Agent Decision Making, Advances in Complex Systems Vol. 16, Nos. 2 & 3, World Scientific Publishing Company (2013)

8. Riedl, M. O., Young, M. R., Narrative Planning: Balancing Plot and Character, Journal of Artificial Intelligence Research, vol. 39, pp: 217-268 (2010)

9. Porteous, J., Cavazza, M., Controlling narrative generation with planning trajectories: the role of constraints, Proceedings of the 2nd International Conference on Interactive Digital Storytelling (2009)

10. Sgouros, N. M., Dynamic Generation, Management and Resolution of Interactive Plots, Artificial Intelligence, vol. 107, no. 1, pp: 29-62, Elsevier (1999)