Skip to content

Revert PRs related to InternalAc, Unit, Element & Concat symbols changes #2463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions kore/kore.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 2.2
--
-- see: https://github.com/sol/hpack
--
-- hash: e1fb37a3896c7ce0fd031723af0b1589be0df0d9b5f958befbe74dbbfdee231f
-- hash: 2efec6a0024031e0d72609be302ec5298405ab977cfd1fac26ad002a0327ef18

name: kore
version: 0.41.0.0
Expand Down Expand Up @@ -70,9 +70,7 @@ library
Kore.Attribute.Axiom.Symbolic
Kore.Attribute.Axiom.Unit
Kore.Attribute.Comm
Kore.Attribute.Concat
Kore.Attribute.Constructor
Kore.Attribute.Element
Kore.Attribute.Function
Kore.Attribute.Functional
Kore.Attribute.Hook
Expand Down Expand Up @@ -103,9 +101,12 @@ library
Kore.Attribute.Smtlib.Smthook
Kore.Attribute.Smtlib.Smtlib
Kore.Attribute.Sort
Kore.Attribute.Sort.Concat
Kore.Attribute.Sort.Constructors
Kore.Attribute.Sort.ConstructorsBuilder
Kore.Attribute.Sort.Element
Kore.Attribute.Sort.HasDomainValues
Kore.Attribute.Sort.Unit
Kore.Attribute.SortInjection
Kore.Attribute.Source
Kore.Attribute.SourceLocation
Expand All @@ -119,7 +120,6 @@ library
Kore.Attribute.Synthetic
Kore.Attribute.Trusted
Kore.Attribute.UniqueId
Kore.Attribute.Unit
Kore.BugReport
Kore.Builtin
Kore.Builtin.AssocComm.AssocComm
Expand Down Expand Up @@ -915,6 +915,7 @@ test-suite kore-test
Test.Kore.Attribute.Smtlib
Test.Kore.Attribute.Sort.ConstructorsBuilder
Test.Kore.Attribute.Sort.HasDomainValues
Test.Kore.Attribute.Sort.Unit
Test.Kore.Attribute.SortInjection
Test.Kore.Attribute.Subsort
Test.Kore.Attribute.Symbol
Expand All @@ -925,7 +926,6 @@ test-suite kore-test
Test.Kore.Attribute.Symbol.SymbolKywd
Test.Kore.Attribute.Trusted
Test.Kore.Attribute.UniqueId
Test.Kore.Attribute.Unit
Test.Kore.BugReport
Test.Kore.Builtin
Test.Kore.Builtin.AssocComm.CeilSimplifier
Expand Down
95 changes: 0 additions & 95 deletions kore/src/Kore/Attribute/Concat.hs

This file was deleted.

95 changes: 0 additions & 95 deletions kore/src/Kore/Attribute/Element.hs

This file was deleted.

18 changes: 9 additions & 9 deletions kore/src/Kore/Attribute/Sort.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ import Prelude.Kore hiding
import qualified Control.Monad as Monad
import Data.Generics.Product

import Kore.Attribute.Concat
import Kore.Attribute.Element
import Kore.Attribute.Hook
import Kore.Attribute.Parser hiding
( Sort
)
import Kore.Attribute.Smtlib.Smtlib
import Kore.Attribute.Sort.Concat
import Kore.Attribute.Sort.Element
import Kore.Attribute.Sort.HasDomainValues
( HasDomainValues
)
import Kore.Attribute.Unit
import Kore.Attribute.Sort.Unit

data Sort =
Sort
{ hook :: !Hook
-- ^ The builtin sort hooked to the sort.
, smtlib :: !Smtlib
-- ^ The user-defined translation of the sort for SMT.
, unit :: !(Unit SymbolOrAlias)
, unit :: !Unit
-- ^ The unit symbol associated with the sort.
, element :: !(Element SymbolOrAlias)
, element :: !Element
-- ^ The element symbol associated with the sort.
, concat :: !(Concat SymbolOrAlias)
, concat :: !Concat
-- ^ The concat symbol associated with the sort.
, hasDomainValues :: !HasDomainValues
-- ^ whether the sort has domain values
Expand Down Expand Up @@ -68,9 +68,9 @@ instance ParseAttributes Sort where
parseAttribute attr =
typed @Hook (parseAttribute attr)
Monad.>=> typed @Smtlib (parseAttribute attr)
Monad.>=> typed @(Unit SymbolOrAlias) (parseAttribute attr)
Monad.>=> typed @(Element SymbolOrAlias) (parseAttribute attr)
Monad.>=> typed @(Concat SymbolOrAlias) (parseAttribute attr)
Monad.>=> typed @Unit (parseAttribute attr)
Monad.>=> typed @Element (parseAttribute attr)
Monad.>=> typed @Concat (parseAttribute attr)
Monad.>=> typed @HasDomainValues (parseAttribute attr)

instance From Sort Attributes where
Expand Down
70 changes: 70 additions & 0 deletions kore/src/Kore/Attribute/Sort/Concat.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{-|
Module : Kore.Attribute.Sort.Concat
Description : Concat sort attribute
Copyright : (c) Runtime Verification, 2019
License : NCSA
Maintainer : [email protected]

-}
module Kore.Attribute.Sort.Concat
( Concat (..)
, concatId, concatSymbol, concatAttribute
) where

import Prelude.Kore

import Data.Default

import Kore.Attribute.Parser

-- | @Concat@ represents the @concat@ attribute for sorts.
newtype Concat = Concat { getConcat :: Maybe SymbolOrAlias }
deriving (Generic, Eq, Ord, Show)

instance Semigroup Concat where
(<>) a@(Concat (Just _)) _ = a
(<>) _ b = b

instance Monoid Concat where
mempty = Concat { getConcat = Nothing }

instance Default Concat where
def = mempty

instance NFData Concat

instance ParseAttributes Concat where
parseAttribute = withApplication' parseApplication
where
parseApplication params args Concat { getConcat }
| Just _ <- getConcat = failDuplicate'
| otherwise = do
getZeroParams params
arg <- getOneArgument args
symbol <- getSymbolOrAlias arg
return Concat { getConcat = Just symbol }
withApplication' = withApplication concatId
failDuplicate' = failDuplicate concatId

instance From Concat Attributes where
from =
maybe def toAttribute . getConcat
where
toAttribute = from @AttributePattern . concatAttribute

-- | Kore identifier representing the @concat@ attribute symbol.
concatId :: Id
concatId = "concat"

-- | Kore symbol representing the @concat@ attribute.
concatSymbol :: SymbolOrAlias
concatSymbol =
SymbolOrAlias
{ symbolOrAliasConstructor = concatId
, symbolOrAliasParams = []
}

-- | Kore pattern representing the @concat@ attribute.
concatAttribute :: SymbolOrAlias -> AttributePattern
concatAttribute symbol =
attributePattern concatSymbol [attributePattern_ symbol]
Loading