@@ -179,7 +179,6 @@ match_unify' :: Context -> Env ->
179179match_unify' ctxt env (topx, xfrom) (topy, yfrom) =
180180 do ps <- get
181181 let while = while_elaborating ps
182− let dont = dontunify ps
183182 let inj = injective ps
184183 traceWhen (unifylog ps)
185184 ("Matching " ++ show (topx, topy) ++
@@ -492,15 +491,6 @@ deferType n fty_in args ctxt env (Bind x (Hole t) (P nt x' ty)) | x == x' =
492491 Nothing -> error ("deferType can't find " ++ show n)
493492deferType _ _ _ _ _ _ = fail "Can't defer a non-hole focus."
494493
495−regret :: RunTactic
496−regret ctxt env (Bind x (Hole t) sc) | noOccurrence x sc =
497− do action (\ps -> let hs = holes ps in
498− ps { holes = hs \\ [x] })
499− return sc
500−regret ctxt env (Bind x (Hole t) _)
501− = fail $ show x ++ " : " ++ show t ++ " is not solved..."
502−regret _ _ _ = fail "The current focus is not a hole."
503−
504494unifyGoal :: Raw -> RunTactic
505495unifyGoal tm ctxt env h@(Bind x b sc) =
506496 do (tmv, _) <- lift $ check ctxt env tm
@@ -527,14 +517,8 @@ exact _ _ _ _ = fail "Can't fill here."
527517fill :: Raw -> RunTactic
528518fill guess ctxt env (Bind x (Hole ty) sc) =
529519 do (val, valty) <- lift $ check ctxt env guess
530−-- let valtyn = normalise ctxt env valty
531−-- let tyn = normalise ctxt env ty
532− ns <- unify' ctxt env (valty, Just $ SourceTerm val)
533− (ty, Just (chkPurpose val ty))
534− ps <- get
535− let (uh, uns) = unified ps
536−-- put (ps { unified = (uh, uns ++ ns) })
537−-- addLog (show (uh, uns ++ ns))
520+ unify' ctxt env (valty, Just $ SourceTerm val)
521+ (ty, Just (chkPurpose val ty))
538522 return $ Bind x (Guess ty val) sc
539523 where
540524 -- some expected types show up commonly in errors and indicate a
@@ -550,14 +534,8 @@ fill _ _ _ _ = fail "Can't fill here."
550534match_fill :: Raw -> RunTactic
551535match_fill guess ctxt env (Bind x (Hole ty) sc) =
552536 do (val, valty) <- lift $ check ctxt env guess
553−-- let valtyn = normalise ctxt env valty
554−-- let tyn = normalise ctxt env ty
555− ns <- match_unify' ctxt env (valty, Just $ SourceTerm val)
556− (ty, Just ExpectedType)
557− ps <- get
558− let (uh, uns) = unified ps
559−-- put (ps { unified = (uh, uns ++ ns) })
560−-- addLog (show (uh, uns ++ ns))
537+ match_unify' ctxt env (valty, Just $ SourceTerm val)
538+ (ty, Just ExpectedType)
561539 return $ Bind x (Guess ty val) sc
562540match_fill _ _ _ _ = fail "Can't fill here."
563541
@@ -571,11 +549,8 @@ complete_fill :: RunTactic
571549complete_fill ctxt env (Bind x (Guess ty val) sc) =
572550 do let guess = forget val
573551 (val', valty) <- lift $ check ctxt env guess
574− ns <- unify' ctxt env (valty, Just $ SourceTerm val')
575− (ty, Just ExpectedType)
576− ps <- get
577− let (uh, uns) = unified ps
578−-- put (ps { unified = (uh, uns ++ ns) })
552+ unify' ctxt env (valty, Just $ SourceTerm val')
553+ (ty, Just ExpectedType)
579554 return $ Bind x (Guess ty val) sc
580555complete_fill ctxt env t = fail $ "Can't complete fill at " ++ show t
581556
@@ -586,7 +561,6 @@ complete_fill ctxt env t = fail $ "Can't complete fill at " ++ show t
586561solve :: RunTactic
587562solve ctxt env (Bind x (Guess ty val) sc)
588563 = do ps <- get
589− let (uh, uns) = unified ps
590564 dropdots <-
591565 case lookup x (notunified ps) of
592566 Just tm -> -- trace ("NEED MATCH: " ++ show (x, tm, val) ++ "\nIN " ++ show (pterm ps)) $
@@ -603,7 +577,7 @@ solve ctxt env (Bind x (Guess ty val) sc)
603577 recents = x : recents ps,
604578 implementations = implementations ps \\ [x],
605579 dotted = dropUnified dropdots (dotted ps) })
606− let (locked, did) = tryLock (holes ps \\ [x]) (updsubst x val sc) in
580+ let (locked, _) = tryLock (holes ps \\ [x]) (updsubst x val sc) in
607581 return locked
608582 where dropUnified ddots [] = []
609583 dropUnified ddots ((x, es) : ds)
@@ -628,7 +602,6 @@ solve ctxt env (Bind x (Guess ty val) sc)
628602 (Bind n (Let ty' val') sc', tyl && vall && scl)
629603 tryLock hs t@(Bind n b sc)
630604 = let (bt', btl) = tryLock hs (binderTy b)
631− (val', vall) = tryLock hs val
632605 (sc', scl) = tryLock hs sc in
633606 (Bind n (b { binderTy = bt' }) sc', btl && scl)
634607 tryLock hs t = (t, True)
@@ -654,13 +627,9 @@ introTy ty mn ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
654627 x@(Bind y (Pi _ _ s _) _) -> x
655628 _ -> normalise ctxt env t
656629 (tyv, tyt) <- lift $ check ctxt env ty
657−-- ns <- lift $ unify ctxt env tyv t'
658630 case t' of
659631 Bind y (Pi rig _ s _) t -> let t' = updsubst y (P Bound n s) t in
660− do ns <- unify' ctxt env (s, Nothing) (tyv, Nothing)
661− ps <- get
662− let (uh, uns) = unified ps
663−-- put (ps { unified = (uh, uns ++ ns) })
632+ do unify' ctxt env (s, Nothing) (tyv, Nothing)
664633 return $ Bind n (Lam rig tyv) (Bind x (Hole t') (P Bound x t'))
665634 _ -> lift $ tfail $ CantIntroduce t'
666635introTy ty n ctxt env _ = fail "Can't introduce here."
@@ -758,7 +727,7 @@ casetac :: Raw -> Bool -> RunTactic
758727casetac tm induction ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' = do
759728 (tmv, tmt) <- lift $ check ctxt env tm
760729 let tmt' = normalise ctxt env tmt
761− let (tacn, tacstr, tactt) = if induction
730+ let (tacn, tacstr, _) = if induction
762731 then (ElimN, "eliminator", "Induction")
763732 else (CaseN (FC' emptyFC), "case analysis", "Case analysis")
764733 case unApply tmt' of
@@ -771,13 +740,9 @@ casetac tm induction ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' = do
771740 _ -> return []
772741 let (params, indicies) = splitTyArgs param_pos tyargs
773742 let args = getArgTys elimTy
774− let pmargs = take (length params) args
775743 let args' = drop (length params) args
776− let propTy = head args'
777744 let restargs = init $ tail args'
778745 let consargs = take (length restargs - length indicies) restargs
779− let indxargs = drop (length restargs - length indicies) restargs
780− let scr = last $ tail args'
781746 let indxnames = makeIndexNames indicies
782747 currentNames <- query $ allTTNames . getProofTerm . pterm
783748 let tmnm = case tm of
@@ -799,8 +764,7 @@ casetac tm induction ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' = do
799764 xs -> lift $ tfail $ Msg $ "Multiple definitions found when searching for " ++ tacstr ++ "of " ++ show tnm
800765 _ -> lift $ tfail $ NoEliminator (if induction then "induction" else "case analysis")
801766 tmt'
802− where scname = sMN 0 "scarg"
803− makeConsArg (nm, ty) = P Bound nm ty
767+ where makeConsArg (nm, ty) = P Bound nm ty
804768 bindConsArgs ((nm, ty):args) v = Bind nm (Hole ty) $ bindConsArgs args v
805769 bindConsArgs [] v = v
806770 addConsHole (nm, ty) =
@@ -879,8 +843,6 @@ start_unify :: Name -> RunTactic
879843start_unify n ctxt env tm = do -- action (\ps -> ps { unified = (n, []) })
880844 return tm
881845
882−tmap f (a, b, c) = (f a, b, c)
883−
884846solve_unified :: RunTactic
885847solve_unified ctxt env tm =
886848 do ps <- get
@@ -929,14 +891,6 @@ updateError ns (CantUnify b (l,lp) (r,rp) e xs sc)
929891 (updateSolvedTerm ns r, fmap (updateProv ns) rp) (updateError ns e) xs sc
930892updateError ns e = e
931893
932−updateRes ns [] = []
933−updateRes ns ((x, t) : ts) = (x, updateSolvedTerm ns t) : updateRes ns ts
934−
935−solveInProblems x val [] = []
936−solveInProblems x val ((l, r, env, err) : ps)
937− = ((psubst x val l, psubst x val r,
938− updateEnv [(x, val)] env, err) : solveInProblems x val ps)
939−
940894mergeNotunified :: Env -> [Name] -> [(Name, Term)] -> ([(Name, Term)], Fails)
941895mergeNotunified env holes ns = mnu ns [] [] where
942896 mnu [] ns_acc ps_acc = (reverse ns_acc, reverse ps_acc)