Skip to content

Conversation

@dwightguth
Copy link
Contributor

@dwightguth dwightguth commented Apr 17, 2019

This is the first of three pull requests relating to an improvement to the llvm backend.

@dwightguth dwightguth requested review from ehildenb and traiansf April 17, 2019 18:01
@dwightguth dwightguth merged commit c2174bc into master Apr 17, 2019
@dwightguth dwightguth deleted the scala1 branch April 17, 2019 20:49
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants