cs466(Prasad) L3RE 1
Representation of Languages
cs466(Prasad) L3RE 2
• Need finite descriptions of infinite sets of strings (=> specify languages).
• Discover and specify “regularity”.
• What is at all possible at all possible by the cardinality arguments?
• What is admissible admissible by the machines?
Fundamental Problems
cs466(Prasad) L3RE 3
• The set of languages over a finite alphabet is uncountable, while the set of descriptions is countable (equi-numerous with N). So, all languages cannot be described finitely.
• Given that there are uncountable subsets of languages, which countably many subsets of these languages can be specified in any given formalism?
Fundamental Problems
Visualizing Languages : Cardinality vs Representation
cs466(Prasad) L3RE 4
Uncountable Languages
Representable Countable Languages
Un-Representable Countable Languages
Spaces enclose Collections of
Languages
CFLs;RLs
cs466(Prasad) L3RE 5
Language = set of strings
• Languages inherit operation on sets.• E.g., union, intersection, complement, etc.
• Operations on strings can be lifted to operations on languages.
• E.g., language concatenation, etc.
} | { YvXuuvXY
cs466(Prasad) L3RE 6
Integer Power of a Language
n length of stringsBit
...}1,0}{11,10,01,00{
}11,10,01,00{
}1,0{
}{
}1,0{
23
2
1
0
nX
XXX
X
X
X
X
cs466(Prasad) L3RE 7
Kleene Star and Kleene Plus
XX
XXXX
XXXXX
i
i
i
i
i
i
that Note
......
......
1
1
10
0
cs466(Prasad) L3RE 8
Regular Sets
Family of languages • Seed elements:
• Empty language
• Language containing the empty string
• Singleton language for each letter in the alphabet
• Closure Operations:• Union: collects strings from languages
• Concatenation: generates longer strings
• Kleene Star: generates infinite languages
cs466(Prasad) L3RE 9
Regular Sets over
• Basis: are regular sets over .
• Inductive Step: Let X and Y be regular sets over . Then so are:
• Closure:…
}{: and },{, aa
*X
XY
Y X
cs466(Prasad) L3RE 10
Examples
• Bit strings containing at least a “1”
• Bit strings containing exactly one “1”
• Bit strings beginning or ending with a “1”
*})1{}0}({1{*})1{}0({
*}0}{1{*}0{
}1{*}1,0{ *}1,0}{1{
cs466(Prasad) L3RE 11
Naming Languages
• Regular sets can be named using the derivation in terms of the seed elements and the closure operations. Regular expressions formalize this approach.
Regular sets :: Regular Expressions
:::: Numbers :: Numerals
:::: Semantics Semantics :: SyntaxSyntax
cs466(Prasad) L3RE 12
• Basis: are regular expressions over .
• Inductive Step: Let x and y be regular expressions over . Then so are:
• Closure:…
Regular Expressions over aa : and ,,
. and , , *xxyyx
cs466(Prasad) L3RE 13
Examples: Syntax Syntax vs SemanticsSemantics
• Regular Expressions • Regular sets
{},, }{
}0{) (0 0
0
0
cs466(Prasad) L3RE 14
• Regular expressions for strings over {a,b} containing at least one “a”.
• Focus on the one “a”(a u b)*a(a u b)*
• Focus on the leftmost “a”b*a(a u b)*
• Focus on the “a”sb*ab*(ab*)*
• Further optimizationb*(ab*)+
(Motivates equivalence problem)
cs466(Prasad) L3RE 15
• Equivalence of regular expressionsTwo regular expressions are equivalent if they represent the same regular set.
• “Irregularity” (to be taken on faith now ) There are non-regular languages such as
Informally, a finite amount of extra storage is sufficient for recognizing regular languages (or the patterns that characterize it).
Regular languages cannot capture “counting”.
}0 | ){( nnn
cs466(Prasad) L3RE 16
• Complement of bit strings with at least one “1”
= bit strings containing no “1”s
= 0*• Complement of
bit strings with exactly one “1”
= bit strings containing no “1”s
U bit strings with at least two “1”s
= 0* U (0* 1 0* 1 0*)(0 U 1)*
Top Related