Coding· RHomeworkPredict, observe, explainRecall with feedbackBefore teaching✓ Code checkedAccessibility not checkedPublished

Truth in R

By Alexis Diamond · Philosophy · Logic and argumentation · Undergraduate · Formal mathematics · version 8

CS350 Lesson 3: a nine-cell R workbook for an introductory deductive-logic session. Students write OR, AND and NOT in R, see how parentheses change the order R works out a sentence, build the conditional from the connectives R provides, then build truth tables with expand.grid and test De Morgan's law, asking what == over a whole table establishes that == at a single row cannot.

Licence: CC BY 4.0

Share and present
Assumption ledger (5)
  • simplificationSentences are atomic and two-valued: P, Q and S are each a single TRUE or FALSE (no NA).
  • interpretationR's &, | and ! stand for AND, OR and NOT; R has no conditional operator, so P → Q is built as !P | Q. P <= Q gives the same values only through arithmetic on 0 and 1, and the page warns against it.
  • interpretationLogical equivalence is checked by comparing two expressions with == on every row of a truth table built with expand.grid; == at a single assignment shows agreement on that row only.
  • parameterCell 1 sets P <- TRUE, Q <- FALSE, S <- TRUE. With these values both expressions in cell 5 are FALSE; the page has students set Q <- TRUE to see them differ, then rerun cell 1.
  • simplificationLeft out on purpose: R's short-circuit && and ||, NA in logical operations, and formal proof.
Checks Breakout ✓ · Code ✓ · Accessibility ✓

Breakout check

✓ Ready for breakouts: every control we tried showed teammates the same thing.

Code checks

✓ Code checked: the reference solutions pass every exercise's checks.

Cite this · History

Cite this

Alexis Diamond (2026). Truth in R [Interactive model], version 8. Ideas at Play. https://ideasatplay.org/play/truth-in-r-b317c2?v=8 (CC BY 4.0)

History

  1. v8Homework-ready: lists every question (items) and keeps answers beside the page, released to homework copies only after the professor's answer date. (edited, Oct 31, 2026)current
  2. v7Course label: CS350 Lesson 3 (edited, Oct 31, 2026)View
  3. v6Cell 9: one sentence per line. (edited, Oct 31, 2026)View
  4. v5Cell 7: the given code is labelled as a worked example for !(P | Q); students run it, then build tt3 for !(P | Q) & S below it. (edited, Oct 31, 2026)View
  5. v4Cell 7: taller code and output boxes so both truth tables show without scrolling. (edited, Oct 31, 2026)View
  6. v3A checked multiple-choice question about proper code at the end of each of the four sections. (edited, Oct 31, 2026)View
  7. v2Cell 5: precedence defined; instruction to add Q <- TRUE set apart; reminder in cell 6 to put Q back to FALSE. (edited, Oct 31, 2026)View
  8. v1Imported; lineage before import is not available. (imported, Oct 31, 2026)View
Report this artifact

Reports are anonymous. The artifact stays up until we've checked it.

Comments

No comments yet.

Sign in to comment or like.

Anything wrong with this page? Submit feedback