Skip to content

Commit

Permalink
adding option to Prover.advance_proof
Browse files Browse the repository at this point in the history
  • Loading branch information
PetarMax committed Aug 6, 2024
1 parent 8e988f0 commit 7c2b0ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyk/src/pyk/proof/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def advance_proof(
max_iterations: int | None = None,
fail_fast: bool = False,
callback: Callable[[P], None] = (lambda x: None),
maintenance_rate: int = 1,
) -> None:
"""Advance a proof.
Expand All @@ -516,6 +517,7 @@ def advance_proof(
fail_fast: If the proof is failing after finishing a step,
halt execution even if there are still available steps.
callback: Callable to run in between each completed step, useful for getting real-time information about the proof.
maintenance_rate: Number of iterations between proof maintenance (writing to disk and executing callback).
"""
iterations = 0
_LOGGER.info(f'Initializing proof: {proof.id}')
Expand All @@ -536,7 +538,9 @@ def advance_proof(
results = self.step_proof(step)
for result in results:
proof.commit(result)
proof.write_proof_data()
callback(proof)
if iterations % maintenance_rate == 0:
proof.write_proof_data()
callback(proof)

if proof.failed:
proof.failure_info = self.failure_info(proof)

0 comments on commit 7c2b0ca

Please sign in to comment.