Question: TABLE 2.1 Some queries to Listing 2.1 1. What instructors teach on Thursclay? ?- teaches(instructor. thursday). Instructor = instructor( j eanne, reid) a : Instructor



TABLE 2.1 Some queries to Listing 2.1 1. What instructors teach on Thursclay? ?- teaches(instructor. thursday). Instructor = instructor( j eanne, reid) a : Instructor - instructor (po11y, cushman) a : 2. What classes does Hill Krowesser teach? 7- instructor(instructor (bi11. kroesser). Class). Class = micro_appitcations t Class = project : 3. What days does Jeanne Reid teach? 7- teaches (instructor(Jeanne. reid). Day). Day = thursday 4. Who teaches the PROLOG class? 7- instructor(Instructor. prolog). Instructor = instructor(jeanne, refd) or B- Instructor(inst ructor (Fname, Lname) . prolog). Fname - jeanne g Lnarte = reid z 5. Who teaches classes that run from 6 to 9 on Mondays? ?- class (_.time (nonday. 6. 9). Instructor. _). Instructor = instructar(dave, mader) ma 6. What classes are held in room 511 of Sullivan Hall? \[ \begin{array}{l} \text { ?- class (Class, .* . Jocation }(\operatorname{sul} 1 \text { ivan, 511)). } \\ \text { Class - micro_applications } \mathrm{ag} \\ \text { Class = pascal } \\ \end{array} \] The scope of the variable Person is the entire rule. This met PROLOYG a goal of the form: ?- 11kes(john, shish_kebab). then Person will be instantiated to john as PROIOCG determine larly, in responding to the query: Submit the screenshot of your program and the queries. Run the queries below. Submit the screenshot of your program and the qu Compiled the following program and make necessary correction so that it works with your compiler. CHAFTER 2: Rules, Structured Data, and the Scope of Variables 15 1.15TING.2.1 A database with nested predicates class (data_structures. time (monday, 6, 9). instructor(dave. mader). location(wa11ace, 718) ). classintro. time (monday, 5, 6). instructor(1inda, maier). location(suilivan. 529) ). class (project, time(tuesday, 5, 6). instructor(bi11. kroesser). location (su11tivan, 301). class (pasca). time (thursday, 6, 9). instructor (poily, cushman). location(su11ivan, 511) ). teaches(Instructor, Day): - class(Classname, time(Day, Start, Finish). Instructor. Location). instructor(Instructor, Class) :- class (Class, Time, Instructor, Location)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
