lean-crush

3.4. Helping Checked Reconstruction🔗

The solver and Lean's core-directed reconstruction have different inputs. A fact in [...] is available while solving and may also appear in the unsat core. A fact in with [...] is withheld from SMT and becomes available only after the solver has returned unsat.

Use with [...] when the SMT encoding is already sufficient but Lean needs a bridge theorem to recover the source-level proof:

set_option crush.trust "reconstruct" in example (x : Int) (hx : x = 4) : x ≤ 4 := x:Inthx:x = 4⊢ x ≤ 4 All goals completed! 🐙

The hint cannot turn a sat query into an unsat query. In this example, hx still reaches SMT through the bare call; only Int.le_of_eq hx is reconstruction-only.

Use using when reconstruction needs a short, goal-specific tactic script rather than another fact:

def reconstructionStep (x : Int) : Int := x + 1 set_option crush.trust "reconstruct" in example (x : Int) : reconstructionStep x > x := x:Int⊢ reconstructionStep x > x crush d[reconstructionStep] using (x:Inth✝:(¬reconstructionStep x > x) = ¬x < x + 1⊢ x < x + 1; All goals completed! 🐙)

The tactic runs on the original goal with only the isolated unsat-core facts and the with [...] hints in its local context. It cannot accidentally use unrelated hypotheses that the solver did not use. Its result, including any auxiliary declarations it creates, is checked by Lean's kernel before assignment. If an early checked proof or Alethe replay already closes the goal, the core finisher is not run.

Use these mechanisms at different scales:

  • with [...] is a per-call collection of reconstruction facts.

  • using is a per-call reconstruction procedure.

  • @[crush_reconstruct] registers a reusable theorem for core reconstruction throughout a module or library.

  • register_crush_replay extends step-by-step Alethe certificate replay.

Alethe replay uses only the last mechanism. See core reconstruction rules and replay extensions for the persistent APIs.