Tuesday, March 4, 2014

Prolog Unification Proof

gcd(U, 0, U) .
gcd(U, V, W) :-
V>0,
U1 is  U mod V,
gcd(V, U1, W).

% z:/prog lang/prolog/test compiled 0.00 sec, 7 clauses
1 ?- gcd(29, 7, X).
X = 1 .


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.