Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_sorry fails to recognize open statements #79

Open
AG161 opened this issue Feb 21, 2025 · 2 comments
Open

load_sorry fails to recognize open statements #79

AG161 opened this issue Feb 21, 2025 · 2 comments

Comments

@AG161
Copy link

AG161 commented Feb 21, 2025

In this comment it was suggested that load_sorry can take open statements along with the theorem body. I may have misunderstood something, but I found that not to work in the following MWE:

from pantograph import Server

root = """
open Nat

theorem add_comm_proved_formal_sketch : ∀ n m : Nat, n + m = m + n := sorry
"""
server = Server()
sorries = server.load_sorry(root)
state1 = server.goal_tactic(sorries[1].goal_state, 0, "apply add_comm")
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
#   File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/site-packages/pantograph/utils.py", line 16, in wrapper
#     return asyncio.run(func(*args, **kwargs))
#   File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/asyncio/runners.py", line 44, in run
#     return loop.run_until_complete(main)
#   File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
#     return future.result()
#   File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/site-packages/pantograph/server.py", line 279, in goal_tactic_async
#     raise TacticFailure(result)
# pantograph.server.TacticFailure: {'tacticErrors': ["unknown identifier 'add_comm'"]}
state1 = server.goal_tactic(sorries[1].goal_state, 0, "apply Nat.add_comm")
state1
# GoalState(state_id=2, goals=[], _sentinel=[0])

Is there another way to get open statements into pantograph's proof environment for a theorem?

@lenianiva
Copy link
Member

Surround it with section ... end

@AG161
Copy link
Author

AG161 commented Feb 26, 2025

That didn't seem to work. Here is what I tried:

Python 3.10.16 (main, Dec 11 2024, 16:24:50) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pantograph import Server
>>> root = """
... section
... 
... open Nat
... 
... theorem add_comm_proved_formal_sketch : ∀ n m : Nat, n + m = m + n := sorry
... 
... end
... """
>>> server = Server()
>>> sorries = server.load_sorry(root)
>>> state1 = server.goal_tactic(sorries[2].goal_state, 0, "apply add_comm")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/site-packages/pantograph/utils.py", line 16, in wrapper
    return asyncio.run(func(*args, **kwargs))
  File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/agittis/miniconda3/envs/intern2/lib/python3.10/site-packages/pantograph/server.py", line 279, in goal_tactic_async
    raise TacticFailure(result)
pantograph.server.TacticFailure: {'tacticErrors': ["unknown identifier 'add_comm'"]}
>>> state1 = server.goal_tactic(sorries[2].goal_state, 0, "apply Nat.add_comm")
>>> state1
GoalState(state_id=1, goals=[], _sentinel=[])
>>> 

Naming the section didn't make a difference either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants