Skip to content
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

Fix _method_to_cfg #109

Merged
merged 10 commits into from
Oct 24, 2023
Merged
Changes from 9 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
15 changes: 8 additions & 7 deletions src/kontrol/prove.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,17 @@ def _method_to_cfg(
new_node_ids = []

if setup_proof:
init_node_id = setup_proof.kcfg.node(setup_proof.init).id

cfg = setup_proof.kcfg
final_states = [cover.source for cover in cfg.covers(target_id=setup_proof.target)]
cfg.remove_node(setup_proof.target)
if len(setup_proof.pending) > 0:
if setup_proof.pending:
raise RuntimeError(
f'Initial state proof {setup_proof.id} for {contract.name}.{method.signature} still has pending branches.'
)
if len(final_states) < 1:

init_node_id = setup_proof.init

cfg = KCFG.from_dict(setup_proof.kcfg.to_dict()) # Copy KCFG
final_states = [cover.source for cover in cfg.covers(target_id=setup_proof.target)]
cfg.remove_node(setup_proof.target)
if not final_states:
_LOGGER.warning(
f'Initial state proof {setup_proof.id} for {contract.name}.{method.signature} has no passing branches to build on. Method will not be executed.'
)
Expand Down
Loading