[comp.lang.prolog] Implication in Prolog

brady@swift.cs.tcd.ie (11/30/90)

This is a really ignorant question, but I don't use C Prolog at all...
Is the -> predicate meant to mean some kind of implication?
Is it defined as if by the following:
A -> B :- call(A),call(B).

Has it got something to do with unsound negation?

Mike Brady
brady@cs.tcd.ie

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (12/06/90)

In article <1990Nov30.155356.7584@swift.cs.tcd.ie>, brady@swift.cs.tcd.ie writes:
> This is a really ignorant question, but I don't use C Prolog at all...
> Is the -> predicate meant to mean some kind of implication?

-> is a control structure.  It is described in many Prolog textbooks.
It is Prolog's version of "if".

	( P -> Q )		if P succeeds, then commit to it
				and then do Q  (similar to P, !, Q)

	( P -> Q		if P succeeds, then commit to it
	; R			and then do Q, or else do R
	)			(similar to (P, !, Q ; R))

> Is it defined as if by the following:
> A -> B :- call(A),call(B).

No.  The definition works like this, ignoring cuts in P, Q, R.

	;( ->( P, Q ), R )	:- P, !, Q.
	;( ->( P, Q ), R )	:- !, R.
	;( P, Q )		:- P.
	;( P, Q )		:- Q.

	->(P, Q)		:- P, !, Q.

> Has it got something to do with unsound negation?

Yes.
	\+ (P)		"P does not succeed/is not provable"
is identical to
	(P -> fail ; true)

-- 
The Marxists have merely _interpreted_ Marxism in various ways;
the point, however, is to _change_ it.		-- R. Hochhuth.