160 likes | 265 Views
Representation of Languages. Fundamental Problems. Need finite descriptions of infinite sets of strings (=> specify languages ). Discover and specify “regularity”. What is at all possible by the cardinality arguments ? What is admissible by the machines ?. Fundamental Problems.
E N D
Fundamental Problems • Need finite descriptions of infinite sets of strings (=> specify languages). • Discover and specify “regularity”. • What is at all possible by the cardinality arguments? • What is admissible by the machines? L3RE
Fundamental Problems • 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? L3RE
Visualizing Languages : Cardinality vs Representation Representable Countable Languages Uncountable Languages CFLs; RLs Un-Representable Countable Languages Spaces enclose Collections of Languages L3RE
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. L3RE
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 L3RE
Regular Sets over • Basis: are regular sets over . • Inductive Step: Let X and Y be regular sets over . Then so are: • Closure:… L3RE
Examples • Bit strings containing at least a “1” • Bit strings containing exactly one “1” • Bit strings beginning or ending with a “1” L3RE
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 :: Syntax L3RE
Regular Expressions over • Basis: are regular expressions over . • Inductive Step: Let x and y be regular expressions over . Then so are: • Closure:… L3RE
Regular Expressions Regular sets Examples: Syntax vs Semantics L3RE
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”s b*ab*(ab*)* • Further optimization b*(ab*)+ (Motivates equivalence problem) L3RE
Equivalence of regular expressions Two 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”. L3RE
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)* L3RE