Problem Set 1 Solution

$35.00

Description

General instructions

Please read the following instructions carefully before starting the problem set. They contain important information about general problem set expectations, problem set submission instructions, and reminders of course policies.

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.

Each problem set may be completed in groups of up to three. If you are working in a group for this problem set, please consult https://github.com/MarkUsProject/Markus/wiki/Student_Groups for a brief explanation of how to create a group on MarkUs.

Exception: Problem Set 0 must be completed individually.

Solutions must be typeset electronically, and submitted as a PDF with the correct lename. Hand-written submissions will receive a grade of ZERO.

The required lename 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 gure 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.

Your submitted le should not be larger than 9MB. This may happen if you are using a word processing software like Microsoft Word; if it does, you should look into PDF compression tools to make your PDF smaller, although please make sure that your PDF is still legible before submitting!

Submissions must be made before the due date on MarkUs. You may use grace tokens to extend the deadline; please see the Problem Set page for details on using grace tokens.

The work you submit must be that of your group; you may not refer to or copy from the work of other groups, or external sources like websites or textbooks. You may, however, refer to any text from the Course Notes (or posted lecture notes), except when explicitly asked not to.

Additional instructions

Final expressions must have negation symbols (:) applied only to predicates or propositional vari-

ables, e.g. :p or 😛 rime(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 re-moving implication operators), you must show all of the simpli cation steps involved, not just the nal result. We are looking for correct use of the various simpli cation rules here.

You may not de ne your own predicates or sets for this problem set; please work with the de nitions provided in the questions.

Page 1/5

CSC165H1, Problem Set 1

  1. [6 marks] Propositional formulas. For each of the following propositional formulas, nd the following two items:

    1. The truth table for the formula. (You don’t need to show your work for calculating the rows of the table.)

    1. A logically equivalent formula that only uses the :, ^, and _ operators; no ) or ,. (You should show your work in arriving at your nal result. Make sure you’re reviewed the \extra instructions” for this problem set carefully.)

  1. [3 marks] (p ) q) ) :q.

  1. [3 marks] (p ) :r) ^ (:p ) q).

Page 2/5

CSC165H1, Problem Set 1

  1. [8 marks] Fixed Points.

Let f be a function from N to N. A xed point of f is an element x 2 N such that f(x) = x. A least xed point of f is the smallest number x 2 N such that f(x) = x. A greatest xed point of f is the largest number x 2 N such that f(x) = x.

  1. [1 mark] Express using the language of predicate logic the English statement: \f has a xed point.”

You may use an expression like \f(x) = [something]” in your solution.

  1. [2 marks] Express using the language of predicate logic the English statement: \f has a least xed point.”

You may use the prede ned function f as well as the prede ned predicates = and <. You may not use any other prede ned predicates.

  1. [2 marks] Express using the language of predicate logic the English statement: \f has a greatest xed point.”

You may use the prede ned function f as well as the prede ned predicates = and <. You may not use any other prede ned predicates.

  1. [3 marks] Consider the function f from N to N de ned as f(x) = x mod 7.1 Answer the following questions by lling in the blanks.

The xed points of f are:

The least xed point of f is:

The greatest xed point of f is:

  • Here we are using the modulus operator. Given a natural number a and a positive integer b; a mod b is the natural number less than b that is the remainder when a is divided by b. In Python, the expression a % b may be used to compute the value of a mod b:

Page 3/5

CSC165H1, Problem Set 1

  1. [6 marks] Partial Orders. A binary predicate R on a set D is called a partial order if the following three properties hold:

    1. (re exive) 8d 2 D; R(d; d)

    1. (transitive) 8d; d0 ; d00 2 D; (R(d; d0 ) ^ R(d0 ; d00 )) ) R(d; d00 )

    1. (anti-symmetric) 8d; d0 2 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: 8d; d0 2 D; R(d; d0 ) _ R(d0 ; d).

For example, here is a binary predicate R on the set fa; b; c; dg 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.

  1. [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.

  1. [2 marks] Let R be a partial order predicate on a set D. R speci es 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:

9d 2 D; 8d0 2 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:

9d 2 D; 8d0 2 D; d = d0 _ :R(d; d0 )

Give an example of a partial order order R over fa; b; c; dg such that every element is maximal.

(c) [2 marks] Give an example of a partial order R over fa; b; c; dg such that a 2 D is maximal but a is not a greatest element. Justify your answer brie y.

Page 4/5

CSC165H1, Problem Set 1

  1. [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 de ne 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: 8x1 2 S; 8x2 2 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:

8y 2 T; 9x 2 S; f(x) = y

Let t 2 T . We say that f outputs t if there exists s 2 S such that f(s) = t.

  1. [1 mark] How many functions are there from f1; 2; 3g to fa; b; c; dg?

  1. [1 mark] How many one-to-one functions are there from f1; 2; 3g to fa; b; c; dg?

  1. [1 mark] How many onto functions are there from f1; 2; 3; 4g to fa; b; cg?

  1. [2 marks] Now let R be a binary predicate with domain N N. We say that R represents a function if, for every x 2 N, there exists a unique y 2 N, such that R(x; y) (is True). In this case, we write expressions like y = f(x).

De ne a predicate F unction(R), where R is a binary predicate with domain N N, that expresses the English statement:

\R represents a function.”

You may use the predicates <; ; =; R, but may not use any other predicate or function symbols.

In parts (e)-(h) below, you may use the predicate F unction(R) (in addition to the predicates <;

; =; R) in your solution, but may not use any other predicate or function symbols.

  1. [2 marks] De ne a predicate that expresses the following English statement.

\R represents an onto function.”

  1. [2 marks] De ne a predicate that expresses the following English statement. \R represents a one-to-one function.”

  1. [2 marks] De ne a predicate that expresses the following English statement. \R represents a function that outputs in nitely many elements of N.”

  1. [2 marks] Now de ne a predicate that expresses the following English statement. \R represents a function that outputs all but nitely many elements of N.”

Page 5/5