Skip to content

Commit

Permalink
Merge branch 'develop' into deprecate-symbol-klabel
Browse files Browse the repository at this point in the history
  • Loading branch information
Baltoli authored Jul 3, 2024
2 parents 3c5dc81 + c7cba68 commit 4bb1bf1
Show file tree
Hide file tree
Showing 14 changed files with 204 additions and 208 deletions.
2 changes: 1 addition & 1 deletion deps/haskell-backend_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.25
v0.1.29
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "K Framework";
inputs = {
haskell-backend.url = "github:runtimeverification/haskell-backend/v0.1.25";
haskell-backend.url = "github:runtimeverification/haskell-backend/v0.1.29";
nixpkgs.follows = "llvm-backend/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
llvm-backend = {
Expand Down
2 changes: 1 addition & 1 deletion haskell-backend/src/main/native/haskell-backend
Submodule haskell-backend updated 91 files
+2 −1 booster/library/Booster/Builtin/Base.hs
+3 −2 booster/library/Booster/Builtin/KEQUAL.hs
+17 −0 booster/library/Booster/CLOptions.hs
+11 −8 booster/library/Booster/Definition/Ceil.hs
+5 −2 booster/library/Booster/Definition/Util.hs
+384 −374 booster/library/Booster/JsonRpc.hs
+27 −4 booster/library/Booster/JsonRpc/Utils.hs
+29 −8 booster/library/Booster/Log.hs
+149 −123 booster/library/Booster/Pattern/ApplyEquations.hs
+0 −83 booster/library/Booster/Pattern/Base.hs
+3 −2 booster/library/Booster/Pattern/Binary.hs
+20 −19 booster/library/Booster/Pattern/Match.hs
+189 −0 booster/library/Booster/Pattern/Pretty.hs
+238 −197 booster/library/Booster/Pattern/Rewrite.hs
+16 −7 booster/library/Booster/SMT/Interface.hs
+13 −4 booster/library/Booster/SMT/Translate.hs
+14 −9 booster/library/Booster/Syntax/Json/Internalise.hs
+8 −6 booster/library/Booster/Syntax/ParsedKore/Internalise.hs
+1 −1 booster/package.yaml
+7 −7 booster/test/rpc-integration/test-log-simplify-json/simplify-log.txt.golden
+46 −39 booster/tools/booster/Server.hs
+6 −2 dev-tools/booster-dev/Server.hs
+7 −2 dev-tools/kore-rpc-dev/Server.hs
+1 −1 dev-tools/package.yaml
+2 −2 dev-tools/parsetest/Parsetest.hs
+6 −5 dev-tools/pretty/Pretty.hs
+1 −1 kore-rpc-types/kore-rpc-types.cabal
+50 −2 kore-rpc-types/src/Kore/JsonRpc/Types/ContextLog.hs
+1 −1 kore/kore.cabal
+8 −0 kore/src/Kore/Builtin/Krypto.hs
+2 −2 kore/src/Kore/Equation/Application.hs
+23 −46 kore/src/Kore/Equation/DebugEquation.hs
+26 −30 kore/src/Kore/JsonRpc.hs
+3 −8 kore/src/Kore/Log/BoosterAdaptor.hs
+3 −4 kore/src/Kore/Log/DebugAppliedRewriteRules.hs
+1 −1 kore/src/Kore/Log/DebugAttemptUnification.hs
+11 −18 kore/src/Kore/Log/DebugAttemptedRewriteRules.hs
+1 −0 kore/src/Kore/Log/DebugBeginClaim.hs
+8 −9 kore/src/Kore/Log/DebugContext.hs
+1 −0 kore/src/Kore/Log/DebugCreatedSubstitution.hs
+4 −0 kore/src/Kore/Log/DebugEvaluateCondition.hs
+1 −0 kore/src/Kore/Log/DebugProven.hs
+1 −0 kore/src/Kore/Log/DebugRetrySolverQuery.hs
+11 −25 kore/src/Kore/Log/DebugRewriteRulesRemainder.hs
+6 −1 kore/src/Kore/Log/DebugRewriteTrace.hs
+4 −0 kore/src/Kore/Log/DebugSolver.hs
+1 −0 kore/src/Kore/Log/DebugSubstitutionSimplifier.hs
+1 −0 kore/src/Kore/Log/DebugTransition.hs
+1 −0 kore/src/Kore/Log/DebugUnification.hs
+3 −0 kore/src/Kore/Log/DebugUnifyBottom.hs
+6 −2 kore/src/Kore/Log/DecidePredicateUnknown.hs
+1 −0 kore/src/Kore/Log/ErrorBottomTotalFunction.hs
+3 −0 kore/src/Kore/Log/ErrorEquationRightFunction.hs
+3 −0 kore/src/Kore/Log/ErrorEquationsSameMatch.hs
+1 −0 kore/src/Kore/Log/ErrorException.hs
+1 −0 kore/src/Kore/Log/ErrorOutOfDate.hs
+1 −0 kore/src/Kore/Log/ErrorParse.hs
+1 −0 kore/src/Kore/Log/ErrorRewriteLoop.hs
+1 −0 kore/src/Kore/Log/ErrorRewritesInstantiation.hs
+1 −0 kore/src/Kore/Log/ErrorVerify.hs
+1 −0 kore/src/Kore/Log/InfoExecBreadth.hs
+1 −0 kore/src/Kore/Log/InfoExecDepth.hs
+1 −0 kore/src/Kore/Log/InfoJsonRpcCancelRequest.hs
+1 −0 kore/src/Kore/Log/InfoJsonRpcProcessRequest.hs
+1 −0 kore/src/Kore/Log/InfoProofDepth.hs
+1 −0 kore/src/Kore/Log/InfoReachability.hs
+1 −0 kore/src/Kore/Log/InfoUserLog.hs
+1 −1 kore/src/Kore/Log/JsonRpc.hs
+2 −0 kore/src/Kore/Log/WarnBottom.hs
+1 −0 kore/src/Kore/Log/WarnDepthLimitExceeded.hs
+3 −0 kore/src/Kore/Log/WarnFunctionWithoutEvaluators.hs
+1 −0 kore/src/Kore/Log/WarnIfLowProductivity.hs
+1 −0 kore/src/Kore/Log/WarnNotAPredicate.hs
+1 −0 kore/src/Kore/Log/WarnNotImplemented.hs
+1 −0 kore/src/Kore/Log/WarnRestartSolver.hs
+2 −0 kore/src/Kore/Log/WarnStepTimeout.hs
+1 −0 kore/src/Kore/Log/WarnStuckClaimState.hs
+1 −0 kore/src/Kore/Log/WarnSymbolSMTRepresentation.hs
+1 −0 kore/src/Kore/Log/WarnTrivialClaim.hs
+1 −0 kore/src/Kore/Log/WarnUnexploredBranches.hs
+2 −0 kore/src/Kore/Log/WarnUnsimplified.hs
+4 −4 kore/src/Kore/Rewrite/Step.hs
+1 −1 kore/src/Kore/Simplify/Simplify.hs
+2 −2 kore/src/Kore/Unification/Procedure.hs
+10 −30 kore/src/Log.hs
+31 −7 kore/src/Log/Entry.hs
+7 −0 kore/test/Test/Kore/Builtin/Definition.hs
+33 −0 kore/test/Test/Kore/Builtin/Krypto.hs
+1 −1 package/debian/changelog
+1 −1 package/version
+2 −2 scripts/performance-tests-kevm.sh
3 changes: 1 addition & 2 deletions k-distribution/include/kframework/ktest-common.mak
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ LLVM_KRUN=${K_BIN}/llvm-krun
# and kdep
KDEP=${K_BIN}/kdep
# command to strip paths from test outputs
# REMOVE_PATHS=| sed 's!\('`pwd`'\|'${BUILTIN_DIR}'\|/nix/store/.\+/include/kframework/builtin\)/\(\./\)\{0,2\}!!g'
REMOVE_PATHS=| sed 's!\('`pwd`'\)/\(\./\)\{0,2\}!!g' | sed 's!\('${BUILTIN_DIR}'\)/\(\./\)\{0,2\}!!g' | sed 's!\('/nix/store/.\+/include/kframework/builtin'\)/\(\./\)\{0,2\}!!g'
REMOVE_PATHS=| sed 's!\('`pwd`'\)/\(\./\)\{0,2\}!!g' | sed 's!\('${BUILTIN_DIR}'\)/\(\./\)\{0,2\}!!g' | sed 's!\('/nix/store/..*/include/kframework/builtin'\)/\(\./\)\{0,2\}!!g'
10 changes: 10 additions & 0 deletions pyk/src/pyk/kllvm/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
ML_SYMBOLS,
AliasDecl,
App,
Assoc,
Axiom,
Claim,
Definition,
EVar,
Import,
LeftAssoc,
MLPattern,
Module,
RightAssoc,
SortApp,
SortDecl,
SortVar,
Expand Down Expand Up @@ -110,6 +113,8 @@ def pattern_to_llvm(pattern: Pattern) -> kllvm.Pattern:
return kllvm.VariablePattern(name, sort_to_llvm(sort))
case App(symbol, sorts, args):
return _composite_pattern(symbol, sorts, args)
case Assoc():
return _composite_pattern(pattern.kore_symbol(), [], [pattern.app])
case MLPattern():
return _composite_pattern(pattern.symbol(), pattern.sorts, pattern.ctor_patterns)
case _:
Expand Down Expand Up @@ -206,6 +211,11 @@ def llvm_to_pattern(pattern: kllvm.Pattern) -> Pattern:
symbol, sorts, patterns = _unpack_composite_pattern(pattern)
if symbol in ML_SYMBOLS:
return MLPattern.of(symbol, sorts, patterns)
elif symbol in [r'\left-assoc', r'\right-assoc']:
(app,) = patterns
assert isinstance(app, App)
assoc = LeftAssoc if symbol == r'\left-assoc' else RightAssoc
return assoc(app.symbol, app.sorts, app.args)
else:
return App(symbol, sorts, patterns)
case _:
Expand Down
5 changes: 1 addition & 4 deletions pyk/src/pyk/kore/manip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import TYPE_CHECKING

from .syntax import And, Assoc, EVar, MLQuant, Top
from .syntax import And, EVar, MLQuant, Top

if TYPE_CHECKING:
from collections.abc import Collection
Expand All @@ -28,9 +28,6 @@ def collect(pattern: Pattern, bound_vars: set[str]) -> None:
else:
occurrences[pattern.name] = [pattern]

elif isinstance(pattern, Assoc):
collect(pattern.app, bound_vars)

elif isinstance(pattern, MLQuant):
new_bound_vars = {pattern.var.name}.union(bound_vars)
collect(pattern.pattern, new_bound_vars)
Expand Down
30 changes: 15 additions & 15 deletions pyk/src/pyk/kore/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,36 @@ def match_dv(pattern: Pattern, sort: Sort | None = None) -> DV:
return dv


def match_symbol(app: App, symbol: str) -> None:
if app.symbol != symbol:
raise ValueError(f'Expected symbol {symbol}, found: {app.symbol}')
def match_symbol(actual: str, expected: str) -> None:
if actual != expected:
raise ValueError(f'Expected symbol {expected}, found: {actual}')


def match_app(pattern: Pattern, symbol: str | None = None) -> App:
app = check_type(pattern, App)
if symbol is not None:
match_symbol(app, symbol)
match_symbol(app.symbol, symbol)
return app


def match_inj(pattern: Pattern) -> App:
return match_app(pattern, 'inj')


def match_left_assoc(pattern: Pattern) -> LeftAssoc:
return check_type(pattern, LeftAssoc)
def match_left_assoc(pattern: Pattern, symbol: str | None = None) -> LeftAssoc:
assoc = check_type(pattern, LeftAssoc)
if symbol is not None:
match_symbol(assoc.symbol, symbol)
return assoc


def match_list(pattern: Pattern) -> tuple[Pattern, ...]:
if type(pattern) is App:
match_app(pattern, "Lbl'Stop'List")
return ()

assoc = match_left_assoc(pattern)
cons = match_app(assoc.app, "Lbl'Unds'List'Unds'")
items = (match_app(arg, 'LblListItem') for arg in cons.args)
assoc = match_left_assoc(pattern, "Lbl'Unds'List'Unds'")
items = (match_app(arg, 'LblListItem') for arg in assoc.args)
elems = (item.args[0] for item in items)
return tuple(elems)

Expand All @@ -62,9 +64,8 @@ def match_set(pattern: Pattern) -> tuple[Pattern, ...]:
match_app(pattern, "Lbl'Stop'Set")
return ()

assoc = match_left_assoc(pattern)
cons = match_app(assoc.app, "Lbl'Unds'Set'Unds'")
items = (match_app(arg, 'LblSetItem') for arg in cons.args)
assoc = match_left_assoc(pattern, "Lbl'Unds'Set'Unds'")
items = (match_app(arg, 'LblSetItem') for arg in assoc.args)
elems = (item.args[0] for item in items)
return tuple(elems)

Expand All @@ -79,9 +80,8 @@ def match_map(pattern: Pattern, *, cell: str | None = None) -> tuple[tuple[Patte
match_app(pattern, stop_symbol)
return ()

assoc = match_left_assoc(pattern)
cons = match_app(assoc.app, cons_symbol)
items = (match_app(arg, item_symbol) for arg in cons.args)
assoc = match_left_assoc(pattern, cons_symbol)
items = (match_app(arg, item_symbol) for arg in assoc.args)
entries = ((item.args[0], item.args[1]) for item in items)
return tuple(entries)

Expand Down
2 changes: 1 addition & 1 deletion pyk/src/pyk/kore/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def _assoc(self, token_type: TokenType, cls: type[AS]) -> AS:
self._match(TokenType.LPAREN)
app = self.app()
self._match(TokenType.RPAREN)
return cls(app) # type: ignore
return cls(app.symbol, app.sorts, app.args) # type: ignore

def left_assoc(self) -> LeftAssoc:
return self._assoc(TokenType.ML_LEFT_ASSOC, LeftAssoc)
Expand Down
28 changes: 12 additions & 16 deletions pyk/src/pyk/kore/prelude.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,10 @@ def kseq(kitems: Iterable[Pattern], *, dotvar: EVar | None = None) -> Pattern:
if len(args) == 1:
return tail

app = App(KSEQ, (), args)

if len(args) == 2:
return app
return App(KSEQ, (), args)

return RightAssoc(app)
return RightAssoc(KSEQ, (), args)


def k_config_var(var: str) -> DV:
Expand Down Expand Up @@ -224,7 +222,7 @@ def top_cell_initializer(config: Mapping[str, Pattern]) -> App:
def list_pattern(*args: Pattern) -> Pattern:
if not args:
return STOP_LIST
return LeftAssoc(App(LBL_LIST, args=(App(LBL_LIST_ITEM, args=(arg,)) for arg in args)))
return LeftAssoc(LBL_LIST, args=(App(LBL_LIST_ITEM, args=(arg,)) for arg in args))


STOP_SET: Final = App("Lbl'Stop'Set")
Expand All @@ -235,7 +233,7 @@ def list_pattern(*args: Pattern) -> Pattern:
def set_pattern(*args: Pattern) -> Pattern:
if not args:
return STOP_SET
return LeftAssoc(App(LBL_SET, args=(App(LBL_SET_ITEM, args=(arg,)) for arg in args)))
return LeftAssoc(LBL_SET, args=(App(LBL_SET_ITEM, args=(arg,)) for arg in args))


STOP_MAP: Final = App("Lbl'Stop'Map")
Expand All @@ -249,7 +247,7 @@ def map_pattern(*args: tuple[Pattern, Pattern], cell: str | None = None) -> Patt

cons_symbol = SymbolId(f"Lbl'Unds'{cell}Map'Unds'") if cell else LBL_MAP
item_symbol = SymbolId(f'Lbl{cell}MapItem') if cell else LBL_MAP_ITEM
return LeftAssoc(App(cons_symbol, args=(App(item_symbol, args=arg) for arg in args)))
return LeftAssoc(cons_symbol, args=(App(item_symbol, args=arg) for arg in args))


STOP_RANGEMAP: Final = App("Lbl'Stop'RangeMap")
Expand All @@ -263,10 +261,8 @@ def rangemap_pattern(*args: tuple[tuple[Pattern, Pattern], Pattern]) -> Pattern:
return STOP_RANGEMAP

return LeftAssoc(
App(
LBL_RANGEMAP,
args=(App(LBL_RANGEMAP_ITEM, args=(App(LBL_RANGEMAP_RANGE, args=arg[0]), arg[1])) for arg in args),
)
LBL_RANGEMAP,
args=(App(LBL_RANGEMAP_ITEM, args=(App(LBL_RANGEMAP_RANGE, args=arg[0]), arg[1])) for arg in args),
)


Expand Down Expand Up @@ -306,7 +302,7 @@ def json_object(pattern: Pattern) -> App:


def jsons(patterns: Iterable[Pattern]) -> RightAssoc:
return RightAssoc(App(LBL_JSONS, (), chain(patterns, (STOP_JSONS,))))
return RightAssoc(LBL_JSONS, (), chain(patterns, (STOP_JSONS,)))


def json_key(key: str) -> App:
Expand Down Expand Up @@ -370,21 +366,21 @@ def kore_to_json(pattern: Pattern) -> Any:
def _iter_json_list(app: App) -> Iterator[Pattern]:
from . import match as km

km.match_symbol(app, LBL_JSON_LIST.value)
km.match_app(app, LBL_JSON_LIST.value)
curr = km.match_app(app.args[0])
while curr.symbol != STOP_JSONS.symbol:
km.match_symbol(curr, LBL_JSONS.value)
km.match_app(curr, LBL_JSONS.value)
yield curr.args[0]
curr = km.match_app(curr.args[1])


def _iter_json_object(app: App) -> Iterator[tuple[str, Pattern]]:
from . import match as km

km.match_symbol(app, LBL_JSON_OBJECT.value)
km.match_app(app, LBL_JSON_OBJECT.value)
curr = km.match_app(app.args[0])
while curr.symbol != STOP_JSONS.symbol:
km.match_symbol(curr, LBL_JSONS.value)
km.match_app(curr, LBL_JSONS.value)
entry = km.match_app(curr.args[0], LBL_JSON_ENTRY.value)
key = km.kore_str(km.inj(entry.args[0]))
value = entry.args[1]
Expand Down
Loading

0 comments on commit 4bb1bf1

Please sign in to comment.