String operations: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: s2cid. | Use this bot. Report bugs. | Suggested by Abductive | Category:Formal languages | #UCB_Category 51/214
Reverted good faith edits by Dominus (talk): Not clearly improving
 
(8 intermediate revisions by 8 users not shown)
Line 78:
 
==String homomorphism==
A '''string homomorphism''' (often referred to simply as a [[Homomorphism#Homomorphisms and e-free homomorphisms in formalFormal language theory|homomorphism]] in [[formal language theory]]) is a string substitution such that each character is replaced by a single string. That is, <math>f(a)=s</math>, where <math>s</math> is a string, for each character <math>a</math>.<ref group="note" name="singleton sets">Strictly formally, a homomorphism yields a language consisting of just one string, i.e. <math>f(a) = \{s\}</math>.</ref><ref>Hopcroft, Ullman (1979), Sect.3.2, p.60-61</ref>
 
String homomorphisms are [[monoid morphism]]s on the [[free monoid]], preserving the empty string and the [[binary operation]] of [[string concatenation]]. Given a language <math>L</math>, the set <math>f(L)</math> is called the '''homomorphic image''' of <math>L</math>. The '''inverse homomorphic image''' of a string <math>s</math> is defined as
 
<math>f^{-1}(s) = \{ w |\mid f(w) = s \}</math>
 
while the inverse homomorphic image of a language <math>L</math> is defined as
 
<math>f^{-1}(L) = \{ s |\mid f(s) \in L \}</math>
 
In general, <math>f(f^{-1}(L)) \neq L</math>, while one does have
Line 130:
:<math>\pi_\Sigma (L)=\{\pi_\Sigma(s)\ \vert\ s\in L \}</math>{{citation needed|date=August 2017}}
 
== Right and left quotient ==
The '''right quotient''' of a character ''a'' from a string ''s'' is the truncation of the character ''a'' in the string ''s'', from the right hand side. It is denoted as <math>s/a</math>. If the string does not have ''a'' on the right hand side, the result is the empty string. Thus:
<!---This definition deviates from Hopcroft.Ullman.1979, as remarked below. I guess the former doesn't have widespread use, if it has a source at all.--->
: <math>(sa)/ b = \begin{cases}
 
:<math>(sa)/ b = \begin{cases}
s & \mbox{if } a=b \\
\varepsilon & \mbox{if } a \ne b
Line 140 ⟶ 139:
 
The quotient of the empty string may be taken:
: <math>\varepsilon / a = \varepsilon</math>
 
:<math>\varepsilon / a = \varepsilon</math>
 
Similarly, given a subset <math>S\subset M</math> of a monoid <math>M</math>, one may define the quotient subset as
: <math>S/a=\{s\in M\ \vert\ sa\in S\}</math>
 
'''Left quotients''' may be defined similarly, with operations taking place on the left of a string.{{citation needed|date=August 2017}}
:<math>S/a=\{s\in M\ \vert\ sa\in S\}</math>
 
Left quotients may be defined similarly, with operations taking place on the left of a string.{{citation needed|date=August 2017}}
 
Hopcroft and Ullman (1979) define the quotient ''L''<sub>1</sub>/''L''<sub>2</sub> of the languages ''L''<sub>1</sub> and ''L''<sub>2</sub> over the same alphabet as {{nowrap|1=''L''<sub>1</sub>/''L''<sub>2</sub> = {{mset| ''s'' |{{!}} ∃''t''∈''L''<sub>2</sub>. ''st''∈''L''<sub>1</sub> }}}}.<ref>Hopcroft, Ullman (1979), Sect.3.2, p.62</ref>
This is not a generalization of the above definition, since, for a string ''s'' and distinct characters ''a'', ''b'', Hopcroft's and Ullman's definition implies {{nowrap||{{mset|''sa''}} / {{mset|''b''}}}} yielding {{mset|}}, rather than {{mset| ε }}.
 
The left quotient (when defined similar to Hopcroft and Ullman 1979) of a singleton language ''L''<sub>1</sub> and an arbitrary language ''L''<sub>2</sub> is known as [[Brzozowski derivative]]; if ''L''<sub>2</sub> is represented by a [[regular expression]], so can be the left quotient.<ref>{{cite journal| author=Janusz A. Brzozowski| authorlink=Janusz Brzozowski (computer scientist)|title=Derivatives of Regular Expressions| journal=J ACM| year=1964| volume=11| issue=4| pages=481–494| doi=10.1145/321239.321249| s2cid=14126942| doi-access=free}}</ref>
 
==Syntactic relation==
Line 163 ⟶ 160:
:<math>\{S/m\ \vert\ m\in M\}</math>
 
is finite. In the case that ''M'' is the monoid of words over some alphabet, ''S'' is then a [[regular language]], that is, a language that can be recognized by a [[finite -state automaton]]. This is discussed in greater detail in the article on [[syntactic monoid]]s.{{citation needed|date=August 2017}}
 
==Right cancellation==
Line 215 ⟶ 212:
* {{cite book | first1=John E. | last1=Hopcroft | first2=Jeffrey D. | last2=Ullman | title=Introduction to Automata Theory, Languages and Computation | publisher=Addison-Wesley Publishing | ___location=Reading, Massachusetts | year=1979 | isbn=978-0-201-02988-8 | zbl=0426.68001 | url-access=registration | url=https://archive.org/details/introductiontoau00hopc }} ''(See chapter 3.)''
{{reflist}}
{{Strings}}
 
[[Category:Formal languages]]