Skip to content

Repository files navigation

Disc‑Math

MA22301 · Discrete Mathematics · Unit I

A propositional calculus lab — parse a formula once, read it through five lenses.


What this is

Disc-Math is a teaching tool built by Omega Mu Gamma Studio for MA22301, Unit I: propositions and notation, truth tables, propositional equivalence, conditional forms, normal forms, and the theory of inference.

Type a formula once. Every panel — Truth Table, Equivalence, Conditional Forms, Normal Forms, Theory of Inference — reads off the same parsed AST, so the tool never disagrees with itself across tabs.

Features

  • Dual notation, equal priority. ASCII (~ & | -> <-> xor) and Unicode (¬ ∧ ∨ → ↔ ⊕) are parsed identically — mix them in the same formula if you want.
  • Truth Table — full evaluation over every variable assignment.
  • Equivalence — check whether two formulas agree on every row.
  • Conditional Forms — converse, contrapositive, and inverse, generated automatically from formulas.
  • Normal Forms — CNF / DNF derivation.
  • Theory of Inference — validity checking via truth table, plus pattern-matching against a small library of named rules (Modus Ponens, Modus Tollens, Hypothetical Syllogism, Disjunctive Syllogism, Simplification, Addition, Conjunction). A miss on the named-rule library doesn't mean invalid — it means no named pattern matched; validity itself is always decided by the truth table.
  • Three lab themes — Neon Night, Synthwave, Matrix. Same CSS-variable architecture as the rest of the studio suite.

Run locally

npm install
npm run dev

Open the printed local URL (defaults to http://localhost:5173).

Build

npm run build
npm run preview

Formula syntax

Meaning ASCII Unicode
NOT ~ ! ¬
AND &
OR |
XOR xor
IMPLIES ->
IFF <->

Precedence (tightest first): NOT > AND > OR/XOR > IMPLIES > IFF. Parentheses override everything.

Under the hood

src/engine/          framework-agnostic propositional logic core
  tokenizer.ts        raw string to tokens
  parser.ts           tokens to AST
  evaluator.ts        AST to truth value under an assignment
  truthTable.ts        full truth table generation
  classifier.ts         tautology / contradiction / contingency
  conditionalForms.ts  converse / contrapositive / inverse
  normalForms.ts       CNF / DNF derivation
  formatter.ts         AST to display string, AST equality
  inference/
    ruleLibrary.ts      named-rule pattern matching
    validity.ts         truth-table validity check

src/components/
  panels/              the five result panels, thin views over the engine
  formula-input.tsx    formula field, live symbol palette, live parse feedback
  theme-switcher.tsx   Neon Night / Synthwave / Matrix
  global-symbol-toolbar.tsx

src/index.css          CSS-variable theme architecture, Space Grotesk + JetBrains Mono

No React import ever reaches into src/engine/ — every panel is a display layer over what the engine already computed. If a bug lives in "the math," it lives in src/engine/, not in a component.

What's left open

  • Natural deduction proof builder
  • Predicate logic (quantifiers ∀ ∃)
  • Additional inference rules (Constructive/Destructive Dilemma, etc.)
  • Formula history / shareable URL state

Credits

More from Omega Mu Gamma Studio

Disc-Math is one app in a wider suite of course-linked educational tools:

  • GateLab — sci-fi digital logic game, framed as intergalactic spaceship maintenance
  • SeeDS — data-structures RPG with a campus/Academy shell and passport progression system
  • KMapX — Karnaugh map tool with full don't-care support and a Quine-McCluskey engine
  • BlockBeats — drag-and-drop music theory app
  • The Chan suite — per-language programming tutors: Go-Chan, Kotlin-Chan, Python-Chan, Java-Chan, Rust-Chan

© 2026 Omega Mu Gamma Studio

Releases

Packages

Contributors

Languages