Coding· RWhole classBreakoutsHomeworkPredict, observe, explainRecall with feedbackBefore teaching✓ Code checkedAccessibility checks passPublished
Exclusive or in R
By Alexis Diamond · Philosophy · Logic and argumentation · Undergraduate · Formal mathematics · version 4
Stands on its own; differs from Truth in R: A short workbook on exclusive or (XOR) alone, not the full nine-cell Truth in R lesson.
Remixed from Truth in R by Alexis Diamond
Three short R exercises on one connective, exclusive or: predict what xor(P, Q) gives in each row of a truth table, build XOR from AND, OR and NOT, then find the row where inclusive OR and XOR disagree.
Licence: CC BY 4.0
Assumption ledger (5)
- simplificationP and Q are atomic, two-valued sentences: each is a single TRUE or FALSE, with no NA.
- interpretationxor(P, Q) is TRUE exactly when P and Q have different truth values. It is built from the basic connectives as (P | Q) & !(P & Q).
- interpretationThe inclusive/exclusive contrast is drawn between R's | and xor(); how English 'or' behaves is not argued here.
- dataNo data: tt is the four-row grid from expand.grid, built in the read-only setup cell. Rows run (TRUE,TRUE), (FALSE,TRUE), (TRUE,FALSE), (FALSE,FALSE).
- simplificationLeft out on purpose: XOR of three or more sentences, the conditional, equivalence testing, NA handling and formal proof.
Checks Breakout ✓ · Code ✓ · Built-in ✓ · 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.
Built-in checks 4 of 4 pass
- (P | Q) & !(P & Q) equals xor(P, Q) in every row (passes)
- P | Q and xor(P, Q) differ in exactly one row, the one where both are TRUE (passes)
- xor is symmetric: xor(P, Q) = xor(Q, P) (passes)
- The four code cells and their checks are present and well formed (passes)
Cite this · History
Cite this
Alexis Diamond (2026). Exclusive or in R [Interactive model], version 4. Ideas at Play. https://ideasatplay.org/play/truth-in-r-remix-cab3ab?v=4 (CC BY 4.0). Remix of “Truth in R” by Alexis Diamond (https://ideasatplay.org/artifacts/truth-in-r-b317c2).
History
- v4Code output boxes are now larger (taller, scrolling) and every exercise with an NA placeholder (1, 2 and 3) now tells the student explicitly to replace NA. (generated, Oct 31, 2026)current
- v3Exercise 1 now has numbered coding instructions, tt is shown as a table with a new explore cell, and that cell demonstrates selecting rows and columns from tt. (generated, Oct 31, 2026)View
- v2Scope cut to XOR alone: three short R cells and an exit question replace the nine-cell workbook and its multiple-choice questions, and the old prediction state keys were replaced by pred1 and response_exit. (generated, Oct 31, 2026)View
- v1Remixed from version 8 of "Truth in R". (remixed, Oct 31, 2026)View
Comments
No comments yet.
Sign in to comment or like.