From fed88aaf9cfb325e54c85b7aebbea2a6cded1511 Mon Sep 17 00:00:00 2001 From: Meng Weng Wong Date: Tue, 15 Aug 2023 20:25:31 +0800 Subject: [PATCH] at first glance i think the data flow is being set up correctly, next dot --- lib/haskell/natural4/app/Main.hs | 2 +- lib/haskell/natural4/src/LS/Interpreter.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/haskell/natural4/app/Main.hs b/lib/haskell/natural4/app/Main.hs index 30eb3133d..39e3ade22 100644 --- a/lib/haskell/natural4/app/Main.hs +++ b/lib/haskell/natural4/app/Main.hs @@ -194,7 +194,7 @@ main = do (totsFN, (asTSpretty, asTSerr)) = (workuuid <> "/" <> "ts", xpLog $ asTypescript l4i) (togroundsFN, asGrounds) = (workuuid <> "/" <> "grounds", show $ groundrules rc rules) (toOrgFN, asOrg) = (workuuid <> "/" <> "org", toOrg l4i rules) - (toDFGFN, (asDFG, asDFGerr)) = (workuuid <> "/" <> "dfg", xpLog $ dataFlowAsDot l4i) + (toDFGFN, (asDFG, asDFGerr)) = (workuuid <> "/" <> "dataflow", xpLog $ dataFlowAsDot l4i) (toNL_FN, asNatLang) = (workuuid <> "/" <> "natlang", toNatLang l4i) (toMaudeFN, asMaude) = (workuuid <> "/" <> "maude", Maude.rules2maudeStr rules) (tonativeFN, asNative) = (workuuid <> "/" <> "native", unlines diff --git a/lib/haskell/natural4/src/LS/Interpreter.hs b/lib/haskell/natural4/src/LS/Interpreter.hs index bce9273b2..c613126f0 100644 --- a/lib/haskell/natural4/src/LS/Interpreter.hs +++ b/lib/haskell/natural4/src/LS/Interpreter.hs @@ -378,7 +378,7 @@ ruleDecisionGraph rs = do mutterd 3 "(2.5) let's elevate all the leaf terms to stubby little rules in their own right" let stubRules = [ defaultHorn { name = rulename, keyword = Define, srcref = Nothing , clauses = stubClause rulename } - | rulename <- ruleNames ] + | rulename <- difference ] mutterd 3 "(2.6) then we rebuild the graph with those rules included" let expandedRuleMap = Map.fromList (Prelude.zip (decisionRules ++ stubRules) [1..]) @@ -390,8 +390,8 @@ ruleDecisionGraph rs = do mutterd 3 "(3.1) finally we strip the reflexive BSR from the stub rules while leaving the nodes themselves in place." - let prunedRuleGraph = nmap (\r@Hornlike{..} -> if clauses == stubClause name then r { clauses = [] } else r ) expandedRuleGraph - "(2.7) prunedRuleGraph" ***-> prunedRuleGraph + let prunedRuleGraph = nmap (\r -> if hasClauses r && clauses r == stubClause (name r) then r { clauses = [] } else r ) expandedRuleGraph + "(3.2.7) prunedRuleGraph" ***-> prunedRuleGraph return prunedRuleGraph @@ -450,7 +450,7 @@ relPredRefs rs ridmap r = do mutterdhsf 5 "relPredRefs: bodyElements" pShowNoColorS bodyElements -- [BUG] at some point we lose the moon - + mutterd 5 "relPredReffs: will exclude various things not found in headElements" -- given a rule R, for each term relied on by rule R, identify all the subsidiary rules which define those terms. toreturn <- sequence [ (rid, targetRuleId', ()) <$ mutterd 6 ("relPredRefs list comp: returning " <> show rid <> ", " <> show targetRuleId')