Lean4
/-- Evaluate an expression into its `abel` normal form.
This is a variant of `Mathlib.Tactic.Abel.eval`, the main driver of the `abel` tactic.
It differs in
* outputting a `Simp.Result`, rather than a `NormalExpr × Expr`;
* throwing an error if the expression `e` is an atom for the `abel` tactic.
-/
def evalExpr (e : Expr) : AtomM Simp.Result := do
let e ← withReducible <| whnf e
guard !(isAtom e)
let (a, pa) ← eval e (← mkContext e)
return { expr := a, proof? := pa }