Venn Diagram Explorer

The learner types set expressions (or taps regions) to shade events on a 1-3 event Venn diagram with a value in every disjoint region, compares two expressions (De Morgan, containment), adds inclusion-exclusion terms one at a time while each region shows how often it is counted (with Bonferroni bounds), fills regions from known probabilities, conditions on an event, and runs the independence product check; inconsistent values show up as negative, hatched regions.

Used in: Introduction to Probability Theory

Props

PropTypeDefaultDescription
titlestringfrom the mode, e.g. "Events on a Venn diagram"Title bar text.
eventsnumber | string[] | object["A", "B"]1 to 3 events: a count (letters A, B, C), a list of names (a letter optionally followed by letters/digits, e.g. "E", "H1"), or an object mapping each name to its list of outcomes (outcome mode, with omega).
omega(string | number)[]union of the listed outcomesOutcome mode: the sample space. Outcomes are written inside their regions and every event can be read as a set.
outcomeWeights"uniform" | number[] | object"uniform"Outcome mode: weights per outcome (a list in omega order or an object keyed by outcome), normalised to total 1 in probability units; counts units count outcomes.
atomsobjectA 0.30, A∩B 0.15, B 0.25, outside 0.30 (2 events)Value of each disjoint region. Keys: the letters of the events containing it ("A" = only A, "AB", "ABC"), or any expression of a single region ("A ∩ B^c"); "rest" = outside every event (default: whatever makes the total 1).
knownobjectnoneKnown event values keyed by set expression, e.g. {"P(A)": 0.5, "P(B)": 0.4, "P(A ∩ B)": 0.2} or counts {"|A|": 50, "|Ω|": 100}. The region values are solved from them (free regions keep their defaults); a negative solution is flagged as an invalid assignment.
unitsstring"probability""probability" (P(·), regions sum to 1) or "counts" (|·|, whole numbers).
layoutstring"overlap"Two events only: "overlap", "disjoint" (A ∩ B is empty) or "subset" (the first event drawn inside the second).
layoutSwitchbooleanfalseTwo events: let the learner switch the drawing between overlapping, disjoint and nested.
inputsstring"events" with known, "none" in outcome mode or without values, else "atoms"Sliders: "atoms" (one per region; the outside takes the remainder), "events" (P(A), P(B), P(A ∩ B), ...; regions recomputed and may go negative) or "none".
modestring"shade""shade": shade typed or tapped events; "inclusion-exclusion": add the terms of P(A ∪ B ∪ ...) one at a time with a per-region count.
modeSwitchbooleantrueShow the Shade / Add terms switch in the title bar (2 or 3 events).
targetstring"A ∪ B" ("" with challenges)Expression shaded first. Syntax: ∪ | or, ∩ & and, A^c A' not A, A ∖ B (or A - B), Ω, ∅, brackets; TeX (\cup, \cap, ^{c}) also works.
comparestringnoneSecond expression, drawn on a second diagram; the verdict says equal, contained (with P(E) ≤ P(F)) or different, listing the regions that differ.
editablebooleantrueShow the expression boxes and symbol buttons and let taps on regions edit the event.
givenstringnoneConditioning event (expression). Adds a 'Condition on ...' switch: outside fades, values inside are rescaled, and P(target | given) is shown next to P(target).
conditionedbooleanfalseStart with the condition switched on (needs given).
showProductCheckbooleanfalseShow P(A ∩ B) against P(A)P(B) for every pair (and the triple for 3 events) with an independent / pairwise / mutually independent verdict.
showBoundsbooleanfalseInclusion-exclusion mode: plot the Bonferroni partial sums (order 1 = union bound) against the union, alternating above and below.
fillStepsbooleanfalseShade mode: hide the region values and let the learner fill them innermost first (Venn diagram method), each as a known value minus the regions already filled inside it.
stepnumber0Initial step: terms already added (inclusion-exclusion) or regions already filled (fillSteps).
challenges{prompt, answer}[]noneExercises: the prompt (text with $...$ TeX) describes an event in words; the learner types or taps it and checks; the answer is any equivalent expression.
showValuesbooleantruefalse hides every number (pure set algebra): no region values, sliders or probability readouts.
digitsnumber2Decimals for probabilities (0 to 4).
sliderStepnumber0.01 (1 for counts)Slider step.
controlsstring[]all controls shownIds of the hideable controls and text to show (see the controls registry: toggle.mode, readout.validity, readout.monotonicity). Core controls always show. Absent = everything. Fitted per page by tooling (component_scopes.py fit-nodes), not by hand.