Computer Science: An Overview (13th Edition) (What's New in Computer Science)
13th Edition
ISBN: 9780134875460
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 6, Problem 58CRP
Program Plan Intro
Prolog
The prolog programming refers to the programming with logics. It is also a declarative programming language. A prolog program consists of some statements. There is a collection of initial statements, followed by some reasonably deducted statements.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Can someone use these prolog facts to complete the following rules?
eat(bear, fish).
eat(squirrel, nuts).
eat(swan, seaweed).
eat(bear, seaweed).
eat(cat, fish).
animal(fish).
plant(seaweed).
plant (nuts).
Create three rules:
herbivore(X) :- ?
carnivore(X) :- ?
omnivore(X) :- ?
what is the testing and truth table of prolog program:likes( mary, food)likes(mary, apple)likes( john, apple)likes(john, mary)
Now we pose the query:?- likes(mary, X), likes( john, X)
What answers do we get??
The query?animal(bear)merely asks if the fact animal(bear) is in the database. Because this fact is in the database, Prolog would respond to the query by answering yes. (This is a one-step proof sequence—no rules of inference are required). Further dialogue with Prolog could include?eat(deer, grass)yes?eat(bear, rabbit)no
Chapter 6 Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Ch. 6.1 - In what sense is a program in a third-generation...Ch. 6.1 - We can summarize the imperative programming...Ch. 6.1 - Prob. 4QECh. 6.2 - Why is the use of a constant considered better...Ch. 6.2 - Prob. 2QECh. 6.2 - Prob. 3QECh. 6.2 - Identity some common control structures found in...Ch. 6.2 - What is the difference between an array and an...Ch. 6.3 - Prob. 1QECh. 6.3 - Prob. 2QE
Ch. 6.3 - Why do many programming languages implement I/O...Ch. 6.3 - Prob. 4QECh. 6.3 - Prob. 5QECh. 6.4 - Prob. 1QECh. 6.4 - What is a symbol table?Ch. 6.4 - What is the difference between a terminal and a...Ch. 6.4 - Prob. 4QECh. 6.4 - Prob. 5QECh. 6.4 - Prob. 6QECh. 6.5 - What is the difference between an object and a...Ch. 6.5 - Prob. 2QECh. 6.5 - Suppose the classes PartTimeEmployee and...Ch. 6.5 - What is a constructor?Ch. 6.5 - Why are some items within a class designated as...Ch. 6.6 - Prob. 1QECh. 6.6 - Prob. 2QECh. 6.6 - Prob. 3QECh. 6.7 - Prob. 2QECh. 6.7 - Prob. 3QECh. 6.7 - Prob. 4QECh. 6 - Prob. 1CRPCh. 6 - Translate the following Python program into the...Ch. 6 - Prob. 3CRPCh. 6 - Why was it necessary to identify the type of data...Ch. 6 - Prob. 6CRPCh. 6 - Suppose the function f expects two numeric values...Ch. 6 - Suppose f is a function that returns the result of...Ch. 6 - Prob. 9CRPCh. 6 - Summarize the distinction between a machine...Ch. 6 - John Programmer argues that the ability to declare...Ch. 6 - Summarize the distinction between declarative...Ch. 6 - Explain the differences between a literal, a...Ch. 6 - a. What is operator precedence? b. Depending on...Ch. 6 - Prob. 16CRPCh. 6 - What is the difference between the meaning of the...Ch. 6 - Draw a flowchart representing the structure...Ch. 6 - Prob. 19CRPCh. 6 - Prob. 20CRPCh. 6 - Draw a flowchart representing the structure...Ch. 6 - Rewrite the following program segment using a...Ch. 6 - Summarize the following rats-nest routine with a...Ch. 6 - Prob. 24CRPCh. 6 - Prob. 25CRPCh. 6 - Suppose the variable X in a program was declared...Ch. 6 - Prob. 27CRPCh. 6 - Why would a large array probably not be passed to...Ch. 6 - Sometimes an actual parameter is passed to a...Ch. 6 - Prob. 32CRPCh. 6 - What ambiguity exists in the statement X = 3 + 2 ...Ch. 6 - Suppose a small company has five employees and is...Ch. 6 - Prob. 35CRPCh. 6 - Prob. 36CRPCh. 6 - Prob. 37CRPCh. 6 - Prob. 38CRPCh. 6 - Prob. 39CRPCh. 6 - Design a set of syntax diagrams that describes the...Ch. 6 - Prob. 41CRPCh. 6 - Prob. 42CRPCh. 6 - Add syntax diagrams to those in Question 5 of...Ch. 6 - Prob. 44CRPCh. 6 - What code optimization could be performed by a...Ch. 6 - Simplify the following program segment Y = 5 if (Y...Ch. 6 - Simplify the following program segment while (X !=...Ch. 6 - In an object-oriented programming environment, how...Ch. 6 - Describe how inheritance might be used to develop...Ch. 6 - What is the difference between the public and...Ch. 6 - a. Give an example of a situation in which an...Ch. 6 - Describe some objects that might be found in a...Ch. 6 - Prob. 53CRPCh. 6 - Prob. 54CRPCh. 6 - Prob. 55CRPCh. 6 - Prob. 56CRPCh. 6 - Prob. 57CRPCh. 6 - Prob. 58CRPCh. 6 - Prob. 59CRPCh. 6 - In general copyright laws support ownership rights...Ch. 6 - By using a high-level programming language, a...Ch. 6 - Prob. 3SICh. 6 - Prob. 4SICh. 6 - Prob. 5SICh. 6 - Suppose an amateur programmer writes a program for...Ch. 6 - Prob. 7SI
Knowledge Booster
Similar questions
- 1.Suppose we are working with the following knowledge base: wizard(ron). wizard(X) :- hasBroom(X),hasWand(X). hasWand(harry). quidditchPlayer(harry). hasBroom(X) :- quidditchPlayer(X). How does Prolog respond to the following queries? 1) wizard(ron). 2) witch(ron). 3) wizard(hermione). 4) witch(hermione). 5) wizard(harry). 6) wizard(Y). 7) witch(Y).arrow_forwardWrite the following questions in Prolog: 1. Who is the husband of Diana? 2. Who is/are the child/ren of Diana and Charles? 3. Who is/are the brother/s of William? 4. Who are the brothers of Anne? 5. Who is the mother of William? 6. Is Diana the mother of Anne? 7. Who are the parents of henry? 8. Do Andrew and Diana share the same mother? 9. Is Anne the wife of EdwardW? 10. List of all married couples.arrow_forwardQuestion 1 For given English statements write a prolog program. - Facts & Rules (1) jia is a woman. (2) john is a man. (3) john is healthy. (4) jia is healthy. (5) john is wealthy. (6) anyone is a traveler if he is healthy and wealthy. (7) anyone can travel if he is a traveler. - Goals. (1) Who can travel? (2) Who is healthy and wealthy?arrow_forward
- Consider the following Prolog program: edge(a, b). edge(c, d). edge(a, c). edge(c, b). edge(X, Y) :- edge(Y, X). path(X, X). path(X, Y) :- edge(Z, Y), path(X, Z). Note that this program is nearly identical to one presented in lecture except for the inclusion of the extra rule: edge(X, Y) :- edge(Y, X). The intent is that, with this additional rule, the program should model an undirected (as opposed to directed) graph. (a) Execute the query: ?- edge(a,b). What response do you get? (b) Execute the query ?- edge(b,a). What response do you get? (c) Execute the query ?- edge(a, d). What response do you get? And why?arrow_forwardWrite a PROLOG program that implements Zebra Puzzle Your program should implement the following facts for your answer. 1.There are five houses. 2.The Englishman lives in the red house. 3.The Spaniard owns the dog. 4.Coffee is drunk in the green house. 5.The Ukrainian drinks tea. 6.The green house is immediately to the right of the ivory house. 7.The Old Gold smoker owns snails. 8.Kools are smoked in the yellow house. 9.Milk is drunk in the middle house. 10.The Norwegian lives in the first house. 11.The man who smokes Chesterfields lives in the house next to the man with the fox. 12.Kools are smoked in the house next to the house where the horse is kept. 13.The Lucky Strike smoker drinks orange juice. 14.The Japanese smokes Parliaments. 15.The Norwegian lives next to the blue house.arrow_forwardOnly the correct answer will be appreciated else downvoted surelyarrow_forward
- Can someone write a prolog program using prolog facts and rules to solve the following? "A woman points to a portrait of a man, saying: "his brother's father is the only son of my grandfather." What's the relationship of the woman and the man in the portrait? Can you create some facts and one rule to identify the relationship between the woman and the man in the portrait?"arrow_forwardplease use Prolog to solve this question: 1) Write a Prolog function to solve a 8 tile puzzle with manhattan distance heuristic. manhattan_puzzle (State, Number).arrow_forwardWrite a Prolog program to print all Pythagorean triples (x, y, z) such that 1 ≤ x , y ≤ z ≤ 100. ((x, y, z) is a Pythagorean triple if x * x + y * y = z * z.)arrow_forward
- Which of the following is NOT considered a proposition in Prolog? horn clause goal hypotheses functorarrow_forwardConsider the following Prolog facts and rules:insert(X, L, [X|L]).insert(X, [H|L], [H|L1]) :- insert(X, L, L1).permute([], []).permute([H|T], P) :- permute(T, P1), insert(H, P1, P).Draw the Prolog trees corresponding to the following queries; show the rule and substitution usedat each step:(a) ?- permute([a,b], Y).Y = [a, b] ;Y = [b, a] ;false.(b) Show the part of the tree with solutions and explain why the tree is infinite:?- permute(Y, [a,b]).Y = [a, b] ;Y = [b, a] ;...(c) Explain the effect of the cut in the tree.?- not(permute(Y, [])).false.arrow_forwardWrite a Prolog program amicable(x,y) where it returns true if x and y are amicable.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education