Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is a Datalog query that uses the relation Flights(Airline, Departure, Arriv

ID: 3572043 • Letter: H

Question

Here is a Datalog query that uses the relation Flights(Airline, Departure, Arrival) as an input relation:

Reach(X,Y) ¬ Flights(_,X,Y);

Reach(X,Y) ¬ Flights(_,X,Z) AND Reach(Z,Y);

R(X) ¬ Reach(X,Y) AND Y = ‘Chicago’;

?- R

For each of the following statements indicate whether it is true or false (1 pt for each correct answer).

For any instance of Flights, the output table R contains all cities that are reachable from Chicago with one intermediate stop.

For any instance of Flights, the output table R contains all cities that are reachable from Chicago with any number of intermediate stops.

For any instance of Flights, the output table R contains all cities from which Chicago is reachable with one intermediate stop.

For any instance of Flights, the output table R contains all cities from which Chicago is reachable with any number of intermediate stops.

Explanation / Answer

Reach(X,Y) ¬ Flights(_,X,Y); no direct flight from x to y

Reach(X,Y) ¬ Flights(_,X,Z) AND Reach(Z,Y); x not going direct to z but z to y direct

R(X) ¬ Reach(X,Y) AND Y = ‘Chicago’; no direct from x to y and y is destination chicago

1st and 2nd option wrong

so x to z atleast one stop then z to y direct

d) option seems correct

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote