lean-crush

5.11. Extending Checked Reconstruction🔗

When SMT returns unsat but core reconstruction needs a domain theorem, register it with @[crush_reconstruct]:

inductive Phase where | initial | next (previous : Phase) def Advances (source target : Phase) : Prop := target = .next source @[crush_reconstruct] theorem advancesNext (phase : Phase) : Advances phase (.next phase) := rfl set_option crush.trust "reconstruct" in example (phase : Phase) : Advances phase (.next phase) := phase:Phase⊢ Advances phase phase.next All goals completed! 🐙

Registered theorems participate in bounded backward proof search. The search uses a structural index to match their conclusion against the current reconstruction goal, solves their premises with the core-restricted Lean finishers, and checks the resulting term with Lean's kernel. It is datatype-independent, so downstream libraries can register bridge lemmas for their own inductive types and relations without adding those rules wholesale to grind.

This attribute does not send a theorem to SMT. If the solver also needs the fact, pass it to crush [...], expose equations with @[crush_unfold], or define a lowering as described above.

Use a local attribute when the theorem should affect only one section:

theorem initialAdvances : Advances .initial (.next .initial) := rfl attribute [local crush_reconstruct] initialAdvances

Unlike with [advancesNext phase], the registered theorem is matched lazily against reconstruction goals and can be applied at different arguments. Unlike using, it supplies a declarative rule rather than a complete tactic script.