File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ /-
2+ Copyright (c) 2025 Robert Maxton. All rights reserved.
3+ Released under Apache 2.0 license as described in the file LICENSE.
4+ Authors: Robert Maxton
5+ -/
6+ module
7+
8+ public import Mathlib.Init
9+ public meta import Lean.PrettyPrinter.Delaborator.Builtins
10+
11+ /-! Delab helpers
12+
13+ Provides monadic functions in `DelabM` that can be factored out of their original application.
14+ -/
15+
16+ public meta section
17+
18+ /-- When the delab reader is pointed at an expression for an instance, returns `(true, t)`
19+ **iff** instance synthesis succeeds and produces a defeq instance; otherwise returns `(false, t)`.
20+ -/
21+ def delabCheckingCanonical : DelabM (Bool × Term) := do
22+ let instD ← delab
23+ let inst ← getExpr
24+ let type ← inferType inst
25+ -- if there is no synthesized instance, still return `false`
26+ -- (because `inst` is still non-canonical)
27+ let .some synthInst ← Meta.trySynthInstance type | return (false , instD)
28+ return (← Meta.isDefEq inst synthInst, instD)
You can’t perform that action at this time.
0 commit comments