Logic and Discrete Structures

The logic, proof and discrete structures behind computing: why proof matters when testing cannot cover every input, propositional logic and truth tables, logical equivalence, normal forms and satisfiability, predicate logic and nested quantifiers, direct, contrapositive, contradiction, cases and existence proofs, sets, power sets and inclusion–exclusion, functions, the pigeonhole principle and countability with Cantor's diagonal argument, relations, equivalence classes, partial orders and Warshall's algorithm, ordinary, strong and structural induction with recursion, counting and modular arithmetic with a toy RSA example, and a capstone on loop invariants, Hoare triples and graphs, with Python used to explore every idea.

CMPUT-272 Year 2 3 credits 12 lessons · 6 h 27 min

Offered by HSM University · Computing Science

What you'll learn

  • Explain why proof, not testing alone, establishes facts about all inputs, read mathematical definitions, theorems and conjectures, and use Python to explore small cases and find counterexamples before attempting a proof.
  • Identify propositions, evaluate compound propositions with the connectives and truth tables, interpret the conditional correctly including vacuous truth and only if, and distinguish a conditional from its converse, inverse and contrapositive.
  • Prove and apply logical equivalences including De Morgan's laws, convert formulas to conjunctive and disjunctive normal form, solve small satisfiability problems by brute force, and recognize valid rules of inference and common fallacies.
  • Translate English statements and specifications into predicate logic with correct domains, restricted quantifiers and nested quantifiers, and negate quantified statements to describe counterexamples.
  • Write direct proofs and proofs by contrapositive about integers and divisibility, prove biconditionals in both directions, disprove universal claims with counterexamples, and present proofs clearly in complete sentences.
  • Write proofs by contradiction, including the irrationality of the square root of 2 and the infinitude of primes, proofs by cases and exhaustion, and constructive and non-constructive existence and uniqueness proofs.
  • Describe sets in roster and set-builder notation, apply union, intersection, difference, complement, power sets and Cartesian products, prove set identities by double inclusion, and count with inclusion–exclusion.
  • Classify functions as injective, surjective or bijective, compose and invert functions, apply the pigeonhole principle, and compare cardinalities of infinite sets using bijections and Cantor's diagonal argument.
  • Determine whether relations are reflexive, symmetric, antisymmetric or transitive, work with equivalence classes and partitions, draw Hasse diagrams of partial orders, topologically sort, and compute transitive closures with Warshall's algorithm.
  • Prove statements by ordinary, strong and structural induction, write and reason about recursive definitions, and prove recursive functions correct and terminating.
  • Count arrangements and selections with the sum and product rules, permutations, combinations and the binomial theorem, and apply divisibility, Euclid's algorithm, modular arithmetic and modular inverses, including a toy RSA example.
  • Specify code with preconditions, postconditions and Hoare triples, prove loops correct with invariants and progress measures, and model problems as graphs using degrees, paths, trees and Euler paths.

Course content

12 lessons · 6 h 27 min total · final exam

  1. 1 Why logic and proof matter in computing 28 min · quiz
  2. 2 Propositional logic 31 min · quiz
  3. 3 Logical equivalence, normal forms and satisfiability 33 min · quiz
  4. 4 Predicate logic and quantifiers 32 min · quiz
  5. 5 Proof techniques I: direct proof and contrapositive 36 min · quiz
  6. 6 Proof techniques II: contradiction, cases and existence 35 min · quiz
  7. 7 Sets and set operations 27 min · quiz
  8. 8 Functions and cardinality 32 min · quiz
  9. 9 Relations, equivalence and partial orders 30 min · quiz
  10. 10 Mathematical induction and recursion 42 min · quiz
  11. 11 Counting and number theory for computing 29 min · quiz
  12. 12 Capstone: proving programs correct and an introduction to graphs 32 min · quiz
  13. E Final exam 20 questions

Requirements

Recommended background. You can start any course at any time.

Description

The logic, proof and discrete structures behind computing: why proof matters when testing cannot cover every input, propositional logic and truth tables, logical equivalence, normal forms and satisfiability, predicate logic and nested quantifiers, direct, contrapositive, contradiction, cases and existence proofs, sets, power sets and inclusion–exclusion, functions, the pigeonhole principle and countability with Cantor's diagonal argument, relations, equivalence classes, partial orders and Warshall's algorithm, ordinary, strong and structural induction with recursion, counting and modular arithmetic with a toy RSA example, and a capstone on loop invariants, Hoare triples and graphs, with Python used to explore every idea.

Part of the Science stream, typically taken in year 2.