Skip to content

Commit

Permalink
simplify the implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevengre committed Sep 9, 2024
1 parent 5b51ba0 commit ca72beb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pyk/src/pyk/kcfg/kcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,16 +1044,15 @@ def create_split_by_nodes(self, source_id: NodeIdLike, target_ids: Iterable[Node
"""Create a split without crafting a CSubst."""
source = self.node(source_id)
targets = [self.node(nid) for nid in target_ids]
substs = [source.cterm.config.match(target.cterm.config) for target in targets]
csubsts: list[CSubst] = []
if None in substs:
return None
for subst, target in zip(substs, targets, strict=True):
constraints: list[KInner] = []
for c in target.cterm.constraints:
if c not in source.cterm.constraints:
constraints.append(c)

for target in targets:
subst = source.cterm.config.match(target.cterm.config)
if subst is None:
return None
constraints = [c for c in target.cterm.constraints if c not in source.cterm.constraints]
csubsts.append(CSubst(subst, constraints))

return self.create_split(source.id, zip(target_ids, csubsts, strict=True))

def ndbranches(self, *, source_id: NodeIdLike | None = None, target_id: NodeIdLike | None = None) -> list[NDBranch]:
Expand Down

0 comments on commit ca72beb

Please sign in to comment.