PDA

View Full Version : FOPL Basics in Prolog



Wind Shear
03-04-2004, 03:59 AM
I need some help on First Predicate Order Logic for my project. All I need is just to reverse it.

Would you like to translate to English statement? These are just examples.

1. male('Loony BoB').
2. parent('Loony BoB','Agent Proto').
3. mother(X,Y) :- parent(X,Y), female(Y).
4. sister(X,S) :- female(S), parent(S,P), parent(X,P), X \== S.

Thanks!

Shlup
03-04-2004, 04:24 AM
I have no idea what any of that means.

Wind Shear
03-04-2004, 04:29 AM
Originally posted by ShlupQuack
I have no idea what any of that means.

By the way, the programming language is in PROLOG.

Thunday Man
03-04-2004, 05:32 AM
I like to make up langauges too. And steal cookies.

crono_logical
03-04-2004, 10:00 AM
Originally posted by Wind Shear
I need some help on First Predicate Order Logic for my project. All I need is just to reverse it.

Would you like to translate to English statement? These are just examples.

1. male('Loony BoB').
2. parent('Loony BoB','Agent Proto').
3. mother(X,Y) :- parent(X,Y), female(Y).
4. sister(X,S) :- female(S), parent(S,P), parent(X,P), X \== S.

Thanks!

1. Loony BoB is male, maybe :p
2. Agent Proto is the parent of Loony BoB. (Probably :D )
3. Y is the mother of X if Y is a parent of X and Y is female.
4. S is a sister of X if S is female, P is a parent of S, P is also a parent of X, and X is not S (last clause is needed otherwise it'll match X as a sister to itself if the rest are true :p )

Wind Shear
03-04-2004, 11:13 AM
Thanks. And I almost forgot! The said codes must be converted to First Order Predicate Logic! *headbangs himself on the wall*

That's all I need!

Dr Unne
03-05-2004, 07:03 PM
I know first-order logic, but I don't know prolog. I'm just guessing the :- represents implication, i.e. ->, or it might represent the <-> operator. Commas likely represent AND, i.e. a symbol I can't post in HTML. 3 and 4 are universal statements, so you need the upside-down A universal quanifier symbol. So for example

FORALL P,S,X sister(X,S) -> female(S) AND parent(S,P) AND parent(X,P) AND NOT X == S.

Replacing the words in caps with the appropriate symbols. Don't know if that helps, or if you still even need help.

Baloki
03-05-2004, 08:09 PM
Gah, prolog, prolog, prolog, why does everyone go on about such a declaritive language? Why? WHY?!?!

*Goes insane*

Dr Unne
03-05-2004, 08:14 PM
Prolog has its uses though. For example, torturing prisoners of war.

Baloki
03-05-2004, 08:17 PM
Originally posted by Dr Unne
Prolog has its uses though. For example, torturing prisoners of war.

And poor A-level candidates whose teacher talks about it EVERY lesson....