feat: reduce Expr.proj

This commit is contained in:
Leonardo de Moura 2019-11-01 17:07:38 -07:00
parent 638ceebab4
commit 2d65b2ba9f

View file

@ -174,11 +174,13 @@ export AbstractMetavarContext (hasAssignableLevelMVar isReadOnlyLevelMVar auxMVa
| _ =>
-- TODO: auxiliary recursors
done ()
| e@(Expr.proj _ i m) => do
m ← whnf m;
let f := m.getAppFn;
-- TODO check if `f` is constructor and reduce
pure e
| e@(Expr.proj _ i c) => do
c ← whnf c;
env ← getEnv;
matchConst env c.getAppFn (fun _ => pure e) $ fun cinfo lvls =>
match cinfo with
| ConstantInfo.ctorInfo ctorVal => pure $ c.getArgD (ctorVal.nparams + i) e
| _ => pure e
| _ => unreachable!
/- ===========================