Skip to content

Commit 4700c69

Browse files
committed
TODO: Preserve pattern sorts in the simplifier
1 parent 2de5854 commit 4700c69

File tree

14 files changed

+159
-1
lines changed

14 files changed

+159
-1
lines changed

src/main/haskell/kore/src/Kore/Step/OrOfExpandedPattern.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ import Kore.Unparser
5656

5757
{-| 'MultiOr' is a Matching logic or of its children
5858
59-
TODO(virgil): Make this a list-like monad, many things would be nicer.
59+
-}
60+
{- TODO (virgil): Make 'getMultiOr' a non-empty list ("Data.NonEmpty").
61+
62+
An empty 'MultiOr' corresponding to 'Bottom' actually discards information about
63+
the sort of its child patterns! That is a problem for simplification, which
64+
should preserve pattern sorts.
65+
66+
A non-empty 'MultiOr' would also have a nice symmetry between 'Top' and 'Bottom'
67+
patterns.
68+
6069
-}
6170
newtype MultiOr child = MultiOr { getMultiOr :: [child] }
6271
deriving

src/main/haskell/kore/src/Kore/Step/Simplification/And.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ simplify
107107
{-| simplifies an And given its two 'OrOfExpandedPattern' children.
108108
109109
See 'simplify' for details.
110+
-}
111+
{- TODO (virgil): Preserve pattern sorts under simplification.
112+
113+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
114+
take an argument of type
115+
116+
> CofreeF (And level) (Valid level) (OrOfExpandedPattern level variable)
117+
118+
instead of two 'OrOfExpandedPattern' arguments. The type of 'makeEvaluate' may
119+
be changed analogously. The 'Valid' annotation will eventually cache information
120+
besides the pattern sort, which will make it even more useful to carry around.
121+
110122
-}
111123
simplifyEvaluated
112124
:: ( MetaOrObject level

src/main/haskell/kore/src/Kore/Step/Simplification/Ceil.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ simplify
7575

7676
{-| 'simplifyEvaluated' evaluates a ceil given its child, see 'simplify'
7777
for details.
78+
-}
79+
{- TODO (virgil): Preserve pattern sorts under simplification.
80+
81+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
82+
take an argument of type
83+
84+
> CofreeF (Ceil level) (Valid level) (OrOfExpandedPattern level variable)
85+
86+
instead of an 'OrOfExpandedPattern' argument. The type of 'makeEvaluate' may
87+
be changed analogously. The 'Valid' annotation will eventually cache information
88+
besides the pattern sort, which will make it even more useful to carry around.
89+
7890
-}
7991
simplifyEvaluated
8092
:: ( MetaOrObject level

src/main/haskell/kore/src/Kore/Step/Simplification/Equals.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,18 @@ simplify
166166
=
167167
simplifyEvaluated tools substitutionSimplifier first second
168168

169+
{- TODO (virgil): Preserve pattern sorts under simplification.
170+
171+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
172+
take an argument of type
173+
174+
> CofreeF (Equals level) (Valid level) (OrOfExpandedPattern level variable)
175+
176+
instead of two 'OrOfExpandedPattern' arguments. The type of 'makeEvaluate' may
177+
be changed analogously. The 'Valid' annotation will eventually cache information
178+
besides the pattern sort, which will make it even more useful to carry around.
179+
180+
-}
169181
simplifyEvaluated
170182
:: ( MetaOrObject level
171183
, SortedVariable variable

src/main/haskell/kore/src/Kore/Step/Simplification/Exists.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,19 @@ simplify
9696
=
9797
simplifyEvaluated tools substitutionSimplifier simplifier variable child
9898

99+
{- TODO (virgil): Preserve pattern sorts under simplification.
100+
101+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
102+
take an argument of type
103+
104+
> CofreeF (Exists level) (Valid level) (OrOfExpandedPattern level variable)
105+
106+
instead of a 'variable level' and an 'OrOfExpandedPattern' argument. The type of
107+
'makeEvaluate' may be changed analogously. The 'Valid' annotation will
108+
eventually cache information besides the pattern sort, which will make it even
109+
more useful to carry around.
110+
111+
-}
99112
simplifyEvaluated
100113
:: ( MetaOrObject level
101114
, Ord (variable level)

src/main/haskell/kore/src/Kore/Step/Simplification/Floor.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ simplify
5454
=
5555
simplifyEvaluatedFloor child
5656

57+
{- TODO (virgil): Preserve pattern sorts under simplification.
58+
59+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
60+
take an argument of type
61+
62+
> CofreeF (Floor level) (Valid level) (OrOfExpandedPattern level variable)
63+
64+
instead of an 'OrOfExpandedPattern' argument. The type of 'makeEvaluateFloor'
65+
may be changed analogously. The 'Valid' annotation will eventually cache
66+
information besides the pattern sort, which will make it even more useful to
67+
carry around.
68+
69+
-}
5770
simplifyEvaluatedFloor
5871
:: ( MetaOrObject level
5972
, SortedVariable variable

src/main/haskell/kore/src/Kore/Step/Simplification/Forall.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ simplify
6060
=
6161
simplifyEvaluated variable child
6262

63+
{- TODO (virgil): Preserve pattern sorts under simplification.
64+
65+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
66+
take an argument of type
67+
68+
> CofreeF (Forall level) (Valid level) (OrOfExpandedPattern level variable)
69+
70+
instead of a 'variable level' and an 'OrOfExpandedPattern' argument. The type of
71+
'makeEvaluate' may be changed analogously. The 'Valid' annotation will
72+
eventually cache information besides the pattern sort, which will make it even
73+
more useful to carry around.
74+
75+
-}
6376
simplifyEvaluated
6477
:: ( MetaOrObject level
6578
, SortedVariable variable

src/main/haskell/kore/src/Kore/Step/Simplification/Iff.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ simplify
6060
{-| evaluates an 'Iff' given its two 'OrOfExpandedPattern' children.
6161
6262
See 'simplify' for detailed documentation.
63+
-}
64+
{- TODO (virgil): Preserve pattern sorts under simplification.
65+
66+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
67+
take an argument of type
68+
69+
> CofreeF (Iff level) (Valid level) (OrOfExpandedPattern level variable)
70+
71+
instead of two 'OrOfExpandedPattern' arguments. The type of 'makeEvaluate' may
72+
be changed analogously. The 'Valid' annotation will eventually cache information
73+
besides the pattern sort, which will make it even more useful to carry around.
74+
6375
-}
6476
simplifyEvaluated
6577
:: ( MetaOrObject level

src/main/haskell/kore/src/Kore/Step/Simplification/Implies.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ simplify
6969
See 'simplify' for details.
7070
-}
7171
-- TODO: Maybe transform this to (not a) \/ b
72+
{- TODO (virgil): Preserve pattern sorts under simplification.
73+
74+
One way to preserve the required sort annotations is to make 'simplifyEvaluated'
75+
take an argument of type
76+
77+
> CofreeF (Implies level) (Valid level) (OrOfExpandedPattern level variable)
78+
79+
instead of two 'OrOfExpandedPattern' arguments. The type of 'makeEvaluate' may
80+
be changed analogously. The 'Valid' annotation will eventually cache information
81+
besides the pattern sort, which will make it even more useful to carry around.
82+
83+
-}
7284
simplifyEvaluated
7385
:: ( MetaOrObject level
7486
, SortedVariable variable

src/main/haskell/kore/src/Kore/Step/Simplification/In.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ simplify
6565
=
6666
simplifyEvaluatedIn tools first second
6767

68+
{- TODO (virgil): Preserve pattern sorts under simplification.
69+
70+
One way to preserve the required sort annotations is to make
71+
'simplifyEvaluatedIn' take an argument of type
72+
73+
> CofreeF (In level) (Valid level) (OrOfExpandedPattern level variable)
74+
75+
instead of two 'OrOfExpandedPattern' arguments. The type of 'makeEvaluateIn' may
76+
be changed analogously. The 'Valid' annotation will eventually cache information
77+
besides the pattern sort, which will make it even more useful to carry around.
78+
79+
-}
6880
simplifyEvaluatedIn
6981
:: ( MetaOrObject level
7082
, SortedVariable variable

0 commit comments

Comments
 (0)