In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A...

34
Information Sciences and Technologies Bulletin of the ACM Slovakia December 2014 Volume 6, Number 4 P. Horáček M. Bačíková J. Hudec Synchronous Formal Systems Based on Grammars and Transducers Domain Analysis of Graphical User Interfaces of Software Systems Contribution to the Methods and Algorithms of Automatic Generation of Functional Tests for Processorss 1 17 24 Chapter

Transcript of In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A...

Page 1: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and TechnologiesBulletin of the ACM Slovakia

December 2014Volume 6, Number 4

P. Horáček

M. Bačíková

J. Hudec

Synchronous Formal Systems Based on Grammars and Transducers

Domain Analysis of Graphical User Interfaces of Software Systems

Contribution to the Methods and Algorithms of Automatic Generation of Functional Tests for Processorss

Published by Slovak University of Technology Press, Vazovova 5, 812 43 Bratislava, IČO: 00397687

on behalf of the ACM Slovakia ChapterISSN 1338-1237 (printed edition)

ISSN 1338-6654 (online)Registration number: MK SR EV 3929/09

1

17

24

Chapter

Page 2: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Aim and Scope of the Information Sciences andTechnologies Bulletin of the ACM Slovakia

ACM Slovakia offers a forum for rapid disseminationof research results in the area of computing/informaticsand more broadly of information and communication sci-ences and technologies. It is primarily a web based bul-letin publishing results of dissertations submitted at anyuniversity in Slovakia or elsewhere, perhaps also resultsof outstanding master theses. Besides that, conferencesthat meet bulletin’s expectations with regard to scien-tific rigor are invited to consider publishing their papersin the bulletin in form of special issues. Besides the webversion of the bulletin, a paper version is available, too.

The Bulletin aims:

• To advance and to increase knowledge and inter-est in the science, design, development, construc-tion, languages, management and applications ofmodern computing a.k.a. informatics, and morebroadly of information and communication sciencesand technologies.

• To facilitate a communication between persons hav-ing an interest in information and communicationsciences and technologies by providing a forum forrapid dissemination of scholarly articles.

Scope of the Bulletin is:

• original research in an area within the broader fam-ily of information sciences and technologies, witha particular focus on computer science, computerengineering, software engineering and informationsystems, and also other similarly well establishedfields such as artificial intelligence or informationscience.

Types of contributions:

• Extended abstracts of doctoral dissertations.This is the primary type of article in the Bulletin.It presents main contributions of the dissertation inform of a journal paper together with separate sec-tion with list of published works of the author. InSlovakia and the Czech Republic, it corresponds totypical length of so called autoreferat. In fact, it isenvisaged that publishing the extended abstract inthe Bulletin makes autoreferat obsolete and even-tually can replace it completely. It should be notedthat by publishing it in the Bulletin, the extendedabstract will receive a much wider dissemination.Exceptionally, at the discretion of the EditorialBoard, the Bulletin may accept extended abstractsof other than doctoral theses, e.g. Master theses,when research results reported are sufficiently wor-thy of publishing in this forum. Rules and proce-dures of publishing are similar.

• Conference papers. The Bulletin offers orga-nizers of interesting scientific events in some areawithin the scope of the Bulletin to consider pub-lishing papers of the Conference in the Bulletin asits special issue. Any such proposal will be subjectof discussion with the Editorial Board which willultimately decide. From the scientific merit point

of view, method of peer reviewing, acceptance ratioetc. are issues that will be raised in the discussion.

Besides that the Bulletin may include other types of con-tributions that will contribute to fulfilling its aims, sothat it best serves the professional community in the areaof information and communication sciences and tech-nologies. There are four regular issues annually.

Editorial Board

Editor in ChiefPavol NavratSlovak University of Technology in Bratislava, Slovakia

Associate Editor in ChiefMaria BielikovaSlovak University of Technology in Bratislava, Slovakia

Members:Andras BenczurEotvos Lorand University, Budapest, Hungary

Johann EderUniversity of Vienna, Austria

Viliam GeffertP. J. Safarik University, Kosice, Slovakia

Tomas HruskaBrno University of Technology, Czech Republic

Mirjana IvanovicUniversity of Novi Sad, Serbia

Robert LorenczCzech Technical University, Prague, Czech Republic

Karol MatiaskoUniversity of Zilina, Slovakia

Yannis ManolopoulosAristotle University, Thessaloniki, Greece

Tadeusz MorzyPoznan University of Technology, Poland

Valerie NovitzkaTechnical University in Kosice, Slovakia

Jaroslav PokornyCharles University in Prague, Czech Republic

Lubos PopelınskyMasaryk University, Brno, Czech Republic

Branislav RovanComenius University, Bratislava, Slovakia

Vaclav SnaselVSB-Technical University of Ostrava, Czech Republic

Jirı SafarıkUniversity of West Bohemia, Plzen, Czech Republic

Executive Editor: Peter LackoCover Design: Peter LackoTypeset in LATEX using style based on ACM SIG Proceedings Template.

Page 3: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Synchronous Formal Systems Basedon Grammars and Transducers

Petr Horácek∗

Department of Information SystemsFaculty of Information Technology

Brno University of TechnologyBožetechova 1/2, 612 66 Brno, Czech Republic

[email protected]

AbstractThis paper is an extended abstract of a doctoral the-sis which studies synchronous formal systems based ongrammars and transducers, investigating both theoreticalproperties and practical application perspectives. It in-troduces new concepts and definitions building upon thewell-known principles of regulated rewriting and synchro-nization. An alternate approach to synchronization ofcontext-free grammars is proposed, based on linked rules.This principle is extended to regulated grammars such asscattered context grammars and matrix grammars. More-over, based on a similar principle, a new type of trans-ducer called the rule-restricted transducer is introduced asa system consisting of a finite automaton and context-freegrammar. New theoretical results regarding the genera-tive and accepting power are presented. The last part ofthe thesis studies linguistically-oriented application per-spectives, focusing on natural language translation. Themain advantages of the new models are discussed andcompared, using select case studies from Czech, English,and Japanese to illustrate.

Categories and Subject DescriptorsF.4.3 [Mathematical Logic and Formal Languages]:Formal Languages—classes defined by grammars or au-tomata, operations on languages; I.2.7 [Artificial Intel-ligence]: Natural Language Processing—language mod-els, machine translation

Keywordsformal systems, grammars, transducers, regulated rewrit-ing, synchronization, natural language syntax, naturallanguage translation

∗Recommended by thesis supervisor: Prof. AlexanderMeduna. Defended at Faculty of Information Technology,Brno University of Technology on September 12, 2014.

c© Copyright 2014. All rights reserved. Permission to make digitalor hard copies of part or all of this work for personal or classroom useis granted without fee provided that copies are not made or distributedfor profit or commercial advantage and that copies show this notice onthe first page or initial screen of a display along with the full citation.Copyrights for components of this work owned by others than ACMmust be honored. Abstracting with credit is permitted. To copy other-wise, to republish, to post on servers, to redistribute to lists, or to useany component of this work in other works requires prior specific per-mission and/or a fee. Permissions may be requested from STU Press,Vazovova 5, 811 07 Bratislava, Slovakia.Horácek, P. Synchronous Formal Systems Based on Grammars andTransducers. Information Sciences and Technologies Bulletin of theACM Slovakia, Vol. 6, No. 4 (2014) 1-16

1. IntroductionNatural language processing is a field of theoretical in-formatics and linguistics and is concerned with the in-teractions between computers and human (natural) lan-guages. It is defined as a theoretically motivated range ofcomputational techniques for analyzing and representingnaturally occurring texts (which means any language) atone or more levels of linguistic analysis for the purpose ofachieving human-like language processing for a range oftasks or applications (according to [4]).

The history goes back to the the late 1940s, when therewas an effort to understand and formally describe the syn-tax of natural languages. A big step forward was the pub-lishing of the book called Syntactic Structures, by NoamChomsky, introducing the idea of generative grammar.

At first, computer processing of natural languages wasin interest of artificial inteligence as a part of human-computer interaction. Subsequently, it split into two sepa-rate disciplines. Today, natural language processing stud-ies many other aspects of natural languages besides theirsyntax (such as morphology or semantics). This disciplineis focused mainly on practical applications. Some of themost frequent tasks are information retrieval, informa-tion extraction, question answering, summarization, andmachine translation, and in broader scope, we can eveninclude tasks as speech recognition and speech synthesis.

The second discipline encompasses a set of formalisms,which are, in general, known as formal language theory.Formal language theory is considered a part of theoreticalcomputer science, and it focuses mainly on theoreticalstudies of various formal models and their properties. Itsapplications are now found in many other areas besidescomputational linguistics.

One of the major trends in formal language theory is reg-ulated rewriting. This concept was introduced already inthe 1960s, as the models of the now traditional Chom-sky hierarchy have been found unsatisfactory for certainpractical applications. For example, it has been arguedthat some linguistic phenomena could not be described bycontext-free grammars, while context-sensitive and unre-stricted grammars were inefficient for practical use (be-cause of the complexity of parsing). Because of this, waysto increase the power of context-free grammars—while re-taining their practical applicability—were investigated.

Page 4: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

2 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

Regulated rewriting essentially means that we take a cer-tain known formal model (usually a context-free gram-mar, for reasons mentioned above) and in some way reg-ulate (hence the name) the way in which it generates (or,in the case of automata, accepts) sentences. This can bedone by adding some mathematically simple mechanismthat controls the use of rules (such as in programmedgrammars), or by changing the form of rules themselves(as, for example, in scattered context grammars). Thus,the expressive power is increased by limiting availablederivations (or computations).

The purpose of our work is twofold. From a theoreti-cal point of view, we contribute to the study of formallanguage theory by introducing new formal models andinvestigating their properties. Rather than trying to cre-ate completely new formalisms from scratch, we establishthe new models as generalizations, extensions, or mod-ifications of well-known and well-studied formal models(such as context-free grammars and finite automata) andprinciples (such as regulated rewriting and synchroniza-tion).

In [22], we have presented an alternate approach to syn-chronization, based on linking rules instead of nontermi-nals. In this fashion, we have extended the principle tomodels with regulated rewriting, specifically matrix gram-mars and scattered context grammars. We have continuedwith further theoretical study of synchronous grammarsbased on linked rules, and particularly of synchronous ver-sions of regulated grammars, in [20] and [23].

In [6], we have introduced a new type of transducer, therule-restricted automaton-grammar transducer, as a sys-tem consisting of a finite automaton, which is used to readan input string, and a context-free grammar, which simul-taneously produces a corresponding output string. Alsoin [6], we have investigated the theoretical properties—namely, the generative and accepting power—of this newsystem and its variants.

Meanwhile, from a more practical viewpoint, we investi-gate how some of the well-known and well-studied modelsfrom formal language theory can be adapted or extendedfor applications in natural language processing. In otherwords, the ideas and concepts behind the new formal mod-els mentioned above are motivated by the possibility oftheir linguistic applications.

Inspired by such works as [32], where the authors dis-cuss linguistically-oriented applications of scattered con-text grammars (using examples from the English language),we explore similar application perspectives of other reg-ulated formal models as well. In [18], we have discussedpotential applications of matrix grammars in the descrip-tion of the Japanese syntax. Subsequently, we have beenfocusing on translation of natural languages.

Machine translation is one of the major tasks in nat-ural language processing. With increasing availabilityof large corpora, corpus-based systems became favouredover rule-based, using statistical methods and machine-learning techniques. They mostly rely on formal mod-els that represent local information only, such as n-grammodels. However, recently, there have been attempts toimprove results by incorporating syntactic informationinto such systems (see [26], [43], or [5]).

To do so, we need formal models that can describe syn-tactic structures and their transformations. Based on theprinciples of synchronous grammars (see [8]), we have pro-posed synchronous versions of some regulated grammars,such as matrix grammars (see [12]) and scattered contextgrammars (see [32]). We first introduced the idea in [19],and further elaborated upon it in [22]. Revised defini-tions, a study of theoretical properties, and a further dis-cussion of linguistically-oriented application perspectivescan be found in [23]; applications in particular are alsoinvestigated in [21].

Other type of models we can use are transducers (see [2]).Unlike synchronous grammars, which generate a pair ofsentences in one derivation and thus define translation,transducers take a given input sentence and transform itinto a corresponding output sentence. Frequently, thesetransducers consist of several components, including var-ious automata and grammars, some of which read theirinput strings while others produce their output strings(see [15] or [36]). In [6], we have introduced the rule-restricted automaton-grammar transducer and its vari-ants, and discussed its advantages for natural languagetranslation, illustrated by examples from Czech, English,and Japanese.

2. PreliminariesIn this paper, we assume that the reader is familiar withthe fundamental concepts and models of modern formallanguage theory (see [30] or [39]) and natural languageprocessing (see [4] or [35]). These topics are covered indetail in Chapters 2 and 3 of the full thesis.

A context-free grammar (CFG for short) G is a quadrupleG = (N,T, P, S), where N is a nonterminal alphabet, Tis a terminal alphabet, N ∩ T = ∅, P is a finite relationfrom N to (N ∪ T )∗, represented as a set of derivationrules of the form A → x, where A ∈ N , x ∈ (N ∪ T )∗,and S ∈ N is the start symbol. Any string w ∈ (N∪T )∗ iscalled a sentential form of G. Further, if w ∈ T ∗, we callw a sentence. Let uxv and uyv be two sentential formsand let p = A → x ∈ P . Then, we say that uAv directlyderives uxv in G according to rule p, written as uAv ⇒G

uxv [p] or simply uAv ⇒ uxv. Alternatively, we say thatG makes a derivation step from uAv to uxv (accordingto rule p), and any sequence of derivation steps startingby rewriting S is called a derivation. Further, ⇒k, ⇒+,and ⇒∗ denote the k-fold product, the transitive closure,and the transitive and reflexive closure of⇒, respectively.The language generated by G, denoted by L(G), is definedas L(G) = {w : S ⇒∗ w}.

Throughout this text, CF denotes the class of context-free languages and RE denotes the class of recursivelyenumerable languages.

A finite automaton (FA) M is a quintuple M = (Q,Σ, δ,q0, F ), where Q is a finite set of states, Σ is an inputalphabet, δ is a finite relation from Q × (Σ ∪ {ε}) to Q,represented as a set of transition rules of the form pa→ q,where p, q ∈ Q, a ∈ Σ ∪ {ε}, q0 ∈ Q is the start state,and F ⊆ Q is a set of final states. Any string χ ∈ QΣ∗

is called a configuration of M . Let pax and qx be twoconfigurations of M and let r = pa → q ∈ δ. Then,we say that M makes a move (or computation step) frompax to qx according to rule r, written as pax⇒M qx [r] orsimply pax⇒ qx. As usual,⇒k,⇒+, and⇒∗ denote the

Page 5: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 3

k-fold product, the transitive closure, and the transitiveand reflexive closure of ⇒, respectively. The languageaccepted by M , denoted by L(M), is defined as L(M) ={w : q0w ⇒∗ f, f ∈ F}.

A pushdown automaton (PDA) M is a septuple M =(Q,Σ,Γ, δ, q0, S, F ), where Q is a finite set of states, Σis an input alphabet, Γ is a pushdown alphabet, δ is afinite relation from Γ × Q × (Σ ∪ {ε}) to Γ∗ × Q, repre-sented as a set of transition rules of the form Apa→ wq,where A ∈ Γ, p, q ∈ Q, a ∈ Σ ∪ {ε}, w ∈ Γ∗, q0 ∈ Q isthe start state, S ∈ Γ is the initial pushdown symbol, andF ⊆ Q is a set of final states. Any string χ ∈ Γ∗QΣ∗

is called a configuration of M . Let xApay and xwqy betwo configurations of M and let r = Apa → wq ∈ δ.Then, we say that M makes a move (or computationstep) from xApay to xwqy according to rule r, writtenas xApay ⇒M xwqy [r] or simply xApay ⇒ xwqy. Thelanguage accepted by M , denoted by L(M), is defined asL(M) = {w : Sq0w ⇒∗ f, f ∈ F}.

A matrix grammar (MAT) H is a pair H = (G,M), whereG = (N,T, P, S) is a CFG and M is a finite language overP (M ⊂ P ∗); members of M are called matrices. Let uand v be two sentential forms. We say that u directlyderives v in H according to matrix m, written as u ⇒H

v [m] or simply u ⇒ v, if and only if m = p1 . . . pn ∈M and there are strings x0, . . . , xn such that x0 = u,xn = v, and for all 0 ≤ i < n, xi ⇒ xi+1 [pi+1] in G.Note that this makes for one derivation step in H (duringwhich an arbitrary number of derivation steps in G maybe performed, or even none at all, if m = ε).

A matrix grammar with appearance checking (MATac)H is a pair H = (G,M), where G = (N,T, P, S) is aCFG and M is a finite set of strings of pairs (p, t), wherep ∈ P and t ∈ {−,+}; members of M are called ma-trices. Let u and v be two sentential forms. We saythat u directly derives v in H according to matrix m,written as u ⇒H v [m] or simply u ⇒ v, if and onlyif m = (p1, t1) . . . (pn, tn) ∈ M and there are stringsx0, . . . , xn such that x0 = u, xn = v, and for all 0 ≤ i < n,either xi ⇒ xi+1 [pi+1] in G, or ti+1 ∈ {−}, xi = xi+1,and pi+1 is not applicable on xi in G.

A scattered context grammar (SCG) G is a quadruple G =(N,T, P, S), where N is a nonterminal alphabet, T is aterminal alphabet, N ∩T = ∅, P is a finite set of rules ofthe form (A1, . . . , An) → (x1, . . . , xn), where n ≥ 1 andfor all 1 ≤ i ≤ n, Ai ∈ N , xi ∈ (N ∪ T )∗, and S ∈ Nis the start symbol. Let u and v be two sentential forms.We say that u directly derives v in G according to rulep, written as u ⇒G v [p] or simply u ⇒ v, if and onlyif there is a factorization of u = u1A1 . . . unAnun+1 andv = u1x1 . . . unxnun+1 where for all 1 ≤ i ≤ n + 1, ui ∈(N∪T )∗, such that p = (A1, . . . , An)→ (x1, . . . , xn) ∈ P .

Further, let L (MAT), L (MATac), and L (SCG) denotethe class of all languages generated by matrix grammars,matrix grammars with appearance checking, and scat-tered context grammars, respectively.

A k-counter automaton (k-CA) M is an FA M = (Q,Σ, δ,q0, F ) with k integers v = (v1, . . . , vk) in Nk

0 as an addi-tional storage. Transition rules in δ are of the form pa→q(t1, . . . , tn), where p, q ∈ Q, a ∈ Σ∪{ε}, and ti ∈ {−}∪Z.A configuration of k-CA is any string from QΣ∗Nk

0 . Let

χ1 = paw(v1, . . . , vk) and χ2 = qw(v′1, . . . , v′k) be two

configuration of M and r = pa→ q(t1, . . . , tk) ∈ δ, wherethe following holds: if ti ∈ Z, then v′i = vi + ti; otherwise,it is satisfied that vi, v

′i = 0. Then, M makes a move (or

computation step) from configuration χ1 to χ2 accordingto r, written as χ1 ⇒ χ2 [r], or simply χ1 ⇒ χ2. Thelanguage accepted by M , denoted by L(M), is defined asL(M) = {w : w ∈ Σ∗, q0w(0, . . . , 0) ⇒∗ f(0, . . . , 0), f ∈F}.

A partially blind k-counter automaton (k-PBCA) M is anFA M = (Q,Σ, δ, q0, F ) with k integers v = (v1, . . . , vk)in Nk

0 as an additional storage. Transition rules in δ areof the form pa → qt, where p, q ∈ Q, a ∈ Σ ∪ {ε}, andt ∈ Zk. As a configuration of k-PBCA we understandany string from QΣ∗Nk

0 . Let χ1 = paw(v1, . . . , vk) andχ2 = qw(v′1, . . . , v

′k) be two configurations of M and r =

pa → q(t1, . . . , tk) ∈ δ, where (v1 + t1, . . . , vk + tk) =(v′1, . . . , v

′k). Then, M makes a move (or computation

step) from configuration χ1 to χ2 according to r, writtenas χ1 ⇒ χ2 [r], or simply χ1 ⇒ χ2. The language acceptedby M , denoted by L(M), is defined as L(M) = {w : w ∈Σ∗, q0w(0, . . . , 0)⇒∗ f(0, . . . , 0), f ∈ F}.

For k ∈ N, let L (k-CA) and L (k-PBCA) denote theclass of all languages accepted by k-CAs and k-PBCAs,respectively.

3. Synchronous Systems Based on GrammarsIn essence, synchronous grammars are grammars or gram-mar systems that generate pairs of sentences in one deriva-tion, instead of single sentences (as for example in CFGs).In this way, they allow us to describe translations. Thatis, in each pair, the first string is a sentence of the sourcelanguage, and the second string is a corresponding sen-tence of the target language.

The term synchronous context-free grammar (SCFG forshort) is relatively recent. However, the basic principlewas introduced already in the late 1960s in syntax-directedtranslation schemata [3] and syntax-directed transduc-tion grammars [27]. These models were originally de-veloped as formal background for compilers of program-ming languages. Subsequently, synchronous grammarshave been succesfully used natural language processingas well, particularly in machine translation (see for exam-ple [41]; more details are also given in the full thesis).

Informally, we can see SCFG (see [8] or [9]) as a modifi-cation of CFG where every rule has two right-hand sides,the first of which is applied to the input sentential form(source), and the second to the output sentential form(target). Nonterminals are linked, which means that ineach derivation step, we rewrite both the selected nonter-minal symbol in the input sentential form and its appro-priate counterpart in the output sentential form.

The original ideas, concepts, definitions, and theoreticalresults presented in this section were first published in [22]and [23].

3.1 Rule-Synchronized Context-Free GrammarIn [22] and [23], we have proposed synchronization basedon linked rules instead of nonterminals. Informally, suchsynchronous grammar is a system of two grammars, GI

and GO, in which the corresponding rules share labels.For example, if we apply rule labelled 1 in the input gram-

Page 6: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

4 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

mar GI , we also have to apply rule labelled 1 in the outputgrammar GO, and this makes for a single derivation stepin the synchronous grammar. In other words, the inputand output sentence have the same parse (a sequence ofrules applied in a derivation, denoted by their labels).

Rules (GI on the left, GO on the right):

1 : E → E + T 1 : E → E T +2 : T → T × F 2 : T → T F ×

An example of a derivation using these rules in GI follows.

E ⇒ E + T [1] ⇒ E + T × F [2]

A corresponding derivation in GO is:

E ⇒ E T + [1] ⇒ E T F × + [2]

The parse is (1, 2).

However, note that we place no restriction on the linkedrules. For instance, unlike in synchronous CFGs, we donot have to rewrite the same nonterminal in both sen-tential forms in one derivation step. Both the right-handsides and the left-hand sides of linked rules may be com-pletely different, for example:

3 : A → B a C 3 : P → Q B R b d

In other words, rule-synchronized CFGs can be seen as ageneralization of the traditional synchronous CFGs, as thelatter can be defined as special case of rule-synchronizedCFGs, where each two linked rules have the same left-hand side (that is, they rewrite the same nonterminal).

Formally, we define a rule-synchronized CFG as follows.

Definition 1. A rule-synchronized CFG (RSCFG) H isa quintupleH = (GI , GO,Ψ, ϕI , ϕO), whereGI = (NI , TI ,PI , SI) and GO = (NO, TO, PO, SO) are CFGs, Ψ is a setof rule labels, and ϕI is a function from Ψ to PI and ϕO

is a function from Ψ to PO.

We say that two rules pI ∈ PI and pO ∈ PO are linked, ifand only if there is some label p ∈ Ψ such that ϕI(p) = pIand ϕO(p) = pO. That is, each two linked rules share thesame label.

We use the following notation (presented for input gram-mar GI , analogous for output grammar GO). First, p :AI → xI , where p ∈ Ψ, AI → xI ∈ PI , denotes ϕI(p) =AI → xI . Next, xI ⇒GI yI [p], where xI , yI ∈ (N ∪T )∗, p ∈ Ψ, denotes a derivation step in GI applyingrule ϕI(p). Finally, xI ⇒n

GIyI [p1 . . . pn], where xI , yI ∈

(N ∪ T )∗, pi ∈ Ψ, denotes a derivation in GI applyingrules ϕI(p1) through ϕI(pn).

Let H = (GI , GO,Ψ, ϕI , ϕO) be an RSCFG. The transla-tion defined by H, denoted by T (H), is the set of pairs of

sentences, which is defined as T (H) = {(wI , wO) : wI ∈T ∗I , wO ∈ T ∗O, SI ⇒∗GI

wI [α], SO ⇒∗GOwO [α], α ∈ Ψ∗}.

Originally [22], we considered RSCFG only as a variant ofsynchronous CFG. However, there is in fact a significantdifference. While the latter does not increase the gener-ative power over CFG, RSCFG does, as is shown in thenext subsection.

3.1.1 Generative PowerSynchronous grammars define translations—that is, setsof pairs of sentences. To be able to compare their genera-tive power with well-known models such as CFGs, whichdefine languages, we can consider their input and outputlanguage separately.

Definition 2. Let H be an RSCFG. Then, we definethe input language of H, denoted by LI(H), as LI(H) ={wI : (wI , wO) ∈ T (H)}, and the output language of H,denoted by LO(H), as LO(H) = {wO : (wI , wO) ∈ T (H)}.

Consider an RSCFG H = (GI , GO,Ψ, ϕI , ϕO) with thefollowing rules (nonterminals are in capitals, linked rulesshare the same label, SI and SO are the start symbols ofGI and GO, respectively):

GI GO

1 : SI → ABC 1 : SO → A2 : A → aA 2 : A → B3 : B → bB 3 : B → C4 : C → cC 4 : C → A5 : A → ε 5 : A → B′

6 : B → ε 6 : B′ → C′

7 : C → ε 7 : C′ → ε

An example of a derivation follows.

SI ⇒ ABC [1] SO ⇒ A [1]⇒ aABC [2] ⇒ B [2]⇒ aAbBC [3] ⇒ C [3]⇒ aAbBcC [4] ⇒ A [4]⇒ aaAbBcC [2] ⇒ B [2]⇒ aaAbbBcC [3] ⇒ C [3]⇒ aaAbbBccC [4] ⇒ A [4]⇒ aabbBccC [5] ⇒ B′ [5]⇒ aabbccC [6] ⇒ C′ [6]⇒ aabbcc [7] ⇒ ε [7]

We can easily see that LI(H) = {anbncn : n ≥ 0}, which iswell known not to be a context-free language. This showsthat RSCFGs are stronger than (synchronous) CFGs.1

Where exactly do synchronous grammars with linked rulesstand in terms of generative power?

Let L (RSCFG) denote the class of languages generatedby RSCFGs as their input language. Note that the resultspresented below would be the same if we considered theoutput language instead.

1Strictly speaking, to make this claim, we also have toshow that every context-free language can be generatedby a RSCFG. That is however evident from the definition.

Page 7: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 5

In some of the proofs below, we use a function that re-moves all terminals from a sentential form, formally de-fined as follows.

Definition 3. Let G = (N,T, P, S) be a CFG. Then, wedefine the function θ over (N ∪ T )∗ as follows:

1. For all w ∈ T ∗, θ(w) = ε.

2. For all w = x0A1x2A2 . . . xn−1Anxn for some n ≥ 1,where xi ∈ T ∗ for all 0 ≤ i ≤ n and Aj ∈ N for all1 ≤ j ≤ n, θ(w) = A1A2 . . . An.

The idea here is that if we consider only context-free rules,the applicability of rules to a given sentential form onlydepends on nonterminals. Therefore, we can remove ter-minals without affecting computational control.

For every RSCFG, we can construct an equivalent MAT,using matrices to simulate the principle of linked rules.

Lemma 1. For every RSCFG H, there is a MAT H ′

such that L(H ′) = LI(H).

Proof. Let H = (GI , GO,Ψ, ϕI , ϕO) be an RSCFG,where GI = (NI , TI , PI , SI), GO = (NO, TO, PO, SO).Without loss of generality, assume NI ∩ NO = ∅, S /∈NI ∪ NO. Construct a MAT H ′ = (G,M), where G =(N,T, P, S), as follows:

1. Set N = NI ∪NO∪{S}, T = TI , P = {S → SISO},M = {S → SISO}.

2. For every label p ∈ Ψ, add rules pI , pO to P andadd matrix pIpO to M , where

• pI = ϕI(p) and

• pO = A → x such that ϕO(p) = A → x′, x =θ(x′).2

Basic idea. H ′ simulates the principle of linked rules inH by matrices. That is, for every pair of rules (AI →xI , AO → xO) such that ϕI(p) = AI → xI , ϕO(p) =AO → xO for some p ∈ Ψ in H, there is a matrix m =AI → xIAO → θ(xO) in H ′. If, in H, xI ⇒ yI [p] in GI

and xO ⇒ yO [p] in GO, then there is a derivation stepxI θ(xO) ⇒ yI θ(yO) [m] in H ′. Note that since the rulesare context-free, the presence (or absence) of terminalsin a sentential form does not affect which rules we canapply. Furthermore, because the nonterminal sets NI andNO are disjoint, the sentential form in H ′ always consistsof two distinct parts such that the first part corresponds tothe derivation in GI and the second part to the derivationin GO.

The complete formal proof of L(H ′) = LI(H) can be foundin the thesis and in [23].

2This removes all terminals from the right-hand side ofthe rule. Note that if we leave the rule unchanged, we ob-tain the concatenation of the input and the output sen-tence. Further, if we want L(H ′) = LO(H) instead ofL(H ′) = LI(H), we can simply modify pI instead of pOin this step.

On the other hand, for every MAT, we can construct anequivalent RSCFG. We take advantage of that fact thatthere is an “additonal” CFG in an RSCFG, and use it tosimulate matrices.

Lemma 2. For every MAT H, there is a RSCFG H ′

such that LI(H ′) = L(H).

Proof. Let H = (G,M) be a MAT, where G = (N,T,P, S). Without loss of generality, assume that N∩{SI , SO,X} = ∅. Construct an RSCFG H ′ = (GI , GO,Ψ, ϕI , ϕO),where GI = (NI , TI , PI , SI), GO = (NO, TO, PO, SO), asfollows:

1. Set NI = N ∪ {SI , X}, TI = T , PI = {SI →SX,X → ε}, NO = {SO, X}, TO = {#}, PO ={SO → X,X → #}, ϕI = ∅, ϕO = ∅.

2. Set Ψ = {0, 1}, ϕI(0) = SI → SX, ϕO(0) = SO →X, ϕI(1) = X → ε, ϕO(1) = X → #.

3. For every matrix m = p ∈M , where p ∈ P ,

(a) add rule p to PI ,

(b) add rule X → X to PO,

(c) add new label 〈m〉 to Ψ, and

(d) set ϕI(〈m〉) = p, ϕO(〈m〉) = X → X.

4. For every matrix m = p1 . . . pn ∈ M , where n > 1and pi ∈ P for all 1 ≤ i ≤ n,

(a) add rules p1, . . . , pn to PI ,

(b) add new nonterminals 〈Xm〉1, . . . , 〈Xm〉n−1 toNO,

(c) add rules X → 〈Xm〉1, 〈Xm〉1 → 〈Xm〉2, . . . ,〈Xm〉n−2 → 〈Xm〉n−1, 〈Xm〉n−1 → X to PO,

(d) add new labels 〈m〉1, . . . , 〈m〉n to Ψ, and

(e) set ϕI and ϕO as follows:

• ϕI(〈m〉1) = p1, ϕO(〈m〉1) = X → 〈Xm〉1,

• ϕI(〈m〉i) = pi, ϕO(〈m〉i) = 〈Xm〉i−1 →〈Xm〉i for all 1 < i < n, and

• ϕI(〈m〉n) = pn, ϕO(〈m〉n) = 〈Xm〉n−1 →X.

Basic idea. One may notice that GI constructed by theabove algorithm is nearly identical to the original CFGG in H. Indeed, it performs essentially the same role:generating a sentence. Meanwhile, GO restricts availablederivations according to matrices from H. Each nonter-minal in GO represents a certain state of the system. Forexample, suppose that we have the nonterminal 〈Xm〉2 asthe current sentential form in GO. This means that weare currently simulating the matrix m, we have succesfullyapplied the second rule of this matrix, and now we needto apply its next rule. The nonterminal X is a specialcase. It represents the state where we can either choose anew matrix to simulate, or end the derivation. It appearsat the start of a derivation (along with the original startsymbol from H, S) and can only appear again immedi-ately after a successful simulation of a whole matrix (onederivation step in H).

The complete formal proof of LI(H ′) = L(H) can be foundin the thesis and in [23].

Page 8: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

6 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

Note that GO constructed by the above algorithm is notonly context-free, but also regular.

From Lemma 1 and Lemma 2, we can establish the fol-lowing theorem.

Theorem 1. L (RSCFG) = L (MAT)

Proof. From Lemma 1, it follows that L (RSCFG) ⊆L (MAT). From Lemma 2, it follows that L (MAT) ⊆L (RSCFG). Therefore, L (RSCFG) = L (MAT).

3.2 Synchronous Scattered Context GrammarThe principle of synchronization based on linked rules canbe naturally extended to other models beside CFGs. In-deed, the definition of synchronous SCG is analogous toDefinition 1 for RSCFG. Essentially, we only need to re-place context-free rules with scattered context rules. Thenotation is also analogous.

Definition 4. A synchronous SCG (SSCG for short) His a quintuple H = (GI , GO,Ψ, ϕI , ϕO), where GI =(NI , TI , PI , SI) and GO = (NO, TO, PO, SO) are SCGs,Ψ is a set of rule labels, and ϕI is a function from Ψ toPI and ϕO is a function from Ψ to PO.

Further, the translation defined by H, denoted by T (H),is the set of pairs of sentences, which is defined as T (H) ={(wI , wO) : wI ∈ T ∗I , wO ∈ T ∗O, SI ⇒∗GI

wI [α], SO ⇒∗GO

wO [α], α ∈ Ψ∗}.

We define the input and output language of SSCG byanalogy with Definition 2 for RSCFGs. Let L (SSCG)denote the class of all languages generated by SSCGs astheir input language.

3.2.1 Generative PowerIt is known that SCGs can generate all recursively enu-merable languages (see [29]). Perhaps not surprisingly,the same is true for SSCGs. From their definition, it iseasy to see that SSCGs cannot be weaker than SCGs.If we want to construct an SSCG equivalent to a givenSCG, we can, for instance, essentially duplicate the origi-nal SCG and designate each two identical rules from inputand output grammar as linked.

Theorem 2. L (SSCG) = RE

Proof. Clearly, L (SSCG) ⊆ RE must hold. Fromdefinition, it follows that L (SCG) ⊆ L (SSCG). BecauseL (SCG) = RE [29], RE ⊆ L (SSCG) also holds.

3.3 Synchronous Matrix GrammarIn the case of matrix grammars, the situation is slightlymore complicated. How should we link the rules with re-gard to matrices? There are many options. For instance,we could strictly require that all rules in one matrix in theinput grammar be linked to rules in one matrix in the out-put grammar, in respective order (consequently, requiringeach two matrices that have their rules linked to have thesame length). Alternatively, we could link only the firstrule in each matrix. However, perhaps the most straight-forward and intuitive approach is to link whole matricesrather than individual rules.

The notation used here is analogous to the one presentedin Section 3.1 for RSCFGs, only replacing rules by matri-ces.

Definition 5. A synchronous matrix grammar (SMATfor short) H is a septuple H = (GI ,MI , GO,MO,Ψ, ϕI ,ϕO), where (GI ,MI) and (GO,MO) are MATs, whereGI = (NI , TI , PI , SI) and GO = (NO, TO, PO, SO), Ψ is aset of matrix labels, and ϕI is a function from Ψ to MI

and ϕO is a function from Ψ to MO. Further, the trans-lation defined by H, denoted by T (H), is the set of pairsof sentences, which is defined as T (H) = {(wI , wO) : wI ∈T ∗I , wO ∈ T ∗O, SI ⇒∗(GI ,MI ) wI [α], SO ⇒∗(GO,MO) wO [α],α ∈ Ψ∗}.

We define the input and output language of SMAT byanalogy with Definition 2 for RSCFGs. Let L (SMAT)denote the class of all languages generated by SMATs astheir input language.

3.3.1 Generative PowerFollowing a similar reasoning as in the case of SSCGs,we can immediately conclude that SMATs must be atleast as powerful as MATs. To elaborate, to constructan SMAT equivalent to a given MAT, we can, as withSSCGs, let both input and output grammar equal theoriginal grammar and designate the identical matrices ininput and output grammar as linked.

The fact that we can also construct an equivalent MATfor every SMAT is much less immediately obvious. Inessence, we can join each two linked matrices (from inputand output grammar) into one matrix.

Theorem 3. L (SMAT) = L (MAT)

Proof. The inclusion L (MAT) ⊆ L (SMAT) followsfrom definition. It only remains to prove that L (SMAT) ⊆L (MAT). For every SMAT H = (GI ,MI , GO,MO,Ψ, ϕI ,ϕO), where GI = (NI , TI , PI , SI), GO = (NO, TO, PO, SO),we can construct a MAT H ′ = (G,M), where G = (N,T,P, S), such that L(H ′) = LI(H), as follows. Without lossof generality, assume NI ∩NO = ∅, S /∈ NI ∪NO.

1. Set N = NI ∪NO∪{S}, T = TI , P = {S → SISO},M = {S → SISO}.

2. For every label p ∈ Ψ, to P , add rules pI1 throughpIn and pO1 through pOm, and to M , add matrixpI1 . . . pInpO1 . . . pOm, where pI1 . . . pIn = ϕI(p) andfor 1 ≤ j ≤ m, pOj = Aj → xj such that ϕO(p)[j] =

Aj → x′j, xj = θ(x′j).3

Basic idea. H ′ simulates H by combining the rules ofeach two linked matrices in H into a single matrix in H ′.That is, for every pair of matrices (mI ,mO) such thatmI = ϕI(p),mO = ϕO(p) for some p ∈ Ψ in H, there isa matrix m = mIm

′O in H ′, where m′O is equal to mO

with all terminals removed (formally defined above). If,in H, xI ⇒ yI [p] in GI and xO ⇒ yO [p] in GO, then

3Again, this removes all terminals from the right-handside of the rules (see Theorem 1). m[j] denotes the j-thrule in matrix m.

Page 9: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 7

there is a derivation step xI θ(xO)⇒ yI θ(yO) [m] in H ′.Note that since the rules are context-free, the presence(or absence) of terminals in a sentential form does notaffect which rules we can apply. Furthermore, because thenonterminal sets NI and NO are disjoint, the sententialform in H ′ always consists of two distinct parts such thatthe first part corresponds to the derivation in GI and thesecond part to the derivation in GO.

The complete formal proof of L(H ′) = LI(H) can be foundin the thesis and in [23].

4. Synchronous Systems Based on TransducersIn formal language theory, there exist two basic transla-tion-method categories. The first category contains inter-prets and compilers, which first analyse an input stringin the source language and, consequently, they gener-ate a corresponding output string in the target language(see [2], [25], [34], [37], or [40]). The second category iscomposed of language-translation systems or, more briefly,transducers. Frequently, these trasducers consist of sev-eral components, including various automata and gram-mars, some of which read their input strings while othersproduce their output strings (see [15], [36], and [42]).

Although transducers represent language-translation de-vices, formal language theory often views them as lang-uage-defining devices and investigates the language familyresulting from them. That is, it studies their acceptingpower consisting in determining the language families ac-cepted by the transducer components that read their in-put strings. Alternatively, it establishes their generativepower that determines the language family generated bythe components that produce their strings. The presentsection contributes to this vivid investigation trend in for-mal language theory.

In this section, we introduce a new type of transducer, re-ferred to as rule-restricted (automaton-grammar) trans-ducer, based upon an FA and a CFG. We discuss thepower of this system working in an ordinary way as wellas in a leftmost way and investigate an effect of an ap-pearance checking placed into the system.

The original ideas, concepts, definitions, and theoreticalresults presented in this section were first published in [6].

4.1 Rule-Restricted TransducerThe rule-restricted (automaton-grammar) transducer is ahybrid system consisting based on a straightforward idea:we read an input sentence with an FA while generatingan appropriate output sentence with a CFG. A controlset determines which rules from the FA and the CFG canbe used simultaneously. The computation of the systemis successful if and only if the FA accepts the input stringand the CFG generates a string of terminals.

Definition 6. The rule-restricted transducer (RT) Γ is atriple Γ = (M,G,Ψ), where M = (Q,Σ, δ, q0, F ) is an FA,G = (N,T, P, S) is a CFG, and Ψ is a finite set of pairs ofthe form (r1, r2), where r1 and r2 are rules from δ and P ,respectively. A 2-configuration of Γ is a pair χ = (x, y),where x ∈ QΣ∗ and y ∈ (N ∪ T )∗. Consider two 2-con-figurations, χ = (pav1, uAv2) and χ′ = (qv1, uxv2) withA ∈ N , u, v2, x ∈ (N ∪ T )∗, v1 ∈ Σ∗, a ∈ Σ ∪ {ε}, andp, q ∈ Q. If pav1 ⇒ qv1 [r1] in M , uAv2 ⇒ uxv2 [r2] in G,

and (r1, r2) ∈ Ψ, then Γ makes a computation step fromχ′ to χ′, written as χ ⇒ χ′. In the standard way, ⇒∗and ⇒+ are transitive-reflexive and transitive closure of⇒, respectively.

The 2-language of Γ, denoted by 2-L(Γ), is defined as2-L(Γ) = {(w1, w2) : (q0w1, S) ⇒∗ (f, w2), w1 ∈ Σ∗,w2 ∈ T ∗, and f ∈ F}. From the 2-language we can de-fine two languages: L(Γ)1 = {w1 : (w1, w2) ∈ 2-L(Γ)} andL(Γ)2 = {w2 : (w1, w2) ∈ 2-L(Γ)}. By L (RT), L (RT)1,and L (RT)2, the classes of 2-languages of RTs, languagesaccepted by M in RTs, and languages generated by G inRTs, respectively, are understood.

4.1.1 Generative PowerIt is well-known that FAs and CFGs describe differentclasses of languages. Specifically, by FAs we can acceptregular languages, while CFGs define the class of context-free languages. However, in RTs, the power of the gram-mar increases due to the possibility of synchronizationwith the automaton that can dictate sequences of usablerules in the grammar. The synchronization with the au-tomaton enhances the generative power of the grammarup to the class of languages generated by MATs.

Theorem 4. L (RT)2 = L (MAT)

Proof. I. First we prove that L (MAT) ⊆ L (RT)2.

Consider a MAT I = (IG, IC) and construct an RT Γ =(ΓM, ΓG,Ψ), such that L(I) = L(Γ)2, as follows. Set

ΓG = IG. Construct ΓM = (Q,Σ, δ, s, F ) in the followingway:

1. Set F,Q = {s}.2. For every m = p1 . . . pk ∈ IC, add:

(a) k − 1 new states, q1, q2, . . . , qk−1, into Q,

(b) k new rules, r1 = s → q1, r2 = q1 → q2, . . . ,rk−1 = qk−2 → qk−1, rk = qk−1 → s, into δ,and

(c) k new pairs, (r1, p1), (r2, p2), . . . , (rk−1, pk−1),(rk, pk), into Ψ.

The FA ΓM simulates matrices in I by transitions. Thatis, if x1 ⇒ x2 [p] in I, where p = p1, . . . , pi for some i ∈ N,then there is q1, . . . , qi−1 ∈ Q such that r1 = s→ q1, r2 =q1 → q2, . . . , ri−1 = qi−2 → qi−1, ri = qi−1 → s ∈ δ and(r1, p1), . . . , (ri, pi) ∈ Ψ. Therefore, (s, x1) ⇒i (s, x2) inΓ. Similarly, if (s, x1) ⇒i (s, x2) in Γ, for i ∈ N, andthere is no j ∈ N such that 0 < j < i and (s, x1) ⇒j

(s, y) ⇒∗ (s, x2), there has to be p ∈ IC and x1 ⇒ x2 [p]in I. Hence, if (s, S)⇒∗ (s, w) in Γ, where w is a stringover the set of terminals in ΓG, then S ⇒∗ w in I; and,on the other hand, if S ⇒∗ w in I for a string over theset of terminals in IG, then (s, S) ⇒∗ (s, w) in Γ. Theinclusion L (MAT) ⊆ L (RT)2 has been proven.

II. Next, we prove the inclusion L (RT)2 ⊆ L (MAT).For any RT Γ = (ΓM, ΓG,Ψ), where ΓM = (Q,Σ, δ, s, F )and ΓG = (ΓN, ΓT, ΓP, ΓS), we can construct a MAT O =(OG,OC) such that L(Γ)2 = L(O) as follows:

1. Set OG = (ΓN∪{S′}, ΓT,OP, S′), OP = ΓP ∪{p0 =S′ → 〈s〉ΓS}, and OC = {p0}.

Page 10: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

8 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

2. For each pair (p1, p2) ∈ Ψ with p1 = qa → r, q, r ∈Q, a ∈ Σ ∪ {ε}, p2 = A → x, A ∈ ΓN and x ∈(ΓN ∪ ΓT )∗, add p1 = 〈q〉 → 〈r〉 into OP and p1p2

into OC.

3. Furthermore, for all q ∈ F , add p = 〈q〉 → ε into

OP and p into OC.

The complete formal proof of L(Γ)2 = L(H) can be foundin the thesis and in [6].

4.1.2 Accepting PowerOn the other hand, the CFG in the RT can be exploited asan additional storage space of the FA to remember somenon-negative integers. If the automaton uses the CFG inthis way, the additional storage space is akin to countersin a multi-counter machine. The following lemma saysthat the FAs in RTs are able to accept every languageaccepted by partially blind k-counter automata.

Lemma 3. For every k-PBCA I, there is an RT Γ =(M,G,Ψ) such that L(I) = L(Γ)1.

Proof. Let I = (IQ,Σ, Iδ, q0, F ) be a k-PBCA forsome k ≥ 1. Construct a RT Γ = (M = (MQ,Σ,Mδ, q0, F ),G = (N,T, P, S),Ψ) as follows:

1. Set T = ∅, Ψ = ∅, N = {S,A1, . . . , Ak}, P = {A→ε : A ∈ N}, Mδ = {f → f : f ∈ F}, and MQ = IQ.

2. For each pa→ q(t1, . . . , tk) in Iδ and for n = (Σki=1

max(0,−ti)) add:

(a) q1, . . . , qn into MQ;

(b) r = S → xS, where x ∈ (N − {S})∗ andoccur(Ai, x) = max(0, ti), for i = 1, . . . , k, intoP ;

(c) r1 = q0a→ q1, r2 = q1 → q2, . . ., rn = qn−1 →qn, rn+1 = qn → q into Mδ with q0 = p; and(ri+1, αi → ε), where αi = Aj and each Aj iserased max(0,−ti)-times during the sequence,into Ψ (n = 0 means that only pa→ q, S → xSand (r1, r) are considered);

(d) (f → f, S → ε) into Ψ for all f ∈ F .

The FA of the created system uses the CFG as an exter-nal storage. Each counter of I is represented by a non-terminal. Every step from p to q that modifies counters issimulated by several steps leading from p to q and duringthis sequence of steps the number of occurrences of eachnonterminal in the grammar is modified to be equal to thecorresponding counter in I. Clearly, L(I) = L(Γ)1.

Lemma 4 states that the CFG is helpful for the FA in RTat most with the preservation of the non-negative num-bers without possibility to check their values.

Lemma 4. For every RT Γ = (M,G,Ψ), there is a k-PBCA O such that L(O) = L(Γ)1 and k is the number ofnonterminals in G.

Proof. Let Γ = (M = (Q,Σ,Mδ, q0, F ), G = (N,T,P, S),Ψ) be an RT. Without any loss of generality, sup-pose that N = {A1, . . . , An}, where S = A1. The partially

blind card(N)-counter automaton O = (Q,Σ,Oδ, q0, F ) iscreated in the following way. For each r1 = pa→ q ∈ Mδand r2 = α → β ∈ P such that (r1, r2) ∈ Ψ, add pa →q(v1, . . . , vcard(N)), where vi = occur(Ai, β)−occur(Ai, α)for all i = 1, . . . , card(N).

The constructed partially blind card(N)-counter automa-ton has a counter for each nonterminal from the grammarof Γ. Whenever the automaton in Γ makes a step and thesentential form of the grammar G is changed, O makes thesame step and accordingly changes the number of occur-rences of nonterminals in its counters.

From Lemma 3 and Lemma 4, we can establish the fol-lowing theorem.

Theorem 5. L (RT)1 =⋃∞

k=1 L (k-PBCA)

Proof. Follows from Lemma 3 and Lemma 4.

For better illustration of the accepting and generativepower of RT, let us recall that the class of languages gen-erated by MATs is properly included in the class of RElanguages [1, 12], and the class of languages defined bypartially blind k-counter automata, with respect to num-ber of counters, is superset of the class of CF languagesand properly included in the class of CS languages [13,14].

4.2 RT with Leftmost RestrictionAlthough the investigated system is relatively powerful,in defiance of weakness of models that are used, nonde-terministic selections of nonterminals to be rewritten canbe relatively problematic from the practical point of view.Therefore, we examine an effect of a restriction in the formof leftmost derivations placed on the CFG in RT.

Definition 7. Let Γ = (M,G,Ψ) be an RT with M =(Q,Σ, δ, q0, F ) and G = (N,T, P, S). Furthermore, letχ = (pav1, uAv2) and χ′ = (qv1, uxv2) be two 2-configu-rations, where A ∈ N , v2, x ∈ (N ∪ T )∗, u ∈ T ∗, v1 ∈ Σ∗,a ∈ Σ ∪ {ε}, and p, q ∈ Q. Γ makes a computation stepfrom χ to χ′, written as χ⇒lm χ′, if and only if pav1 ⇒qv1 [r1] in M , uAv2 ⇒ uxv2 [r2] in G, and (r1, r2) ∈ Ψ. Inthe standard way, ⇒∗lm and ⇒+

lm are transitive-reflexiveand transitive closure of ⇒lm, respectively.

The 2-language of Γ with G generating in the leftmostway, denoted by 2-Llm(Γ), is defined as 2-Llm(Γ) = {(w1,w2) : (q0w1, S) ⇒∗lm (f, w2), w1 ∈ Σ∗, w2 ∈ T ∗, andf ∈ F}; we call Γ a leftmost restricted RT. Further-more, we define the languages given from 2-Llm(Γ) asLlm(Γ)1 = {w1 : (w1, w2) ∈ 2-Llm(Γ)} and Llm(Γ)2 ={w2 : (w1, w2) ∈ 2-Llm(Γ)}.

By L (RTlm), L (RTlm)1, and L (RTlm)2, we understandthe following language classes, respectively: 2-languagesof leftmost restricted RTs, languages accepted by M inleftmost restricted RTs, and languages generated by G inleftmost restricted RTs.

4.2.1 Generative PowerUnfortunately, the price for the leftmost restriction, placedon derivations in the CFG, is relatively high and both ac-cepting and generative ability of RT with the restrictiondecreases to the definition of context-free languages.

Page 11: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 9

Theorem 6. L (RTlm)2 = CF

Proof. The inclusion CF ⊆ L (RTlm)2 is clear fromthe definition, because any time we can construct leftmostrestricted RT, where the automaton M cycles with readingall possible symbols from the input or ε whilst the grammarG is generating some output string. Therefore, we onlyneed to prove the opposite inclusion.

We know that the class of context-free languages is de-fined, inter alia, by nondeterministic PDAs. It is there-fore sufficient to prove that every language Llm(Γ)2 ofRT can be accepted by a nondeterministic PDA. Consideran RT Γ = (ΓM = (Q, ΓΣ, Γδ, q0, F ), G = (N,T, P, S),Ψ)and define a PDA O = (Q,T,OΓ,Oδ, q0, S, F ), where OΓ =N ∪ T and Oδ is created as follows:

1. Set Oδ = ∅.2. For each r1 = A → x ∈ P and r2 = pa → q ∈ Γδ

such that (r1, r2) ∈ Ψ, add Ap→ (x)Rq into Oδ.

3. For each p ∈ Q, and a ∈ T add apa→ p into Oδ.

The complete formal proof of L(O) = Llm(Γ)2 can befound in the thesis and in [6].

As L(O) ⊆ Llm(Γ)2 and Llm(Γ)2 ⊆ L(O), Theorem 6holds.

4.2.2 Accepting PowerFirst, we show that any context-free language can be ac-cepted by some leftmost restricted RT.

Lemma 5. For every language L ∈ CF, there is an RTΓ = (M,G,Ψ) such that Llm(Γ)1 = L.

Proof. Let I = (IN,T, IP, S) be a CFG such thatL(I) = L. We construct a CFG H = (HN,T,HP, S),where HN = IN∪{〈a〉 : a ∈ T} and HP = {〈a〉 → a : a ∈T} ∪ {A → x : A → x′ ∈ IP and x is created from x′ byreplacing all a ∈ T in x′ with 〈a〉}. Surely, L(I) = L(H)even if H replaces only the leftmost nonterminals in eachderivation step. In addition, we construct an FA M =({q0}, T, δ, q0, {q0}) with δ = {q0 → q0}∪{q0a→ q0 : a ∈T}, and Ψ = {(q0 → q0, A → x) : A → x ∈ HP,A ∈IN} ∪ {(q0a→ q0, 〈a〉 → a) : a ∈ T}.

It is easy to see that any time when H replaces nonter-minals from IN in its sentential form, M reads no in-put symbol. If and only if H replaces 〈a〉 with a, wherea ∈ T , then M reads a from the input. Since H works ina leftmost way, 2-Llm(Γ) = {(w,w) : w ∈ L(I). Hence,Llm(Γ)1 = L(I).

Similarly, we show that any RT generating outputs in theleftmost way can recognize no language out of CF.

Lemma 6. Let Γ is an RT. Then, for every languageLlm(Γ)1, there is a PDA O such that Llm(Γ)1 = L(O).

Proof. In the same way as in the proof of Theorem4, we construct PDA O such that L(O) = Llm(Γ)1 forRT Γ = (M = (Q, ΓΣ, Γδ, q0, F ), G = (N,T, P, S),Ψ).We define O as O = (Q, ΓΣ, N,Oδ, q0, S, F ), where Oδ iscreated in the following way:

1. Set Oδ = ∅.

2. For each r1 = pa → q ∈ Γδ and r2 = A → x ∈ Psuch that (r1, r2) ∈ Ψ, add Apa → (θ(x))Rq into

Oδ, where θ(x) is a function from (N ∪ T )∗ to N∗

that replaces all terminal symbols in x with ε—thatis, θ(x) is x without terminal symbols.4

The complete formal proof of L(O) = Llm(Γ)2 can befound in the thesis and in [6].

Theorem 7. L (RTlm)1 = CF

Proof. Follows from Lemma 5 and Lemma 6.

4.3 RT with Appearance CheckingWe can also extend RT with the possibility to prefer a ruleover another—that is, the restriction sets contain triplesof rules (instead of pairs of rules), where the first rule isa rule of FA, the second rule is a main rule of CFG, andthe third rule is an alternative rule of CFG, which is usedonly if the main rule is not applicable.

Definition 8. RT with appearance checking (RTac forshort) Γ is a triple Γ = (M,G,Ψ), where

• M = (Q,Σ, δ, q0, F ) is an FA,

• G = (N,T, P, S) is a CFG, and

• Ψ is a finite set of triples of the form (r1, r2, r3) suchthat r1 ∈ δ and r2, r3 ∈ P .

Let χ = (pav1, uAv2) and χ′ = (qv1, uxv2), where A ∈ N ,v2, x, u ∈ (N ∪ T )∗, v1 ∈ Σ∗, a ∈ Σ ∪ {ε}, and p, q ∈Q, be two 2-configurations. Γ makes a computation stepfrom χ to χ′, written as χ ⇒ χ′, if and only if for some(r1, r2, r3) ∈ Ψ, pav1 ⇒ qv1 [r1] in M , and either

• uAv2 ⇒ uxv2 [r2] in G, or

• uAv3 ⇒ uxv2 [r3] in G and r2 is not applicable onuAv2 in G.

The 2-language 2-L(Γ) and languages L(Γ)1, L(Γ)2 aredefined in the same way as in Definition 6. The classes oflanguages defined by the first and the second componentin the system is denoted by L (RTac)1 and L (RTac)2,respectively.

4.3.1 Generative PowerBy the appearance checking both generative and accept-ing power of RT grow to define the class of all recursivelyenumerable languages. To prove that the former holds,we take advantage of the known fact that matrix gram-mars with appearance checking can generate any languagein RE [12], and show that, in turn, RTac can simulateMATac.

Theorem 8. L (RTac)2 = RE

4See page 5 for further explanation and precise formaldefinition of θ (Definition 3).

Page 12: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

10 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

Proof. Since L (MATac) = RE [12], we only need toprove that L (MATac) ⊆ L (RTac)2.

Consider a MATac I = (IG, IC) and construct a RT Γ =(ΓM, ΓG,Ψ), such that L(I) = L(Γ)2, as follows:

1. Set ΓG = IG.

2. Add a new initial nonterminal S′, nonterminal ∆,and rules ∆ → ∆, ∆ → ε, S′ → S∆ into grammar

ΓG.

3. Construct an FA ΓM = (Q,Σ, δ, s, F ) and Ψ in thefollowing way:

(a) Set F = Q = {s}, δ = {s → s}, and Ψ ={(s → s,∆ → ε,∆ → ε), (s → s, S′ → S∆,S′ → S∆)}.

(b) For every m = (p1, t1) . . . (pk, tk) ∈ IC, addq1, q2, . . . , qk−1 into Q, s → q1, q1 → q2, . . . ,qk−2 → qk−1, qk−1 → s into δ, and (s→ q1, p1,c1), (q1 → q2, p2, c2), . . . , (qk−2 → qk−1, pk−1,ck−1), (qk−1 → qs, pk, ck) into Ψ, where, for1 ≤ i ≤ k, if ti = −, then ci = pi; otherwise,ci = ∆→ ∆.

Since S′ is the initial symbol, the first computation stepin Γ is (s, S′) ⇒ (s, S∆). After this step, the FA sim-ulates matrices in I by computation step. That is, ifx1 ⇒ x2 [p] in I, where p = p1, . . . , pi for some i ∈ N,then there is q1, . . . , qi−1 ∈ Q such that r1 = s→ q1, r2 =q1 → q2, . . . , ri−1 = qi−2 → qi−1, ri = qi−1 → s ∈ δand (r1, p1, c1), . . . , (ri, pi, ci) ∈ Ψ. Therefore, (s, x1) ⇒i

(s, x2) in Γ. Notice that if I can overleap some grammarrule in m ∈ IC, Γ represents the fact by using ∆ → ∆with the move in ΓM . Similarly, if, for some i ∈ N,(s, x1) ⇒i (s, x2) in Γ and there is no j < i such that(s, x1) ⇒j (s, y) ⇒∗ (s, x2), there exists p ∈ IC suchthat x1 ⇒ x2 [p] in I. Hence, if (s, S) ⇒∗ (s, w) inΓ, where w is a string over the set of terminals in ΓG,then S ⇒∗ w in I; and, on the other hand, if S ⇒∗ win I for a string over the set of terminals in IG, then(s, S′)⇒ (s, S∆)⇒∗ (s, w∆)⇒ (s, w) in Γ.

4.3.2 Accepting PowerRTac’s can accept any recursively enumerable language,as evidenced by their ability to simulate k-CAs.

Theorem 9. L (RTac)1 = RE

Proof. Let I = (IQ,Σ, Iδ, q0, F ) be a k-CA for somek ≥ 1 and construct a RT Γ = (M,G,Ψ), where M =(MQ,Σ,Mδ, q0, F ), G = (N,T, P, S), as follows:

1. Set T = {a},Ψ = ∅, P = {A → ε,A → ♦ : A ∈N − {♦}} ∪ {S → S}, MQ = IQ, Mδ = {f →f : f ∈ F}, and N = {S,♦, A1, . . . , Ak}.

2. For each pa → q(t1, . . . , tk) in Iδ, n = Σki=1 θ(ti),

and m = Σki=1θ(ti), where if ti ∈ Z, θ(ti) = max(0,

−ti) and θ(ti) = max(0, ti); otherwise θ(ti) = 1 and

θ(ti) = 0, add:

(a) q1, . . . , qn into MQ;

(b) r = S → xS, where x ∈ (N − {S,♦})∗ and

occur(Ai, x) = θ(ti), for each i = 1, . . . , k, intoP ;

(c) r1 = q0a→ q1, r2 = q1 → q2, . . ., rn = qn−1 →qn, rn+1 = qn → q into Mδ with q0 = p; andfor each i = 1, . . . , n, add (ri+1, τi, τ

′i), where

for each j = 1, . . . , k, if tj ∈ N, for θ(tj) is,τi = τ ′i = Aj → ε; otherwise, if tj = −, τi =Aj → ♦ and τ ′i = S → S, into Ψ. Notice thatn = 0 means that only q0a → q, S → xS areconsidered. Furthermore, add (r1, r, r) into Ψ;

(d) (f → f, S → ε, S → ε) into Ψ for all f ∈ F .

Similarly as in the proof of Lemma 3, the FA of the cre-ated system uses the CFG as an external storage, and eachcounter of I is represented by a nonterminal. If I mod-ifies some counters during a move from state p to stateq, M moves from p to q in several steps during which itchanges the numbers of occurrences of nonterminals cor-respondingly. Rules applicable only if some counters areequal to zero are simulated by using an appearance check-ing, where Γ tries to replace all nonterminals representingcounters which have to be 0 by ♦. If it is not possible, Γapplies the rule S → S and continues with computation.Otherwise, since ♦ cannot be rewritten during the rest ofcomputation, the use of such rules leads to an unsuccess-ful computation. The formal proof of the equivalence oflanguages is left to the reader. Since L (k-CA) = RE forevery k ≥ 2 [17], Theorem 9 holds.

5. Lingustic Applications: PerspectivesIn this section, we discuss the advantages of the new for-mal models in regard to their potential applications innatural language processing, and particularly in transla-tion. To illustrate, we use examples from Czech, English,and Japanese. (No prior knowledge of Czech or Japaneseis required for understanding, although it can be an ad-vantage.)

Throughout the course of this section, we use the follow-ing notation to represent some common linguistic con-stituents:

ADJ adjectiveADV adverbAUX auxiliary verbDET determinerN nounNP noun phraseNP-SBJ noun phrase in the role of subjectNUM numeralP prepositionPP prepositional phrasePP-T prepositional phrase, temporalPP-D prepositional phrase, directionalV verbVP verb phrase

Further, note that in the example sentences presentedbelow, we generally disregard punctuation and capital-ization. For example, we consider Where are you going?and where are you going identical for the purposes of thistext.

Page 13: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 11

Finally, in most of the case studies presented in this sec-tion, we assume that we already have the input sentencesplit into words (or possibly some other lexical units asappropriate), and these words are classified as, for exam-ple, a noun, pronoun, or verb. Then, we consider syntaxanalysis and translation on an abstract level, transform-ing syntactic structures in languages rather than actualmeanings.

Often, you will notice that the input alphabet of the au-tomaton or the terminal alphabet of the grammar do notcontain actual words themselves, but rather symbols rep-resenting word categories and properties. For example,we can use N3s to denote a noun in third person singular.While such representation is sufficient in our exampleshere, where, for clarity, we usually only focus on someselect aspects at a time, in practice we need much moreinformation about each word. In that case, we can, for in-stance, use structures resembling attribute-value matricesfrom head-driven phrase structure grammars as symbols.

5.1 Synchronous GrammarsFirst, we explore the application perspectives of our newlyintroduced synchronous grammars, or more precisely, syn-chronous versions of MATs and SCGs. The original re-sults, observations, and examples presented in this sectionwere published in [21] and [23].

To demonstrate the basic principle, let us consider a sim-ple Japanese sentence Takeshi-san wa raishuu Oosaka niikimasu. We will transform this sentence (or, more pre-cisely, the structure of this sentence) into its English coun-terpart Takeshi is going to Osaka next week.

In the following examples, words in angled brackets (〈〉)are words associated with a terminal or nonterminal sym-bol in a given sentence or structure. Note that this isincluded only to make the examples easier to follow andunderstand, and is not an actual part of the formalismitself.

Consider a RSCFG H = (GI , GO,Ψ, ϕI , ϕO), where GI =(NI , TI , PI , SI) and GO = (NO, TO, PO, SO) such that

• NI = {SI , NP-SBJ, VP, PP-T, PP-D},

• TI = {NP, V, DET},

• NO = {SO, NP-SBJ, VP, PP-T, PP-D},

• TO = {NP, V, AUX, DET, P},

• PI =

1 : SI → NP-SBJ VP,2 : NP-SBJ → NP DET〈wa〉,3 : VP → PP-T PP-D V,4 : PP-T → NP,

4z : PP-T → ε,5 : PP-D → NP DET〈ni〉,

5z : PP-D → ε

,

• PO =

1 : SO → NP-SBJ VP,2 : NP-SBJ → NP,3 : VP → AUX V PP-D PP-T,4 : PP-T → NP,

4z : PP-T → ε,5 : PP-D → P〈to〉 NP,

5z : PP-D → ε

.

Strictly according to their definitions, synchronous gram-mars generate pairs of sentences. However, in practice,we usually have the input sentence in the source language,and we want to translate it into the target language. Thatis, we want to generate the corresponding output sen-tence. In that case, the translation can be divided intotwo steps as follows.

1. First, we parse the input sentence using the inputgrammar. In GI , a derivation that generates theexample sentence may proceed as follows:

SI ⇒ NP-SBJ VP [1]⇒ NP〈Takeshi-san〉 DET〈wa〉 VP [2]⇒ NP〈Takeshi-san〉 DET〈wa〉 PP-T PP-D

V〈ikimasu〉 [3]⇒ NP〈Takeshi-san〉 DET〈wa〉 NP〈raishuu〉

PP-D V〈ikimasu〉 [4]⇒ NP〈Takeshi-san〉 DET〈wa〉 NP〈raishuu〉

NP〈Oosaka〉 DET〈ni〉 V〈ikimasu〉 [5]

We have applied rules denoted by labels 1 2 3 4 5,in that order.

2. Next, we use the sequence obtained in the first step(1 2 3 4 5), and apply the corresponding rules inthe output grammar. Then, the derivation in GO

proceeds as follows:

SO ⇒ NP-SBJ VP [1]⇒ NP〈Takeshi〉 VP [2]⇒ NP〈Takeshi〉 AUX〈is〉 V〈going〉 PP-D

PP-T [3]⇒ NP〈Takeshi〉 AUX〈is〉 V〈going〉 PP-D

NP〈next week〉 [4]⇒ NP〈Takeshi〉 AUX〈is〉 V〈going〉 P〈to〉

NP〈Osaka〉 NP〈next week〉 [5]

Also note the rules 4z and 5z (in both input and outpurgrammar), which can be used to erase PP-T and PP-D.This represents the fact that these constituents may beomitted.

The full thesis further elaborates upon this example, demon-strating different grammatical categories and syntacticstructures.

Let us now consider translation between Czech and En-glish. Czech is a relatively challenging language in termsof natural language processing. It is a free-word-orderlanguage with rich inflection (see [16]).

For example, consider the Czech sentence Dva ruzovı sloniprisli na prednasku. (Two pink elephants came to thelecture.) All of the following permutations of words alsomake for a valid sentence:

dva ruzovı sloni prisli na prednaskudva ruzovı sloni na prednasku prisliruzovı sloni prisli na prednasku dvaruzovı sloni na prednasku prisli dvadva sloni prisli na prednasku ruzovıdva sloni na prednasku prisli ruzovısloni prisli na prednasku dva ruzovısloni na prednasku prisli dva ruzovı

Page 14: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

12 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

S

NP VP

NUM ADJ N V PP

dva ruzovı sloni prisli na prednasku

S

NP VP

ADJ N V PP NUM

ruzovı sloni prisli na prednasku dva

Figure 1: Syntax trees for example sentences inCzech

S

NP VP NUM

ADJ N V PP

ruzovı sloni prisli na prednasku dva

Figure 2: Modified syntax tree

There may be differences in meaning or emphasis, but thesyntactic structure remains the same. Why is this prob-lematic? Compare the syntax trees in Figure 1. Becauseof the crossing branches (non-projectivity), the secondtree cannot be produced by any CFG. Of course, it is stillpossible to construct a CFG that generates the sentenceruzovı sloni prisli na prednasku dva if we consider a differ-ent syntax tree, for example such as in Figure 2. However,this tree no longer captures the relation between the nounsloni and its modifying numeral dva (represented by thedotted line). We need to know this relation for instanceto ensure agreement between the words (person, number,gender. . . ), so that we can choose their appropriate forms.

In a purely context-free framework, this can be compli-cated. The necessary information has to be propagatedthrough the derivation tree, even if the structure is notactually affected, and this can result in a high number ofrules. Recall that in generalized phrase structure gram-mars, for instance, this is countered by the introductionof metarules and features. With MATs, we can insteadrepresent the relations using matrices.

Here, we present an example of SMAT H = (Gcz,Mcz,Gen,Men,Ψ, ϕcz, ϕen) that describes the translations be-tween the English sentence two pink elephants came to the

lecture and any of the above Czech sentences, correctlydistinguishing between male and female gender in Czech(to demonstrate female gender, we also include opice inCzech, monkeys in English). Note that H is actually moregeneral (for example allowing multiple adjectives). It isdesigned for easy extension to include other grammati-cal categories (person. . . ) as well as different syntacticstructures.

For Czech, let Gcz contain the following context-free rules(nonterminals are in capitals, Scz is the start symbol):

s : Scz → NP VP NUM ADJS,np : NP → NUM ADJS N,vp : VP → ADVS V ADVS,

numε : NUM → ε,adjs : ADJS → ADJ ADJS,

adjsε : ADJS → ε,advs : ADVS → ADV ADVS,

advsε : ADVS → ε,nm : N → Nm,nf : N → Nf ,

nmm : Nm → Nm,nff : Nf → Nf ,vm : V → Vm,vf : V → Vf ,

adjm : ADJ → ADJm,adjf : ADJ → ADJf ,adv : ADV → PP,

numm : NUM → NUMm,numf : NUM → NUMf ,dict1 : Nm → sloni ,dict2 : Nf → opice,

dict3m : Vm → prisli ,dict3f : Vf → prisly ,dict4m : ADJm → ruzovı,dict4f : ADJf → ruzove,dict5m : NUMm → dva,dict5f : NUMf → dve,dict6 : PP → na prednasku

Similarly, for English, let Gen contain the following rules(again, nonterminals are in capitals, and Sen is the startsymbol):

s : Sen → NP VP,np : NP → NUM ADJS N,vp : VP → V ADVS,

numε : NUM → ε,adjs : ADJS → ADJ ADJS,

adjsε : ADJS → ε,advs : ADVS → ADV ADVS,

advsε : ADVS → ε,adv : ADV → PP,

dict1 : N → elephants,dict2 : N → monkeys,dict3 : V → came,dict4 : ADJ → pink ,dict5 : NUM → two,dict6 : PP → to the lecture

Page 15: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 13

Finally, let Mcz and Men contain the following matrices:

Mcz Men

s : s snp : np npvp : vp vp

num : numε εnumε : numε numε numε

adjs : adjs adjsadjsε : adjsε adjsε adjsεadvs : advs advs

advsε : advsε advsε advsεnm : nm εnf : nf εvm : vm nmm εvf : vf nff ε

adjm : adjm nmm εadjf : adjf nff εadv : adv adv

numm : numm nmm εnumf : numf nff εdict1 : dict1 dict1

dict2 : dict2 dict2

dict3m : dict3m dict3

dict3f : dict3f dict3

dict4m : dict4m dict4

dict4f : dict4f dict4

dict5m : dict5m dict5

dict5f : dict5f dict5

dict6 : dict6 dict6

In this example, we have chosen to include the wordsthemselves directly in the grammar rules (rather than as-suming a separate dictionary) to illustrate this approachas well. For instance, consider the rule dict5m in Gcz.This rule encodes the fact that the word dva (in Czech) isa numeral, of male gender (in practice, there can be muchmore information). We call this kind of rules dictionaryrules.

Further, note for example the matrix adjf in Mcz, whichensures agreement between noun and adjective (both mustbe in female gender). Another interesting matrix is adjsε,which terminates generation of adjectives. In the Czechsentence in this example, we have two positions where ad-jectives can be placed (directly within the noun phrase orat the end of the sentence). In English, there is only onepossible position (within the noun phrase). This is whythe rule ADJS → ε is used twice in Czech, but only oncein English.

Also observe that the linked matrices (sharing the samelabel) in Mcz and Men may contain completely differ-ent rules and they can even be empty (ε), in which casethe corresponding grammar does not change its sententialform in that step. The definitions of MAT and SMATallow for this kind of flexibility when describing both in-dividual languages and their translations.

Example of a derivation in Czech follows next.

Scz ⇒ NP VP NUM ADJS [s]⇒ NUM ADJS N VP NUM ADJS [np]⇒ NUM ADJS N ADVS V ADVS NUM ADJS

[vp]⇒ ADJS N ADVS V ADVS NUM ADJS [num]

⇒ ADJ ADJS N ADVS V ADVS NUM ADJS[adjs]

⇒ ADJ N ADVS V ADVS NUM [adjsε]⇒ ADJ N ADVS V ADV ADVS NUM [advs]⇒ ADJ N V ADV NUM [advsε]⇒ ADJ Nm V ADV NUM [nm]⇒ ADJ Nm Vm ADV NUM [vm]⇒ ADJm Nm Vm ADV NUM [adjm]⇒ ADJm Nm Vm PP NUM [adv ]⇒ ADJm Nm Vm PP NUMm [numm]⇒ ADJm sloni Vm PP NUMm [dict1]⇒ ADJm sloni prisli PP NUMm [dict3m]⇒ ruzovı sloni prisli PP NUMm [dict4m]⇒ ruzovı sloni prisli na prednasku NUMm

[dict5]⇒ ruzovı sloni prisli na prednasku dva [dict6m]

The corresponding derivation in English may look likethis:

Sen ⇒ NP VP [s]⇒ NUM ADJS N VP [np]⇒ NUM ADJS N V ADVS [vp]⇒ NUM ADJS N V ADVS [num]⇒ NUM ADJ ADJS N V ADVS [adjs]⇒ NUM ADJ N V ADVS [adjsε]⇒ NUM ADJ N V ADV ADVS [advs]⇒ NUM ADJ N V ADV [advsε]⇒ NUM ADJ N V ADV [nm]⇒ NUM ADJ N V ADV [vm]⇒ NUM ADJ N V ADV [adjm]⇒ NUM ADJ N V PP [adv ]⇒ NUM ADJ N V PP [numm]⇒ NUM ADJ elephants Vm PP [dict1]⇒ NUM ADJ elephants came PP [dict3m]⇒ NUM pink elephants came PP [dict4m]⇒ NUM pink elephants came to the lecture

[dict5]⇒ two pink elephants came to the lecture

[dict6m]

The entire derivation tree for the Czech sentence is shownin Figure 3. The dotted lines represent relations describedby matrices. The triangle from Nm to Nm is an abstrac-tion which in this particular case essentially means thatthis step is repeated until all agreement issues are re-solved.

We can achieve similar results using SSCGs. For exam-ple the matrix adjf in Mcz can be represented by twoscattered-context rules (ADJ, Nf ) → (ADJf , Nf ) and(Nf , ADJ) → (Nf , ADJf ). Note that we need two rules,because the nonterminal order is important in SCG (thisis one of the key differences between SMAT and SSCG).In this case, we need an additional rule in SSCG. How-ever, this can also be an advantage, because it allows us toeasily distinguish between left and right modifiers. For ex-ample, if we only have the first rule (ADJ, Nf )→ (ADJf ,Nf ), it means that the adjective always has to occur onthe left of the noun.

5.2 Rule-Restricted TransducersWith RTs, we can also represent the relations discussedin the above example. For instance, we can use the statesof FA to store the information about gender (as well asother grammatical categories).

Page 16: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

14 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

S

NP VP NUM ADJS

NUM ADJS N ADVS V ADVS ε

ε ADJ ADJS Nm ε ADV ADVS

ADJm ε Nm Vm PP ε NUMm

ruzovı sloni prisli na prednasku dva

Figure 3: Derivation tree of Gcz

Further case studies of the application perspectives of RTscan be found in the full thesis and in [6].

5.3 SummaryIn this section, we summarize the key advantages of theproposed models and compare the respective strengthsand weaknesses of the new synchronous grammars andRTs. The observations presented are based on our previ-ously published papers [6], [21], and [23].

One of the main advantages of both types of models istheir power. As shown in Sections 3 and 4, both syn-chronous grammars (with linked rules) and RTs (withoutleftmost restriction) are able to describe even some non-context-free languages. Although arguably relatively rarein practice, there are some features of natural languagesthat are difficult or impossible to properly capture withCFGs only (such as cross-dependencies). Furthermore,even in cases when a purely context-free description ispossible, it may require a high number of rules. Our newmodels can provide a more economical description thanksto their increased generative power and, in case of RTs,also accepting power.

Another advantage of our new synchronous grammars istheir high flexibility, especially if we synchronize mod-els that have higher generative power themselves, suchas regulated grammars. In particular, let us consider thecase of SMAT. As shown above (Theorem 3), if we syn-chronize MATs in the proposed fashion, we do not ob-tain any further increase in power of the whole systemcompared to RSCFG or MAT. However, more powerfulindividual components allow for easier—and again, moreeconomical—description of each individual language.

Unlike synchronous grammars, which are symmetric andtherefore can be used for bidirectional translation, RTscan only describe translation in one direction. Further-more, because their components are relatively simple (anFA and a CFG), RTs are also less flexible than, for exam-ple, SMATs and SSCGs. Consequently, the descriptionof linguistic structures and features can be more complex(essentially, requiring more rules).

On the other hand, the simplicity of components can alsobe seen as an important advantage of RT, especially froma practical viewpoint. Both FAs and CFGs are well-known and well-studied not only from a theoretical pointof view, but also with regards to practical implementa-tions. For example, there are well-known methods of effi-cient parsing for CFGs.

Another advantage of RT lies in its the straightforwardand intuitive basic principle (read input with an FA, gen-erate output with a CFG), which directly correspondsto the translation task in practice. In contrast, in syn-chronous grammars, both components generate sentences.

Finally, note that both types of introduced formal modelscan be extended for use in statistical natural processingas well. We can, for example, assign weights (or probabil-ities) to rules similarly to probabilistic CFGs or weightedsynchronous grammars.

6. ConclusionIn this doctoral thesis, we have presented new grammarsystems that can formally describe translations (or, morespecifically, transformations of syntactic structures). Wehave discussed some of the theoretical properties of thenew models, in particular their generative and acceptingpower.

More specifically, we have introduced the idea of synchro-nization based on linked rules as a modification of thewell-known synchronous grammars. We have extendedthis principle beyond CFGs, to models with regulatedrewriting, defining sychronous MATs and synchronousSCGs.

Further, we have introduced the rule-restricted automaton-grammar transducer, based on the natural idea of readingsome input with an FA and producing an appropriate out-put with a CFG, and provided precise formal definitons.We have also considered two of its variants, namely left-most restricted RTs and RTs with appearance checking.

Page 17: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 1-16 15

We have established the following main results:

1. Rule-synchronized CFGs are more powerful thanCFGs, as they characterize the same class of lan-guages as MATs (see Section 3.1).

2. Synchronous MATs have the same power as MATs(see Section 3.3).

3. Synchronous SCGs are able to generate all recur-sively enumerable languages (see Section 3.2).

4. RTs can generate any language that can be gener-ated by some MAT, and they can accept any lan-guage that can be accepted by some k-PBCA (seeSection 4.1).

5. Leftmost restricted RTs can only accept and gener-ate context-free languages (see Section 4.2). Notethat this is still an increase in accepting power com-pared to FAs.

6. RTs with appearance checking can both accept andgenerate all recursively enumerable languages (seeSection 4.3).

We have also discussed application perspectives of the newmodels in translation of natural languages, using selectcase studies from Czech, English, and Japanese to illus-trate (see Section 5). Besides natural language processing,the models can be useful in other translation and transfor-mation tasks, such as programming language compilation.

6.1 Further Research ProspectsFurther research prospects include the study of other the-oretical properties of the proposed models, such as de-scriptional complexity. Although we have already shownwhich language classes our new models define, how effi-ciently they can do so remains an open problem. Thatis, we can investigate the effects of different limits placedon, for example, the number of nonterminal symbols ingrammars, states in automata, or rules in both. In MATs,we can also limit the length of matrices, and similarly inSCGs, the length of scattered context rules (as sequencesof context-free rules).

As we have done with RTs by introducing an appearancechecking and a leftmost restriction, we can consider othervariants of our models and investigate their properties.For example, we could restrict SSCGs by using propagat-ing SCGs (which are known to be strictly weaker thanSCGs with erasing rules). We can also introduce andstudy systems consisting of other well-known grammarsand automata.

Extension to more than two components is possible aswell. In such case, we could further investigate the rela-tions to known grammar systems (see [10], [31], or [33])and automata systems (see [7], [11], or [28]).

Finally, note that although our synchronous grammarsand RTs represent different approaches and, consequently,are defined differently, there is a significant similarity intheir basic principles. In essence, they are all systems inwhich the cooperation of components is achieved by syn-chronization of their rules. It might be useful to introduce

a more general formalism allowing for various compo-nents, and thus encompassing all such rule-synchronizedsystems.

From a more practical viewpoint, an important area toinvestigate is syntax analysis. For practical applications,we need to be able to parse sentences efficiently. Thereare well-known parsing methods for CFGs, such as (gener-alized) LR parsing or chart parsing, but for models withregulated rewriting, the situation is more complicated.While there have been some research in this area, partic-ularly for SCGs (see [24] or [38]), efficient parsing withmatrix grammars and scattered context grammars stillrepresents an open problem.

In the examples presented in this work, we have made twoimportant assumptions. First, we already have the inputsentence analysed on a low level—that is, we know whereevery word starts and ends (which may be a non-trivialproblem in itself in some languages, such as Japanese)and have some basic grammatical information about it.Furthermore, we assume that we know the translation ofthe individual words.

For practical applications in natural language translation,we would need a more complex system, with at least twoother components: a part-of-speech tagger (lexical ana-lyzer), and a dictionary to translate the actual meaningsof the words (although we can do this directly within agrammar by using dictionary rules, a separate dictionarygenerally allows for more efficient encoding). Then, thecomponent based on the discussed formal models couldbe used to transform the syntactic structure of a sentenceand ensure that the words in the translated sentence arein the correct form.

Acknowledgements. This work was supported by theFR97/2011/G1, CZ.1.05/1.1.00/02.0070, FIT-S-10-2, andFIT-S-11-2 grant projects and by the MSM0021630528research plan.

References[1] S. Abraham. Some questions of language theory. In Proceedings

of the 1965 conference on Computational linguistics, COLING’65, pages 1–11, Stroudsburg, PA, USA, 1965. Association forComputational Linguistics.

[2] A. V. Aho. Compilers: Principles, Techniques, and Tools.Pearson/Addison Wesley, 2007.

[3] A. V. Aho and J. D. Ullman. Syntax directed translations and thepushdown assembler. J. Comput. Syst. Sci., 3(1):37–56, Feb. 1969.

[4] J. Allen. Natural language understanding (2nd edition).Benjamin/Cummings series in computer science.Benjamin/Cummings Pub. Co., 1995.

[5] O. Bojar and M. Cmejrek. Mathematical model of treetransformations. In Project Euromatrix Deliverable 3.2, Prague,2007. Charles University.

[6] M. Cermák, P. Horácek, and A. Meduna. Rule-restrictedautomaton-grammar transducers: Power and linguisticapplications. Mathematics for Applications, 1(1):13–35, 2012.

[7] M. Cermák and A. Meduna. n-accepting restricted pushdownautomata systems. In 13th Int. Conference on Automata andFormal Languages, pages 168–183. Computer and AutomationResearch Institute, Hungarian Academy of Sciences, 2011.

[8] D. Chiang. An introduction to synchronous grammars. In 44thAnnual Meeting of the Association for Computational Linguistics,2006.

[9] D. Chiang. Grammars for Language and Genes: Theoretical andEmpirical Investigations. Theory and applications of naturallanguage processing. Springer, 2011.

Page 18: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

16 Horacek, P.: Synchronous Formal Systems Based on Grammars and Transducers

[10] E. Csuhaj-Varju, J. Kelemen, G. Paun, and J. Dassow, editors.Grammar Systems: A Grammatical Approach to Distribution andCooperation. Gordon and Breach Science Publishers, Inc.,Newark, NJ, USA, 1st edition, 1994.

[11] E. Csuhaj-Varjú, C. Martín-Vide, V. Mitrana, and G. Vaszil.Parallel communicating pushdown automata systems. Int. J.Found. Comput. Sci., 11(4):633–650, 2000.

[12] J. Dassow and G. Paun. Regulated Rewriting in Formal LanguageTheory. Springer-Verlag, Berlin, 1989.

[13] S. Ginsburg. Algebraic and Automata-Theoretic Properties ofFormal Languages. Elsevier Science Inc., New York, NY, USA,1975.

[14] S. A. Greibach. Remarks on blind and partially blind one-waymulticounter machines. Theor. Comput. Sci., 7:311–324, 1978.

[15] E. M. Gurari and O. H. Ibarra. A note on finite-valued and finitelyambiguous transducers. Theory of Computing Systems, 16:61–66,1983. 10.1007/BF01744569.

[16] J. Hajic. Disambiguation of Rich Inflection: ComputationalMorphology of Czech. Wisconsin Center for Pushkin Studies.Karolinum, 2004.

[17] J. E. Hopcroft, R. Motwani, and J. D. Ullman. Introduction toAutomata Theory, Languages, and Computation. Addison Wesley,2000.

[18] P. Horácek. Formal models in processing of japanese language. InProceedings of the 16th Conference and Competition STUDENTEEICT 2010 Volume 5, pages 161–165. Brno University ofTechnology, 2010.

[19] P. Horácek. Parse driven translation. In Proceedings of the 17thConference and Competition STUDENT EEICT 2011 Volume 3,pages 480–484. Brno University of Technology, 2011.

[20] P. Horácek. On generative power of synchronous grammars withlinked rules. In Proceedings of the 18th Conference STUDENTEEICT 2012 Volume 3, pages 376–380. Brno University ofTechnology, 2012.

[21] P. Horácek. Application perspectives of synchronous matrixgrammars. In Proceedings of the 19th Conference STUDENTEEICT 2013 Volume 3, pages 202–206. Brno University ofTechnology, 2013.

[22] P. Horácek and A. Meduna. Regulated rewriting in naturallanguage translation. In 7th Doctoral Workshop on Mathematicaland Engineering Methods in Computer Science, pages 35–42,Brno, CZ, 2011. Brno University of Technology.

[23] P. Horácek and A. Meduna. Synchronous versions of regulatedgrammars: Generative power and linguistic applications.Theoretical and Applied Informatics, 24(3):175–190, 2012.

[24] O. Jirák and D. Kolár. Comparison of classical and lazy approachin scg compiler. In NUMERICAL ANALYSIS AND APPLIEDMATHEMATICS ICNAAM 2011: International Conference onNumerical Analysis and Applied Mathematics, volume 1389,pages 873–876. American Institute of Physics, 2011.

[25] O. Jirák and Z. Krivka. Design and implementation of back-endfor picoblaze c compiler. In Proceedings of the IADISInternational Conference Applied Computing 2009, pages135–138. International Association for Development of theInformation Society, 2009.

[26] M. Khalilov and J. A. R. Fonollosa. N-gram-based statisticalmachine translation versus syntax augmented machine translation:comparison and system combination. In Proc. of the 12th Conf. ofthe European Chapter of the Association for ComputationalLinguistics, EACL ’09, pages 424–432, Stroudsburg, PA, USA,2009. Association for Computational Linguistics.

[27] P. M. Lewis and R. E. Stearns. Syntax-directed transduction. J.ACM, 15(3):465–488, July 1968.

[28] C. Martín and V. Mitrana. Parallel communicating automatasystems. Journal of Applied Mathematics and Computing, pages237–257, 2008.

[29] A. Meduna. A trivial method of characterizing the family ofrecursively enumerable languages by scattered context grammars.EATCS Bulletin, 1995(56):1–3, 1995.

[30] A. Meduna. Automata and Languages: Theory and Applications.Springer, London, 2000.

[31] A. Meduna and R. Lukáš. Multigenerative grammar systems.Schedae Informaticae, 2006(15):175–188, 2006.

[32] A. Meduna and J. Techet. Scattered Context Grammars and theirApplications. WIT Press, UK, GB, 2010.

[33] R. Meersman and G. Rozenberg. Cooperating grammar systems.In J. Winkowski, editor, Mathematical Foundations of ComputerScience 1978, volume 64 of Lecture Notes in Computer Science,pages 364–373. Springer Berlin Heidelberg, 1978.

[34] T. Mine, R. Taniguchi, and M. Amamiya. Coordinatedmorphological and syntactic analysis of japanese language. InProceedings of the 12th international joint conference onArtificial intelligence - Volume 2, pages 1012–1017. MorganKaufmann Publishers Inc., 1991.

[35] R. Mitkov, editor. The Oxford Handbook of ComputationalLinguistics. Oxford University Press, 2003.

[36] M. Mohri. Finite-state transducers in language and speechprocessing. Comput. Linguist., 23(2):269–311, June 1997.

[37] S. S. Muchnick. Advanced compiler design and implementation.Morgan Kaufmann Publishers Inc., San Francisco, CA, USA,1997.

[38] F. Popowich. Chart parsing of scattered context grammars.Applied Mathematics Letters, 7(1):35–40, 1994.

[39] G. Rozenberg and A. Salomaa, editors. Handbook of FormalLanguages. Springer-Verlag, Berlin, 1997.

[40] P. Šaloun. Parallel LR parsing. In Proceedings of the FifthInternational Scientific Conference Electronic Computers andInformatics 2002. The University of Technology Košice, 2002.

[41] A. Venugopal, A. Zollmann, and V. Stephan. An efficienttwo-pass approach to synchronous-CFG driven statistical MT. InC. L. Sidner, T. Schultz, M. Stone, and C. Zhai, editors,HLT-NAACL, pages 500–507. The Association for ComputationalLinguistics, 2007.

[42] A. Weber. On the valuedness of finite transducers. ActaInformatica, 27:749–780, 1990. 10.1007/BF00264285.

[43] A. Zollmann and A. Venugopal. Syntax augmented machinetranslation via chart parsing. In Proceedings of the Workshop onStatistical Machine Translation, StatMT ’06, pages 138–141,Stroudsburg, PA, USA, 2006. Association for ComputationalLinguistics.

Selected Papers by the AuthorP. Horácek, A. Meduna. New Grammar Systems and Their

Application Perspectives. Schedae Informaticae, 22, 2014(accepted for publication).

P. Horácek. Application Perspectives of Synchronous MatrixGrammars. In Proceedings of the 19th Conference STUDENTEEICT 2013, Vol. 3, pages 202–206. Brno, CZ, 2013.

P. Horácek, A. Meduna. Synchronous Versions of RegulatedGrammars: Generative Power and Linguistic Applications.Theoretical and Applied Informatics, 24(3): 175–190, 2012.

M. Cermák, P. Horácek, A. Meduna. Rule-restrictedautomaton-grammar tranduscers: Power and linguisticapplications. Mathematics for Applications, 1(1): 13–35, 2012.

P. Horácek. On Generative Power of Synchronous Grammars withLinked Rules. In Proceedings of the 18th Conference STUDENTEEICT 2012, Vol. 3, pages 376–380. Brno, CZ, 2012.

E. Zámecníková, P. Horácek. Formal Models in Natural LanguageProcessing. In Proceedings of the 18th Conference STUDENTEEICT 2012, Vol. 3, pages 425–429. Brno, CZ, 2012.

P. Horácek, A. Meduna. Regulated Rewriting in Natural LanguageTranslation. In 7th Doctoral Workshop on Mathematical andEngineering Methods in Computer Science, pages 35–42. Brno,CZ, 2011.

P. Horácek. Parse Driven Translation. In Proceedings of the 17thConference STUDENT EEICT 2011, Vol. 3, pages 480–484.Brno, CZ, 2011.

P. Horácek. Formal Models in Processing of Japanese Language.In Proceedings of the 16th Conference STUDENT EEICT 2010,Vol. 5, pages 161–165. Brno, CZ, 2010.

Page 19: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Domain Analysis of Graphical User Interfaces ofSoftware Systems

Michaela Bacíková∗

Department of Computers and InformaticsFaculty of Electrotechnical Engineering and Informatics

Technical University of KošiceLetná 9, 042 00 Košice, [email protected]

AbstractDomain analysis (DA) is the first phase of software systendevelopment. A person who performs DA is called a do-main analyst. The task of a domain analyst is to collectinformation about a domain with the goal of developinga new software system. Usually, this task is manual andtime-tedious, because the data have to be manually gath-ered from different sources such as existing documents,domain experts or existing applications in the domain.

This work is a contribution in the field of domain anal-ysis of software systems. Our goal is to reduce the timeand effort of domain analysts by supporting an automatedcreation of domain models. The goal is achieved throughdomain-specific language (DSL) development, thus we alsocontribute to the field of DSL development.

We present a unique method for domain analysis of graph-ical user interfaces (GUIs) of existing software systems.The output of the method is a formal, platform-inde-pendent domain model, which is then used to generate aDSL implementation - classes representing the languagemodel and a language parser. Since the domain modelis platform-independent, it can be utilized also in otherprocesses. These processes are described in the work andtheir utilization is demonstrated in the experimental part.

We developed a prototype to experimentally verify theproposed method. Besides the primary feature of creat-ing DSLs from existing GUIs, the prototype also supportsformalization of the domain model into ontologies. Theprototype was used in three experiments: to experimen-

∗Recommended by thesis supervisor: Prof. JaroslavPoruban. Defended at Faculty of Electrotechnical En-gineering and Informatics, Technical University of Kosiceon June 30, 2014.

c© Copyright 2014. All rights reserved. Permission to make digitalor hard copies of part or all of this work for personal or classroom useis granted without fee provided that copies are not made or distributedfor profit or commercial advantage and that copies show this notice onthe first page or initial screen of a display along with the full citation.Copyrights for components of this work owned by others than ACMmust be honored. Abstracting with credit is permitted. To copy other-wise, to republish, to post on servers, to redistribute to lists, or to useany component of this work in other works requires prior specific per-mission and/or a fee. Permissions may be requested from STU Press,Vazovova 5, 811 07 Bratislava, Slovakia.Bacíková, M. Domain Analysis of Graphical User Interfaces of Soft-ware Systems. Information Sciences and Technologies Bulletin of theACM Slovakia, Vol. 6, No. 4 (2014) 17-23

tally verify the method on 32 existing applications, todevelop 9 DSLs and to compare two systems using on-tologies.

Categories and Subject DescriptorsD.2.13 [Software Engineering]: Reusable Software—Domain engineering ; D.3.m [Programming Languages]:Miscellaneous; H.5.2 [Information Interfaces and Pre-sentation (e.g., HCI)]: User Interfaces—Evaluation/methodology, Graphical user interfaces (GUI), Natural lan-guage, Theory and methods; D.2.11 [Software Engineer-ing]: Software architectures—Domain-specific architec-tures, Languages

Keywordsdomain analysis, domain-specific languages, graphical userinterfaces, component-based software systems, reverse en-gineering, ontologies

1. IntroductionWhen developing a new software system (or a new ver-sion of a system) for a particular domain (e.g. banking),the first step of the developer is to speak with the do-main experts (bank employees), study documents to gainknowledge about the domain and find and analyse exist-ing banking systems (or the old version of the bankingsystem). Then a form of a formal domain model is cre-ated, describing the knowledge from the banking domain,which is used to develop the new system.

This process is called domain analysis (DA). The personwho performs DA is called domain analyst. The task isusually manual and often tedious and time consuming.This work aims to reduce the time and effort of the do-main analyst by supporting the creation of a formalizeddomain model in an automated manner.

Why extract domain information from GUIs and not forexample from domain experts or domain documents? GUIsare made for domain users, therefore we can assume, theywill contain correct domain terms and relations. Other-wise, they would be less usable. Moreover, unlike theknowledge of a domain expert or information stored indomain documents, GUIs are in a formalized form. Tak-ing this facts into account, we can say that GUIs are thebest sources of formalized domain knowledge.

The idea goes even further and we propose a method forcreating new domain-specific languages (DSLs) based on

Page 20: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

18 Bacıkova, M.: Domain Analysis of Graphical User Interfaces of Software Systems

the previously extracted domain models. Thus, we con-tribute to the DSL development also.

DSLs are small programming languages that provide suit-able notations and abstractions for achieving expressivepower specialized, and usually restricted, to a domain ofproblems [1, 2]. By having a DSL, the developer of a newsystem can benefit from the architecture with a separateddomain model. Besides this advantage, DSLs further pro-vide benefits such as easier programming and easier un-derstandability for end-users. Although the new systemwill use different technology or have a different appear-ance, because of reusing the DSL from the old system,the terms in the UI will be the same and therefore it willbe more user-friendly.

Because the development of tools for supporting the DSLdesign is often inevitable, the development of a DSL canbe of a high cost. Zawoad et al. provide a comprehensibleexample of creating their own DSL for secure logging [3].From their work it is evident, that a deep understand-ing of the DSL creation process is needed to create newDSLs and their supporting tools. Zawoad et al. perform5 standard phases of creating DSLs: (1) domain analy-sis, (2) definition of the abstract syntax, (3) definition ofthe concrete syntax, (4) definition of the translational se-mantics, (5) implementation. While the last four phasesare well supported and automated by many researchers[4], the DA phase is usually performed manually, as it isalso in the case of Zawoad et al. We aim to support theDA phase by designing a method for automatized cre-ation of a DSL from existing sources. By providing anautomatic generation of a language processor for the gen-erated DSL, we also support the next four phases of theDSL development. Although the development phase ispretty well supported, we integrate existing solutions intoour approach and thus provide a comprehensive solution,which supports all phases at once.

We have designed and developed the aforementioned meth-od for domain language extraction. The method is a com-bination of two steps. In the first step, our DEAL methodanalyses UIs and creates a platform-independent domainmodel. The second step is a translation of the domainmodel to a language specification. We have implementeda prototype of the method – the DEAL tool. As a lan-guage specification we use grammar description languagesupported by annotation-based model-driven parser gen-erator YAJCo [5]. YAJCo is able to generate a languagemodel specification using annotated Java classes. In ourcase, however, we create the language specification bytraversing the domain model and creating language con-cepts, abstract and concrete syntax in our algorithm.Based on the language specification, YAJCo generates aparser, that can be used as a text-based UI of the applica-tion (this could be interesting for testing the non-UI partof the application). Both tools, DEAL and YAJCo weredeveloped at our university and in the following sectionswe will shortly describe their principles. The concept ofthe method is displayed in Fig. 1.

2. The DEAL MethodIn this section we will describe our DEAL method fordomain analysis and DSL development. We will also de-scribe its implementation, the DEAL tool. To explain theprocess, how the DSLs are created from domain modelsextracted by the DEAL method we will present the pro-

Figure 1: The concept of the DEAL method fordomain language extraction

cess on a small example of a Person form and we will alsoshortly describe the YAJCo tool that is used to generatelanguage model classes and parser.

Our method for domain analysis is called DEAL (DomainExtraction ALgorithm). The input of the DEAL methodis an existing UI made of components and the output isa platform-independent domain model.

The target UIs to be analysed have to fulfil the followingconditions: (i) the UI has to be made of components,(ii) the UI programming platform has to enable some formof introspection. If the conditions (i) and (ii) are valid,then we can perceive graphical components as domain-specific units that represent the terms of the UI language.The scenes (i.e. windows, dialogs, web pages, etc.) of a UIdefine the domain or sub-domain and terms representedby all the components located in a particular scene belongto the domain or sub-domain defined by the scene. Thecomponents represent domain-specific units of the domaindefined by the scene.

The DEAL method uses two kinds of metamodels: appli-cation UI metamodel and domain metamodel. The ap-plication UI metamodel is a model of an application’s UIand it contains scenes represented as hierarchies of con-tainers and components and their domain identifiers. Itdefines the input of the DEAL method, i.e. a UI. Thedomain metamodel defines serves for specifying domainterms, their hierarchy, their properties, constraints andrelations between the terms. The domain metamodel de-fines the output of the DEAL method.

Figure 2: Phases of the DEAL method

Page 21: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 17-23 19

The DEAL method has five phases as displayed in Fig. 2:

1. Loading and processing2. Extraction3. Simplification4. Derivation5. Utilization

In the loading and processing phase the target applicationis loaded into memory and all its scenes and componentsare traversed and processed. The loading and process-ing phase is application-specific and the UI programmingplatform of the target application has to provide means ofintrospection for this phase to be successful. Application-specific means that a loading and processing algorithmhas to be created for every new programming languageand the programming platform of the target application’sUI. The output of the loading and processing phase is anapplication UI model.

The extraction phase is component-specific. Component-specific means that a handler has to be created for eachcomponent type and UI programming platform. The out-put of the extraction phase is an object representation ofthe domain model, which contains terms, their explicitproperties and constraints.

Simplification means filtering information unrelated tothe domain. The domain model created in the extractionphase contains data unimportant for the domain model,such as: empty terms (terms without any relevant do-main information, created mostly from containers), gen-eral terms unrelated to the domain (such as File, Save,Import, Exit, etc.). Filtering involves removing multiplenesting, removing empty terms, shifting single leafs andfiltering general non-domain terms. In this context, anempty term is a term created from a component of typecontainer that does not contain any children.

Some empty terms are essential for preserving the hierar-chy of terms. However if the target application containstoo many containers, it causes excessive deepening of thedomain model hierarchy, which is not desirable. There-fore such terms have to be removed. The output of thesimplification phase is a simplified domain model.

Derivation is a process where implicit relations are de-rived. Derivation is defined in component handlers and isbased on the identification of different component types.The output is a simplified domain model with implicitrelations between terms. DEAL supports three kindsof relations: and, mutually-exclusive and mutually-not-exclusive relation.

In the utilization phase the model created in the previ-ous phase can, for example, be utilized in the followingprocesses:

• generating a DSL (described in [6]),• generating an ontology (described and experimen-

tally verified in [7]),• generating new UI (described and experimentally

verified in [8],• evaluating domain usability [9], etc.

Each of the 5 phases are to be performed sequentially

in the order they are listed here. Each phase uses theoutput of the previous phase. Once the domain model isextracted, it can be processed independently. Thus thesimplification, derivation and utilisation phases are notnecessarily application-specific: they are the same for anytarget application.

2.1 The DEAL ToolThe DEAL tool1 is a software solution for extracting do-main knowledge from existing UIs and it proves the pos-sibility of using the DEAL method on Java and Windowsapplications. The prototype is written in Java languageand it uses Java reflection, DOM and AspectJ to be ableto extract domain information from target applications.The main window of the DEAL tool is displayed in Fig-ure 3. It allows to review domain models extracted fromrunning application. The functionality is interconnectedwith the target application: when a user clicks on a termin the extracted domain model, then the correspondingcomponent is highlighted in the target application, too.Some of the extracted concepts can be excluded from themodel using a “Hide” function.

Figure 3: The DEAL tool in the back and a Personform in the front.

The DEAL tool proves that it is possible to:

• traverse a UI of an existing application, given thatthe application is made of components and enablesintrospection,• extract domain information from the UI in a for-

malized form, and to generate a DSL based on theextracted domain model.

The resulting domain model is in a form of an internalobject model.

2.2 DSL as Output of the DEAL MethodFor better understanding, we will present the result ofextraction on a small DSL extracted from a Person form.The form can be seen in Fig. 4.

Domain model of the form was extracted using the DEALtool. This model was transformed into a language modelused by YAJCo tool described in section 2.3.

1DEAL project can be found at: https://www.assembla.com/spaces/DEALtool

Page 22: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

20 Bacıkova, M.: Domain Analysis of Graphical User Interfaces of Software Systems

Figure 4: The Person form

The concrete syntax of the Person form language canbe described using a grammar in EBNF. The elements〈STRING〉 and 〈NUMBER〉 represent a terminal stringor numeric values. The concrete syntax of the DSL gen-erated from the Person form is as follows (terminals arenoted in quotation marks):

Person→ ”Person”Name Surname Age

Gender FavouriteColor

Name→ ”Name” 〈STRING〉Surname→ ”Surname” 〈STRING〉

Age→ ”Age” 〈NUMBER〉Gender → ”Gender” (”man” | ”woman”)

FavouriteColor → ”Favourite colors”

(”red”? ”blue”? ”green”? ”yellow”?)

In this domain model to DSL specification transformation,each term of the domain model is transformed into oneconcept in the language model. That means, for eachterm there is one rule in the EBNF. The domain modelis represented as a hierarchy of terms. This hierarchy isdirectly mapped into the hierarchy of language concepts.

Moreover, if a term in the domain model has a not-mutually-exclusive relation, then this term is transformed into arule of 0-1 choices (similar to the FavouriteColor rule)and in Java class it is represented as a list of items. Onthe other hand, if the term has a mutually-exclusive re-lation, then it is transformed into a rule of alternatives(similar to the Gender rule) and in Java class it is repre-sented as enumeration.

We also map data types into the language model. Notethat since the Age field in the graphical form is a nu-meric spinner in the UI, the data type of the Age propertywas derived as 〈NUMBER〉 type. And since both Nameand Surname came from textfield components, the datatype of the Name and Surname properties was derivedas 〈STRING〉 . For more information about the domainmodel to DSL specification transformation, see our paper[6].

2.3 YAJCo Parser GeneratorYAJCo2 is a parser generator that accepts language spec-ification in a form of Java classes representing languageconcepts. Relations between the concepts (and therefore

2YAJCo project can be found at: https://code.google.com/p/yajco/

grammar structure) are inferred from the relations be-tween classes such as inheritance, composition and aggre-gation. Concrete syntax of the language and some ad-ditional information is specified using Java annotations.Based on such specification YAJCo can generate languagegrammar and parser. YAJCo also generates the parserusing JavaCC or Beaver that can instantiate the modelbased on a DSL sentence. More about YAJCo can befound in [5].

YAJCo can also be used the other way round and generateobject oriented model in a form of Java classes from theinternal language model. This mode of operation was usedto transform domain model extracted by DEAL to bothlanguage grammar and classes representing the languagemodel as displayed in Fig. 1. This way the extractedmodel can be directly used within the new version of theapplication.

In our example of the Person form language, several classeswere generated as shown by class diagram in Figure 5. Foreach rule in the EBNF grammar there is one class and foreach data type in the rule (number, string, date, etc.) inthe rule there is one property in the class, e.g. a classPerson has a name, surname and age. Each of them rep-resents object of classes Name, Surname and Age wherethe first two have inner values of type String and Agehas an inner value of type int. Person also has a Listof FavouriteColor instances and a reference to a Genderenum.

Person

Namename: String

Surnamesurname: String

Ageage: int

<<enumeration>>

Gendermanwoman

<<enumeration>>

Favourite_colorredbluegreenyellow

1 1

1

1 *

Figure 5: Class diagram of the Person languagemodel.

2.4 Utilization of the DEAL method: DomainUsability

Since the domain model generated by the DEAL methodis platform-independent, it can be used also in furtherprocesses other than DSL development. Ontologies areone of the possible output. Ontologies are formal repre-sentations of knowledge as hierarchies of concepts withina domain, using a shared vocabulary to denote the types,properties and interrelationships of those concepts. On-tologies are considered pillars of the Semantic web, wherethey are used to define semantics of web pages. One ofthe standard format for ontology notation is OWL.

We developed a method for creating an ontology fromthe domain model extracted by the DEAL method andwe described it in [7]. The output ontology is in the stan-dard OWL format and describes the knowledge extractedfrom the existing application. Thus, we also support aformalization of existing GUIs into ontologies.

Page 23: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 17-23 21

The goal of ontology extraction is not only to aid Semanticweb. Because of the OWL standard, we can benefit fromontological methodologies and tools. For example, we cancompare two ontologies or query an ontology for facts weneed to know. Ontology comparation or querying can beused to evaluate usability of the target user interface, bycomparing it to another user interface (its ontology) or toan ontological dictionary such as WordNet for correctness.We call this aspect of the system domain usability. Todefine domain usability we have to explain the generalusability first.

The common perception of usability is usually in the termsof user experience, satisfaction, application quality andeffectiveness or ergonomics. Often it is seen from the er-gonomic point of view and the domain aspect is neglectedor omitted, even if it is included‘ in the general definitionby Nielsen [10], which still serves as a fundamental guideto create usable software systems, new usability guidelinesand usability evaluation and testing systems.

Each software is developed for a concrete domain, there-fore its UI should contain terms, relations and describeprocesses from its specific domain for the users to be ableto work with it. If the user does not understand the termsin the system’s UI, then the whole application is less us-able. Based on our experience and research and pursuingthe existing current work in the area of usability, we de-fined understandability as the property of a system, thataffects usability and relates to the following factors:

• Domain content: the UI terms, relations and pro-cesses should match the ones from the domain, whichthe UI is designed for.• Adequate level of specificity: the UI made for a

specific domain should not contain terms too gen-eral, even if they belong to a parent domain. On theother hand, the terms should not bee too specific,if the system is used by people from a more generaldomain.• Consistency: words used throughout the whole UI

should not differ, if they describe the same function-ality, the dictionary shoulxd be consistent.• Language barriers: there should be no foreign words,

the translation should be complete. The languageof the UI should be the language of the user.• Errors: a UI should not contain stylistic and gram-

matical errors.

The domain usability is defined as the aspect of usability,which is affected by the factor of UI understandability.However, it is not true that understandability = domainusability. Understandability can affect other attributesbesides domain usability, e.g. accessibility. The overallusability is defined as a connection of two basic aspects:ergonomic usability and domain usability. These two as-pects can be combined together when evaluating usability.

Using our approach, and using the proposed ontology for-malization, it is possible to automatically evaluate domainusability as described in the introduction of this section.The feasibility analysis of automated evaluation of domainusability is described in [9].

3. Experimental verificationWe performed three experiments. The goal of the first ex-periment was to verify the DEAL method on existing Javaapplications. More specifically it verifies the coverage ofthe DEAL default handlers for components. The secondexperiment is a verification of the DSL extraction mod-ule. The third experiment verifies the ontology extractionmodule and moreover, it uses the ontologies generated bythe module to compare two existing applications. We willdescribe each experiment in the next sections3.

Experiment 1: Coverage of the DEAL Default Handlers

We verified the DEAL prototype against 32 open-sourceJava applications downloaded from sourceforge. The num-ber of 799 components were counted in all 32 applicationsand 761 of them were successfully extracted. Consideringthese numbers, the DEAL prototype has a 95% coverage.

For poorly designed applications, such as ArcaneAvalon,where the content was drawn directly in the paint() meth-od of the application frame, the content was not extractedat all.

On the other hand, there were examples of graphical ap-plications such as FreeMind and Freeplane with very gooddesigns and thus not only standard but also all the app-lication-specific components have been extracted properlyfrom them.

Experiment 2: DSLs of Domain-specific Applications

Using the DEAL method we were able to infer grammarsand parsers for 9 domain-specific languages such as: thelanguage of locations and time zones, the language of fur-niture categories and furniture, the language of egyptianhieroglyphic symbols, the language of star observationsand the language of bibliographical references.

The applications, which the DSLs were extracted from,are: PersonForm (a simple testing application), TimeS-lotTracker, DaylightChart, JSesh, SweetHome3D, VStar,JabRef (all downloaded from sourceforge.net).

All DSLs in our experiment were generated correctly, henceachieving our goal4.

Experiment 3: Comparison of two Applications

The goal of this experiment was to answer the questionwhether it is possible to compare two existing GUIs basedon their domain model and to what extent. For ontologyextraction, we used the DEAL module for generating on-tologies and for automatic comparison we used the Pro-tege ontology tool.

Two ontologies were generated from two applications:Freeplane and FreeMind, both downloaded from source-forge. The result of the comparison of ontologies createdfrom the applications are the following: 1. entities cre-

3A more detailed description and the results of theexperiments can be found online in the DEAL wiki page:https://www.assembla.com/spaces/DEALtool/wiki/Ex–perimental verification4The DSLs can also be found online in a Dropbox folderat http://goo.gl/PxaFy7

Page 24: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

22 Bacıkova, M.: Domain Analysis of Graphical User Interfaces of Software Systems

ated: 678, 2. entities deleted: 166, 3. entities modified:345. The results are not 100% accurate, because the com-ponents with different names, but same functionality inboth applications, were counted as created/deleted enti-ties, not as modified. However some changes can be iden-tified with certainty, e.g. the menu item position changescan be identified in the Superclass parameter in Protegeor the change of the menu item class.

When finding new features, combination of a visual (man-ual) comparison and automatic ontology comparison canbe better than visual-only. Combination of the visual andontology comparison with highlighting would highly en-hance the illustration of the comparison.

4. Related WorkIn this section, we will select the most important works,related to our approach.

As proposed by Ceh et al. [11], it is possible to use on-tologies as sources of DSL terminology. They have im-plemented the Ontology2DSL framework to demonstratethe ontology to DSL transformation. The condition forusing their approach is the existence of an ontology de-signed for the given specific domain. Which is actually anequally difficult problem compared to finding an existingDSL for the given specific domain - the amount of exist-ing software systems is certainly larger than the amount ofexisting ontologies, therefore we claim that our approachfor creating DSLs is more advantageous.

Several approaches exist that deal with automatized DAin the area of feature modeling. All mentioned approachesdeal with automatized extraction of feature models fromvarious sources and with subsequent processing of the ex-tracted information. A feature model is a specific kindof domain model that uses features to describe a domainapplication. Czarneczki et al. [13] propose mining tech-niques that extracts feature models from a set of multipleproduct configurations, however the assumption is thatthe products are already formally described as sets of fea-tures or configurations. However it would be possible tocombine the DEAL method with their technique. Davrilet al. [14] assume that an organization has no existingproduct descriptions and must rely on publicly availabledata from websites, which provide feature lists of prod-ucts. Weston et al. [15] and Chen et al. [12] propose amethod of extracting feature models from informal spec-ifications. The resulting feature model is constrained tothe set of features described in the specifications for theexisting set of products.

An approach very similar to ours is the diploma thesisof Jirı Sotona [16]. Sotona created a tool called HTMLExtract which is able to automatically extract textual in-formation from web GUIs. Similar approach, targeted tomobile device readability, was presented by Buyukkok-ten et al. [17] who introduced methods for summarizingparts of Web pages in handheld devices. Buyukkokten etal. aimed at enhancing web readability and orientationfor mobile web readers. Svab et al. [18] perform extrac-tion of specific statistical information using the HiddenMarkov model technique and the output of the extrac-tion is data in an RDF format. They extract structuredsemantic information, however their work benefits fromtargeting the extraction process on specific data such asproduct catalogues while our approach is aimed at GUIs

in general. Bronzi et al. in [19] present their approachof harvesting data exposed by a set of structured andpartially overlapping data-intensive web sources. Bronziet al. use multiple web sites to extract domain-specificinformation based on the overlapping data. The resultis a table of domain data. The approach is quite simi-lar to our approach, however we also create DSLs fromthe GUIs, i.e. our motivation is to develop new soft-ware systems using the DSL. Mazal [20] tries to createan XML with data extracted from existing HTML page.The XML contains textual data from the page, page titleand date. Mazal however does not extract any data prop-erties or derives relations between the textual items. Eachof the listed approaches deals with data extraction fromweb pages in the first place, but none of them deals withcreating a domain model from the extracted data. Unlikeour approach, none of the listed approaches had defineda methodology for extracting domain models along withproperties and relations from existing GUIs.

5. ConclusionsThe work describes a new unique method and approachfor DSL development. Its main contributions include:

• Proposal of an original method of domain analysisof graphical user interfaces.

• Proposal of a unique approach to developing DSLs.

• Proposal of a new definition of domain usability.

• A feasibility analysis of automatic evaluation of do-main usability.

• Experimental verification of the proposed method.

The designed approach for domain analysis of GUIs andcreating DSLs can be further developed in several fields,including:

• Evaluation of domain usability. We are convincedthat the extracted domain models can be used notonly for visual evaluation of domain usability by adeveloper or domain expert, but also automaticallyby comparing the extracted domain model with anexisting ontology or ontological dictionary, that con-tain pre-defined relations between the terms. Thisfield represents our current and future research.

• Analysis of UI event sequences. In our definitionof domain usability we also touch the sequences ofevents in UIs and we claim that sequences of eventsshould correspond to the real-world processes. Cur-rent approaches for analysing UI event sequencesfocus on analysing procedural errors and bugs, how-ever our view on the event sequences is more as do-main processes.

• Generative processes, e.g. a generation of user guidesas an example with using the above mentioned UIevent sequences recorded on a UI. A tool for record-ing such event sequences could be used to generatea draft of a user guide along with the screenshots.

• Combination of the DEAL approach with other ap-proaches for domain analysis, such as clustering orfor example, the Davril’s approach [14] for extract-ing domain information from product descriptionsfrom public websites of existing software applica-tions.

Page 25: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 17-23 23

5.1 AcknowledgmentsThis work was supported by project VEGA 1/0341/13“Principles and methods of automated abstraction of com-puter languages and software development based on thesemantic enrichment caused by communication”.

References[1] M. Mernik, J. Heering, and A. M. Sloane, “When and how to

develop domain-specific languages,” ACM Comput. Surv., vol. 37,no. 4, pp. 316–344, Dec. 2005.

[2] M. Fowler, Domain-Specific Languages, 1st ed.Addison-Wesley Professional, Oct. 2010.

[3] S. Zawoad, M. Mernik, and R. Hasan, “Fal: A forensics awarelanguage for secure logging,” in Computer Science andInformation Systems (FedCSIS), 2013 Federated Conference on,Sept 2013, pp. 1579–1586.

[4] T. Kosar, P. E. M. López, P. A. Barrientos, and M. Mernik, “Apreliminary study on various implementation approaches ofdomain-specific language,” Inf. Softw. Technol., vol. 50, no. 5, pp.390–405, Apr. 2008.

[5] J. Porubän, F. M., M. Sabo, and M. Behalek, “Annotation basedparser generator,” Computer Science and Information Systems :Special Issue on Advances in Languages, Related Technologiesand Applications, 2010.

[6] M. Bacíková, J. Porubän, and D. Lakatoš, “Defining domainlanguage of graphical user interfaces,” in SLATE, 2013, pp.187–202.

[7] M. Bacíková, Š. Nitkulinec, “Formalization of graphical userinterfaces using ontologies,” in POSTER 2014 : 18thInternational Student Conference on Electrical Engineering,vol. 15. Czech Technical University in Prague, May 2014, pp.1–5. [Online]. Available:http://hornad.fei.tuke.sk/ bacikova/publications/2014–04_poster14_bacikova–nitkulinec.pdf

[8] M. Bacíková and J. Porubän, “Ui creation patterns (using itasksfor dsl -> gui transformation,” in Proceedings of the TwelfthInternational Conference on Informatics, INFORMATICS’2013,Spišská Nová Ves, Slovakia, 2013, pp. 145–150.

[9] ——, “Ergonomic vs. domain usability of user interfaces,” inHuman System Interaction (HSI), 2013 The 6th InternationalConference on, June 2013, pp. 159–166.

[10] J. Nielsen, Usability Engineering. San Francisco, CA, USA:Morgan Kaufmann Publishers Inc., 1993.

[11] I. Ceh, M. Crepinsek, T. Kosar, and M. Mernik, “Ontology drivendevelopment of domain-specific languages,” Computer Scienceand Information Systems, no. 2, pp. 317–342, 2011.

[12] K. Chen, W. Zhang, H. Zhao, H. Mei, “An Approach toConstructing Feature Models Based on Requirements Clustering,”RE ’05: Proceedings of the 13th IEEE International Conferenceon Requirements Engineering, pp. 31–40, IEEE ComputerSociety, Washington, DC, USA, 2005.

[13] K. Czarnecki, S. She, and A. Wasowski, “Sample spaces andfeature models: There and back again,” Software Product LineConference, International, vol. 0, pp. 22–31, 2008.

[14] J.-M. Davril, E. Delfosse, N. Hariri, M. Acher, J. Cleland-Huang,and P. Heymans, “Feature model extraction from large collectionsof informal product descriptions,” in Proceedings of the 2013 9thJoint Meeting on Foundations of Software Engineering, ser.ESEC/FSE 2013. New York, NY, USA: ACM, 2013, pp.290–300.

[15] N. Weston, R. Chitchyan, and A. Rashid, “A framework forconstructing semantically composable feature models fromnatural language requirements,” in Proceedings of the 13thInternational Software Product Line Conference, ser. SPLC ’09,Pittsburgh, PA, USA, 2009, pp. 211–220.

[16] J. SOTONA, “Hypertext data preprocessing for e-learning,”master’s thesis, Masaryk’s university, Faculty of informatics, 2007[cit. 2014-02-17]. [Online]. Available:http://is.muni.cz/th/60464/fi_m/

[17] O. Buyukkokten, H. Garcia-Molina, and A. Paepcke, “Seeing thewhole in parts: Text summarization for web browsing on

handheld devices,” in Proceedings of the 10th InternationalConference on World Wide Web, ser. WWW ’01. New York, NY,USA: ACM, 2001, pp. 652–662.

[18] O. Svab, M. Labsky, and V. Svatek, “Rdf-based retrieval ofinformation extracted from web product catalogues,” 2004.

[19] M. Bronzi, V. Crescenzi, P. Merialdo, and P. Papotti, “Extractionand integration of partially overlapping web sources,” Proc.VLDB Endow., vol. 6, no. 10, pp. 805–816, Aug. 2013.

[20] J. Mazal, “Extraction of textual data from web pages,” master’sthesis, Brno University of Technology, 2011 [cit. 2014-02-19].[Online]. Available:https://www.vutbr.cz/www_base/zav_prace_soubor_verejne.php?file_id=40352

Selected Papers by the AuthorM. Bacíková, J. Porubän Evaluating Domain Usability with DEAL: a

Case Study. In Journal of Computer Science and ControlSystems: JCSCS Vol. 6, no. 1(2013), pages 5–9. ISSN1844-6043. 2013.

M. Bacíková, J. Porubän Analyzing stereotypes of creating graphicaluser interfaces In Central European Journal of Computer Science.Vol. 2, no. 3 (2012), pages 300–315. ISSN 1896-1533. 2012.Springer.

M. Kreutzová, J. Porubän, P. Václavík First Step for GUI DomainAnalysis : Formalization In Journal of Computer Science andControl Systems. Vol. 4, no. 1 (2011), pages 65-70. ISSN1844-6043. 2011.

M. Bacíková, J. Porubän Ergonomic vs. Domain Usability of UserInterfaces In HSI 2013 : 6th International Conference on HumanSystem Interaction : June 6.–8. 2013, Sopot, Poland, pages 1–8.ISBN 978-1-4673-5636-7. 2013. IEEE. Selected to monograph –waiting for publisher review.

M. Bacíková, J. Porubän, D. Lakatoš Defining Domain Language ofGraphical User Interfaces In SLATE 2013: Symposium onLanguages, Applications and Technologies : proceedings : June20-21 2013, Porto, Portugal, pages 187–202. ISBN:978-3-939897-52-1, ISSN: 2190-6807. 2013.

M. Bacíková, D. Lakatoš, M. Nosál’ Automatized generating of GUIsfor domain-specific languages In SLEDS 2012: DoctoralSymposium of the 5th International Conference on SoftwareLanguage Engineering 2012 : proceedings : Dresden, Germany,September 25, 2012, Dresden, Germany. - Leipzig : Universty ofLeipzig, 2012, pages 1–9. ISSN 1613-0073 [Online]http://ceur-ws.org/Vol-935/.

M. Bacíková, J. Porubän, D. Lakatoš Declarative Specification ofReferences in DSLs In Federated Conference on ComputerScience and Information Systems, FedCSIS 2013. 8-11.9.2013:Krakow Poland, pages 1527–1534. Los Alamitos, CA, USA :IEEE Computer Society Press, 2013, acceptance rate 40%.

M. Sabo ... [et al.] Computer Language Notation Specificationthrough Program Examples In FedCSIS: Proceedings of theFederated Conference on Computer Science and InformationSystems. September 18-21, 2011, Szczecin, Poland. LosAlamitos, pages 895–898. ISBN 978-83-60810-22-4. IEEEComputer Society Press, 2011.

M. Bacíková Formalization of Graphical User Interfaces usingOntologies In POSTER 2014 : 18th International StudentConference on Electrical Engineering : May 15, 2014, Prague,Czech republic. Czech Technical University in Prague, 2014,pages 1–5.

M. Bacíková DEAL – a method for Domain Analysis of GraphicalUser Interfaces In Poster 2013 : 17th International StudentConference on Electrical Engineering : May 16, 2013, Prague.Czech Technical University in Prague, 2013, pages 1–5. ISBN978-80-01-05242-6.

M. Bacíková Domain analysis with reverse-engineering for GUIfeature models In POSTER 2012 : 16th International StudentConferenece on Electrical Engineering : May 17, 2012, Prague,Czech republic. Czech Technical University in Prague, 2012,pages 1–5. ISBN 978-80-01-05043-9.

Page 26: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Contribution to the Methods and Algorithms ofAutomatic Generation of Functional Tests for

Processors

Ján Hudec∗

Institute of Computer Systems and NetworksFaculty of Informatics and Information Technologies

Slovak University of Technology in BratislavaIlkovicova 2, 842 16 Bratislava, Slovakia

[email protected]

AbstractThe dissertation thesis is aimed at automatic functionaltest generation methods for processors. Testing proces-sors needs continually new test generation methods, algo-rithms and test application techniques for their verifica-tion, manufacture testing and reliable life-time run. Thefunctional tests are mainly generated over an instructionset architecture and processor model description. Theyrun in similar form and frequency as real programmes.Such tests are categorized as the software-based tests. Ametric for quality evaluation of the software-based testsis obviously done by code coverage of a described proces-sor model. A simulation tool is used with the mentionedmetric calculation.

A new test generation method is presented in the dis-sertation thesis. It uses VHDL model of processors andgenetic algorithms with adaptation of various evolution-ary strategies. In addition fitness function is defined forevaluation of generated tests by genetic algorithms and anew method for creation of a starting test (the first pop-ulation) has been proposed. The described methods aresuitable for automatic generation of software-based testsfor processors. Functionality and effectiveness of the de-veloped methods were evaluated in implemented softwaresystem AGenMIX over one type of RISC processors. Tworepresentative experiments are shown in the paper.

Categories and Subject DescriptorsB.7.3 [Reliability and Testing]: Test generation

∗Recommended by thesis supervisor: Associate ProfessorElena Gramatova. Defended at Faculty of Informaticsand Information Technologies, Slovak University of Tech-nology in Bratislava on December 18, 2014.c⃝ Copyright 2014. All rights reserved. Permission to make digital

or hard copies of part or all of this work for personal or classroom useis granted without fee provided that copies are not made or distributedfor profit or commercial advantage and that copies show this notice onthe first page or initial screen of a display along with the full citation.Copyrights for components of this work owned by others than ACMmust be honored. Abstracting with credit is permitted. To copy other-wise, to republish, to post on servers, to redistribute to lists, or to useany component of this work in other works requires prior specific per-mission and/or a fee. Permissions may be requested from STU Press,Vazovova 5, 811 07 Bratislava, Slovakia.Hudec, J. Contribution to the Methods and Algorithms of AutomaticGeneration of Functional Tests for Processors. Information Sciencesand Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014)24-30

Keywordstesting, functional test, test generation, software-basedtesting, genetic algorithm, evolutionary strategy, VHDL,code coverage

1. IntroductionAs system on chip (SoC) architectures have become widelyaccepted for complex digital and hybrid systems, the prob-lem of testing embedded processor cores has opened acrucial problem. Incoming technologies, chip complexityand increasing clock frequencies give new challenges fortesting not only the whole SoCs but also the embeddedprocessors integrated there. Functional tests are mainlyimportant for processors during their verification, as ad-ditional manufacturing tests and also during their lifetime testing. Thus increasing design complexity opensresearch and development of functional test pattern gen-eration (TPG) again as one of the most challenging issuesin both areas: verification and testing not only SoCs butmainly processors integrated there. Current industrialpractices mostly use random test programs (functionaltests). The TPG methods need both manual and guidedrandom tests. Manual generation of functional tests canbe a tedious process and random tests do not guaran-tee specified faults coverage (e.g. functional or stuck at,delay faults etc.). The need of more deterministic func-tional or hybrid (deterministic + random) test generationapproaches is desirable. However, the deterministic func-tional TPG is a long–standing open problem. Classicaltest methods based on sequential and structural auto-matic test pattern generation (ATPG) consume too com-putational time for complex digital circuits and thus alsofor nowadays processors. Thus a progress comes aroundresearch and practical cases for developing new functionaltest generation methods with their automatization.

The TPG methods targeted to software–based and self-testing over instruction set architecture (ISA) have beendeveloped and published. During last decade the TPGmethods marked as software-based self–testing (SBST)methods have been developed for processor models [5].Self–testing means that the tests can be performed on atested processor without using an automatic test equip-ment. Such SBST methods produce additional tests tostructural tests of processors and for life–time run onSoCs. The tests for SBST consist of various ordered se-quences of instructions from ISA of a tested processor andspecified data as operands if necessary.

Page 27: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 24-30 25

Minimal or even no circuit modifications are needed forrunning SBST performed in normal operating mode. More-over once a test code (test programs, tests for SBST) hasbeen uploaded in the tested processor then the test pro-grams are completely autonomous and can run at speed.

A new test generation method for SBST has been devel-oped using different types of genetic algorithms (GAs)with specific first population and changing possibilities ofevolutionary strategies (ES). The ES changing is based onfeedback quality of generated test programs evaluated bydefined fitness function. The major features of the newtest generation method are adaptability, flexibility andlower computational time for finding optimal functionaltests with accepted functional or stuck–at fault coverage.A metric used for functional fault coverage evaluation inSBST is based on code coverage of a modelled processor.Some rules and strategies have been defined for develop-ing an effective and flexible ATPG system for generationof test programs. The new method is based on languageVHDL (Very High Speed Integrated Circuits DescriptionLanguage) and ISA of processors. A new system, namedAGenMIX, has been developed with link to the simulatorModelSim for code coverage calculation [9]. Experimentswere done over DP32 RISC type processor [2].

The paper is organized as follows. The next section pre-sents a related work about functional testing processors.The third section describes motivation and goals of thedissertation thesis. Basic definitions, notation and thenew developed test generation method are presented insection four and five respectively. Selected two experi-mental results over the DP32 processor model in VHDLand its ISA are presented in section six. The last sectionconcludes the paper with a summary of theoretical andpractical contributions obtained in the dissertation the-sis. The list of references and author’s publications fromthe dissertation thesis core are involved at the end of thepaper.

2. Functional testing processors - backgroundThere is a long history on functional testing processorsand microprocessors. Fault coverage is low in applica-tion of the earlier developed TPG methods for functionaltesting. They have started more from behavioural leveland not from register transfer level (RTL) or structurallevel of processor models. Recently, some research activi-ties have been initialized towards functional testing usingmainly RTL. The processor applies functional test pro-grams named test mixes in the paper (this notation is de-fined and presented in section four) using its native ISA.The test mixes run at the processor’s actual operatingfrequency.

Various methods have been presented for the functionalTPG based on different fault models [4], [5], [12], [13],[16]. The latest use genetic algorithms (GAs) with oneselected evolutionary strategy (ES) and randomly gener-ated a first population (starting test programs/test mixes)[6], [7], [10], [14], [15]. Fault coverage quality is basicallyevaluated by code coverage calculation and using a profes-sional simulator or a professional fault simulator based onstuck-at fault models (stuck–at 0, stuck–at 1). The func-tional ATPGs are mostly evaluated by covering activationof registers during data transfer based on the processorRTL model. It was published that if tests for SBST showhigh code coverage then also can achieve high coverage

of stuck–at 0, stuck–at 1 faults. Experimentally it hasbeen achieved that app. 90 % code coverage is sufficientfor such software–based tests [14]. Automatization of thedeveloped SBST methods is essential aspect in testingprocessors.

One of the first automatized functional test generationmethod is based on a system graph representing regis-ters (nodes) and data transfers (arcs) and they are eval-uated by mnemonic code of instructions [19]. Evalua-tion of the proposed method was realised over the pro-cessor core DP32 (the 32–bit RISC type processor) andby an in–house structural fault simulator based on stuck–at fault coverage (96 % fault coverage has been achievedby the described method) [3]. The other two functionaltest generation methods use abstraction models of pro-cessors like RTL models and their ISA. The methods arebased on analysis of data dependencies of available SBSTprograms and some parameters of the tested processors.These methods are targeted to pipeline processor archi-tectures. Experiments shown remarkable results up to95 % in stuck-at fault coverage for two RISC processors(MiniMIPS and OpenRISC 1200) [8]. Similar ideas werepresented with experiments over the Sun OpenSPARCmicroprocessor [1].

The next methods for automatic test programs genera-tion use a selected GA and ESs application with feedbackinformation targeted to generation of new populations us-ing simulators [6], [7], [14], [15], [18]. The idea presentedin the papers has been transformed into implementationof a new ATPG system, named µGP. The µGP systemcomposes of a test generator at RTL, a fault simulatorfor stuck-at faults, ISA library and processor division intomodules. The evolutionary strategy ES(µ + λ) was usedin the generator where µ is parents population and λ isnew individuals for generating a new population, (newtest programs/new test mixes). The new individuals areachieved by means of tournament selection for their re-production [18]. The µGP system was also used for auto-matic test programs generation for 32–bit processor Leon2with SPARC V8 architecture [7]. The simulator Mod-elSim was used for simulating the processor design andcalculating the statement coverage. The fitness functionwas defined as the direct measure of the test program’scoverage. Another case study and results with µGP havebeen described in [6] and [15]. The µGP effectiveness weretested also over the Intel i8051 processor core with 93,6% structural fault coverage using on the academic faultsimulator FENICE [18]. Some results for µGP and theDLX/pII processor core are presented in [14]; the Mod-elSim simulator [10] was used as the external evaluatorwith different metrics. The obtained results were shownup to 90 % in statement and branch coverage and above80 % in condition and toggle coverage.

The SBST characteristics and advantages are [5]:

• Non-intrusiveness: SBST does not need any pro-cessor modification and no extra power consumptionis produced in comparison to the normal operationmode.

• At-speed testing: Test program application andresponses evaluation are performed at the proces-sorAt’s actual frequency, which enables examinationof faults that are not observable at lower testing fre-quencies.

Page 28: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

26 Hudec, J.: Contrib. to the Methods and Algorithms of Automatic Generation of Functional Tests for Processors

• No over-testing: SBST concentrates on the samecircuitry used in the functional processor modes andtherefore avoids test overkill, and thus detection offaults that would never manifest during the nor-mal processor operation. It leads to significant yieldgains and also shorting test time.

• In-field testing: Self-test programs from manufac-turing testing can be reused in the field throughoutproduct lifetime which is very important in nowa-days complex applications.

The SBST methods show these disadvantages [4]:

• Some faults can modify the test program flow andpotentially can lead to an endless execution, makingit difficult to take back the control of the system atthe end of the test.

• Some memory addresses are never accessible becausethey are not reserved to the test procedure, there-fore resulting in a coverage loss.

• Size and execution time of the test could be pro-hibitive in case of stringent real-time application re-quirement.

• IP (intellectual property) protection is not guar-anteed, since the test program may reveal detailsabout the processor core implementation.

All SBST and functional test generation methods usingGAs generate test programs by using one type of GAsand one applied evolutionary strategy ES(µ + λ). Thefirst population is generated randomly in all publishedSBST TPG methods. Obviously the main drawback ofthese methods is high computing complexity and there-fore there is open space for other research.

3. Motivation and objectivesThe key idea of the dissertation thesis is development ofa new functional test generation method for SBST basedon GAs with adaptation of various evolutionary strate-gies. Besides of basic evolutionary strategies ES(µ + λ)and ES(µ, λ) it should be useful to use more sophisticatedES defined recently. This evolutionary strategy increasesusability of other specified parameters as life-time of pop-ulation (k) and probability of mutation (p) with the goalto use changing the mentioned strategies.

The latest evolutionary strategy ES(µ, k, λ, p) is definedin [17] and it hasn’t been used in practical GAs applica-tions and not in ATPG methods till now. Thus, it wasmain motivation for new GAs application in functionaltest generation. The strategy ES(µ, k, λ, p) uses:

• Pseudorandom selection of r individuals (r ≥ λ ≥ µ)from µ parents.

• Executing operations by genetic operators.

• Making an order of the obtained individuals basedon fitness selection of λ individuals to the new cre-ated population with the best fitness in accordanceof selected value of parameter k(k ≥ 1) - lifetime ofindividuals (test mixes) in particular generations.

The ES changing should allow finding maximum fasterthan using only one basic ES. Thus adaptability, flexibil-ity and optimal test generation for SBST can be improved.The goals of the dissertation thesis were to develop andimplement the new SBST generation method suitable forits automatic implementation based on this new ES andto develop a new method for generation of the first pop-ulation more deterministically than randomly.

4. Basic definitions and notationBasic terms used in the proposed method for SBST andin GA application are described in the section.

A test mix is a valid sequence of finite and ordered in-structions that can be run in normal execution instructionmechanism (similar to functional programs).

A test for processor consists of a set of test mixes.

Test mix length is number of instructions in a test mix.

Term ”test mix” is used instead of term ”test program”used in published methods because both terms have beendefined in the same time [10].

Code coverage is defined as coverage of different typesof VHDL statements in processor model description. Thebasic code coverage types are:

• statement coverage,

• branch coverage,

• condition coverage,

• toggle coverage.

Function fitness for one test mix Mj , is defined by (1)with condition described by (2) for j = 1, 2, ..., N, whereN is number of test mixes.

Fj = ws.sj + wb.bj + wc.cj + wt.tj , (1)

where ws, wc, wb and wt are weights of code coveragetypes (statement, branch, condition, toggle) and sj , bj ,cj , tj are relevant values of code coverage by test mix Mj

received by simulation. Values of ws, wc, wb and wt arefrom <0, 1>, and their sum is 1.

ws + wc + wb + wt = 1 (2)

The advanced evolutionary strategy ES(µ, k, λ, p) is usedin GA application. Parameters µ, λ are parents and newpopulation of generated test mixes, k is a life-time of in-dividuals (test mixes) and p is probability of mutation. Ifk = 1/k = ∞ in ES(µ, k, λ, p) then ES(µ, λ)/ES(µ + λ) ispredetermined.

Diversity is a measure for characterizing an existed pop-ulation of test mixes and indicates how many differenttypes of them are involved in a new population.

Evenness is a quantitative measure of type representa-tions in existing population which quantifies how equal isthe population of testing mixes numerically.

Page 29: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 24-30 27

First population (starting individuals) for running GAin SBST generation is a set of test mixes.

The Shannon-Wiener index [17] and/or standard devia-tion have been defined for diversity and evenness compu-tation. Both types have to be specified for SBST methodin application to a VHDL processor model for receivingan optimal test with sufficient (good) code coverage.

Besides of using the new ES, it is important to find thebest first population. It can be generated randomly as itis used in the published SBST method till now. The ideato create this population as best as possible means thatGA application can find the best test mixes in a shortertime. Three strategies have been defined in the abovecontext.

Strategy 1. Deterministic or pseudorandom generationof an initial started population (test mixes) with highercode coverage can increase quality of the final functionaltest consisting several test mixes.

Strategy 2. Application of the advanced ES in whichall the basic ESs can be combined using different geneticoperators for selection and combinations of crossover andmutation can improve finding optimal final solution fortest mixes and thus for functional testing processors.

Strategy 3. The fitness function defined more sophisti-cally in GAs can contribute to better feedbacks in GAsrun.

Other important parameters for generating the test forSBST have to be specified. They are:

• Number of test mixes or a code coverage limit forending their generation based on a specified value ofthe code coverage.

• ES alternation, used GA operators, a first popula-tion.

• Weights and the code coverage specification for fit-ness calculation.

• Test mix length depending of ISA complexity.

• Dependability of instructions sequence in a test mix.

• Operands selection for instructions, if any.

5. Adaptive ATPG method for processorsThe general diagram of a new functional ATPG method ispresented in figure 1. Inputs to test generation is VHDLmodel of a tested processor, parameters for test mixesand for GA application described in previous section, anddatabases of instructions and operands for instructionsinvolved in test mixes. The blocks ”Automatic test mixesgeneration” and ”Test mixes evaluation and ES adapta-tion” are linked to the simulator ModelSim.

The block ”Initial test mixes generation”produces a start-ing set of test mixes selected by one of the implementedmethod (random, priority, grouping). User can select oneof them for a tested processor. A lot of experiments weredone using these methods over one type processor (DP32)and the most efficient and suitable method was grouping.All results are presented in the dissertation thesis. The

main principle of the method grouping is following: Allinstructions of a tested processor ISA are divided intoseveral groups based on their characteristics, e.g. instruc-tion with zero, one or two operands, branch instructions,or based on instruction functionality e.g. arithmetic oper-ations, logic operations etc. Then a test mix is generatedby adding one instruction from each group based on aspecified test mix length. Each instruction has the sameprobability of its occurrence. There is possible also to useinstruction prioritization.

The main block ”Automatic test mixes generation” is acore of the SBST method and is activated by the initialtest mixes as the first population.

Then GA with genetic operators (selection/ reproduction,mutation, crossover) is performed on the first populationof test mixes, and with reference to the fitness value ofeach mix calculated by ModelSim. The parents for thenext population of test mixes are selected by changing pa-rameters and stated ES. Some constraints such as elitismof individuals with changing parameter k in ES (µ, k, λ, p),tournament and roulette selection are also applicable. Ifthe feedback values in the GA progress indicate the smallvalue of diversity or high value of evenness then alter-nation of parameters in GA have to be adopted. Thuscontinual adaptation of input parameters k (life-time oftest mix/elitism) and p (probability of mutation) and theselection methods (roulette, tournament etc.) are applieduntil the higher fitness values of generated test mixes areachieved. This procedure is repeating until the best codecoverage of test mixes or the maximal number of popula-tions (generations) is achieved.

There is a lot of craftsmanship in definition and assess-ment of fitness function and the GA parameters. In thepresented SBST method there is combination of variousconstraints and code coverage for estimating the param-eters of the fitness function: evaluation statement cover-age, branch coverage, condition coverage and toggle cov-erage. The evolutionary scheme in used GA is very com-prehensive and is based on changing advanced strategyES (µ, k, λ, p).

6. Implementation and experimental resultsThe described SBST generation method was implementedand integrated in a new software environment and toolAGenMIX implemented in C# language using MicrosoftVisual Studio and Microsoft .NET Framework on the plat-form Microsoft Windows. All inputs/outputs, except forthe evaluating the individuals use the XML format. XMLallows usability of standard tools such as browsers, con-straints inspection, data library and options for popula-tions and configuration. The VHDL language is used foreach tested processor for which also ISA library, databaseof operands, specification of parameters and ESs, theyhave to be created. The system AGenMIX is adaptableto various ES and can be extended by other blocks or func-tionalities, if necessary. A final functional test consists ofthe best test mixes in optimal length with sufficient codecoverage.

DP32 is a RISC type 32-bit processor core was used forall experiments presented in the dissertation thesis. ItsISA contains 20 types of instructions with the length of32 or 64 bits that are frequently used in programs. Itis a typical representative of ARM (Advanced RISC Ma-

Page 30: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

28 Hudec, J.: Contrib. to the Methods and Algorithms of Automatic Generation of Functional Tests for Processors

Figure 1: General diagram of automatic SBST generation - AGenMIX

Table 1: Parameters for experiment 1Parameters Value

Number of instructions in test mix 20Number of individuals in a population 12

Number of generation 15Method–GA fixParameter p 0, 1Parameter k ∞

Elitism 1Code coverage metric statement

chine) processor architecture. The processor core is de-scribed as a synthesizable VHDL model for academic andresearch purposes. Specification and architecture of DP32is open, portable, non-proprietary and scalable to embed-ded processors, all sharing the same core (non-privileged)instruction set. All experiments use the statement cover-age for fitness evaluation. Two selected experiments fromthe dissertation thesis are described over processor DP32for visibility of feedback efficiency integrated into the testmixes generation.

Experiment 1. Generation of test mixes for DP32 byGA without feedback from fitness evaluation and chang-ing the basic evolutionary strategy. Input parameters arepresented in table 1. The first population (starting testmixes) has been generated by method grouping. In thisexperiment also elitism was used during all generation ofnew populations.

Maximum statement coverage of the best test mix forspecified number of generation is 42.2 %. This low valuedepends on quality of elite individuals and their impactcannot be blocked off till end of the generation. For highervalue it should be increase the limit or to use another ES.

Experiment 2. Generation of test mixes for DP32 byGA with feedback from fitness evaluation and changingthe basic evolutionary strategy. Input parameters are

Table 2: Parameters for experiment 2Parameters Value

Number of instructions in test mix 20Number of individuals in a population 12

Number of generation 15Method–GA feedbackParameter p 0, 1Parameter k 3

Elitism 0Code coverage metric statement

presented in table 2. The first population (starting testmixes) has been generated by method grouping. Theelitism was constrained by parameter k and its value wasspecified randomly.

Maximum statement coverage of the best test mix afterdefined limit for number of generation is 82.9 %. Theachieved results show a significant improvement of thestatement coverage for the defined generations number(15) using feedback and changing evolutionary strategies.Experiments concerning first population generation pre-sented in the dissertation thesis shown the best quality ofthe method grouping [11]. Complex experiments for DP32processor and its ISA, described in the dissertation thesis,achieved maximum 95,67 % in the coverage statement.

7. ConclusionThe main contribution of the dissertation thesis is de-velopment of the new complex and adaptive functionaltest generation system based on GAs and the advancedevolutionary strategy defined as ES(µ, k, λ, p). The devel-oped methods, algorithms have been implemented in thesoftware tool AGenMIX for automatic software-based testgeneration for RISC type processors modelled by VHDL.

The new system is useful for verification and testing pro-cessors. The test mixes (test programmes) for proces-

Page 31: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and Technologies Bulletin of the ACM Slovakia, Vol. 6, No. 4 (2014) 24-30 29

sors can be generated in shorter time than using similarmethods with one specified ES, a random generated firstpopulation. Functionality and effectiveness of the new im-plemented TPG method and the system AGenMIX havebeen tested on the DP32 RISC type processor and its ISAusing the professional simulator ModelSim. Experimen-tal results confirmed effectiveness of various ESs combi-nation, more genetic operators for receiving an optimalset of test mixes on qualitative higher level for a testedprocessor.

The partial contribution is in the new generating firstpopulation method (starting test mixes) by the proposedmethod grouping. A lot of experiments with other meth-ods (random, priority, grouping with various modifica-tions etc.) shown the best efficiency of the method group-ing. The final test mixes can be generated in shorter timewith higher code coverage.

Theoretical contributions of the dissertation thesis are inapplication of the advanced ES with their parameters (di-versity and evenness) in software-based test generation forprocessors and variety of first population generation withthe goal to receive the final test mixes in shorter timewith sufficient high code coverage. The implemented sys-tem AGenMIX is flexible to specified parameters, scalableto processor models and their ISA and allows the usersgenerate test mixes with interactions. The system AGen-MIX can be used for practical verification purposes at theacademic level.

Future works are targeted to the experiments with othertype of processor (e.g. RISC processor DLX - 32 bit pro-cessor with pipeline instruction architecture).

Acknowledgements. This work has been supported bySlovak National Research Grant Agency under projectno. VEGA 1/1008/12 Optimization of low-power designof digital and mixed integrated systems and project no.VEGA 1/0649/09 Security and reliability in distributedcomputer systems and mobile computer networks.

References[1] A. Apostolakis, M. Psarakis, D. Gizopoulos, A. Paschalis, and

I. Parulkar. Exploiting thread-level parallelism in functionalself-testing of cmt processors. In 14th IEEE European TestSymposium ETS 2009, pages 33–38. IEEE, May 2009.

[2] P. Ashenden. The VHDL Cookbook. University of Adelaide,Adelaide, Australia, 1990.

[3] V. V. Belkin and S. G. Sharshunov. Isa based functional testgeneration with application to self-test of risc processors. In 9thIEEE Workshop on Design & Diagnostics of Electronic Circuits& Systems (DDECS 2006), pages 73–74. IEEE, April 2006.

[4] P. Bernardi, L. M. Ciganda, E. Sanchez, and M. S. Reorda. Mihst:a hardware technique for embedded microprocessor functionalon/line self-test. IEEE Transactions on Computers, PP(99):1–12,2013.

[5] P. Bernardi, M. Grosso, E.Sanchez, and M. Reorda.Software-based self-test of embedded microprocessors. In Designand Test Technology for Dependable Systems-on-Chip, Chapter15, pages 339–359. Information Science Reference, IGI Global,Herschey, New York, 2011.

[6] P. Bernardi, E. Sanchez, M. Schillaci, G. Squillero, and M. S.Reorda. An evolutionary methodology to enhance processorsoftware-based diagnosis. In 2006 IEEE Congress onEvolutionary Computation, pages 859–864. IEEE, July 2006.

[7] F. Corno, E. Sanchez, M. S. Reorda, and G. Squillero. Automatictest program generation. IEEE Design & Test of Computers,21(2):102–109, 2004.

[8] D. Gizopoulos, M. Psarakis, M. Hatzimihail, M. Maniakos,A. Paschalis, A. Raghunathan, and S. Ravi. Systematicsoftware-based self-test for pipelined processors. IEEETransactions on Very Large Scale Integration (VLSI) Systems,16(11):1441–1453, 2008.

[9] M. Graphics. ModelSim SE Command Reference Manual. MentorGraphics Corp. http://www.supportnet.mentor.com/support/.[Online; accessed September, 2009].

[10] J. Hudec. Vlsi system test design: The methods, problems andexperience in microprocessor testing using aftg. In 16th Int.Conference Information Technology Interfaces ITI’94, pages191–193. UCC Zagreb, IEEE, June 1994.

[11] J. Hudec. Some results in automatic functional test design forprocessors. In Emerging Trends in Computing, Informatics,Systems Sciences, and Engineering, Lecture Notes in ElectricalEngineering, Vol. 151, pages 965–972. New York: SpringerScience + Business Media B.V., 2013.

[12] P. S. Kabiri and Z. Navabi. Effective rt/level software/basedself/testing of embedded processor cores. In IEEE 15thInternational Symposium on Design and Diagnostics ofElectronic Circuits & Systems, DDECS 2012, pages 209–212.IEEE, April 2012.

[13] M. Psarakis, D. Gizopoulos, E. Sanchez, and M. S. Reorda.Microprocessor software-based self-testing. IEEE Design & Testof Computers, 27(3):4–19, 2010.

[14] E. Sanchez, M. S. Reorda, and G. Squillero. Efficient techniquesfor automatic verification-oriented test set optimization.International Journal of Parallel Programming, 34(1):93–109,2006.

[15] E. Sanchez, M. Schillaci, G. Squillero, and M. S. Reorda. Anenhanced technique for the automatic generation of effectivediagnosis-oriented test programs for processor. In Design,Automation & Test in Europe Conference & Exhibition 2007,DATE 07, pages 1–6. IEEE, April 2007.

[16] M. Schölzel, T. Koal, S. Röder, and H. Vierhaus. Towards anautomatic generation of diagnosis in field sbst for processorcomponents. In 14th IEEE Latin-American Test Workshop, LATW2013, pages 1–6. IEEE, April 2013.

[17] H. P. Schwefel and T. Bäck. Evolution strategies. In GeneticAlgorithms in Engineering and Computer Science, pages111–140. John Wiley & Sons Ltd, Chichester, 1995.

[18] G. Squillero. Microgp–an evolutionary assembly programgenerator. In Genetic programming and evolvable machines,pages 247–263. New York: Springer, 2005.

[19] S. M. Thatte and J. A. Abraham. A methodology for functionallevel testing of microprocessors. In 8th International Symposiumon Fault-tolerant Computing, pages 90–95. IEEE, 1978.

Selected Papers by the AuthorJ. Hudec. Some Results in Automatic Functional Test Design for

Processors. In T. Sobh, K. Elleithy, eds. Emerging Trends inComputing, Informatics, Systems Sciences, and Engineering,Lecture Notes in Electrical Engineering, Vol. 151, pages965–972, ISBN 978-1-4614-3557-0, New York: SpringerScience + Business Media B.V. 2013.

J. Hudec. An Efficient Technique for Processor Automatic FunctionalTest Generation based on Evolutionary Strategies. In V.Luzar-Stiffler, ed. 33rd International Conference on InformationTechnology Interfaces ITI 2011 Proceedings, pages 527–532,ISBN 978-953-7138-20-2, IEEE Catalog NumberCFP11498-PRT, Cavtat/Dubrovnik, Croatia, June, 2011, UCCZagreb&IEEE 2011.

J. Hudec. Processor Functional Test Generation - Some Results withusing of Genetic Algorithms. In V. Vranic, ed. 2nd EasternEuropean Regional Conference on the Engineering of ComputerBased Systems ECBS-EERC 2011 Proceedings, pages 159–160,ISBN 978-0-7695-4418-2, IEEE Catalog NumberCFP11ECB-CDR, Bratislava, Slovakia, September, 2011, IEEEComputer Press, Los Alamitos: IEEE Computer Society 2011.

Page 32: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

30 Hudec, J.: Contrib. to the Methods and Algorithms of Automatic Generation of Functional Tests for Processors

J. Hudec. Some results in automatic functional test design for VLSIcircuits. In V. Luzar-Stiffler, ed. 32nd International Conferenceon Information Technology Interfaces ITI 2010 Proceedings,pages 635–638, ISBN 978-953-7138-18-9, IEEE CatalogNumber CFP10498-PRT, Cavtat/Dubrovnik, Croatia, June, 2010,UCC Zagreb&IEEE 2010.

J. Hudec. Functional Test Generator for VLSI Circuits. In A.Popov,R.Romanski, ed. 19th International Conference on Systems forAutomation of Engineering and Research SAER-2005Proceedings, pages 46–50, ISBN 954-438-501-0,Varna, Bulgaria,Sept. 2005, TU Sofia, EBSCO Publishing 2005.

J. Hudec. Design Methodology and Practice of VLSI Functional TestSynthesis. In D.Kalpic, V.H. Dobric, ed. 23rd International Conf.on Information Technology Interfaces ITI 2001 Proceedings,pages 461–466, ISBN 953-96769-3-2, Catalog Nr. 01EX491,Pula, Croatia, June 2001, SRCE Zagreb&IEEE 2001.

J. Hudec, M. Hustava. Optimized Design and Implementation of theToroidal Neural Processor in the Xilinx Virtex FPGAEnvironment. In A.Popov, R.Romanski, ed. 15th InternationalConference on Systems for Automation of Engineering andResearch SAER-2001 Proceedings, pages 177–184, ISBN954-8329-33-6,Varna, Bulgaria, Sept. 2001, TU Sofia, EBSCOPublishing 2001.

J. Hudec, E. Gramatová. An Efficient Functional Test GenerationMethod for Processors using Genetic Algorithms. Journal ofElectrical Engineering JEEEC, ISSN 1335-3632, 2014, submittedto journal.

Page 33: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Instructions to the authors

Publishing procedureAll contributions are web-published. A contribution ispublished without unnecessary delay right after it hasbeen accepted. Contributions are published on the fly inthe current issue. It is at the discretion of the Editor-in-chief to determine, when the current issue is closed anda subsequent new one is open. There will be at least twoissues in a year but it is left up to the Editor-in-chief toadjust periodicity of the Bulletin to actual needs.

Extended abstracts of theses is the primary type of ar-ticle in the Bulletin. Each extended abstract will by an-notated by identifying the thesis supervisor, who mustrecommend it for publication and stands for the Edi-torial Board in a role similar to a reviewer. We offerpublishing extended abstracts on the Bulletin’s web be-fore the thesis is defended. This preliminary publishingis a specific service to the academic community. As soonas we learn about successful defence, the extended ab-stract gains the status of accepted paper and will beincluded in the forthcoming issue. The accepted paperwill be annotated with the date of successful defence andname of the insitution where the defence took place.

It is the policy of the Bulletin to offer a free access toall its articles on the web. Moreover, the publisher willseek opportunities to promote as wide as possible accessand/or indexing of the articles. All the past issues re-main accessible on the web as part of the web portal ofthe Bulletin. Closed issues will be made available also ina printable form, free for downloading and printing byanyone interested.

Policy on OriginalityIt is the policy of the Bulletin that Slovak Universityof Technology be the sole, original publisher of articles.Manuscripts that have been submitted simultaneously toother magazines, journals or to conferences, symposia,or workshops without the prior written consent of theEditor-in-Chief will be rejected outright and will not bereconsidered. Publication of expanded versions of papersthat have been disseminated via proceedings or newslet-ters is permitted only if the Editor-in-Chief judges thatthere is significant additional benefit to be gained fromjournal publication. A conference chairperson can ar-range with the Editor-in-Chief to publish selected pa-pers from conferences, symposia, and workshops, aftersuitable reviewing. The papers must meet the editorialrequirements for research articles. Acknowledgement ofthe originating conference will appear as a credit whenthe paper is published in the Bulletin.

Manuscript information for extended abstractsof doctoral dissertationsAll contributions are submitted electronically. Send yourmanuscript as LATEXsources and .pdf files by e-mail [email protected]. Paper’s length should be6-12 pages. Please, use LATEXstyle, which is available todownload at bulletin web-page http://slovakia.acm.

org/bulletin/.

Some remarks to the provided style:

• Headings and AbstractThe heading must contain the title, full name, andaddress of the author(s), thesis supervisor, abstractof about 100-200 words.

• Categories and Subject DescriptorsDefine category and subject descriptors accordingto ACM Computing Classification System(see http://www.acm.org/about/class/1998/).

• KeywordsPlease specify 5 to 10 keywords.

• EquationsYou may want to display math equations in threedistinct styles: inline, numbered or non-numbereddisplay (we recommend the numbered style). Pleasemake sure that your equations are clearly formu-lated and described.

• Figures and tablesFigures and tables cannot be split across pages,the best placement for them is typically the top orthe bottom of the page nearest their initial cite.To ensure this proper ”floating” placement of fig-ures/table, use the environment figure/table to en-close the figure and its caption.

• ReferencesPlease use BibTeX to automatically produce thebibliography. If possible use abbreviations like:Proceedings – Proc., International – Int., Confer-ence – Conf., Journal – J.

• Selected papers by the authorThis section is used for thesis extended abstracts.Please write down all publications which are re-lated to your thesis.

Page 34: In fo rm atio n Scien ces an d Tech n o lo g ies B u lletin o f th e A …acmbulletin.fiit.stuba.sk/vol6num4/vol6num4.pdf · 2015-09-17 · In fo rm atio n Scien ces an d Tech n o

Information Sciences and TechnologiesBulletin of the ACM Slovakia

September 2014Volume 6, Number 3

D. Chalupa

D. Levy

P. Zemek

Partitioning Networks into Cliques: A Randomized Heuristic Approach

WLAN Power Save by Header Compression and Packet Overhearing Reduction

One-Sided Random Context Grammars

Published by Slovak University of Technology Press, Vazovova 5, 812 43 Bratislava, IÈO: 00397687

on behalf of the ACM Slovakia ChapterISSN 1338-1237 (printed edition)

ISSN 1338-6654 (online)Registration number: MK SR EV 3929/09

1

9

19

Chapter