0% found this document useful (0 votes)
65 views4 pages

CSC236 UTM Assignment 1 Overview

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views4 pages

CSC236 UTM Assignment 1 Overview

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CSC236 UTM Fall 2024

Assignment 1 Due Sept 30

You are not allowed to post the assignment questions anywhere; however, you are allowed to
search the internet (just cite your resources if you find any). You are also allowed to bounce ideas
off classmates and TAs, but at the end, you must write your own solutions.

Q1. (15 pts)


Exercise 11 p. 21 in the textbook asks you to prove that:

For every natural number n, a set of size n has 2n subsets.

Observe that the statement is about an arbitrary set, which means you are asked to prove
the following:

∀n ∈ N, for any set A, if |A| = n then |P(A)| = 2n .

where the |A| means the cardinality of the set A, and P(A) means the power set of A (the
set of all subsets of A).
Another equivalent way to write the statement is:

For any arbitrary set A, ∀n ∈ N, |A| = n =⇒ |P(A)| = 2n .

Now consider the following predicates:

P (n) : For any set A, if |A| = n then |P(A)| = 2n

Q(A, n) : |A| = n =⇒ |P(A)| = 2n

In Q(A, n), A is treated as a variable that can be any set1 .


Alright, now, proving the original statement means proving one of the following:

Statement 1: ∀n ∈ N, P (n), or

Statement 2: For any set A, ∀n ∈ N, Q(A, n).

Attempt the following:

(a) Prove Statement 1 using simple induction.


(b) Prove Statement 2 using simple induction. Your proof should start by letting A be an
arbitrary set, which will be fixed throughout the induction proof.

One of the attempts above will fail (you will get stuck). Explain briefly why.

1
This is known as a second order variable. A first order variable is like n

1
CSC236 UTM Fall 2024
Assignment 1 Due Sept 30

Q2. (10 pts + 3 bonus)


Let n, m be natural numbers. Let A and B be arbitrary finite sets of sizes m and n, respec-
tively.

(a) How many functions are there with domain A and co-domain B? Prove the correctness
of your answer using induction.
(b) (Bonus) Use part (a) to prove the original statement in Q1 directly without the use of
induction.

Q3. (10 pts)


In propositional logic, you have seen the connectives ¬, ∧, ∨, →, and ↔. Prove using struc-
tural induction that any proposition built using these connectives is equivalent to a propo-
sition built only using ¬, →.

Q4. (10 pts)


Consider the following two-pointer style Python program which finds whether a given string
s is a palindrome or not:
def c h e c k i f p a l i n d r o m e ( s ) :
left = 0
r i g h t = len ( s ) − 1

while l e f t < r i g h t :
i f s [ l e f t ] != s [ r i g h t ] :
return F a l s e
l e f t += 1
r i g h t −= 1

return True

Prove correctness and termination. Clearly state the loop variant and the loop invariant,
and use induction properly.

More on the next page

2
CSC236 UTM Fall 2024
Assignment 1 Due Sept 30

Q5. (15 pts)


Following up on Q3. Perhaps you have seen other connectives such as: XOR, NOR, etc. All
the connectives used in propositional logic are meant to approximate the connectives we use
in our natural language (e.g. English). In Q3 you showed that only two connectives can be
enough to express everything2 .
Each connective is, in essence, a truth function. For example, ¬ is a function from (domain)
{T, F } to (co-domain) {T, F } such that ¬(T ) = F and ¬(F ) = T . Similarly,

∧ : {T, F }2 → {T, F }

is such that
∧(T, T ) = T, and
∧(T, F ) = ∧(F, T ) = ∧(F, F ) = F.

There is something common about all these connectives (truth functions); they are at most
binary. For example, ¬ is a unary (1-ary) connective, while ∧ is a binary (2-ary) connective3 .

Why stop at 2-ary?


Why can’t we have 3-ary? 4-ary? n-ary for any natural n?
Even if these go beyond the capacity of a natural language, they can still exist mathematically
(imagine a potentially superior power of expression). Indeed, an n-ary connective is just a
function from {T, F }n to {T, F }.
To help you understand things more, consider the following example. We can define a fancy
connective △ as follows:
△(p, q, r) = (p ∧ q) → r,

which is just a lazy way to say:

△ : {T, F }3 → {T, F },
such that
△(p, q, r) = → (∧(p, q), r).

The connective △ connects 3 propositions (3-ary).


At this point, it is not hard to notice that every connective is equivalent to some truth table.
Any n-ary connective is describable by a truth table that has n + 1 columns (n columns for
n propositional variables, plus one column for the evaluation of the entire proposition).

Q5 is continued on the next page

2
One can even use → alone. For example, ¬p is equivalent to (p → F ).
3
T and F are considered 0-ary connectives

3
CSC236 UTM Fall 2024
Assignment 1 Due Sept 30

Answer the following:

(a) (2 pts) For any natural n, how many n-ary connectives are there? You do not need to
justify your answer using induction. Hint: Check Q2.
(b) (13 pts) Prove that any truth table that can ever exist is the truth table of some
proposition built using only {¬, ∧}.
Hint 1: If Θ is an n + 1-ary truth function, then we can define from it n-ary truth
functions ΘT and ΘF as follows:

ΘT (p1 , . . . , pn ) = Θ(p1 , . . . , pn , T ),

ΘF (p1 , . . . , pn ) = Θ(p1 , . . . , pn , F ).

Hint 2: For any p1 , . . . , pn+1 ∈ {T, F }, thinking of Θ, ΘT , and ΘF as connectives, we


have

Θ(p1 , . . . , pn+1 ) ≡ (pn+1 ∧ ΘT (p1 , . . . , pn )) ∨ (¬pn+1 ∧ ΘF (p1 , . . . , pn ))

You are expected to explain why the hints are correct if you use them in your solution.

End of questions

You might also like