
20 Dec
2010
20 Dec
'10
8:54 p.m.
I recently discovered that class and instance declarations in Haskell are Horn clauses. So I encoded the arithmetic operations from the first chapter of *Art of Prolog* into Haskell, in the standar fac(0,s(0)). fac(s(N),F) :- fac(N,X), mult(s(N),X,F). class Fac x y | x -> y instance Fac Z (S Z) instance (Fac n x, Mult (S n) x f) => Fac (S n) f I don't understand, however, to make Haskell instantiate values for variables in a proof. I.e., I don't understand what the Haskell equivalent of ?- fac(X,Y) would be for some value of X.