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

Node attribute storage in nodes #1002

Merged
merged 85 commits into from
Mar 28, 2024
Merged

Node attribute storage in nodes #1002

merged 85 commits into from
Mar 28, 2024

Conversation

nwatson22
Copy link
Contributor

@nwatson22 nwatson22 commented Mar 19, 2024

Fixes: #965

Stores node attributes terminal,stuck, and vacuous in nodes rather than in KCFG or KCFGExploration.

  • adds attr field to KCFG.Node
  • adds enums NodeAttr (base), KCFGNodeAttr, and KCFGExplorationNodeAttr
  • adds add_attr, remove_attr, and discard_attr to kcfg for updating the attrs of a given node, which replaces the node with a new one, since nodes are immutable.
  • replace_node now takes a node. let_node is now for updating specific fields of nodes.
  • Checks terminal, stuck, and vacuous by reference to the attributes on the node
  • Removes separate terminal, stuck and vacuous lists.
  • from_dict and to_dict on Node and KCFG updated to store relevant attributes in the node dicts. KCFGStore translates to and from the existing on-disk format.
  • Tests in test_proof.py previously using read_proof and write_proof are now using read_proof_data and write_proof_data, since the older way of reading and writing does not use the KCFGStore and relies on KCFG.to_dict directly, without the translation.

@nwatson22 nwatson22 self-assigned this Mar 19, 2024
@nwatson22 nwatson22 added the enhancement New feature or request label Mar 19, 2024
@nwatson22 nwatson22 linked an issue Mar 19, 2024 that may be closed by this pull request
@ehildenb
Copy link
Member

We should be able to delete this line after this change, and tests still pass:

self._terminal = self._terminal.difference(self.kcfg._deleted_nodes)

@ehildenb
Copy link
Member

Correct, a node attribute shouldn't change depending on where in the KCFG it is or what the user has marked, it sohuld only by what is true for that node in isolation.

@rv-jenkins rv-jenkins merged commit 1efacbc into master Mar 28, 2024
@rv-jenkins rv-jenkins deleted the noah/node-attributes branch March 28, 2024 21:03
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 9, 2024
Fixes: runtimeverification/pyk#965

Stores node attributes `terminal`,`stuck`, and `vacuous` in nodes rather
than in KCFG or KCFGExploration.
- adds `attr` field to KCFG.Node
- adds enums `NodeAttr` (base), `KCFGNodeAttr`, and
`KCFGExplorationNodeAttr`
- adds `add_attr`, `remove_attr`, and `discard_attr` to kcfg for
updating the attrs of a given node, which replaces the node with a new
one, since nodes are immutable.
- `replace_node` now takes a node. `let_node` is now for updating
specific fields of nodes.
- Checks `terminal`, `stuck`, and `vacuous` by reference to the
attributes on the node
- Removes separate `terminal`, `stuck` and `vacuous` lists.
- `from_dict` and `to_dict` on `Node` and `KCFG` updated to store
relevant attributes in the node dicts. `KCFGStore` translates to and
from the existing on-disk format.
- Tests in `test_proof.py` previously using `read_proof` and
`write_proof` are now using `read_proof_data` and `write_proof_data`,
since the older way of reading and writing does not use the `KCFGStore`
and relies on `KCFG.to_dict` directly, without the translation.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 9, 2024
Fixes: runtimeverification/pyk#965

Stores node attributes `terminal`,`stuck`, and `vacuous` in nodes rather
than in KCFG or KCFGExploration.
- adds `attr` field to KCFG.Node
- adds enums `NodeAttr` (base), `KCFGNodeAttr`, and
`KCFGExplorationNodeAttr`
- adds `add_attr`, `remove_attr`, and `discard_attr` to kcfg for
updating the attrs of a given node, which replaces the node with a new
one, since nodes are immutable.
- `replace_node` now takes a node. `let_node` is now for updating
specific fields of nodes.
- Checks `terminal`, `stuck`, and `vacuous` by reference to the
attributes on the node
- Removes separate `terminal`, `stuck` and `vacuous` lists.
- `from_dict` and `to_dict` on `Node` and `KCFG` updated to store
relevant attributes in the node dicts. `KCFGStore` translates to and
from the existing on-disk format.
- Tests in `test_proof.py` previously using `read_proof` and
`write_proof` are now using `read_proof_data` and `write_proof_data`,
since the older way of reading and writing does not use the `KCFGStore`
and relies on `KCFG.to_dict` directly, without the translation.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 10, 2024
Fixes: runtimeverification/pyk#965

Stores node attributes `terminal`,`stuck`, and `vacuous` in nodes rather
than in KCFG or KCFGExploration.
- adds `attr` field to KCFG.Node
- adds enums `NodeAttr` (base), `KCFGNodeAttr`, and
`KCFGExplorationNodeAttr`
- adds `add_attr`, `remove_attr`, and `discard_attr` to kcfg for
updating the attrs of a given node, which replaces the node with a new
one, since nodes are immutable.
- `replace_node` now takes a node. `let_node` is now for updating
specific fields of nodes.
- Checks `terminal`, `stuck`, and `vacuous` by reference to the
attributes on the node
- Removes separate `terminal`, `stuck` and `vacuous` lists.
- `from_dict` and `to_dict` on `Node` and `KCFG` updated to store
relevant attributes in the node dicts. `KCFGStore` translates to and
from the existing on-disk format.
- Tests in `test_proof.py` previously using `read_proof` and
`write_proof` are now using `read_proof_data` and `write_proof_data`,
since the older way of reading and writing does not use the `KCFGStore`
and relies on `KCFG.to_dict` directly, without the translation.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 10, 2024
Fixes: runtimeverification/pyk#965

Stores node attributes `terminal`,`stuck`, and `vacuous` in nodes rather
than in KCFG or KCFGExploration.
- adds `attr` field to KCFG.Node
- adds enums `NodeAttr` (base), `KCFGNodeAttr`, and
`KCFGExplorationNodeAttr`
- adds `add_attr`, `remove_attr`, and `discard_attr` to kcfg for
updating the attrs of a given node, which replaces the node with a new
one, since nodes are immutable.
- `replace_node` now takes a node. `let_node` is now for updating
specific fields of nodes.
- Checks `terminal`, `stuck`, and `vacuous` by reference to the
attributes on the node
- Removes separate `terminal`, `stuck` and `vacuous` lists.
- `from_dict` and `to_dict` on `Node` and `KCFG` updated to store
relevant attributes in the node dicts. `KCFGStore` translates to and
from the existing on-disk format.
- Tests in `test_proof.py` previously using `read_proof` and
`write_proof` are now using `read_proof_data` and `write_proof_data`,
since the older way of reading and writing does not use the `KCFGStore`
and relies on `KCFG.to_dict` directly, without the translation.

---------

Co-authored-by: devops <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store node attributes directly on the node
5 participants