chore: improve eqvTypes

This commit is contained in:
Leonardo de Moura 2022-10-09 16:42:27 -07:00
parent 43fe67c41a
commit cf313d2101
3 changed files with 5 additions and 1 deletions

View file

@ -416,6 +416,9 @@ We have that `List Nat` and `List ◾` are compatible types, but they are not eq
partial def eqvTypes (a b : Expr) : Bool :=
if a == b then
true
else if a.isErased && b.isErased then
-- `◾ α` is equivalent to `◾`
true
else
let a' := a.headBeta
let b' := b.headBeta

View file

@ -113,5 +113,6 @@ builtin_initialize
builtin_initialize
registerTraceClass `Compiler.saveBase (inherited := true)
registerTraceClass `Compiler.trace (inherited := true)
end Lean.Compiler.LCNF

View file

@ -43,7 +43,7 @@ partial def inlineProjInst? (e : Expr) (expectedType : Expr) : SimpM (Option (Ar
let (fvarId?, decls) ← visit s [i] |>.run |>.run #[]
if let some fvarId := fvarId? then
let type ← getType fvarId
if type.isErased || eqvTypes expectedType type then
if expectedType.isErased || type.isErased || eqvTypes expectedType type then
return some (decls, fvarId)
else
let cast ← mkLcCast (.fvar fvarId) expectedType