Topics in Artificial Intelligence: Intelligent Problem Solvers This course is about building systems that can reason -that is, solve problems by utilizing Artificial Intelligence techniques. For that, we shall assume that Intelligence is a functional property independent of any physical embodiment. This is known as the physical-symbol system hypothesis formulated by Newell and Simon in 1976. There are other, less-symbolic AI paradigms, such as neural networks and evolutionary computation. What is Intelligence? In most general terms, intelligence is a property attributed to people. She is intelligent = She knows a lot. = She thinks fast. = She talks much. = She learns quickly. Intelligence = Knowledge + ability/capacity to perceive, feel, comprehend, process, communicate, judge, learn. What is Artificial Intelligence? An interdisciplinary field aiming at developing techniques and tools for solving problems that people at good at. Existing definitions of the field advocate everything from replicating human intelligence to simply solving knowledge-intensive tasks. Some examples: “Artificial Intelligence is a study of complex information processing problems that often have their roots in some aspect of biological information processing. The goal of the subject is to identify solvable and interesting information processing problems, and solve them.” -- David Marr. “Artificial Intelligence is the design, study and construction of computer programs that behave intelligently.” -- Tom Dean. “Artificial Intelligence is the enterprise of constructing a physical symbol system that can reliably pass the Turing test.” -- Matt Ginsberg. “Artificial Intelligence is the study of intelligence using the ideas and methods of computation.” – Brady, Bobrow & Davis (in foreword to “Building Problem Solvers” book). Goals of Artificial Intelligence Scientific goal: understand the mechanisms behind human intelligence. Engineering goal: develop concepts and tools for building intelligent programs capable of solving real world problems. Examples of such programs include: – Knowledge-based systems. These capture human knowledge in a particular domain, and are intended to solve problems from that domain. – Common sense reasoning systems. These capture knowledge that people commonly hold (which is why such knowledge is not explicitly communicated), and are intended to do “everyday” reasoning. – Learning systems. These posses the ability to expend their knowledge based on the accumulated experience. – Natural language understanding systems. These support dialog in English/French/Japanese/… language. – Game playing systems. – Intelligent robots. Artificial Intelligence Methodologies Classical problem solving: knowledge defines the so-called “problem space”, and a general-purpose search (such as depth-first or breadth-first) is used as a problem solving technique. Examples: the Boston subway problem (pp. 35) and the Algebra problem solver (pp. 39). Pattern-directed reasoning systems: knowledge is represented as “rules” (such as “if A, then B”), and the so-called “search engine” identifies and fires rules which antecedents hold. Example: the KM* system (pp. 92). Truth Maintenance Systems: the latest AI methodology for efficient search and generation of explanations for proposed solutions. This will be the main focus of our course. We shall discuss different types of TMSs: – – – – Justification-based TMSs. Logic-based TMSs. Assumption-based TMSs. Contradiction-tolerant TMS. We shall also discuss their example applications. As part of this discussion, everybody will be assigned a research paper which must be carefully studied and presented in class at a pre-announced time. This will count as homework 4. Introduction to LISP Why LISP? – Especially designed for symbol manipulation. – Provides built-in support for lists. – Automatic storage management (no need to keep track of memory allocation). – Interactive environment, which allows programs to be developed step by step. If a change is to be introduced, only changed functions need to be recompiled. Recommended books: Winston, Horn LISP, 3rd edition, AddisonWesley, 1993. Norvig P. Artificial Intelligence Programming, Morgan Kaufman, 1992. Basic terminology Atoms: word-like indivisible objects which can be numbers or symbols. Lists: sentence-like objects formed from atoms or other lists, and enclosed in parentheses. S-expressions: compositions of atoms and lists. Procedures: step by step specifications how to do something. – Primitives: procedures supplied by the LISP itself Example: (+ 5 6) – User-defined procedures: procedures introduced by the programmer. Example: (students 'anna) Program: a collection of procedures working together. S-expressions An s-expression can have other s-expressions nested in it. Examples: (+ (* 5 7) ( / 2 4)) (This (is a dog) (or a cat)) Expressions can be interpreted both, procedurally and declaratively. – If interpreted procedurally, an expression provides a direction for doing something. Such an expression is called a form, and its first element is the name of a procedure to be used to produce the value. – The process of computing the value of an expression is called evaluation. – If interpreted declaratively, expressions represent data. Data and procedures have the same syntax. Using Golden Common Lisp for evaluating sexpressions GOLDEN COMMON LISP DEVELOPER 5.00 Copyright (c) 1984-1995 by Gold Hill, Inc., All Rights Reserved. Versions: COLDLOAD 5.002 GCLISP-FILE 2.1 LISPLIB 5.00 Top-Level! * (+ (* 5 7) (/ 2 4)) 71/2 * (This (is a dog) (or a cat)) Undefined function: THIS * Using Allegro Common Lisp for evaluating sexpressions International Allegro CL Trial Edition 6.1 [Windows] (Oct 31, 2001 10:59) Copyright (C) 1985-2001, Franz Inc., Berkeley, CA, USA. All Rights Reserved. CG/IDE Version: 1.389.2.67.2.25 ;; Optimization settings: safety 1, space 1, speed 1, debug 2. ;; For a complete description of all compiler switches given the current ;; optimization settings evaluate (EXPLAIN-COMPILER-SETTINGS). [changing package from "COMMON-LISP-USER" to "COMMON-GRAPHICSUSER"] CG-USER(1): (+ (* 5 7) (/ 2 4)) 71/2 CG-USER(2): (This (is a dog) (or a cat)) Error: attempt to call `THIS' which is an undefined function. [condition type: UNDEFINED-FUNCTION] CG-USER(3): Evaluation of atoms The value of a number is the number itself. Example: 5 ==> 5 The value of a string is the string itself. Example: “Nice day” ==> “Nice day” The value of the symbol T is T (true). The value of the symbol NIL is NIL (false). The symbol NIL and the empty list ( ) are the same thing. Variables are names of memory locations. The contents stored in a given memory cell is the value of the variable serving as a name of this location. Example: Let x be a variable, and 5 be the contents of the memory cell called x. Then, the value of x is 5. Numbers Integers: 179, 45 Ratio: 5/7, 7/9 Floating point: 5.2, 7.9 Examples: * (/ 25 5) 5 * (/ 46 9) 46/9 * (float (/ 46 9)) 5.111111 * (round (/ 46 9)) 5 1/9 ; do not divide evenly ; the nearest integer ; the remainder More numeric primitives * (- 6) -6 * (- -6) 6 * (max 5 7 2) 7 * (min 5 7 2) 2 * (sqrt (* (+ 1 3) (* 2 2))) 4.0 * (+ (round (/ 22 7)) (round (/ 7 3))) 5 * (+ 2 2.5) 4.5 * (expt 3 6) 729 * (sqrt 81) 9.0 * (sqrt 82) 9.055386 * (abs 6) 6 * (abs -6) 6 Representation of atoms and lists in a computer memory Consider the list (A (B (C))). It can be represented by means of the following diagram: A These boxes are called cons cells. B C Each cons cell consists of 9 bytes: 1 leading byte, called the data type byte. It holds information indicating that the particular group of 9 bytes is part of a list (i.e. a cons cell). 2 groups of 4 bytes each, representing pointers. Each pointer is an address -- the first one to the memory location containing the first element of the list, and the second one to the memory location storing the rest of the list. The second pointer of the last element of each list contains zeros (representing NIL and empty list), i.e. no cons cell corresponds to the empty list. CONS builds new lists Example: Given the list (Education is power), build a new list from it and the atom University. * (cons 'University '(Education is power)) (UNIVERSITY EDUCATION IS POWER) To implement this, LISP maintains a list of free boxes (cons cells), called the free-storage list. CONS removes the first box from the free-storage list, and deposits new pointers into it. Education is power Free storage list ... University Dotted pairs Consider the list (A B . C). Here (B . C) is called a dotted pair, and is represented as follows: B C To construct the list (A B C), we write: * (cons 'A (cons 'B (cons 'C NIL))) To construct the list (A B . C), we write: * (cons 'a (cons 'b 'c))