Prefixes, Suffixes and Substrings in a Multilanguage - Hikari Ltd

0 downloads 0 Views 508KB Size Report
In this paper, prefix, suffix and substring relations are described in a .... in a multilanguage is described which would help studying stringology in a multiset-.
Applied Mathematical Sciences, Vol. 8, 2014, no. 127, 6325 - 6339 HIKARI Ltd, www.m-hikari.com http://dx.doi.org/10.12988/ams.2014.48660

Prefixes, Suffixes and Substrings in a Multilanguage: A Perspective Dasharath Singh (Former Professor: Indian Institute of Technology Bombay) Corresponding author Mathematics Department, Ahmadu Bello University Zaria, Nigeria Ahmed Ibrahim Isah Mathematics Department, Ahmadu Bello University Zaria, Nigeria Copyright Β© 2014 Dasharath Singh and Ahmed Ibrahim Isah. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract In this paper, prefix, suffix and substring relations are described in a Multilanguage. It is shown that prefix and suffix relations give rise to a relational structure of a linear multiset order, and substring relations determine only a partial multiset order. The distinctive features of these relations in multilanguage vs. standard formal language are identified by using their graphical and Hasse diagram representations. Finally, certain monoids of these relations and their homomorphisms are described. Mathematics Subject Classification: 68Q45, 94A45, 03E02 Keywords: String, Prefix, Suffix, Substring, Monoid, Multilanguage

1 Introduction Gottlob Frege’s formulation of the first-order logic in 1879 is known to be the first description of the structure of a formal language. It was immensely augmented by

6326

Dasharath Singh and Ahmed Ibrahim Isah

Hilbert, Alan Turing and Emil Post. In the mid-1950s, Noam Chomsky’s endeavor to formulate a general theory of the syntax of natural languages made a great impact on the development of formal language theory. In the 1960s and 1970s, particularly due to the advent of electronic computers, much of the foundations for the theory of formal languages were erected in order to describe the process linked with the use of computers and communication devices. All forms of information (whether numbers, names, pictures, or sound waves) could be represented as strings and a collection of strings could be structured to represent a language became central to diverse applications of formal languages in computer science and linguistics, and more recently, in soft sciences such as biology and economics. In fact, the study of stringology has come to occupy the core of the formal language theory. On the other hand, the fact that many query languages and database languages do require multiset-based semantics, the study of stringology needs to be extended to multilanguages. This paper attempts to describe prefix, suffix and substring relations and their properties in a multilanguage. In particular, monoids of these relations and their homomorphisms are described.

2 Some Basics of Standard Formal Language Theory Most of the definitions given here are standard and mimicked from various sources, particularly from [1] and those listed in the references. Basically, a language 𝐿 is defined as a set of strings over a fixed alphabet Ξ£. An alphabet is a nonempty set of distinguishable symbols, called terminal symbols, sometimes denoted 𝛴𝑇 . A language deployed to generate strings of another language over an alphabet Ξ£ is called metalanguage often denoted 𝛴𝑁 , and it is supposed to consist of a set of syntactic classes or variables called nonterminal symbols. An element of an alphabet is called a letter or a character. An alphabet need not be finite or even countably infinite. However, for our purposes here, we shall assume it to be finite. A string is a finite ordered set of symbols from the alphabet. A string is also called a (finite) sequence, a word, or a sentence depending on its nature. A string consisting of π‘˜ symbols (π‘˜ > 0) is said to be a string of length π‘˜. In the event, an empty string (i.e., a string of length 0), denoted ο₯, , , or 1, is admitted, the system can have strings of length π‘˜ β‰₯ 0. Strings can also be defined as functions [1]. For any integer 𝑛 β‰₯ 1, let [𝑛] = {1, 2, … , 𝑛}, and for 𝑛 = 0, let [0] = βˆ…. A string 𝑒 of length 𝑛 over a fixed Ξ£ is a function

Prefixes, suffixes and substrings in a Multilanguage

6327

𝑒: [𝑛] ⟢ Ξ£. When 𝑛 = 0, the special string 𝑒: [0] ⟢ Ξ£, of length 0 (having no symbol), is called the empty or null string. Given a string 𝑒: [𝑛] ⟢ Ξ£ of length 𝑛 β‰₯ 1, let 𝑒(𝑖) denote the 𝑖 π‘‘β„Ž letter in the string 𝑒. A string 𝑒 of length 𝑛 can also be represented as 𝑒 = 𝑒1 𝑒2 … 𝑒𝑛 , 𝑒𝑖 ∈ Ξ£, 𝑖 = 1, 𝑛. [5] For example, let Ξ£ = {π‘Ž, 𝑏} and 𝑒: ⟢ Ξ£ be defined such that 𝑒(1) = π‘Ž, 𝑒(2) = 𝑏, 𝑒(3) = 𝑏, 𝑒(4) = π‘Ž and 𝑒(5) = π‘Ž, then 𝑒 = π‘Žπ‘π‘π‘Žπ‘Ž. Let Ξ£ ο€ͺ denote the set of all strings and Ξ£ + = Ξ£ ο€ͺ βˆ’ {ο₯}, denote the set of all nonempty strings over Ξ£. A formal language (or simply a language) 𝐿 is a subset of Ξ£ ο€ͺ i.e., 𝐿 βŠ† Ξ£ο€ͺ . A language can also be considered as a subset of the free monoid on an alphabet; however, as the language consisting of a free monoid is too large, it is not found suitable for practical applications. Following [1], we describe below two basic operations which are central to both standard formal languages and multilanguages. Concatenation Let 𝑒: [π‘š] ⟢ Ξ£ and 𝑣: [𝑛] ⟢ Ξ£ be two strings over Ξ£, then concatenation of 𝑒 and 𝑣, denoted 𝑒. 𝑣 or 𝑒𝑣, is the string 𝑒𝑣: [π‘š + 𝑛] ⟢ Ξ£, defined as 𝑒(𝑖)

if 1 ≀ 𝑖 ≀ π‘š,

u v (i) = 𝑣(𝑖 βˆ’ π‘š) if π‘š + 1 ≀ 𝑖 ≀ π‘š + 𝑛.

It is immediate to see that the following holds: π‘’πœ€ = πœ€π‘’ = 𝑒 and 𝑒(𝑣𝑀) = (𝑒𝑣)𝑀. In other words, concatenation is a binary operation on Ξ£ ο€ͺ which is associative and has πœ€ as an identity. Thus, (Ξ£ ο€ͺ , ., πœ€) or (Ξ£ ο€ͺ , . ) is a monoid, and (Ξ£ + , . ) is a (free) semigroup generated by Ξ£. Note that concatenation, in general, is not commutative i.e., 𝑒𝑣 β‰  𝑣𝑒. For example, let 𝑒 = π‘Žπ‘Žπ‘, 𝑣 = 𝑏𝑏 over Ζ© = {π‘Ž, 𝑏}, then 𝑒𝑣 β‰  𝑣𝑒. Powers of strings Given a string 𝑒 ∈ Ξ£ ο€ͺ and 𝑛 β‰₯ 0, 𝑒𝑛 is defined as follows:

6328

Dasharath Singh and Ahmed Ibrahim Isah

πœ€

if 𝑛 = 0,

π‘’π‘›βˆ’1 𝑒

if 𝑛 β‰₯ 1.

un =

Clearly, 𝑒1 = 𝑒, πœ€ 𝑛 = πœ€, and 𝑒𝑛 𝑒 = 𝑒𝑒𝑛 , for all 𝑛 β‰₯ 0. For example, let Ζ© = {π‘Ž, 𝑏, 𝑐}, 𝑒 = π‘Žπ‘π‘π‘Ž, 𝑣 = π‘Žπ‘π‘Ž, 𝑀 = π‘Žπ‘π‘π‘Ž, π‘₯ = π‘Ž, 𝑦 = πœ€; then (𝑒𝑣)𝑀 = 𝑒(𝑣𝑀) = π‘Žπ‘π‘π‘Žπ‘Žπ‘π‘Žπ‘Žπ‘π‘π‘Ž, 𝑒2 = π‘Žπ‘π‘π‘Žπ‘Žπ‘π‘π‘Ž, π‘₯ 6 = π‘Žπ‘Žπ‘Žπ‘Žπ‘Žπ‘Ž, π‘₯𝑦 = π‘₯ = π‘Ž, etc. It is known that, in general, uncountably infinite amount of languages exist over any alphabet. However, in the case of a formal language theory, as it is defined by a grammar or by an automaton, and as such operating in a natural language, at most

countably infinite amount of languages can exist. In view of enormous applications of formal languages, it is not surprising that a vast amount of literature is available on the topic (see 1, 2, 3, 4, 5, for details).

3 Multilanguages Knuth, in the summer of 1964, while writing the book entitled The Art of Computer Programming, drafted a chapter on The theory of languages where he emphasized the need to keep a track of the multiplicity of strings in the language so that a string would appear several times if there were several ways to parse it. This was recognized quite natural from a programmer’s point of view because transformations on context-free grammar (its terminal strings form multisets if it is non-circular) were found most useful in practice, especially when they yielded isomorphisms between parse trees. In fact, Knuth [6] is the first place where an elaborate description of multilanguages appeared. Knuth defines a multilanguage simply as a multiset of strings.

3.1 Basics of a Multilanguage In the following, we briefly describe multisets, multiset relations, and lexicographic ordering on multisets. Further, characterization of prefix, suffix and substring relations in a multilanguage is described which would help studying stringology in a multisetbased environment.

Prefixes, suffixes and substrings in a Multilanguage

6329

Multisets A Multiset (mset, for short) is an unordered collection of objects in which, unlike an ordinary set, duplicates or multiples of objects are admitted. For example, a string stripped of its ordering is a multiset. An mset containing one occurrence of π‘Ž, two occurrences of 𝑏, and three occurrences of 𝑐, is variably represented as [[π‘Ž, 𝑏, 𝑏, 𝑐, 𝑐, 𝑐]] or [π‘Ž, 𝑏, 𝑏, 𝑐, 𝑐, 𝑐] or [π‘Ž, 𝑏, 𝑐]1,2,3 or [π‘Ž, 2𝑏, 3𝑐] or [π‘Ž. 1, 𝑏. 2, 𝑐. 3] or [1/π‘Ž, 2/𝑏, 3/𝑐] or [π‘Ž1 , 𝑏 2 , 𝑐 3 ] or [π‘Ž1 𝑏 2 𝑐 3 ]. For convenience, the curly brackets are also used in place of the square brackets. In fact the last form of representation as string, even without using any bracket, turn out to be the most compact one, especially in computational parlance. In general, if π‘₯1 appears π‘˜1 times, π‘₯2 appears π‘˜2 times, … , π‘₯𝑛 appears π‘˜π‘› times in an mset 𝐴, then 𝐴 is expressed as 𝐴 = {π‘˜1 /π‘₯1 , π‘˜2 /π‘₯2 , … , π‘˜π‘› /π‘₯𝑛 }. Formally, a multiset over Ξ£ is a mapping 𝐴 ∢ Ξ£ ⟢ , where  is the set of natural numbers, including zero. Let 𝐴(π‘Ž) or 𝐢𝐴 (π‘Ž) denote the number or count of copies of the symbol π‘Ž in the multiset 𝐴. The empty multiset, denoted ο₯, is defined as ο₯ (π‘Ž) = 0, for all π‘Ž ∈ Ξ£. Follows that 𝐴 is a set, whenever 𝐴(π‘Ž) ≀ 1. Let 𝐴 and 𝐡 be msets over Ξ£. 𝐴 is said to be a submultiset (msubset or submset, for short) of 𝐡, written 𝐴 βŠ† 𝐡 or 𝐡 βŠ‡ 𝐴, if 𝐴(π‘Ž) ≀ 𝐡(π‘Ž), βˆ€π‘Ž ∈ Ξ£. Thus, 𝐴 = 𝐡 iff 𝐴 βŠ† 𝐡 and 𝐡 βŠ† 𝐴. Note that an mset need not be finite, in general. However, for our purposes here, we shall consider it finite.

Multiset relations Let 𝑋 𝑛 be a cardinality bounded mset space defined on a set 𝑋 and 𝐴 ∈ 𝑋 𝑛 . Any subset 𝑅 of 𝐴x𝐴 is said to be an mset relation on 𝐴, denoted 𝑅: 𝐴 ⟢ 𝐴, where every member of 𝑅 has a count 𝐢1 (π‘₯, 𝑦) and 𝐢2 (π‘₯, 𝑦). Note that π‘š/π‘₯ 𝑅 βˆ’ related to 𝑛/𝑦 is symbolized as (π‘š/π‘₯, 𝑛/𝑦) ∈ 𝑅 or π‘š/π‘₯ 𝑅 𝑛/𝑦. In other words, 𝑅 = {(π‘š/π‘₯, 𝑛/𝑦)/ π‘šπ‘›: (π‘š/π‘₯, 𝑛/𝑦) βˆˆπ‘šπ‘› 𝑅}, where (π‘š/π‘₯, 𝑛/𝑦) βˆˆπ‘šπ‘› 𝑅 symbolizes that the ordered pair (π‘₯, 𝑦) occurs π‘šπ‘› times in 𝑅. The domain of the relation 𝑅 on 𝐴 (π·π‘œπ‘š 𝑅, for short) = {π‘₯ βˆˆπ‘  𝐴: βˆƒπ‘¦ βˆˆπ‘‘ 𝐴 such that 𝑠/π‘₯ 𝑅 𝑑/𝑦} where πΆπ‘‘π‘œπ‘š 𝑅 (π‘₯) = sup{𝐢1 (π‘₯, 𝑦): π‘₯ βˆˆπ‘  𝐴}, and the range of 𝑅 on 𝐴 (π‘…π‘Žπ‘› 𝑅, for short) = {𝑦 βˆˆπ‘‘ 𝐴: βˆƒπ‘₯ βˆˆπ‘  𝐴 such that 𝑠/π‘₯ 𝑅 𝑑/𝑦} where πΆπ‘Ÿπ‘Žπ‘› 𝑅 (π‘₯) = sup{𝐢2 (π‘₯, 𝑦): 𝑦 βˆˆπ‘‘ 𝐴}. Note that these Sups always exist for a cardinality bounded msets. For example, let 𝐴 = [5/π‘₯, 7/𝑦, 9/𝑧] be an mset. Then, 𝑅 = {(2/π‘₯, 3/𝑦)/6, (4/π‘₯, 3/ 𝑧)/12, (4/𝑦, 5/𝑧)/20, (6/𝑦, 5/π‘₯)/30, (4/𝑧, 4/𝑧)/16, (5/𝑧, 3/π‘₯)/15, (3/π‘₯, 6/𝑦)/18} is an mset relation on 𝐴 with π·π‘œπ‘š 𝑅 = [4/π‘₯, 6/𝑦, 5/𝑧], and π‘Ÿπ‘Žπ‘› 𝑅 = [5/π‘₯, 6/𝑦, 5/ 𝑧].

6330

Dasharath Singh and Ahmed Ibrahim Isah

An mset relation 𝑅 on an mset 𝐴 is called reflexive iff βˆ€ π‘š/π‘₯ in 𝐴, π‘š/π‘₯ 𝑅 π‘š/π‘₯; irreflexive iff π‘š/π‘₯ 𝑅 π‘š/π‘₯ never holds; symmetric iff π‘š/π‘₯ 𝑅 𝑛/𝑦 imply 𝑛/𝑦 𝑅 π‘š/π‘₯, antisymmetric iff βˆ€ π‘š/π‘₯, 𝑛/𝑦 in 𝐴, π‘š/π‘₯ 𝑅 𝑛/𝑦 and 𝑛/𝑦 𝑅 π‘š/π‘₯ imply π‘š/π‘₯ = 𝑛/𝑦; transitive iff βˆ€ π‘š/π‘₯, 𝑛/𝑦, π‘˜/𝑧 in 𝐴, π‘š/π‘₯ 𝑅 𝑛/𝑦 and 𝑛/𝑦 𝑅 π‘˜/𝑧 imply π‘š/π‘₯ 𝑅 π‘˜/𝑧. An mset relation 𝑅 on an mset 𝐴 is said to be an mset order relation (mset order, for short) or a partial mset order relation, if it is reflexive, antisymmetric and transitive. The pair (𝐴, 𝑅) is called an ordered mset or a partially ordered mset (pomset) structure. A partial mset order is called a linear mset order (or a complete mset order) on 𝐴, if for every two elements π‘š/π‘₯ β‰  𝑛/𝑦 of 𝐴, either π‘š/π‘₯ 𝑅 𝑛/𝑦 or 𝑛/𝑦 𝑅 π‘š/π‘₯ (see [7], [8], for further details). Over an alphabet Ξ£, let Ξ£ βŠ› denote the multiset of all strings, including the empty string which is unique, and Ξ£ ⨁ , the multiset of all non-empty strings. A multilanguage, denoted 𝑀𝐿 , is an msubset of Ξ£ βŠ› . Let for each π‘Ž ∈ Ξ£, 𝑒 ∈ Ξ£ βŠ› , |𝑒|π‘Ž denote the number of occurrences of the symbol π‘Ž in the string 𝑒. Observe that if Ξ£ = βˆ… then βˆ…βŠ› = {πœ€}, and if Ξ£ β‰  βˆ… then Ξ£ βŠ› is countably infinite. Interestingly, even for a tiny alphabet that consists of a single letter e.g., let Ξ£ = {π‘Ž}, Ξ£ βŠ› contains infinitely many strings viz., π‘Ž0 = ο₯, π‘Ž1 = π‘Ž, π‘Ž2 = π‘Žπ‘Ž, etc., and, in general, for every 𝑖 > 0, the string π‘Žπ‘– is in Ξ£ βŠ› . Therefore, given any alphabet Ξ£, there are infinitely many multilanguages over Ξ£. Orderings on strings in a Multilanguage Let Ξ£ = {π‘Ž1 , … , π‘Žπ‘˜ } such that π‘Ž1 < π‘Ž2 < β‹― π‘Žπ‘˜ , 𝑒, 𝑣 ∈ Ξ£ βŠ› , then the lexicographic ordering, denoted β‰Ό, is defined as: if 𝑣 = 𝑒, or uβ‰Ό v

if 𝑣 = 𝑒𝑦 for some 𝑦 ∈ Ξ£ βŠ› , or if 𝑒 = π‘₯π‘Žπ‘– 𝑦, 𝑣 = π‘₯π‘Žπ‘— 𝑧, and π‘Žπ‘– < π‘Žπ‘— for some π‘₯, 𝑦, 𝑧 ∈ Ξ£βŠ› .

In fact, lexicographic ordering of Ξ£ βŠ› is a monotonic and linear mset order. For example, the lexicographic ordering of the strings π‘Žπ‘π‘π‘, π‘Ž, 𝑏, π‘Ž, 𝑏𝑏, π‘Žπ‘Ž, π‘Žπ‘Žπ‘Ž, π‘Žπ‘Ž over Ξ£ = {π‘Ž, 𝑏} is π‘Ž, π‘Ž, 𝑏, π‘Žπ‘Ž, π‘Žπ‘Ž, 𝑏𝑏, π‘Žπ‘Žπ‘Ž, π‘Žπ‘π‘π‘ and also, lexicographic ordering of Ξ£ βŠ› itself is [ πœ€, π‘Ž, 𝑏, π‘Žπ‘Ž, π‘Žπ‘, π‘π‘Ž, 𝑏𝑏, π‘Žπ‘Žπ‘Ž, π‘Žπ‘Žπ‘, … ], etc. Prefix, Suffix and Substring in a Multilanguage Let Ξ£ be an alphabet, Ξ£ βŠ› be the mset of all strings over Ξ£, and 𝑒, 𝑣 ∈ Ξ£ βŠ› .

Prefixes, suffixes and substrings in a Multilanguage

6331

𝑒 is a substring of 𝑣 iff there exist π‘₯, 𝑦 ∈ Ξ£ βŠ› such that 𝑣 = π‘₯𝑒𝑦. In other words, a substring (also, called segment, subword or factor) of a string is any sequence of consecutive symbols that appear in the string. The term substrings of a string represents the set of all substrings of a string. 𝑒 is a prefix of 𝑣 iff there is some 𝑦 ∈ Ξ£ βŠ› such that 𝑣 = 𝑒𝑦. That is, a prefix of a string 𝑒 is a substring of 𝑒 that occurs at the beginning of 𝑒. The term prefixes of a string represents the set of all prefixes of a string. 𝑒 is a suffix of 𝑣 iff there is some π‘₯ ∈ Ξ£ βŠ› such that 𝑣 = π‘₯𝑒. That is, a suffix of a string 𝑒 is a substring that occurs at the end of 𝑒. The term suffixes of a string represents the set of all suffixes of a string. Observe that a prefix is any sequence of leading symbols of the string, and a suffix is any sequence of trailing symbols of the string. Moreover, a substring of a string is a prefix of a suffix of the string, and also, a suffix of a prefix. 𝑒 is a proper prefix (suffix or substring) of 𝑣 iff 𝑒 is a prefix (respectively, suffix or substring) of 𝑣 and 𝑒 β‰  𝑣. Note that prefixes and suffixes both are substrings, but the converse need not hold. For example, let 𝑀 = π‘Žπ‘π‘Žπ‘Ž be a string over Ξ£ = {π‘Ž, 𝑏}. Its prefixes, suffixes and substrings are as follows: Prefixes: ο₯, π‘Ž, π‘Žπ‘, π‘Žπ‘π‘Ž, π‘Žπ‘π‘Žπ‘Ž. Suffixes: ο₯, π‘Ž, π‘Žπ‘Ž, π‘π‘Žπ‘Ž, π‘Žπ‘π‘Žπ‘Ž. Substrings: ο₯, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž, π‘Ž, π‘Žπ‘Ž, π‘π‘Žπ‘Ž, π‘Žπ‘π‘Žπ‘Ž. The border of a string is both its prefix and suffix, e.g., π‘π‘Žπ‘ is a border of π‘π‘Žπ‘π‘Žπ‘. Remark 3.1.1 It needs to be emphasized that prefixes, suffixes and substrings are multisets. The prefixes and suffixes are defined in the same way both in standard formal language and multilanguage. For example, prefixes and suffixes of the string 𝑀 considered above are the same in both. However, for substrings, this is not the case. The substrings of 𝑀 in a multilanguage are as given above, where as in a standard formal language, substrings of 𝑀 are ο₯, π‘Ž, 𝑏, π‘Žπ‘, π‘π‘Ž, π‘Žπ‘π‘Ž, π‘Žπ‘Ž, π‘π‘Žπ‘Ž, π‘Žπ‘π‘Žπ‘Ž. Prefix, Suffix and Substring Closures in a Multilanguage Let 𝑀𝐿 be a multilanguage. In line with the description of these notions for a standard formal language, we define them for 𝑀𝐿 as follows: Prefix closure of 𝑀𝐿 : π‘π‘Ÿπ‘’π‘“π‘€πΏ (𝑣) = {𝑒| 𝑣 = 𝑒𝑦; 𝑣 ∈ 𝑀𝐿 , 𝑒, 𝑦 ∈ Ξ£ βŠ› }, and π‘π‘Ÿπ‘’π‘“(𝑀𝐿 ) = βŠŽπ‘£βˆˆπ‘€πΏ π‘π‘Ÿπ‘’π‘“π‘€πΏ (𝑣) = {𝑒| 𝑣 = 𝑒𝑦; 𝑣 ∈ 𝑀𝐿 , 𝑒, 𝑦 ∈ Ξ£ βŠ› }. Suffix closure of 𝑀𝐿 :

6332

Dasharath Singh and Ahmed Ibrahim Isah

𝑠𝑒𝑓𝑓𝑀𝐿 (𝑣) = {𝑒| 𝑣 = π‘₯𝑒; 𝑣 ∈ 𝑀𝐿 , π‘₯, 𝑒 ∈ Ξ£ βŠ› }, and 𝑠𝑒𝑓𝑓(𝑀𝐿 ) = βŠŽπ‘£βˆˆπ‘€πΏ 𝑠𝑒𝑓𝑓𝑀𝐿 (𝑣) = {𝑒| 𝑣 = π‘₯𝑒; 𝑣 ∈ 𝑀𝐿 , π‘₯, 𝑒 ∈ Ξ£ βŠ› }. Substring closure of 𝑀𝐿 : 𝑠𝑒𝑏𝑠𝑀𝐿 (𝑣) = {𝑒| 𝑣 = π‘₯𝑒𝑦; 𝑣 ∈ 𝑀𝐿 , π‘₯, 𝑒, 𝑦 ∈ Ξ£ βŠ› }, and 𝑠𝑒𝑏𝑠(𝑀𝐿 ) = βŠŽπ‘£βˆˆπ‘€πΏ 𝑠𝑒𝑏𝑠𝑀𝐿 (𝑣) = {𝑒| 𝑣 = π‘₯𝑒𝑦; 𝑣 ∈ 𝑀𝐿 , π‘₯, 𝑒, 𝑦 ∈ Ξ£ βŠ› }. Example Let 𝑀𝐿 = {π‘Žπ‘, π‘Žπ‘, π‘Žπ‘π‘Ž} over Ξ£ = {π‘Ž, 𝑏}. Then π‘π‘Ÿπ‘’π‘“(𝑀𝐿 ) = {πœ€, π‘Ž, π‘Žπ‘, π‘Ž, π‘Žπ‘, π‘Ž, π‘Žπ‘, π‘Žπ‘π‘Ž}, 𝑠𝑒𝑓𝑓(𝑀𝐿 ) = {πœ€, 𝑏, π‘Žπ‘, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž}, and 𝑠𝑒𝑏𝑠(𝑀𝐿 ) = {πœ€, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž}. As in a standard formal language 𝐿, the following results hold in 𝑀𝐿 as well: A multilanguage is said to be prefix, suffix or substring closed if π‘π‘Ÿπ‘’π‘“(𝑀𝐿 ) = 𝑀𝐿 , 𝑠𝑒𝑓𝑓(𝑀𝐿 ) = 𝑀𝐿 or 𝑠𝑒𝑏𝑠(𝑀𝐿 ) = 𝑀𝐿 , respectively. For example, 𝑀𝐿 = [πœ€, π‘Ž, π‘Ž, 𝑏] is both prefix, suffix and substring closed. The prefix, suffix and substring closure operators in a multilanguage 𝑀𝐿 are idempotent: π‘π‘Ÿπ‘’π‘“(π‘π‘Ÿπ‘’π‘“(𝑀𝐿 )) = π‘π‘Ÿπ‘’π‘“(𝑀𝐿 ), 𝑠𝑒𝑓𝑓(𝑠𝑒𝑓𝑓(𝑀𝐿 )) = 𝑠𝑒𝑓𝑓(𝑀𝐿 ), 𝑠𝑒𝑏𝑠(𝑠𝑒𝑏𝑠(𝑀𝐿 )) = 𝑠𝑒𝑏𝑠(𝑀𝐿 ). Remark 3.1.2 It may, however, be noted that the prefix, suffix and substring closures of a multilanguage and that of a standard formal language differ. For example, in the case of a multilanguage 𝑀𝐿 = {π‘π‘Ž, π‘Žπ‘π‘Ž}, 𝑠𝑒𝑓𝑓(𝑀𝐿 ) = {πœ€, π‘Ž, π‘π‘Ž, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž}, and in a standard formal language 𝐿 = {π‘π‘Ž, π‘Žπ‘π‘Ž}, 𝑠𝑒𝑓𝑓(𝐿) = {πœ€, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž}.

3.2 Prefix, Suffix and Substring Relations and Their Characteristics in a Multilanguage Let 𝑋 consist of prefixes (suffixes or substrings) of a string 𝑣 ∈ Ξ£ βŠ› and 𝑅, be the respective binary relation on 𝑋. Hence forth, 𝑅 shall stand for 𝑅 (prefix, suffix or substring), unless otherwise stated. i. ii.

𝑅 is reflexive: βˆ€ π‘š/π‘₯ ∈ 𝑋, π‘š/π‘₯ 𝑅 π‘š/π‘₯. Since every prefix (suffix or substring) 𝑒 is a prefix (respectively, suffix or substring) of itself. 𝑅 (prefix or suffix) is complete: βˆ€ π‘š/π‘₯ β‰  𝑛/𝑦 ∈ 𝑋, either π‘š/π‘₯ 𝑅 𝑛/𝑦 or 𝑛/ 𝑦 𝑅 π‘š/π‘₯. Since for every pair of prefixes (or suffixes) of a string 𝑣, one is a prefix (respectively, suffix) of the other. However, for substrings, this is not licit. For example, let 𝑣 = π‘Žπ‘π‘π‘ and π‘š/π‘₯ = 1/π‘Ž, 𝑛/𝑦 = 1/𝑐 then both π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑋, but neither π‘š/π‘₯ 𝑅 𝑛/𝑦 nor 𝑛/𝑦 𝑅 π‘š/π‘₯.

Prefixes, suffixes and substrings in a Multilanguage

6333

𝑅 is antisymmetric: βˆ€ π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑋, if π‘š/π‘₯ 𝑅 𝑛/𝑦 and 𝑛/𝑦 𝑅 π‘š/π‘₯, then π‘š/π‘₯ = 𝑛/𝑦. Since whenever 𝑒 is a prefix (suffix or substring) of 𝑣 and 𝑣 is a prefix (respectively, suffix or substring) of 𝑒, then 𝑒 must be the same as 𝑣 as duplicates are indistinguishable. iv. 𝑅 is transitive: βˆ€ π‘š/π‘₯, 𝑛/𝑦, π‘˜/𝑧 ∈ 𝑋, if π‘š/π‘₯ 𝑅 𝑛/𝑦 an𝑑 𝑛/𝑦 𝑅 π‘˜/𝑧, then π‘š/π‘₯ 𝑅 π‘˜/𝑧. Since whenever 𝑒 is a prefix (suffix or substring) of 𝑣 and 𝑣 is a prefix (respectively, suffix or substring) o𝑓 𝑀, clearly 𝑒 is a prefix (respectively, suffix or substring) o𝑓 𝑀. Clearly, 𝑅 (prefix or suffix) is a linear mset order, where as 𝑅 (substring) is only a partial mset order. iii.

Summarily, 𝑅 on 𝑋 gives rise to a multiset relational structure (𝑋, 𝑅), hence forth notated 𝕏 = (𝑋, 𝑅), on 𝑋. In general, 𝑋 is an mset and 𝑅 is an mset relation. In particular, 𝑋 may be a list of attributes defined on a domain and 𝑅, the relation name (see [9], for related descriptions). In the following, we describe some typical features of such an mset structure, which would be exactly the features possessed by its relations. Maximal, Minimal and Isolated Elements of 𝕏 = (𝑿, 𝑹) Let 𝕏 = (𝑋, 𝑅), where 𝑋 consists of all nonempty prefixes (suffixes or substrings) of a string 𝑣 ∈ Ξ£ ⨁ and 𝑅, its respective relation on 𝑋. Then, π‘š/π‘₯ is a maximal element of 𝕏 iff βˆ€ 𝑛/𝑦 ∈ 𝑋, 𝑛/𝑦 𝑅 π‘š/π‘₯; for 𝑅 (prefix or suffix), π‘š/π‘₯ is a minimal element of 𝕏 iff βˆ€ 𝑛/𝑦 ∈ 𝑋, π‘š/π‘₯ 𝑅 𝑛/𝑦; for 𝑅 (substring), π‘š/π‘₯ is a minimal element of 𝕏 iff βˆ€ 𝑛/𝑦 ∈ 𝑋, π‘š/π‘₯ 𝑅 𝑛/𝑦 or else they are unrelated; and π‘š/π‘₯ is an isolated element of 𝕏 iff π‘š/π‘₯ is both a maximal and minimal element of 𝕏. For example, Let Ξ£ = {π‘Ž, 𝑏}, 𝑣 = π‘Žπ‘π‘π‘Ž ∈ Ξ£ ⨁ , then the non-empty prefixes and substrings of 𝑣 are π‘Ž, π‘Žπ‘, π‘Žπ‘π‘, π‘Žπ‘π‘π‘Ž and π‘Ž, 𝑏, π‘Žπ‘, 𝑏, 𝑏𝑏, π‘Žπ‘π‘, π‘Ž, π‘π‘Ž, π‘π‘π‘Ž, π‘Žπ‘π‘π‘Ž, respectively. Now for 𝑅 (prefix), 1/π‘Ž and 1/π‘Žπ‘π‘π‘Ž are the minimal and maximal elements, respectively, and for 𝑅 (substring), 2/π‘Ž and 2/𝑏 are the minimal elements and 1/π‘Žπ‘π‘π‘Ž is the maximal element. Also, let 𝑒 = π‘Ž ∈ Ξ£ ⨁ , then 1/π‘Ž is the isolated element for 𝑅. Proposition 3.2.1 𝕏 = (𝑋, 𝑅) always has a unique maximal element and, only under 𝑅 (prefix or suffix), it has also a unique minimal element. Proof Let 𝑝/𝑧 β‰  𝑑/𝑠 ∈ 𝑋, and let 𝑝/𝑧, 𝑑/𝑠 both be maximal elements of 𝕏. Since 𝑝/𝑧 is a maximal element, 𝑑/𝑠 𝑅 𝑝/𝑧. Similarly, since 𝑑/𝑠 is a maximal element, 𝑝/𝑧 𝑅 𝑑/𝑠.

6334

Dasharath Singh and Ahmed Ibrahim Isah

Now, by antisymmetry of these relations, 𝑝/𝑧 = 𝑑/𝑠. This contradicts the assumption that 𝑝/𝑧 β‰  𝑑/𝑠. Hence 𝕏 has a unique maximal element. Similarly, the other parts can be proved.

Chains of 𝕏 = (𝑿, 𝑹) A submset structure β„‚ = (𝐢 βŠ† 𝑋, 𝑅) of the prefix (suffix or substring) mset relational structure 𝕏 is a chain in 𝕏, if distinct points of 𝐢 are pair wise comparable in 𝑋 i.e., βˆ€ π‘š/π‘₯ β‰  𝑛/𝑦 ∈ 𝑋, either π‘š/π‘₯ 𝑅 𝑛/𝑦 or 𝑛/𝑦 𝑅 π‘š/π‘₯ in 𝑋. Also, 𝕏 itself is said to be a chain if the distinct points on 𝑋 are pair wise comparable. It is easy to see that every (𝐢, 𝑅) with 𝑅 (prefix or suffix) is a chain, and the mset of all chains in a prefix (suffix or substring) relational structure is partially ordered by mset inclusion relation. The maximal elements in this pomset relational structure are the maximal chains. For example, let 𝑣 = π‘Žπ‘π‘Ž ∈ Ξ£ ⨁ , and 𝑋 = [2/π‘Ž, 1/𝑏, 1/π‘Žπ‘, 1/π‘π‘Ž, 1/π‘Žπ‘π‘Ž] be the mset of all nonempty substrings of 𝑣. Then, submsets 𝐢1 = [2/π‘Ž, 1/π‘Žπ‘], 𝐢2 = [2/π‘Ž, 1/π‘π‘Ž], 𝐢3 = [2/π‘Ž, 1/π‘Žπ‘, 1/π‘Žπ‘π‘Ž], 𝐢4 = [1/𝑏, 1/π‘Žπ‘], 𝐢5 = [1/𝑏, 1/π‘Žπ‘, 1/π‘Žπ‘π‘Ž] are some chains in 𝕏, and 𝐢3 , 𝐢5 are the maximal chains among these. Graphical Representation of 𝑹 on 𝑿 Let 𝑋 consist of all prefixes (suffixes or substrings) of a string 𝑣 ∈ Ξ£ ⨁ and 𝑅, its respective relation on 𝑋. This relation can be represented by a directed graph 𝐺 = (𝑉, 𝐸), where 𝑉 (the vertex mset) is defined by 𝑉 ≝ 𝑋, and 𝐸 (the directed edges mset) by (π‘š/π‘₯, 𝑛/ 𝑦) ∈ 𝐸 iff (π‘š/π‘₯ β‰  𝑛/ 𝑦) ∈ 𝑅, for 𝑛 β‰₯ 2. For example, Let Ξ£ = {π‘Ž, 𝑏}, 𝑣 = π‘Žπ‘π‘Žπ‘Ž ∈ Ξ£ ⨁ , and let the non-empty prefixes and substrings of 𝑣 be given as: Prefixes: 𝑠 = π‘Ž, 𝑒 = π‘Žπ‘, 𝑀 = π‘Žπ‘π‘Ž, π‘₯ = π‘Žπ‘π‘Žπ‘Ž, and Substrings: π‘Ÿ = π‘Ž, 𝑠 = 𝑏, 𝑑 = π‘Žπ‘, 𝑒 = π‘π‘Ž, 𝑀 = π‘Žπ‘Ž, π‘₯ = π‘Žπ‘π‘Ž, 𝑦 = π‘π‘Žπ‘Ž, 𝑧 = π‘Žπ‘π‘Žπ‘Ž. Then the directed graph for the prefix relation 𝑅 on 𝑋 = [1/𝑠, 1/𝑒, 1/𝑀, 1/π‘₯] is presented in fig A, while that of the substring relation 𝑅 on 𝑋 = [3/π‘Ÿ, 1/𝑠, 1/𝑑, 1/𝑒, 1/ 𝑀, 1/π‘₯, 1/𝑦, 1/𝑧] is presented in fig B below.

Prefixes, suffixes and substrings in a Multilanguage

s

u

w

x

Fig A Graph of the prefix relation

6335

r

r

r

t

w

s

u

y

x

z

Fig B Graph of the substring relation

Proposition 3.2.2 A prefix (suffix or substring) relation graph is a directed acyclic graph for 𝑛 β‰₯ 2. Proof Let 𝐺 = (𝑉, 𝐸) denote the graph of a prefix (suffix or substring) relation and let (π‘š/π‘₯, 𝑛/𝑦) ∈ 𝐸 be represented as π‘š/π‘₯ 𝐸 𝑛/𝑦. Let 𝑛 β‰₯ 2, and the graph is cyclic. That is, there exist distinct elements π‘š1 /π‘₯1 , … , π‘šπ‘˜ / π‘₯π‘˜ ∈ 𝑉 such that π‘š1 /π‘₯1 𝐸 … 𝐸 π‘šπ‘˜ /π‘₯π‘˜ 𝐸 π‘š1 /π‘₯1 . Since these relations are transitive, π‘š1 /π‘₯1 𝐸 π‘š2 /π‘₯2 and π‘š2 /π‘₯2 𝐸 π‘š3 /π‘₯3 imply π‘š1 / π‘₯1 𝐸 π‘š3 /π‘₯3 and, in turn, by repeated application of transitivity, we have π‘š1 /π‘₯1 𝐸 π‘šπ‘˜ / π‘₯π‘˜ . Hence, π‘š1 /π‘₯1 = π‘šπ‘˜ /π‘₯π‘˜ , by antisymmetry of these relations. This contradicts the assumption that π‘š1 /π‘₯1 , … , π‘šπ‘˜ /π‘₯π‘˜ are distinct and 𝑛 β‰₯ 2. Hasse diagram of 𝑹 on 𝑿 Let 𝕏 = (𝑋, 𝑅), where 𝑋 consists of all nonempty prefixes (suffixes or substrings) of a string 𝑣 ∈ Ξ£ ⨁ and 𝑅, its respective relation on 𝑋. In order to represent the relations by

6336

Dasharath Singh and Ahmed Ibrahim Isah

Hasse diagram, we assume that βˆ€π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑋, π‘š/π‘₯ 𝑅 𝑛/𝑦 only if βˆ„ 𝑝/𝑧 ∈ 𝑋 such that π‘š/π‘₯ 𝑅 𝑝/𝑧 and 𝑝/𝑧 𝑅 𝑛/𝑦. For each ordered pair for which this relation holds, draw π‘š/π‘₯ in a vertical plane below 𝑛/𝑦 (or 𝑛/𝑦 below π‘š/π‘₯) and connect them with a straight line, i.e., a Hasse diagram

for prefix (suffix or substring) relation is a directed graph with vertex mset 𝑉 and edges set 𝐸 minus self-loops and edges implied by transitivity. As an example, the Hasse diagrams for the prefix relation in fig A and, that of the substring relation in fig B, are presented in Fig C and D, respectively. x z w

x

u

s

Fig C Hasse diagram for the prefix relation

y

t

s

w

u

r

r

r

Fig D Hasse diagram for the substring relation

Remark 3.2.3 Akin to set relations, two or more different prefix (suffix or substring) mset relations may have similar Hasse diagrams. For example, the Hasse diagram of the suffix relation 𝑅 on 𝑋 = [π‘˜, 𝑙, π‘š, 𝑛], for the nonempty suffixes of the string π‘Žπ‘π‘Žπ‘Ž with π‘˜ = π‘Ž, 𝑙 = π‘Žπ‘Ž, π‘š = π‘π‘Žπ‘Ž, 𝑛 = π‘Žπ‘π‘Žπ‘Ž, is similar to that of the prefix relation presented in fig C.

4 Monoids of prefixes, suffixes and substrings of a nonempty string in a multilanguage In view of the fact that homomorphisms of semigroups and monoids have useful applications in the economic design of sequential machines and in formal languages, this section introduces these notions in a multilanguage.

Prefixes, suffixes and substrings in a Multilanguage

6337

Let Ξ£ be an alphabet and Ξ£ ⨁ , the mset of all nonempty strings over Ξ£. For 𝑣 ∈ Ξ£ ⨁ , let 𝑣 βŠ› denote the multiset of all prefixes (suffixes or substrings) of 𝑣, and 𝑅 its respective relation. We define a binary operation βˆ— on 𝑣 βŠ› as follows: i. βˆ€π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑣 βŠ› , if π‘š/π‘₯ 𝑅 𝑛/𝑦 and βˆ„ π‘˜/𝑧 ∈ 𝑣 βŠ› such that π‘š/π‘₯ 𝑅 π‘˜/𝑧 ∧ π‘˜/𝑧 𝑅 𝑛/𝑦, then π‘š/π‘₯ βˆ— 𝑛/𝑦 = 𝑛/𝑦, ii. βˆ€π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑣 βŠ› , if π‘š/π‘₯ 𝑅 𝑛/𝑦 and βˆƒ π‘˜1 /𝑧1 , π‘˜2 /𝑧2 , … , π‘˜π‘› /𝑧𝑛 ∈ 𝑣 βŠ› , such that π‘š/π‘₯ 𝑅 π‘˜1 /𝑧1 𝑅 π‘˜2 /𝑧2 𝑅 … 𝑅 π‘˜π‘› /𝑧𝑛 𝑅 𝑛/𝑦, then π‘š/π‘₯ βˆ— 𝑛/𝑦 = π‘š/π‘₯ βˆ— π‘˜1 /𝑧1 βˆ— π‘˜2 /𝑧2 βˆ— … βˆ— π‘˜π‘› /𝑧𝑛 βˆ— 𝑛/𝑦. It is easy to see that βˆ— is associative and πœ€ is the identity element. Hence, (𝑣 βŠ› , βˆ—, πœ€), usually written as (𝑣 βŠ› , βˆ—), is a monoid. Also, every element π‘š/π‘₯ ∈ 𝑣 βŠ› is idempotent with respect to the operation βˆ—, since π‘š/π‘₯ βˆ— π‘š/π‘₯ = π‘š/π‘₯, βˆ€π‘š/π‘₯ ∈ 𝑣 βŠ› . However, βˆ— is not commutative as π‘š/π‘₯ βˆ— 𝑛/𝑦 β‰  𝑛/𝑦 βˆ— π‘š/π‘₯, βˆ€π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑣 βŠ› . For example, let Ξ£ = {π‘Ž, 𝑏}, and let 𝑣 = π‘Žπ‘π‘Žπ‘Ž ∈ Ξ£ βŠ› . Consider the substrings πœ€, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž, π‘Ž, π‘Žπ‘Ž, π‘π‘Žπ‘Ž, π‘Žπ‘π‘Žπ‘Ž of 𝑣 and let 𝑝 = πœ€, π‘Ÿ = π‘Ž, 𝑠 = 𝑏, 𝑑 = π‘Žπ‘, 𝑒 = π‘π‘Ž, 𝑀 = π‘Žπ‘Ž, π‘š = π‘Žπ‘π‘Ž, 𝑛 = π‘π‘Žπ‘Ž, and π‘ž = π‘Žπ‘π‘Žπ‘Ž. Then, 𝑣 βŠ› = [1/𝑝, 3/π‘Ÿ, 1/𝑠, 1/𝑑, 1/ 𝑒, 1/π‘š, 1/𝑀, 1/𝑛, 1/π‘ž]. It is straightforward to see that βˆ— is associative, since βˆ€π‘š/π‘₯, 𝑛/𝑦, π‘˜/𝑧 ∈ 𝑣 βŠ› , (π‘š/π‘₯ βˆ— 𝑛/𝑦) βˆ— π‘˜/𝑧 = π‘š/π‘₯ βˆ— (𝑛/𝑦 βˆ— π‘˜/𝑧), and 1/𝑝 is the identity element. Therefore, (𝑣 βŠ› , βˆ—) is a monoid. Functions between Monoids of Prefixes, Suffixes and Substrings Let 𝑀 = (𝑣 βŠ› , βˆ—) and 𝑁 = (π‘’βŠ› , βˆ—) be two monoids of prefixes (suffixes or substrings) of 𝑣, 𝑒 ∈ Ξ£ βŠ› . A homomorphism between 𝑀 and 𝑁 is a function 𝑓: 𝑣 βŠ› ⟢ π‘’βŠ› such that for every element π‘š/π‘₯ ∈ 𝑣 βŠ› there exists exactly one element 𝑛/𝑦 ∈ π‘’βŠ› such that (π‘š/ π‘₯, 𝑛/𝑦) ∈ 𝑓, the pair (π‘₯, 𝑦) occurs only 𝐢1 (π‘₯, 𝑦) times and, for every pair of elements π‘š/π‘₯, 𝑛/𝑦 ∈ 𝑣 βŠ› , if π‘š/π‘₯ βˆ— 𝑛/𝑦, then (i) 𝑓(π‘š/π‘₯ βˆ— 𝑛/𝑦) = 𝑓(π‘š/π‘₯) βˆ— 𝑓(𝑛/𝑦); and (ii) 𝑓(πœ€π‘£βŠ› ) = πœ€π‘’βŠ› , where πœ€π‘£βŠ› and πœ€π‘’βŠ› are the same identity on 𝑣 βŠ› and π‘’βŠ› both, as mentioned earlier. For example, let Ξ£ = {π‘Ž, 𝑏} and 𝑣 = π‘Žπ‘π‘Ž, 𝑒 = π‘Žπ‘π‘Žπ‘Ž ∈ Ξ£ βŠ› ; then their substrings are πœ€, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž and πœ€, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž, π‘Ž, π‘Žπ‘Ž, π‘π‘Žπ‘Ž, π‘Žπ‘π‘Žπ‘Ž, respectively. For the substrings of 𝑣, let 𝑑 = πœ€, π‘˜ = π‘Ž, π‘š = 𝑏, 𝑛 = π‘Žπ‘, 𝑝 = π‘π‘Ž, π‘ž = π‘Žπ‘π‘Ž, 𝑣 βŠ› = [1/𝑑, 2/π‘˜, 1/π‘š, 1/𝑛, 1/𝑝, 1/π‘ž] and, for that of 𝑒, let 𝑒 = πœ€, π‘Ÿ = π‘Ž, 𝑠 = 𝑏, 𝑑 = π‘Žπ‘, β„Ž = π‘π‘Ž, 𝑀 = π‘Žπ‘Ž, π‘₯ = π‘Žπ‘π‘Ž, 𝑙 = π‘π‘Žπ‘Ž, 𝑧 = π‘Žπ‘π‘Žπ‘Ž, π‘’βŠ› = [1/𝑒, 3/π‘Ÿ, 1/𝑠, 1/𝑑, 1/β„Ž, 1/ 𝑀, 1/π‘₯, 1/𝑙, 1/𝑧]. Then, 𝑓: (𝑣 βŠ› , βˆ—) ⟢ (π‘’βŠ› , βˆ—), defined by 𝑓{(1/𝑑, 1/𝑒)/1, (2/π‘˜, 2/π‘Ÿ)/2, (1/π‘š, 1/𝑀)/1, (1/ 𝑛, 1/𝑙)/1, (1/𝑝, 1/𝑙)/1, (1/π‘ž, 1/𝑧)/1}, is a monoid homomorphism of substrings,

6338

Dasharath Singh and Ahmed Ibrahim Isah

while 𝑔: (𝑣 βŠ› , βˆ—) ⟢ (π‘’βŠ› , βˆ—), defined by 𝑔{(1/𝑑, 1/𝑒)/1, (2/π‘˜, 2/π‘Ÿ)/2, (1/π‘š, 1/β„Ž)/ 1, (1/𝑛, 1/𝑀)/1, (1/𝑝, 1/π‘₯)/1, (1/π‘ž, 1/𝑧)/1} is not a homomorphism, since 𝑔(1/π‘š βˆ— 1/𝑛) does not imply 𝑔(1/π‘š) βˆ— 𝑔(1/𝑛). Let 𝑓: 𝑀 = (𝑣 βŠ› , βˆ—) ⟢ 𝑁 = (π‘’βŠ› , βˆ—) be a monoid homomorphism. We define (i) 𝑓: 𝑀 ⟢ 𝑁 is an injection iff 𝑓: 𝑣 βŠ› ⟢ π‘’βŠ› is an injection, and βˆ€π‘₯(π‘₯ ∈ 𝑣 βŠ› ⟹ |π‘₯| ≀ |𝑓(π‘₯)|), (ii) 𝑓: 𝑀 ⟢ 𝑁 is a surjection iff 𝑓: 𝑣 βŠ› ⟢ π‘’βŠ› is a surjection, and βˆ€π‘₯(π‘₯ ∈ 𝑣 βŠ› ⟹ |π‘₯| β‰₯ |𝑓(π‘₯)|), and (iii) 𝑓: 𝑀 ⟢ 𝑁 is a bijection iff 𝑓: 𝑣 βŠ› ⟢ π‘’βŠ› is a bijection, and βˆ€π‘₯(π‘₯ ∈ 𝑣 βŠ› ⟹ |π‘₯| = |𝑓(π‘₯)|). Note that |𝑒| denotes the length of the string 𝑒. For example, consider the strings π‘˜ = π‘π‘Žπ‘, π‘š = π‘Žπ‘π‘Ž ∈ Ξ£ βŠ› . Then, πœ€, 𝑏, π‘Ž, π‘π‘Ž, 𝑏, π‘Žπ‘, π‘π‘Žπ‘ and πœ€, π‘Ž, 𝑏, π‘Žπ‘, π‘Ž, π‘π‘Ž, π‘Žπ‘π‘Ž, respectively are their substrings. For π‘˜, let π‘₯ = πœ€, 𝑛 = π‘Ž, 𝑝 = 𝑏, π‘ž = π‘π‘Ž, π‘Ÿ = π‘Žπ‘, 𝑠 = π‘π‘Žπ‘, π‘˜ βŠ› = [1/π‘₯, 2/𝑝, 1/𝑛, 1/ π‘ž, 1/π‘Ÿ, 1/𝑠], and for π‘š, let 𝑦 = πœ€, 𝑑 = π‘Ž, 𝑒 = 𝑏, 𝑣 = π‘Žπ‘, 𝑀 = π‘π‘Ž, 𝑧 = π‘Žπ‘π‘Ž, π‘šβŠ› = [1/𝑦, 2/𝑑, 1/𝑒, 1/𝑣, 1/𝑀, 1/𝑧], then 𝑓: (π‘˜ βŠ› , βˆ—) ⟢ (π‘šβŠ› , βˆ—), defined by 𝑓{(1/π‘₯, 1/ 𝑦)/1, (2/𝑝, 2/𝑑)/2, (1/𝑛, 1/𝑒)/1, (1/π‘ž, 1/𝑣)/1, (1/π‘Ÿ, 1/𝑀)/1, (1/𝑠, 1/𝑧)/1}, is an isomorphism. Concluding Remarks In view of the fact that strings are known to be relatively (in comparison with integers or even booleans, etc.) suitable basic data types in a (querry) language, and as many (database) languages and systems do require multiset-based semantics, formulation of prefix, suffix and substring relational structures in this paper may be found useful in construction of formal power series developed in [10], for example. Monoids and their homomorphisms described in this paper may find useful applications in the economical design of sequential machines and formal languages. Acknowledgement: We are beholden to Professor D. E. Knuth for making paper [6] available to the first Author of this paper in a personal correspondence.

References [1] J. Gallier, Introduction to the Theory of Computation, Formal Languages and Automata Models of Computation, Lecture Notes, (2010) 1- 60. [2] J. Kari, Automata and Formal Languages, University of Turku, Lecture Notes, (2011) 1 – 150.

Prefixes, suffixes and substrings in a Multilanguage

6339

[3] M. Kudlek, C. Martin-Vide, and G. PΓ£un, Toward a Formal Macroset Theory, In: Multiset Processing, C.S. Calude et al. (Eds.), LNCS 2235, Springer – Verlag, (2001) 123-133. [4] E. Csuhaj–VarjΓΊ, C. MartΓ­n–Vide and V. Mitrana, Multiset Automata*, In: Multiset Processing, C.S. Calude et al. (Eds.), LNCS 2235, Springer – Verlag, (2001) 69 – 83. [5] K. Ruohonen, Formal Languages, Lecture Notes, (2009) 1-94. [6] D. E. Knuth, Context-free Multilanguages, In: Theoretical Studies in Computer Science, Jeffrey D. Ullman, Symour Ginsburg (Eds), Academic Press, (1992) 1-13. [7] D. Singh, A. M. Ibrahim, Y. Tella, and J. N. Singh, An Overview of the Applications of Multisets, NOVI Sad J. Math, 37 (2) (2007) 73 – 92. [8] K. P. Girish and J. J. Sunil, General relations between partially ordered multisets and their chains and antichains, Mathematical Communications, 14 (2) (2009) 193205. [9] P. W. P. J. Grefen and R. A. de By, A Multiset Extended Relational Algebra: A Formal Approach to a Practical Issue, In: 10th International Conference on Data Engineering (ICDE), Houston, TX, USA, (1994) 80 - 88. [10] A. Salomaa, Formal Languages, Academic press, New York San Francisco, 1973.

Received: August 17, 2014