Laboratory Work 4 — Advanced Propositional Logic and Computational Logic
Fourth laboratory work of Computer Discrete Mathematics. You implement a propositional-logic expression evaluator — computing the truth value of a formula under a given assignment — and an automated truth-table generator for formulas built from
AND,OR, andNOT.
At a glance
| Topic | Propositional logic: connectives, expression evaluation, truth tables |
| Prerequisite lectures | L04 — Boolean algebra (basics), L06 — Propositional logic |
| Deliverable | Source code + report (see 5report.md) |
| Structure | Two tasks: expression evaluation and truth-table generation (see 4task.md) |
Contents
| # | Part | File |
|---|---|---|
| 1 | Objective | 1purpose.md |
| 2 | Methodical guidelines (theory & algorithms) | 2method.md |
| 4 | Task and order of execution | 4task.md |
| 5 | Report contents | 5report.md |
| 6 | Control questions | 6questions.md |
Conventions
- Language — source code and the report are in English.
- Implement it yourself — no built-in shortcuts. Do not call a library or
built-in that performs the core task for you (e.g. no
HashSet/set()/Setfor sets, no library graph/relation type, nomath.gcd, noeval). Build the mechanism from basic primitives — arrays/lists, loops, arithmetic, strings. - Deliverable — submit the source code and a report structured as in 5report.md; the code must reproduce the example outputs in 4task.md.
- Self-contained theory — everything needed is in 2method.md; no external material is required.
Summary
A proposition is a statement that is either true or false, and the
connectives NOT, AND, and OR combine propositions into compound formulas.
Two questions drive this work: what is the value of a formula under a specific
assignment of truth values to its variables (evaluation), and what are its
values under all possible assignments (its truth table). Implementing both
requires parsing an expression with the correct operator precedence and
enumerating the assignments of its variables — the computational core
that underlies circuits, SAT solving, and the rest of logic in the course.