500 likes | 627 Vues
This article explores the conversion of any finite automaton (NFA or DFA) into an equivalent NFA that has a single final state. We discuss key properties of regular languages, including closure properties like union, concatenation, and star operations. Additionally, we detail the connection between regular languages and regular expressions, providing examples and theorems that confirm the regularity of languages generated by regular expressions. Through inductive proofs, we establish the equivalence and generation of regular expressions from given regular languages.
E N D
Observation • Any Finite Automaton (NFA or DFA) • can be converted to an equivalent NFA • with a single final state
Equivalent NFA Example NFA
Equivalent NFA Single final state In General NFA
Add a final state Without transitions Extreme Case NFA without final state
Union: Concatenation: Are regular Languages Star: Properties For regular languages and we will prove that:
Union: Concatenation: Star: We Say: Regular languages are closed under
Regular language Regular language NFA NFA Single final state Single final state
Union • NFA for
Example NFA for
Concatenation • NFA for
Example • NFA for
Star Operation • NFA for
Example • NFA for
Regular Expressions • Regular expressions • describe regular languages • Example: • describes the language
Given regular expressions and Are regular expressions Recursive Definition Primitive regular expressions:
Not a regular expression: Examples A regular expression:
Languages of Regular Expressions • : language of regular expression • Example
Definition • For primitive regular expressions:
Definition (continued) • For regular expressions and
Example • Regular expression:
Example • Regular expression
Example • Regular expression
= { all strings with at least two consecutive 0 } Example • Regular expression
= { all strings without two consecutive 0 } Example • Regular expression
Equivalent Regular Expressions • Definition: • Regular expressions and • are equivalent if
and are equivalent regular expr. Example = { all strings with at least two consecutive 0 }
Theorem Languages Generated by Regular Expressions Regular Languages
1. For any regular expression the language is regular Theorem - Part 1 Languages Generated by Regular Expressions Regular Languages
2. For any regular language there is a regular expression with Theorem - Part 2 Languages Generated by Regular Expressions Regular Languages
1. For any regular expression the language is regular Proof by induction on the size of Proof - Part 1
NFAs regular languages Induction Basis • Primitive Regular Expressions:
Inductive Hypothesis • Assume • for regular expressions and • that • and are regular languages
Inductive Step • We will prove: Are regular Languages
We also know: Regular languages are closed under union concatenation star By inductive hypothesis we know: and are regular languages
Therefore: Are regular languages
And trivially: is a regular language
Proof – Part 2 2. For any regular language there is a regular expression with Proof by construction of regular expression
Since is regular take the • NFA that accepts it Single final state
From construct the equivalent • Generalized Transition Graph • transition labels • are regular expressions Example:
In General • Removing states: