انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Conjunction((and)) and Disjunction((or)) in prolog

الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 3
أستاذ المادة اسراء عبد الله حسين علي الدليمي       18/11/2017 13:47:30
Conjunction((and)) and Disjunction((or)) in prolog
For conjunction, comma , is used and it is read as and .
For Disjunction, semicolon ; is used and it is read as or .

Example:: Write a program in prolog contain 3 group(a, b, c). a contain 3 degree(9,10,11), b(9,12),c(9,12,10) .
Predicates
group(symbol, integer).
Clauses
group(a ,9).
group(a ,10).
group(a ,11).
group(b ,9).
group(b ,12).
group(c ,9).
group(c ,12).
group(c ,10).
Goal: group(a,X),X=9.

Goal: group(c,X), X>=10.


Goal: group(c,X),group(b,X).


Example:: If you have the following facts answer the questions:

Predicates
age(symbol, integer).
woman(symbol).
friend(symbol, symbol).
Clauses
woman(sara).
woman(jody).
woman(noor).
friend(sara,jody).
friend(noor, muna).
age(noor,20).
age(sara,25).
age(jody,22).
Goal: woman(X),friend(X,Y).






Goal: woman(X);friend(X,Y).





Example:: Given the following facts answer the questions:
Files Edit Run Compile Options Setup
Editor
Line1 Col1 Indent Insert Work.pro
Predicates
likes(symbol, symbol).
has(symbol, symbol).
friends(symbol, symbol).
Clauses
friends(dick, ed).
has(dick, book).
has(dick, mercedes).
likes(dick, mercedes).
likes(dick, wine).
likes(ed, wine).
----Dialog-----
Goal: friends(dick, ed).


Goal: likes(X, wine).





Goal: likes(X, Y), likes(X, mercedes).





Goal: likes(X, Y) ; likes(X, mercedes).


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .