Pantograph/examples/aesop.py

20 lines
707 B
Python
Raw Normal View History

2024-05-17 20:45:29 -07:00
#!/usr/bin/env python3
import subprocess
from pathlib import Path
from pantograph.server import Server
2024-05-17 20:53:34 -07:00
def get_project_and_lean_path():
2024-05-17 20:45:29 -07:00
cwd = Path(__file__).parent.resolve() / 'Example'
p = subprocess.check_output(['lake', 'env', 'printenv', 'LEAN_PATH'], cwd=cwd)
2024-05-17 20:53:34 -07:00
return cwd, p
2024-05-17 20:45:29 -07:00
if __name__ == '__main__':
2024-05-17 20:53:34 -07:00
project_path, lean_path = get_project_and_lean_path()
print(f"$PWD: {project_path}")
print(f"$LEAN_PATH: {lean_path}")
server = Server(imports=['Example'], project_path=project_path, lean_path=lean_path)
state0 = server.goal_start("forall (p q: Prop), Or p q -> Or q p")
state1 = server.goal_tactic(state0, goal_id=0, tactic="aesop")
assert state1.is_solved