A logic toolkit

The problem

Build a small program that reads a logical formula and tells you everything about it: its truth table, whether it is a tautology, a contradiction or a contingency, and whether it is equivalent to a second formula.

Requirements

Technologies

Step by step

  1. Write a function that lists every row of values for the letters in a formula.
  2. Evaluate the formula on each row and print the table.
  3. Use all() and any() on the column of results to classify the formula.
  4. Add the equivalence check, then test it on De Morgan's laws and on the converse of an implication.

Expected result

A command-line tool that prints truth tables, classifies formulas and proves or refutes equivalences, tested on the standard laws of logic.

How it is evaluated

Ways to improve it