CPSC 121, Winter 2017: Assignment 1
Alice Gao, Ryan Vogt, and Steve Wolfman
Due Thursday 19 January 2017 at 16:00
1. An Island of Riddles (10 marks)
There is an island on which everyone is a dragon or a troll. Dragons, being noble, always tell
the truth.
CPSC 121: Models of Computation
Assignment #4, due Friday, July 6th , 2007 at 14:25
[6] 1. Determine the truth value of each statement. The domain of discourse is the set R of real
numbers. Justify your answers.
[3] a. y R, x R, x2 < y + 1
[3] b. x R, y R
CPSC 121: Models of Computation
Assignment #5, due Friday, July 13th , 2007 at 14:25
[12] 1. Consider the theorem: for all integers a, b and c, if a divides b and a does not divide c, then
a does not divide b + c.
[6] a. Prove this theorem using the contr
CPSC 121: Models of Computation
Assignment #5, due Tuesday April 7th , 2015 at 17:00
[6] 1. Design a DFA that accepts exactly the strings over the alphabet cfw_A, B, . . . , Z in
which every pair of consecutive Es occurs before every pair of consecutive O
CPSC 121: Models of Computation
Assignment #2, due Thursday February 5th , 2015 at 17:00
[6] 1. Computers represent characters by associating with each character a specic sequence of 0s and 1s. In this question, you will be dealing with the ASCII and
Unic
CPSC 121: Models of Computation
Assignment #4, due Friday, July 6th , 2007 at 14:25
[6] 1. Determine the truth value of each statement. The domain of discourse is the set R of real
numbers. Justify your answers.
[3] a. y R, x R, x2 < y + 1
Solution : This
CPSC 121, Summer 2016: Midterm 1
Ryan Vogt
27 May 2016
This exam is open-book, and you may use any written or printed materials to assist you. You
may not use any electronic devies, though (e.g., calculators, phones, tablets, etc.). Please do not
take any
CPSC 121: Models of Computation
Assignment #1, due Tuesday 23 May 2017 at 16:00
[9] 1. An Island of Riddles
There is an island on which everyone is a dragon or a troll. Dragons, being noble,
always tell the truth. Trolls, being tricky, always lie. Alice,
CPSC 121: Models of Computation
Module 1: Course Introduction
Today's learning goals
By the end of this module, you should be able
to:
Give an example of how we can apply formal
reasoning to a simple, real-world task.
Give an example of how a computationa
CPSC 121: Models of Computation
Module 7: Proof Techniques (part 1)
Module 7: Proof Techniques (part 1)
Assignment #3 is due Monday March 2 nd at
17:00.
Pre-class quiz #8 is tentatively due Thursday
March 5th at 17:00
Epp, 4th edition: 12.2, pages 791 to
For theorems like:
You might try:
WLOG
x D, P (x).
Exhaustion
Cases
In which case, write:
WLOG, let x be an element of D.
We proceed by exhaustion over D.
Note that Q(x) or
R(x) must be true.
And then prove:
P (x).
P (d) for each element d in D.
x D, Q(x)
CPSC 121: Models of Computation
Assignment #6, Not to be handed in.
1. Evaluate the sum
n
S(n) =
k
(k + 1)!
k=1
for n = 1, 2, 3, 4, 5. Make a conjecture about a formula for S(n) that works for every n 1, and then
prove your conjecture by mathematical indu
CPSC 121: Models of Computation
Assignment #4, due Monday, March 16th , 2015 at 17:00
Each of the following questions asks you to prove (or disprove) a theorem. When the
theorem is stated in English, it would be an excellent idea to rst rewrite it in pred
a) Prove or disprove the following statement without using a truth table:
p(x) , q(z,y) are predicates with Z as the domain of discourse for each variable.
xy [ (p(x) z q(z,y) ) (z q(z,y) p(x)] xy [p(x) z q(z,y)]
Recall: To prove logical equivalences, sel
5/14/17
Due Dates
Assignment #1 is due Thursday January 19th at
4pm
Pre-class quiz #4 is due Thursday January 19th at
7pm.
Module 3: Representing
Values in a Computer
Assigned reading for the quiz:
Epp, 4th edition: 2.3
Epp, 3rd edition: 1.3
Come
3/3/17
Learning goals: pre-class
By the start of class, you should be able to
Module 8:
Sequential Circuits
Trace the operation of a DFA (deterministic finitestate automaton) represented as a diagram on an
input, and indicate whether the DFA accepts o
1/25/17
Due dates
Pre-class quiz #5 is due Sunday January 29th at
19:00
Module 4: Propositional
Logic Proofs
Assigned reading for the quiz:
Epp, 4th edition: 3.1, 3.3
Epp, 3rd edition: 2.1, 2.3
Assignment #2 is due Thursday February 2nd at
4pm.
2
2/27/17
Admin
Midterm 1 has been graded. It is available
through handback on the course website. Read
Piazza post on this.
Assignment #3 will be released by the end of
Monday and will be due the Thursday after
reading week.
Module 7: Proof Technique
3/19/17
Module 9: Announcements
Module 9: Mathematical
Induction
There is a chance that this Fridays class may be
cancelled.
Assignment #4 is due Thursday March 16th at
4pm.
Midterm #2
Monday March 20th, 2017 from 7pm to 9pm
Read the Piazza post.
3/30/17
CPSC 121: Models of Computation
Who am I?
Alice Gao ([email protected])
Postdoctoral fellow in Computer Science
PhD in Computer Science at Harvard University
Undergrad in CPSC and MATH at UBC
www.cs.ubc.ca/~xigao/
Module 1: Propositional Logic
3/30/17
Due dates
Pre-class quiz 3 due Sunday January 15 at 7pm.
Module 2: Conditionals and
Logical Equivalences
Assigned Readings:
Epp, 4th edition: 2.5
http:/en.wikipedia.org/wiki/Binary_numeral_syste
m
http:/www.ugrad.cs.ubc.ca/~cs121/current/han
2/5/17
Admin
Midterm 1: read the Piazza post on the two-stage
exam.
Assignment #2 is due Thursday Feb 2 at 4pm.
Pre-class quiz #6 is due Thursday Feb 2 at 7pm.
Module 5: Predicate Logic
Assigned reading for the quiz:
Epp, 4th edition: 3.2, 3.4
Ep
CPSC 121 - PROPOSITIONAL LOGIC I
Problem 1. Consider the following two circuits whereP and Q are the input signals. Are these two circuits
logically equivalent?
(1) Circuit 1:
(2) Circuit 2:
Problem 2. Consider the following proposition.
( (P Q) (P Q)
(1
CPSC 121 - PROPOSITIONAL LOGIC II SOLUTIONS
Problem 1. Consider the truth table.
p
q
r
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
Output
1
1
1
0
0
1
0
0
Convert the above truth table to a proposition. Your first approach may give the following propos
CPSC 121 TUTORIAL 1 - PROPOSITIONAL LOGIC I SOLUTIONS
Problem 1. Consider the following two circuits whereP and Q are the input signals. Are these two circuits
logically equivalent?
(1) Circuit 1:
(2) Circuit 2:
Answer: They are logically equivalent. One
CPSC 121: Models of Computation
Assignment #1, due Tuesday 23 May 2017 at 16:00
[9] 1. An Island of Riddles
There is an island on which everyone is a dragon or a troll. Dragons, being noble,
always tell the truth. Trolls, being tricky, always lie. Alice,
CPSC 121: Models of Computation
Assignment #2, due Tuesday 30 May 2017 at 16:00
[15] 1. ASCII Soup
Computers represent characters by associating with each character a specific sequence
of 0s and 1s. In this question, you will be dealing with the ASCII enc
CPSC 121: Models of Computation
Assignment #3, due Monday, March 2th , 2015 at 17:00
[15] 1. Consider the following predicates over the set U of all UBC students at the Vancouver
or the Okanagan campus:
G(x): x is a gourmet chef.
I(x): x speaks Italian.
CPSC 121: Models of Computation
Assignment #5
Sample Solution
We put question titles on these problems, but they don't matter. Please feel free to ignore them! :)
1
Adding Subtraction to the Working Computer [4 marks]
UNTIL THE WORDS END OF PRELUDE, THIS
CPSC 121 TUTORIAL - PROPOSITIONAL LOGIC
Problem 1. Consider the following two circuits where P and Q are the input signals. Are these two circuits
logically equivalent?
(1) Circuit 1:
(2) Circuit 2:
Solution. They are logically equivalent. One approach is
CPSC 121 TUTORIAL - PROPOSITIONAL LOGIC WEEK 2 SOLUTIONS
Problem 1. Consider the truth table.
p
q
r
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
Output
1
1
1
0
0
1
0
0
Convert the above truth table to a proposition. Your first approach may give the fol