From be7dc0c019ad3def338e50c59ce7f749b1cdaa69 Mon Sep 17 00:00:00 2001 From: Joe Bond Date: Fri, 27 Oct 2023 12:52:34 +0100 Subject: [PATCH] Tidy --- src/Graph/Slice.purs | 7 +++++-- test/Specs.purs | 8 ++++---- test/Util.purs | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Graph/Slice.purs b/src/Graph/Slice.purs index 0ed959026..9cc08f655 100644 --- a/src/Graph/Slice.purs +++ b/src/Graph/Slice.purs @@ -51,8 +51,11 @@ fwdSlice αs0 g0 = fst $ runWithGraph $ tailRecM go (M.empty × inEdges g0 αs0) pure $ Loop (M.insert α βs h × es) -- | De Morgan dual of forward slicing (▷_G)° ≡ Backward slicing on the opposite graph (◁_{G_op}) -fwdSliceDual :: forall g. Graph g => Set Vertex -> g -> g -fwdSliceDual αs0 g0 = bwdSlice αs0 (op g0) +fwdDualAsBwdOp :: forall g. Graph g => Set Vertex -> g -> g +fwdDualAsBwdOp αs0 g0 = bwdSlice αs0 (op g0) + +fwdDual :: forall g. Graph g => Set Vertex -> g -> g +fwdDual αs0 g0 = fwdSlice (sinks g0 `difference` αs0) g0 -- | Forward slicing (▷_G) ≡ De Morgan dual of backward slicing on the opposite graph (◁_{G_op})° fwdSliceAsDeMorgan :: forall g. Graph g => Set Vertex -> g -> g diff --git a/test/Specs.purs b/test/Specs.purs index 417749cbc..ca692259f 100644 --- a/test/Specs.purs +++ b/test/Specs.purs @@ -41,10 +41,10 @@ misc_cases = , { file: "records", fwd_expect: "{a : 2, b : 6, c : 7, d : (5 : []), e : 7}" } , { file: "reverse", fwd_expect: "(2 : (1 : []))" } -- TODO: move to slicing tests once we fix matrix-update - -- , { file: "slicing/dtw/average-series" - -- , fwd_expect: - -- "(2.5 : (0.5 : (0.5 : (2.5 : (2.5 : (1.0 : (0.5 : [])))))))" - -- } + -- , { file: "slicing/dtw/average-series" + -- , fwd_expect: + -- "(2.5 : (0.5 : (0.5 : (2.5 : (2.5 : (1.0 : (0.5 : [])))))))" + -- } ] desugar_cases :: Array TestSpec diff --git a/test/Util.purs b/test/Util.purs index 721cf5505..cdbdebbe3 100644 --- a/test/Util.purs +++ b/test/Util.purs @@ -24,7 +24,7 @@ import Expr (ProgCxt) import GaloisConnection (GaloisConnection(..)) import Graph (Vertex, selectαs, select𝔹s, sinks, vertices) import Graph.GraphImpl (GraphImpl) -import Graph.Slice (bwdSliceDual, fwdSliceDual, fwdSliceDeMorgan) as G +import Graph.Slice (bwdSliceDual, fwdDualAsBwdOp, fwdSliceDeMorgan) as G import Lattice (Raw, 𝔹, botOf, erase, topOf) import Module (File, initialConfig, open, parse) import Parse (program) @@ -153,7 +153,7 @@ testGraph s gconfig spec@{ δv } benchmarking = do when logging (logAs "BwdAll/input slice" (prettyP $ select𝔹s eα αs')) do - g' <- benchmark (method <> "-FwdDual") $ \_ -> pure (G.fwdSliceDual αs_in g) + g' <- benchmark (method <> "-FwdDual") $ \_ -> pure (G.fwdDualAsBwdOp αs_in g) when logging (logAs "FwdDual/output slice" (prettyP $ select𝔹s vα (vertices g'))) do