Content deleted Content added
m →String homomorphism: math environment (except the last part to keep it consistent with the other section) |
Reverted good faith edits by Dominus (talk): Not clearly improving |
||
(18 intermediate revisions by 16 users not shown) | |||
Line 6:
The concatenation of two string <math>s</math> and <math>t</math> is denoted by <math>s \cdot t</math>, or shorter by <math>s t</math>.
Concatenating with the empty string makes no difference: <math>s \cdot \varepsilon = s = \varepsilon \cdot s</math>.
Concatenation of strings is [[associative]]: <math>s \cdot (t \cdot u) = (s \cdot t) \cdot u</math>.
For example, <math>(\langle b \rangle \cdot \langle l \rangle) \cdot (\varepsilon \cdot \langle ah \rangle) = \langle bl \rangle \cdot \langle ah \rangle = \langle blah \rangle</math>.
Line 49:
Similarly, [[context-free language]]s are closed under string substitution.<ref>Hopcroft, Ullman (1979), Sect.6.2, Theorem 6.2, p.131</ref><ref group="note">Although every regular language is also context-free, the previous theorem is not implied by the current one, since the former yields a shaper result for regular languages.</ref>
A simple example is the conversion ''f''<sub>uc</sub>(.) to
{| class="wikitable"
Line 57:
! ''x'' !! ''f''<sub>uc</sub>(''x'') !!
|-
| ‹''a''› || { ‹''A''› } || map
|-
| ‹''A''› || { ‹''A''› } || map
|-
| ‹''ß''› || { ‹''SS''› } || no
|-
| ‹0› || { ε } || map digit to empty string
Line 78:
==String homomorphism==
A '''string homomorphism''' (often referred to simply as a [[Homomorphism#
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
while the inverse homomorphic image of a language <math>L</math> is defined as
<math>f^{-1}(L) = \{ s
In general, <math>f(f^{-1}(L)) \neq L</math>, while one does have
Line 103:
A string homomorphism is said to be ε-free (or e-free) if <math>f(a) \neq \varepsilon</math> for all ''a'' in the alphabet <math>\Sigma</math>. Simple single-letter [[substitution cipher]]s are examples of (ε-free) string homomorphisms.
An example string homomorphism ''g''<sub>uc</sub> can also be obtained by defining similar to the [[#String_substitution|above]] substitution: ''g''<sub>uc</sub>(‹a›) = ‹A›, ..., ''g''<sub>uc</sub>(‹0›) = ε, but letting ''g''<sub>uc</sub> be undefined on punctuation chars.
<!---omitted, since sloppy notation, anyway, see above---
Besides this restriction of its input ___domain, ''g''<sub>uc</sub> differs from ''f''<sub>uc</sub> by returning strings,<ref group=note name="singleton sets"/> while the latter returned singleton sets of strings.
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''
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
==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
==Right cancellation==
Line 213 ⟶ 210:
== References ==
* {{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-
{{reflist}}
{{Strings}}
[[Category:Formal languages]]
|