From 9373cac4ca120dfebba2d98b4bd216d471e1ee92 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 1 Aug 2016 09:43:40 +0200 Subject: Really fix #1 --- Logic.icl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Logic.icl') 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} -- cgit v1.2.3