Skip to content

Commit ef1a483

Browse files
committed
Revert "Removes sort checks for Map and Set during internalization (#2440)"
This reverts commit 4195d94.
1 parent 57ad329 commit ef1a483

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

kore/src/Kore/Builtin.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,6 @@ internalize tools =
198198
where
199199
internalize1 =
200200
List.internalize tools
201-
. Map.internalize
202-
. Set.internalize
201+
. Map.internalize tools
202+
. Set.internalize tools
203203
. InternalBytes.internalize

kore/src/Kore/Builtin/Map.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import Data.Text
5252
import Kore.Attribute.Hook
5353
( Hook (..)
5454
)
55+
import qualified Kore.Attribute.Symbol as Attribute
5556
import qualified Kore.Builtin.AssociativeCommutative as Ac
5657
import Kore.Builtin.Attributes
5758
( isConstructorModulo_
@@ -484,14 +485,18 @@ internalize subterms.
484485

485486
internalize
486487
:: InternalVariable variable
487-
=> TermLike variable
488+
=> SmtMetadataTools Attribute.Symbol
489+
-> TermLike variable
488490
-> TermLike variable
489-
internalize termLike
491+
internalize tools termLike
492+
| fromMaybe False (isMapSort tools sort')
490493
-- Ac.toNormalized is greedy about 'normalizing' opaque terms, we should only
491494
-- apply it if we know the term head is a constructor-like symbol.
492-
| App_ symbol _ <- termLike
495+
, App_ symbol _ <- termLike
493496
, isConstructorModulo_ symbol = Ac.toNormalizedInternalMap termLike
494497
| otherwise = termLike
498+
where
499+
sort' = termLikeSort termLike
495500

496501
{- | Simplify the conjunction or equality of two concrete Map domain values.
497502

kore/src/Kore/Builtin/Set.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ import qualified Data.Set as Set
5252
import Data.Text
5353
( Text
5454
)
55+
import qualified Kore.Attribute.Symbol as Attribute
56+
( Symbol
57+
)
5558
import qualified Kore.Builtin.AssociativeCommutative as Ac
5659
import Kore.Builtin.Attributes
5760
( isConstructorModulo_
@@ -485,14 +488,18 @@ internalize subterms.
485488
-}
486489
internalize
487490
:: InternalVariable variable
488-
=> TermLike variable
491+
=> SmtMetadataTools Attribute.Symbol
492+
-> TermLike variable
489493
-> TermLike variable
490-
internalize termLike
494+
internalize tools termLike
495+
| fromMaybe False (isSetSort tools sort')
491496
-- Ac.toNormalized is greedy about 'normalizing' opaque terms, we should only
492497
-- apply it if we know the term head is a constructor-like symbol.
493-
| App_ symbol _ <- termLike
498+
, App_ symbol _ <- termLike
494499
, isConstructorModulo_ symbol = Ac.toNormalizedInternalSet termLike
495500
| otherwise = termLike
501+
where
502+
sort' = termLikeSort termLike
496503

497504
{- | Simplify the conjunction or equality of two concrete Set domain values.
498505

0 commit comments

Comments
 (0)