Skip to content

Commit

Permalink
Fix failure info not being set in advance_proof on done proof (runtim…
Browse files Browse the repository at this point in the history
…everification/pyk#951)

runtimeverification/kontrol#413

---------

Co-authored-by: devops <[email protected]>
Co-authored-by: Palina Tolmach <[email protected]>
  • Loading branch information
3 people authored and Baltoli committed Apr 9, 2024
1 parent f498206 commit 22ac497
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pyk/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.686'
release = '0.1.686'
version = '0.1.687'
release = '0.1.687'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion pyk/package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.686
0.1.687
2 changes: 1 addition & 1 deletion pyk/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.686"
version = "0.1.687"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions pyk/src/pyk/proof/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,6 @@ def advance_proof(self, max_iterations: int | None = None, fail_fast: bool = Fal
results = self.step_proof()
for result in results:
self.proof.commit(result)
if self.proof.failed:
self.proof.failure_info = self.failure_info()
self.proof.write_proof_data()
if self.proof.failed:
self.proof.failure_info = self.failure_info()
47 changes: 47 additions & 0 deletions pyk/src/tests/integration/proof/test_imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,53 @@ def test_failure_info(

assert actual_path_conds == expected_path_conds

@pytest.mark.parametrize(
'test_id,spec_file,spec_module,claim_id,expected_pending,expected_failing,path_conditions',
FAILURE_INFO_TEST_DATA,
ids=[test_id for test_id, *_ in FAILURE_INFO_TEST_DATA],
)
def test_failure_info_recomputed_on_proof_reinit(
self,
kprove: KProve,
kcfg_explore: KCFGExplore,
test_id: str,
spec_file: str,
spec_module: str,
claim_id: str,
expected_pending: int,
expected_failing: int,
path_conditions: tuple[KInner],
proof_dir: Path,
) -> None:
claim = single(
kprove.get_claims(Path(spec_file), spec_module_name=spec_module, claim_labels=[f'{spec_module}.{claim_id}'])
)

proof = APRProof.from_claim(kprove.definition, claim, logs={}, proof_dir=proof_dir)
proof_id = proof.id
kcfg_explore.simplify(proof.kcfg, {})
prover = APRProver(proof, kcfg_explore=kcfg_explore)
prover.advance_proof()

# reload proof from disk
proof = APRProof.read_proof_data(proof_dir, proof_id)
prover = APRProver(proof, kcfg_explore=kcfg_explore)
prover.advance_proof()

failure_info = proof.failure_info
assert isinstance(failure_info, APRFailureInfo)

actual_pending = len(failure_info.pending_nodes)
actual_failing = len(failure_info.failing_nodes)

assert expected_pending == actual_pending
assert expected_failing == actual_failing

actual_path_conds = set({path_condition for _, path_condition in failure_info.path_conditions.items()})
expected_path_conds = set({kprove.pretty_print(condition) for condition in path_conditions})

assert actual_path_conds == expected_path_conds

def test_apr_prove_read_write_node_data(
self,
kprove: KProve,
Expand Down

0 comments on commit 22ac497

Please sign in to comment.