

Will go to play if school is closed, and he is free. Jack and Bili are friends if both of them love to play cricket. Tom is hungry if he is searching for food. Suppose we have some rules as given below − So when one associated condition is true, then the predicate is also true. We can define rule as an implicit relationship between objects. Exampleįollowing is an example of the above concept − cat(tom).loves_to_eat(kunal,pasta).of_color(hair,black).loves_to_play_games(nawaz).lazy(pratyusha). The syntax for facts is as follows − relation(object1,object2.). They also can begin with digits (like 1234), and can be strings of characters enclosed in quotes e.g. Objects also begin with lower case letters. Objects appear as comma-separated arguments within parentheses. The relationship name appears as the first term. Names of properties/relationships begin with lower case letters. These are actually statements, that we have to consider as true.įollowing are some guidelines to write facts − So these are some facts, that are unconditionally true. Suppose we have some facts as given below − So facts are unconditionally true in nature. We can define fact as an explicit relationship between objects, and properties these objects might have. These building blocks are Facts, Rules and the Queries. Here, we will discuss about the essential building blocks of logic programming. We will get some detailed knowledge about facts and rules, and also see some kind of queries that will be used in logic programming.

We will see in detail about the Knowledge Base, and how it helps in logic programming.įacts, Rules and Queries − These are the building blocks of logic programming. Knowledge Base − This is one of the fundamental parts of Logic Programming. The different topics that will be covered in this chapter are − So we will move on to the first step of our Prolog Programming. In this chapter, we will gain some basic knowledge about Prolog.
