Skip to content

Feature request: cross-file suspend/resume #1883

@charles-cooper

Description

@charles-cooper

co-authored by claude opus 4.6

Motivation

The current suspend/resume mechanism is a great tool for structuring proofs within a single script file. However, it's limited to intra-file use: the suspension DB is an in-memory Sref, the ExportTheory hook enforces that all suspensions are finalised before the script ends, and nothing is persisted to the theory file on disk.

There are cases where it would be useful to suspend a subgoal in one theory and resume it in a downstream theory — for example:

  • Layered developments: A foundational theory establishes the main structure of a proof but a subgoal requires machinery (definitions, lemmas) that naturally belongs in a later theory. Currently, you must either anticipate and manually state the subgoal as a standalone lemma, or restructure the theory hierarchy.

  • Large proof efforts: Splitting a proof across files can help manage complexity. The suspend/resume pattern already captures the exact goal context (assumptions, free variable bindings), which is more convenient than manually reconstructing the subgoal statement as an independent lemma.

Current behaviour

  • suspend stores the incomplete theorem in boolLib.suspensionDBref (in-memory Symtab)
  • ExportTheory hook raises an error if any suspensions remain unfinalised
  • Finalise must appear in the same script file

Possible approach

One way to support this:

  1. Allow suspended theorems to be serialised into the theory file (e.g., as a new kind of stored theorem with suspendlabel hypotheses intact)
  2. Provide a way to import/access them in downstream theories (e.g., load_suspension "TheoryName" "thm_name")
  3. Finalise in the downstream theory would discharge the suspension hypotheses and save the completed theorem (possibly back-patching the original theory, or storing it in the finalising theory)
  4. The ExportTheory check could be relaxed to allow explicitly marked "deferred" suspensions

Open questions

  • Should the finalised theorem live in the original theory or the one that finalises it?
  • How to handle theory rebuilds — if the upstream theory changes, suspended goals may no longer match
  • Should there be a mechanism to declare which suspensions are intentionally deferred vs accidentally left open?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions