Discrete Math for Data Science

DSCI 220, 2025 W1

September 17, 2025

Announcements

Reasoning

Design a Trap

Your mission:
- Write one valid two-premise argument (any rule).
- Write a look-alike fallacy with the same topic words.
- Bring to class on Wednesday morning!

Make proofs executable

  • Yesterday: valid arguments as legal inference
  • Today: address facts ⇒ conclusion algorithmically
  • Method: Refutation + Unit propagation
  • Big picture: SAT/SMT ideas used in verification, chip design, planning
  • Why now? Logic provides clean specification layer even in a probabilistic world

Vocabulary

  • Statement: something that is either true or false.
  • Fact: a statement we already know is true (we’ll draw it as a single-item parenthesis like \((A)\)).
  • Rule: “if these are true, then that is true.” Example: “If A and B, then E.”
  • clause (OR-group): a group joined by “OR”, like \((\neg A \lor \neg B \lor E)\).
  • CNF (AND of clauses): several OR-groups joined by “AND”.
  • Unit clause: a clause with just one item, like \((A)\) or \((\neg D)\).
  • Unit propagation: if you know \((X)\) is true and you also have \((\neg X \lor Y)\), you may drop \(\neg X\) and keep \(Y\). Now \(Y\) must be true!

Explore UBC

Variable Definitions

  • \(A\): Clock Tower is lit up
  • \(B\): Nest is alight
  • \(C\): Koerner Library is illuminated
  • \(E\): ICCS doors are unlocked
  • \(F\): the Gallery is open
  • \(D\): Main Mall is hopping!

Rulebook

  1. \((A\lor B\lor C)\) — At least one of the three landmarks is lit tonight.
  2. \(A\to E\) — If Clock Tower is lit then ICCS is unlocked.
  3. \(C\to E\) — If Koerner is lit then ICCS is unlocked.
  4. \((B\lor F)\) — Either the Nest is lit, or the Gallery opens.
  5. \((E\land F)\to D\) — If ICCS unlocked and Gal opens then Mall hops.
  6. \(B\to D\) — If the Nest is lit then Mall hops.

Goal: Does \(D\) follow from the rulebook?

A Smaller Example

Variable Definitions

  • \(A\): Lions Gate Bridge is illuminated
  • \(B\): Science World dome is lit up
  • \(D\): The Canucks are playing at Rogers Arena

Rulebook

  1. \((A\lor B)\) — At least one city landmark is lit tonight.
  2. \(A\to D\) — If Lions Gate is lit, the Canucks are at Rogers.
  3. \(B\to D\) — If the dome is lit, the Canucks are at Rogers.

Goal: Does \(D\) follow from the rulebook?

Making a plan

Three ways of thinking about the inference:

  • Apply sequences of rules to conclude \(D\).

  • Show \(((A\lor B)\land (A\to D)\land (B\to D)) \to D\) is a Tautology

  • Show \(\neg (((A\lor B)\land (A\to D)\land (B\to D)) \to D)\) is a Contradiction

Believe it or not, we’re going to do the last one!!

Reframing the goal

\[\neg (((A\lor B)\land (A\to D)\land (B\to D)) \to D)\]


 


Conjunctive Normal Form: ____________

Resolve Away!

\(\{\neg D\}\)

\(\{A, B\}\)

\(\{D, \neg A\}\)

\(\{D, \neg B\}\)

Main Mall Midnight

Setup

  1. Lay out the rule cards face up.
  2. Put the refutation card \((\neg D)\) in a small Unit inbox.
  3. Make three spots: Clauses (the rule cards), Unit inbox, Finished units.
  4. Assign roles: Reader, Marker, Checker, Scribe.

Roles

  • Reader: says the current unit aloud (start with \((\neg D)\)).
  • Marker: crosses out literals; rewrites reduced clauses.
  • Checker: watches for new units and clash.
  • Scribe: records the sequence of units forced (e.g., \(\neg D \Rightarrow \neg B \Rightarrow \cdots\)).

Gameplay loop (repeat)

  1. Pick the next unit \((u)\) from the inbox (start with \((\neg D)\)).
  2. Sweep every clause once (one round):
    • If the clause contains \(u\): it’s satisfied, remove that card.
    • If the clause contains \(\neg u\): cross out \(\neg u\).
      • If nothing remains, \(\bot\) (CLASH) → you win.
      • If one literal remains \((v)\), place it in the Unit inbox.
      • If 2+ literals remain, keep the reduced clause on the table.
    • If it mentions neither \(u\) nor \(\neg u\): leave it as is.
  3. After the sweep, move \(u\) to Finished units. Go back to step 1.

Win condition: You produce \(\bot\) (empty clause) or you later pick a unit that contradicts a finished one (e.g., you pick \((B)\) but Finished already has \((\neg B)\)).

If stuck: The Unit inbox is empty and no clause is a single literal → raise your hand (forward chaining has stalled).

Scribe line (to turn in): \(\neg D \Rightarrow \ldots \Rightarrow \bot\) (list units in the order you derived them).

today’s python

Does this always work?

Works great for: rulebooks where each clause has only 1 positive unit (Horn)

Can stall on: non-Horn, symmetric choice, more complex domains.

Stall example (unsatisfiable, no units): \[ (A\vee B)\wedge(A\vee \neg B)\wedge(\neg A\vee B)\wedge(\neg A\vee \neg B) \]

  • No unit clauses → our method can’t start.
  • It’s actually unsatisfiable but needs a branch to detect. (try (A) or (A)).

Takeaway: Propagation finds what’s locally forced.
When nothing is locally forced, we need case splits or stronger rules.