Jacob Lowey
Question 1 [Rosen Section 1.1, Exercise 30] ( points)
How many rows appear in a truth table for each of these compound propositions?
(a) (q p) (p q) 4 rows
(b) (p t) (p s) 8 rows
(c) (p r) (s t) (u v)
64 rows
(d) (p r s) (q t) (r t)
32 rows
Qu
Jacob Lowey
Question 1 [Rosen Section 1.3, Exercise 42]
Suppose that a truth table in n propositional variables is specified. Show that a compound
proposition with this truth table can be formed by taking the disjunction of conjunctions of the
variables o
CSCI 2200  FOCS HOMEWORK 1 SOLUTIONS
Problem 1.
p
q
r
r q r q (r q) p r (r q) (p r)
T
T
T
F
F
T
F
T
F
T
T
F
T
F
F
T
T
T
T
F
T
F
T
T
F
T
F
T
F
F
T
T
T
F
T
F
F
T
T
F
F
T
F
F
F
F
T
F
T
F
F
T
T
T
F
F
T
F
T
T
F
F
F
F
F
F
T
T
T
F
T
F
Problem 2.
It is trivial t
Induction and recursion
Climbing an
Infinite Ladder
Suppose we have an infinite ladder:
1. We can reach the first rung of the ladder.
2. If we can reach a particular rung of the ladder,
then we can reach the next rung.
From (1), we can reach the first run
The Foundations: Proofs
Revisiting the Socrates Example
We have the two premises:
All men are mortal.
Socrates is a man.
And the conclusion:
Socrates is mortal.
How do we get the conclusion from the
premises?
The Argument
We can express the premises (abov
Discrete Probability
Probability of an Event
PierreSimon
Laplace
(17491827)
We study PierreSimon Laplaces classical theory of probability,
which
he introduced in the 18th century, when he analyzed games of chance.
We first define these key terms:
An ex
Decidability
1
The Chomsky Hierarchy
Nonrecursively enumerable
Recursivelyenumerable
Recursive
Contextsensitive
Contextfree
Regular
2
Consider problems with answer YES or NO
Examples:
Does MachineM
Is string
w
Does DFA
M
have three states ?
a binar
1)
p
i POv ha
Score:
/ 100
Exam #1,1
'D beArf
A 1_
CSCI2 00 Foundations of Computer Science (FoCS)
Name:
Monday 9/30
1PAGE (2SIDED) CRIB SHEET ALLOWED; NO CALCULATOR
ANSWER ALL QUESTIONS; USE EXTRA PAPER AS NECESSARY
1. [20 POINTS] Let p, q, r, s, an
ContextFree Languages
1
n n
cfw_a b : n 0
R
cfw_ww
Regular Languages
a *b *
( a b) *
2
ContextFree Languages
n n
cfw_a b
R
cfw_ww
Regular Languages
3
ContextFree Languages
ContextFree
Grammars
Pushdown
Automata
stack
automaton
4
ContextFree Gramma
P and NP
1
Time Complexity
We use a multitape Turing machine
We count the number of steps until
a string is accepted
We use the O(k) notation
2
Example:
n n
L cfw_a b : n 0
Algorithm to accept a stringw
:
Use a twotape Turing machine
Copy thea
on the sec
[10/24/2013]
Homework #6 posted (due 10/31)
=
Proof by Mathematical Induction
Principle of Mathematical Induction:
To prove that P(n) is true for all positive integers n,
we need to complete these steps:
we could start at a difference basis value

v
FOCS Section 1
Homework 1
1)
Truth Table
q
p
r
qp
r
T
T
T
T
F
F
F
F
T
T
F
F
T
T
F
F
T
F
T
F
T
F
T
F
T
T
F
F
T
T
T
T
F
T
F
T
F
T
F
T
Statement:
qr
T
F
T
F
F
T
F
T
result
F
T
T
F
T
F
T
F
(r (q p) ( r (q p)
2a) Satisfiable: assign T to q and p
b) Not Satisfi
FOCS Section 1
Homework #2
1a)
xyF(x,y)
b)
xyF(x,y)
c)
x(F(x,me)P(I,x)
d)
P(I,you)xP(x,you)
2a)
xy(P(x)Q(y)
b)
x(P(x)Q(x)
3a)
mc
Tautology:
dm
(mc)(dm)(ds)(c)s
ds
c_
s
b) This is a valid argument.
(mc)(dm)(ds)(c)s
(m (dm)(ds)(c)s
(d(ds)(c)s
(s(c)s whichwi
FOCS Section 1
FOCS Homework #3
1) Part 1: assume x = y
1. (x + y) / 2 = (xy)
original
2. (x + x) / 2 = (x*x)
replace y with x
(w.l.o.g.)
3. x = x
simplify
Therefore the statement is true when x = y
Part 2: if x y
1. (x + y) / 2 = (xy)
original
2. (x + y)
CSCI 2200  FOCS HOMEWORK 2 SOLUTIONS
Problem 1. (20 points)
The argument is invalid. Here is the proof:
Step
Reason
1. (p q) P remise
2. p q De M organ0 s laws using (1)
3. q
Simplif ication using (2)
4. p
Simplif ication using (2)
From (3) and (4), we c
CSCI 2200  FoCS Homework 3 Solutions
Problem 1. (40 points)
1. c A B : True
A B = cfw_a, b, c cfw_b, cfw_c = cfw_a, c.
2. cfw_ 2B : True
The empty set is always in a powerset.
3. B A : False
cfw_c is not included into A.
4. cfw_a, b A A : False
A A = cfw
CSCI 2200 Foundations of Computer Science
Homework 8
Problem 1. (3*10=30 points)
Consider the alphabet = cfw_a, b. Show that the following languages are regular (give the FAs, either deterministic or nondeterministic, that accept the
languages):
Problem
CSCI 2200 Foundations of Computer Science
Homework 3
Problem 1. (40 points)
Let A = cfw_a, b, c and B = cfw_b, cfw_c. Determine whether the following statements
are true or false and explain your answer. (We use 2X to denote the powerset
of a set X.)
1. c
CSCI 2200 Foundations of Computer Science
Homework 9
Problem 1. (2*25=50 points) Give Standard Turing machines for each of
the following languages (the alphabet is always = cfw_a, b):
L1
=
cfw_aa, bb
L2
=
cfw_w : na (w) = nb (w)
In L2 , na (w) is the numb
CSCI 2200 Foundations of Computer Science
Homework 7
Problem 1.
(20=2*10 points)
Suppose you have a class with 30 students 10 freshmen, 12 sophomores, and 8
juniors.
You pick one student at random. What is the probability that the student
is not a junior
CSCI 2200 Foundations of Computer Science
Homework 6
Problem 1. (45 points)
Suppose you have 35 books (15 novels, 10 math books, and 10 computer science
books). Assume that all 35 books are different. In how many ways can you:
Put the 35 books in a row o
CSCI 2200 Foundations of Computer Science
Homework 4
Problem 1. (15 points)
Prove that for all n 2, n3 > n2 + 3. What happens for n = 1 or n = 0?
Problem 2. (15 points)
Prove that n2 + n is divisible by two for all n 0.
Problem 3. (15 points)
You take a j
CSCI 2200 Foundations of Computer Science
Homework 10
(This is a practice homework; DO NOT submit. The TAs will solve the
problems in the recitation sessions on Wednesday, May 5.)
Problem 1. Prove that the following problem is undecidable:
Input: Two Turi
CSCI 2200 Foundations of Computer Science
Homework 5
Problem 1. (100 = 10 * 10 points)
Suppose that a word is any string of seven letters of the English alphabet, with
repeated letters allowed.
1. How many words are there?
2. How many words end with the l
1.
To prove that S is countable, we need to show that S is bijective to Z+.
f(a) = a/5 maps all elements from set S=cfw_x Z +  x mod 5 to all
positive integers.
Assume f(a) =f(b),because a/5 = b/5 a=b, so f(a) is injective.
For every elements x as positi
[10/21/2013]
Homework #5 Due Today!
Homework #6 available next class (due 10/31)
Exam #2 on Monday 11/4
=
RECURRENCE RELATIONS
definition: a RECURRENCE RELATION for the sequence cfw_a
n
is an equation that expresses a in terms of one or more
n
of the
[10/17/2013]
f o g
The composition of f with g
Let f and g be functions from the set
of integers to the set of integers
f: Z > Z
g: Z > Z
f(x) = 2x + 3
g(x) = 3x + 2
f o g = f( g(x) ) = f( 3x + 2 )
= 2( 3x + 2 ) + 3 = 6x + 7
g o f = g( f(x) ) = g( 2
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 1
1
Warm Up (do before recitation lab)
(1) p and q are two propositions that are either T or F . How many rows are there in the truth table of the
compound proposition (p q) p.
(2) Give
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 5
1
Warm Up (do before recitation lab)
(1) Precisely formulate using appropriately defined predicates and quantifiers:
If two courses have the same student then the exam times for those
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 10
1
Warm Up (do before recitation lab)
(1) Order these languages using the subset relation:
FAsolvable: The set of languages that can be solved by a Finite Automaton.
CFGsolvable: The
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 2
1
Warm Up (do before recitation lab)
(1) N is the set of natural numbers, cfw_1, 2, 3, . . .. What is the size of N?
(2) Write down all 4bit binary sequences. How many did you get?
(3
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 6
1
Warm Up (do before recitation lab)
(1) Let g(n) =
n
P
i. What is the BigTheta, BigOh and LittleOh relationship between g(n) and n, n2 , n3 .
i=1
For example, is g(n) = O(n) or o(n
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 9
1
Warm Up (do before recitation lab)
(1) A = cfw_a, b, c; B = cfw_x, y, z. Consider the function f : A 7 B with f (a) = x; f (b) = x; f (c) = z. Circle
which (if any) of the following
CSCI 2200
Foundations of Computer Science (FOCS)
RPI
2016
ASSIGNMENT 7
1
Warm Up (do before recitation lab)
(1) Which of these graphs has an Euler cycle, an Euler path or neither:
(2) Compute the minimum number of colors to color each graph in Warm Up pro