1 TOSCOW NH 2 3 4 5 6 7 8 9 LO 11 12 L3 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 83 34 85 36 37 38 39 Below we have some logical facts and some potential queries that could be run with those facts. Your goal is to fill in what these queries do. Ignore any warnings for this file. As a hint, you can run this file directly by: 8 swipl -s 5_exercises.pl ...and then issuing the queries at the prompt. Consider the following Prolog logicbase: 8 a (al, 1). a (A, 2). a (a3, N). b (1,bl). b (2,B). b (N, b3). C (X,Y) :- a (X,N), b (N, Y). d (X,Y) :- a (X,N), b (Y, N). d (X,Y) :- a (N, X), b (N, Y). Write out whether or not the following queries are true or false, replacing ??? where appropriate. If a query is true and involves variable instantiations, then write out all possible variable instantiations which make the query 8 true. Some have already been done for you, to give an example of the expected format. If you wish, you may simply copy and paste the output of SWI-PL here directly; we will be grading this by hand, so the output format isn't important.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Show how to do this. Please answer correctly and do not copy and paste.

This uses Prolog so write in it as well.

The queries are in the 2nd picture that you have to run in Prolog, 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
10
17
18
19
20
21
22
23
24
25
26
27
27
28
29
30
31
2
32
2
33
2
34
20
35
36
37
38
39
Below we have some logical facts and some potential queries
that could be run with those facts. Your goal is to fill
in what these queries do. Ignore any warnings for this file.
As a hint, you can run this file directly by:
8
swipl -s 5 exercises.pl
8
8 ...and then issuing the queries at the prompt.
Consider the following Prolog logicbase:
a (al, 1).
a (A, 2).
a (a3, N).
b (1,bl).
b (2,B).
b (N, b3).
C (X,Y) :-
a (X, N),
b (N, Y).
d (X,Y) :-
a (X, N),
b (Y, N).
d (X,Y) :-
a (N, X),
b (N, Y).
Write out whether or not the following queries are true or
false, replacing ??? where appropriate.
If a query is true and involves variable instantiations, then write out
all possible variable instantiations which make the query
& true. Some have already been done for you, to give an
example of the expected format. If you wish, you may simply
copy and paste the output of SWI-PL here directly; we will be grading
this by hand, so the output format isn't important.
Transcribed Image Text:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 10 17 18 19 20 21 22 23 24 25 26 27 27 28 29 30 31 2 32 2 33 2 34 20 35 36 37 38 39 Below we have some logical facts and some potential queries that could be run with those facts. Your goal is to fill in what these queries do. Ignore any warnings for this file. As a hint, you can run this file directly by: 8 swipl -s 5 exercises.pl 8 8 ...and then issuing the queries at the prompt. Consider the following Prolog logicbase: a (al, 1). a (A, 2). a (a3, N). b (1,bl). b (2,B). b (N, b3). C (X,Y) :- a (X, N), b (N, Y). d (X,Y) :- a (X, N), b (Y, N). d (X,Y) :- a (N, X), b (N, Y). Write out whether or not the following queries are true or false, replacing ??? where appropriate. If a query is true and involves variable instantiations, then write out all possible variable instantiations which make the query & true. Some have already been done for you, to give an example of the expected format. If you wish, you may simply copy and paste the output of SWI-PL here directly; we will be grading this by hand, so the output format isn't important.
QUERY: a (X, 2).
ANSWER: true, X = a3
QUERY: C (X, Y).
ANSWER: (X = al, Y = bl), (X = al, Y = b3), true, Y = b3, (X = a3, Y = bl), X = a3, (X = a3, Y = b3)
QUERY: b (X, kalamazoo).
& ANSWER: ???
QUERY: C (X, b3).
ANSWER: ???
QUERY: C (A, B).
ANSWER: ???
QUERY: C (X, X).
ANSWER: ???
QUERY: d (X, Y).
ANSWER: ???
QUERY: d (X, X).
ANSWER: ???
Transcribed Image Text:QUERY: a (X, 2). ANSWER: true, X = a3 QUERY: C (X, Y). ANSWER: (X = al, Y = bl), (X = al, Y = b3), true, Y = b3, (X = a3, Y = bl), X = a3, (X = a3, Y = b3) QUERY: b (X, kalamazoo). & ANSWER: ??? QUERY: C (X, b3). ANSWER: ??? QUERY: C (A, B). ANSWER: ??? QUERY: C (X, X). ANSWER: ??? QUERY: d (X, Y). ANSWER: ??? QUERY: d (X, X). ANSWER: ???
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education