Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit a5ba1c7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into more-kcfg-logs
2 parents 19f1d10 + afb5306 commit a5ba1c7

File tree

11 files changed

+370
-18
lines changed

11 files changed

+370
-18
lines changed

deps/k_release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.1.94
1+
6.1.96

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
project = 'pyk'
1010
author = 'Runtime Verification, Inc'
1111
copyright = '2024, Runtime Verification, Inc'
12-
version = '0.1.594'
13-
release = '0.1.594'
12+
version = '0.1.595'
13+
release = '0.1.595'
1414

1515
# -- General configuration ---------------------------------------------------
1616
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.594
1+
0.1.595

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "pyk"
7-
version = "0.1.594"
7+
version = "0.1.595"
88
description = ""
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

src/pyk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
from typing import Final
77

88

9-
K_VERSION: Final = '6.1.94'
9+
K_VERSION: Final = '6.1.96'

src/pyk/kore/prelude.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def le_int(left: Pattern, right: Pattern) -> Pattern:
142142
SORT_K: Final = SortApp('SortK')
143143
SORT_K_ITEM: Final = SortApp('SortKItem')
144144
SORT_K_CONFIG_VAR: Final = SortApp('SortKConfigVar')
145+
SORT_GENERATED_TOP_CELL: Final = SortApp('SortGeneratedTopCell')
145146

146147
LBL_INIT_GENERATED_TOP_CELL: Final = SymbolId('LblinitGeneratedTopCell')
147148
LBL_GENERATED_TOP: Final = SymbolId("Lbl'-LT-'generatedTop'-GT-'")

src/pyk/kore/rpc.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,37 @@ def __init__(self, error: str, context: Iterable[str]):
370370

371371
@final
372372
@dataclass
373-
class ModuleError(KoreClientError):
373+
class UnknownModuleError(KoreClientError):
374374
module_name: str
375375

376376
def __init__(self, module_name: str):
377377
self.module_name = module_name
378378
super().__init__(f'Could not find module: {self.module_name}')
379379

380380

381+
@final
382+
@dataclass
383+
class InvalidModuleError(KoreClientError):
384+
error: str
385+
context: tuple[str, ...] | None
386+
387+
def __init__(self, error: str, context: Iterable[str] | None):
388+
self.error = error
389+
self.context = tuple(context) if context else None
390+
context_str = ' Context: ' + ' ;; '.join(self.context) if self.context else ''
391+
super().__init__(f'Could not verify module: {self.error}{context_str}')
392+
393+
394+
@final
395+
@dataclass
396+
class DuplicateModuleError(KoreClientError):
397+
module_name: str
398+
399+
def __init__(self, module_name: str):
400+
self.module_name = module_name
401+
super().__init__(f'Duplicate module name: {self.module_name}')
402+
403+
381404
@final
382405
@dataclass
383406
class ImplicationError(KoreClientError):
@@ -875,9 +898,13 @@ def _error(self, err: JsonRpcError) -> KoreClientError:
875898
case 2:
876899
return PatternError(error=err.data['error'], context=err.data['context'])
877900
case 3:
878-
return ModuleError(module_name=err.data)
901+
return UnknownModuleError(module_name=err.data)
879902
case 4:
880903
return ImplicationError(error=err.data['error'], context=err.data['context'])
904+
case 8:
905+
return InvalidModuleError(error=err.data['error'], context=err.data.get('context'))
906+
case 9:
907+
return DuplicateModuleError(module_name=err.data)
881908
case _:
882909
return DefaultError(message=err.message, code=err.code, data=err.data)
883910

@@ -981,8 +1008,14 @@ def get_model(self, pattern: Pattern, module_name: str | None = None) -> GetMode
9811008
result = self._request('get-model', **params)
9821009
return GetModelResult.from_dict(result)
9831010

984-
def add_module(self, module: Module) -> str:
985-
result = self._request('add-module', module=module.text)
1011+
def add_module(self, module: Module, *, name_as_id: bool | None = None) -> str:
1012+
params = filter_none(
1013+
{
1014+
'module': module.text,
1015+
'name-as-id': name_as_id,
1016+
}
1017+
)
1018+
result = self._request('add-module', **params)
9861019
return result['module']
9871020

9881021

src/pyk/proof/reachability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def _inject_module(module_name: str, import_name: str, sentences: list[KRuleLike
643643
_kore_module = kflatmodule_to_kore(
644644
self.kcfg_explore.kprint.definition, self.kcfg_explore.kprint.kompiled_kore, _module
645645
)
646-
self.kcfg_explore._kore_client.add_module(_kore_module)
646+
self.kcfg_explore._kore_client.add_module(_kore_module, name_as_id=True)
647647

648648
super().__init__(kcfg_explore)
649649
self.proof = proof
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module INT-CONFIG-SYNTAX
2+
imports INT-SYNTAX
3+
endmodule
4+
5+
module INT-CONFIG
6+
imports INT-CONFIG-SYNTAX
7+
configuration <k> $PGM:Int </k>
8+
endmodule

0 commit comments

Comments
 (0)