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

Overhaul ImpliesProof class hierarchy #878

Merged
merged 12 commits into from
Feb 14, 2024
Merged

Conversation

ehildenb
Copy link
Member

@ehildenb ehildenb commented Feb 14, 2024

While working on #875, I found many places in ImpliesProof class hierarchy that we can make things simpler. In general:

  • mlEqualsTrue and mlEqualsFalse are given sorts they can use for the outer sort of the equality.
  • The various renaming of antecedent and consequent in subclasses are removed.
  • The ImpliesProof gets its own dict and from_dict methods, and the subclasses and reuse it.
  • advance_proof no longer needs to be overloaded in the subclasses.
  • Various really simple setter methods are removed in favor of direct setting of paramaters in the proofs.
  • The now-useless classes EqualityProver and RefutationProver are removed.

Essentially, after this, EqualityProof and RefutationProof are just "smart constructors" for ImpliesProof, with different names for the antecedent/consequent and specific ways of constructing the antecedent/consequent. The key difference here is that EqualityProver and RefutationProver were tracking their own proof state before (by storing and manipulating _antecedent_kast and _consequent_kast themselves directly), and now they rely only on the *Proof objects to store state.

@ehildenb
Copy link
Member Author

Changes to KEVM to make it build successfully with this change are in this branch: runtimeverification/evm-semantics#2294

@ehildenb ehildenb force-pushed the equality-proof-overhaul branch from 7108637 to c01aeff Compare February 14, 2024 20:00
@ehildenb ehildenb marked this pull request as ready for review February 14, 2024 20:18
@ehildenb ehildenb requested a review from nwatson22 February 14, 2024 20:18
@rv-jenkins rv-jenkins merged commit 9453af7 into master Feb 14, 2024
@rv-jenkins rv-jenkins deleted the equality-proof-overhaul branch February 14, 2024 21:43
ehildenb added a commit that referenced this pull request Feb 15, 2024
~Blocked on: #878

In an attempt to make the prover interfaces simpler, we are making it so
that `advance_proof` is a generic method among all `*Prover` classes.
This will allow us to have a generic way to call subproofs and advance
them, then call superproofs and advance them, which will allow
simplifying some downstream logic a bit.

- Makes it so that `mlEqualsTrue` and `mlEqualsFalse` can take sort
arguments for their outer sort.
- Moves all the `APRProof` specific arguments of
`APRProof.advance_proof` to the constructor instead.
- Adds an `abstractmethod Proof.step_proof(...)` which should take one
step of executing a proof to completion.
- Adds an `abstractmethod Proof.can_progress` which lets you know if
it's possible to make progress on a given proof.
- Implements generic `Proof.advance_proof(...)` which handles calling
`step_proof` in a loop until either `max_iterations` is reached, the
proof can no longer progress, or if `fail_fast` trigger hits. It also
handles writing proof data each iteration.
- Adjusts all the tests to the new interface.

---------

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

In an attempt to make the prover interfaces simpler, we are making it so
that `advance_proof` is a generic method among all `*Prover` classes.
This will allow us to have a generic way to call subproofs and advance
them, then call superproofs and advance them, which will allow
simplifying some downstream logic a bit.

- Makes it so that `mlEqualsTrue` and `mlEqualsFalse` can take sort
arguments for their outer sort.
- Moves all the `APRProof` specific arguments of
`APRProof.advance_proof` to the constructor instead.
- Adds an `abstractmethod Proof.step_proof(...)` which should take one
step of executing a proof to completion.
- Adds an `abstractmethod Proof.can_progress` which lets you know if
it's possible to make progress on a given proof.
- Implements generic `Proof.advance_proof(...)` which handles calling
`step_proof` in a loop until either `max_iterations` is reached, the
proof can no longer progress, or if `fail_fast` trigger hits. It also
handles writing proof data each iteration.
- Adjusts all the tests to the new interface.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 9, 2024
While working on runtimeverification/pyk#875, I
found many places in `ImpliesProof` class hierarchy that we can make
things simpler. In general:

- `mlEqualsTrue` and `mlEqualsFalse` are given sorts they can use for
the outer sort of the equality.
- The various renaming of `antecedent` and `consequent` in subclasses
are removed.
- The `ImpliesProof` gets its own `dict` and `from_dict` methods, and
the subclasses and reuse it.
- `advance_proof` no longer needs to be overloaded in the subclasses.
- Various really simple setter methods are removed in favor of direct
setting of paramaters in the proofs.
- The now-useless classes `EqualityProver` and `RefutationProver` are
removed.

Essentially, after this, `EqualityProof` and `RefutationProof` are just
"smart constructors" for `ImpliesProof`, with different names for the
antecedent/consequent and specific ways of constructing the
antecedent/consequent. The key difference here is that `EqualityProver`
and `RefutationProver` were tracking their own proof state before (by
storing and manipulating `_antecedent_kast` and `_consequent_kast`
themselves directly), and now they rely only on the `*Proof` objects to
store state.

---------

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

In an attempt to make the prover interfaces simpler, we are making it so
that `advance_proof` is a generic method among all `*Prover` classes.
This will allow us to have a generic way to call subproofs and advance
them, then call superproofs and advance them, which will allow
simplifying some downstream logic a bit.

- Makes it so that `mlEqualsTrue` and `mlEqualsFalse` can take sort
arguments for their outer sort.
- Moves all the `APRProof` specific arguments of
`APRProof.advance_proof` to the constructor instead.
- Adds an `abstractmethod Proof.step_proof(...)` which should take one
step of executing a proof to completion.
- Adds an `abstractmethod Proof.can_progress` which lets you know if
it's possible to make progress on a given proof.
- Implements generic `Proof.advance_proof(...)` which handles calling
`step_proof` in a loop until either `max_iterations` is reached, the
proof can no longer progress, or if `fail_fast` trigger hits. It also
handles writing proof data each iteration.
- Adjusts all the tests to the new interface.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 9, 2024
While working on runtimeverification/pyk#875, I
found many places in `ImpliesProof` class hierarchy that we can make
things simpler. In general:

- `mlEqualsTrue` and `mlEqualsFalse` are given sorts they can use for
the outer sort of the equality.
- The various renaming of `antecedent` and `consequent` in subclasses
are removed.
- The `ImpliesProof` gets its own `dict` and `from_dict` methods, and
the subclasses and reuse it.
- `advance_proof` no longer needs to be overloaded in the subclasses.
- Various really simple setter methods are removed in favor of direct
setting of paramaters in the proofs.
- The now-useless classes `EqualityProver` and `RefutationProver` are
removed.

Essentially, after this, `EqualityProof` and `RefutationProof` are just
"smart constructors" for `ImpliesProof`, with different names for the
antecedent/consequent and specific ways of constructing the
antecedent/consequent. The key difference here is that `EqualityProver`
and `RefutationProver` were tracking their own proof state before (by
storing and manipulating `_antecedent_kast` and `_consequent_kast`
themselves directly), and now they rely only on the `*Proof` objects to
store state.

---------

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

In an attempt to make the prover interfaces simpler, we are making it so
that `advance_proof` is a generic method among all `*Prover` classes.
This will allow us to have a generic way to call subproofs and advance
them, then call superproofs and advance them, which will allow
simplifying some downstream logic a bit.

- Makes it so that `mlEqualsTrue` and `mlEqualsFalse` can take sort
arguments for their outer sort.
- Moves all the `APRProof` specific arguments of
`APRProof.advance_proof` to the constructor instead.
- Adds an `abstractmethod Proof.step_proof(...)` which should take one
step of executing a proof to completion.
- Adds an `abstractmethod Proof.can_progress` which lets you know if
it's possible to make progress on a given proof.
- Implements generic `Proof.advance_proof(...)` which handles calling
`step_proof` in a loop until either `max_iterations` is reached, the
proof can no longer progress, or if `fail_fast` trigger hits. It also
handles writing proof data each iteration.
- Adjusts all the tests to the new interface.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 10, 2024
While working on runtimeverification/pyk#875, I
found many places in `ImpliesProof` class hierarchy that we can make
things simpler. In general:

- `mlEqualsTrue` and `mlEqualsFalse` are given sorts they can use for
the outer sort of the equality.
- The various renaming of `antecedent` and `consequent` in subclasses
are removed.
- The `ImpliesProof` gets its own `dict` and `from_dict` methods, and
the subclasses and reuse it.
- `advance_proof` no longer needs to be overloaded in the subclasses.
- Various really simple setter methods are removed in favor of direct
setting of paramaters in the proofs.
- The now-useless classes `EqualityProver` and `RefutationProver` are
removed.

Essentially, after this, `EqualityProof` and `RefutationProof` are just
"smart constructors" for `ImpliesProof`, with different names for the
antecedent/consequent and specific ways of constructing the
antecedent/consequent. The key difference here is that `EqualityProver`
and `RefutationProver` were tracking their own proof state before (by
storing and manipulating `_antecedent_kast` and `_consequent_kast`
themselves directly), and now they rely only on the `*Proof` objects to
store state.

---------

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

In an attempt to make the prover interfaces simpler, we are making it so
that `advance_proof` is a generic method among all `*Prover` classes.
This will allow us to have a generic way to call subproofs and advance
them, then call superproofs and advance them, which will allow
simplifying some downstream logic a bit.

- Makes it so that `mlEqualsTrue` and `mlEqualsFalse` can take sort
arguments for their outer sort.
- Moves all the `APRProof` specific arguments of
`APRProof.advance_proof` to the constructor instead.
- Adds an `abstractmethod Proof.step_proof(...)` which should take one
step of executing a proof to completion.
- Adds an `abstractmethod Proof.can_progress` which lets you know if
it's possible to make progress on a given proof.
- Implements generic `Proof.advance_proof(...)` which handles calling
`step_proof` in a loop until either `max_iterations` is reached, the
proof can no longer progress, or if `fail_fast` trigger hits. It also
handles writing proof data each iteration.
- Adjusts all the tests to the new interface.

---------

Co-authored-by: devops <[email protected]>
Baltoli pushed a commit to runtimeverification/k that referenced this pull request Apr 10, 2024
While working on runtimeverification/pyk#875, I
found many places in `ImpliesProof` class hierarchy that we can make
things simpler. In general:

- `mlEqualsTrue` and `mlEqualsFalse` are given sorts they can use for
the outer sort of the equality.
- The various renaming of `antecedent` and `consequent` in subclasses
are removed.
- The `ImpliesProof` gets its own `dict` and `from_dict` methods, and
the subclasses and reuse it.
- `advance_proof` no longer needs to be overloaded in the subclasses.
- Various really simple setter methods are removed in favor of direct
setting of paramaters in the proofs.
- The now-useless classes `EqualityProver` and `RefutationProver` are
removed.

Essentially, after this, `EqualityProof` and `RefutationProof` are just
"smart constructors" for `ImpliesProof`, with different names for the
antecedent/consequent and specific ways of constructing the
antecedent/consequent. The key difference here is that `EqualityProver`
and `RefutationProver` were tracking their own proof state before (by
storing and manipulating `_antecedent_kast` and `_consequent_kast`
themselves directly), and now they rely only on the `*Proof` objects to
store state.

---------

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

In an attempt to make the prover interfaces simpler, we are making it so
that `advance_proof` is a generic method among all `*Prover` classes.
This will allow us to have a generic way to call subproofs and advance
them, then call superproofs and advance them, which will allow
simplifying some downstream logic a bit.

- Makes it so that `mlEqualsTrue` and `mlEqualsFalse` can take sort
arguments for their outer sort.
- Moves all the `APRProof` specific arguments of
`APRProof.advance_proof` to the constructor instead.
- Adds an `abstractmethod Proof.step_proof(...)` which should take one
step of executing a proof to completion.
- Adds an `abstractmethod Proof.can_progress` which lets you know if
it's possible to make progress on a given proof.
- Implements generic `Proof.advance_proof(...)` which handles calling
`step_proof` in a loop until either `max_iterations` is reached, the
proof can no longer progress, or if `fail_fast` trigger hits. It also
handles writing proof data each iteration.
- Adjusts all the tests to the new interface.

---------

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

Successfully merging this pull request may close these issues.

4 participants