on master help sign in
Fix injectivity check
d06d473Edwin Brady
src/Core/Elaborate.hs+9−1
@@ -155,8 +155,16 @@ get_inj = do ES p _ _ <- get
155 return (injective (fst p))
155 return (injective (fst p))
156
156
157checkInjective :: (Term, Term, Term) -> Elab' aux ()
157checkInjective :: (Term, Term, Term) -> Elab' aux ()
158−checkInjective (tm, l, r) = if isInjective tm then return ()
158+checkInjective (tm, l, r) = do ctxt <- get_context
159+ if isInj ctxt tm then return ()
159 else lift $ tfail (NotInjective tm l r)
160 else lift $ tfail (NotInjective tm l r)
161+ where isInj ctxt (P _ n _)
162+ | isConName Nothing n ctxt = True
163+ isInj ctxt (App f a) = isInj ctxt f
164+ isInj ctxt (Constant _) = True
165+ isInj ctxt (TType _) = True
166+ isInj ctxt (Bind _ (Pi _) sc) = True
167+ isInj ctxt _ = False
160
168
161-- get instance argument names
169-- get instance argument names
162get_instances :: Elab' aux [Name]
170get_instances :: Elab' aux [Name]