Experiment : 01 Date : 21/02/2023 Aim :- Study of Prolog Prolog : Prolog stands for “Programming in Logic”. Prolog is a programming language that is designed for artificial intelligence and symbolic reasoning. Extension of Prolog file is “.pl” Prolog is a logic programming language that uses formal logic to represent and reason about knowledge and data. Prolog is based on the concept of predicate logic, which is a mathematical logic that is used to describe relationships between objects and events. In prolog, programs are written in form of logical statements called “clauses” that define relationships between objects, and the system can use these statements to make deduction and inferences based on logical rules and facts. Prolog is widely used in various fields such as expert systems, natural language processing, and database system, and it has influenced the development of other logic-based programming languages. Programming Window :Prolog programming can be done in various text editors or integrated development environments (IDEs) depending on the specific needs of the programmer. SWI-Prolog: SWI-Prolog is a popular open-source Prolog implementation that comes with an integrated development environment (IDE).The IDE includes a text editor, syntax highlighting, debugging tools, and a graphical user interface (GUI) for running Prolog programs. Facts and rules are declared in the programming window. 1 Fact :A fact is a logical statement that is true in the context of a particular program or database.Factes used to describe relationships between objects and events, and they form the basic building blocks of Prolog programs. Rule :A rule is a logical statement that defines a relationship between one or more predicates. A rule consists of a head and a body, separated by the “:-” symbol. The head of the rule is a single predicate, and the body is a list of one or more predicates separated by commas and enclosed in parentheses. Query Window :In prolog, the query window is a user interface that allows the programmer or user to interact with the Prolog system by entering queries and receiving results. To use the query window, the user enters a query in the form of a predicate or a set of predicates separated by commas and enclosed in parentheses. The query is then evaluated by the Prolog system, which searches for all possible solutions that satisfy the query based on the facts and rules defined in the program. 2 Experiment : 02 Date : 22/03/2023 Aim :- Write simple fact for the statement using Prolog. Facts :male(lav). male(kush). male(ram). female(gita). female(sita). parent(ram,lav). parent(ram,kush). parent(ram,gita). parent(sita,lav). parent(sita,kush). parent(sita,gita). Rules :brother(X,Y):-parent(Z,X),parent(Z,Y),male(X),X\=Y. sister(X,Y):-parent(Z,X),parent(Z,Y),female(X),X\=Y. mother(X,Y):-parent(X,Y),female(X). father(X,Y):-parent(X,Y),male(X). husband(X,Y):-parent(X,Z),parent(Y,Z),male(X),female(Y). wife(X,Y):-parent(X,Z),parent(Y,Z),male(Y),female(X). Programming Window :- 3 Query Window :- 4 Experiment : 3.1 Date : 29/03/2023 Aim :- To find largest number among two numbers. Programming Window :- Query Window :- 5 Experiment : 3.2 Date : 29/03/2023 Aim :- Count the number of element in a list. Programming Window :- Query Window :- 6 Experiment : 3.2 Date : 29/03/2023 Aim :- Find sum of elements in a list. Programming Window :- Query Window :- 7