fix: Experiments with new `load_sorry`
This commit is contained in:
parent
ce7e27a0fd
commit
56fc11f831
|
@ -201,7 +201,7 @@ def step_prove(
|
||||||
print(colored("Lean code:", "light_grey", attrs=["bold"]), lean_code)
|
print(colored("Lean code:", "light_grey", attrs=["bold"]), lean_code)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
states = server.load_sorry(lean_code)
|
units = server.load_sorry(lean_code)
|
||||||
except ServerError as e:
|
except ServerError as e:
|
||||||
msg = f"Encountered exception: {e}"
|
msg = f"Encountered exception: {e}"
|
||||||
print(colored(msg, "red"))
|
print(colored(msg, "red"))
|
||||||
|
@ -210,18 +210,18 @@ def step_prove(
|
||||||
error=msg,
|
error=msg,
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(states) != 1:
|
if len(units) != 1:
|
||||||
print(colored("Model must output one compilation unit", "red"))
|
print(colored("Model must output one compilation unit", "red"))
|
||||||
return SketchParseFailure(
|
return SketchParseFailure(
|
||||||
sketch=fl_sketch,
|
sketch=fl_sketch,
|
||||||
error="Model must output one compilation unit",
|
error="Model must output one compilation unit",
|
||||||
)
|
)
|
||||||
|
|
||||||
state = states[0]
|
state = units[0].goal_state
|
||||||
|
|
||||||
if isinstance(state, list) and len(state) > 0:
|
if state is None:
|
||||||
# This means `state` contains error messages
|
# This means `state` contains error messages
|
||||||
msg = "\n".join(state)
|
msg = "\n".join(units[0].messages)
|
||||||
print(colored("Sketch failed:", "red"), msg)
|
print(colored("Sketch failed:", "red"), msg)
|
||||||
return SketchParseFailure(
|
return SketchParseFailure(
|
||||||
sketch=fl_sketch,
|
sketch=fl_sketch,
|
||||||
|
|
|
@ -27,13 +27,14 @@ def try_test_data(server, agent, entry: dict, max_steps: int, max_trials_per_goa
|
||||||
agent.informal_stmt = entry["informal_stmt"]
|
agent.informal_stmt = entry["informal_stmt"]
|
||||||
agent.informal_proof = entry["informal_proof"]
|
agent.informal_proof = entry["informal_proof"]
|
||||||
|
|
||||||
goal_states = server.load_sorry(command)
|
units = server.load_sorry(command)
|
||||||
|
|
||||||
if len(goal_states) != 1:
|
if len(units) != 1:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
goal_state, = goal_states
|
unit, = units
|
||||||
if isinstance(goal_state, list):
|
goal_state = unit.goal_state
|
||||||
|
if goal_state is None:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
return agent.search(
|
return agent.search(
|
||||||
|
|
Loading…
Reference in New Issue