Using XML and XSL to Express Formal Semantics Karel Richta * richta@fel.cvut.cz Abstract: The paper deals with an algebraic specification prototyping via XSL-stylesheet over XML form of this specification. An algebraic specification is converted into XML- format. The signature is expressed as DTD. The semantic part of a specification is converted into XSL-code and used as a rewriting system. The prototyped expression can be formed as an XML-term, which is rewritten with the help of XSL into a canonical form – the meaning of this term. Key Words: XML, XSL, algebraic specification, formal semantics 1 Introduction At present it is widely accepted that formal specifications can play an important role in software design. The most important point is that the formal specifications can serve as an unambiguous and strict interface between customer, software analyst, designer, and programmer. Algebraic specifications with its clear syntax and semantics could be used for this purpose. The results of negotiations between the customer, who needs software for solving a certain problem, and a software producer can be declared as the algebraic specification of the given problem. An algebraic specification consists of two parts: signature and a set of axioms. The signature servers as a definition of the syntax. The axioms specify the semantics. Any algebraic structure satisfying axioms is a so-called model of a specification. The meaning of a specification as the isomorphic class of all initial models – it means, the class of models, whose are exchangeable. The specification can be prototyped – the problem is to find out automatically any member of the initial class. One possible way is to use a unique symbolic model constructed from Herbrand's universe of all well-formed terms by the smallest congruence relation generated by axioms of a specification. This symbolic model always exists, and if we are able to construct it, the result depicts so-called decision procedure for the equality problem in the defined class. A decision procedure is usually modeled by term rewriting systems. The problem is how to construct an appropriate term rewriting system for a given algebraic specification. Most systems are based on the well-known Knuth-Bendix completing procedure, which completes the appropriate term rewriting system for a given specification. If the procedure succeeded, we receive a term rewriting system that solves the equality problem for the specification and we can use it as a base for the construction of a prototype. This paper discusses the construction of a prototype from a term rewriting system. The key problem in prototyping is to produce a prototype in a short time and at a sufficient level of efficiency for testing. A very simple method is to transform the term rewriting system to Prolog or another similar high level logical programming language [Bergstra 89]. In such a case the process of construction is simple, but the resulting product is directly dependent on the efficiency of a Prolog compiler. *