view example/cad.pl @ 22:29cf617f49db default tip

newer CVS version
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 22 Apr 2016 16:47:13 +0900
parents 1c57a78f1d98
children
line wrap: on
line source

specification(Z=f(X),
   while(more,((
     Z=X,
     (
	 (X->(
	     repeat((skip&(Z=X,empty)),until,not(X)) &
	     repeat((skip&(Z=not(X),empty)),until,not(X))))
         ,
         (not(X)->(
	     repeat((skip&(Z=not(X),empty)),until,not(X))))
     )
    & skip
    )))
).

implementation(Z=f(X),
    exists(y,(
    not(y),
    [](
           (
	   next(y) = ((not(X),not(y));(X,y)),
	   Z = ((X,not(y);(not(X),y)))
           )
      )
    ))
).

?- specification(z=f(x),Y),ex((trace(x,[1,1,0,1,1,1,0,0,1,0,1]),Y)).

?- speficication(z=f(x),S),implementation(z=f(x),I),
   ex(I->fin_free(S).