Introduction to the Theory of Computation
AZADEH FARZAN WINTER 2010
Monday, January 11, 2010
PROOFS
Proof by Contradiction Proof by Construction
Jack sees Jill, who has just come in from outdoors Proof by Induction dry. Jack knows that it is not raining.
CSC236H: Introduction to the Theory of Computatoin
Homework 1 Solutions
1. Use induction to prove that the following equation holds for all positive integers n:
n
k=1
n 1 = . k (k + 1) n+1
Solution. We prove this by induction on n. Base case: Note that fo
REGULAR EXPRESSIONS
DEFINITION
A regular expression over alphabet is dened inductively by:
DEFINITION
A regular expression over alphabet is dened inductively by: Basis:
DEFINITION
A regular expression over alphabet is dened inductively by: Basis: is a reg
CONTEXT FREE LANGUAGES
CONTEXT-FREE LANGUAGES
CONTEXT-FREE
REGULAR
Context-Free Grammars Push-Down Automata
IDEA
Remember balanced parantheses example from structural induction?
IDEA
Remember balanced parantheses example from structural induction?
S=
(S
THE PUMPING LEMMA
THE PUMPING LEMMA
Theorem. For any regular language L there exists an integer n, such that for all x L with |x| n, there exist u, v, w , such that (1) x = uvw (2) |uv | n (3) |v | 1 (4) for all i 0: uv i w L.
x x L
THE PUMPING LEMMA
Theo
LANGUAGES AND AUTOMATA
Tuesday, February 9, 2010
DATA MODEL
: a nite alphabet, e.g. cfw_0, 1, cfw_a, b, c. string or word: a nite sequence of concatenated symbols of .
0110 abbccbcac
empty string: length: |0110| = 4, |abbccbcac| = 9, | = 0.
Convention: a,
Introduction to the Theory of Computation
AZADEH FARZAN SPRING 2010
Tuesday, February 2, 2010
STRUCTURAL INDUCTION
Tuesday, February 2, 2010
DEFINING SETS RECURSIVELY
Dene a set of objects: (i) dene the smallest or smiplest object (or objects). (ii) dene
Introduction to the Theory of Computation
AZADEH FARZAN SPRING 2010
Tuesday, January 26, 2010
FUNCTIONS DEFINED BY INDUCTION
Tuesday, January 26, 2010
RECURSIVELY DEFINED FUNCTIONS
76
CHAPTER 3. FUNCTIONS DEFINED BY IN Examples. Let f : N N be for which w
Introduction to the Theory of Computation
AZADEH FARZAN SPRING 2010
Wednesday, January 20, 2010
CORRECTNESS OF SIMPLE RECURSIVE PROGRAMS
Wednesday, January 20, 2010
MERGE SORT
Merge sort takes an array A and rearranges its elements such that A[i] A[i + 1]
Introduction to the Theory of Computation
AZADEH FARZAN SPRING 2009
Wednesday, January 13, 2010
CORRECTNESS OF SIMPLE ITERATIVE PROGRAMS
Wednesday, January 13, 2010
BASIC DEFINITIONS
Program Correctness: correct output on all acceptable inputs. Testing?
I
UNIVERSITY OF TORONTO
® Faculty of Arts and Science (0
6&9 ‘y
AUGUST 2015 EXAMINATIONS %
CSC 236 HIY
Q Instructor: S. Cohen
Duration — 3 hours
Examination Aid: One sheet of paper, handwritten on both sides.
Last (Family) Name:
First (Given) Name:
Stud
DECEMBER 2014 FINAL EXAM CSC236H5F
Last Name: . First Name:
Student #: . a r g Signature:
UNIVERSITY OF TORONTO MISSISSAUGA
DECEMBER 2014 FINAL EXAMINATION
CSCZ36H5F
Theory of Computation
Daniel Zingaro
Duration ~ 3 hours
Aids: 1 page of double-sided Lett
0
(<0 UNIVERSITY OF TORONTO \$
‘7 Faculty of Arts and Science
Final Exam
ago
, December 2014 ‘8
¢ CSC 236H1F
Duration — 3 hours
No Aids Allowed.
Student Number: I
Last Name:
First Name:
Do not turn this page until you have received the signal to start.
(I
(
6% UNIVERSITY OF TORONTO O
6‘ Faculty of Arts and Science $
6‘ ‘2‘?
6’4 Final Exam Q,
¢ . 9
0 April 2015 @V‘
I4, CSC 236HlS QV
Duration — 3 hours
NO A‘AS AllowacL
Student Numb er: I
Last Name:
First Name:
_—_—_—_—_————~—
Do not turn this page until yo
CSC236H: Introduction to the Theory of Computatoin
Homework 2
Due on Tuesday Feb 9, 2010 (in class)
1. Consider an array A[1.N ] each of whose elements is red or blue. The following algorithm rearranges the elements of A so that all occurrences of red com
Homework 2 Solutions
February 21, 2010 Problem 1a (3 points)
Precondition: N > 1 is a natural number. A is an array of N elements. Each element is either red or blue. Postcondition: A contains the same number of red and blue elements, and all the red elem
CSC236H: Introduction to the Theory of Computation
Homework 3
Due on Thursday March 4, 2010 (in class)
1. Early members of the Pythagorean Society dened gurate numbers to be the number of dots in certain geometrical congurations. (a) The rst four triangul
CSC236H: Introduction to the Theory of Computatoin
Homework 1
Due on Tuesday January 26, 2010 1. Use induction to prove that the following equation holds for all positive integers n:
n
k=1
1 n = . k (k + 1) n+1
2. Use induction to prove 3n < n! for all n
CSC236H: Introduction to the Theory of Computation
Bonus Homework
Due on Tuesday April 6, 2010 (in review session, see announcements)
Note that this assignment is for extra credit. If you do not want the extra credit, you do not have to hand in this assig
CSC236H: Introduction to the Theory of Computation
Homework 5 Solutions
1. Give a context-free grammar for each of the following languages. (a) L1 = cfw_0n 1m 0m 1n | n, m 0. Solution. S 0S 1 | C C 1C 0 | (b) L2 = cfw_an bm ck | n, m, k 0 and n = m + k. S
CSC236H: Introduction to the Theory of Computation
Homework 5
Due on Tuesday April 6, 2010 (in review session, see announcements)
1. Give a context-free grammar for each of the following languages. (a) L1 = cfw_0n 1m 0m 1n | n, m 0. (b) L2 = cfw_an bm ck
CSC236: Homework 4
March 17, 2010
Question 1
Part (a)
The automaton accepts words over cfw_a, b where the number of as is congurent to the number of bs modulo 3.
Part (b)
A B C
Part (c)
Prove by induction that: The new DFA is in state A i the old DFA is i