2080 4

CSC262 Ā· 2080 Ā· 5 marks

Define string, substring, empty string, and empty language over alphabet {a,b}.

Define string, substring, empty string, and empty language over alphabet {a,b}. [5]

Theory of ComputationChapter 1: Basic FoundationsStrings

Quick answer

A string (also called a word) is a finite sequence of symbols taken from an alphabet.

String, Substring, Empty String, and Empty Language over {a, b}

1. String

Over the alphabet Σ = {a, b}, a string is any finite arrangement of the symbols a and b.

Examples over {a, b}:

  • a
  • b
  • ab
  • aab
  • bba
  • abab

Formally, if Σ = {a, b}, then Σ* (Kleene closure) gives the set of all possible strings over {a, b}, including the empty string:

Σ* = {ε, a, b, aa, ab, ba, bb, aaa, aab, ...}


2. Substring

A string v is called a substring of string w if v appears as a contiguous sequence of symbols within w (obtained by removing zero or more leading symbols and zero or more trailing symbols from w).

Example over {a, b}:

Let w = abab

Substrings of w include:

  • a, b, ab, ba, aba, bab, abab, ε

Note: Every string is a substring of itself, and the empty string ε is a substring of every string.


3. Empty String

The empty string (denoted ε or sometimes λ) is a string that contains no symbols at all. Its length is 0.

Key properties of ε over {a, b}:

PropertyResult
Length of ε|ε| = 0
Concatenation with any string xε x = x ε = x
ε belongs toΣ* for any alphabet Σ

Example:

If x = ab, then ε · x = ab and x · ε = ab

The empty string acts as the identity element for string concatenation.


4. Empty Language

A language over an alphabet Σ is a set of strings, i.e., a subset of Σ*.

The empty language (denoted āˆ…) is a language that contains no strings at all.

Over {a, b}:

āˆ… = { } (a set with no members)

Important distinction:

ConceptNotationContains
Empty stringεA string of length 0
Empty languageāˆ…No strings whatsoever
Language with only empty string{ε}Exactly one string (ε)

Note: āˆ… ≠ {ε}. The empty language has no strings, whereas {ε} is a language containing one string (the empty string).

The empty language āˆ… is a valid language over any alphabet, including {a, b}.


Summary Table

TermDefinitionExample over {a,b}
StringFinite sequence of symbols from Σab, bba, aab
SubstringContiguous part of a stringab is substring of aab
Empty String (ε)String with no symbols, length = 0ε
Empty Language (āˆ…)Language containing no stringsāˆ… = { }

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.