Introduction to Computer Science for Computer Science Major
CPSC 313

Fall 2013
CPSC 313 Quiz #4
Thursday, October 10, 2013
Name:
Student ID:
Tutorial:
Duration: 45 Minutes
Aids Not Permitted
Name:
1.
Design a regular expression that can be used to represent the language
L = cfw_w cfw_x, y*  nx(w) is odd cfw_uxyv  u, v cfw_x, y* .
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Solutions for Quiz #1
1. The rst question concerned the following deterministic nite automaton M = (Q, , , q0 , F )
over the alphabet = cfw_a, b, c:
a
start
b
b
q0
q1
c
a
c
a, b
q2
c
q3
a, b, c
(a) The set of states of M is the set
Q = cfw_q0 , q
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
Introduction to Theory of Computation
Anil Maheshwari
Michiel Smid
School of Computer Science
Carleton University
cfw_anil,[email protected]
April 7, 2014
ii
Contents
Contents
Preface
vi
1 Introduction
1.1 Purpose and motivation . . . . .
1.1.1 Comp
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #1
Deterministic Finite Automata and Regular Languages
1
About This Assignment
This assignment can be completed by groups of up to three students and is due by 11:59 pm on
Wednesday, October 15. A printed copy of answers for written qu
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #3
Solution for Problem #2
In this question you were asked to consider the problem of determining whether a singletape
Turing machine ever writes a blank symbol over a nonblank symbol during the course of its
computation on some inpu
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
UNIVERSITYOFCALGARY
Assignment3Turing
Machines
CPSC313ComputationalTheory
Ahmed Zaidi(10150285), Nizar Maan(10103889), Jorge Gomez(10118589)
12/3/2014
Question1
This RAM machine consists of the following components:
A finite (small) number of registers R0
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Solutions for Quiz #2
1. This question concerned the regular expression
(a b) c (a b)
over the alphabet = cfw_a, b, c.
(a) Any strings of symbols over the above alphabet that included
zero or more occurrences of as and bs (in any order), followe
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Solutions for Quiz #4
1. A contextfree grammar G = (V, , R, S) is in Chomsky Normal Form if it satises
the following property.
The start variable, S, does not appear as part of the righthand side of any rule.
The only rules in the grammar hav
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Solutions for Quiz #3
1. (a) Solution #1: One way to show that is in the language of this grammar is
to give the derivation
S AB
(using the rule S AB)
B
(using the rule A )
(using the rule B ).
Solution #2: Another way to show that is in the lang
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Solutions for Quiz #6
1. If L1 and L2 then a mapping reduction from L1 to L2 is a total
2
1
function f : that satises the following properties.
2
1
(a) For every string x , if x L1 then f (x) L2 .
1
(b) For every string x , if x L1 then f (x) L2
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Solutions for Quiz #5
1. (a) The start conguration for a Turing machine
M = (Q, , , , q0 , qaccept , qreject )
is the conguration in which
M is in its start state q0 ,
M s tape stores the symbols in the input string (in order, at the left end
o
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment 3 Solution April, 2013
1.
Claim 1. L = cfw_< M, N >  L(M ) L(N ) is not recursive.
We have shown in class that the language
Lempty = cfw_< M >  L(M ) =
is not recursive. To prove the above claim it is sucient to prove the following.
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
HW1 Solution
1.4
a. L1 = cfw_w  w has at least three a's
b
b
b
a
a,b
a
a
L2 = cfw_w  w has at least two b's
a
a
a,b
b
b
Combining them using the intersection construction gives the DFA:
a
a
a
b
b
a
b
a
b
a
b
b
a
b
a
b
a
b
b
a
b
c. L1 = cfw_w  w has an
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #3
Solution for Problem #1 (Second Version)
In this problem you were asked to sketch a proof that the set of Turingrecognizable (respectively, Turingdecidable) languages is not changed if RAM Turing machines are used to dene
these in
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #3
Solution for Problem #1 (First Version)
In this problem you were asked to sketch a proof that the set of Turingrecognizable (respectively, Turingdecidable) languages is not changed if RAM Turing machines are used to dene
these ins
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2011
CPSC313
Introduction to Computability
Review of Concepts
Lecture 02
Padma Polash Paul
Winter 2015
Textbook
Chapter 1
Introduction to the Theory of Computing
CPSC313: Introduction to Computability
2
CPSC313
Introduction to Computability
Review
Set
Padma Po
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2011
DFAs: An Example
Fundamental Definitions
DFA: Definition
Computation by DFAs
Another Example
Computer Science 313
Introduction to Deterministic Finite Automata
Instructor: Wayne Eberly
Department of Computer Science
University of Calgary
Lecture #2
Conclu
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2011
CPSC 313
Spring 2017
Assignment 1  part 1
Due no later than May 29 at 18:30
For full credit it is enough to accumulate 5 points.
Exercise 1 (1.5 points). For each of the following languages in cfw_0, 1 , describe a deterministic finite automaton that acc
Introduction to Computer Science for Computer Science Major
CPSC 313

Fall 2014
Denition
Examples
Recognition and Decision
Computer Science 313
Introduction to Turing Machines
Instructor: Wayne Eberly
Department of Computer Science
University of Calgary
Lecture #21
What Next?
Denition
Examples
Recognition and Decision
What Next?
Goal
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #1
Solutions for Problem #3
Once again two quite short and simple solutions will be presented. The way that you
would solve this problem would probably depend on the way you solved the problem before it.
First Solution
Suppose, rst, th
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #1
Solutions for Problem #1
Consider a string of symbols over the alphabet dened for this question, as well as
the integers , and that correspond to them, as these are dened in Question #1 on
this assignment.
A consideration of what ha
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #1
Solutions for Problem #2
Two solutions will be presented. The rst involves a process that can be used to convert a
deterministic nite automaton for a language L into a nondeterministic nite automaton
for LR . the second involves a p
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #1
Solutions for Problem #4
Consider a string of symbols over the alphabet dened for this question, as well
as the integers , and that correspond to them, as these are dened in Questions #3
and #4 on this assignment.
A consideration of
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #2
Solutions for Problem #11
Recall the grammar given in the solution to Problem #9. This was the grammar
G = (V, , R, S)
where
V = cfw_S,
= cfw_a, b, c,
S is the start variable, and
R includes the following rules.
S  S c  cS  a
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #2
Solutions for Problem #10
The process to convert a contextfree grammar into a grammar in Chomsky Normal Form will
now be applied to the context free grammar produced in answer for question #9. This was the
grammar
G = (V, , R, S)
w
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2015
CPSC 313 Assignment #2
Solutions for Problems #19
1. Claim: If then L if and only if c L.
Proof: Suppose L. Then includes exactly k as and exactly k bs, for some integer
k 0. In this case c also includes exactly k as and exactly k bs, so that c L too.
On
Introduction to Computer Science for Computer Science Major
CPSC 313

Winter 2011
CPSC313
Introduction to Computability
Basic Concepts
Lecture 03
Padma Polash Paul
Winter 2015
Introduction to
Languages
Grammars
Automata
CPSC313: Introduction to Computability
2
CPSC313
Introduction to Computability
Introduction to Languages
Padma Polash
Introduction to Computer Science for Computer Science Major
CPSC 313

Fall 2015
CPSC 313 Review Questions for Lecture #8
Regular Expressions
1. What is a regular expression over an alphabet ?
2. How is are regular expressions in related to regular languages that are subsets
of ?
3. State the formal denition of a regular expression ov