Document Details

BrandNewPanPipes

Uploaded by BrandNewPanPipes

Abdallah Hamed

Tags

logic programming prolog computer science programming languages

Summary

These notes cover logic programming concepts, focusing on Prolog syntax. They discuss facts, rules, and queries, and include examples and a family tree demonstrating relationships.

Full Transcript

LOGIC PROGRAMMING ABDALLAH HAMED LOGIC PROGRAMMING  What is the logic programming ? is a computer programming paradigm where program statements express facts and rules about problems within a system of formal logic PROLOG SYNTAX  Prolog language consist of : 1....

LOGIC PROGRAMMING ABDALLAH HAMED LOGIC PROGRAMMING  What is the logic programming ? is a computer programming paradigm where program statements express facts and rules about problems within a system of formal logic PROLOG SYNTAX  Prolog language consist of : 1. Facts 2. Rules 3. Queries PROLOG SYNTAX  Any prolog program is a collection of facts and rules forming a knowledge base (or a database). These facts and rules describe some collection of relationships. To use a prolog program, ask questions about the information stored in the knowledge base. FACTS  Something that is always unconditionally true.  Ex: ahmed is a boy Aly is father of sameh  Syntax : boy(ahmed) father(aly,sameh) RULES  True if some conditions satisfied  Ex: Abdallah likes books fact Abdallah likes X, if X is a book  Syntax likes(abdallah,X):-book(X) Example  boy(ahmed) fact argument ?- boy(ahmed) ?-boy(Ahmed) ?-boy(X) Queries  ?-parent(ahmed,sara)  ?-Parent(ali,X)  ?-Parent(sara,Y) sol  ?-parent(ahmed,sara) true  ?-Parent(ali,X) osama  ?-Parent(sara,Y) Batol ; omar Thank you

Use Quizgecko on...
Browser
Browser