Introduction to AI & AI Principles (Semester 1) WEEK 8 (2008/09) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK Language-to-Logic in Shopping Trip case study The material in the following slides (before the ones on Reasoning) MAY be used in the Exercises on Wed 19th November Implication Symbol: If Sally likes Peter then Ben hates Harry. likes(Sally, Peter) hates(Ben, Harry). A B is true if and only if B is true or A is false (or both). So: A B is false if and only if A is true and B is false. And: If A is true and A B is true then it must be that B is true. A B is logically equivalent to (i.e., always has same truth value as) A B. It is probably best, in fact, to think of A B as just a sometimes-intuitive ABBREVIATION for A B. is NOT about any intrinsic connection of any sort between the two sides. Equivalence or Double Implication: or If Sally likes Peter then Ben hates Harry, and vice versa. likes(Sally, Peter) hates(Ben, Harry). A B is true if and only if A B and B A are both true. So: A B is true if and only if A and B are either both true or both false. And: A B is false if and only if A and B have different truth values. Existential Quantification Sally likes Peter. likes(Sally, Peter). Sally likes something. (p) likes(Sally, p). Think of “p” as “there exists something p such that” Does NOT restrict the claim to exactly one thing: the formula is still true if Sally likes more than one thing. Sally likes someone. (p) (is-person(p) likes(Sally, p)). Sally likes someone [i.e., at least one particular person] who is tall. (p) (is-person(p) likes(Sally, p) tall(p)). Universal Quantification Sally likes everything. (x) likes(Sally, x). Think of “x” as “for anything, x, it is the case that” Sally likes every shop. (p) (is-shop(p) likes(Sally, p)). For anything, p, [it is the case that] if p is a shop then Sally likes p. CAUTION: The formula is TRUE if there are no shops at all! Sally likes every shop that is modern. (q) ( (is-shop(q) modern(q)) likes(Sally, q) ). Sally loves or hates anyone who is tall. (z) ( (is-person(z) tall(z)) (loves(Sally, z) hates(Sally,z) ). Quantification, contd. Sally likes everyone. (p) (is-person(p) likes(Sally, p)). Why is the following wrong?: ( p) (is-person(p) likes(Sally, p)). Sally likes someone. (p) (is-person(p) likes(Sally, p)). Why is the following wrong?: (p) (is-person(p) likes(Sally, p)). Quantification, contd. Everyone likes any shop that’s modern. (q,p) ( (is-shop(q) modern(q) is-person(p)) likes(p, q) ). Everyone likes some shop that’s modern. (p) (is-person(p)) (q) (is-shop(q) modern(q) likes(p, q) ). This interpretation doesn’t assume it’s the same shop(s) for each person: q can depend on p. (q) (is-shop(q) modern(q) (p) (is-person(p)) (likes(p, q)) ). This interpretation does assume it’s the same shop(s) for each person: q does not depend on p. Substances and Lumps of Them Sally likes ice-cream. likes(Sally, ice-cream). Sally is eating ice-cream. eating(Sally, ice-cream). The ice-cream Sally is eating is famous. (x) eating(Sally,x) is(x,ice-cream) famous(x)). The ice-cream Sally is eating is melting. (x) eating(Sally,x) lump-of(x,ice-cream) melting(x)). Is there an interpretative problem here?? The predicate symbol eating can apply to two different sorts of second-argument object: lumps and general substances. May be better to have two different predicate symbols. Somewhat Similar Issue with Actions Sally eats ice-cream [in the sense of: habitually]. eats-hab(Sally, ice-cream). Sally eats ice-cream [in the sense of: mainly]. eats-main(Sally, ice-cream). Sally eats ice-cream [in the sense of: is prepared to]. eats-prep(Sally, ice-cream). Sally is eating ice-cream [at the present moment]. eating(Sally, ice-cream). Could not use the same predicate symbol for two or more of the above. Expressing Uniqueness Sally likes [exactly] one person. (p) (is-person(p) likes(Sally, p)) WRONG Wrong because just means one or more. (!p) (is-person(p) likes(Sally, p)) This notation has been proposed, amongst others. Without special notation, need to use formulas like: (p) (is-person(p) likes(Sally, p) (q)(is-person(q) likes(Sally, q) q = p) ) A simplification: (p)(q)(is-person(q) likes(Sally, q) q = p) Deductive Reasoning in Logic (brief intro) The following slides won’t be used in the Exercises on Wed 19th November Basic Concepts about Reasoning Reasoning in general is a process of generating new propositions (claims, statements) from existing ones, where the new ones are viewed as following from the old ones in some sense. So imagine a “knowledge base” (“proposition base” would have been a better term) where the results of reasoning are being accumulated. Example: the Working Memory in a production system. There are many types of reasoning: deduction, induction, abduction, reasoning by default, reasoning from examples, reasoning by analogy, probabilistic reasoning, …. All are studied in AI and are important for practical tasks. (Traditional) deduction is the most basic and idealistic form … Nature of Deduction (Traditional) deduction is reasoning where each step taken is the application of a sound and domainindependent rule of inference. A rule of inference is a mechanism that takes some set of propositions as input and outputs one or more propositions that are viewed as following from the input. (In the case where each proposition’s truth value is either TRUE or FALSE:) Soundness means that if the propositions inputed to the rule are true then the output propositions are guaranteed to be true. That is, the rule is truth-preserving. PS Rules are (usually) Not Sound Although productions (= rules in production systems) can in principle be of any type whatsoever, they are usually domain dependent (e.g., are about doors, fridges, hands, …) and unsound (they often merely encode defaults). IF in(a, room1) holds0(a, x) THEN in(x, room1) For clarity on following slides I am now going to change rule notation. Instead of the above we will write: IF-HAVE in(a, room1) AND-HAVE holds0(a, x) THEN-HAVE in(x, room1) Modus Ponens: A Basic Sound (and DomainIndependent) Inference Rule MP could be expressed as follows: IF-HAVE A AND-HAVE A B THEN-HAVE B. with the understanding that A and B are variables that can be bound to propositions in a KB. Such variables are usually called meta-variables to distinguish them from the usual variables that may occur within the propositions. But the traditional way to express it is: A, A B B Some Other Example Rules (in non-traditional IF-THEN form) Modus tollens (MT): IF-HAVE B AND-HAVE A B THEN-HAVE A. Rules similar to MP and MT but involving the double-implication connective. Conjunction elimination: IF-HAVE AB THEN-HAVE A, B. Conjunction introduction: IF-HAVE A AND-HAVE B THEN-HAVE AB. Disjunction introduction (one case): IF-HAVE A THEN-HAVE AB. Commutativity of conjunction: IF-HAVE AB THEN-HAVE BA. Many other possibilities. The above rules all apply to Propositional Logic as well as Predicate Logic, but ….. Towards A Rule involving Variable Instantiation We’d like to be able to go from, say, (p) (is-shop(p) likes(Sally, p)) and, say, is-shop(Gap) to likes(Sally, Gap). Can do this by first “instantiating” the variable p to get is-shop(Gap) likes(Sally, Gap)) and then using MP.
© Copyright 2026 Paperzz