Chapter 7Formal Languagesnotes.en.pdf:118-119

Alphabets and Strings

Σ, s ∈ Σ*, |s|

Def 7.1.1AlphabetDef 7.1.2StringDef 7.1.4LengthDef 7.1.5Concatenation
Concept

Before we can talk about languages in the formal sense, we need the alphabet
and the strings.

Definition 7.1.1 (notes p. 118): An alphabet Σ\Sigma is a finite set. Its
elements are called characters or symbols. An nn-tuple sΣns \in \Sigma^n
is called a string (of length nn over Σ\Sigma).

Definition 7.1.4: The length s|s| of string sΣns \in \Sigma^n is nn.

Definition 7.1.2: Σ0={}\Sigma^0 = \{\langle\rangle\}, which is the unique 0-tuple.
We denote this string by ϵ\epsilon and call it the empty string.

Sets vs strings: {1,2,3}={3,2,1}\{1, 2, 3\} = \{3, 2, 1\} as sets, but
1,2,33,2,1\langle 1, 2, 3 \rangle \neq \langle 3, 2, 1 \rangle as strings. Order matters
for strings, but not for sets.

Concatenation (Definition 7.1.5): for sΣn,tΣms \in \Sigma^n, t \in \Sigma^m:

conc(s,t)=s1,,sn,t1,,tmΣn+m\text{conc}(s, t) = \langle s_1, \dots, s_n, t_1, \dots, t_m \rangle \in \Sigma^{n+m}

We often write s+ts + t or simply stst for concatenation. Note st=s+t|st| = |s| + |t|
and sϵ=ϵs=ss\epsilon = \epsilon s = s (identity element).

A common shorthand (Definition 7.1.10): c[n]c^{[n]} means the character cc repeated
nn times. So a[3]=aaaa^{[3]} = aaa.

Strings are the atoms of formal languages — every program, every formula, every
sentence is a string over some alphabet.

Worked example
Step 0 of 2
Practice — score 100% to advance
Multiple choice
Q1
An alphabet is…
Q2
The length of the empty string ϵ\epsilon is…
Q3
{a,b}\{a, b\} vs a,b\langle a, b \rangle: which is the same as b,a\langle b, a \rangle?
Q4
If s=3|s| = 3 and t=5|t| = 5, then st=?|st| = ?
Q5
a[4]a^{[4]} denotes the string…
Fill in the blank
Q1
An alphabet Σ\Sigma is a ___ set.
Q2
The empty string is written ___ (a single Greek letter).
Q3
For strings, |conc(s,t)=s+(s, t)| = |s| + ||.
Order the steps
Arrange these proof steps in the correct order using the arrows.
1
Count the characters to determine s|s|
2
Concatenate strings by writing them side by side
3
Check each character of the string is in Σ\Sigma
4
Identify the alphabet Σ\Sigma (the available characters)
Loading…