@@ -80,13 +80,17 @@ def test_simple_lean4(self):
8080 retrieval_strategy = ProofEnvReRankStrategy .NO_RE_RANK
8181 env = ProofEnv ("test_lean4" , proof_exec_callback , theorem_name , retrieval_strategy = retrieval_strategy , max_proof_depth = 10 , always_retrieve_thms = always_retrieve_thms )
8282 proof_steps = [
83+ '-- TODO' ,
8384 'apply And.intro' ,
8485 'exact hp' ,
8586 'apply And.intro' ,
87+ '--TODO' ,
88+ '-- This is just some extra comment' ,
8689 'exact hq' ,
8790 'exact hp'
8891 ]
8992 with env :
93+ proof_was_finished = False
9094 for proof_step in proof_steps :
9195 state , _ , next_state , _ , done , info = env .step (ProofAction (
9296 ProofAction .ActionType .RUN_TACTIC ,
@@ -99,6 +103,7 @@ def test_simple_lean4(self):
99103 print ('-' * 30 )
100104 if done :
101105 print ("Proof Finished!!" )
106+ proof_was_finished = True
102107 else :
103108 s1 : ProofState = state
104109 s2 : ProofState = next_state
@@ -120,6 +125,7 @@ def test_simple_lean4(self):
120125 print ('|- ' , end = '' )
121126 print (goal .goal )
122127 print (f"=" * 30 )
128+ assert proof_was_finished , "Proof was not finished"
123129
124130 def test_lean4_backtracking (self ):
125131 from itp_interface .rl .proof_state import ProofState
@@ -156,6 +162,7 @@ def test_lean4_backtracking(self):
156162 ]
157163 with env :
158164 prev_state = env .state
165+ proof_was_finished = False
159166 for idx , proof_step in enumerate (proof_steps ):
160167 if idx > 0 and random .random () <= 0.5 :
161168 print (f"Backtracking at step { idx + 1 } i.e. { proof_step } " )
@@ -179,6 +186,8 @@ def test_lean4_backtracking(self):
179186 prev_state = state
180187 if done :
181188 print ("Proof Finished!!" )
189+ proof_was_finished = True
190+ assert proof_was_finished , "Proof was not finished"
182191
183192 def test_simple_coq (self ):
184193 from itp_interface .rl .proof_state import ProofState
@@ -286,6 +295,7 @@ def test_simple_lean_calc(self):
286295"_ = (n + 1)*(n + 1) := by \n rw [Nat.right_distrib n 1 (n + 1)]"
287296]
288297 with env :
298+ proof_was_finished = False
289299 for proof_step in proof_steps :
290300 state , _ , next_state , _ , done , info = env .step (ProofAction (
291301 ProofAction .ActionType .RUN_TACTIC ,
@@ -310,6 +320,7 @@ def test_simple_lean_calc(self):
310320 print (f"Action: { proof_step } " )
311321 print (f"=" * 30 )
312322 print ("Proof Finished!!" )
323+ proof_was_finished = True
313324 else :
314325 s1 : ProofState = state
315326 s2 : ProofState = next_state
@@ -331,6 +342,7 @@ def test_simple_lean_calc(self):
331342 print ('|- ' , end = '' )
332343 print (goal .goal )
333344 print (f"=" * 30 )
345+ assert proof_was_finished , "Proof was not finished"
334346
335347 def test_simple_lean_enforce_done_test (self ):
336348 from itp_interface .rl .proof_state import ProofState
@@ -372,6 +384,7 @@ def test_simple_lean_enforce_done_test(self):
372384"done"
373385]
374386 with env :
387+ proof_finished = False
375388 for proof_step in proof_steps :
376389 state , _ , next_state , _ , done , info = env .step (ProofAction (
377390 ProofAction .ActionType .RUN_TACTIC ,
@@ -397,6 +410,7 @@ def test_simple_lean_enforce_done_test(self):
397410 print (f"Action: { proof_step } " )
398411 print (f"=" * 30 )
399412 print ("Proof Finished!!" )
413+ proof_finished = True
400414 else :
401415 s1 : ProofState = state
402416 s2 : ProofState = next_state
@@ -418,6 +432,7 @@ def test_simple_lean_enforce_done_test(self):
418432 print ('|- ' , end = '' )
419433 print (goal .goal )
420434 print (f"=" * 30 )
435+ assert proof_finished , "Proof was not finished"
421436
422437 def test_simple_lean4_done_test (self ):
423438 from itp_interface .rl .proof_state import ProofState
0 commit comments