Characterization and computation of ancestors in reaction systems

In reaction systems, preimages and nth ancestors are sets of reactants leading to the production of a target set of products in either 1 or n steps, respectively. Many computational problems on preimages and ancestors, such as finding all minimum-cardinality nth ancestors, computing their size or counting them, are intractable. In this paper, we characterize all nth ancestors using a Boolean formula that can be computed in polynomial time. Once simplified, this formula can be exploited to easily solve all preimage and ancestor problems. This allows us to directly relate the difficulty of ancestor problems to the cost of the simplification so that new insights into computational complexity investigations can be achieved. In particular, we focus on two problems: (i) deciding whether a preimage/nth ancestor exists and (ii) finding a preimage/nth ancestor of minimal size. Our approach is constructive, it aims at finding classes of reactions systems for which the ancestor problems can be solved in polynomial time, in exact or approximate way.


Introduction
Inspired by natural phenomena, many new computational formalisms have been introduced to model different aspects of biology. Basic chemical reactions inspired the reaction systems, a qualitative modeling formalism introduced by Brijder et al. (2011), Ehrenfeucht and Rozenberg (2007). It is based on two opposite mechanisms, namely facilitation and inhibition. Facilitation means that a reaction can occur only if all its reactants are present, while inhibition means that the reaction cannot occur if any of its inhibitors is present. A rewrite rule of a reaction system (called reaction) is hence a triple (R, I , P), where R, I and P are sets of objects representing reactants, inhibitors and products, respectively, of the modeled chemical reaction. A reaction system is represented by a set of reactions having such a form, together with a (finite) support set S containing all of the objects that can appear in a reaction. The state of a reaction system consists of a finite set of objects describing the biological entities that are present in the real system being modeled. The presence of an object in the state expresses the fact that the corresponding Communicated by Miguel A. Vega-Rodriguez.
B Roberta Gori gori@di.unipi.it 1 Dipartimento di Informatica, Università di Pisa, Pisa , Italy biological entity, in the real system being modeled, is present in a number of copies as high as needed. This is the threshold supply assumption and characterizes reaction systems.
A reaction system evolves by means of the application of its reactions. The threshold supply assumption ensures that different reactions never compete for their reactants, and hence, all the applicable reactions in a step are always applied. The application of a set of reactions results in the introduction of all of their products in the next state of the system.
The main advantages of investigating reaction systems are that they have a clean computational model allowing for precise formal analysis, and they can be considered as reference for other computing system (e.g., Barbuti et al. 2018b;Formenti et al. 2014).
Computational complexity of some problems related to the dynamics of reaction systems has been extensively studied (e.g., in Dennunzio et al. 2015a, b;Formenti et al. 2014;Salomaa 2013a, b). In Dennunzio et al. (2015a, b), the authors introduced the concept of preimage and nth ancestor. Roughly speaking, an nth ancestor is a set of objects that lead to the production of a target set of objects after n evolution steps, while a preimage is a 1st ancestor. The authors studied the complexity of several problems related to nth ancestors by defining reductions between well-known hard problems and the corresponding nth ancestor problem. They proved that finding a minimal size preimage or ancestor, computing their size, or counting them are all intractable problems.
In this paper, we propose a constructive method to reason on preimages and nth ancestors. Indeed, we define a formula able to characterize all nth ancestors of a given set of objects. Such a formula is obtained by revising the idea of formulabased predictor introduced in Barbuti et al. (2016aBarbuti et al. ( , b, 2017Barbuti et al. ( , 2018c for reaction systems that interact with an environment. A formula-based predictor is a logic formula that exactly characterizes all the states leading to a given product in a given number of steps. It enables the study of all causal dependencies of one object from the other objects provided by the environment and therefore enhances previous works on causality in reaction systems (Brijder et al. 2010), system biology (Gori and Levi 2010;Bodei et al. 2013Bodei et al. , 2015 and natural computing (Busi 2007).
Following the same approach, here we define an nth ancestor formula that fully characterizes all nth ancestors. Moreover, we define an operator able to compute the formula in polynomial time. The relevance of this complete characterization of all nth ancestors is twofold. Ancestors in a closed reaction system express the causality relations between the objects in the initial state and the products that we can obtain after a given number of steps. Assume you are interested in the production of a certain set of objects, ancestors model all the different initial states that can lead to the production of the set of products of interest. Minimal ancestors model minimal states and our complete characterization is able to detect which are the objects that are really necessary for the production of the objects of interest. Moreover, the Boolean formula can be used to give effective algorithms for solving problems as deciding the existence of nth ancestors or the computation of a minimal size preimage or ancestor. This allows us to study the complexity of the preimage and nth ancestor problems in a constructive way by precisely identifying the step in the solving procedure that is the cause for the exponential cost. In particular, in our context, the computationally expensive step consists in the conversion of the formula to disjunctive normal form (DNF) in order to easily solve ancestor problems. An idea to avoid this step is to devise cases in which the conversion into DNF is not necessary.
To this aim, our investigation proceeds in two different directions. First, we identify classes of reaction systems for which our nth ancestor formula is already in DNF; this is obtained by imposing synctactic restrictions on the form of reactions of the reaction system. Then, we define approximations of the nth ancestor formula that can be computed in polynomial time and that are still useful to reason on nth ancestor problems. This approach is validated by several biological examples of gene regulatory networks.
The present paper enhances and extends (Barbuti et al. 2018a). More precisely, the original contributions of the paper are: 1. a new investigation leading to the formal definition of sets of approximations of the original ancestor formula; 2. the definition of effective operators able to compute such approximations in polynomial time; 3. the introduction of biological examples that show the application of the ancestors and validate our approach based on the computation of approximations.
The paper is organized as follows. Section 2 introduces (closed) reaction systems, preimages and nth ancestors. Section 3 presents some preliminary notions. The definition of nth ancestor formulas is given in Sect. 4 together with an effective operator to compute them. In Sect. 5, we bound the complexity of the nth ancestor formula. Section 6 lists some conditions under which the existence and minimal size of ancestors can be computed in polynomial time. In Sect. 7, we introduce two kinds of approximations of nth ancestor formulas that can be computed in polynomial time. Section 8 reports some conclusions.

Closed reaction systems
In this section, we recall the basic definition of reaction system (Brijder et al. 2011;Ehrenfeucht and Rozenberg 2007). Let S be a finite set of symbols, called objects. A reaction is a triple (R, I , P) with R, I , P ⊆ S, composed of reactants R, inhibitors I and products P. Reactants and inhibitors R ∪ I of a reaction are collectively called resources of such a reaction, and we assume them to be disjoint (R ∩ I = ∅), otherwise the reaction would never be applicable. The set of all possible reactions over a set S is denoted by rac(S). Finally, a reaction system is a pair A = (S, A), where S is a finite support set and A ⊆ rac(S) is a set of reactions.
The state of a reaction system is described by a subset T of the set of objects S. Let a = (R a , I a , P a ) be a reaction and T a subset of S. The result res a (T ) of the application of a to T is either P a , if T separates R a from I a (i.e., R a ⊆ T and I a ∩ T = ∅), or the empty set ∅ otherwise. The application of multiple reactions at the same time occurs without any competition for the used reactants (threshold supply assumption). Therefore, each reaction which is not inhibited can be applied, and the result of the application of multiple reactions is cumulative. Formally, given a reaction system A = (S, A), the result of the application of A to a set T ⊆ S is defined as res A (T ) = res A (T ) = a∈A res a (T ).
An important feature of reaction systems is the assumption about the non-permanency of objects: The objects carried over to the next step are only those produced by reactions. All the other objects vanish, even if they are not involved in any reaction.
Given an initial set D 0 , the semantics of a closed reaction system can be simply defined as the result sequence, δ = D 1 , . . . , D n where each set D i , for i ≥ 1, is obtained from the application of reactions of A to the state obtained at the previous step D i−1 ; formally, D i = res A (D i−1 ) for all 1 ≤ i < n. The sequence of states of the reaction system coincides with the result sequence δ = D 1 , . . . , D n . In Dennunzio et al. (2015a, b), the authors introduced the idea of preimage and nth ancestor. For simplicity, we first define them for a single product s.
Definition 1 (nth Ancestors for s) Let A = (S, A) be a reaction systems and s ∈ S. A set D 0 is an nth ancestor of s if s ∈ res The same concepts can be naturally extended to sets of products.

Causal predicates in reaction systems
In our formulas, we use objects of reaction systems as propositional symbols. Formally, we introduce the set F S of propositional formulas on S defined in the standard way: The propositional formulas F S are interpreted with respect to C a subset of objects S. Intuitively, s ∈ C denotes the presence of element s and therefore the truth of the corresponding propositional symbol. The complete definition of the formula satisfaction relation is as follows.
Definition 3 Let C ⊆ S for a given set of objects S. Given a propositional formula f ∈ F S , the satisfaction relation C | f is inductively defined as follows: In the following, ≡ stands for the logical equivalence on propositional formulas F S . Moreover, given a formula f ∈ F S , with atom( f ) we denote the set of propositional symbols that appear in f . Given a formula f , a disjunctive normal form (DNF) of f can be computed by applying the following procedure: 1. Put the negations next to the atomic objects using De Morgan's laws; 2. Put the conjunctions within the disjunctions using the distributive law; 3. Simplify the obtained formula using the idempotent, negation, domination and negation laws.
Alternatively, we can construct the complete DNF of f by constructing the truth table of f and representing with a conjunction all rows that have a truth value 1. It is worth noting that both methods are exponential in the worst case. Indeed, in the first method the application of the distributive laws (step 2) can be exponential, while in the second method the construction of the truth table is exponential in the number of variables of f . Any DNF of the formula allows us to efficiently solve problems such as determining the existence of a preimage or of an nth ancestor (see Sect. 5 for more details) or to find the minimum-cardinality preimage or nth ancestor. However, although not strictly necessary, it can be convenient to consider a compact DNF representation of f so that it can be more easily verified. This requires a logic minimization step that consists in further simplifying the formula, in exact or heuristic way, in order to derive a DNF minimal with respect to the number of terms (i.e., conjunctions) or to the number of literals occurring in it or to any other given cost metric.
This last step is computationally expensive, as logic minimization is an NP-hard problem 1 (Hassoun and Sasao 2002;Umans et al. 2006). However, since near-minimum solutions are sufficient, the logic minimization step can be performed applying heuristic methods to produce solutions that are near to the optimum in a relatively short time. In particular, in our setting, we are interested in deriving a compact logic expression containing only essential propositional symbols, i.e., symbols on which the expression actually depends. Thus, in this context, we can apply heuristic techniques (e.g., the ESPRESSO heuristic minimizer Brayton et al. 1984) to produce near minimal prime and irredundant DNF formulas, i.e., DNF where each conjunction corresponds to a prime implicant 2 of the function represented by the expression (primality), and no conjunction can be deleted without changing the function represented by the expression (irredundancy). Indeed, nonessential propositional symbols cannot appear in any prime implicant of a given Boolean function.
Let us denote with min( f ) the DNF obtained after the exact or heuristic logic minimization step. For any formula f ∈ F S , min( f ) is equivalent to f and is minimal with respect to the number of terms (i.e., conjunctions) or to the number of literals occurring in it or to any other chosen cost function. Thus, for any reasonable cost function we have f ≡ min( f ) and atom(min( f )) ⊆ atom( f ) and there exists no formula f such that f ≡ f and atom( f ) ⊂ atom(min( f )).
The causes of an object in a reaction system are defined by a propositional formula on the set of objects S. First of all, we define the applicability predicate of a reaction a as a propositional logic formula on S describing the requirements for applicability of a; namely, all reactants have to be present and inhibitors have to be absent. This is represented by the conjunction of all atomic formulas representing reactants and the negations of all atomic formulas representing inhibitors of the considered reaction.
Definition 4 Let a = (R, I , P) be a reaction with R, I , P ⊆ S for a set of objects S. The applicability predicate of a, denoted by ap(a), is defined as follows: The causal predicate of a given object s is a propositional formula on S representing the conditions for the production of s in one step; namely, at least one reaction having s as a product has to be applicable. Moreover, we define the negation of the causal predicate of s, called nocause(s), as the DNF formula equivalent to ¬cause(s).

Definition 5 Let
Note that nocause(s) can easily be computed (once for all) from cause(s) by putting the negations next to the atomic objects using De Morgan's laws and then by putting the conjunctions within the disjunctions using the distributive law.
We now introduce a simple reaction system as running example. The applicability predicates of the reactions are ap(a 1 ) = A, ap(a 2 ) = C ∧ D and ap(a 3 ) = G ∧ ¬B. Thus, the causal predicates of the objects are

Characterizing the nth ancestors
We aim to define a formula characterizing all the initial sets D 0 that lead to the production of a given product s ∈ S after exactly n steps. Note that the formula for the nth ancestor of a set of products {s 1 , s 2 , . . . , s m } ⊆ S can be obtained by combining in conjunction all the nth ancestor formulas for each s i with i ∈ {1, . . . , m} (see Corollary 1). We base our new definitions on the notions of formulabased and specialized formula predictors, originally presented in Barbuti et al. (2016aBarbuti et al. ( , b, 2018c, that characterize all causes of an object in a given number of steps. Following this approach, all nth ancestors of an object s are characterized by a propositional formula f , i.e., they are all initial sets D 0 that satisfy f according to the satisfaction relation defined in Definition 3.

Definition 6 (nth Ancestor Formula) Let
Intuitively, formula f has to characterize all initial states leading to the production of s in exactly n steps. Since the evolution of closed reaction systems is deterministic, there cannot exist two non-equivalent formulas f and f both satisfying Definition 6. However, if f is an nth ancestor formula of s and f ≡ f then also f is an nth ancestor formula of s. Among all the equivalent formulas, it is convenient to choose the one containing the minimal number of propositional symbols, so that they do not contain inessential objects. This is formalized by the following approximation order on F S .
It can be shown that there exists a unique equivalence class of nth ancestor formulas of s that is minimal with respect to the order f .
We now define an operator Anc that allows nth ancestor formulas to be effectively computed.
Definition 8 Let A = (S, A) be a reaction systems and s ∈ S. We define a function Anc : S × IN → F S as follows: Anc(s, n) = Anc a (cause(s), n − 1), where the auxiliary function Anc a : F S × IN → F S is recursively defined as follows: The function Anc(_, n) gives an nth ancestor formula that, in general, is not in DNF form and may not be minimal with respect to f . For this purpose, we could apply heuristic techniques to produce prime and irredundant quasi-minimal DNF that are guaranteed to be minimal with respect to f .

Theorem 1 Let A = (S, A) be a reaction systems. For any object s ∈ S, -Anc(s, n) is the nth ancestor formula of s; -min(Anc(s, n)) is the nth ancestor formula of s and is
minimal with respect to f .
The proof of the previous result can be obtained by revisiting the proof of Theorem 4.4 and Corollary 4.7 in Barbuti et al. (2016a). The previous result extends naturally to sets as follows.

Corollary 1 Let A = (S, A) be a reaction systems. Given a set of objects {s
-min i∈{1,...,m} Anc(s i , n) is a nth ancestor formula of {s 1 , . . . , s m } and it is minimal with respect to f .
These constructive (minimal) characterizations of nth ancestors can be exploited either for studying causal dependences between objects or for solving the computational problems studied in Dennunzio et al. (2015a, b). In particular, nth ancestor formulas can be exploited for studying the complexity of checking the existence of preimages and nth ancestors, and of computing minimal preimages and nth ancestors, as we will discuss in the rest of this paper.
Example 2 Let us consider again the reaction system A 1 of Example 1. Assume we are interested in the 1st ancestor formula of E. Hence, we calculate it by applying the function Anc: An initial set D 0 satisfies Anc(E, 1) iff the execution of the reaction system starting from D 0 leads to the production of object E after 1 step. Furthermore, in this case the obtained formula is also minimal given that min(Anc(E, 1)) = Anc(E, 1) since Anc(E, 1) is already in minimal DNF. The 1st ancestors (or preimages) of E are the sets D 0 satisfying Anc(E, 1). They are all the possible sets containing either G but not B or both C and D. In this case, no object is really necessary for the production of E in one step since we have two alternative ways to produce E involving different objects.
The 2nd ancestor formula of E is equal to f alse, This means that there does not exist any 2nd ancestor of E, that is, no initial state can lead to E in two steps. Of course, also any nth ancestor formula of E with n > 2 is equal to f alse. Therefore, we can conclude that there does not exist any nth ancestor of E for any n ≥ 2.
Example 3 Let us consider now the reaction system A 2 = ({A, . . . , L}, {a 1 , . . . , a 8 }) with the following reaction rules: Assume we are interested in the preimages of F. We obtain the 1st ancestor formula Anc(F, 1) = E ∧ D, expressing that any set containing {E, D} is preimage of F. Looking for the 2nd ancestors of F, we obtain in this case is simply obtained by applying the distributive law that gives an already minimized DNF.
The 2nd ancestor formula expresses that any set containing either {C, G, B} or {C, H , B} is a 2nd ancestors of F. Note that we can conclude that while C and B are necessary for the production of F in two steps, G and H are not.
As regards the 3rd ancestors, we have This time min(Anc(F, 3)) = f alse; therefore, we can be sure that it does not exist any nth ancestor of F for any n > 2.
The concept of ancestor is very useful for reasoning on reaction systems modeling gene regulatory networks. A gene regulatory network can be easily translated into a reaction system (Barbuti et al. 2018b). The dynamics of the reaction system, then, precisely describes the evolution of the gene regulatory network. In this context, the nth ancestors describe initial configurations of active/inactive genes that lead to a given final configuration after n steps. The repressilator network can be naturally expressed as a the reaction system This reaction system behaves differently depending on whether the initial configuration is, for example, {X , Y , Z } or simply {X }. However, in all cases the behavior is oscillatory. This can be shown by computing the 3rd and 6th ancestors of Z that turn out to be This shows that independently of the initial configuration, the gene Z repeatedly appears and disappears, exhibiting an oscillatory behavior.

Complexity of ancestor problems
In this section, we investigate the complexity of solving ancestor problems using the new characterization computed by the Anc operator. In order to achieve this goal, we first study the structure of the formula result of the Anc operator. The idea is to give an upper bound both to the size and to the depth of the formula, where depth means the number of nested AND/OR levels.
To this aim, given a reaction system A = (S, A), we first define some auxiliary notions. To give an upper bound to the size of the obtained formula, we need to know: (i) the maximum number of reactants and inhibitors in a rule of the system, denoted by cp(A), and (ii) the maximum number of rules that produce the same object, denoted mp(A).

Definition 9 Given a reaction system
where |X | indicates the cardinality of the set X .
First observe that for each s ∈ S the size of the formula cause(s) in terms of number of literals is at most cp(A) × mp(A). Computing the nth ancestor formula requires n steps. At the first step, the formula computed by our operator is cause(s), for some s, whose maximal size is at most cp(A)× mp(A). At the second step, each one of the cp(A) × mp(A) literals of the previous formula has to be substituted with its causes, obtaining a new formula whose size is at most (cp(A) × mp(A)) 2 and so on. Hence, the size of the resulting formula Anc(s, n) is at most (cp(A)×mp(A)) n for each s ∈ S; namely, the size of Anc(s, n) is polynomial in cp(A) and mp(A), as long as n has a constant value. Therefore, the size of the nth ancestor formula for the set and mp(A) as long as n has a constant value.
Let us now evaluate the depth of the formula. To this aim, the idea is to measure the level of nesting of ∧-∨ operators.
and A ∨ (B ∧ C) are level 2, and so on.
Definition 10 Let f ∈ F S , we call nesting level of f the maximum depth of its representation through a AN D-O R tree.
In order to bound the nesting level of Anc(s, n), we define the following: Definition 11 Given a reaction system A = (S, A), we define The next result bounds the nesting level of the formula Anc(s, n), for s ∈ S. We can then conclude that for a set {s 1 , s 2 , . . . , s m } ⊆ S our operator computes a 1+n ×(c(A)+ p(A)) depth formula with at most m × (cp(A) × mp(A)) n literals in polynomial time.

Theorem 2 Let
The formula that we obtain with our operator completely characterizes all nth ancestors, but it can be very complex to read because of the nesting levels of AND-OR operators. While checking whether a given set D 0 is an nth ancestor can be done in linear time in the size of the formula obtained by Anc, finding whether an nth ancestor exists or compute one of the minimal sizes requires some further manipulation of the formula. This is the expensive step, since putting the formula in DNF is in general exponential in the size of the formula. However, it is worth noting that once the formula is in DNF both problems of establishing whether an nth ancestor of a given product exists, and finding an nth ancestor with a minimal number of objects can be solved in polynomial time. Indeed, the satisfiability of a formula in DNF can be checked in a time that is linear in the size of the formula 4 ; analogously, an ancestor of minimal size can be found in linear time scanning the DNF formula in order to select the conjunction with the minimal number of positive literals.
Therefore, we can conclude that the expensive step is to put the formula in DNF. Whenever this is not necessary because the formula resulting from our operator is already in DNF, then the complexity of the ancestor problems boils down to be polynomial. This is the case of preimages of single objects as stated by the following result.
Theorem 3 Let A = (S, A) be a reaction system. For an object s ∈ S, to establish if there exists a preimage and finding one of the minimal sizes can be done in polynomial time.
Proof The formula Anc(s, 1) is, by definition, in DNF. This is not, in general, the case for preimages of {s 1 , . . . s m } with m > 1 and for nth ancestors where n > 1. To handle efficiently these problems, our investigation proceeds in two different directions. On the one hand (see Sect. 6), we define conditions on the reaction system rules so that our operator computes a formula that is already in DNF. On the other hand (see Sect. 7), we explore approximations of the nth ancestor formula that can be computed in polynomial time and are useful to address ancestor problems.

Synctactic restrictions on reactions systems
We now investigate syntactic conditions under which the existence and the minimal size nth ancestor, with n > 1, can be computed in polynomial time. The first condition we introduce is linear dependency. Intuitively, s 2 is n-linearly dependent from s 1 if it can be produced from s 1 in n steps in a unique way and by producing a single element at each step. Moreover, we say that s 2 is nlinearly produced if there exists a s 1 such that either s 2 is n-linearly dependent from s 1 or s 2 is n -linearly dependent from s 1 with n < n and s 1 does not appear as product of any reaction. Formally, Definition 13 Let A = (S, A) be a reaction system. An object s 2 is n-linearly produced in A iff one of the following conditions holds:
We are now ready to prove that for reaction systems that have at most one rule producing each object and such that all inhibitors are n-linearly produced, the nth ancestor problems are much easier to be solved.

Theorem 4 Let A = (S, A) be a reaction system satisfying the following conditions:
1. ∀s ∈ S, |{(R, I , P) | (R, I , P) ∈ A and s ∈ P}| ≤ 1 and 2. for every object s i ∈ I with (R, I , P) ∈ A, s i is n-linearly produced.
Then, for any s ∈ S, the existence and minimal size of the nth ancestors of s can be solved in polynomial time.
Proof In order to prove the claim, we prove that in this case the operator Anc of Definition 8 gives a formula which is already in DNF.
Since for every object s ∈ S Condition 1 is satisfied, we know that for each s ∈ S the formula causes(s) is a conjunction of literals. Moreover, every object used as inhibitor is n-linearly produced; thus, every negated object ¬s , in the computation of n steps, is replaced by nocause(s ) which consists of a single literal. As a consequence the disjunction operator is never introduced. Hence, the nth ancestor formula of s will be simply a conjunction of literals (objects or nonnegated objects) of nesting level 1 which is a particular case of DNF.
The next result extends the previous one to sets of objects. Proof As before, also in this case, we prove that the operator Anc of Definition 8 gives a formula which is already in DNF. The nth ancestor formula of a set of objects is, by definition, a conjunctive formula of nesting level 1. Hence, the whole nth ancestor formula of {s 1 , s 2 , . . . , s m } is still a conjunctive formula of nesting level 1. Since every object is produced by at most one rule, we have that condition 1 of Theorem 4 is satisfied. Moreover, the inhibitors B and F are (linearly) produced by a reaction with a single reactant which, in turn, is (linearly) produced by a reaction with a single reactant; then, also the second condition of Theorem 4 and Corollary 3 is satisfied for all n. Now Conditions expressed by Theorem 4 and Corollary 3 are not a characterization of all reaction systems having an nth ancestor formula in DNF. Weaker conditions can be found as, for instance, in the following proposition. The idea in this case is to allow one single object to be produced by more than one reaction.
|{(R, I , P) | (R, I , P) ∈ A and s ∈ P}| ≤ 1 and 3. for every object s i ∈ I with (R, I , P) ∈ A, s i is n-linearly produced.
Then, for any s ∈ S, the existence and minimal size of the nth ancestors of s can be solved in polynomial time.
Proof Even in this case, we prove that the operator Anc of Definition 8 gives a formula which is already in DNF.
Since there is only s ∈ S that is produced by more than one rule, only cause(s) can contain the OR operator. Moreover, s cannot appear as reactant in any rule. Thus, it cannot be introduced in the computation of the nth ancestor formula of any other object. Further, every object used as inhibitor is n-linearly produced; thus, every negated object s , in the computation of n steps, is replaced by nocause(s ) which is a single literal. Then, the nth ancestor formula of s is a DNF.

A biological application: the lac operon
We consider the regulation process of the lactose operon in E. coli (Escherichia coli, see Wong et al. 1997;Vilar et al. 2003). E. coli is a bacterium often present in the intestine of many animals. As most bacteria, it is often exposed to a constantly changing physical and chemical environment, and reacts to changes in its environment through changes in the kinds of proteins it produces. In general, in order to save energy, bacteria do not synthesize degradative enzymes unless the substrates for these enzymes are present in the environment. For example, E. coli does not synthesize the enzymes that degrade lactose unless lactose is in the environment. This phenomenon is called enzyme induction or, more generally, gene regulation since it is obtained by controlling the transcription of some genes into the corresponding proteins.
Let us consider the lactose degradation example in E. coli. Two enzymes are required to start the breaking process: the lactose permease, which is incorporated in the membrane of the bacterium and actively transports the sugar into the cell (without this enzyme lactose can enter the bacterium anyway, but much more slowly), and the beta galactosidase, which splits lactose into glucose and galactose. The bacterium produces also the transacetylase enzyme, whose function is marginal. The sequence of genes in the DNA of E. coli which produces the described enzymes is known as the lactose operon (see Fig. 2). It is composed by six genes: The first three (i, p, o) regulate the production of the enzymes, and the last three (z, y, a), called structural genes, are transcribed (when allowed) into the mRNA for beta galactosidase, lactose permease and transacetylase, respectively.
The regulation process is as follows (see Fig. 3): Gene i encodes the lac Repressor, which, in the absence of lactose, binds to gene o (the operator). Transcription of structural genes into mRNA is performed by the RNA polymerase enzyme, which usually binds to gene p (the promoter) and scans the operon from left to right by transcribing the three structural genes z, y and a into a single mRNA fragment. When the lac Repressor is bound to gene o, it becomes an obstacle for the RNA polymerase, and transcription of the structural genes is not performed. On the other hand, when lactose is present inside the bacterium, it binds to the Repressor and this cannot stop any more the activity of the RNA polymerase. In this case, transcription is performed and the three enzymes for lactose degradation are synthesized.
At a high level of abstraction, the previous complex mechanism can be described by considering only the influences that each gene has on the other genes. This is the usual approach in gene regulatory networks, which focus on positive and negative influences (promotion and inhibition) between pairs of genes, by abstracting away the biochemical details of the interaction. We follow this approach now in order to define a reaction system modeling the lac operon.
In the lac operon, the repressor R has a negative influence on the transcription and synthesis of the three enzymes for lactose degradation. Since such three enzymes are always synthesized together, we describe them with the single symbol Z in the reaction system model. The repressor R is in turn subject to the negative influence of lactose (denoted L ACT ). In addition to these influences, we model the activity of the RNA polymerase (denoted P O L), which can bind to the promoter gene p. We denote the result of such binding as Pp. As a result, we obtain the following simple reaction system: Rules a 1 , a 2 and a 3 describe the persistence of the promoter gene, of the RNA polymerase and of lactose. Rules a 4 and a 5 describe the activity of the RNA polymerase, namely the binding with the promoter gene and the transcription of the structural genes. The latter rule has R as inhibitor in order to model the negative influence of the repressor on the transcription and synthesis of the three enzymes denoted Z . Finally, rule a 6 models the negative influence of lactose on the repressor.
In this example, we are interested in the production of the three enzymes for lactose degradation, denoted Z . In particular, we are interested in knowing whether a 2nd (or higher) ancestor exists, which is the minimal set of genes that has to be active for the production of Z . This would tell us what are the minimal conditions leading to the production of the three enzymes. Since the reaction system A Operon satisfies Theorem 4, we can be sure that the computation of the DNF of the ancestor formula will take polynomial time. For n ≥ 2, we obtain Anc(Z , n) = p ∧ P O L ∧ L ACT , which tells us that L ACT is necessary in order to produce Z .

Approximations of the nth ancestor formula
In the previous section, we have established some syntactic restrictions that guarantee us that the formula result of our Anc operator is already in DNF. This allowed us to address, for those cases, nth ancestor problems in polynomial time. However, the syntactic restrictions of Theorem 4 are quite strong, and therefore, they allow to address only a small set of reaction systems. An alternative way to keep the complexity low is to consider approximations of the nth ancestor formula. In particular, given a Boolean formula f which is the nth ancestor formula of an object s, we want to effec-tively compute two DNF formulas f ⊗ and f ⊕ such that the following logical implications are satisfied It is worth noting that the properties in (1) guarantee that any initial set D 0 satisfying a f ⊗ formula is an nth ancestor of s. Therefore, if a formula f ⊗ is satisfiable 5 , then there exists at least an nth ancestor of s. Moreover, scanning a f ⊗ formula and selecting the conjunction with the minimal number of positive literals gives an upper bound to the minimal size of an nth ancestor of s. On the other hand, if the formula f ⊕ ≡ false, then we can be sure that there are no nth ancestors of s. Moreover, if an initial D 0 does not satisfy the formula f ⊕ , then we can be sure that D 0 cannot be an nth ancestor of s.
Both kinds of formulas can be computed by effective operators in polynomial time. Such operators can be obtained as different approximations (in the sense of abstract interpretation Cousot 1977, 1979) of the original Anc operator. In the next sections, we will show how to compute the formulas f ⊗ and f ⊕ . The idea is then to use both kinds of approximation for reasoning on nth ancestor problems.

The approximation f ⊗
Our aim is to compute DNF formulas implying the nth ancestor formula for an object s using approximations of the Anc(s, n) operator. Since we require that the approximations f ⊗ imply the nth ancestor formula, it follows that each f ⊗ formula we obtain will be satisfiable only by a subset of the nth ancestors of s. Roughly speaking, in order to obtain such formulas, the idea is to rewrite each positive literal using the conjunction of literals from a single reaction that produces s.
By changing the combinations of the chosen conjunctions, we obtain different f ⊗ formulas. Indeed, the idea is to compute f ⊗ formulas defining a new operator that mimics the operator Anc where at each rewriting step, each positive literal is replaced by just one possible conjunction of the DNF cause, while each negative literal is replaced with just one conjunction of the DNF of nocause. It is worth noting that this corresponds to exploring the derivation tree for s in n steps with a depth first search rather than a breath first search.
Formally, since there are many different f ⊗ approximations of the nth ancestor formula, one for each possible conjunction choice, we define the operator computing f ⊗ by means of a relation Anc ⊗ as follows. A = (S, A) be a reaction systems and s ∈ S. We define a relation Anc ⊗ :

Definition 14 Let
where the auxiliary relation Anc ⊗ a : F S ×IN × F S is recursively defined as follows, where ..,r } C i , and ∀i ∈ {1 . . . r }, C i is a conjunction of literals.
All formulas f ⊗ in relation Anc ⊗ with s and n approximate the nth ancestor formula of s in the sense of Eq. (1). It is worth noting that, given an object of interest s, for any n, each f ⊗ formula such that Anc ⊗ (s, n, f ⊗ ) is a DNF formula that implies Anc(s, n).

Theorem 5 Let A = (S, A) be a reaction systems.
Let f ⊗ such that Anc ⊗ (s, n, f ⊗ ) and f = Anc(s, n), for any object s ∈ S. Then Proof Let us prove first that, if a generic formula f is a conjunction of literals, where, we recall, a literal is either an object or a negated object, and Anc ⊗ ( f , n, f ⊗ ) holds, then f ⊗ is a conjunction of literals.
We prove this assert by induction on the pair of the first two arguments of the relation Anc ⊗ a . The induction is based on the following well-founded ordering. We assume that a pair ( f , n) is less than a pair ( f , n ), denoted ( f , n) ≺ ( f , n ) iff either n < n or n = n and f is a subformula of f .
The minimal elements of ≺ are the pairs (l, 0) where l is a literal. Thus, because we know that Anc ⊗ a (l, 0, l), when l = s or l = ¬s, the base case is obvious.
For the inductive cases, we have: have the property that f 1 , f 2 , f ⊗ 1 and f ⊗ 2 are conjunctions of literals, then, by the definition of where t ∈ ChooseC(cause(s)), for an object s, we know that t is a conjunction of literals. Suppose f ⊗ is a conjunction of literals, then, by the definition of relation Anc ⊗ a , we have Anc ⊗ a (s, i + 1, f ⊗ ). Because s is a single object, the property is still true.
3. The case in which we have Anc ⊗ a (t, i, f ⊗ ) where t ∈ ChooseC(nocause(s)) is analogous to the previous one.
Note that the property is trivially preserved by the two cases Anc ⊗ a (true, i, true) and Anc ⊗ a ( f alse, i, f alse). Let us remark that, for our assumption, we never apply the case because we start with a formula which is a conjunction of literals and the operator ∨ is never introduced.
Finally, to prove that f ⊗ is in DNF, we notice that Since C i is a conjunction of literals, we can apply the above result to conclude that each f ⊗ i is a conjunction of literals. This allows us to conclude that f ⊗ is in disjunctive normal form.
The proof of f ⊗ → f is trivial. If in a formula f we substitute a disjunction of subformulas with just one subformula in the disjunction, we obtain a stronger formula which implies the original one, and this is what this approximation does by substituting a disjunction of conjunctions of literals in cause(s) or in nocause(s) with just one conjunction of literals.
Example 6 Let us consider the simple reaction system A 2 of Example 3.
One approximation f ⊗ of the 2nd ancestors of F is C ∧ (H ∧ B) and it can be computed as follows.
The approximation of the 2nd ancestor formula that we computed assures us that any set containing {C, H , B} is a 2nd ancestors of F. So, if one is interested in finding a 2nd ancestor, one can obtain one in polynomial time by just rewriting a single branch of the tree.
Of course, also C ∧ (G ∧ B) can be computed for the relation Anc ⊗ (F, 2, f ⊗ ) by choosing the other possible conjunction in the DNF causes(D) formula. This is not the case for the 3rd ancestor formula of F. Indeed, for the f ⊗ approximations of the 3rd ancestor formula for F we can derive the formula A ∧ ¬B ∧ (I ∧ B) as follows The approximation formula is f ⊗ ≡ f alse, it is in DNF and implies Anc(F, 3) = A ∧ ¬B ∧ ((I ∧ B) ∨ (L ∧ B)) ≡ f alse as stated by Theorem 5. Note, however, that in general f ⊗ ≡ f alse does not allow us to conclude that there exist no 3rd ancestors of F.

The approximation f ⊕
In this section, we define the computation of DNF formulas that are implied by the nth ancestor formula of an object s. Once again, the idea is to use approximations of the Anc(s, n) operator. Since we require that the approximations f ⊕ are implied by the nth ancestor formula, it follows that each f ⊕ formula we obtain will be satisfiable only by a superset of the nth ancestors of s. Roughly speaking, in order to obtain such formulas the idea is to rewrite each literal using a disjunction of literals obtained by choosing a single literal in each conjunction. By changing the combinations of the chosen literals, we obtain different f ⊕ formulas. Indeed, the idea is to derive the f ⊕ formulas defining a new operator that mimics the operator Anc where at each rewriting step, each positive literal is replaced by a simple disjunction obtained starting from the DNF cause or nocause.
Formally, since there are many different f ⊕ approximations of the nth ancestor formula, one for each possible choice of one literal in the conjunction, we define the operator computing f ⊕ by means of a relation Anc ⊕ as follows.
Definition 15 Let A = (S, A) be a reaction systems and s ∈ S. We define a relation Anc ⊕ : where the auxiliary relation Anc ⊕ a : F S × IN × F S is recursively defined as follows: where Choose( i∈{1...r } l i ) = {l 1 , l 2 , . . . , l r } and ∀i ∈ {1 . . . r }, either l i = s or l i = ¬s.
All formulas f ⊕ in relation Anc ⊕ with s and n approximate the nth ancestor formula of s in the sense of Eq. (1). It is worth noting that, given an object of interest s, for any n, each f ⊕ formula such that Anc ⊕ (s, n, f ⊕ ) is a DNF formula that is implied by Anc(s, n).
Theorem 6 Let A = (S, A) be a reaction system. Let f ⊕ such that Anc ⊕ (s, n, f ⊕ ) and f = Anc(s, n), for any object s ∈ S, Proof Let us consider the following definition of the relation Anc ⊕ b which differs from Anc ⊕ a only for the case Anc ⊕ a (s, 1, f ⊕ ). Indeed, By using the same well-founded ordering of Theorem 5, we can prove that if f is a disjunction of literals and The proof of f → f ⊕ is trivial. If in a formula f we substitute some conjunction of subformulas with just one of the subformulas in the conjunction, we obtain a weaker formula which is implied by the original one, and this is what this approximation does by substituting each conjunction of literals in cause(s) or in nocause(s) with just one literal of the conjunction.
Example 7 Consider again the simple reaction system A 2 of Example 3. One approximation f ⊕ of the 2nd ancestors of F is (G ∧ B) ∨ (H ∧ B), and it can be computed as follows.
. This approximation of the 2nd ancestor formula that sets not containing B and containing neither G nor H cannot be 2nd ancestors of F. In particular, in this case, it assures us that the presence of B is necessary for a set to be the 2nd ancestors of F. Of course, also C can be computed for the relation Anc ⊕ (F, 2, f ⊕ ) by choosing the other possible literal in the DNF cause(F) formula. In that case, the approximation f ⊕ assures us that the presence of C is necessary for a set to be the 2nd ancestors of F.

A biological application: discovering minimal ancestors for yeast cell cycle Boolean network
The cell cycle process by which a cell grows and divides into two cells is a vital process the regulation of which is conserved among the eukaryotes (Murray and Hunt 1993). The process mainly consists in the four phases depicted in Fig. 4. In phase G1, the cell grows and, under appropriate conditions, commits to division; in phase S, the DNA is synthesized and chromosomes replicated: G2 is the phase where the cell checks the duplicated chromosomes; and finally, in the M (Mitosis) phase the cell is divided into two. After the Mitosis phase, the cell enters the G1 phase again, hence completing a "cycle." There are about 800 genes involved in the cell cycle process of the budding yeast (Spellman et al. 1998). However, the number of key regulators that are responsible for the control and regulation of this complex process is much smaller. Based on extensive literature studies, the authors in Li et al. (2004) constructed a network of key reg- ulators involving 11 genes. The relations between genes are described by the Boolean network (M Cell , E Cell ) depicted in Fig. 5, where the positive influence of a gene on another one is depicted in green, while the negative influence of a gene on another one is depicted in red. The Boolean network was used to study the time evolution of the protein states. Starting from the 2 11 = 2048 possible initial states describing a configuration for gene activation, they discover that all of them flow into one of the seven attractor stationary states. In particular, among the seven fixed points there is one big attractor that attracts 1764 initial states.
The execution of the reaction systems is able to mimic the 12 steps of evolution of activation/inactivation of genes of the Boolean network as it can be observed in nature and it is depicted in Fig. 7, where the activation of a gene is indicated with a dark circle.
At the beginning, the cell stays in a stationary state where only genes Sic1 and Cdh1 are active, while all the other genes are inactive. This is a stationary states and the cell waits for the external stimulus (the grow of the cell, here

Fig. 6 Reactions of A cell
indicated with the activation of gene Cellsi ze) to arrive. When also Cellsi ze becomes active, this triggers the activation sequence of the genes, as shown in Fig. 7. After 12 steps, the cell completes its cycle and divides, going back to the initial stationary state waiting for another external stimulus to arrive and to make it divide again.
Note that in the previous formula positive literals correspond to genes that have to be active, while negative literals correspond to genes that have to be inactive for the stationary state S to be reached after one step. Of course, the last but one state of Fig. 7, which describes the yeast cell cycle that can be observed in nature, satisfies the formula Anc(S, 1). The interesting point is that actually the stationary state S could be reached even if gene Sic1 was not active at the previous step. Indeed, the minimal 1st ancestor of S is {Cdh1, Swi5} which does not contain Sic1. Computing the nth ancestor formula of S, we can discover all the (minimal) configurations of active/inactive genes that lead to the stationary state S. For example, computing the 2nd ancestor formula of S, we can discover that there are 16 alternative states (configurations) that lead to the stationary state S. However, increasing the number of steps increases the nesting level of AND-OR operators in the ancestor formula, and therefore, its conversion in DNF becomes more and more expensive. In these cases, it can be extremely useful to use the approximations introduced in the previous section since they allow the construction of approximation formulas with a lower complexity. Indeed, looking for a pair f ⊗ and f ⊕ such that the relations Anc ⊗ (S, 3, f ⊗ ) and Anc ⊕ (S, 3, f ⊕ ) hold allows us to compute the following approximations The approximation f ⊗ tells us that there is at least a 2nd ancestor of size 2; that is, if we start with both Cdh20 and Cdh1 active we can reach the S state in two steps. Note that this implies that neither the activation of Sic1 nor the one of Swi5 are really necessary for reaching the state S. From f ⊕ , on the contrary, we can conclude that the activation of Cdh20 is necessary for leading to the state S in two steps. A similar reasoning can be repeated for each backward step. Finally, computing a pair f ⊗ and f ⊕ such that the relations Anc ⊗ (S, 13, f ⊗ ) and Anc ⊕ (S, 13, f ⊕ ) hold will give us some information on the initial state that triggers all yeast cell cycle.
From f ⊗ , we can observe that the cell cycle could start even if Cdh1 is not active, while from f ⊕ we can conclude that it is necessary that Mcm1 is not active.

Conclusions
In this paper, we have proposed a theory of ancestors for reactions systems, based on previously proposed notions of preimage/nth ancestors. An nth ancestor of a set of objects s 1 , . . . , s m is a set of objects that leads to the production of s 1 , . . . , s m in n evolution steps of reaction system. A preimage corresponds to a 1st ancestor.
Our theory is based on the new notion of nth ancestor formula, which is a logic formula that characterizes all the possible nth ancestors of a given object (or set of objects). We have defined an operator that computes nth ancestor formulas in polynomial time. This formula can be used to solve n ancestors problems in exponential time. The exponential time is actually due to the transformation of the formula into DNF. In order to tackle this problem, we proposed: (i) a syntactic restriction on the reaction system that ensures that the operator gives directly a formula in DNF and (ii) approximated notions of nth ancestor formulas that are directly computed in DNF and that provide a under-and a over-approximation of the set of all the nth ancestor of a given set of objects.
We have validated our approach by showing some real biological examples of gene regulatory networks where ancestors can provide useful information about the dynamics of the networks, even when the syntactic restrictions and the approximations we proposed are used.
As future work, we plan to apply our theory to investigate dynamical properties of more complex case studies of gene regulatory networks.