0% found this document useful (0 votes)
118 views23 pages

Automata Languages

The document defines and explains basic concepts relating to strings and languages. It defines a string as a sequence of letters over an alphabet. It explains operations that can be performed on strings like concatenation, reversing, determining length and substrings. It then defines a language as any subset of the set of all possible strings, and explains operations on languages like union, intersection and concatenation of languages. It also introduces concepts like the Kleene closure and positive closure of a language.

Uploaded by

tariqravian
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views23 pages

Automata Languages

The document defines and explains basic concepts relating to strings and languages. It defines a string as a sequence of letters over an alphabet. It explains operations that can be performed on strings like concatenation, reversing, determining length and substrings. It then defines a language as any subset of the set of all possible strings, and explains operations on languages like union, intersection and concatenation of languages. It also introduces concepts like the Kleene closure and positive closure of a language.

Uploaded by

tariqravian
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Languages

Fall 2005 Costas Busch - RPI 1


A language is a set of strings

String: A sequence of letters

Examples: “cat”, “dog”, “house”, …

Defined over an alphabet:


   a, b, c, , z

Fall 2005 Costas Busch - RPI 2


Alphabets and Strings
We will use small alphabets:    a, b

Strings
a
ab u  ab
abba v  bbbaaa
baba w  abba
aaabbbaabab
Fall 2005 Costas Busch - RPI 3
String Operations

w  a1a2  an abba
v  b1b2 bm bbbaaa

Concatenation

wv  a1a2  anb1b2 bm abbabbbaaa

Fall 2005 Costas Busch - RPI 4


w  a1a2  an ababaaabbb

Reverse

R
w  an a2a1 bbbaaababa

Fall 2005 Costas Busch - RPI 5


String Length
w  a1a2  an
Length: w n

Examples: abba  4
aa  2
a 1
Fall 2005 Costas Busch - RPI 6
Length of Concatenation

uv  u  v

Example: u  aab, u  3
v  abaab, v  5

uv  aababaab  8
uv  u  v  3  5  8
Fall 2005 Costas Busch - RPI 7
Empty String
A string with no letters is denoted:  or 

Observations:   0

w  w  w

abba  abba  abba  abba

Fall 2005 Costas Busch - RPI 8


Substring
Substring of string:
a subsequence of consecutive characters

String Substring
abbab ab
abbab abba
abbab b
abbab bbab
Fall 2005 Costas Busch - RPI 9
Prefix and Suffix
abbab
Prefixes Suffixes
 abbab w  uv
a bbab
prefix
ab bab
suffix
abb ab
abba b
abbab 
Fall 2005 Costas Busch - RPI 10
Another Operation
n
w  ww w
 
n

Example:  abba   abbaabba


2

0
Definition: w 

 abba   
0

Fall 2005 Costas Busch - RPI 11


The * Operation
 * : the set of all possible strings from
alphabet 

   a, b
*    , a, b, aa, ab, ba, bb, aaa, aab,

Fall 2005 Costas Busch - RPI 12


The + Operation
 : the set of all possible strings from

alphabet  except 

   a, b
*    , a, b, aa, ab, ba, bb, aaa, aab,


   * 

   a, b, aa, ab, ba, bb, aaa, aab,
Fall 2005 Costas Busch - RPI 13
Languages
A language is any subset of *

Example:    a, b
*    , a, b, aa, ab, ba, bb, aaa,

Language 1:  
Language 2:  a, aa, aab
Language 3: { , abba, baba, aa, ab, aaaaaa}
Fall 2005 Costas Busch - RPI 14
Note that:

Sets   { }  {}

Set size {}    0

Set size {}  1


String length  0
Fall 2005 Costas Busch - RPI 15
Another Example

n n
An infinite language L  {a b : n  0}


ab
L abb  L
aabb
aaaaabbbbb
Fall 2005 Costas Busch - RPI 16
Operations on Languages
The usual set operations

 a, ab, aaaa  bb, ab  {a, ab, bb, aaaa}


 a, ab, aaaa  bb, ab  {ab}
 a, ab, aaaa   bb, ab   a, aaaa
Complement: L   * L

 a, ba    , b, aa, ab, bb, aaa,


Fall 2005 Costas Busch - RPI 17
Reverse

R R
Definition: L  {w : w  L}

Examples:  ab, aab, baba   ba, baa, abab


R

n n
L  {a b : n  0}

R n n
L  {b a : n  0}
Fall 2005 Costas Busch - RPI 18
Concatenation

Definition: L1L2   xy : x  L1, y  L2 

Example:  a, ab, ba b, aa

  ab, aaa, abb, abaa, bab, baaa

Fall 2005 Costas Busch - RPI 19


Another Operation
Definition: n
L  LL L
n

 a, b   a, b a, b a, b 
3

 aaa, aab, aba, abb, baa, bab, bba, bbb


0
Special case: L   

 a , bba , aaa  0   
Fall 2005 Costas Busch - RPI 20
More Examples

n n
L  {a b : n  0}

2 n n m m
L  {a b a b : n, m  0}

2
aabbaaabbb  L

Fall 2005 Costas Busch - RPI 21


Star-Closure (Kleene *)

0 1 2
Definition: L*  L  L  L 

Example:
 , 
a, bb, 
 
 a, bb *   
 aa , abb, bba , bbbb, 
aaa, aabb, abba, abbbb,
Fall 2005 Costas Busch - RPI 22
Positive Closure

Definition: L  L  L 
 1 2

Similar to L* except for the 

a, bb, 
  
 a, bb  aa, abb, bba, bbbb, 
aaa, aabb, abba, abbbb,
 
Fall 2005 Costas Busch - RPI 23

You might also like