@@ -40,7 +40,7 @@ class Proof(Generic[PS, SR]):
40
40
:param SR: Step result: data produced by executing a PS with `Prover.step_proof` used to update the `Proof`
41
41
"""
42
42
43
- _PROOF_TYPES : Final = {'APRProof' , 'EqualityProof' , 'RefutationProof' }
43
+ _PROOF_TYPES : Final = {'APRProof' , 'EqualityProof' , 'RefutationProof' , 'MultiProof' }
44
44
45
45
id : str
46
46
proof_dir : Path | None
@@ -247,6 +247,7 @@ def read_proof(cls: type[Proof], id: str, proof_dir: Path) -> Proof:
247
247
def read_proof_data (proof_dir : Path , id : str ) -> Proof :
248
248
# these local imports allow us to call .to_dict() based on the proof type we read from JSON
249
249
from .implies import EqualityProof , RefutationProof # noqa
250
+ from .proof import MultiProof # noqa
250
251
from .reachability import APRProof # noqa
251
252
252
253
proof_path = proof_dir / id / 'proof.json'
@@ -303,12 +304,18 @@ def can_progress(self) -> bool:
303
304
def commit (self , result : None ) -> None : ...
304
305
305
306
@classmethod
306
- def from_dict (cls : type [Proof ], dct : Mapping [str , Any ], proof_dir : Path | None = None ) -> Proof :
307
+ def from_dict (cls : type [Proof ], dct : Mapping [str , Any ], proof_dir : Path | None = None ) -> MultiProof :
307
308
_id = dct ['id' ]
308
309
_subproof_ids = dct ['subproof_ids' ]
309
310
_admitted = dct ['admitted' ]
310
311
return MultiProof (id = _id , subproof_ids = _subproof_ids , proof_dir = proof_dir , admitted = _admitted )
311
312
313
+ @property
314
+ def dict (self ) -> dict [str , Any ]:
315
+ dct = super ().dict
316
+ dct ['type' ] = 'MultiProof'
317
+ return dct
318
+
312
319
def get_steps (self ) -> Iterable [None ]:
313
320
"""Return all currently available steps associated with this Proof. Should not modify `self`."""
314
321
return []
@@ -317,6 +324,15 @@ def get_steps(self) -> Iterable[None]:
317
324
def own_status (self ) -> ProofStatus :
318
325
return ProofStatus .PASSED
319
326
327
+ @staticmethod
328
+ def read_proof_data (proof_dir : Path , id : str ) -> MultiProof :
329
+ proof_path = proof_dir / id / 'proof.json'
330
+ if Proof .proof_data_exists (id , proof_dir ):
331
+ proof_dict = json .loads (proof_path .read_text ())
332
+ return MultiProof .from_dict (proof_dict , proof_dir )
333
+
334
+ raise ValueError (f'Could not load Proof from file { id } : { proof_path } ' )
335
+
320
336
def write_proof_data (self ) -> None :
321
337
super ().write_proof_data ()
322
338
if not self .proof_dir :
0 commit comments