Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

KIT103 Assignment 2: Boolean Algebra and Conditional Program Logic

This assignment further develops and assesses your skills working with Boolean algebra and in implementing conditional logic in Python. Questions 1–3 (and 8a) are most easily r handwritten (either on paper or using a stylus on a touchscreen), but you can use LATEX or an equation editor in Word/Pages if you would like. The remaining questions are done in 口 source code.

To prepare for the later questions download the Python script kit103_a2_logic.py and put your name and student ID at the indicated places in the large comment at the top, and also record your student ID as a string in the script.

Submit your digitised maths answers and completed Python script ile to the A2: BooleanAlgebra and Conditional Program Logic assignment folder on MyLO by 2355 (11:55pm) Friday 26 August 2022.

A Two of the questions are customised based on your student ID number. To see those questions you need to enter your student ID (including any leading zero) into the text ield below and press Update.

Student ID:

In your Python script: You will also need to record your student ID in the Python script so that we can test your solutions correctly. In the script look for:

sid = '000000'

and replace the 6 zeroes in the string with your student ID.

All questions are worth 2 marks except for Question 5, which is worth 1 as it is based on progress made earlier.

r Question 1: Mapping natural language to formal language (ILO 4)

Give an example sentence in English, about an everyday topic, that has the form: P Q R  ⟹  S

a. State the whole sentence irst,

b. then deine each part (P, Q, R, S) separately.

r Question 2: Truth tables and logical equivalences (ILO 4)

a. Using a truth table, show that P Q  ⟹  R≡ (P Q R). Show all required (intermediate) columns and justify your conclusion using words.

b. Using appropriate logical equivalences, show that

P Q  ⟹  R≡ (P Q R)

by starting with

P Q  ⟹  R

and then transforming this appropriately, stating the name of the logical equivalence being applied at each step (where applicable). Use one logical equivalence per step.

r Question 3: Simplifying Boolean expressions (ILO 4)

Questions 3–5 are linked. This one is most easily done on paper, the next two are done in the Python script.

Write each of the following Boolean expressions more simply by applying the rules of Boolean algebra (consult the Logical Equivalences under Study > For Reference or use a truth table to observe patterns in their results). For each simpliied expression, briely summarise what                   transformation(s) you performed and why.

a. (a ∨ b ∨ c )′′′ ∧ d

b. (a ∨ b) ∧ (b ∨ c)

c. a a

d. (a b) ∧ (a∨ b)

o Tip: You have been provided with a useful function in one of the tutorials to use while testing your solutions to Questions 3–5.

Question 4: Direct translation into Python (ILOs 1 & 2)

There are stub (i.e., incomplete) implementations of each of the Boolean expressions from the previous question (named q4_a through q4_d). Replace None in each of these stub functions with the Python code for that Boolean expression as it was originally written (do not apply any      simpliications yet). The functions already have the required parameters listed. All parameters are Boolean.

Question 5: Translating the simpliied expressions (ILOs 1 & 2)

Next, translate your simpliied Boolean expressions from Question 3 into code by completing the implementation of the stub functions named q5_a through q5_d in the script ile.

Question 6: Bitsets (ILOs 1 & 2)

The following question is answered within the Python script, with all answers being stored in a small dictionary of responses. If you would like to add an explanation for an answer then include a short #one-line comment next to or above it.

To view the rest of this question you must enter your student ID above.

Question 7: Franks Furniture Fixtures (ILO 1)

Frank’s Furniture Fixtures manufactures a variety of ittings for assembling furniture, and operate at a number of locations around the country (Frank has long since stopped being involved in making anything and instead spends his time counting money). As part of their quality assurance processes staff test each bolt that they manufacture to determine if they should pass it, reject it, or sell it to a company willing to accept inferior products.

They company has tasked you with writing a function that can determine what to do with each bolt produced. The function has three parameters: the bolt’s tensile strength in megapascals (MPa), its diameter variation across its length in micrometres (μm)—since no manufacturing process is  perfect—and whether or not there is an Amart Furniture nearby. It can return three possible string messages: ‘Pass’ if the bolt is of acceptable       quality; Sell to Amart’ if it doesn’t meet all quality criteria but is still good enough for lat pack furniture; and Reject’ if it isn’t of suficiently high   quality and can’t be given to Amart Furniture.


To view the rest of this question you must enter your student ID above.

r /Question 8: A Letter Detector (ILOs 1 & 4)

The Yeah Nah Logic Company has a simple object recognition system that can identify when a particular arrangement of curves represents a        letter (not which letter, only that it is one of a proper subset of letters). They have a camera that can detect curves similar to opening and closing parentheses ( ) in the upper and lower parts of an image. Although the image may be hand-drawn, their detector sees’ it as if it were like part of a

segmented display, like this:

a  ( ) b

c  ( ) d

To determine if the arrangement of curves looks like a letter they use the following truth table (for convenience the truth table is presented using 0 for False and 1 for True, but the function accepts four Boolean variables a–d and returns a Boolean value). The Letter column is only for               information; the function will not attempt to actually identify the letter.