Skip to content

Report the proof state when an error occurs during a proof#1453

Merged
fblanqui merged 1 commit into
Deducteam:masterfrom
ciaran-matthew-dunne:pr/proof-state-on-error
Jul 10, 2026
Merged

Report the proof state when an error occurs during a proof#1453
fblanqui merged 1 commit into
Deducteam:masterfrom
ciaran-matthew-dunne:pr/proof-state-on-error

Conversation

@ciaran-matthew-dunne

@ciaran-matthew-dunne ciaran-matthew-dunne commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Errors raised during a proof now report the proof state. An unfinished proof at end and most subproof-count mismatches already print the goals, but a failing tactic prints nothing:

[foo.lp:12:2-6] Call to tactic "fail".

The state is now attached to every such error, in the err_desc field of Fatal (from #1290): the message is unchanged, and the state is printed uncolored after it.

[foo.lp:12:2-6] Call to tactic "fail".
Proof state before tactic application:
a: π A
b: π B
------------------------------------------------------------------------------
0. ?4: π A

A subproof-count mismatch is only detected after the tactic ran, so it reports the state before and after it:

[foo.lp:11:2-11] Missing subproofs (0 subproofs for 2 subgoals).
Proof state before tactic application:
0. ?1: Π n:N, π (Q n)
Proof state after tactic application:
0. ?5: π (Q z)
1. ?7: Π x0:N, π (Q x0) → π (Q (succ x0))

An unfinished proof at end reports the remaining goals under a Proof state: heading.

The state is attached in the outer Tactic.handle, below which tacticals catch their own errors, so failures swallowed by try/orelse are unaffected. The LSP server disables the attachment for tactic failures (Proof.state_on_error) since editors display the goals themselves. Tests: tests/proof_state.ml on three new KO fixtures.

Attach the proof state to errors raised while a proof is in progress,
using the err_desc field of Fatal: the goals a failing tactic was
applied to, the goals before and after the tactic for a subproof-count
mismatch, and the remaining goals for an unfinished proof at `end`.
The error message itself is unchanged; the state is printed after it,
uncolored. The LSP server disables this for tactic failures since
editors display the proof state themselves.
@fblanqui fblanqui merged commit 701cf69 into Deducteam:master Jul 10, 2026
24 checks passed
@fblanqui

Copy link
Copy Markdown
Member

Thanks @ciaran-matthew-dunne !

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

Successfully merging this pull request may close these issues.

2 participants