unique ref

This commit is contained in:
aarne
2004-08-13 13:21:46 +00:00
parent ad3fd6c082
commit 18be5298f0
4 changed files with 18 additions and 14 deletions

View File

@@ -232,6 +232,7 @@ contextRefinements gr = refineAllNodes contextRefine where
uniqueRefine :: CGrammar -> Action
uniqueRefine gr state = case refinementsState gr state of
[(e,(_,True))] -> Bad "only circular refinement"
[(e,_)] -> refineWithAtom False gr e state
_ -> Bad "no unique refinement"
@@ -347,7 +348,7 @@ solveAll gr st0 = do
-- active refinements
refinementsState :: CGrammar -> State -> [(Term,Val)]
refinementsState :: CGrammar -> State -> [(Term,(Val,Bool))]
refinementsState gr state =
let filt = possibleRefVal gr state in
if actIsMeta state

View File

@@ -36,8 +36,9 @@ mkStateFromInts ints gr = mkRandomState ints where
testErr (isCompleteState state) "not completed"
return state
mkRandomState (n:ns) state = do
let refs = refinementsState gr state
testErr (not (null refs)) $ "no refinements available for" +++
let refs = refinementsState gr state
refs0 = map (not . snd . snd) refs
testErr (not (null refs0)) $ "no nonrecursive refinements available for" +++
prt (actVal state)
(ref,_) <- (refs !? (n `mod` (length refs)))
state1 <- refineWithAtom False gr ref state