chore: minor optimization at mkFlatLet

This commit is contained in:
Leonardo de Moura 2022-08-20 17:12:51 -07:00
parent 776a9b0dcb
commit b2a99e1b68

View file

@ -276,7 +276,11 @@ Remark: `body` may have many loose bound variables, and the loose bound variable
must be lifted by `n`.
-/
private def mkFlatLet (y : Name) (type : Expr) (value : Expr) (body : Expr) (nonDep : Bool := false) : Expr :=
go value 0
match value with
| .letE binderName type value'@(.lam ..) (.bvar 0) nonDep =>
/- Easy case that is often generated by `inlineProjInst?` -/
.letE binderName type value' body nonDep
| _ => go value 0
where
go (value : Expr) (i : Nat) : Expr :=
match value with