discrete-math-lab logic · sets · relations · arithmetic · computation

1. Truth tables & classification

Type a propositional formula in variables p q r s. Operators: ~ & | -> <-> ^ (not, and, or, implies, iff, xor). The table is built row by row and the formula is classed as tautology, contradiction or contingency.

variables
rows true
class

2. Predicates & quantifiers

A domain of integers and a predicate $P(x)$. See where $\forall x\,P(x)$ and $\exists x\,P(x)$ hold, and how negation flips the quantifier: $\neg\forall x\,P(x)\equiv\exists x\,\neg P(x)$.

$\forall x\,P(x)$
$\exists x\,P(x)$
$\exists! x\,P(x)$

3. Set algebra — three-set Venn

Click regions to toggle them into your set. The matching expression in $A,B,C$ and the cardinality update live. Universe is the 1..30 integers split across the three circles.

expression
|result|0

Regions are the 7 disjoint pieces of the Venn diagram plus the outside.

4. Functions — injective, surjective, bijective

Each domain element maps to one codomain element. Click a domain node, then a codomain node to rewire it. The classification updates from the current mapping.

injective (1-1)
surjective (onto)
bijective

5. Relations — properties & closures

Toggle cells of the relation matrix on $\{1..n\}$. Properties are checked live. Show the reflexive / symmetric / transitive closure as faint added cells.

reflexive
symmetric
antisymmetric
transitive
kind

6. Graphs — Euler & Hamilton paths

Click empty space to add a vertex; click two vertices to toggle an edge. Degrees, connectivity and the existence of Euler / Hamilton paths are detected live.

vertices · edges0 · 0
odd-degree
Euler
Hamilton path

7. Modular arithmetic

A clock with $n$ positions. Step by $+a$ to walk the residues, read the operation tables, and run the Euclidean algorithm for $\gcd$.

gcd

8. Integer representation

A value shown as bits. Read it in binary, octal and hex, and toggle two's-complement to see how negatives are encoded in a fixed width.

binary
octal
hex

9. Finite-state machine

A deterministic automaton over the alphabet $\{0,1\}$. Type an input string and step through it; the current state is highlighted and the string is accepted iff it ends in a final state.

state
read
accepted