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

Rules

الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 3
أستاذ المادة اسراء عبد الله حسين علي الدليمي       18/11/2017 13:50:57
Rules
Rules are the conditional statements about objects and their relationships takes the form ::
left_hand_side :- right_hand_side .
This sentence is interpreted as: left_hand_side if right_hand_side.

Example 1:
If we want to say that john and jane are friends if john likes jane and jane likes john. Then in prolog this friends rule can be written as::
friends(john,jane) :- likes(john,jane), likes(jane,john).

Example 2:
likes(john, X) :- car(X). // Read as : john likes X if X is a car.
friends(X, Y) :- likes(X, Y), likes(Y, X). // Read as : X and Y are friends if X likes Y and Y likes X. OR Two people are friends if they like each other.
Example 3:


Predicates
study (symbol, symbol).
lecture (symbol, symbol).


Example 2 :
Predicates
bird(symbol).
animal(symbol).
has_feathers(symbol).
Clauses
bird(X) :- animal(X),has_feathers(X).
animal(lion).
animal(sparrow).
has_feathers(sparrow).

teach(symbol, symbol).
Clauses
teach(X, Y) :- lecture(X, Z),
study(Y, Z).

lecture(ali, ss).
study(fatan, ss).


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