-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbasic_verification.py
More file actions
executable file
·45 lines (33 loc) · 1.02 KB
/
Copy pathbasic_verification.py
File metadata and controls
executable file
·45 lines (33 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
"""Basic example: Verify a Lean proof."""
import asyncio
from axle import AxleClient
async def main() -> None:
"""Demonstrate basic proof verification."""
# The formal statement (what we want to prove)
statement = """
import Mathlib
theorem add_comm_example (a b : Nat) : a + b = b + a := by sorry
"""
# The candidate proof
proof = """
import Mathlib
theorem add_comm_example (a b : Nat) : a + b = b + a := by
exact Nat.add_comm a b
"""
async with AxleClient() as client:
# Verify the proof
result = await client.verify_proof(
formal_statement=statement,
content=proof,
environment="lean-4.28.0",
)
print(f"Proof valid: {result.okay}")
if not result.okay:
print("Errors:")
for msg in result.tool_messages.errors:
print(f" - {msg}")
for msg in result.lean_messages.errors:
print(f" - {msg}")
if __name__ == "__main__":
asyncio.run(main())