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

Fix bugs in node refutation functionality #877

Merged
merged 7 commits into from
Feb 14, 2024
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
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
project = 'pyk'
author = 'Runtime Verification, Inc'
copyright = '2024, Runtime Verification, Inc'
version = '0.1.622'
release = '0.1.622'
version = '0.1.623'
release = '0.1.623'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.622
0.1.623
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pyk"
version = "0.1.622"
version = "0.1.623"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
12 changes: 10 additions & 2 deletions src/pyk/proof/reachability.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ def from_dict(cls: type[APRProof], dct: Mapping[str, Any], proof_dir: Path | Non
subproof_ids = dct['subproof_ids'] if 'subproof_ids' in dct else []
node_refutations: dict[int, str] = {}
if 'node_refutation' in dct:
node_refutations = {kcfg._resolve(node_id): proof_id for (node_id, proof_id) in dct['node_refutations']}
node_refutations = {
kcfg._resolve(int(node_id)): proof_id for node_id, proof_id in dct['node_refutations'].items()
}
if 'logs' in dct:
logs = {int(k): tuple(LogEntry.from_dict(l) for l in ls) for k, ls in dct['logs'].items()}
else:
Expand Down Expand Up @@ -404,7 +406,9 @@ def read_proof_data(proof_dir: Path, id: str) -> APRProof:
terminal = proof_dict['terminal']
logs = {int(k): tuple(LogEntry.from_dict(l) for l in ls) for k, ls in proof_dict['logs'].items()}
subproof_ids = proof_dict['subproof_ids']
node_refutations = {kcfg._resolve(node_id): proof_id for (node_id, proof_id) in proof_dict['node_refutations']}
node_refutations = {
kcfg._resolve(int(node_id)): proof_id for node_id, proof_id in proof_dict['node_refutations'].items()
}

return APRProof(
id=id,
Expand Down Expand Up @@ -474,6 +478,10 @@ def unrefute_node(self, node: KCFG.Node) -> None:
_LOGGER.info(f'Disabled refutation of node {node.id}.')

def construct_node_refutation(self, node: KCFG.Node) -> RefutationProof | None: # TODO put into prover class
if len(self.kcfg.successors(node.id)) > 0:
_LOGGER.error(f'Cannot refute node {node.id} that already has successors')
return None

path = single(self.kcfg.paths_between(source_id=self.init, target_id=node.id))
branches_on_path = list(filter(lambda x: type(x) is KCFG.Split or type(x) is KCFG.NDBranch, reversed(path)))
if len(branches_on_path) == 0:
Expand Down
2 changes: 2 additions & 0 deletions src/pyk/proof/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def node_attrs(self, kcfg: KCFG, node: KCFG.Node) -> list[str]:
attrs.append('target')
if self.proof.is_pending(node.id):
attrs.append('pending')
if self.proof.is_refuted(node.id):
attrs.append('refuted')
if self.proof.is_terminal(node.id):
attrs.append('terminal')
if 'stuck' in attrs:
Expand Down