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.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter12: Database Queries With Sql
Section: Chapter Questions
Problem 2MQ2
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning