aboutsummaryrefslogtreecommitdiff
path: root/Logic.icl
diff options
context:
space:
mode:
Diffstat (limited to 'Logic.icl')
-rw-r--r--Logic.icl10
1 files changed, 5 insertions, 5 deletions
diff --git a/Logic.icl b/Logic.icl
index 87368dc..bd87bf0 100644
--- a/Logic.icl
+++ b/Logic.icl
@@ -224,9 +224,12 @@ all_atoms (Atom a) = [a]
all_atoms (B _) = []
all_atoms (App1 _ e) = all_atoms e
all_atoms (App2 e1 _ e2) = removeDup (all_atoms e1 ++ all_atoms e2)
+
+removeSubOptions :: [[AtomOption]] -> [[AtomOption]]
+removeSubOptions opts = filter (\this -> not (any (\that -> all (flip isMember that) this) (removeMember this opts))) opts
all_atom_options :: Expr -> [[AtomOption]]
-all_atom_options e = removeDup [opt \\ opt <- all_opts (sort (all_atoms e)) []]
+all_atom_options e = removeSubOptions [opt \\ opt <- all_opts (sort (all_atoms e)) []]
where
all_opts :: [AtomName] [AtomOption] -> [[AtomOption]]
all_opts [] opts = [opts]
@@ -263,16 +266,13 @@ simple_truthtable :: Expr -> TruthTable
simple_truthtable e = {exprs = [Atom a \\ a <- all_atoms e] ++ [e], options = all_atom_options e}
simple_truthtable_n :: [Expr] -> TruthTable // Simple truthtable with multiple expressions
-simple_truthtable_n es = {exprs = removeDup ([Atom a \\ a <- flatten (map all_atoms es)] ++ es), options = removeDup (flatten (map all_atom_options es))}
+simple_truthtable_n es = {exprs = removeDup ([Atom a \\ a <- flatten (map all_atoms es)] ++ es), options = removeSubOptions (flatten (map all_atom_options es))}
truthtable :: Expr -> TruthTable
truthtable e = {exprs = sorted_subexprs e ++ [e], options = all_atom_options e}
truthtable_n :: [Expr] -> TruthTable
truthtable_n es = {exprs = sort (removeDup (flatten ([[e:subexprs e] \\ e <- es]))), options = removeSubOptions (flatten (map all_atom_options es))}
-where
- removeSubOptions :: [[AtomOption]] -> [[AtomOption]]
- removeSubOptions opts = filter (\this -> not (any (\that -> all (flip isMember that) this) (removeMember this opts))) opts
compute :: TruthTable -> FilledTruthTable // Fill in a truthtable
compute table=:{exprs,options} = {table=table, values=values}