CSC165H1:

$ 24.99
Category:

Description

General instructions
• Your problem sets are graded on both correctness and clarity of communication. Solutions that are technically correct but poorly written will not receive full marks. Please read over your solutions carefully before submitting them.
• Solutions must be typeset electronically, and submitted as a PDF with the correct filename. Handwritten submissions will receive a grade of ZERO.
The required filename for this problem set is problem set1.pdf.
• Problem sets must be submitted online through MarkUs. If you haven’t used MarkUs before, give yourself plenty of time to figure it out, and ask for help if you need it! If you are working with a partner, you must form a group on MarkUs, and make one submission per group. “I didn’t know how to use MarkUs” is not a valid excuse for submitting late work.
Additional instructions
• Final expressions must have negation symbols (¬) applied only to predicates or propositional variables, e.g. ¬p or ¬Prime(x). To express “a is not equal to b,” you can write a 6= b.
• When rewriting logical formulas into equivalent forms (e.g., simplifying a negated formula or removing implication operators), you must show all of the simplification steps involved, not just the final result. We are looking for correct use of the various simplification rules here.
1. [6 marks] Propositional formulas. For each of the following propositional formulas, find the following two items:
(i) The truth table for the formula. (You don’t need to show your work for calculating the rows of the table.)
(ii) A logically equivalent formula that only uses the ¬, ∧, and ∨ operators; no ⇒ or ⇔. (You should show your work in arriving at your final result. Make sure you’re reviewed the “extra instructions” for this problem set carefully.)
(a) [3 marks] (p ⇒ q) ⇒¬q.
(b) [3 marks] (p ⇒¬r) ∧ (¬p ⇒ q).
2. [8 marks] Fixed Points.
Let f be a function from N to N. A fixed point of f is an element x ∈ N such that f(x) = x. A least fixed point of f is the smallest number x ∈N such that f(x) = x. A greatest fixed point of f is the largest number x ∈N such that f(x) = x.
(a) [1 mark] Express using the language of predicate logic the English statement: “f has a fixed point.”
(b) [2 marks] Express using the language of predicate logic the English statement: “f has a least fixed point.”
(c) [2 marks] Express using the language of predicate logic the English statement: “f has a greatest fixed point.”
(d) [3 marks] Consider the function f from N to N defined as f(x) = x mod 7. Answer the following questions by filling in the blanks.
The fixed points of f are:
The least fixed point of f is:
The greatest fixed point of f is:
3. [6 marks] Partial Orders. A binary predicate R on a set D is called a partial order if the following three properties hold:
(1) (reflexive) ∀d ∈ D, R(d,d)
(2) (transitive) ∀d,d0,d00 ∈ D, (R(d,d0) ∧ R(d0,d00)) ⇒ R(d,d00)
(3) (anti-symmetric) ∀d,d0 ∈ D, (R(d,d0) ∧ R(d0,d)) ⇒ d = d0
A binary predicate R on a set D is called a total order if it is a partial order and in addition the following property holds: ∀d,d0 ∈ D, R(d,d0) ∨ R(d0,d).
For example, here is a binary predicate R on the set {a,b,c,d} that is a total order:
R(a,b) = R(a,c) = R(a,d) = R(b,c) = R(b,d) = R(c,d) = R(a,a) = R(b,b) = R(c,c) = R(d,d) = True and all other values are False.
(a) [2 marks] Give an example of a binary predicate R on the set N that is a partial order but that is not a total order.
(b) [2 marks] Let R be a partial order predicate on a set D. R specifies an ordering between elements in D. Whenever R(d,d0) is True, we will say that d is less than or equal to d0, or that d0 is greater than or equal to d. The following formula in predicate logic expresses that there exists a greatest element in D; that is, an element in D that is greater than or equal to every other element in D:
∃d ∈ D, ∀d0 ∈ D, R(d0,d)
An element in D is said to be maximal if no other element in D is larger than this element. The following formula in predicate logic expresses that there exists a maximal element in D:
∃d ∈ D, ∀d0 ∈ D, d = d0 ∨¬R(d,d0)
Give an example of a partial order order R over {a,b,c,d} such that every element is maximal.
(c) [2 marks] Give an example of a partial order R over {a,b,c,d} such that a ∈ D is maximal but a is not a greatest element. Justify your answer briefly.
4. [13 marks] One-to-one functions. So far, most of our predicates have had sets of numbers as their domains. But this is not always the case: we can define properties of any kind of object we want to study, including functions themselves!
Let S and T be sets. We say that a function f : S → T is one-to-one if no two distinct inputs are mapped to the same output by f. For example, if S = T = Z, the function f1(x) = x + 1 is one-to-one, since every input x gets mapped to a distinct output. However, the function f2(x) = x2 is not one-to-one, since f2(1) = f2(−1) = 1. Formally we express “f : S → T is one-to-one” as: ∀x1 ∈ S, ∀x2 ∈ S, f(x1) = f(x2) ⇒ x1 = x2.
We say that f : S → T is onto if every element in T gets mapped to by at least one element in S. The above function f(x) = x + 1 is onto over Z but is not onto over N. Formally we express “f : S → T is onto” as:
∀y ∈ T, ∃x ∈ S, f(x) = y Let t ∈ T. We say that f outputs t if there exists s ∈ S such that f(s) = t.
(a) [1 mark] How many functions are there from {1,2,3} to {a,b,c,d}?
(b) [1 mark] How many one-to-one functions are there from {1,2,3} to {a,b,c,d}?
(c) [1 mark] How many onto functions are there from {1,2,3,4} to {a,b,c}?
(d) [2 marks] Now let R be a binary predicate with domain N×N. We say that R represents a function if, for every x ∈N, there exists a unique y ∈N, such that R(x,y) (is True). In this case, we write expressions like y = f(x).
Define a predicate Function(R), where R is a binary predicate with domain N×N, that expresses the English statement:
“R represents a function.”
(e) [2 marks] Define a predicate that expresses the following English statement.
“R represents an onto function.”
(f) [2 marks] Define a predicate that expresses the following English statement.
“R represents a one-to-one function.”
(g) [2 marks] Define a predicate that expresses the following English statement.
“R represents a function that outputs infinitely many elements of N.”
(h) [2 marks] Now define a predicate that expresses the following English statement.
“R represents a function that outputs all but finitely many elements of N.”

Reviews

There are no reviews yet.

Be the first to review “CSC165H1:”

Your email address will not be published. Required fields are marked *