In the Matrix approach to graph transformation we represent simple digraphs and rules with Boolean matrices and vectors, and the rewriting is expressed using Boolean operators only. In previous works, we developed analysis techniques enabling the study of the applicability of rule sequences, their independence, state reachability and the minimal graph able to fire a sequence.In the present paper we improve our framework in two ways. First, we make explicit (in the form of a Boolean matrix) some negative implicit information in rules. This matrix (called nihilation matrix) contains the elements that, if present, forbid the application of the rule (i.e. potential dangling edges, or newly added edges, which cannot be already present in the simple digraph). Second, we introduce a novel notion of application condition, which combines graph diagrams together with monadic second order logic. This allows for more flexibility and expressivity than previous approaches, as well as more concise conditions in certain cases. We demonstrate that these application conditions can be embedded into rules (i.e. in the left hand side and the nihilation matrix), and show that the applicability of a rule with arbitrary application conditions is equivalent to the applicability of a sequence of plain rules without application conditions. Therefore, the analysis of the former is equivalent to the analysis of the latter, showing that in our framework no additional results are needed for the study of application conditions. Moreover, all analysis techniques of [21,22] for the study of sequences can be applied to application conditions.Typing. A type is assigned to each node in G ÔM, V Õ by a function from the set of nodes V to a set of types T , type : V T . In Fig. 1 types are represented as an extra column in the matrices, the numbers before the colon distinguish elements of the same type. For edges we use the types of their source and target nodes.
Definition 2.3. (Typed Simple Digraph)A typed simple digraph G T ÔG M , typeÕ over a set of types T , is made of a simple digraph G M ÔM, V Õ, and a function from the set of nodes V to the set of types T , type : V T .Next, we define the notion of partial morphism between typed simple digraphs.
Definition 2.4. (Typed Simple Digraph Morphism)where DomÔf Õ is the domain of the partial function f .
Productions.A production, or rule, p : L R is a morphism of typed simple digraphs. Using a static formulation, a rule is represented by two typed simple digraphs that encode the left and right hand sides (LHS and RHS). The matrices and vectors of these graphs are arranged so that the elements identified by morphism p match (this is called completion, see below).
Definition 2.5. (Static Formulation of Production)A production p : L R is statically represented as p ÔL ÔL E , L V , type L Õ; R ÔR E , R V , type R ÕÕ, where E stands for edges and V for vertices.A production adds and deletes nodes and edges, therefore using a dynamic formulation, we can encode the rule's pre-condition (its LHS) together with...