Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
40 views

CSCI-2400 Models of Computation

1) The document describes different models of computation including finite automata, pushdown automata, and Turing machines, which have increasing levels of computational power based on the type of memory they have. 2) It then discusses languages as sets of strings defined over an alphabet, and basic string operations like concatenation and length. 3) Finally, it introduces formal language concepts like regular languages and operations on languages like union, intersection, concatenation, and Kleene closure.

Uploaded by

api-20012397
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

CSCI-2400 Models of Computation

1) The document describes different models of computation including finite automata, pushdown automata, and Turing machines, which have increasing levels of computational power based on the type of memory they have. 2) It then discusses languages as sets of strings defined over an alphabet, and basic string operations like concatenation and length. 3) Finally, it introduces formal language concepts like regular languages and operations on languages like union, intersection, concatenation, and Kleene closure.

Uploaded by

api-20012397
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 36

CSCI-2400

Models of Computation

1
Computation

CPU memory

2
temporary memory

input memory
CPU
output memory

Program memory

3
3
Example: f ( x)  x

temporary memory

input memory
CPU
output memory
Program memory
compute xx
2
compute x x
4
3
f ( x)  x

temporary memory
input memory
x2
CPU
output memory
Program memory
compute xx
2
compute x x
5
3
temporary memory f ( x)  x
z  2*2  4
f ( x)  z * 2  8
input memory
x2
CPU
output memory
Program memory
compute xx
2
compute x x
6
3
temporary memory f ( x)  x
z  2*2  4
f ( x)  z * 2  8
input memory
x2
CPU
f ( x)  8
Program memory output memory
compute xx
2
compute x x
7
Automaton
temporary memory

Automaton
input memory
CPU
output memory

Program memory

8
Different Kinds of Automata
Automata are distinguished by the temporary memory

• Finite Automata: no temporary memory

• Pushdown Automata: stack

• Turing Machines: random access memory

9
Finite Automaton

temporary memory

input memory
Finite
Automaton
output memory

Example: Vending Machines


(small computing power)
10
Pushdown Automaton
Stack Push, Pop

input memory
Pushdown
Automaton
output memory

Example: Compilers for Programming Languages


(medium computing power)
11
Turing Machine

Random Access Memory

input memory
Turing
Machine
output memory

Examples: Any Algorithm


(highest computing power)
12
Power of Automata

Finite Pushdown Turing


Automata Automata Machine

Less power More power


Solve more
computational problems
13
Languages

14
A language is a set of strings

String: A sequence of letters

Examples: “cat”, “dog”, “house”, …

Defined over an alphabet:


   a, b, c, , z

15
Alphabets and Strings
We will use small alphabets:    a, b

Strings
a
ab u  ab
abba v  bbbaaa
baba w  abba
aaabbbaabab
16
String Operations

w  a1a2  an abba
v  b1b2 bm bbbaaa

Concatenation

wv  a1a2  anb1b2 bm abbabbbaaa

17
w  a1a2  an ababaaabbb

Reverse

R
w  an a2a1 bbbaaababa

18
String Length
w  a1a2  an
Length: w n

Examples: abba  4
aa  2
a 1
19
Length of Concatenation

uv  u  v

Example: u  aab, u  3
v  abaab, v  5

uv  aababaab  8
uv  u  v  3  5  8
20
Empty String
A string with no letters: 

Observations:  0

w  w  w

abba  abba  abba


21
Substring
Substring of string:
a subsequence of consecutive characters

String Substring
abbab ab
abbab abba
abbab b
abbab bbab
22
Prefix and Suffix
abbab
Prefixes Suffixes
 abbab w  uv
a bbab
prefix
ab bab
suffix
abb ab
abba b
abbab 
23
Another Operation
n
w  ww w
 
n

Example:  abba   abbaabba


2

0
Definition: w 

 abba   
0

24
The * Operation
 * : the set of all possible strings from
alphabet 

   a, b
*    , a, b, aa, ab, ba, bb, aaa, aab,

25
The + Operation
 : the set of all possible strings from

alphabet  except 

   a, b
*    , a, b, aa, ab, ba, bb, aaa, aab,


   * 

   a, b, aa, ab, ba, bb, aaa, aab,
26
Languages
A language is any subset of *

Example:    a, b
*    , a, b, aa, ab, ba, bb, aaa,

Languages:  
 a, aa, aab
{ , abba, baba, aa, ab, aaaaaa}
27
Note that:

Sets   { }  {}

Set size {}    0

Set size {}  1


String length  0
28
Another Example

n n
An infinite language L  {a b : n  0}


ab
L abb  L
aabb
aaaaabbbbb
29
Operations on Languages
The usual set operations

 a, ab, aaaa  bb, ab  {a, ab, bb, aaaa}


 a, ab, aaaa  bb, ab  {ab}
 a, ab, aaaa   bb, ab   a, aaaa
Complement: L   * L

 a, ba    , b, aa, ab, bb, aaa,


30
Reverse

R R
Definition: L  {w : w  L}

Examples:  ab, aab, baba   ba, baa, abab


R

n n
L  {a b : n  0}

R n n
L  {b a : n  0}
31
Concatenation

Definition: L1L2   xy : x  L1, y  L2 

Example:  a, ab, ba b, aa

  ab, aaa, abb, abaa, bab, baaa

32
Another Operation
Definition: n
L  LL L
n

 a, b   a, b a, b a, b 
3

 aaa, aab, aba, abb, baa, bab, bba, bbb


0
Special case: L   

 a , bba , aaa  0   
33
More Examples

n n
L  {a b : n  0}

2 n n m m
L  {a b a b : n, m  0}

2
aabbaaabbb  L

34
Star-Closure (Kleene *)

0 1 2
Definition: L*  L  L  L 

Example:
 , 
a, bb, 
 
 a, bb *   
 aa , abb, bba , bbbb, 
aaa, aabb, abba, abbbb,
35
Positive Closure

 1 2
Definition: L  L  L 
 L *   

a, bb, 
  
 a, bb  aa, abb, bba, bbbb, 
aaa, aabb, abba, abbbb,
 
36

You might also like