foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
Consider a domain with two individuals (✂ and ☎), two predicate symbols ($p$ and $q$), and three constants ($a$, $b$, and $c$). The knowledge base $KB$ is defined by
$p(X)\leftarrow q(X).$ | ||
$q(a).$ |
Give one interpretation that is a model of $KB$.
Give one interpretation that is not a model of $KB$.
How many interpretations are there? Give a brief justification for your answer.
How many of these interpretations are models of $KB$? Give a brief justification for your answer.
Consider the language that contains the constant symbols $a$, $b$, and $c$; the predicate symbols $p$ and $q$; and no function symbols. We have the following knowledge bases built from this language:
$K{B}_{1}=\{$ | $p(a)\}$ | ||
$K{B}_{2}=\{$ | $p(X)\leftarrow q(X)\}$ | ||
$K{B}_{3}=\{$ | $p(X)\leftarrow q(X),$ | ||
$p(a),$ | |||
$q(b)\}.$ |
Now consider possible interpretations for this language of the form $$, where $D=\{$✂, ☎, ✈, ✎$\}$.
How many interpretations with the four domain elements exist for our simple language? Give a brief justification for your answer. [Hint: Consider how many possible assignments $\varphi $ exist for the constant symbols, and consider how many extensions predicates $p$ and $q$ can have to determine how many assignments $\pi $ exist.] Do not try to enumerate all possible interpretations.
Of the interpretations outlined above, how many are models of $K{B}_{1}$? Give a brief justification for your answer.
Of the interpretations outlined above, how many are models of $K{B}_{2}$? Give a brief justification for your answer.
Of the interpretations outlined above, how many are models of $K{B}_{3}$? Give a brief justification for your answer.
Consider the following knowledge base:
$r(a).$ | ||
$r(e).$ | ||
$p(c).$ | ||
$q(b).$ | ||
$s(a,b).$ | ||
$s(d,b).$ | ||
$s(e,d).$ | ||
$p(X)\leftarrow q(X)\wedge r(X).$ | ||
$q(X)\leftarrow s(X,Y)\wedge q(Y).$ |
Show the set of ground atomic consequences derivable from this knowledge base. Assume that a bottom-up proof procedure is used and that at each iteration the first applicable clause is selected in the order shown. Furthermore, applicable constant substitutions are chosen in “alphabetic order” if more than one applies to a given clause; for example, if $X/a$ and $X/b$ are both applicable for a clause at some iteration, derive $q(a)$ first. In what order are consequences derived?
In Example 13.23, the algorithm fortuitously chose $imm\mathrm{\_}west(r109,r111)$ as the clause to resolve against. What would have happened if another clause had been chosen? Show the sequence of resolutions that arise, and either show a different answer or give a generalized answer clause that cannot resolve with any clause in the knowledge base.
In Example 13.23, we always selected the leftmost conjunct to resolve on. Is there a selection rule (a selection of which conjunct in the query to resolve against) that would have resulted in only one choice for this example? Give a general rule that – for this example, at least – results in fewer failing branches being made. Give an example where your rule does not work.
In a manner similar to Example 13.23, show derivations of the following queries:
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}two\mathrm{\_}doors\mathrm{\_}east(r107,R).$
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}next\mathrm{\_}door(R,r107).$
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}west(R,r107).$
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}west(r107,R).$
Give all answers for each query.
Consider the following knowledge base:
$has\mathrm{\_}access(X,library)\leftarrow student(X).$ | ||
$has\mathrm{\_}access(X,library)\leftarrow faculty(X).$ | ||
$has\mathrm{\_}access(X,library)\leftarrow has\mathrm{\_}access(Y,library)\wedge parent(Y,X).$ | ||
$has\mathrm{\_}access(X,office)\leftarrow has\mathrm{\_}keys(X).$ | ||
$faculty(diane).$ | ||
$faculty(ming).$ | ||
$student(william).$ | ||
$student(mary).$ | ||
$parent(diane,karen).$ | ||
$parent(diane,robyn).$ | ||
$parent(susan,sarah).$ | ||
$parent(sarah,ariel).$ | ||
$parent(karen,mary).$ | ||
$parent(karen,todd).$ |
Provide an SLD derivation of the query $has\mathrm{\_}access(todd,library)$.
The query $has\mathrm{\_}access(mary,library)$ has two SLD derivations. Give both of them.
Does there exist an SLD derivation for $has\mathrm{\_}access(ariel,library)$? Explain why or why not.
Explain why the set of answers to the query $has\mathrm{\_}access(X,office)$ is empty.
Suppose the following clause is added to the knowledge base:
$has\mathrm{\_}keys(X)\leftarrow faculty(X).$ |
What are the answers to the query $has\mathrm{\_}access(X,office)$?
What is the result of the following applications of substitutions?
$f(A,X,Y,X,Y)\{A/X,Z/b,Y/c\}.$
$yes(F,L)\leftarrow append(F,c(L,nil),c(l,c(i,c(s,c(t,nil)))))$
$\{F/c(l,{X}_{1}),{Y}_{1}/c(L,nil),{A}_{1}/l,{Z}_{1}/c(i,c(s,c(t,nil)))\}.$
$append(c({A}_{1},{X}_{1}),{Y}_{1},c({A}_{1},{Z}_{1}))\leftarrow append({X}_{1},{Y}_{1},{Z}_{1})$
$\{F/c(l,{X}_{1}),{Y}_{1}/c(L,nil),{A}_{1}/l,{Z}_{1}/c(i,c(s,c(t,nil)))\}.$
Give a most general unifier of the following pairs of expressions:
$p(f(X),g(g(b)))$ and $p(Z,g(Y))$
$g(f(X),r(X),t)$ and $g(W,r(Q),Q)$
$bar(val(X,bb),Z)$ and $bar(P,P)$
For each of the following pairs of atoms, either give a most general unifier or explain why one does not exist:
$p(X,Y,a,b,W)$
$p(E,c,F,G,F)$
$p(X,Y,Y)$
$p(E,E,F)$
$p(Y,a,b,Y)$
$p(c,F,G,F)$
$ap(F0,c(b,c(B0,L0)),c(a,c(b,c(b,c(a,emp)))))$
$ap(c(H1,T1),L1,c(H1,R1))$
List all of the ground atomic logical consequences of the following knowledge base:
$q(Y)\leftarrow s(Y,Z)\wedge r(Z).$ | ||
$p(X)\leftarrow q(f(X)).$ | ||
$s(f(a),b).$ | ||
$s(f(b),b).$ | ||
$s(c,b).$ | ||
$r(b).$ |
Consider the following logic program:
$f(empty,X,X).$ | ||
$f(cons(X,Y),W,Z)\leftarrow $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}f(Y,W,cons(X,Z)).$ |
Give each top-down derivation, showing substitutions (as in Example 13.32) for the query
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}f(cons(a,cons(b,cons(c,empty))),L,empty).$ |
What are all of the answers?
Consider the following logic program:
$rd(cons(H,cons(H,T)),T).$ | ||
$rd(cons(H,T),cons(H,R))\leftarrow $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}rd(T,R).$ |
Give a top-down derivation, showing all substitutions for the query
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}rd(cons(a,cons(cons(a,X),cons(B,cons(c,Z)))),W).$ |
What is the answer corresponding to this derivation?
Is there a second answer? If yes, show the derivation; if not, explain why.
Consider the following logic program:
$ap(emp,L,L).$ | ||
$ap(c(H,T),L,c(H,R))\leftarrow $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}ap(T,L,R).$ | ||
$adj(A,B,L)\leftarrow $ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}ap(F,c(A,c(B,E)),L).$ |
Give a top-down derivation (including all substitutions) for one answer to the query
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}adj(b,Y,c(a,c(b,c(b,c(a,emp))))).$ |
Are there any other answers? If so, explain where a different choice could be made in the derivation in the previous answer, and continue the derivation, showing another answer. If there are no other answers, explain why not.
[You are meant to do this exercise as if you were a computer, without knowing what the symbols mean. If you want to give a meaning to this program, you could read $ap$ as $append$, $c$ as $cons$, $emp$ as $empty$, and $adj$ as $adjacent$.]
The aim of this question is to get practice writing simple logic programs.
Write a relation $remove(E,L,R)$ that is true if $R$ is the list resulting from removing one instance of $E$ from list $L$. The relation is false if $E$ is not a member of $L$.
Give all of the answers to the following queries:
$\text{ask}remove(a,[b,a,d,a],R).$ | ||
$\text{ask}remove(E,[b,a,d,a],R).$ | ||
$\text{ask}remove(E,L,[b,a,d]).$ | ||
$\text{ask}remove(p(X),[a,p(a),p(p(a)),p(p(p(a)))],R).$ |
Write a relation $subsequence(L1,L2)$ that is true if list $L1$ contains a subset of the elements of $L2$ in the same order.
How many different proofs are there for each of the following queries:
$\text{ask}subsequence([a,d],[b,a,d,a]).$ | ||
$\text{ask}subsequence([b,a],[b,a,d,a]).$ | ||
$\text{ask}subsequence([X,Y],[b,a,d,a]).$ | ||
$\text{ask}subsequence(S,[b,a,d,a]).$ |
Explain why there are that many.
In this question, you are to write a definite clause knowledge base for the design of custom video presentations.
Assume that the video is annotated using the relation
$$segment(SegId,Duration,Covers),$$ |
where $SegId$ is an identifier for the segment. (In a real application this will be enough information to extract the video segment.) $Duration$ is the running time of the segment (in seconds). $Covers$ is a list of topics covered by the video segment. An example of a video annotation is the database
$segment(seg0,10,[welcome]).$ | ||
$segment(seg1,30,[skiing,views]).$ | ||
$segment(seg2,50,[welcome,artificial\mathrm{\_}intelligence,robots]).$ | ||
$segment(seg3,40,[graphics,dragons]).$ | ||
$segment(seg4,50,[skiing,robots]).$ |
A presentation is a sequence of segments. Represent a presentation by a list of segment identifiers.
Axiomatize a predicate
$$presentation(MustCover,Maxtime,Segments)$$ |
that is true if $Segments$ is a presentation whose total running time is less than or equal to $Maxtime$ seconds, such that all of the topics in the list $MustCover$ are covered by a segment in the presentation. The aim of this predicate is to design presentations that cover a certain number of topics within a time limit.
For example, the query
$\text{\U0001d5ba\U0001d5cc\U0001d5c4}\text{}presentation([welcome,skiing,robots],90,Segs).$ |
should return at least the following two answers (perhaps with the segments in some other order):
$presentation([welcome,skiing,robots],90,[seg0,seg4])$ | ||
$presentation([welcome,skiing,robots],90,[seg2,seg1]).$ |
Give the intended interpretation of all symbols used and demonstrate that you have tested your axiomatization (including finding all answers to your query) in AILog or Prolog. Explain briefly why each answer is an answer.
Assuming you have a good user interface and a way to actually view the presentations, list three things that the preceding program does not do that you may want in such a presentation system. (There is no correct answer for this part. You must be creative to get full marks.)
Construct a knowledge base and a dictionary based on Figure 13.13 to answer geographical questions such as that given in Figure 1.2. For each query, either show how it can be answered or explain why it is difficult to answer given the tools presented in this chapter.