-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
next_states = tuple( | ||
( | ||
CTerm.from_kast(self.kore_to_kast(ns.kore)), | ||
self.kore_to_kast(ns.rule_predicate) if ns.rule_predicate is not None else None, | ||
) | ||
for ns in resp_next_states | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propagating the branching constraints along with the CTerm
s, perhaps there is a better way of doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CTermExecute
could be abstract with concrete subclasses for branching vs non-branching steps.
# _branches = self.kcfg_semantics.extract_branches(_cterm) | ||
# branches = [] | ||
# for constraint in _branches: | ||
# kast = mlAnd(list(_cterm.constraints) + [constraint]) | ||
# kast, _ = self.cterm_symbolic.kast_simplify(kast) | ||
# if not CTerm._is_bottom(kast): | ||
# branches.append(constraint) | ||
# if len(branches) > 1: | ||
# constraint_strs = [self.pretty_print(bc) for bc in branches] | ||
# log(f'{len(branches)} branches using heuristics: {node_id} -> {constraint_strs}') | ||
# return Branch(branches, heuristic=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be necessary anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the comments, we can bring that code back at any time from the version history.
constraint_strs = [self.pretty_print(bc) for bc in branches] | ||
log(f'{len(branches)} branches using heuristics: {node_id} -> {constraint_strs}') | ||
assert len(next_cterms_with_branch_constraints) > 1 | ||
if all(branch_constraint for _, branch_constraint in next_cterms_with_branch_constraints): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be too strong, but feels safe at the moment.
As a first example, I have that the KCFG of the CSE execution of
which is not great, and in which simultaneous applications of multiple specifications of the underlying functions cause non-deterministic branching, to this
where there are no non-deterministic branches and all branching conditions are present. |
In a recent proof, also, the two branchings below were characterised as non-deterministic, but their constraints are now fully captured:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general.
Before merging this, we should understand a bit better what guarantees the backends provide (#1073), and do extensive testing in evm-semantics
, kontrol
and ongoing engagements.
next_states = tuple( | ||
( | ||
CTerm.from_kast(self.kore_to_kast(ns.kore)), | ||
self.kore_to_kast(ns.rule_predicate) if ns.rule_predicate is not None else None, | ||
) | ||
for ns in resp_next_states | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CTermExecute
could be abstract with concrete subclasses for branching vs non-branching steps.
# _branches = self.kcfg_semantics.extract_branches(_cterm) | ||
# branches = [] | ||
# for constraint in _branches: | ||
# kast = mlAnd(list(_cterm.constraints) + [constraint]) | ||
# kast, _ = self.cterm_symbolic.kast_simplify(kast) | ||
# if not CTerm._is_bottom(kast): | ||
# branches.append(constraint) | ||
# if len(branches) > 1: | ||
# constraint_strs = [self.pretty_print(bc) for bc in branches] | ||
# log(f'{len(branches)} branches using heuristics: {node_id} -> {constraint_strs}') | ||
# return Branch(branches, heuristic=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the comments, we can bring that code back at any time from the version history.
Transfer of: runtimeverification/pyk#1072 This PR that uses branching information from the backend (for which support was enabled by runtimeverification/pyk#942) to simplify the branching mechanism, potentially making the `extract_branches` obsolete and only creating `NDBranches` in the presence of true non-determinism. I've done a preliminary testing in Kontrol, more info in comments below. --------- Co-authored-by: Petar Maksimovic <[email protected]> Co-authored-by: Petar Maksimović <[email protected]>
This is a very draft PR that uses branching information from the backend (for which support was enabled by #942) to simplify the branching mechanism, potentially making the
extract_branches
obsolete and only creatingNDBranches
in the presence of true non-determinism.I've done a preliminary testing in Kontrol, more info in comments below.