@@ -198,12 +198,20 @@ proofSearch rec fromProver ambigok deferonfail maxDepth elab fn nroot psnames hi
198 return $ and (map (notHole hs) (zip as cs))
198 return $ and (map (notHole hs) (zip as cs))
199 Nothing -> fail "Can't happen"
199 Nothing -> fail "Can't happen"
201+ -- if n is a metavariable, and c is a constructor form, we're not ready
201 notHole hs (P _ n _, c)
203 notHole hs (P _ n _, c)
202 | (P _ cn _, _) <- unApply c,
204 | (P _ cn _, _) <- unApply c,
203 n `elem` hs && isConName cn (tt_ctxt ist) = False
205 n `elem` hs && isConName cn (tt_ctxt ist) = False
204 | Constant _ <- c = not (n `elem` hs)
206 | Constant _ <- c = not (n `elem` hs)
207+ -- if fa is a metavariable applied to anything, we're not ready to run yet.
209+ | (P _ fn _, args) <- unApply fa = fn `notElem` hs
205 notHole _ _ = True
210 notHole _ _ = True
212+ inHS hs (P _ n _) = n `elem` hs
207 toUN t@(P nt (MN i n) ty)
215 toUN t@(P nt (MN i n) ty)
208 | ('_':xs) <- str n = t
216 | ('_':xs) <- str n = t
209 | otherwise = P nt (UN n) ty
217 | otherwise = P nt (UN n) ty