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

Commit f1a22bb

Browse files
PetarMaxrv-auditor
andauthored
Automating implication-every-block reasoning (#580)
This PR removes the need for the `implication-every-block` parameter in APR-related provers. The reasoning is as follows: - if the `target` node is a `terminal` node, then subsumption into target should be checked only for `terminal` nodes (equivalent to previously setting `implication-every-block` to `false`) - otherwise (and this is possible, for example, for internal functions), subsumption into target is checked on every block ((equivalent to previously setting `implication-every-block` to `true`). I am assuming that this change requires changes to KEVM so that the `implication-every-block` parameter is removed. --------- Co-authored-by: devops <[email protected]>
1 parent d5e39a8 commit f1a22bb

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.402
1+
0.1.403

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.402"
7+
version = "0.1.403"
88
description = ""
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

src/pyk/proof/reachability.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ class APRProver(Prover):
557557
dependencies_module_name: str
558558
circularities_module_name: str
559559

560+
_target_is_terminal: bool
561+
560562
def __init__(
561563
self,
562564
proof: APRProof,
@@ -591,6 +593,10 @@ def __init__(
591593
priority=1,
592594
)
593595

596+
self._target_is_terminal = kcfg_explore.kcfg_semantics.is_terminal(
597+
self.proof.kcfg.node(self.proof.target).cterm
598+
)
599+
594600
def nonzero_depth(self, node: KCFG.Node) -> bool:
595601
return not self.proof.kcfg.zero_depth_between(self.proof.init, node.id)
596602

@@ -620,13 +626,12 @@ def advance_pending_node(
620626
execute_depth: int | None = None,
621627
cut_point_rules: Iterable[str] = (),
622628
terminal_rules: Iterable[str] = (),
623-
implication_every_block: bool = True,
624629
) -> None:
625630
if self._check_terminal(node):
626631
_ = self._check_subsume(node)
627632
return
628633

629-
if implication_every_block:
634+
if not self._target_is_terminal:
630635
if self._check_subsume(node):
631636
return
632637

@@ -647,7 +652,6 @@ def advance_proof(
647652
execute_depth: int | None = None,
648653
cut_point_rules: Iterable[str] = (),
649654
terminal_rules: Iterable[str] = (),
650-
implication_every_block: bool = True,
651655
fail_fast: bool = False,
652656
) -> KCFG:
653657
iterations = 0
@@ -671,7 +675,6 @@ def advance_proof(
671675
execute_depth=execute_depth,
672676
cut_point_rules=cut_point_rules,
673677
terminal_rules=terminal_rules,
674-
implication_every_block=implication_every_block,
675678
)
676679

677680
self.proof.write_proof_data()
@@ -855,7 +858,6 @@ def advance_pending_node(
855858
execute_depth: int | None = None,
856859
cut_point_rules: Iterable[str] = (),
857860
terminal_rules: Iterable[str] = (),
858-
implication_every_block: bool = True,
859861
) -> None:
860862
if node.id not in self._checked_nodes:
861863
_LOGGER.info(f'Checking bmc depth for node {self.proof.id}: {node.id}')
@@ -881,7 +883,6 @@ def advance_pending_node(
881883
execute_depth=execute_depth,
882884
cut_point_rules=cut_point_rules,
883885
terminal_rules=terminal_rules,
884-
implication_every_block=implication_every_block,
885886
)
886887

887888

0 commit comments

Comments
 (0)