-
Notifications
You must be signed in to change notification settings - Fork 160
a few helper methods for the scala kore code #413
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
traiansf
approved these changes
Apr 17, 2019
rv-jenkins
added a commit
that referenced
this pull request
Jul 8, 2021
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
Part of #471, #413 As I was working towards the goal of better BMC prover visualization, it's clear we need: - Proof specific viewers, - Fixing the BMC checker off-by-one-error, and - Trimming of the structure stored in the KCFG (removing the notion of `target`, `expanded`). This makes the first least controversial steps towards those changes, including: - Method `KCFG.replace_node` now replaces the node in place, so that the node identifier doesn't change. This is possible now because the node identifier is not tied to the contents of the node, and makes tracking things like `init/target/terminal/bounded` sets externally in the `*Proof` classes more feasible even if nodes are being simplified for example. - The notion of a unique `target` and `init` is added to the `APRProof` class, in preparation for removing the `target` notion from `KCFG`. - Add fields `target` and `init` to `APRProof` state, which explicitly call out the unique init/target states. - Move `KCFGExplore.target_subsume => APRProver._check_subsumed`, which makes use of the explicitly called out `init/target` states. - Moves `KCFG.path_constraints => APRProof.path_constraints`, because it relies on a unique target node. - The notion of `stuck` nodes is moved into `APRProof` state as `terminal` nodes. - The field `_terminal_nodes` is added to `APRProof` state. - `APRProver._check_terminal` directly manipulates this set instead of `stuck/expanded` set. - The notion of `APRProof.terminal` is added, which returns the set of nodes in the `APRProof._terminal_nodes` set. - The notion of `APRProof.pending` is added, which returns the set of `KCFG.frontier` nodes that are _not_ in the proofs `terminal_nodes` set. - The `APRProof.terminal` and `APRProof.pending` sets are used for determining `APRProof.status`. - The `APRBMCProof.bounded` set is added, which similarly tracks the bounded set of nodes directly. This is used in computing `APRBMCProof.pending` and `APRBMCProof.status`. - Methods `APRProof.from_claim` and `APRBMCProof.from_claim_with_bmc_depth` are added for reading these proof types directly from claims (and tests are updated appropriately). - Method `APRBMCProof.dict` is refactored to use `APRProof.dict` directly first, then add the needed information to it. - Methods `KCFG.node_attrs => KCFGShow.node_attrs` and `KCFG.node_short_info => KCFGShow.node_short_info` are moved to localize them to use site. - Adds `Proof.json` as shortcut for `json.dumps(Proof.dict)`. - For each of the `integration/kcfg` tests that do `APRProof`s, adds logging at `info` level for the generated KCFG, to make debugging them easier by just throwing a flag. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
Fixes: #413 This PR introduces proof-specific viewers, and does a few refactors to make that possible: - Helpers are added to `KCFG` for turning into modules, including: - `KCFG.Split.covers` which returns each individual split as a reverse cover. - `KCFG.NDBranch.edges`, which returns each non-deterministic step as an edge. - `KCFG.Edge.to_rule`, which converts an edge into a K rule (or claim). - Small refactorings to `KCFGShow` structure: - `KCFGShow.dot` returns a `Digraph` directly (for further manipulation) instead of a list of `str`. - `KCFGShow.to_module` which returns a `KFlatModule` is factored out and used directly in `KCFGShow.show`. - Helper methods embedded in other methods in `KCFGShow` are factored out directly to staticmethods of `KCFGShow` so they can be reused easily. - We just treat `stuck` as a node attribute now, printed at the beginning of a node, instead of printing it a second time following a node too. - The way that `KCFGShow` calculates node attributes is adjusted and factor out. - A new class `NodePrinter` is factored out, which by default just uses the attributes the `KCFG` knows about for printing out nodes. - That class is extended by `APRProofNodePrinter` and `APRBMCProofNodePrinter`, which add the additional information about the nodes `pending,terminal,bounded` state. If a node is `terminal` or `bounded`, then the `stuck` attribute is no longer printed for less confusion. - `KCFGShow` now takes an optional `*NodePrinter` as an argument (or builds on itself), so instantiating that class is how you can customize how nodes are displayed in text. - The tests are adapted to use the more specific `*NodePrinter` classes, and the output checked that the more specific node information is indeed being included. - Adds helper predicates `APRProof.is_{pending,terminal}` and `APRProof.is_bounded`, which should behave better in case there are qualified node ids passed in. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
Part of #471, #413 As I was working towards the goal of better BMC prover visualization, it's clear we need: - Proof specific viewers, - Fixing the BMC checker off-by-one-error, and - Trimming of the structure stored in the KCFG (removing the notion of `target`, `expanded`). This makes the first least controversial steps towards those changes, including: - Method `KCFG.replace_node` now replaces the node in place, so that the node identifier doesn't change. This is possible now because the node identifier is not tied to the contents of the node, and makes tracking things like `init/target/terminal/bounded` sets externally in the `*Proof` classes more feasible even if nodes are being simplified for example. - The notion of a unique `target` and `init` is added to the `APRProof` class, in preparation for removing the `target` notion from `KCFG`. - Add fields `target` and `init` to `APRProof` state, which explicitly call out the unique init/target states. - Move `KCFGExplore.target_subsume => APRProver._check_subsumed`, which makes use of the explicitly called out `init/target` states. - Moves `KCFG.path_constraints => APRProof.path_constraints`, because it relies on a unique target node. - The notion of `stuck` nodes is moved into `APRProof` state as `terminal` nodes. - The field `_terminal_nodes` is added to `APRProof` state. - `APRProver._check_terminal` directly manipulates this set instead of `stuck/expanded` set. - The notion of `APRProof.terminal` is added, which returns the set of nodes in the `APRProof._terminal_nodes` set. - The notion of `APRProof.pending` is added, which returns the set of `KCFG.frontier` nodes that are _not_ in the proofs `terminal_nodes` set. - The `APRProof.terminal` and `APRProof.pending` sets are used for determining `APRProof.status`. - The `APRBMCProof.bounded` set is added, which similarly tracks the bounded set of nodes directly. This is used in computing `APRBMCProof.pending` and `APRBMCProof.status`. - Methods `APRProof.from_claim` and `APRBMCProof.from_claim_with_bmc_depth` are added for reading these proof types directly from claims (and tests are updated appropriately). - Method `APRBMCProof.dict` is refactored to use `APRProof.dict` directly first, then add the needed information to it. - Methods `KCFG.node_attrs => KCFGShow.node_attrs` and `KCFG.node_short_info => KCFGShow.node_short_info` are moved to localize them to use site. - Adds `Proof.json` as shortcut for `json.dumps(Proof.dict)`. - For each of the `integration/kcfg` tests that do `APRProof`s, adds logging at `info` level for the generated KCFG, to make debugging them easier by just throwing a flag. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
Fixes: #413 This PR introduces proof-specific viewers, and does a few refactors to make that possible: - Helpers are added to `KCFG` for turning into modules, including: - `KCFG.Split.covers` which returns each individual split as a reverse cover. - `KCFG.NDBranch.edges`, which returns each non-deterministic step as an edge. - `KCFG.Edge.to_rule`, which converts an edge into a K rule (or claim). - Small refactorings to `KCFGShow` structure: - `KCFGShow.dot` returns a `Digraph` directly (for further manipulation) instead of a list of `str`. - `KCFGShow.to_module` which returns a `KFlatModule` is factored out and used directly in `KCFGShow.show`. - Helper methods embedded in other methods in `KCFGShow` are factored out directly to staticmethods of `KCFGShow` so they can be reused easily. - We just treat `stuck` as a node attribute now, printed at the beginning of a node, instead of printing it a second time following a node too. - The way that `KCFGShow` calculates node attributes is adjusted and factor out. - A new class `NodePrinter` is factored out, which by default just uses the attributes the `KCFG` knows about for printing out nodes. - That class is extended by `APRProofNodePrinter` and `APRBMCProofNodePrinter`, which add the additional information about the nodes `pending,terminal,bounded` state. If a node is `terminal` or `bounded`, then the `stuck` attribute is no longer printed for less confusion. - `KCFGShow` now takes an optional `*NodePrinter` as an argument (or builds on itself), so instantiating that class is how you can customize how nodes are displayed in text. - The tests are adapted to use the more specific `*NodePrinter` classes, and the output checked that the more specific node information is indeed being included. - Adds helper predicates `APRProof.is_{pending,terminal}` and `APRProof.is_bounded`, which should behave better in case there are qualified node ids passed in. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
…n/pyk#486) Part of #471, #413 As I was working towards the goal of better BMC prover visualization, it's clear we need: - Proof specific viewers, - Fixing the BMC checker off-by-one-error, and - Trimming of the structure stored in the KCFG (removing the notion of `target`, `expanded`). This makes the first least controversial steps towards those changes, including: - Method `KCFG.replace_node` now replaces the node in place, so that the node identifier doesn't change. This is possible now because the node identifier is not tied to the contents of the node, and makes tracking things like `init/target/terminal/bounded` sets externally in the `*Proof` classes more feasible even if nodes are being simplified for example. - The notion of a unique `target` and `init` is added to the `APRProof` class, in preparation for removing the `target` notion from `KCFG`. - Add fields `target` and `init` to `APRProof` state, which explicitly call out the unique init/target states. - Move `KCFGExplore.target_subsume => APRProver._check_subsumed`, which makes use of the explicitly called out `init/target` states. - Moves `KCFG.path_constraints => APRProof.path_constraints`, because it relies on a unique target node. - The notion of `stuck` nodes is moved into `APRProof` state as `terminal` nodes. - The field `_terminal_nodes` is added to `APRProof` state. - `APRProver._check_terminal` directly manipulates this set instead of `stuck/expanded` set. - The notion of `APRProof.terminal` is added, which returns the set of nodes in the `APRProof._terminal_nodes` set. - The notion of `APRProof.pending` is added, which returns the set of `KCFG.frontier` nodes that are _not_ in the proofs `terminal_nodes` set. - The `APRProof.terminal` and `APRProof.pending` sets are used for determining `APRProof.status`. - The `APRBMCProof.bounded` set is added, which similarly tracks the bounded set of nodes directly. This is used in computing `APRBMCProof.pending` and `APRBMCProof.status`. - Methods `APRProof.from_claim` and `APRBMCProof.from_claim_with_bmc_depth` are added for reading these proof types directly from claims (and tests are updated appropriately). - Method `APRBMCProof.dict` is refactored to use `APRProof.dict` directly first, then add the needed information to it. - Methods `KCFG.node_attrs => KCFGShow.node_attrs` and `KCFG.node_short_info => KCFGShow.node_short_info` are moved to localize them to use site. - Adds `Proof.json` as shortcut for `json.dumps(Proof.dict)`. - For each of the `integration/kcfg` tests that do `APRProof`s, adds logging at `info` level for the generated KCFG, to make debugging them easier by just throwing a flag. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
) Fixes: #413 This PR introduces proof-specific viewers, and does a few refactors to make that possible: - Helpers are added to `KCFG` for turning into modules, including: - `KCFG.Split.covers` which returns each individual split as a reverse cover. - `KCFG.NDBranch.edges`, which returns each non-deterministic step as an edge. - `KCFG.Edge.to_rule`, which converts an edge into a K rule (or claim). - Small refactorings to `KCFGShow` structure: - `KCFGShow.dot` returns a `Digraph` directly (for further manipulation) instead of a list of `str`. - `KCFGShow.to_module` which returns a `KFlatModule` is factored out and used directly in `KCFGShow.show`. - Helper methods embedded in other methods in `KCFGShow` are factored out directly to staticmethods of `KCFGShow` so they can be reused easily. - We just treat `stuck` as a node attribute now, printed at the beginning of a node, instead of printing it a second time following a node too. - The way that `KCFGShow` calculates node attributes is adjusted and factor out. - A new class `NodePrinter` is factored out, which by default just uses the attributes the `KCFG` knows about for printing out nodes. - That class is extended by `APRProofNodePrinter` and `APRBMCProofNodePrinter`, which add the additional information about the nodes `pending,terminal,bounded` state. If a node is `terminal` or `bounded`, then the `stuck` attribute is no longer printed for less confusion. - `KCFGShow` now takes an optional `*NodePrinter` as an argument (or builds on itself), so instantiating that class is how you can customize how nodes are displayed in text. - The tests are adapted to use the more specific `*NodePrinter` classes, and the output checked that the more specific node information is indeed being included. - Adds helper predicates `APRProof.is_{pending,terminal}` and `APRProof.is_bounded`, which should behave better in case there are qualified node ids passed in. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
…n/pyk#486) Part of #471, #413 As I was working towards the goal of better BMC prover visualization, it's clear we need: - Proof specific viewers, - Fixing the BMC checker off-by-one-error, and - Trimming of the structure stored in the KCFG (removing the notion of `target`, `expanded`). This makes the first least controversial steps towards those changes, including: - Method `KCFG.replace_node` now replaces the node in place, so that the node identifier doesn't change. This is possible now because the node identifier is not tied to the contents of the node, and makes tracking things like `init/target/terminal/bounded` sets externally in the `*Proof` classes more feasible even if nodes are being simplified for example. - The notion of a unique `target` and `init` is added to the `APRProof` class, in preparation for removing the `target` notion from `KCFG`. - Add fields `target` and `init` to `APRProof` state, which explicitly call out the unique init/target states. - Move `KCFGExplore.target_subsume => APRProver._check_subsumed`, which makes use of the explicitly called out `init/target` states. - Moves `KCFG.path_constraints => APRProof.path_constraints`, because it relies on a unique target node. - The notion of `stuck` nodes is moved into `APRProof` state as `terminal` nodes. - The field `_terminal_nodes` is added to `APRProof` state. - `APRProver._check_terminal` directly manipulates this set instead of `stuck/expanded` set. - The notion of `APRProof.terminal` is added, which returns the set of nodes in the `APRProof._terminal_nodes` set. - The notion of `APRProof.pending` is added, which returns the set of `KCFG.frontier` nodes that are _not_ in the proofs `terminal_nodes` set. - The `APRProof.terminal` and `APRProof.pending` sets are used for determining `APRProof.status`. - The `APRBMCProof.bounded` set is added, which similarly tracks the bounded set of nodes directly. This is used in computing `APRBMCProof.pending` and `APRBMCProof.status`. - Methods `APRProof.from_claim` and `APRBMCProof.from_claim_with_bmc_depth` are added for reading these proof types directly from claims (and tests are updated appropriately). - Method `APRBMCProof.dict` is refactored to use `APRProof.dict` directly first, then add the needed information to it. - Methods `KCFG.node_attrs => KCFGShow.node_attrs` and `KCFG.node_short_info => KCFGShow.node_short_info` are moved to localize them to use site. - Adds `Proof.json` as shortcut for `json.dumps(Proof.dict)`. - For each of the `integration/kcfg` tests that do `APRProof`s, adds logging at `info` level for the generated KCFG, to make debugging them easier by just throwing a flag. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 9, 2024
) Fixes: #413 This PR introduces proof-specific viewers, and does a few refactors to make that possible: - Helpers are added to `KCFG` for turning into modules, including: - `KCFG.Split.covers` which returns each individual split as a reverse cover. - `KCFG.NDBranch.edges`, which returns each non-deterministic step as an edge. - `KCFG.Edge.to_rule`, which converts an edge into a K rule (or claim). - Small refactorings to `KCFGShow` structure: - `KCFGShow.dot` returns a `Digraph` directly (for further manipulation) instead of a list of `str`. - `KCFGShow.to_module` which returns a `KFlatModule` is factored out and used directly in `KCFGShow.show`. - Helper methods embedded in other methods in `KCFGShow` are factored out directly to staticmethods of `KCFGShow` so they can be reused easily. - We just treat `stuck` as a node attribute now, printed at the beginning of a node, instead of printing it a second time following a node too. - The way that `KCFGShow` calculates node attributes is adjusted and factor out. - A new class `NodePrinter` is factored out, which by default just uses the attributes the `KCFG` knows about for printing out nodes. - That class is extended by `APRProofNodePrinter` and `APRBMCProofNodePrinter`, which add the additional information about the nodes `pending,terminal,bounded` state. If a node is `terminal` or `bounded`, then the `stuck` attribute is no longer printed for less confusion. - `KCFGShow` now takes an optional `*NodePrinter` as an argument (or builds on itself), so instantiating that class is how you can customize how nodes are displayed in text. - The tests are adapted to use the more specific `*NodePrinter` classes, and the output checked that the more specific node information is indeed being included. - Adds helper predicates `APRProof.is_{pending,terminal}` and `APRProof.is_bounded`, which should behave better in case there are qualified node ids passed in. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 10, 2024
…n/pyk#486) Part of #471, #413 As I was working towards the goal of better BMC prover visualization, it's clear we need: - Proof specific viewers, - Fixing the BMC checker off-by-one-error, and - Trimming of the structure stored in the KCFG (removing the notion of `target`, `expanded`). This makes the first least controversial steps towards those changes, including: - Method `KCFG.replace_node` now replaces the node in place, so that the node identifier doesn't change. This is possible now because the node identifier is not tied to the contents of the node, and makes tracking things like `init/target/terminal/bounded` sets externally in the `*Proof` classes more feasible even if nodes are being simplified for example. - The notion of a unique `target` and `init` is added to the `APRProof` class, in preparation for removing the `target` notion from `KCFG`. - Add fields `target` and `init` to `APRProof` state, which explicitly call out the unique init/target states. - Move `KCFGExplore.target_subsume => APRProver._check_subsumed`, which makes use of the explicitly called out `init/target` states. - Moves `KCFG.path_constraints => APRProof.path_constraints`, because it relies on a unique target node. - The notion of `stuck` nodes is moved into `APRProof` state as `terminal` nodes. - The field `_terminal_nodes` is added to `APRProof` state. - `APRProver._check_terminal` directly manipulates this set instead of `stuck/expanded` set. - The notion of `APRProof.terminal` is added, which returns the set of nodes in the `APRProof._terminal_nodes` set. - The notion of `APRProof.pending` is added, which returns the set of `KCFG.frontier` nodes that are _not_ in the proofs `terminal_nodes` set. - The `APRProof.terminal` and `APRProof.pending` sets are used for determining `APRProof.status`. - The `APRBMCProof.bounded` set is added, which similarly tracks the bounded set of nodes directly. This is used in computing `APRBMCProof.pending` and `APRBMCProof.status`. - Methods `APRProof.from_claim` and `APRBMCProof.from_claim_with_bmc_depth` are added for reading these proof types directly from claims (and tests are updated appropriately). - Method `APRBMCProof.dict` is refactored to use `APRProof.dict` directly first, then add the needed information to it. - Methods `KCFG.node_attrs => KCFGShow.node_attrs` and `KCFG.node_short_info => KCFGShow.node_short_info` are moved to localize them to use site. - Adds `Proof.json` as shortcut for `json.dumps(Proof.dict)`. - For each of the `integration/kcfg` tests that do `APRProof`s, adds logging at `info` level for the generated KCFG, to make debugging them easier by just throwing a flag. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 10, 2024
) Fixes: #413 This PR introduces proof-specific viewers, and does a few refactors to make that possible: - Helpers are added to `KCFG` for turning into modules, including: - `KCFG.Split.covers` which returns each individual split as a reverse cover. - `KCFG.NDBranch.edges`, which returns each non-deterministic step as an edge. - `KCFG.Edge.to_rule`, which converts an edge into a K rule (or claim). - Small refactorings to `KCFGShow` structure: - `KCFGShow.dot` returns a `Digraph` directly (for further manipulation) instead of a list of `str`. - `KCFGShow.to_module` which returns a `KFlatModule` is factored out and used directly in `KCFGShow.show`. - Helper methods embedded in other methods in `KCFGShow` are factored out directly to staticmethods of `KCFGShow` so they can be reused easily. - We just treat `stuck` as a node attribute now, printed at the beginning of a node, instead of printing it a second time following a node too. - The way that `KCFGShow` calculates node attributes is adjusted and factor out. - A new class `NodePrinter` is factored out, which by default just uses the attributes the `KCFG` knows about for printing out nodes. - That class is extended by `APRProofNodePrinter` and `APRBMCProofNodePrinter`, which add the additional information about the nodes `pending,terminal,bounded` state. If a node is `terminal` or `bounded`, then the `stuck` attribute is no longer printed for less confusion. - `KCFGShow` now takes an optional `*NodePrinter` as an argument (or builds on itself), so instantiating that class is how you can customize how nodes are displayed in text. - The tests are adapted to use the more specific `*NodePrinter` classes, and the output checked that the more specific node information is indeed being included. - Adds helper predicates `APRProof.is_{pending,terminal}` and `APRProof.is_bounded`, which should behave better in case there are qualified node ids passed in. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 10, 2024
…n/pyk#486) Part of #471, #413 As I was working towards the goal of better BMC prover visualization, it's clear we need: - Proof specific viewers, - Fixing the BMC checker off-by-one-error, and - Trimming of the structure stored in the KCFG (removing the notion of `target`, `expanded`). This makes the first least controversial steps towards those changes, including: - Method `KCFG.replace_node` now replaces the node in place, so that the node identifier doesn't change. This is possible now because the node identifier is not tied to the contents of the node, and makes tracking things like `init/target/terminal/bounded` sets externally in the `*Proof` classes more feasible even if nodes are being simplified for example. - The notion of a unique `target` and `init` is added to the `APRProof` class, in preparation for removing the `target` notion from `KCFG`. - Add fields `target` and `init` to `APRProof` state, which explicitly call out the unique init/target states. - Move `KCFGExplore.target_subsume => APRProver._check_subsumed`, which makes use of the explicitly called out `init/target` states. - Moves `KCFG.path_constraints => APRProof.path_constraints`, because it relies on a unique target node. - The notion of `stuck` nodes is moved into `APRProof` state as `terminal` nodes. - The field `_terminal_nodes` is added to `APRProof` state. - `APRProver._check_terminal` directly manipulates this set instead of `stuck/expanded` set. - The notion of `APRProof.terminal` is added, which returns the set of nodes in the `APRProof._terminal_nodes` set. - The notion of `APRProof.pending` is added, which returns the set of `KCFG.frontier` nodes that are _not_ in the proofs `terminal_nodes` set. - The `APRProof.terminal` and `APRProof.pending` sets are used for determining `APRProof.status`. - The `APRBMCProof.bounded` set is added, which similarly tracks the bounded set of nodes directly. This is used in computing `APRBMCProof.pending` and `APRBMCProof.status`. - Methods `APRProof.from_claim` and `APRBMCProof.from_claim_with_bmc_depth` are added for reading these proof types directly from claims (and tests are updated appropriately). - Method `APRBMCProof.dict` is refactored to use `APRProof.dict` directly first, then add the needed information to it. - Methods `KCFG.node_attrs => KCFGShow.node_attrs` and `KCFG.node_short_info => KCFGShow.node_short_info` are moved to localize them to use site. - Adds `Proof.json` as shortcut for `json.dumps(Proof.dict)`. - For each of the `integration/kcfg` tests that do `APRProof`s, adds logging at `info` level for the generated KCFG, to make debugging them easier by just throwing a flag. --------- Co-authored-by: devops <[email protected]>
Baltoli
pushed a commit
that referenced
this pull request
Apr 10, 2024
) Fixes: #413 This PR introduces proof-specific viewers, and does a few refactors to make that possible: - Helpers are added to `KCFG` for turning into modules, including: - `KCFG.Split.covers` which returns each individual split as a reverse cover. - `KCFG.NDBranch.edges`, which returns each non-deterministic step as an edge. - `KCFG.Edge.to_rule`, which converts an edge into a K rule (or claim). - Small refactorings to `KCFGShow` structure: - `KCFGShow.dot` returns a `Digraph` directly (for further manipulation) instead of a list of `str`. - `KCFGShow.to_module` which returns a `KFlatModule` is factored out and used directly in `KCFGShow.show`. - Helper methods embedded in other methods in `KCFGShow` are factored out directly to staticmethods of `KCFGShow` so they can be reused easily. - We just treat `stuck` as a node attribute now, printed at the beginning of a node, instead of printing it a second time following a node too. - The way that `KCFGShow` calculates node attributes is adjusted and factor out. - A new class `NodePrinter` is factored out, which by default just uses the attributes the `KCFG` knows about for printing out nodes. - That class is extended by `APRProofNodePrinter` and `APRBMCProofNodePrinter`, which add the additional information about the nodes `pending,terminal,bounded` state. If a node is `terminal` or `bounded`, then the `stuck` attribute is no longer printed for less confusion. - `KCFGShow` now takes an optional `*NodePrinter` as an argument (or builds on itself), so instantiating that class is how you can customize how nodes are displayed in text. - The tests are adapted to use the more specific `*NodePrinter` classes, and the output checked that the more specific node information is indeed being included. - Adds helper predicates `APRProof.is_{pending,terminal}` and `APRProof.is_bounded`, which should behave better in case there are qualified node ids passed in. --------- Co-authored-by: devops <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first of three pull requests relating to an improvement to the llvm backend.