Question

In: Computer Science

What is the difference between Fact and Query in a logic programming language?

What is the difference between Fact and Query in a logic programming language?

Solutions

Expert Solution

  • Below is the detailed explanation of the problem mentioned above on fact and queries in a logic programming language.
  • In a logic programming language like Prolog, the logic or a clause is expressed as fact or a rule and the results or the computation is carried out by the use of queries.

Difference between Fact and Query

FACT QUERY
Fact is the logic of the program or is the knowledge of the program on the basis of which we get results from it. Query is the result that program gives on the basis on facts or we can say calculation or computation is carried out by the use of query.
Fact starts with a predicate and ends with a full stop.There may be argument inside parathesis between them. Query starts with predicate and followed by some arguments which can be variables so as to check from the FACT that this is true or not.
Fact is always true Query can give a solution or no solution depending upon facts.


For example consider a fact in Prolog as father(Ada,Bob). which states the fact that A is the father of B and consider a query ?- father(Ada,X).where X is a variable and this query tells us that what are the possible solutions in which A is a father of somebody so we get X=Bob

So query is used by user to ask some logic's possible solutions and the facts are the base of the program which are true and on the basis of which query is answered.


Related Solutions

Briefly describe the difference between recursive and iterative DNS query?
Briefly describe the difference between recursive and iterative DNS query?
Structured query language (SQL): A. Does not allow conditions to be put on the query. B....
Structured query language (SQL): A. Does not allow conditions to be put on the query. B. Is a complex language used to extract data from a limited number of tables. C. Isolates data within tables. D. Takes advantage of the primary record key to link tables.
Please illustrate the difference between circumscription and default logic
Please illustrate the difference between circumscription and default logic
What is the difference between the optimal solution to a linear programming problem and the objective...
What is the difference between the optimal solution to a linear programming problem and the objective function value at the optimal solution? Use an example in your explanation
2. What is the difference between positive and negative evidence? How does the fact that children...
2. What is the difference between positive and negative evidence? How does the fact that children do not rely on negative evidence support the claim that there is an innate Universal Grammar? How does the fact that children (almost) only rely on positive evidence support the claim that there is an innate Universal Grammar? Use an example to illustrate each of these parts of the Poverty of Stimulus argument.
1.What is the relationship between the LSD and a Z score? (R programming Language) Write a...
1.What is the relationship between the LSD and a Z score? (R programming Language) Write a fragment of code comparing how both would be computed. Use the Z score for the standard error of a mean, $z_i = (x_i - \mu)/(\sigma / \sqrt(n))$ 2. How would you modify the calculations of LSD to produce Tukey's Honest Signficant Difference?
HOW DO YOU THINK HUMANS CAME TO HAVE LANGUAGE? WHAT IS THE DIFFERENCE BETWEEN HUMAN LANGUAGE...
HOW DO YOU THINK HUMANS CAME TO HAVE LANGUAGE? WHAT IS THE DIFFERENCE BETWEEN HUMAN LANGUAGE AND OTHER KINDS OF COMMUNICATION? WHAT BRAIN FUNCTIONS, STRUCTURES OR CONNECTIONS WOULD A DOG NEED TO DEVELOP LANGUAGE?
In demonstrating the use of temperature programming in qualitative analysis. Q. What is the difference between...
In demonstrating the use of temperature programming in qualitative analysis. Q. What is the difference between isothermal and temperature programming?
In C language: What is the difference between the step and stepi gdb commands? Why is...
In C language: What is the difference between the step and stepi gdb commands? Why is this difference significant?
Question 6        (Marks: 35) Structured Query Language (SQL) is a language that is widely used in...
Question 6        (Marks: 35) Structured Query Language (SQL) is a language that is widely used in industry to create, update and query data in relational databases. This question must NOT be done practically (i.e. in the computer room). You are required to write the SQL code in your answer book. Q.6.1 The below sample data in third normal form was provided by a database designer. Answer the below questions using this data. Table: Country Primary key: CountryID (auto number) All...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT