# statement logic !!! things you can do with this: ### general things - parse string -> statement - parse L (the formal language) string -> statement - serialize a statement to plaintext, LaTeX, L (the formal language) ### semantic things (statements have meaning I guess) - evaluate statements - from a statement generate a LaTeX truth table - match/replace patterns in statements (e.g. logical laws) - verify logical-law equivalence of statements (TODO) - find logical-law equivalence of statements with breadth-first search ### syntactic things (statements are strings of symbols) - implement formal languages (symbols, axioms schemas, and inference rules): - verify derivations in formal languages ### formal languages implemented - the MIU system (from "Gödel, Escher, Bach") - L ## requirements a haskell compiler e.g. GHC ## compile it ```sh make ``` or look in `Makefile` ## usage only this has been implemented in the main function: ```sh echo '((p->q)<->(!q->!p))' | ./logic ``` ### output ``` Iff (Implies (Atom "p") (Atom "q")) (Implies (Not (Atom "q")) (Not (Atom "p"))) Tautology \begin{tabular}{cc||cccccc|c|cccccccc} $p$ & $q$ & $($ & $($ & $p$ & $\to $ & $q$ & $)$ & $\leftrightarrow $ & $($ & $\neg $ & $q$ & $\to $ & $\neg $ & $p$ & $)$ & $)$ \\ \hline 0 & 0 & & & 0 & 1 & 0 & & \textbf 1 & & 1 & 0 & 1 & 1 & 0 & & \\ 0 & 1 & & & 1 & 0 & 0 & & \textbf 1 & & 1 & 0 & 0 & 0 & 1 & & \\ 1 & 0 & & & 0 & 1 & 1 & & \textbf 1 & & 0 & 1 & 1 & 1 & 0 & & \\ 1 & 1 & & & 1 & 1 & 1 & & \textbf 1 & & 0 & 1 & 1 & 0 & 1 & & \\ \end{tabular} ```