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

Lecture 1

Uploaded by

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

Lecture 1

Uploaded by

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

AUTOMATA AND LANGUAGE THEORY

Eng. Hager Nady


AUTOMATA THEORY
• Automata Theory : deals with definitions and properties of different types of
“Computation models”.
Examples of such models are:
• Finite Automata : These are used in text processing, compilers, and hardware design.
• Context-Free Grammars: These are used to define programing languages, and in Artificial
Intelligence.
• Turing Machines: These form a simple abstract model of a “real” computer, such as your
PC at home.
LANGUAGE THEORY
• Symbols: are individual objects, which can be any letter, number, or any
picture.
• Example : 1, a, b, #
• Alphabets : are a finite set of symbols. It is denoted by Σ.
• Examples:
• Σ = {a, b}
• Σ = {0, 1,2}
• Σ = {#, &, $}
LANGUAGE THEORY
• String : is a finite collection of symbols from the alphabet. It is denoted by w.
• Example: If Σ = {a, b}, various string that can be generated from Σ are {ab, aa, aaa, bb, bbb, ba, aba,
…}.
• A string with no symbols is known as an empty string. It is represented by epsilon (ε) or
lambda (λ) or null (Ʌ).
• The number of symbols in a string w is called the length of a string. It is denoted by |w|.
• Example: w = 010 => |w| = 3
• |00100| = 5
• |ab| = 2
• |λ|=0
LANGUAGE THEORY

• Language: is a set of strings of terminal symbols derivable from alphabet. A


language which is formed over Σ can be Finite or Infinite.
• Example:
• L1 = {Set of strings of length 2}
• = {aa, ab, ba, bb} => Finite Language
• L2 = {Set of all strings starts with ‘a’}
= {a, aa, aaa, abb, abbb, ababb, … } => Infinite Language
LANGUAGE THEORY
• Types of Languages:
1. Natural Languages : They are languages that spoken by humans e.g. English, Arabic, and so on. It
has alphabet : Σ = {a, b, c, …….z} from these alphabetic we make sentences that belong to the
language.
2. Programming Language: (e.g. c++, Java, and so on) it has alphabetic: Σ = {a, b, c, ….z, A, B, C, ….., Z,
/, - , …}. From these alphabetic we make sentences that belong to programming language.

• Example:
• Alphabetic: Σ = {0,1} -> Sentences : 000001, 1010101
• Alphabetic: Σ = {a,b} -> Sentences : ababaabb, bababbabb
OPERATIONS ON STRINGS

• Powers of Σ
• Example : Σ = {0,1}
• Σ0 = {λ} -> set of all strings of length 0
• Σ1 = {0, 1} -> set of all strings of length 1
• Σ2 = {00, 01, 10, 11} -> set of all strings of length 2
• Σ3 = {000, 001, 010, 011, 100, 101, 110, 111}
• Σn -> set of all strings of length n
OPERATIONS ON STRINGS

• Kleene Closure :
• They are two repetition marks, also called Closure or Klene Star.
• * : Repeat (0 - n) times.
• + : Repeat (1 - n) times
OPERATIONS ON STRINGS
• Example:
• If Σ = {x}, then
• Σ* = L1 = {λ, x, xx, xxx, …}
• Σ+ = L1 = { x, xx, xxx, ….}
• If Σ = {aa, b}, then
• Σ* = L2 = {λ, aab, baa, baab, aabb, …}
• Σ+ = L2 = {aaaa, b, baaaa, bb, ….}
OPERATIONS ON STRINGS
• Union (U) / OR
• Example :
• r1 = {a} , r2 = {b} -> L = r1 U r2 = a U b = {a, b}

• Concatenation (.)
• Example:
• r1 = {a} , r2 = {b} -> L = r1r2 = {ab}
• L1 = {a, ab, ba}, L2 = {b, aa} -> L1L2 = {ab, aaa, abb, abaa, bab, baaa}
EXAMPLES

• Σ = {0,1}
• L1 = {Strings that end with 1} = {01, 11, 10101, 10001, …}
• L2 = {Strings that start and end with 0} = {0, 00, 010, 0111010, ….}
• L3 = {Strings that have even numbers of 1’s} = {11, 101, 1101010, 1111, …}
LANGUAGES

• How can languages be recognized by computers?


1. Regular Expressions
2. Grammars (Context Free Grammar)
3. Automata (Deterministic Finite Automata, Non Deterministic Finite Automata)
REGULAR EXPRESSIONS

• Regular Languages: are formal languages that can be expressed using regular
expressions.
• Regular languages can be generated from one-element languages by applying certain
standard operations a finite number of times. These simple operations include
(Concatenation, Union, and Kleen Closure)

• Regular Expressions can be thought of it as the algebraic description of a


regular language.
REGULAR EXPRESSIONS

• Example: Write the Language for each of the following regular expressions,
Σ = {a,b}
1. (ab)* = {λ, ab, abab, ababab, …}
2. ab*a = {aa, aba, abba, abbba, abbbba, …}
3. a*b* = {λ, a, b, aa, ab, bb, aaa, aab, abb, bbb, aaaa, …}

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