@@ -22,6 +22,7 @@ data ProofState = PS { thname :: Name,
2222 nextname :: Int, -- name supply
2323 pterm :: Term, -- current proof term
2424 ptype :: Type, -- original goal
25+ defer :: [(Name, Type)], -- names we'll need to define
2526 previous :: Maybe ProofState, -- for undo
2627 context :: Context,
2728 done :: Bool
@@ -60,8 +61,8 @@ data TacticAction = AddGoal Name -- add a new goal, solve immediately
6061-- Some utilites on proof and tactic states
6162
6263instance Show ProofState where
63− show (PS nm [] _ tm _ _ _ _) = show nm ++ ": no more goals"
64− show (PS nm (h:hs) _ tm _ i_ ctxt _)
64+ show (PS nm [] _ tm _ _ _ _ _) = show nm ++ ": no more goals"
65+ show (PS nm (h:hs) _ tm _ i _ ctxt _)
6566 = let OK g = goal (Just h) tm
6667 wkenv = premises g in
6768 showPs wkenv (reverse wkenv) ++ "\n" ++
@@ -103,7 +104,8 @@ action a = do (n, ts) <- get
103104newProof :: Name -> Context -> Type -> ProofState
104105newProof n ctxt ty = let h = holeName 0
105106 ty' = vToP ty in
106− PS n [h] 1 (Bind h (Hole ty') (P Bound h ty')) ty Nothing ctxt False
107+ PS n [h] 1 (Bind h (Hole ty') (P Bound h ty')) ty []
108+ Nothing ctxt False
107109
108110type TState = (Int, [TacticAction])
109111type RunTactic = Context -> Env -> Term -> StateT TState TC Term
@@ -250,7 +252,6 @@ eval_in t ctxt env tm =
250252 showEnv env valty'))
251253 return tm
252254
253−
254255processTactic :: Tactic -> ProofState -> TC (ProofState, String)
255256processTactic QED ps = case holes ps of
256257 [] -> let tm = finalise (pterm ps) in
@@ -291,7 +292,7 @@ processTactic t ps
291292 getSolved (_ : xs) = getSolved xs
292293
293294 updateSolved xs (Bind n b@(Hole _) t)
294− | Just v <- lookup n xs = Bind n (Let (binderTy b) v) (updateSolved xs t)
295+ | Just v <- lookup n xs = instantiate v (pToV n (updateSolved xs t))
295296 updateSolved xs (Bind n b t)
296297 | otherwise = Bind n (fmap (updateSolved xs) b) (updateSolved xs t)
297298 updateSolved xs (App f a) = App (updateSolved xs f) (updateSolved xs a)