Exercise 3: Mapping Real Code Artifacts to Discrete Math Topics — Possible Solution ==================================================================== (a) A PYTHON set USED TO REMOVE DUPLICATES — SETS (CHAPTER 4) ------------------------------ Per this chapter's own table, "Python's set, JavaScript's Set, SQL's DISTINCT and UNION" are listed directly as implementations of set operations. Removing duplicate values from a list by converting it to a set relies specifically on the defining property of a mathematical set: it contains no repeated elements. Passing a list with duplicates into a Python set and getting each unique value back exactly once is that same property, expressed in code rather than in mathematical notation. (b) A SQL TABLE WITH A UNIQUE CONSTRAINT ON AN EMAIL COLUMN — RELATIONS (CHAPTER 5) ------------------------------ Per this chapter, "a database table is a relation in the mathematical sense." A UNIQUE constraint enforces a specific property on that relation - that no two rows share the same value in that column, which is closely related to the properties (like being a valid key) that Chapter 5's own material on relations covers directly. The constraint is a database mechanism for enforcing exactly the kind of structural property discrete math gives a formal vocabulary for describing. (c) AN if STATEMENT WITH THREE CHAINED and/or CONDITIONS — PROPOSITIONAL LOGIC (CHAPTER 2) ------------------------------ Per this chapter, "every if statement, every boolean expression ... all of it is propositional logic wearing different syntax." Each individual condition in the chain is a proposition (something that's either true or false), and and/or are exactly the logical connectives Chapter 2 covers directly - the same connectives used to build truth tables. A chained condition like this is a compound proposition, whether or not the code was ever written with that vocabulary in mind. WHY THIS WORKS AS AN ANSWER ------------------------------ Each mapping is justified by directly quoting the specific line from this chapter's own connections table that names the artifact in question, then explaining in concrete terms why the code's actual behavior matches the mathematical property being invoked - not just asserting a connection, but showing what specifically makes it true.