SlideShare a Scribd company logo
1 of 33
Courtesy: Costas Busch - LSU 1
Languages
Slides have been modified by Shaukat Wasi
Courtesy: Costas Busch - LSU 2
Language: a set of strings
String: a sequence of symbols
from some alphabet
Example:
Strings: cat, dog, house
Language: {cat, dog, house}
 zcba ,,,, Alphabet:
Courtesy: Costas Busch - LSU 3
Languages are used to describe
computation problems:
},17,13,11,7,5,3,2{ PRIMES
},6,4,2,0{ EVEN
}9,,2,1,0{ Alphabet:
Courtesy: Costas Busch - LSU 4
Computation is translated to set membership
Is number prime?x
}?,17,13,11,7,5,3,2{ PRIMESx
Example computation problem:
Equivalent set membership problem:
Courtesy: Costas Busch - LSU 5
Alphabets and Strings
abbaw
bbbaaav
abu



 ba,
baaabbbaaba
abba
ab
a
Example Strings
Example Alphabet:
An alphabet is a set of symbols
A string is a sequence of
symbols from the alphabet
String variables
Courtesy: Costas Busch - LSU 6
}9,,2,1,0{ Decimal numbers alphabet
102345 567463386
}1,0{Binary numbers alphabet
100010001 101101111
Courtesy: Costas Busch - LSU 7
}1{Unary numbers alphabet
1Unary number:
Decimal number: 1
11
2
111
3
1111
4
11111
5
Courtesy: Costas Busch - LSU 8
String Operations
m
n
bbbv
aaaw


21
21


bbbaaa
abba
mn bbbaaawv  2121
Concatenation
abbabbbaaa
Courtesy: Costas Busch - LSU 9
12aaaw n
R

naaaw 21 ababaaabbb
Reverse
bbbaaababa
Courtesy: Costas Busch - LSU 10
String Length
Length:
Examples:
naaaw 21
nw 
1
2
4



a
aa
abba
Courtesy: Costas Busch - LSU 11
Length of Concatenation
Example:
vuuv 
853
8
5,
3,




vuuv
aababaabuv
vabaabv
uaabu
Courtesy: Costas Busch - LSU 12
A string with no letters is denoted:
Acts as a neutral element
Observations:
Empty String
 or
abbabaababbaabba
www





 0
Courtesy: Costas Busch - LSU 13
Substring
Substring of string:
a subsequence of consecutive characters
String Substring
bbab
b
abba
ab
abbab
abbab
abbab
abbab
Courtesy: Costas Busch - LSU 14
Prefix and Suffix
Prefixes Suffixes
abbab
abbab
abba
abb
ab
a


b
ab
bab
bbab
abbab uvw 
prefix
suffix
string
Courtesy: Costas Busch - LSU 15
Exponent Operation
Example:
Definition:
  
n
n
wwww 
  abbaabbaabba 2
0
w
  0
abba
Courtesy: Costas Busch - LSU 16
The * Operation
: the set of all possible strings from
alphabet
*


 
 ,,,,,,,,,
,
*
aabaaabbbaabaaba
ba


Courtesy: Costas Busch - LSU 17
The + Operation
: the set of all possible strings from
alphabet except



 
 ,,,,,,,,,
,
*
aabaaabbbaabaaba
ba


 *
 ,,,,,,,, aabaaabbbaabaaba

Courtesy: Costas Busch - LSU 18
Languages
A language over alphabet
is any subset of *

 
 ,,,,,,,,
,
*
aaabbbaabaaba
ba


 
 
},,,,,{
,,
{}
aaaaaaabaababaabba
aabaaa


Languages:

Example:
Courtesy: Costas Busch - LSU 19
More Language Examples
An infinite language }0:{  nbaL nn
aaaaabbbbb
aabb
ab

L
Labb
},{ baAlphabet
Lbbabb
Courtesy: Costas Busch - LSU 20
prime}isand:{ *
xxxPRIMES 
}9,,2,1,0{ 
},17,13,11,7,5,3,2{ PRIMES
Prime numbers
Alphabet
Language:
Rule: Numbers divisible by 1 and itself
Courtesy: Costas Busch - LSU 21
even}isand:{ *
xxxEVEN 
}9,,2,1,0{ 
Even and odd numbers
Alphabet
odd}isand:{ *
xxxODD 
},6,4,2,0{ EVEN
},7,5,3,1{ ODD
Languages:
Courtesy: Costas Busch - LSU 22
Addition (of unary numbers)
},,1{ 
}1,1,n
,1z,1y,1x:{ mn


mnkm
zyxADDITION k
ADDITION 1111111111
ADDITION 111111111
Alphabet:
Language:
}111111111111111111111111{ ...,,,,ADDITION 
Courtesy: Costas Busch - LSU 23
Squares (of unary numbers)
}#,1{
}11{ 2
nm,,y: xx#ySQUARES mn

SQUARES# 111111
SQUARES# 1111111
Alphabet:
Language:
}11111111111111111111{ , ...#,#,#SQUARES
Courtesy: Costas Busch - LSU 24
 
 
5|},,,,{|
3|,,|
1||
0|{}|




babaabbabbaa
abaaa


Two special languages
Size of a language (number of elements):
or}{ }{
Empty language
Language with
empty string
Courtesy: Costas Busch - LSU 25
Note that:
}{}{ 
0}{ 
1}{ 
0
Sets
Set size
Set size
String length
Courtesy: Costas Busch - LSU 26
Operations on Languages
The usual set operations:
   
   
      difference,,,,
onintersecti}{,,,
union},,,{,,,
aaaaaabbbaaaaaba
ababbbaaaaaba
aaaabbabaabbbaaaaaba



LL  *
   ,,,,,,, aaabbabaabbaa 
Complement:
Courtesy: Costas Busch - LSU 27
Reverse
Definition:
Examples:
}:{ LwwL RR

   ababbaabababaaabab R
,,,, 
}0:{
}0:{


nabL
nbaL
nnR
nn
Courtesy: Costas Busch - LSU 28
Concatenation
Definition:
Example:
 2121 ,: LyLxxyLL 
  
 baaabababaaabbaaaab
aabbaaba
,,,,,
,,,

Courtesy: Costas Busch - LSU 29
Another Operation
Definition:
Special case:
 
n
n
LLLL 
     
 bbbbbababbaaabbabaaabaaa
babababa
,,,,,,,
,,,, 3

 
   



0
0
,, aaabbaa
L
Courtesy: Costas Busch - LSU 30
}0:{  nbaL nn
}0,:{2
 mnbabaL mmnn
2
Laabbaaabbb
Example
2
?????? L
Courtesy: Costas Busch - LSU 31
Star-Closure (Kleene *)
All strings that can be constructed from
Definition:
Example:
 210*
LLLL
 















,,,,
,,,,
,,
,
*,
abbbbabbaaabbaaa
bbbbbbaabbaa
bba
bba

L
0
L
1
L
2
L
3
L
Courtesy: Costas Busch - LSU 32
Positive Closure
Definition:  321
LLLL
 











,,,,
,,,,
,,
,
abbbbabbaaabbaaa
bbbbbbaabbaa
bba
bba
1
L
2
L
3
L
Note that: 
 LLL 0*
CLASS ACTIVITY#01
Courtesy: Costas Busch - LSU 33

More Related Content

Viewers also liked (11)

Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Universal turing coastus
Universal turing coastusUniversal turing coastus
Universal turing coastus
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Telecom lect 3
Telecom lect 3Telecom lect 3
Telecom lect 3
 
Telecom lect 2
Telecom lect 2Telecom lect 2
Telecom lect 2
 
Telecom lect 8
Telecom lect 8Telecom lect 8
Telecom lect 8
 
Telecom lect 5
Telecom lect 5Telecom lect 5
Telecom lect 5
 
Wifi & wi max
Wifi & wi maxWifi & wi max
Wifi & wi max
 
Martin folwer
Martin folwerMartin folwer
Martin folwer
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 

Similar to Languages

Similar to Languages (17)

Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.ppt
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........
 
Handout Regular expression with examples and lecture
Handout Regular expression with examples  and lecture Handout Regular expression with examples  and lecture
Handout Regular expression with examples and lecture
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02
 
Lesson 04
Lesson 04Lesson 04
Lesson 04
 

More from Shiraz316

More from Shiraz316 (20)

FINGERNAIL DISORDER DETECTION FOR DISEASE ANALYSIS
FINGERNAIL DISORDER DETECTION FOR DISEASE ANALYSISFINGERNAIL DISORDER DETECTION FOR DISEASE ANALYSIS
FINGERNAIL DISORDER DETECTION FOR DISEASE ANALYSIS
 
K neareast neighbor algorithm presentation
K neareast neighbor algorithm presentationK neareast neighbor algorithm presentation
K neareast neighbor algorithm presentation
 
Khi 087 revised dt report
Khi 087 revised dt reportKhi 087 revised dt report
Khi 087 revised dt report
 
Khi 117 revised dt report
Khi 117 revised dt reportKhi 117 revised dt report
Khi 117 revised dt report
 
Khi 164 revised dt report
Khi 164 revised dt reportKhi 164 revised dt report
Khi 164 revised dt report
 
Khi 054 revised dt report
Khi 054 revised dt reportKhi 054 revised dt report
Khi 054 revised dt report
 
Khi 061 revised dt report
Khi 061 revised dt reportKhi 061 revised dt report
Khi 061 revised dt report
 
Khi 022 revised dt report
Khi 022 revised dt reportKhi 022 revised dt report
Khi 022 revised dt report
 
Khi 113 revised dt report
Khi 113 revised dt reportKhi 113 revised dt report
Khi 113 revised dt report
 
Khi 156 revised dt report
Khi 156 revised dt reportKhi 156 revised dt report
Khi 156 revised dt report
 
Khi 142 revised dt report
Khi 142 revised dt reportKhi 142 revised dt report
Khi 142 revised dt report
 
Khi 316 revised dt report
Khi 316 revised dt reportKhi 316 revised dt report
Khi 316 revised dt report
 
Khi 186 revised dt report
Khi 186 revised dt reportKhi 186 revised dt report
Khi 186 revised dt report
 
Khi 052 revised dt report
Khi 052 revised dt reportKhi 052 revised dt report
Khi 052 revised dt report
 
Khi 151 revised dt report
Khi 151 revised dt reportKhi 151 revised dt report
Khi 151 revised dt report
 
Khi 150 revised dt report
Khi 150 revised dt reportKhi 150 revised dt report
Khi 150 revised dt report
 
Khi 078 revised dt report
Khi 078 revised dt reportKhi 078 revised dt report
Khi 078 revised dt report
 
LTE quick introduction session Training
LTE quick introduction session TrainingLTE quick introduction session Training
LTE quick introduction session Training
 
LTE Sales Training for CPE Device
LTE Sales Training for CPE DeviceLTE Sales Training for CPE Device
LTE Sales Training for CPE Device
 
Witribe Customer Premises Equipment Training for LTE
Witribe Customer Premises Equipment Training for LTEWitribe Customer Premises Equipment Training for LTE
Witribe Customer Premises Equipment Training for LTE
 

Recently uploaded

CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
amitlee9823
 
CALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcR
CALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcRCALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcR
CALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcR
dollysharma2066
 
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
drmarathore
 
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
amitlee9823
 

Recently uploaded (20)

CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Sanjay Nagar ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
Call Now ≽ 9953056974 ≼🔝 Call Girls In Yusuf Sarai ≼🔝 Delhi door step delevry≼🔝
 
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Chikhali Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
 
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
Vip Mumbai Call Girls Andheri East Call On 9920725232 With Body to body massa...
 
CALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcR
CALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcRCALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcR
CALL GIRLS IN Saket 83778-77756 | Escort Service In DELHI NcR
 
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
VVIP Pune Call Girls Warje (7001035870) Pune Escorts Nearby with Complete Sat...
 
↑Top celebrity ( Pune ) Nagerbazar Call Girls8250192130 unlimited shot and al...
↑Top celebrity ( Pune ) Nagerbazar Call Girls8250192130 unlimited shot and al...↑Top celebrity ( Pune ) Nagerbazar Call Girls8250192130 unlimited shot and al...
↑Top celebrity ( Pune ) Nagerbazar Call Girls8250192130 unlimited shot and al...
 
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
(=Towel) Dubai Call Girls O525547819 Call Girls In Dubai (Fav0r)
 
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
 
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Arekere ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
 
Develop Keyboard Skill.pptx er power point
Develop Keyboard Skill.pptx er power pointDevelop Keyboard Skill.pptx er power point
Develop Keyboard Skill.pptx er power point
 
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
Get Premium Pimple Saudagar Call Girls (8005736733) 24x7 Rate 15999 with A/c ...
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
 
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
 

Languages

  • 1. Courtesy: Costas Busch - LSU 1 Languages Slides have been modified by Shaukat Wasi
  • 2. Courtesy: Costas Busch - LSU 2 Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat, dog, house Language: {cat, dog, house}  zcba ,,,, Alphabet:
  • 3. Courtesy: Costas Busch - LSU 3 Languages are used to describe computation problems: },17,13,11,7,5,3,2{ PRIMES },6,4,2,0{ EVEN }9,,2,1,0{ Alphabet:
  • 4. Courtesy: Costas Busch - LSU 4 Computation is translated to set membership Is number prime?x }?,17,13,11,7,5,3,2{ PRIMESx Example computation problem: Equivalent set membership problem:
  • 5. Courtesy: Costas Busch - LSU 5 Alphabets and Strings abbaw bbbaaav abu     ba, baaabbbaaba abba ab a Example Strings Example Alphabet: An alphabet is a set of symbols A string is a sequence of symbols from the alphabet String variables
  • 6. Courtesy: Costas Busch - LSU 6 }9,,2,1,0{ Decimal numbers alphabet 102345 567463386 }1,0{Binary numbers alphabet 100010001 101101111
  • 7. Courtesy: Costas Busch - LSU 7 }1{Unary numbers alphabet 1Unary number: Decimal number: 1 11 2 111 3 1111 4 11111 5
  • 8. Courtesy: Costas Busch - LSU 8 String Operations m n bbbv aaaw   21 21   bbbaaa abba mn bbbaaawv  2121 Concatenation abbabbbaaa
  • 9. Courtesy: Costas Busch - LSU 9 12aaaw n R  naaaw 21 ababaaabbb Reverse bbbaaababa
  • 10. Courtesy: Costas Busch - LSU 10 String Length Length: Examples: naaaw 21 nw  1 2 4    a aa abba
  • 11. Courtesy: Costas Busch - LSU 11 Length of Concatenation Example: vuuv  853 8 5, 3,     vuuv aababaabuv vabaabv uaabu
  • 12. Courtesy: Costas Busch - LSU 12 A string with no letters is denoted: Acts as a neutral element Observations: Empty String  or abbabaababbaabba www       0
  • 13. Courtesy: Costas Busch - LSU 13 Substring Substring of string: a subsequence of consecutive characters String Substring bbab b abba ab abbab abbab abbab abbab
  • 14. Courtesy: Costas Busch - LSU 14 Prefix and Suffix Prefixes Suffixes abbab abbab abba abb ab a   b ab bab bbab abbab uvw  prefix suffix string
  • 15. Courtesy: Costas Busch - LSU 15 Exponent Operation Example: Definition:    n n wwww    abbaabbaabba 2 0 w   0 abba
  • 16. Courtesy: Costas Busch - LSU 16 The * Operation : the set of all possible strings from alphabet *      ,,,,,,,,, , * aabaaabbbaabaaba ba  
  • 17. Courtesy: Costas Busch - LSU 17 The + Operation : the set of all possible strings from alphabet except       ,,,,,,,,, , * aabaaabbbaabaaba ba    *  ,,,,,,,, aabaaabbbaabaaba 
  • 18. Courtesy: Costas Busch - LSU 18 Languages A language over alphabet is any subset of *     ,,,,,,,, , * aaabbbaabaaba ba       },,,,,{ ,, {} aaaaaaabaababaabba aabaaa   Languages:  Example:
  • 19. Courtesy: Costas Busch - LSU 19 More Language Examples An infinite language }0:{  nbaL nn aaaaabbbbb aabb ab  L Labb },{ baAlphabet Lbbabb
  • 20. Courtesy: Costas Busch - LSU 20 prime}isand:{ * xxxPRIMES  }9,,2,1,0{  },17,13,11,7,5,3,2{ PRIMES Prime numbers Alphabet Language: Rule: Numbers divisible by 1 and itself
  • 21. Courtesy: Costas Busch - LSU 21 even}isand:{ * xxxEVEN  }9,,2,1,0{  Even and odd numbers Alphabet odd}isand:{ * xxxODD  },6,4,2,0{ EVEN },7,5,3,1{ ODD Languages:
  • 22. Courtesy: Costas Busch - LSU 22 Addition (of unary numbers) },,1{  }1,1,n ,1z,1y,1x:{ mn   mnkm zyxADDITION k ADDITION 1111111111 ADDITION 111111111 Alphabet: Language: }111111111111111111111111{ ...,,,,ADDITION 
  • 23. Courtesy: Costas Busch - LSU 23 Squares (of unary numbers) }#,1{ }11{ 2 nm,,y: xx#ySQUARES mn  SQUARES# 111111 SQUARES# 1111111 Alphabet: Language: }11111111111111111111{ , ...#,#,#SQUARES
  • 24. Courtesy: Costas Busch - LSU 24     5|},,,,{| 3|,,| 1|| 0|{}|     babaabbabbaa abaaa   Two special languages Size of a language (number of elements): or}{ }{ Empty language Language with empty string
  • 25. Courtesy: Costas Busch - LSU 25 Note that: }{}{  0}{  1}{  0 Sets Set size Set size String length
  • 26. Courtesy: Costas Busch - LSU 26 Operations on Languages The usual set operations:               difference,,,, onintersecti}{,,, union},,,{,,, aaaaaabbbaaaaaba ababbbaaaaaba aaaabbabaabbbaaaaaba    LL  *    ,,,,,,, aaabbabaabbaa  Complement:
  • 27. Courtesy: Costas Busch - LSU 27 Reverse Definition: Examples: }:{ LwwL RR     ababbaabababaaabab R ,,,,  }0:{ }0:{   nabL nbaL nnR nn
  • 28. Courtesy: Costas Busch - LSU 28 Concatenation Definition: Example:  2121 ,: LyLxxyLL      baaabababaaabbaaaab aabbaaba ,,,,, ,,, 
  • 29. Courtesy: Costas Busch - LSU 29 Another Operation Definition: Special case:   n n LLLL         bbbbbababbaaabbabaaabaaa babababa ,,,,,,, ,,,, 3           0 0 ,, aaabbaa L
  • 30. Courtesy: Costas Busch - LSU 30 }0:{  nbaL nn }0,:{2  mnbabaL mmnn 2 Laabbaaabbb Example 2 ?????? L
  • 31. Courtesy: Costas Busch - LSU 31 Star-Closure (Kleene *) All strings that can be constructed from Definition: Example:  210* LLLL                  ,,,, ,,,, ,, , *, abbbbabbaaabbaaa bbbbbbaabbaa bba bba  L 0 L 1 L 2 L 3 L
  • 32. Courtesy: Costas Busch - LSU 32 Positive Closure Definition:  321 LLLL              ,,,, ,,,, ,, , abbbbabbaaabbaaa bbbbbbaabbaa bba bba 1 L 2 L 3 L Note that:   LLL 0*