Skip to content

Remove defined marker #2380

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 80 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
ef7e6a2
Add HashMap to SideCondition
ana-pantilie Dec 7, 2020
acd2db2
Rename assumptions to replacements
ana-pantilie Dec 7, 2020
a5f33ef
Use simplifyConjunctionWithAssumptions to construct and combine SideC…
ana-pantilie Dec 8, 2020
4ff1717
Hlint
ana-pantilie Dec 8, 2020
3a9367c
Use to and from SideCondition to simplify Condition
ana-pantilie Dec 14, 2020
4675f21
Merge remote-tracking branch 'ana-pantilie/substitution-map-in-sideco…
ana-pantilie Dec 15, 2020
2316fe4
Use Changed in simplifyConjunctions again
ana-pantilie Dec 16, 2020
aab235e
Merge branch 'master' into replacement-map-in-sidecondition
ana-pantilie Dec 16, 2020
a0548d4
Use replacements when simplifying terms, with exception
ana-pantilie Dec 17, 2020
e94747f
Regenerate golden
ana-pantilie Dec 17, 2020
0615cd6
Comment out failing test, TODO fix
ana-pantilie Dec 17, 2020
50cf56a
Merge branch 'replacement-map-in-sidecondition' of github.com:kframew…
ana-pantilie Dec 17, 2020
d9a2efd
Simplify Pattern with SideCondition in only special cases
ana-pantilie Dec 18, 2020
75d5de7
Use simplify instead of simplifyTopConfiguration
ana-pantilie Dec 18, 2020
3ea5720
Modify test which describes possibly wrong behavior
ana-pantilie Dec 18, 2020
99e47e0
Merge remote-tracking branch 'origin/master' into replacement-map-in-…
ana-pantilie Dec 18, 2020
2239a98
Merge branch 'master' into replacement-map-in-sidecondition
ana-pantilie Dec 21, 2020
8427101
Fixed onepath test
ana-pantilie Dec 21, 2020
6e5da94
TermLike.simplify unit tests; simplify with all replacements
ana-pantilie Dec 21, 2020
2d32ce3
Remove unused imports
ana-pantilie Dec 22, 2020
bb0deb2
Add Pretty instance for SideCondition
ana-pantilie Dec 22, 2020
fc82465
Add documentation
ana-pantilie Dec 22, 2020
d0d5a92
Add strictness to fields
ana-pantilie Dec 22, 2020
be0eff9
Add strict language pragma
ana-pantilie Jan 6, 2021
ff4667b
Make lazy binding
ana-pantilie Jan 7, 2021
319a6ca
Merge branch 'master' into replacement-map-in-sidecondition
ana-pantilie Jan 7, 2021
82678f7
Address review comments
ana-pantilie Jan 8, 2021
f8626e1
Clean-up
ana-pantilie Jan 8, 2021
f2da9d1
Update kore/src/Kore/Step/Simplification/Condition.hs
ana-pantilie Jan 8, 2021
b892e8f
Update Debug.hs
ana-pantilie Jan 8, 2021
45ac029
Merge branch 'master' into replacement-map-in-sidecondition
ana-pantilie Jan 8, 2021
d43d564
Modify simplification in checkImplication
ana-pantilie Jan 8, 2021
9864a29
Merge branch 'replacement-map-in-sidecondition' of github.com:kframew…
ana-pantilie Jan 8, 2021
c8f1282
unifyKequalsEq should apply for both \and and \equals
ana-pantilie Jan 12, 2021
14338ee
Tests for KEqual unification
ana-pantilie Jan 13, 2021
f53f318
Merge branch 'unify-kequals-both' into replacement-map-in-sidecondition
ana-pantilie Jan 14, 2021
e3d7b75
Merge remote-tracking branch 'origin/master' into replacement-map-in-…
ana-pantilie Jan 14, 2021
b02e458
Merge remote-tracking branch 'origin/master' into replacement-map-in-…
ana-pantilie Jan 16, 2021
8eb3a7c
Add a HashSet of defined TermLikes to SideCondition
ana-pantilie Jan 19, 2021
edff82c
Draft, incomplete implementation of assumeDefined
ana-pantilie Jan 20, 2021
9199f2e
Implement assumeDefined for assoc comm collections
ana-pantilie Jan 21, 2021
cdedaa8
Fix
ana-pantilie Jan 21, 2021
9d44720
Fixes and tests for generateNormalizedAcs
ana-pantilie Jan 21, 2021
294b729
Tests and fixes
ana-pantilie Jan 21, 2021
6095fae
Keep term and predicate replacements together as terms
ana-pantilie Jan 21, 2021
907817f
Merge branch 'master' into replacement-map-in-sidecondition
ana-pantilie Jan 21, 2021
3d92b8c
Merge branch 'master' into replacement-map-in-sidecondition
ana-pantilie Jan 21, 2021
3a98848
Remove double import
ana-pantilie Jan 22, 2021
bfb6080
generateNormalizedAcs: clean-up
ana-pantilie Jan 26, 2021
3f80f88
Finish isDefined, add tests and clean-up
ana-pantilie Jan 27, 2021
d7536b7
Merge remote-tracking branch 'origin/replacement-map-in-sidecondition…
ana-pantilie Jan 27, 2021
756cde3
Merge remote-tracking branch 'origin/master' into defined-terms-in-si…
ana-pantilie Jan 29, 2021
f478491
Major test clean-up, include set tests
ana-pantilie Jan 29, 2021
d180df7
Fix functional application case, add tests
ana-pantilie Jan 29, 2021
d5b37a5
Remove Defined marker
ana-pantilie Feb 1, 2021
8b1ace7
Materialize Nix expressions
ana-pantilie Feb 1, 2021
5a8b9d3
Propagate side condition in SMT translator
ana-pantilie Feb 1, 2021
d8db233
Use definedness in translatePattern as well
ana-pantilie Feb 1, 2021
2020eb9
Add tests for defined SMT translation back
ana-pantilie Feb 1, 2021
4203ceb
Remove unused test module
ana-pantilie Feb 1, 2021
e8508b6
Get rid of isDefinedPattern in Matcher
ana-pantilie Feb 1, 2021
81ccbff
Merge branch 'remove-defined-marker' of github.com:kframework/kore in…
ana-pantilie Feb 1, 2021
7ad0885
Materialize Nix expressions
ana-pantilie Feb 1, 2021
0b427d1
Carry SideCondition in Builtin modules; replace isDefinedPattern
ana-pantilie Feb 3, 2021
485ead1
Merge branch 'remove-defined-marker' of github.com:kframework/kore in…
ana-pantilie Feb 3, 2021
100235f
Merge remote-tracking branch 'origin/master' into remove-defined-marker
ana-pantilie Feb 4, 2021
c604e41
Remove rest of Defined node
ana-pantilie Feb 4, 2021
7caa40f
Fix isDefined case for 1-element, 1-opaque collections
ana-pantilie Feb 4, 2021
fc412e3
Add accidentally removed collection unification cases
ana-pantilie Feb 4, 2021
d5e168b
Temp: TODO and debugging info
ana-pantilie Feb 4, 2021
ee29273
Merge remote-tracking branch 'origin/master' into remove-defined-marker
ana-pantilie Mar 3, 2021
df89e38
Fix unit test bugs
ana-pantilie Mar 4, 2021
d37f0aa
Merge remote-tracking branch 'origin/master' into remove-defined-marker
ana-pantilie Mar 8, 2021
a4464cf
SideCondition, Pattern: clean-up and documentation
ana-pantilie Mar 10, 2021
9a7ae3b
Add unit tests for values definedness
ana-pantilie Mar 10, 2021
45a2ee8
Merge remote-tracking branch 'origin/master' into remove-defined-marker
ana-pantilie Mar 10, 2021
0138d0e
Update TODO comment
ana-pantilie Mar 11, 2021
1acfab2
Update kore/src/Kore/Step/Simplification/Exists.hs
ana-pantilie Mar 11, 2021
453b23f
Address review comment
ana-pantilie Mar 11, 2021
0da594a
Merge branch 'master' into remove-defined-marker
rv-jenkins Mar 12, 2021
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
4 changes: 1 addition & 3 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: 80d27d36f0343e3b6779aa37ed5fccc747fd7c1b66c7b9bd2fb27c1f6a2d6403
-- hash: f665c212513ddd12eaa511bf198ce16f125dd902b5b25a656b2fa584d073c5ba

name: kore
version: 0.41.0.0
Expand Down Expand Up @@ -284,7 +284,6 @@ library
Kore.Step.Simplification.CeilSimplifier
Kore.Step.Simplification.Condition
Kore.Step.Simplification.Data
Kore.Step.Simplification.Defined
Kore.Step.Simplification.DomainValue
Kore.Step.Simplification.Equals
Kore.Step.Simplification.Exists
Expand Down Expand Up @@ -930,7 +929,6 @@ test-suite kore-test
Test.Kore.BugReport
Test.Kore.Builtin
Test.Kore.Builtin.AssocComm.CeilSimplifier
Test.Kore.Builtin.AssociativeCommutative
Test.Kore.Builtin.Bool
Test.Kore.Builtin.Builtin
Test.Kore.Builtin.Definition
Expand Down
9 changes: 0 additions & 9 deletions kore/src/Kore/Builtin/AssociativeCommutative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ import Kore.Internal.Symbol
)
import Kore.Internal.TermLike
( pattern App_
, pattern Defined_
, pattern ElemVar_
, pattern InternalMap_
, pattern InternalSet_
Expand Down Expand Up @@ -220,7 +219,6 @@ instance TermWrapper NormalizedMap where

matchBuiltin (InternalMap_ internalMap) =
Just (builtinAcChild internalMap)
matchBuiltin (Defined_ child) = matchBuiltin child
matchBuiltin _ = Nothing

{- |Transforms a @TermLike@ representation into a @NormalizedOrBottom@.
Expand Down Expand Up @@ -262,7 +260,6 @@ instance TermWrapper NormalizedMap where
case args of
[map1, map2] -> toNormalized map1 <> toNormalized map2
_ -> Builtin.wrongArity "MAP.concat"
toNormalized (Defined_ child) = toNormalized child
toNormalized patt =
(Normalized . wrapAc) NormalizedAc
{ elementsWithVariables = []
Expand Down Expand Up @@ -357,8 +354,6 @@ toNormalizedInternalMapWorker term@(App_ symbol args)
}
return internal
_ -> Builtin.wrongArity "MAP.concat"
toNormalizedInternalMapWorker (Defined_ child) =
toNormalizedInternalMapWorker child
toNormalizedInternalMapWorker term =
Just (emptyInternalAc @NormalizedMap (termLikeSort term))
{ builtinAcChild = wrapAc emptyNormalizedAc { opaque = [term] }
Expand Down Expand Up @@ -386,7 +381,6 @@ instance TermWrapper NormalizedSet where

matchBuiltin (InternalSet_ internalSet) =
Just (builtinAcChild internalSet)
matchBuiltin (Defined_ child) = matchBuiltin child
matchBuiltin _ = Nothing

{- |Transforms a @TermLike@ representation into a @NormalizedSetOrBottom@.
Expand Down Expand Up @@ -427,7 +421,6 @@ instance TermWrapper NormalizedSet where
case args of
[set1, set2] -> toNormalized set1 <> toNormalized set2
_ -> Builtin.wrongArity "SET.concat"
toNormalized (Defined_ child) = toNormalized child
toNormalized patt =
(Normalized . wrapAc)
emptyNormalizedAc { opaque = [patt] }
Expand Down Expand Up @@ -520,8 +513,6 @@ toNormalizedInternalSetWorker term@(App_ symbol args)
}
return internal
_ -> Builtin.wrongArity "SET.concat"
toNormalizedInternalSetWorker (Defined_ child) =
toNormalizedInternalSetWorker child
toNormalizedInternalSetWorker term =
Just (emptyInternalAc @NormalizedSet (termLikeSort term))
{ builtinAcChild = wrapAc emptyNormalizedAc { opaque = [term] }
Expand Down
27 changes: 17 additions & 10 deletions kore/src/Kore/Builtin/Builtin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ import Kore.Internal.Predicate
( makeEqualsPredicate
)
import qualified Kore.Internal.Predicate as Predicate
import Kore.Internal.SideCondition
( SideCondition
)
import qualified Kore.Internal.SideCondition as SideCondition
( topTODO
)
Expand Down Expand Up @@ -180,7 +183,7 @@ unaryOperator extractVal asPattern ctx op =
get = extractVal ctx

unaryOperator0 :: Function
unaryOperator0 resultSort children =
unaryOperator0 _ resultSort children =
case children of
[termLike]
| Just a <- get termLike -> do
Expand Down Expand Up @@ -220,7 +223,7 @@ binaryOperator extractVal asPattern ctx op =
get = extractVal ctx

binaryOperator0 :: Function
binaryOperator0 resultSort children =
binaryOperator0 _ resultSort children =
case children of
[get -> Just a, get -> Just b] -> do
-- Apply the operator to two domain values
Expand Down Expand Up @@ -259,7 +262,7 @@ ternaryOperator extractVal asPattern ctx op =
get = extractVal ctx

ternaryOperator0 :: Function
ternaryOperator0 resultSort children =
ternaryOperator0 _ resultSort children =
case children of
[get -> Just a, get -> Just b, get -> Just c] -> do
-- Apply the operator to three domain values
Expand All @@ -273,23 +276,25 @@ type Function
. InternalVariable variable
=> HasCallStack
=> MonadSimplify simplifier
=> Sort
=> SideCondition variable
-> Sort
-> [TermLike variable]
-> MaybeT simplifier (Pattern variable)

functionEvaluator :: Function -> BuiltinAndAxiomSimplifier
functionEvaluator impl =
applicationEvaluator $ \app -> do
applicationEvaluator $ \sideCondition app -> do
let Application { applicationSymbolOrAlias = symbol } = app
Application { applicationChildren = args } = app
resultSort = symbolSorts symbol & applicationSortsResult
impl resultSort args
impl sideCondition resultSort args

applicationEvaluator
:: ( forall variable simplifier
. InternalVariable variable
=> MonadSimplify simplifier
=> Application Symbol (TermLike variable)
=> SideCondition variable
-> Application Symbol (TermLike variable)
-> MaybeT simplifier (Pattern variable)
)
-> BuiltinAndAxiomSimplifier
Expand All @@ -299,14 +304,16 @@ applicationEvaluator impl =
evaluator
:: InternalVariable variable
=> MonadSimplify simplifier
=> CofreeF
=> SideCondition variable
-> CofreeF
(Application Symbol)
(Attribute.Pattern variable)
(TermLike variable)
-> simplifier (AttemptedAxiom variable)
evaluator (_ :< app) = do
evaluator sideCondition (_ :< app) = do
let app' = fmap TermLike.removeEvaluated app
getAttemptedAxiom (impl app' >>= appliedFunction)
getAttemptedAxiom
(impl sideCondition app' >>= appliedFunction)

{- | Run a parser on a verified domain value.

Expand Down
4 changes: 0 additions & 4 deletions kore/src/Kore/Builtin/External.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ externalize =
$ mapHead Symbol.toSymbolOrAlias
$ Signedness.toApplication
$ getConst signednessF
DefinedF definedF ->
Cofree.tailF
$ worker
$ getDefined definedF
InjF _ -> error "Unexpected sort injection"
InternalBoolF _ -> error "Unexpected internal builtin"
InternalBytesF _ -> error "Unexpected internal builtin"
Expand Down
7 changes: 4 additions & 3 deletions kore/src/Kore/Builtin/Int.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ import qualified Kore.Internal.Pattern as Pattern
import Kore.Internal.Predicate
( makeCeilPredicate
)
import qualified Kore.Internal.SideCondition as SideCondition
import Kore.Internal.Symbol
( symbolHook
)
Expand Down Expand Up @@ -368,7 +369,7 @@ powmod b e m
| otherwise = Just (powModInteger b e m)

evalEq :: Builtin.Function
evalEq resultSort arguments@[_intLeft, _intRight] =
evalEq sideCondition resultSort arguments@[_intLeft, _intRight] =
concrete <|> symbolicReflexivity
where
concrete = do
Expand All @@ -388,13 +389,13 @@ evalEq resultSort arguments@[_intLeft, _intRight] =
empty

mkCeilUnlessDefined termLike
| TermLike.isDefinedPattern termLike = Condition.top
| SideCondition.isDefined sideCondition termLike = Condition.top
| otherwise =
Condition.fromPredicate (makeCeilPredicate termLike)
returnPattern = return . flip Pattern.andCondition conditions
conditions = foldMap mkCeilUnlessDefined arguments

evalEq _ _ = Builtin.wrongArity eqKey
evalEq _ _ _ = Builtin.wrongArity eqKey

{- | Match the @INT.eq@ hooked symbol.
-}
Expand Down
Loading