Refactoring Object-Oriented Systems

Size: px
Start display at page:

Download "Refactoring Object-Oriented Systems"

Transcription

1 Refactoring Object-Oriented Systems Christoph Schulz, Michael Löwe, and Harald König Abstract. Refactoring of information systems is hard, for two reasons. On the one hand, large databases exist which have to be adjusted. On the other hand, many programs access that data. These programs all have to be migrated in a consistent manner such that their semantics does not change. It cannot be relied upon, however, that no running processes exist during such a migration. Consequently, a refactoring of an information system needs to take care of the migration of data, programs, and processes. This paper introduces a model for complete object-oriented systems, describing the schema level with classes, associations, operations, and inheritance as well as the instance level with objects, links, methods, and messages. Methods are expressed by special double-pushout graph transformations. Homomorphisms are used for the typing of the instance level as well as for the description of refactorings which specify the addition, folding, and unfolding of schema elements. Finally, a categorial framework is presented which allows to derive instance migrations from schema transformations in such a way that programs and processes to the old schema are correctly migrated into programs and processes to the new schema. 1 Introduction During the engineering and use of information systems, data and software undergo many modifications. These modifications can be divided into two categories. The first category contains all modifications that have a direct and externally visible impact on the functionality of the software or on the information content of the database. The second category consists of modifications which only prepare modifications of the first category and which, by themselves, do not lead to changes in the behaviour of the software or in the meaning of the data under transformation. Modifications of the second category are called refactorings [1]. They provide a major method to quickly adapt software to constantly changing requirements. Refactorings are expected to be applied multiple times in different but similar situations. This is comparable to design patterns in software engineering which have emerged in the last twenty years [2, 3]. Consequently, a suitably general specification of a refactoring is necessary. This, however, requires a certain level of abstraction for the software and the data to be transformed. Such an abstraction is often called schema or model and describes important structural aspects of the data and software, which are instances of, or typed in, this schema. Today, the object-oriented view of life dominates the field of software engineering. Therefore, models are typically object-oriented and try to capture the structure by grouping similar objects into classes and describing relations between them by various types of associations. F. Drewes, A. Habel, B. Hoffmann, D. Plump (Eds.): Manipulation of Graphs, Algebras and Pictures. Essays Dedicated to Hans-Jörg Kreowski on the Occasion of His 60th Birthday, pp , 2009.

2 322 Christoph Schulz, Michael Löwe, Harald König Two typical object-oriented refactorings are Introduce a new superclass (Fig. 1) and Move the origin of an association from a subclass to a superclass, as shown in Fig. 2. A combined application of these two refactorings on the schema in Fig. 3a could be used to prepare the model for an extension by an additional subclass of Customer, e. g. CorporateCustomer (Fig. 3b and 3c). 1 Super Sub Sub (a) before (b) after Fig. 1: Refactoring Introduce a new superclass Super Target Super association Target Sub association Sub (a) before (b) after Fig. 2: Refactoring Move the origin of an association from a subclass to a superclass It is important to consider the consequences of a refactoring. Obviously, the more general the structures are which are about to be transformed, the more instances are likely to be affected. Changing a data schema may not only require the data typed in this schema to be adjusted, but may also affect the software which uses the schema structures to access and manipulate the data. Changing a software model may have no consequences on the data but will probably influence programs (which can be considered implementations of the software model) and processes (which are programs under execution). We call the instance changes that follow from a model refactoring the migration induced by that refactoring. For the time being, little has been written about how refactoring data models results in migrations of dependent programs, and even less has been written 1 All class diagrams are specified in the UML [4].

3 Refactoring Object-Oriented Systems 323 Customer PrivateCustomer name String PrivateCustomer name String (a) before refactoring (b) after refactoring Customer CorporateCustomer PrivateCustomer name String (c) final aim Fig. 3: Refactoring an exemplary object-oriented model about refactoring and induced migration of whole systems, which we define to consist of data, programs, and processes, all typed in the same schema. 2 This paper contributes to this topic by providing a graph-like mathematical model which allows to specify object-oriented systems as well as schema refactorings. To describe data together with their schema, graph structures conforming to the model are used. Nodes of such graph structures represent classes (schema) or objects (instance), edges represent associations (schema) or links (instance). Homomorphisms between such graph structures express typings, (parts of) refactorings, and migrations. These graph structures can be used to describe software models and processes, as well: An operation is simply a special node within the graph structure representing the schema, and edges originating from an operation constitute parameters. Analogously, at the instance level, messages and arguments are special nodes and edges, which are typed in operations and parameters at the schema level by an appropriate homomorphism. In the mathematical description of the model, the data and software constructs are separated through the use of special predicates. Programs are somewhat different, as they do not specify a single state but rather a state transition which is performed when the program is executed. In this paper, programs are considered to consist of a (possibly large) set of methods, where each method describes a single state transition. Each such transition speficies how a message of a certain type is processed when all necessary preconditions are met; examples are assignments, method calls, or evaluation of expressions. As program states are described by (parts of) graph structures at the instance level, it follows that state transitions can be adequately specified by 2 See [5] and especially the bibliography contained therein for a general overview on software refactoring.

4 324 Christoph Schulz, Michael Löwe, Harald König the use of graph structure transformations. This paper chooses the DPO approach for describing and applying graph structure transformations 3. Consequently, a method is represented by a span of homomorphisms, and applying a method to a given program state is computed by two pushout diagrams. Results of category theory are used to compute induced migrations from schema refactorings. It will be shown, however, that certain restrictions must be obeyed in order to guarantee reasonable results. Fortunately, these restrictions are met by the practical examples. The paper is organized as follows. Section 3 incrementally introduces a graph structure specification MP with positive Horn formulas which constitutes the foundation of the mathematical description of data and software. The category Alg(MP) of all MP-systems and MP-homomorphisms, as well as the (sub-)categories Alg(MP) S and Sys(S) with a fixed schema S, represent the universe of discourse for the following sections. Section 4 explains how methods are represented as DPO rules and introduces requirements that are necessary to use DPO graph structure transformations successfully in the categories mentioned above. Section 5 addresses the migration of data and processes. Section 6 discusses the migration of programs and contains the main result of this paper, namely that the migration of methods preserves their semantics for new processes as well as for old processes reviewed under the transformed schema. Section 7 outlines three main directions for future research. Due to lack of space, this paper does not contain any proofs. All the proofs can be found in [7]. 2 Related Work There exist approaches for modelling programs as algebraic graph transformation rules [8 10]. However, they fail in various ways to be suitable for our purposes. The approach in [8] does not support inheritance. Furthermore, program execution is destructive, i. e., repetitive control flow constructs as loops cannot be modelled directly but have to be simulated through recursion, a work-around which is not necessary in our approach as the control flow structures are not modified by program execution. The approach presented in [9, 10] does not have a notion of a schema in which programs and processes are typed. This missing link makes it hard if not impossible to compute induced migrations for programs and processes when the data schema is changed. Finally, both approaches consider objects to be opaque, whereas in our approach, each object is decomposed into parts called particles which reflect the class hierarchy. This rich object structure makes it possible to type the instance level in a schema without resorting to special typing morphisms or type graph flattening as proposed in [6, 11, 12]. Finally, our approach is unique in the respect that it combines a program and process model with a model for schema transformations and induced migrations. 3 DPO stands for Double Pushout ; the approach is presented in e. g. [6].

5 Refactoring Object-Oriented Systems Models and Instances The schema and the instance level of object-oriented systems are modelled by systems wrt. an extended specification. 4 An extended specification Spec = (Σ, H (X )) is an extended signature together with a set of positive Horn formulas H (X ) over a set of variables X. An extended signature Σ = (S, OP, P) consists of a set of sorts S, a family of operation symbols OP = (OP w,s ) w S,s S, and a family of predicates P = (P w ) w S such that = s P s s for each sort s S. A system A wrt. an extended signature Σ = (S, OP, P), short Σ-system, consists of a family of carrier sets (A s ) s S, a family of operations (op A : A w A s ) w S,s S,op OP w,s, and a family of relations (p A A w ) w S,p P w such that = A s A s A s is the diagonal relation for each sort s. 5 A system A wrt. an extended specification Spec = (Σ, H (X )) is a Σ-system such that all axioms are valid in A. A Σ-homomorphism h : A B between two Σ-systems A und B wrt. an extended signature Σ = (S, OP, P) is a family of mappings (h s : A s B s ) s S, such that the mappings are compatible with the operations and relations, i. e., h s op A = op B h w for all operation symbols op : w s and h w (p A ) p B for all predicates p : w where w = s 1 s 2... s n S. 6 Each Σ-homomorphism h : A B between two Spec-systems A und B wrt. an extended specification Spec = (Σ, H (X )) is called a Spec-homomorphism. The (first) model version for classes and associations is just graphs as depicted in Fig. 4. Nodes correspond to classes and edges correspond to associations. In Fig. 5a, an exemplary UML schema is presented. The underlying graph for this schema is shown in Fig. 5b. Figure 5c illustrates the resulting Graph system. Graph = sorts N E opns s : E N t : E N (nodes) (edges) (source node of an edge) (target node of an edge) Fig. 4: The Graph signature An instance of a given schema S is represented as a system I wrt. the same signature, together with a typing homomorphism type : I S. At the instance level, nodes represent objects and edges constitute links. The next model version provides the possibility to model inheritance relations between classes by an additional binary predicate under: If, in a system S, a 4 See [13] for the special case when signatures consist of only one sort. 5 Given w = s 1s 2... s n, A w is an abbreviation for the product set A s1 A s2 A sn. 6 Given w = s 1s 2... s n, h w (x 1, x 2,..., x n) is an short-hand notation for the term tuple (h s1 (x 1), h s2 (x 2),..., h sn (x n)).

6 326 Christoph Schulz, Michael Löwe, Harald König husband Man wife Woman wedding date Date wedding date (a) UML schema n 1 e 1 e 2 n 2 (b) graph e 3 e 4 n 3 Representing e 1 t s n 1 e 2 s s e 3 t n 2 s e 4 t t n 3 (c) Representing algebra Fig. 5: A system for the Graph signature class A is under a class B, i. e., if it is a subclass of B, then the relation under S contains the pair (A, B). The specification MP 1 is shown in Fig As inheritance is hierarchical and, therefore, a partial order, it is reasonable to formulate corresponding requirements for the under relation. MP 1 = Graph + prds under : N N axms inheritance x N : under(x, x) (subnode of) (reflexivity) x, y N : under(x, y) under(y, x) x = y (antisymmetry) x, y, z N : under(x, y) under(y, z) under(x, z) (transitivity) Fig. 6: The MP 1 specification including the predicate under While the use of the predicate under is quite natural at the schema level, the question arises how it is to be interpreted at the instance level. Typically, objects are seen as monolithic entities even if they are mapped to multiple types in the class hierarchy. In this paper, we follow a different approach and consider objects to consist of a set of interconnected parts called particles. Each particle is represented by a node and is typed in a specific class in the schema. The advantage of this approach is that the structure of an object is made visible and 7 The MP stands for Model Part and describes the fact that systems for this model represent only a part (schema or instance) of the whole object-oriented system.

7 Refactoring Object-Oriented Systems 327 resembles the object s type hierarchy at the schema level allowing proper typing of links. 8 Figure 7 shows an exemplary instance level for the schema in Fig. 3b. 9 c:customer c:privatecustomer :name n:string Fig. 7: Objects represented by particles The model currently allows an object to contain more than one particle for the same type. This is typically forbidden by object-oriented languages. 10 In order to implement this requirement, we want to specify something like that: (1) x, y N : rel(x, y) type(x) = type(y) x = y (unique particles) Here, another predicate rel has been used which shall be fulfilled when two particles belong to the same object and, therefore, are rel ated. Obviously, this predicate describes an equivalence relation as it is reflexive, symmetric, and transitive. Furthermore, the equivalence comprises the under relation, because each two particles connected by the under relation belong to the same object and, consequently, are part of the rel relation. 11 The resulting specification MP 2 is shown in Fig Another issue currently not resolved is association multiplicity: In our model, all associations are many-to-many, because the number of links at the instance level is not restricted in any way. However, many-to-one associations are often necessary in object-oriented schemas to allow at most one linked target object for any given association and source object. To achieve this, a formula like the following one is necessary which disallows the existence of two links which are instances of the same association and start at the same particle: 13 8 For the purpose of typing, simple homomorphisms are sufficient; there is no need to introduce homomorphisms up to inheritance. 9 We do not use a different notation for schema inheritance and the relationship between particles because it can be easily deduced from the context which relation is meant. 10 An exception to this rule is the programming language C++ which explicitly allows this behaviour [14]. 11 Note, however, that the rel relation might not be generated by the under relation. That means that there may exist related particles that do not belong to the same object. However, this is avoided in all practical examples. 12 Note that reflexivity of the rel relation need not be specified by an axiom as it is a consequence from the combination of the first inheritance axiom and the last component axiom. 13 Note that this axiom disallows multi-valued associations completely. This is desired, however, as only single-valued associations can be dereferenced at the instance level

8 328 Christoph Schulz, Michael Löwe, Harald König MP 2 = MP 1 + prds rel : N N axms components (related to) x, y N : rel(x, y) rel(y, x) (symmetry) x, y, z N : rel(x, y) rel(y, z) rel(x, z) (transitivity) x, y N : under(x, y) rel(x, y) (components) Fig. 8: The MP 2 specification including the predicate rel (2) x, y E : source(x) = source(y) type(x) = type(y) x = y (at most one) The axioms (1) and (2) are called typing axioms. The last issue is the integration of software constructs, namely operations, parameters, messages, arguments, and methods. In order to model operations and messages, the specification MP 2 is extended by a unary predicate called software which distinguishes between class nodes and operation nodes in schemas and between object nodes and message nodes in instances. The distinction between association edges and parameter edges on the one hand and between link edges and argument edges on the other hand is deduced from the context: If an edge starts at a class/object it is considered an association/link, otherwise it constitutes a parameter/argument. The resulting specification is shown in Fig An example of an operation is displayed in Fig. 10a, a message for this operation is shown in Fig. 10b. The modelling of methods builds upon the mapping of messages and arguments into the model and is described in the next section. We use the following notation: Alg(MP) denotes the category of all MPsystems and MP-homomorphisms. The arrow category Alg(MP) 2 consists of all typed instances which do not necessarily fulfil the typing axioms. The full subcategory Sys Alg(MP) 2 restricts the arrow category to those typed instances conforming to these axioms. Given a fixed schema system S, the slice category Alg(MP) S expresses the category of all typed instances for the system S, and the category Sys(S) denotes the full subcategory of Alg(MP) S whose objects fulfil the typing axioms. 15 in a well-defined way. Multi-valued associations need further information (e. g. an index) when accessing links, which does not fit well in our graph structure model. 14 The model allows parameters to point to operations; this is reasonable as it enables to model basic statements like if-then-else as operations. 15 Obviously, Sys(S) is also a subcategory of Sys.

9 Refactoring Object-Oriented Systems 329 MP = sorts N E opns s : E N t : E N prds under : N N rel : N N software : N axms inheritance (nodes) (edges) (source node of an edge) (target node of an edge) (subnode of) (related to) (software part vs. data part) (3) x N : under(x, x) (reflexivity) (4) (5) x, y N : under(x, y) under(y, x) x = y (antisymmetry) x, y, z N : under(x, y) under(y, z) under(x, z) (transitivity) components (6) (7) (8) x, y N : rel(x, y) rel(y, x) (symmetry) x, y, z N : rel(x, y) rel(y, z) rel(x, z) (transitivity) x, y N : under(x, y) rel(x, y) (components) Fig. 9: The complete MP specification getname 1:getName this Customer name result String :this c:customer :name :result n:string (a) Operation with parameters (b) Message with arguments Fig. 10: Software constructs

10 330 Christoph Schulz, Michael Löwe, Harald König Furthermore, there exists a functor F : Alg(MP) 2 Sys which transforms any typed instance by factoring through the congruence generated by the axioms such that the resulting typed instance fulfils the typing axioms. This functor is an epireflector because of the freeness property of the factorisation. This functor never changes the schema: Lemma 3.1 ([7, Lemma 13.13]). Let D ::= I type I S be a typed instance, and let F Ob (D) be the typed instance I type I S. Then S = S holds. From this lemma, it follows that the functor F can be restricted to a slice category for some fixed schema S, resulting in a family of epireflectors F S : Alg(MP) S Sys(S) for each possible schema S. Summarising our results so far, an object-oriented schema is modelled as an MP-system S. An instance of this schema consists of an MP-system I and a typing MP-homomorphism type : I S such that I type S is an object of the category Sys(S). Every schema instance type : I S in Alg(MP) S can be uniquely transformed into an object of the category Sys(S) by the epireflector F S. 4 Methods A method is part of a program and specifies how the program reacts on a message for a certain operation. It constitutes an implementation of an operation. Here, the set of operations consists not only of user-defined operations but also of operations for evaluating expressions and for representing statements. 16 In other words, for each construct which influences the behaviour of a process, there exists a corresponding operation. A program is then a collection of methods such that all operations for which messages exist are implemented. Each method is implemented by a single DPO rule [6] which is properly typed in the schema S. A typed DPO rule is a span L l K r R together with the typings L typel S, K typek S, and R typer S, where L, K, R, and S are Graph systems and l and r are Graph homomorphisms such that type L l = type K = type R r. The left part of the rule describes the required process state necessary for executing this method and contains at least a message typed in the operation this method implements. The remainder of the rule consists of the gluing part and the right part and specifies how this state is changed by method execution. Generally, the gluing part is the common subgraph of both the left and the right part of the rule. 17 In order to be able to determine which message is ready to be processed, a special marker object called processor is used. A message referenced by a processor through a special current link is called active. Methods are formulated 16 For example, the addition of two integer values or the if-then-else statement are both represented by suitable operations. 17 This means that both morphisms of the DPO rule are injective.

11 Refactoring Object-Oriented Systems 331 such that their left part requires an active message. Additionally, each method moves the processor object to the next message according to the flow of control. This next message is determined by a special argument called next. 18 Multiple processor objects can be used to model multi-threaded processing. Figure 11 displays the DPO rule for a method changing the target of a link. 19 Processor current next OpBase Customer this setbirthday date Date birthday (a) Schema 2:... p:proc. 2:... p:proc. 2:... :current p:proc. :next :current :date 1:setB. d2:date :next 1:setB. :date d2:date :next 1:setB. :date d2:date :this c:cust. :birthday d1:date :this c:cust. d1:date :this c:cust. :birthday d1:date (b) Left part (c) Gluing part (d) Right part Fig. 11: Example method Change target of birthday link A method is executed by applying the underlying DPO rule along a match to the graph structure describing the instance world, i. e., objects, links, messages, and arguments. According to the DPO model, in the first step a pushout complement has to be computed to complete the left side. In the second step, the right side is built by a pushout. However we cannot do this in our category Sys(S) as neither do pushout complements exist nor are pushouts along monomorphisms van-kampen squares [6] in all cases. Therefore, we perform DPO transformations which are typed in a schema S in the slice category Alg(MP*) S, where MP* is the signature obtained by removing all axioms from MP, and provide sufficient conditions that guarantee the fulfilment of the axioms after transformation. These conditions are necessary as not all DPO transformations yield typed instances 18 Only very few messages do not have a next argument. This includes the end message which terminates process execution and the if-then-else message which contains a then and a else argument instead. 19 The example shows that operations and messages can also be specialised and possess a particle structure (the particle structure of the messages is not displayed for clarity). This is used to allow processor objects to point to any message.

12 332 Christoph Schulz, Michael Löwe, Harald König which fulfil all the axioms. The following figures demonstrate two such counter examples: adding a link violates axiom (2) (Fig. 12), and eliminating inheritance violates axiom (5) (Fig. 13). In the figures, the element-wise mapping of the homomorphisms is indicated by equally named nodes and edges, and frames are used to group the elements belonging to a single graph. A x B (a) Schema l r 2:B 2:B 3:x 2:B (b) Rule 2:B l r 2:B 3:x 2:B m k n 3:x 2:B 2:B 2:B f g 5:x 5:x 5:x 4:B 4:B 4:B (c) Induced transformation Fig. 12: Adding a link violates axiom (2) on page 328 In order to rule out situations as depicted in Fig. 12 we need DPO rules that pull back edges. Such rules only add an edge at the right side if no other edge exists which starts at the same node. Definition 4.1 (DPO rules pulling back edges). Let Σ = (S, OP, P) be an extended signature, and let L l K r R be a DPO rule. Then the DPO rule pulls back edges if for each edge e R R E there is a node k K N and an edge e L L E, such that the equations hold. source L (e L ) = l N (k) source R (e R ) = r N (k) type L,E (e L ) = type R,E (e R ) In order to rule out situations as depicted in Fig. 13, we restrict DPO rules to completing homomorphisms which pull back relations. Completing

13 Refactoring Object-Oriented Systems 333 A B C (a) Schema 3:C l r 3:C 3:C (b) Rule 3:C l r 3:C 3:C m k n 3:C 3:C 3:C f g 2:B 2:B 2:B (c) Induced transformation Fig. 13: Eliminating inheritance violates axiom (5) on page 329 homomorphisms are an extension to strictly full homomorphisms: 20 While a strictly full homomorphism h only pulls back a relation if all related elements are known to be in the range of h, a completing homomorphism h pulls back relations even if only a part of the related elements is known to be reached. Definition 4.2 (Completing homomorphism). Let Σ = (S, OP, P) be an extended signature, let h : A B be a Σ-homomorphism between the Σ-systems A and B, and let p P w be a predicate over a sort word w S. Then h is completing on p if for every non-empty sort word w resulting from eliminating arbitrary sorts from w and for each two tuples x B w and x A w the implication h w (x ) = x w x p B y A w : y w = x h w (y) = x y p A holds, where the notation x w stands for the projection of the tuple x onto the elements of the sorts in w. h is completing if h is completing on all predicates. Now we are able to define valid DPO rules: Definition 4.3 (Valid rule). A DPO rule L l K r R is valid iff it pulls back edges and l and r are completing homomorphisms. These restrictions do not have much impact on the expressiveness of methods. The first restriction requiring completing homomorphisms disallows changing the inner structure of objects by adding or removing particles. However, this is an unusual way of dealing with objects at runtime at best. The second restriction 20 A homomorphism h : A B is strictly full if h w (x) p B x p A for all x A w and all predicates p P w.

14 334 Christoph Schulz, Michael Löwe, Harald König allows to add a link on the right side of a rule only if a similar link has previously been removed on the left side of the same rule. This is unproblematic if it can be ensured that there always exists a link for each (object, association) pair, which, for example, can initially point to a null object to indicate an uninitialised link. 21 Now we can state the main theorem of this section: Theorem 4.4 (Transformation preserves axioms [7, Theorem 14.29]). Let S be an MP-system. Let L l K r R be a valid rule in Sys(S), G a Sys(S)- object, and m : L G a match in Sys(S), such that the rule is applicable according to the DPO model. Let G f D g H be the resulting transformation after applying the rule in Alg(MP*) S. Then D and H fulfil all axioms and are, therefore, Sys(S)-objects. 5 Model Transformation and Data Migration So far we can describe object-oriented systems, consisting of typed data, programs, and processes. In this section we introduce schema transformations that can be uniquely extended to migrations of corresponding data and proceseses (the migration of programs is handled in the next section). 22 Definition 5.1 (Transformation, Refactoring). A transformation t : S S S in the category Alg(MP) is a span S l t S r t S. Such a transformation is called a refactoring iff l t is surjective. A general transformation allows reduction and unfolding as well as extension and folding through the use of non-surjective homomorphisms (reduction and extension) and non-injective homomorphisms (unfolding and folding) on the left and right side of the span, respectively. Refactorings are special transformations which are constrained to surjective homomorphisms on the left side of the span. This constraint comes from the fact that refactorings are not allowed to delete schema objects because such a deletion almost always causes information (data, programs and/or processes) at the instance level to be lost, which does not meet the intuitive requirement that a refactoring preserve information. In the following we use the term schema transformation if the span consists of schema objects, and migration if the span consists of typed instances. Given a typed instance I typei S and a schema transformation t : S S S, the migration is performed as follows: (1) P l t, the pullback functor along l t, is applied to I typei S, resulting in the typed instance I type I S. This part of the transformation is responsible 21 [7] shows in full detail how this can be done. 22 See [15 17] for precursor material on data migration induced by schema transformations.

15 Refactoring Object-Oriented Systems 335 for unfolding instance elements if l t is not injective, and for deleting elements if l t is not surjective. (2) F r t, the composition functor along r t, is applied to I type I S, resulting in the typed instance I r t type I S. This part of the transformation is used to retype instance elements and to add new types without any instances. (3) I r t type I S may violate the typing axioms. Therefore, the epireflector F S into the subcategory Sys(S ) is applied to it, resulting in the typed instance I type I S (the schema is left unchanged due to Lemma 3.1). This part of the transformation is responsible for identifying instance elements due to retyping. These three steps are visualised in Fig. 14. l S t S r t S r t type I type I P.B. type I I I I I id I [ ] l t type I Fig. 14: Schema transformation and instance migration The composition of the three functors results in the migration functor defined below: Definition 5.2 (Migration functor). Let t : S S S be a transformation. The migration functor M t : Sys(S) Sys(S ) is then defined as: M t ::= F S F r t P l t, where the functor P l t : Alg(MP) S Alg(MP) S is the pullback functor along l t, the functor F r t : Alg(MP) S Alg(MP) S is the composition functor along r t, and the functor F S : Alg(MP) S Sys(S ) is the epireflector into the subcategory Sys(S ). Note that due to Lemma 3.1, the migration functor results in an instance that is correctly typed in the target schema S. The example in Fig. 15 shows a transformation which moves the origin of an association one level upwards the inheritance hierarchy and the induced migration of an exemplary instance. On the left side the class B is unfolded, yielding the two classes B and X in the middle, and the origin of the association is moved to the temporary class X. On the right side the class X is folded with the class A, such that the association starts at the class A after the transformation. The modification of objects and links by the induced migration is performed analogously. Note that the unfolding on the left is due to the pullback construction, and the folding on the right side is due to the epireflector which takes care that axiom (1) is satisfied.

16 336 Christoph Schulz, Michael Löwe, Harald König A A A C X C C B B B (a) Schema transformation 2:C 1:X 2:C 2:C 1:B 1:B 1:B (b) Induced migration Fig. 15: Moving the origin of an association upwards the inheritance hierachy 6 Method Migration The migration of methods is performed in the same way as the migration of data and processes. But as methods are valid DPO rules according to Def. 4.3, it has to be ensured that their properties are preserved by a migration. Additionally, methods already executed which are represented by two pushout diagrams shall be transformed so that the resulting diagrams are again pushouts. This ensures that processes that have already been executed are compatible to the new schema after migration. However, this does not hold for arbitrary transformations. In Fig. 16, two classes B and C of a schema S are merged, resulting in the class BC in the schema S. At the instance level, the right pushout of a method adding a link is presented. The migrated diagram is a pushout in the subcategory Sys(S ) of all typed instances conforming to the typing axioms, but not a pushout in the category Alg(MP*) S in which the migration is computed. This can be deduced from the elemental properties of pushouts (see e. g. [6]). In order to migrate DPO rules and DPO diagrams properly we need to restrict the allowed transformations. We can show that if transformations are disallowed to fold associations on the right side, DPO rules can be migrated correctly in all cases. This results in the following definition of a proper transformation:

17 Refactoring Object-Oriented Systems 337 :A k A B (a) Schema S C r :A :B g :B :A :C :A :C (c) Right side of an applied DPO rule before the migration n A BC :A k (b) Schema S r :A :BC g :A :BC :A :BC (d) Right side of an applied DPO rule after the migration n Fig. 16: Pushout in Alg(MP*) S is not preserved by a migration Definition 6.1 (Proper transformation). A transformation S l t S r t S in Alg(MP) is proper if r t is injective on associations, i. e., if re t (x) = r E t (y) x = y holds for all x, y SE. The correct migration of valid DPO rules is guaranteed by the following proposition: Proposition 6.2 (Migration preserves valid DPO rules [7, Proposition 15.23]). Given a proper transformation t : S S S, let be a valid DPO rule. Then (I 1 type I 1 S) l (I 2 type I 2 S) r (I 3 type I 3 S) M t (I 1 type I 1 S) Mt (l) M t (I 2 type I 2 S) Mt (r) M t (I 3 type I 3 S) is a valid DPO rule as well. The migration of DPO diagrams is ensured by the following proposition: Proposition 6.3 (Migration preserves pushouts [7, Proposition 15.35]). Let t : S S S = S l t S r t S be a proper transformation and (L typel S) l (K typek S) r (R typer S) be a valid DPO rule. Let be a pushout of (D typed S) g (H typeh S) n (R typer S) (D typed S) k (K typek S) r (R typer S)

18 338 Christoph Schulz, Michael Löwe, Harald König in Alg(MP ) S, where all typed instances are in Sys(S). Then is a pushout of M t (D typed S) Mt (g) M t (H typeh S) Mt (n) M t (R typer S) M t (D typed S) Mt (k) M t (K typek S) Mt (r) M t (R typer S) in Alg(MP ) S, where all typed instances are in Sys(S ). Both propositions can be combined, yielding the following theorem: Theorem 6.4 (Correctness of the migration of programs [7, Theorem 15.36]). Let t : S S S be a proper transformation. Then the migration functor M t transfers the validity of non-applied methods (DPO rules) and applied methods (DPO transformations) from the category Alg(MP) S into the category Alg(MP) S. Proof. Direct consequence of Proposition 6.2 and Proposition Outlook With the framework presented above, a major step towards migration of complete object-oriented systems is proposed. Certainly, the framework is not universal as it is subject to some (reasonable) constraints. Migrations are considered to be instances of transformations. The innovative part of the theory described consists of the automatic transformation of a migration source, computing the target with the help of a functor on slice categories. This functor is composed of three factors: Generally, the pullback functor P l t is right-adjoint where the second factor the composition functor F r t is its left-adjoint. But the third factor the construction F S into the subcategory Sys(S) yields an adjunction as well. Thus, the whole migration enjoys well-understood universal properties which can further be pursued into three different directions. The first direction for future research will be the development of tools that support migration induced by refactoring rules. If transformation rules can be captured ergonomically in an appropriate application, migrations can automatically and uniquely (by adjointness) be computed. Thus, content migration of databases is possible as well as migration of running processes in a software system. These tools should discover potential for composition, as well: Bigger refactorings should be decomposable into elementary changes, atomic steps must be proved to combine to more comprehensive procedures. This is another facet for future research. Theorem 6.4 states that dynamical semantics is preserved by refactorings where semantics is based on valid DPO rules. Hence the second direction is to find a comparable correctness criterion for data. This must include a formal specification of information to distinguish between semantics-preserving refactorings and information-distorting transformations.

19 Refactoring Object-Oriented Systems 339 The third direction consists of abstracting away from pure graph structures. It has to be investigated to what extent the results can be generalised to elementary topoi or even to adhesive categories [6, 18]. An approach can be found in [15] which covers data migration only. Hence, an extension to method migration is desirable. References [1] Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison- Wesley (1999) [2] Fowler, M.: Patterns of Enterprise Application Architecture. Addison-Wesley (2002) [3] Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns. Addison- Wesley Professional (1995) [4] Fowler, M., Scott, K.: UML Distilled: A Brief Guide to the Standard Object Modeling Language. Addison-Wesley (2003) [5] Mens, T., Tourwé, T.: A survey of software refactoring. IEEE Transactions On Software Engineering 30(2) (2004) [6] Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamentals of Algebraic Graph Transformation. Springer (2006) [7] Schulz, C.: Refactoring objektorientierter Systeme. Forschungsberichte der FHDW Hannover 2 (2009) [8] Corradini, A., Dotti, F.L., Foss, L., Ribeiro, L.: Translating java code to graph transformation systems. In: ICGT. (2004) [9] Kastenberg, H., Kleppe, A.G., Rensink, A.: Defining object-oriented execution semantics using graph transformations. In Gorrieri, R., Wehrheim, H., eds.: Proceedings of the 8th IFIP International Conference on Formal Methods for Open-Object Based Distributed Systems, Bologna, Italy. Volume 4037 of Lecture Notes in Computer Science., London, Springer Verlag (June 2006) [10] Kastenberg, H., Kleppe, A.G., Rensink, A.: Engineering object-oriented semantics using graph transformations. Technical Report CTIT Technical Report 06-12, University of Twente (2006) [11] Bardohl, R., Ehrig, H., de Lara, J., Runge, O., Taentzer, G., Weinhold, I.: Node type inheritance concept for typed graph transformation. Technical Report Technical Report , Technical University, Berlin (2003) [12] de Lara, J., Bardohl, R., Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Attributed graph transformation with node type inheritance. Theoretical Computer Science 376(3) (2007) [13] Mal cev, A.I.: Algebraic systems. Springer (1973) [14] International Organization for Standardization: ISO/IEC 14882:2003: Programming languages C++, Genf, Schweiz. (2003) [15] König, H., Löwe, M., Schulz, C.: Functor semantics for refactoring-induced data migration. Forschungsberichte der FHDW Hannover 1 (2007) [16] Löwe, M., König, H., Schulz, C., Peters, M.: Refactoring information systems a formal framework. In: Proceedings WMSCI Volume 1. (2006) 75 80

20 340 Christoph Schulz, Michael Löwe, Harald König [17] Löwe, M., König, H., Schulz, C., Peters, M.: Refactoring information systems handling partial composition. In: Electronic Communications of the EASST. Volume 3. (2006) [18] Goldblatt, R.: Topoi: The Categorical Analysis of Logic. Dover Publications (1984) Christoph Schulz Fachhochschule für die Wirtschaft Hannover Freundallee 15 D Hannover (Germany) Prof. Dr. Michael Löwe Fachhochschule für die Wirtschaft Hannover Freundallee 15 D Hannover (Germany) Hans-Jörg Kreowski supervised Michael Löwe s diploma thesis at TU Berlin in 1981, and was the external examiner of his doctoral thesis in Prof. Dr. Harald König Fachhochschule für die Wirtschaft Hannover Freundallee 15 D Hannover (Germany) harald.koenig@fhdw.de

Forschungsberichte der Fakultät IV Elektrotechnik und Informatik

Forschungsberichte der Fakultät IV Elektrotechnik und Informatik Forschungsberichte der Fakultät IV Elektrotechnik und Informatik A Formal Resolution Strategy for Operation-Based Conicts in Model Versioning Using Graph Modications Hartmut Ehrig 1 Claudia Ermel 1 Gabriele

More information

A Formal Resolution Strategy for Operation-Based Conflicts in Model Versioning Using Graph Modifications

A Formal Resolution Strategy for Operation-Based Conflicts in Model Versioning Using Graph Modifications A Formal Resolution Strategy for Operation-Based Conflicts in Model Versioning Using Graph Modifications Hartmut Ehrig 1, Claudia Ermel 1 and Gabriele Taentzer 2 1 Technische Universität Berlin, Germany

More information

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

More information

AGG: A Graph Transformation Environment for Modeling and Validation of Software

AGG: A Graph Transformation Environment for Modeling and Validation of Software AGG: A Graph Transformation Environment for Modeling and Validation of Software Gabriele Taentzer Technische Universität Berlin, Germany gabi@cs.tu-berlin.de Abstract. AGG is a general development environment

More information

Technische Universität München Zentrum Mathematik

Technische Universität München Zentrum Mathematik Technische Universität München Zentrum Mathematik Prof. Dr. Dr. Jürgen Richter-Gebert, Bernhard Werner Projective Geometry SS 208 https://www-m0.ma.tum.de/bin/view/lehre/ss8/pgss8/webhome Solutions for

More information

Handout 9: Imperative Programs and State

Handout 9: Imperative Programs and State 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 9: Imperative Programs and State Imperative

More information

Technische Universität München Zentrum Mathematik

Technische Universität München Zentrum Mathematik Question 1. Incidence matrix with gaps Technische Universität München Zentrum Mathematik Prof. Dr. Dr. Jürgen Richter-Gebert, Bernhard Werner Projective Geometry SS 2016 www-m10.ma.tum.de/projektivegeometriess16

More information

A Semi-group of Hashing Functions & Hash Tables

A Semi-group of Hashing Functions & Hash Tables A Semi-group of Hashing Functions & Hash Tables Arthur Hughes University of Dublin, Trinity College, Dublin, Ireland e-mail: Arthur.P.Hughes@cs.tcd.ie January 19, 1997 Abstract A model of a hash table

More information

Detecting Structural Refactoring Conflicts Using Critical Pair Analysis

Detecting Structural Refactoring Conflicts Using Critical Pair Analysis SETra 2004 Preliminary Version Detecting Structural Refactoring Conflicts Using Critical Pair Analysis Tom Mens 1 Software Engineering Lab Université de Mons-Hainaut B-7000 Mons, Belgium Gabriele Taentzer

More information

Polymorphic Single-Pushout Graph Transformation

Polymorphic Single-Pushout Graph Transformation Polymorphic Single-Pushout Graph Transformation Michael Löwe, Harald König, and Christoph Schulz FHDW Hannover, Freundallee 15, 30173 Hannover Abstract. The paper extends single-pushout graph transformation

More information

Theory of Graph Transformations

Theory of Graph Transformations Theory of Graph Transformations Helge Wiemann University of Bremen studies of computer science hwiemann@tzi.de Abstract This paper shall give an introduction into the theory of rule-based graph transformation

More information

MA651 Topology. Lecture 4. Topological spaces 2

MA651 Topology. Lecture 4. Topological spaces 2 MA651 Topology. Lecture 4. Topological spaces 2 This text is based on the following books: Linear Algebra and Analysis by Marc Zamansky Topology by James Dugundgji Fundamental concepts of topology by Peter

More information

Ensuring Structural Constraints in Graph-Based Models with Type Inheritance

Ensuring Structural Constraints in Graph-Based Models with Type Inheritance Ensuring Structural Constraints in Graph-Based Models with Type Inheritance Gabriele Taentzer 1 and Arend Rensink 2 1 Computer Science Department, Technical University of Berlin, Franklinstr. 28/29, 10587

More information

The Encoding Complexity of Network Coding

The Encoding Complexity of Network Coding The Encoding Complexity of Network Coding Michael Langberg Alexander Sprintson Jehoshua Bruck California Institute of Technology Email: mikel,spalex,bruck @caltech.edu Abstract In the multicast network

More information

A Type Graph Model for Java Programs

A Type Graph Model for Java Programs A Type Graph Model for Java Programs Arend Rensink and Eduardo Zambon Formal Methods and Tools Group, EWI-INF, University of Twente PO Box 217, 7500 AE, Enschede, The Netherlands {rensink,zambon}@cs.utwente.nl

More information

An introduction to Category Theory for Software Engineers*

An introduction to Category Theory for Software Engineers* An introduction to Category Theory for Software Engineers* Dr Steve Easterbrook Associate Professor, Dept of Computer Science, University of Toronto sme@cs.toronto.edu *slides available at http://www.cs.toronto.edu/~sme/presentations/cat101.pdf

More information

Towards Generating Domain-Specific Model Editors with Complex Editing Commands

Towards Generating Domain-Specific Model Editors with Complex Editing Commands Towards Generating Domain-Specific Model Editors with Complex Editing Commands Gabriele Taentzer Technical University of Berlin Germany gabi@cs.tu-berlin.de May 10, 2006 Abstract Domain specific modeling

More information

Behavior Preservation in Model Refactoring using DPO Transformations with Borrowed Contexts

Behavior Preservation in Model Refactoring using DPO Transformations with Borrowed Contexts Behavior Preservation in Model Refactoring using DPO Transformations with Borrowed Contexts Guilherme Rangel 1, Leen Lambers 1, Barbara König 2, Hartmut Ehrig 1, and Paolo Baldan 3 1 Institut für Softwaretechnik

More information

Chapter 7. Modular Refactoring. 7.1 Introduction to Modular Refactoring

Chapter 7. Modular Refactoring. 7.1 Introduction to Modular Refactoring Chapter 7 Modular Refactoring I n this chapter, the role of Unified Modeling Language (UML) diagrams and Object Constraint Language (OCL) expressions in modular refactoring have been explained. It has

More information

Behavior Preservation in Model Refactoring using DPO Transformations with Borrowed Contexts

Behavior Preservation in Model Refactoring using DPO Transformations with Borrowed Contexts Behavior Preservation in Model Refactoring using DPO Transformations with Borrowed Contexts Guilherme Rangel 1, Leen Lambers 1, Barbara König 2, Hartmut Ehrig 1, and Paolo Baldan 3 1 Institut für Softwaretechnik

More information

Arithmetic universes as generalized point-free spaces

Arithmetic universes as generalized point-free spaces Arithmetic universes as generalized point-free spaces Steve Vickers CS Theory Group Birmingham * Grothendieck: "A topos is a generalized topological space" *... it's represented by its category of sheaves

More information

A Visual Editor for Reconfigurable Object Nets based on the ECLIPSE Graphical Editor Framework

A Visual Editor for Reconfigurable Object Nets based on the ECLIPSE Graphical Editor Framework A Visual Editor for Reconfigurable Object Nets based on the ECLIPSE Graphical Editor Framework Enrico Biermann, Claudia Ermel, Frank Hermann and Tony Modica Technische Universität Berlin, Germany {enrico,lieske,frank,modica}@cs.tu-berlin.de

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

Reflection in the Chomsky Hierarchy

Reflection in the Chomsky Hierarchy Reflection in the Chomsky Hierarchy Henk Barendregt Venanzio Capretta Dexter Kozen 1 Introduction We investigate which classes of formal languages in the Chomsky hierarchy are reflexive, that is, contain

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 3 Relational Model Hello everyone, we have been looking into

More information

SUMMARY: MODEL DRIVEN SECURITY

SUMMARY: MODEL DRIVEN SECURITY SUMMARY: MODEL DRIVEN SECURITY JAN-FILIP ZAGALAK, JZAGALAK@STUDENT.ETHZ.CH Model Driven Security: From UML Models to Access Control Infrastructres David Basin, Juergen Doser, ETH Zuerich Torsten lodderstedt,

More information

Object-Oriented Theories for Model Driven Architecture

Object-Oriented Theories for Model Driven Architecture Object-Oriented Theories for Model Driven Architecture Tony Clark 1, Andy Evans 2, Robert France 3 1 King s College London, UK, anclark@dcs.kcl.ac.uk, 2 University of York, UK, andye@cs.york.ac.uk, 3 University

More information

The Journal of Logic and Algebraic Programming

The Journal of Logic and Algebraic Programming The Journal of Logic and Algebraic Programming 81 (2012) 422 457 Contents lists available at SciVerse ScienceDirect The Journal of Logic and Algebraic Programming journal homepage:www.elsevier.com/locate/jlap

More information

Appendix 1. Description Logic Terminology

Appendix 1. Description Logic Terminology Appendix 1 Description Logic Terminology Franz Baader Abstract The purpose of this appendix is to introduce (in a compact manner) the syntax and semantics of the most prominent DLs occurring in this handbook.

More information

Appendix 1. Description Logic Terminology

Appendix 1. Description Logic Terminology Appendix 1 Description Logic Terminology Franz Baader Abstract The purpose of this appendix is to introduce (in a compact manner) the syntax and semantics of the most prominent DLs occurring in this handbook.

More information

A MODEL CATEGORY STRUCTURE ON THE CATEGORY OF SIMPLICIAL CATEGORIES

A MODEL CATEGORY STRUCTURE ON THE CATEGORY OF SIMPLICIAL CATEGORIES A MODEL CATEGORY STRUCTURE ON THE CATEGORY OF SIMPLICIAL CATEGORIES JULIA E. BERGNER Abstract. In this paper we put a cofibrantly generated model category structure on the category of small simplicial

More information

Formal Semantics of Consistent EMF Model Transformations by Algebraic Graph Transformation

Formal Semantics of Consistent EMF Model Transformations by Algebraic Graph Transformation SoSyM manuscript No. (will be inserted by the editor) Formal Semantics of Consistent EMF Model Transformations by Algebraic Graph Transformation Enrico Biermann 1, Claudia Ermel 1, Gabriele Taentzer 2

More information

Joint Entity Resolution

Joint Entity Resolution Joint Entity Resolution Steven Euijong Whang, Hector Garcia-Molina Computer Science Department, Stanford University 353 Serra Mall, Stanford, CA 94305, USA {swhang, hector}@cs.stanford.edu No Institute

More information

Lecture 009 (November 25, 2009) Suppose that I is a small category, and let s(r Mod) I be the category of I-diagrams in simplicial modules.

Lecture 009 (November 25, 2009) Suppose that I is a small category, and let s(r Mod) I be the category of I-diagrams in simplicial modules. Lecture 009 (November 25, 2009) 20 Homotopy colimits Suppose that I is a small category, and let s(r Mod) I be the category of I-diagrams in simplicial modules. The objects of this category are the functors

More information

A Database of Categories

A Database of Categories A Database of Categories Michael Fleming Department of Computer Science University of Waterloo Waterloo, Ont, Canada Ryan Gunther Department of Computer Science University of Waterloo Waterloo, Ont, Canada

More information

Lecture 008 (November 13, 2009)

Lecture 008 (November 13, 2009) Lecture 008 (November 13, 2009) 17 The Dold-Kan correspondence Suppose that A : op R Mod is a simplicial R-module. Examples to keep in mind are the free simplicial objects R(X) associated to simplicial

More information

XI International PhD Workshop OWD 2009, October Fuzzy Sets as Metasets

XI International PhD Workshop OWD 2009, October Fuzzy Sets as Metasets XI International PhD Workshop OWD 2009, 17 20 October 2009 Fuzzy Sets as Metasets Bartłomiej Starosta, Polsko-Japońska WyŜsza Szkoła Technik Komputerowych (24.01.2008, prof. Witold Kosiński, Polsko-Japońska

More information

The Inverse of a Schema Mapping

The Inverse of a Schema Mapping The Inverse of a Schema Mapping Jorge Pérez Department of Computer Science, Universidad de Chile Blanco Encalada 2120, Santiago, Chile jperez@dcc.uchile.cl Abstract The inversion of schema mappings has

More information

Distributed Objects with Sense of Direction

Distributed Objects with Sense of Direction Distributed Objects with Sense of Direction G. V. BOCHMANN University of Ottawa P. FLOCCHINI Université de Montréal D. RAMAZANI Université de Montréal Introduction An object system consists of a collection

More information

Formalizing Software Refactoring in the Distributed Environment by aednlc Graph Grammar

Formalizing Software Refactoring in the Distributed Environment by aednlc Graph Grammar Formalizing Software Refactoring in the Distributed Environment by aednlc Graph Grammar Leszek Kotulski, Adrian Nowak Institute of Computer Science, Jagiellonian University Nawojki 11, 30-072 Kraków, Poland

More information

Lecture 5. Logic I. Statement Logic

Lecture 5. Logic I. Statement Logic Ling 726: Mathematical Linguistics, Logic. Statement Logic V. Borschev and B. Partee, September 27, 2 p. Lecture 5. Logic I. Statement Logic. Statement Logic...... Goals..... Syntax of Statement Logic....2.

More information

Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research Oslo Norway

Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research Oslo Norway Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research 31.05.2017 Oslo Norway Predicate Calculus is a calculus on the truth-values of predicates. This usage

More information

On the Recognizability of Arrow and Graph Languages

On the Recognizability of Arrow and Graph Languages On the Recognizability of Arrow and Graph Languages Christoph Blume Sander Bruggink Barbara König Universität Duisburg-Essen, Germany Background Applications of finite automata and regular (word) languages

More information

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes) ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes) Steve Vickers CS Theory Group Birmingham 1. Sheaves "Sheaf = continuous set-valued map" TACL Tutorial

More information

CSC 501 Semantics of Programming Languages

CSC 501 Semantics of Programming Languages CSC 501 Semantics of Programming Languages Subtitle: An Introduction to Formal Methods. Instructor: Dr. Lutz Hamel Email: hamel@cs.uri.edu Office: Tyler, Rm 251 Books There are no required books in this

More information

Data-Oriented System Development

Data-Oriented System Development Data-Oriented System Development Prof. Martin Wirsing 30.10.2002 Refinement Technics The Refinement-Concept: Refinement through Inclusion of Model Classes 2 Goals Refinement of functional requirements:

More information

A Simplified Abstract Syntax for the Dataflow Algebra. A. J. Cowling

A Simplified Abstract Syntax for the Dataflow Algebra. A. J. Cowling Verification and Testing Research Group, Department of Computer Science, University of Sheffield, Regent Court, 211, Portobello Street, Sheffield, S1 4DP, United Kingdom Email: A.Cowling @ dcs.shef.ac.uk

More information

Checking Conservativity With HETS

Checking Conservativity With HETS Checking Conservativity With HETS Mihai Codescu 1, Till Mossakowski 2,3, and Christian Maeder 2 1 University of Erlangen-Nürnberg, Germany 2 DFKI GmbH Bremen, Germany 3 SFB/TR 8 Spatial Cognition, University

More information

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CHAPTER 8. Copyright Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation

More information

An Annotated Language

An Annotated Language Hoare Logic An Annotated Language State and Semantics Expressions are interpreted as functions from states to the corresponding domain of interpretation Operators have the obvious interpretation Free of

More information

Chapter 3. Describing Syntax and Semantics

Chapter 3. Describing Syntax and Semantics Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

More information

Introduction to Sets and Logic (MATH 1190)

Introduction to Sets and Logic (MATH 1190) Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Dec 4, 2014 Outline 1 2 3 4 Definition A relation R from a set A to a set

More information

Constraints in Feature Algebra

Constraints in Feature Algebra Constraints in Feature Algebra Andreas Zelend Institut für Informatik, Universität Augsburg, Germany zelend@informatik.uni-augsburg.de Abstract. Feature Algebra captures the commonalities of feature oriented

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen Formal semantics of loosely typed languages Joep Verkoelen Vincent Driessen June, 2004 ii Contents 1 Introduction 3 2 Syntax 5 2.1 Formalities.............................. 5 2.2 Example language LooselyWhile.................

More information

INCREMENTAL SOFTWARE CONSTRUCTION WITH REFINEMENT DIAGRAMS

INCREMENTAL SOFTWARE CONSTRUCTION WITH REFINEMENT DIAGRAMS INCREMENTAL SOFTWARE CONSTRUCTION WITH REFINEMENT DIAGRAMS Ralph-Johan Back Abo Akademi University July 6, 2006 Home page: www.abo.fi/~backrj Research / Current research / Incremental Software Construction

More information

Topos Theory. Lectures 3-4: Categorical preliminaries II. Olivia Caramello. Topos Theory. Olivia Caramello. Basic categorical constructions

Topos Theory. Lectures 3-4: Categorical preliminaries II. Olivia Caramello. Topos Theory. Olivia Caramello. Basic categorical constructions Lectures 3-4: Categorical preliminaries II 2 / 17 Functor categories Definition Let C and D be two categories. The functor category [C,D] is the category having as objects the functors C D and as arrows

More information

BINTEST Binary Search-based Test Case Generation

BINTEST Binary Search-based Test Case Generation BINTEST Binary Search-based Test Case Generation Sami Beydeda, Volker Gruhn University of Leipzig Department of Computer Science Chair of Applied Telematics / e-business Klostergasse 3 04109 Leipzig, Germany

More information

Topic 1: What is HoTT and why?

Topic 1: What is HoTT and why? Topic 1: What is HoTT and why? May 5, 2014 Introduction Homotopy type theory (HoTT) is a newly emerging field of mathematics which is currently being developed as a foundation of mathematics which is in

More information

SOFTWARE ENGINEERING DESIGN I

SOFTWARE ENGINEERING DESIGN I 2 SOFTWARE ENGINEERING DESIGN I 3. Schemas and Theories The aim of this course is to learn how to write formal specifications of computer systems, using classical logic. The key descriptional technique

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

1. M,M sequential composition: try tactic M; if it succeeds try tactic M. sequential composition (, )

1. M,M sequential composition: try tactic M; if it succeeds try tactic M. sequential composition (, ) Dipl.-Inf. Achim D. Brucker Dr. Burkhart Wolff Computer-supported Modeling and Reasoning http://www.infsec.ethz.ch/ education/permanent/csmr/ (rev. 16802) Submission date: FOL with Equality: Equational

More information

Chapter 2 Overview of the Design Methodology

Chapter 2 Overview of the Design Methodology Chapter 2 Overview of the Design Methodology This chapter presents an overview of the design methodology which is developed in this thesis, by identifying global abstraction levels at which a distributed

More information

The three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman.

The three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman. The three faces of homotopy type theory Type theory and category theory Michael Shulman 1 A programming language. 2 A foundation for mathematics based on homotopy theory. 3 A calculus for (, 1)-category

More information

On Soft Topological Linear Spaces

On Soft Topological Linear Spaces Republic of Iraq Ministry of Higher Education and Scientific Research University of AL-Qadisiyah College of Computer Science and Formation Technology Department of Mathematics On Soft Topological Linear

More information

Analysis and Abstraction of Graph Transformation Systems via Type Graphs

Analysis and Abstraction of Graph Transformation Systems via Type Graphs Analysis and Abstraction of Graph Transformation Systems via Type Graphs Dennis Nolte Abteilung für Informatik und Angewandte Kognitionswissenschaft, Universität Duisburg-Essen, Germany dennis.nolte@uni-due.de

More information

Databases = Categories

Databases = Categories Databases = Categories David I. Spivak dspivak@math.mit.edu Mathematics Department Massachusetts Institute of Technology Presented on 2010/09/16 David I. Spivak (MIT) Databases = Categories Presented on

More information

CS2 Algorithms and Data Structures Note 1

CS2 Algorithms and Data Structures Note 1 CS2 Algorithms and Data Structures Note 1 Analysing Algorithms This thread of the course is concerned with the design and analysis of good algorithms and data structures. Intuitively speaking, an algorithm

More information

Extending the DPO Approach for Topological Validation of Metamodel-Level Graph Rewriting Rules

Extending the DPO Approach for Topological Validation of Metamodel-Level Graph Rewriting Rules xtending the DPO Approach for Topological alidation of Metamodel-Level raph Rewriting Rules TIAMÉR LNDOSZKY, LÁSZLÓ LNYL, ASSAN CARAF Department of Automation and Applied Informatics Budapest University

More information

Formal Predicate Calculus. Michael Meyling

Formal Predicate Calculus. Michael Meyling Formal Predicate Calculus Michael Meyling May 24, 2013 2 The source for this document can be found here: http://www.qedeq.org/0_04_07/doc/math/qedeq_formal_logic_v1.xml Copyright by the authors. All rights

More information

Partial Metrics and Quantale-valued Sets (Preprint)

Partial Metrics and Quantale-valued Sets (Preprint) Partial Metrics and Quantale-valued Sets (Preprint) Michael Bukatin 1 MetaCarta, Inc. Cambridge, Massachusetts, USA Ralph Kopperman 2 Department of Mathematics City College City University of New York

More information

Test Case Generation According to the Binary Search Strategy

Test Case Generation According to the Binary Search Strategy Test Case Generation According to the Binary Search Strategy Sami Beydeda and Volker Gruhn University of Leipzig Department of Computer Science Chair of Applied Telematics / e-business Klostergasse 3 04109

More information

Rough Sets, Neighborhood Systems, and Granular Computing

Rough Sets, Neighborhood Systems, and Granular Computing Rough Sets, Neighborhood Systems, and Granular Computing Y.Y. Yao Department of Computer Science University of Regina Regina, Saskatchewan, Canada S4S 0A2 E-mail: yyao@cs.uregina.ca Abstract Granulation

More information

A Small Interpreted Language

A Small Interpreted Language A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

More information

On The Formal Specification of Database Schema Constraints

On The Formal Specification of Database Schema Constraints On The Formal Specification of Database Schema Constraints Ivan Luković University of Novi Sad, Faculty of Technical Sciences Novi Sad, Serbia and Montenegro ivan@uns.ns.ac.yu Sonja Ristić Higher Business

More information

Category Theory & Functional Data Abstraction

Category Theory & Functional Data Abstraction Category Theory & Functional Data Abstraction Brandon Shapiro Math 100b 1. Introduction Throughout mathematics, particularly algebra, there are numerous commonalities between the studies of various objects

More information

Sheaves and Stacks. November 5, Sheaves and Stacks

Sheaves and Stacks. November 5, Sheaves and Stacks November 5, 2014 Grothendieck topologies Grothendieck topologies are an extra datum on a category. They allow us to make sense of something being locally defined. Give a formal framework for glueing problems

More information

A Survey of Control Structures for Reconfigurable Petri Nets

A Survey of Control Structures for Reconfigurable Petri Nets Journal of Computer and Communications, 2015, 3, 20-28 Published Online February 2015 in SciRes. http://www.scirp.org/journal/jcc http://dx.doi.org/10.4236/jcc.2015.32002 A Survey of Control Structures

More information

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic. Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to

More information

Operational Specification for FCA using Z

Operational Specification for FCA using Z Operational Specification for FCA using Z Simon Andrews and Simon Polovina Faculty of Arts, Computing, Engineering and Sciences Sheffield Hallam University, Sheffield, UK {s.andrews, s.polovina}@shu.ac.uk

More information

Substitution in Structural Operational Semantics and value-passing process calculi

Substitution in Structural Operational Semantics and value-passing process calculi Substitution in Structural Operational Semantics and value-passing process calculi Sam Staton Computer Laboratory University of Cambridge Abstract Consider a process calculus that allows agents to communicate

More information

Inheritance Metrics: What do they Measure?

Inheritance Metrics: What do they Measure? Inheritance Metrics: What do they Measure? G. Sri Krishna and Rushikesh K. Joshi Department of Computer Science and Engineering Indian Institute of Technology Bombay Mumbai, 400 076, India Email:{srikrishna,rkj}@cse.iitb.ac.in

More information

Hoare logic. A proof system for separation logic. Introduction. Separation logic

Hoare logic. A proof system for separation logic. Introduction. Separation logic Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.

More information

EULER S FORMULA AND THE FIVE COLOR THEOREM

EULER S FORMULA AND THE FIVE COLOR THEOREM EULER S FORMULA AND THE FIVE COLOR THEOREM MIN JAE SONG Abstract. In this paper, we will define the necessary concepts to formulate map coloring problems. Then, we will prove Euler s formula and apply

More information

Chapter 3: Propositional Languages

Chapter 3: Propositional Languages Chapter 3: Propositional Languages We define here a general notion of a propositional language. We show how to obtain, as specific cases, various languages for propositional classical logic and some non-classical

More information

An Evolution of Mathematical Tools

An Evolution of Mathematical Tools An Evolution of Mathematical Tools From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world.

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C. 219 Lemma J For all languages A, B, C the following hold i. A m A, (reflexive) ii. if A m B and B m C, then A m C, (transitive) iii. if A m B and B is Turing-recognizable, then so is A, and iv. if A m

More information

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS JOSHUA LENERS Abstract. An algorithm is function from ω to ω defined by a finite set of instructions to transform a given input x to the desired output

More information

Hypertext A Case Study of Formal Object-Oriented Software Development

Hypertext A Case Study of Formal Object-Oriented Software Development Hypertext A Case Study of Formal Object-Oriented Software Development Andreas Rüping Forschungszentrum Informatik (FZI) Bereich Programmstrukturen Haid-und-Neu-Straße 10-14 D-76131 Karlsruhe e-mail: rueping@fzi.de

More information

ALGORITHMIC DECIDABILITY OF COMPUTER PROGRAM-FUNCTIONS LANGUAGE PROPERTIES. Nikolay Kosovskiy

ALGORITHMIC DECIDABILITY OF COMPUTER PROGRAM-FUNCTIONS LANGUAGE PROPERTIES. Nikolay Kosovskiy International Journal Information Theories and Applications, Vol. 20, Number 2, 2013 131 ALGORITHMIC DECIDABILITY OF COMPUTER PROGRAM-FUNCTIONS LANGUAGE PROPERTIES Nikolay Kosovskiy Abstract: A mathematical

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

2nd Belgian-Dutch workshop on Software Evolution

2nd Belgian-Dutch workshop on Software Evolution 2nd Belgian-Dutch workshop on Software Evolution BENEVOL 2004 8-9 July 2004 University of Antwerp Belgium Problem statement More and better tool support needed for software evolution traceability management

More information

Extracting the Range of cps from Affine Typing

Extracting the Range of cps from Affine Typing Extracting the Range of cps from Affine Typing Extended Abstract Josh Berdine, Peter W. O Hearn Queen Mary, University of London {berdine, ohearn}@dcs.qmul.ac.uk Hayo Thielecke The University of Birmingham

More information

9.5 Equivalence Relations

9.5 Equivalence Relations 9.5 Equivalence Relations You know from your early study of fractions that each fraction has many equivalent forms. For example, 2, 2 4, 3 6, 2, 3 6, 5 30,... are all different ways to represent the same

More information

THE FOUNDATIONS OF MATHEMATICS

THE FOUNDATIONS OF MATHEMATICS THE FOUNDATIONS OF MATHEMATICS By: Sterling McKay APRIL 21, 2014 LONE STAR - MONTGOMERY Mentor: William R. Brown, MBA Mckay 1 In mathematics, truth is arguably the most essential of its components. Suppose

More information

The GROOVE Simulator: A Tool for State Space Generation

The GROOVE Simulator: A Tool for State Space Generation Presented at AGTIVE, September 2003, Charlottesville, Virginia. To appear in Lecture Notes in Computer Science, Springer-Verlag. The GROOVE Simulator: A Tool for State Space Generation Arend Rensink University

More information

Topoi: Theory and Applications

Topoi: Theory and Applications : Theory and Applications 1 1 Computer Science, Swansea University, UK http://cs.swan.ac.uk/~csoliver Categorical logic seminar Swansea, March 19+23, 2012 Meaning I treat topos theory as a theory, whose

More information

Hoare triples. Floyd-Hoare Logic, Separation Logic

Hoare triples. Floyd-Hoare Logic, Separation Logic Hoare triples Floyd-Hoare Logic, Separation Logic 1. Floyd-Hoare Logic 1969 Reasoning about control Hoare triples {A} p {B} a Hoare triple partial correctness: if the initial state satisfies assertion

More information

From Types to Sets in Isabelle/HOL

From Types to Sets in Isabelle/HOL From Types to Sets in Isabelle/HOL Extented Abstract Ondřej Kunčar 1 and Andrei Popescu 1,2 1 Fakultät für Informatik, Technische Universität München, Germany 2 Institute of Mathematics Simion Stoilow

More information