Lean4
/-- Generate instance for the `lift` tactic. -/
def getInst (old_tp new_tp : Expr) : MetaM (Expr × Expr × Expr) := do
let coe ← mkFreshExprMVar (some <| .forallE `a new_tp old_tp .default)
let p ← mkFreshExprMVar (some <| .forallE `a old_tp (.sort .zero) .default)
let inst_type ← mkAppM ``CanLift #[old_tp, new_tp, coe, p]
let inst ← synthInstance inst_type
return (← instantiateMVars p, ← instantiateMVars coe, ← instantiateMVars inst)