Practice Exam 1
1. The SouthEastern regional climate center,
http:/www.dnr.state.sc.us/climate/sercc/, has historical weather data from
many weather stations. Here is some sample data for the Chapel Hill station,
including the maximum and minimum temperat
54(34%204# # 3 ! R 3 44(& 5# R c !9)94 5# % Q 14 q 4 $ !&% # ! ` Q d S
5
#
xw
$ 7 f d by
$R
R
94 3&0# 5# 3 ! R & 5# R c !9)9 5# 4% Q 4 q 49 $ 44# ! u Q d S
5
%
xw
$ 7 f d by !%$
R
14rt f @ 9 $ 44# ! u Q d S
5 @
y !%$
U c# E UVE U4( 7 2&%4u1) !
1
Showing Languages are Non-Regular
Question: How can one show that a language is not regular?
We have no way to do this so far; constructing a finite automaton or a
regular expression can only show a language is regular.
To show a language is not regul
COMP 455
Models of Languages and Computation
Spring 2016
Homework 5
Due Monday, March 7, 2016
1. Problem 3.1.2, from the text, page 120, except that you should give a
derivation of the string abbabbaa instead.
2. Problem 3.1.5, part (a), from the text, pa
1
Showing Languages are Non-Regular
Question: How can one show that a language is not regular?
We have no way to do this so far; constructing a finite automaton or a
regular expression can only show a language is regular.
To show a language is not regul
1
Finite Representations of Languages
Languages may be infinite sets of strings. We need a finite notation for them.
There are at least four ways to do this:
1. Language generators. The language can be represented as a mathematical sequence w1 , w2 , w3 ,
1
Alphabets and Languages
Look at handout 1 (inference rules for sets) and use the rules on some examples like
cfw_a cfw_a
cfw_a cfw_a, b,
cfw_a cfw_a,
cfw_a cfw_a,
cfw_a cfw_a, b,
a cfw_a,
a cfw_a, b,
a cfw_a,
a cfw_a, b
Example: To show cfw_a cfw_a, b,
1
Nondeterministic Finite Automata
Suppose in life,
whenever you had a choice, you could try both possibilities and live
your life.
At the end, you would go back and choose the one that worked out the
best.
Then you could decide who to marry, which job
1
Deterministic Finite Automata
S*
0,1
0,1
0,1
0,1
0,1
0,1
Finite Automaton
Finite Internal States
Device with Binary Inputs
One Binary Output
0,1
0,1
Device with Multiple
Inputs and Outputs
A finite automaton M is a device with finitely many internal sta
Introduction to COMP 455
My name
This is COMP 455, Models of Languages and Computation
Pass out sign-up sheet
Ask who is sophomore etc. and what majors people have
Show course web page, go over links and syllabus
Accessible from my home page or from
1
Push-down Automata and Context-Free
Languages
Lemma 1.1 (3.4.1) The class of languages recognized by push-down automata is the same as the class of context-free languages.
This result is interesting because sometimes it is easier to see how to
construct
Survey
The course deals with abstract models of computers and their properties.
This approach avoids many details of actual computers.
In this way we prove general results that hold for any computer satisfying the assumptions of
the model.
To do this
COMP 181
Models of Languages and Computation
Fall 2005
Mid Semester Exam
Tuesday, Ot. 4, 2005
Closed Book - Closed Notes
Don't forget to write your name or ID and pledge on the exam sheet.
This exam has four pages.
1. (5 points)
a) Suppose is the relation
COMP 181
Models of Languages and Computation
Spring 2001
Mid Semester Exam
Monday, Feb. 26, 2001
Closed Book - Closed Notes
Don't forget to write your name or ID and pledge on the exam sheet.
This exam has four pages.
1. (5 points)
a) Suppose is the relat
1
Deterministic Finite Automata
S*
0,1
0,1
0,1
0,1
0,1
0,1
Finite Automaton
Finite Internal States
Device with Binary Inputs
One Binary Output
0,1
0,1
Device with Multiple
Inputs and Outputs
A nite automaton M is a device with nitely many internal states
1
Closure Properties of Context-Free Languages
We show that context-free languages are closed under union, concatenation,
and Kleene star. Suppose G1 = (V1 , 1 , R1 , S1 ) and G2 = (V2 , 2 , R2 , S2 ).
Example: For G1 we have
S1 aS1 b
S1 .
For G2 we have
1
The Halting Problem and Unsolvability
Here is a way to present unsolvability that diers from the text. See
handout 9 also for this subject.
Let be cfw_encode(M) : M loops on input encode(M). Thus involves
Turing machines running on their own description
COMP 455
Models of Languages and Computation
Fall 2016
Homework 3
Due Friday, Sept. 16, 2016
1. Construct a deterministic finite automaton recognizing the following
language: cfw_w : w has at least two as and an odd number of bs
2. Problem 2.2.9, part (b)
COMP 455
Models of Languages and Computation
Fall 2016
Homework 4
Due Wednesday, October 5, 2016
1. Problem 2.3.7, part (b), from the text, page 84. You need not use the
construction of example 2.3.2, just come up with a regular expression for this
automa
1
Minimizing Finite Automata
Outline of this section:
1. Dene strings equivalent with respect to a language L. This is
notated as x L y. This is dened by x L y i cfw_z : xz L =
cfw_z : yz L. If L is regular then L has nitely many equivalence
classes, and
1
Push-down Automata
A push-down automaton is a nite automaton with an additional last-in
rst-out push-down stack; anything read from the stack is immediately destroyed. Push-down automata are partway to a Turing machine. Push-down
automaton are nondeterm
1
Context-Free Grammars
Context-free languages are useful for studying computer languages as well
as human languages.
Context-free languages are recongnized by push-down automata (PDA)
in the same way that regular languages are recognized by nite automat
1
Parse Trees
Parse trees are a representation of derivations that is much more compact.
Several derivations may correspond to the same parse tree. For example, in
the balanced parenthesis grammar, the following parse tree:
s
s
s
( s )
( s )
e
e
correspon
1
Minimizing Finite Automata
Outline of this section:
1. Dene strings equivalent with respect to a language L. This is
notated as x L y. This is dened by x L y i cfw_z : xz L =
cfw_z : yz L. If L is regular then L has nitely many equivalence
classes, and
1
Finite Automata and Regular Expressions
Motivation: Given a pattern (regular expression) for string searching, we
might want to convert it into a deterministic nite automaton or nondeterministic nite automaton to make string searching more ecient; a det
1
Nondeterministic Finite Automata
Suppose in life,
whenever you had a choice, you could try both possibilities and live
your life.
At the end, you would go back and choose the one that worked out the
best.
Then you could decide who to marry, which job
1
Deterministic Finite Automata
S*
0,1
0,1
0,1
0,1
0,1
0,1
Finite Automaton
Finite Internal States
Device with Binary Inputs
One Binary Output
0,1
0,1
Device with Multiple
Inputs and Outputs
A nite automaton M is a device with nitely many internal states
1
Showing Languages are Non-Regular
Question: How can one show that a language is not regular?
We have no way to do this so far; constructing a nite automaton or a
regular expression can only show a language is regular.
To show a language is not regular
1
Finite Representations of Languages
Languages may be innite sets of strings. We need a nite notation for them.
There are at least four ways to do this:
1. Language generators. The language can be represented as a mathematical sequence w1 , w2, w3 , . .
1
Alphabets and Languages
Look at handout 1 (inference rules for sets) and use the rules on some examples like
cfw_a cfw_a
cfw_a cfw_a, b,
cfw_a cfw_a,
cfw_a cfw_a,
cfw_a cfw_a, b,
a cfw_a,
a cfw_a, b,
a cfw_a,
a cfw_a, b
Example: To show cfw_a cfw_a, b,