Browse Source

Definitional eta equality

feature/hits
Amélia Liao 3 years ago
parent
commit
954356fd92
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      src/Elab/Eval.hs

+ 14
- 2
src/Elab/Eval.hs View File

@ -97,15 +97,27 @@ unify topa topb = join $ go <$> forceIO topa <*> forceIO topb where
traverse_ (uncurry unifySpine) (zip a a') traverse_ (uncurry unifySpine) (zip a a')
| otherwise = fail | otherwise = fail
go (VLam p (Closure _ k)) (VLam p' (Closure _ k')) | p == p' = do
go (VLam p (Closure _ k)) vl = do
t <- VVar . Bound <$> newName t <- VVar . Bound <$> newName
unify (k t) (k' t)
unify (k t) (vApp p vl t)
go vl (VLam p (Closure _ k)) = do
t <- VVar . Bound <$> newName
unify (vApp p vl t) (k t)
go (VPair a b) vl = unify a (vProj1 vl) *> unify b (vProj2 vl)
go vl (VPair a b) = unify (vProj1 vl) a *> unify (vProj2 vl) b
go (VPi p d (Closure _ k)) (VPi p' d' (Closure _ k')) | p == p' = do go (VPi p d (Closure _ k)) (VPi p' d' (Closure _ k')) | p == p' = do
t <- VVar . Bound <$> newName t <- VVar . Bound <$> newName
unify d d' unify d d'
unify (k t) (k' t) unify (k t) (k' t)
go (VSigma d (Closure _ k)) (VSigma d' (Closure _ k')) = do
t <- VVar . Bound <$> newName
unify d d'
unify (k t) (k' t)
go _ _ = fail go _ _ = fail
fail = liftIO . throwIO $ NotEqual topa topb fail = liftIO . throwIO $ NotEqual topa topb


Loading…
Cancel
Save