aboutsummaryrefslogtreecommitdiff
path: root/Logic.dcl
diff options
context:
space:
mode:
Diffstat (limited to 'Logic.dcl')
-rw-r--r--Logic.dcl23
1 files changed, 17 insertions, 6 deletions
diff --git a/Logic.dcl b/Logic.dcl
index 1a0821b..23ae191 100644
--- a/Logic.dcl
+++ b/Logic.dcl
@@ -23,7 +23,7 @@
*/
definition module Logic
-import StdEnv
+import StdEnv, StdMaybe
// Expressions
:: Expr = B Bool // A constant
@@ -47,6 +47,19 @@ import StdEnv
:: AtomOption :== (AtomName,Bool)
:: TruthTable = {exprs :: [Expr], options :: [[AtomOption]]}
+:: FilledTruthTable = {table :: TruthTable, values :: [[Maybe Bool]]}
+
+:: OutputOption = Plain | Html | LaTeX
+DefaultOutputOption :== Plain
+instance == OutputOption
+
+class show a :: OutputOption a -> String
+instance show Bool
+instance show Char
+instance show Op1
+instance show Op2
+instance show Expr
+instance show FilledTruthTable
isBool :: Expr -> Bool
isAtom :: Expr -> Bool
@@ -60,11 +73,6 @@ isOr :: Expr -> Bool
isImpl :: Expr -> Bool
isEquiv :: Expr -> Bool
-instance toString Op1
-instance toString Op2
-instance toString Expr
-instance toString TruthTable
-
instance == Op1
instance < Op1 // Maybe useful later if more unary operators are added
instance == Op2
@@ -87,6 +95,9 @@ sorted_subexprs :: (Expr -> [Expr]) // Similar, but roughly sorted by co
simple_truthtable :: Expr -> TruthTable // Simple truthtable: only the atomic expression and the expression itself
simple_truthtable_n :: [Expr] -> TruthTable // Simple truthtable with multiple expressions
truthtable :: Expr -> TruthTable // Truthtable from an expression
+truthtable_n :: [Expr] -> TruthTable // Truthtable with multiple expressions
+
+compute :: TruthTable -> FilledTruthTable // Fill in a truthtable
parse :: String -> Expr // Parse a string into an expression