0% found this document useful (0 votes)
23 views14 pages

Kleene's Theorem

The document discusses Kleene's Theorem, which states that any language accepted by a Finite Automaton (FA) can be expressed by a Regular Expression (RE) and vice versa. It includes real-life examples of email and password validation, detailing the transition from FA to Transition Graph (TG) and then to RE, along with rules for constructing these representations. The document also provides a state diagram for password validation, illustrating the conditions for valid passwords.

Uploaded by

rimshaiub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views14 pages

Kleene's Theorem

The document discusses Kleene's Theorem, which states that any language accepted by a Finite Automaton (FA) can be expressed by a Regular Expression (RE) and vice versa. It includes real-life examples of email and password validation, detailing the transition from FA to Transition Graph (TG) and then to RE, along with rules for constructing these representations. The document also provides a state diagram for password validation, illustrating the conditions for valid passwords.

Uploaded by

rimshaiub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Theory of

Automata

Group 8:

1. Shahzeen Sadiq (F22RDOCS1M01012)


2. Huzaira Khaliq (F22RDOCS1M01101)
Kleene’s Theorem :

● Introduction
● Real-Life Examples
1)Email Validation

2)Password Validation
Kleene’s Theorem: “Any language accepted
by a Finite Automaton can also be expressed by a Regular
Expression, and vice versa.”

Kleene's Theorem has three parts:

1) If language can be accepted by FA (Finite Automata) then it can


also be accepted by TG (Transition Graph).

2) If language can be accepted by TG (Transition Graph) then it can


also be expressed by RE (Regular Expression).

➤For the proof of part 2, we need to remember following rules:

Rule 1: If a TG has more than one start states, then


introduce a new start state connecting the new state to the
old start states by the transitions labeled by A and make the
Rule 2: If a TG has more than one final states, then introduce a new
final state, connecting the old final states to the new final state by the
transitions labeled by A.

Rule 3: If a state has two (more than one) incoming transition edges,
then replace all these transition edges with a single transition edge
labeled by the sum (+) .

Rule 4 (state elimination): If three states in a TG, are connected in


sequence then eliminate the middle state and connect the first state
with the third by a single transition.

3) If language can be expressed by RE (Regular Expression) then it


can be accepted by FA (Finite Automata)
1. Email Validation:

Part 1: FA (Finite Automaton) → TG (Transition Graph)


Part 2: TG (Transition Graph) → RE (Regular
Expression):

If a language can be accepted by TG, it can be expressed by RE.


Now, apply rules 1 to 4.

Rule 1: More than one start state


Our TG only has one start state Q0.
So, no need to apply Rule 1.

Rule 2: More than one final state


Our TG only has one final state Q7.
So, no need to apply Rule 2.
Rule 3: Merge Incoming Transitions
Before Merging:
After Merging:
Rule 4 (State Elimination):
Eliminate q2 (domain part)
(Paths concatenated: @ + [a-zA-Z0-
9.-]+)
Part 3: RE → FA
We already have a RE: [a-z0-9]+@[a-z]+\.com

Now we can build an FA:

1. Each part of the RE becomes a transition path.


2.The final state is accepting if all parts are matched.So, the circle is complete:
FA → TG → RE → FA
Example 2:
Password Validation:
● A System requires users to create a valid
password that:
Has only letters and digits
Contains at least one letter
Is non-empty
Valid examples:
abc, a123, 1b2c, P4ss
Invalid examples:
● 123 (no letter), !pass (has special character)
Regular expression:

● ([a-zA-Z][a-zA-Z0-9]*) | ([0-9]*[a-zA-Z][a-
zA-Z0-9]*)
● This means:
Must contain at least one letter
Letters/digits only
No empty string allowed
State diagram:

🡪 q0
q0 🡪 q0: digit
q0 🡪 q1: letter
q1 🡪 q1: letter or digit
Explanation of States:
q0: Start state – has only digits so far (not valid yet)
q1: First letter encountered (now valid)
q1 is the accepting state (any further digits/letters
allowed)
This matches the condition:
At least one letter, any combination of letters and
Transitions:

From q0, on digit → stay in q0


From q0, on letter → go to q1
From q1, on letter or digit → stay in q1
Accepting state: q1
Thank
you!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy