feat: add reduceRec
This commit is contained in:
parent
5d4be4fd3c
commit
39d777435c
1 changed files with 13 additions and 0 deletions
|
|
@ -91,4 +91,17 @@ if h : majorIdx < recArgs.size then do
|
|||
else
|
||||
pure none
|
||||
|
||||
/-- Reduce recursor applications. -/
|
||||
@[specialize] def reduceRec {m : Type → Type} [Monad m]
|
||||
(whnf : Expr → m Expr)
|
||||
(inferType : Expr → m Expr)
|
||||
(isDefEq : Expr → Expr → m Bool)
|
||||
(env : Environment) (e : Expr) : m (Option Expr) :=
|
||||
match e.getAppFn with
|
||||
| Expr.const recFn recLvls =>
|
||||
match env.find recFn with
|
||||
| some (ConstantInfo.recInfo rec) => reduceRecAux whnf inferType isDefEq env rec recLvls e.getAppArgs
|
||||
| _ => pure none
|
||||
| _ => pure none
|
||||
|
||||
end Lean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue