Docsity

Strings and Languages - Elementary Discrete Math - Lecture Slides, Slides of Discrete Mathematics

Partial preview of the text

Download Strings and Languages - Elementary Discrete Math - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

Strings and Languages

Sequences and Strings

  • alphabet - a set of symbols , denoted by Σ
  • string (or word) - a finite sequence of elements from Σ
  • example:
    • Σ = {a, b}
    • possible strings include:
    • a aa ab ba abaa bbb aaaa
    • bbaa abab abbbababbbabbababa
  • "abba" is a string over Σ
  • empty word - λ (lambda)
  • Σ* is set of all words over Σ
      • Σ* = {x | x is a word over Σ}
      • always includes λ
      • Σ* is always infinite if Σ has elements
  • other interesting alphabets
      • Σ = {0, 1} (binary words)
      • Σ = {1}
      • Σ = {a,b,c,d,.. ., z}
  • word length
      • number of symbols in word (or string)
  • Γ n

where n is an integer

    • set of all strings over Σ with length at most n
    • let Σ = {0, 1}, find:
      • Γ 1
      • Γ 2
      • Γ 0
  • For any Γ n

it must be true that Γ

n

1

77

  • For a given alphabet Σ, what is the relationship
  • between Γ n

and Σ

n

? (First think about Γ

2

and Σ

2

  • Any subset of Σ* is called a language over Σ.
    • ex: let Σ = {0,1}
      • L 1 = {x | 2 ≤ length(x) ≤ 4 and x ∈ Σ* }

• L

3 = {x | no leading zeros and x ∈ Σ* }

  • Γ n and Σ n are languages over Σ.

SET OPERATORS

• If A

1

, A

2

,... A

n

are sets, and no two have a

common element, then we say they are

mutually disjoint.

  • Ai ∩ Aj = Ø for all i,j ≤ n and i ≠ j
  • ex: Σ 0 , Σ 1 , Σ 2 , Σ 3 ,... are all mutually disjoint
  • Γ 0

1

2

3 ,... are these mutually disjoint?