Implementing Extended Structural Synthesis of Programs

Implementing Extended Structural Synthesis of Programs

From: AAAI Technical Report SS-02-05. Compilation copyright © 2002, AAAI (www.aaai.org). All rights reserved. Implementing Extended Structural Synthesis of Programs Sven Lämmermann Enn Tyugu Department of Microelectronics and Information Estonian Business School Technology, KTH [email protected] [email protected] Abstract Our synthesis method is aimed at composing software from functions, including higher-order functions (which We discuss logic and specification language of a program are taking automatically synthesized functions as synthesizer for Java intended for dynamic synthesis of arguments, and can so representcontrolstructures, e.g. services. We introduce metainterfaces as logical loops and conditional statements). Higher-orderness specifications of classes. They can be used in two ways: as guarantees the generality of the method in principle – one specifications of computational usage of classes or as can preprogram a small set of higher order functions that specifications of new classes composed from metaclasses – the classes already supplied with metainterfaces. The are sufficient for representing any computable function. In specification language used has a straightforward translation practice, we use a specific set of preprogrammed functions into a restricted first-order constructive logic. New for every problem domain. These functions are programs are composed by a deductive synthesis method implemented as methods of classes written in Java. We close to the structural synthesis of programs. An example of distinguish three kinds of building blocks used in the composition of a transaction service is presented. software synthesis process: The smallest building blocks (we call them also Introduction modules) are methods; they are selected and connected automatically by the synthesizer. We discuss logic and specification language proposed in The next size blocks are Java classes representing an ongoing project aimed at the development of a program particular concepts. synthesizer for Java intended for dynamic synthesis of The largest are metaclasses that represent independent network services. A prototype of the synthesizer has software components and are specified declaratively. already shown good performance. In this project, we The software features we are going to express in logic prioritize the efficiency of proof search before the are the following: generality of the logical language. The method under Dataflow between pre-programmed modules consideration is deductive program synthesis. In essence, it Order of application of modules (control variables) is an extension of the structural program synthesis (SSP) Hierarchical data structures described already in (Mints and Tyugu 1982), and we call Usage of pre-programmed control structures it ESSP – extended structural synthesis of programs. (subtasks) Our discussion is related to two quite different Alternative outcome of modules, in particular knowledge domains: software composition and logic. In exception handling the introductiuon we briefly look at the features of Implicit linking of modules software that must be representable by the logic of the 1. Dataflow. Dataflow dependencies between pre- synthesizer. We explain here as well which features of programmed functions can be expressed simply by logic will be used to support the required software features, implications, where for each function there is an and show how the complexity of proof search depends on implication. On its left hand side is a conjunction of the features covered bythelogic. As expected, supporting propositions stating for each input variable (for each all desirable features of the software composition leads in argument) that the input is available and on the right had principle to exponential time complexity of the proof side is a conjunction of propositions stating for each output search. However, our proof search strategy enables us to variable that the output is computed. This conforms with construct a coarse-grained proof quite efficiently using the intuitionistic realizability of implications as functions admissible inference rules that correspond to actual and propositional variables as data. Consider the following applications of functions and control structures in example. Let f and g be modules with input variables a, b computations. We are still quite satisfied with the respectively, and output variables b, c respectively. Then efficiency of the application of the synthesizer to practical the logical descriptionofthedataflow will be A ⊃ B and problems. BC⊃ where A, B, C are propositions stating availability (computability) of variables a, b, c.Computability of c introduction of disjunctions on the right hand side of from a follows from derivability of C from A. implications. 2. Order of module application.Wearesometimes 6. Implicit selections and linking of software components. confronted with the situation where the order of module Our intention is to use the synthesizer for putting together application matters, but this is not determined by dataflow. large programs from components. We mean by a To overcome this problem, a logic must, in addition, component not just a function, but also a software include means to force a certain order of module configuration providing some useful functionality. We application. For instance, let the modules f and g from the expect to have libraries of components supporting various example above be two methods of a class D implemented problem domains, like packages in Java. So the problem of in an object oriented programming language. Before these automatic selection components appears. This requires a twomethods can be applied, a constructor d of the class D language where we can state that a component with must create an object of class D.Byadding a proposition, particular properties exists or, vice versa, it may be let’s say D (as an additional conjunct) to the right hand required. Hence, we need existential and universal side of the implication specifying the constructor d,and quantifiers. However, we can restrict the usage of adding the same proposition to the left hand sides of the quantifiers so that we will not need the whole power of implications specifying f and g,thecorrect order of first order logic. application is forced on the modules. Fortunately, this does Extended structural synthesis covers the features not require any extension of the logic compared to the discussed above as follows: logic of dataflow. Non-nested implications of conjunctions of 3. Hierarchical data structures. Hierarchical data propositions cover 1, 2, and 3, structures can be specified by means of structural relations Nested implications cover also 4, that bind a structure, e.g. x with its components, say Disjunctions cover 5, but can be reduced to nested x1,,… xk .The computational possibilities of this relation implications, ∧∧ ⊃ Restricted first-order logic covers 6. can be expressed by the implications XXX1 … k and The proof search for non-nested implications has linear XX⊃ ,for ik=1,… , where X and X denote again the i i time complexity. Adding nested implications gives us the computability of x and xi respectively. This does not general case of intuitionistic propositional logic, hence require extension of the logic used for expressing the exponential time complexity in general; however, we can dataflow. (Object-oriented environments mayrequiresome use a modal logic for nested implications and get simpler additional computations for obtaining a structured value, proof search, see (Mints 1991). In the case of first-order e.g. application of a constructor of a proper class.) logic we use quantifiers in a very restricted way, and hope 4. Usage of predefined control structures. As we have to keep the search manageable. noted already, some building blocks that have to be We have chosen Java as the language we extend, specified are higher order functions that take other because it is a widely used object-oriented language functions as input. A functional input f of a function g can suitable for implementing services in a network. be specified by an implication on the left hand side of the Components of services are represented as classes and implication specifying the function g.Forinstance, the interfaces. Special attention ispaid to handling exceptions formula ()IANS⊃∧⊃ specifies a function g with in Java in a logically sound way. Also handling arguments f and n that computes s,wherethefunction f can constructors requires special attention. This has required be any function computing a from i that is composed from some extension of the logic used in (Lämmermann 2000). given blocks. (The capital letters again denote the Considerable part of the presentation takes an example of computability of the variables denoted by the respective synthesis of a banking service implemented in our project. small letters.) Accepting nested implications as formulae is This example is introduced gradually by presenting Java an essential extension of the logical language. Indeed, any classes on various parts of the paper. propositional formula of the intuitionistic logic can be encoded by formulae of this language so that its derivability can be checkedinatheorywithin this Specifications as Metainterfaces implicative language, see for instance (Mints and Tyugu On the specification language side we introduce 1982). metainterfaces as logical specifications of classes. They 5. Alternative outcome of modules.Evenconsidering only can be used in two ways: as specifications

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us