ICS.6D, Fall 2007, Midterm, November 5, 2007,
SOLUTIONS
1) True, False, or Depends?
[ 48 pts
= 16 items x
3pts each ]
For each statement mark whether it’s True, False, or it depends on the instantiation of the
variables and/or the definition of the predicates:
a.
If (p and
¬
q) then p
True, because (p and r) implies p for any r
.
b.
If p then (10=5 and a=a)
Depends, because it’s true whenever p ≡ F and
false whenever p ≡ T, because (10=5 and a=a) ≡ F, and (p→F) ≡ (
¬
p).
c.
(p
↔
¬
p)
False, because it’s false for all p.
d.
(p
↔
¬
p) is a contradiction
The answer to (d) is “True” because the answer to
(c) is “False”.
In other words, (p
↔
¬
p) is a contradiction because it’s a
statement that’s false for all values of the variable p.
e.
(
2200
x
¬
A(x))
if
(
¬ 5
x A(x))
True, because these two statements are equivalent
for all predicates A.
Note that implicitly both quantifiers are over the same
universe (which was not stated but was to be assumed).
f.
{1,4}
⊂
({1,2,3,4,5} – {2,3})
True, because {1,4} is a proper subset of {1,4,5}
g.
|{1,1,2,2,3} x {1,1,1}| = 3
True, because |{1,1,2,2,3}|=3, |{1,1,1}|=1, and 3*1=3
h.
|P({1,1,2})| = 2
False, because |{1,1,2}|=2, so |P({1,1,2}|=2
2
=4
i.
Ø
∈
{ Ø }
True, just a case of a
∈
{a} for some a.
j.
Ø
⊂
{ Ø }
True, because Ø
⊆
A
for all A and Ø ≠ {Ø}
k.
S
⊂
S
False, because S=S for all S.
l.
(A
∪
B)
∩
C = (A
∩
C)
∪
(B
∩
C)
True.
It’s one of the distribution laws and it
can be quickly checked using basic definitions of union or intersection or using
a Venn Diagram.
m. 2
2
•3
2
= gcd( 2
2
•3
3
, 2
2
•3
1
)
False, because the gcd here is 2
2
•3
1
n.
gcd(a,b) = gcd(b mod a, a)
True for all integers (a,b) s.t. a≠0.
The Euclidean
Algorithm for fast gcd computation is based on this fact for b>=a.
However it’s
also true for a>b because if a>b then (b mod a) = b, and it’s true for b=a because
gcd(0,a)=a if a≠0.
[When making the quiz I have overlooked the fact that if a=0 then expression (b mod a) is undefined, and