poitin / Distiller

Implementation of the distillation algorithm as described in the paper "Distillation: Extracting the Essence of Programs".

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Termination problem on tree-transformation program

gsvgit opened this issue · comments

Hello.

I try to use Distiller for tree-manipulation programs transformation, but I have the following problem.

Suppose I have the following function:

eWizeOp g s m = 
    case m of
           Val (v1) -> (Val (g v1 s))
         | Node (q1, q2) -> (Node ((eWizeOp g s q1), (eWizeOp g s q2)))

When I try to distill the following term

main =  eWizeOp g s2 (eWizeOp g2 s m) ;

the result is correct, but when I try to distill the term

main =  eWizeOp g s2 (eWizeOp g s m) ;

the distiller does not terminate.

The only difference between these two cases is that I use the same first parameter in both calls of the eWizeOp function in the second case.

Full tests.

-- OK
main =  eWizeOp g s2 (eWizeOp g2 s m) ;

eWizeOp g s m = 
    case m of
           Val (v1) -> (Val (g v1 s))
         | Node (q1, q2) -> (Node ((eWizeOp g s q1), (eWizeOp g s q2)))
-- Fail
main =  eWizeOp g s2 (eWizeOp g s m) ;

eWizeOp g s m = 
    case m of
           Val (v1) -> (Val (g v1 s))
         | Node (q1, q2) -> (Node ((eWizeOp g s q1), (eWizeOp g s q2)))

This is now fixed. There are other minor issues I am currently working on - a major update is due soon,

Thank you very much! Looking forward to an updated version!