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

Please illustrate the difference between circumscription and default logic
Please illustrate the difference between circumscription and default logic
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?
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
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...
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?
What do you know about programming in Python? What is the difference between Python and Java?
What do you know about programming in Python? What is the difference between Python and Java? What does the term Open Source mean? Name four examples of Open Source software. What is the IDEL programming environment? How does IDEL relate to Python? How do you spread a long statement over multiple lines in Python? How do you use the loop-index? How will knowing and understanding Python impact what you do in your profession and/or personal experiences?
2.Review the difference between fact and opinion. Write three fact statements and three opinion statements about...
2.Review the difference between fact and opinion. Write three fact statements and three opinion statements about your selected device(smart phone). put references
In swift language, what is the difference between a stored property, computed property, property observers and...
In swift language, what is the difference between a stored property, computed property, property observers and lazy property?
LISP Programming Language Write a Bubble Sort program in the LISP Programming Language called “sort” that...
LISP Programming Language Write a Bubble Sort program in the LISP Programming Language called “sort” that sorts the array below in ascending order.  LISP is a recursive language so the program will use recursion to sort. Since there will be no loops, you will not need the variables i, j, and temp, but still use the variable name array for the array to be sorted.             Array to be sorted is 34, 56, 4, 10, 77, 51, 93, 30, 5, 52 The...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT