@@ -5,7 +5,7 @@ module Idris.Prover (prover, showProof, showRunElab) where
5-- This exludes (<$>) as fmap, because wl-pprint uses it for newline
5-- This exludes (<$>) as fmap, because wl-pprint uses it for newline
6import Prelude (Eq(..), Show(..),
6import Prelude (Eq(..), Show(..),
7 Bool(..), Either(..), Maybe(..), String,
7 Bool(..), Either(..), Maybe(..), String,
8− (.), ($), (++),
8+ (.), ($), (++), (||),
9 concatMap, id, elem, error, fst, flip, foldl, foldr, init,
9 concatMap, id, elem, error, fst, flip, foldl, foldr, init,
10 length, lines, map, not, null, repeat, reverse, tail, zip)
10 length, lines, map, not, null, repeat, reverse, tail, zip)
@@ -150,7 +150,7 @@ dumpState ist menv ps | (h : hs) <- holes ps = do
150 let OK ty = goalAtFocus ps
150 let OK ty = goalAtFocus ps
151 let OK env = envAtFocus ps
151 let OK env = envAtFocus ps
152 let state = prettyOtherGoals hs <> line <>
152 let state = prettyOtherGoals hs <> line <>
153− prettyAssumptions env <> line <>
153+ prettyAssumptions ty env <> line <>
154 prettyMetaValues (reverse menv) <>
154 prettyMetaValues (reverse menv) <>
155 prettyGoal (zip (assumptionNames env) (repeat False)) ty
155 prettyGoal (zip (assumptionNames env) (repeat False)) ty
156 rendered <- iRender state
156 rendered <- iRender state
@@ -168,18 +168,18 @@ dumpState ist menv ps | (h : hs) <- holes ps = do
168 assumptionNames :: Env -> [Name]
168 assumptionNames :: Env -> [Name]
169 assumptionNames = map fst
169 assumptionNames = map fst
171− prettyPs :: [(Name, Bool)] -> Env -> Doc OutputAnnotation
171+ prettyPs :: Binder Type -> [(Name, Bool)] -> Env -> Doc OutputAnnotation
172− prettyPs bnd [] = empty
172+ prettyPs g bnd [] = empty
173− prettyPs bnd ((n@(MN _ r), _) : bs)
173+ prettyPs g bnd ((n@(MN _ r), _) : bs)
174− | r == txt "rewrite_rule" = prettyPs ((n, False):bnd) bs
174+ | r == txt "rewrite_rule" = prettyPs g ((n, False):bnd) bs
175− prettyPs bnd ((n@(MN _ _), _) : bs)
175+ prettyPs g bnd ((n@(MN _ _), _) : bs)
176− | not (n `elem` freeEnvNames bs) = prettyPs bnd bs
176+ | not (n `elem` freeEnvNames bs || n `elem` goalNames g) = prettyPs g bnd bs
177− prettyPs bnd ((n, Let t v) : bs) =
177+ prettyPs g bnd ((n, Let t v) : bs) =
178 line <> bindingOf n False <+> text "=" <+> tPretty bnd v <+> colon <+>
178 line <> bindingOf n False <+> text "=" <+> tPretty bnd v <+> colon <+>
179− align (tPretty bnd t) <> prettyPs ((n, False):bnd) bs
179+ align (tPretty bnd t) <> prettyPs g ((n, False):bnd) bs
180− prettyPs bnd ((n, b) : bs) =
180+ prettyPs g bnd ((n, b) : bs) =
181 line <> bindingOf n False <+> colon <+>
181 line <> bindingOf n False <+> colon <+>
182− align (tPretty bnd (binderTy b)) <> prettyPs ((n, False):bnd) bs
182+ align (tPretty bnd (binderTy b)) <> prettyPs g ((n, False):bnd) bs
184 prettyMetaValues [] = empty
184 prettyMetaValues [] = empty
185 prettyMetaValues mvs =
185 prettyMetaValues mvs =
@@ -196,6 +196,9 @@ dumpState ist menv ps | (h : hs) <- holes ps = do
197 kwd = annotate AnnKeyword . text
197 kwd = annotate AnnKeyword . text
199+ goalNames (Guess t v) = freeNames t ++ freeNames v
200+ goalNames b = freeNames (binderTy b)
199 prettyG bnd (Guess t v) = tPretty bnd t <+> text "=?=" <+> tPretty bnd v
202 prettyG bnd (Guess t v) = tPretty bnd t <+> text "=?=" <+> tPretty bnd v
200 prettyG bnd b = tPretty bnd $ binderTy b
203 prettyG bnd b = tPretty bnd $ binderTy b
@@ -203,12 +206,12 @@ dumpState ist menv ps | (h : hs) <- holes ps = do
203 text "---------- Goal: ----------" <$$>
206 text "---------- Goal: ----------" <$$>
204 bindingOf h False <+> colon <+> align (prettyG bnd ty)
207 bindingOf h False <+> colon <+> align (prettyG bnd ty)
206− prettyAssumptions env =
209+ prettyAssumptions g env =
207 if length env == 0 then
210 if length env == 0 then
210 text "---------- Assumptions: ----------" <>
213 text "---------- Assumptions: ----------" <>
211− nest nestingSize (prettyPs [] $ reverse env)
214+ nest nestingSize (prettyPs g [] $ reverse env)
213 prettyOtherGoals hs =
216 prettyOtherGoals hs =
214 if length hs == 0 then
217 if length hs == 0 then