on master help sign in
Make note of unapplied unifiation solutions

i.e. when an argument is given explicitly, but can be solved by unification, make sure that the given argument and the inferred argument themselves unify. Keep track in the ProofState structure, and unify when 'solve' tactic is applied for the given hole. Fixes #765

commitfef12073261872ae82835bd7c23ae8b0aadca8da authorEdwin Brady <ecb10@st-andrews.ac.uk> dateThu 9 Jan 2014, 17:10 (13 years ago) parentb67f180
3 files changed+16−12
CHANGELOG+2 src/Idris/Core/ProofState.hs+13−12 test/reg005/reg005.idr+1
CHANGELOG+2
@@ -1,6 +1,8 @@
11New in 0.9.11:
22-------------
3+
34* Agda-style equational reasoning (in Syntax.PreorderReasoning)
5+* 'case' construct now abstracts over the scrutinee in its type
46
57New in 0.9.10:
68--------------
src/Idris/Core/ProofState.hs+13−12
@@ -184,24 +184,25 @@ unify' ctxt env topx topy =
184184 " in " ++ show env ++
185185 "\nHoles: " ++ show (holes ps) ++ "\n") $
186186 lift $ unify ctxt env topx topy dont (holes ps)
187+ let notu = filter (\ (n, t) -> case t of
188+ P _ _ _ -> False
189+ _ -> n `elem` dont) u
187190 traceWhen (unifylog ps)
188191 ("Unified " ++ show (topx, topy) ++ " without " ++ show dont ++
189192 "\nSolved: " ++ show u ++ "\nNew problems: " ++ qshow fails
190193 ++ "\nCurrent problems:\n" ++ qshow (problems ps)
191194-- ++ show (pterm ps)
192195 ++ "\n----------") $
193− case fails of
194−-- [] -> return u
195− err ->
196− do ps <- get
197− let (h, ns) = unified ps
198− let (ns', probs') = updateProblems (context ps) (u ++ ns)
199− (err ++ problems ps)
200− (injective ps)
201− (holes ps)
202− put (ps { problems = probs',
203− unified = (h, ns') })
204− return u
196+ do ps <- get
197+ let (h, ns) = unified ps
198+ let (ns', probs') = updateProblems (context ps) (u ++ ns)
199+ (fails ++ problems ps)
200+ (injective ps)
201+ (holes ps)
202+ put (ps { problems = probs',
203+ unified = (h, ns'),
204+ notunified = notu ++ notunified ps })
205+ return u
205206
206207getName :: Monad m => String -> StateT TState m Name
207208getName tag = do ps <- get
test/reg005/reg005.idr+1
@@ -48,3 +48,4 @@ Main.eqCharOK = proof {
4848 exact x = x;
4949}
5050
51+