


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



























There are many different competing definitions for AI, each with strengths and weaknesses. Some of them follow: AI is concerned with creating intelligent computer systems - however, we don't have a good definition of intelligent "AI is the study of systems that would act in a way that to any observer would appear intelligent" (Coppin) - this is dependent on the observer, and some observers that work in marketing have a very loose definition of intelligence. We can define two types of AI from the above defintion: Weak AI - Machines can possibly act as if they were intelligent Strong AI - Machines can actually think intelligently Alan Turing developed the Turing Test to check intelligence using the weak AI definition. The Turing Test is stuch that an interrogator is communicating with another group of people and a computer - however, he doesn't know which one. If 30% of the time (an arbitrary figure), the computers are able to fool the interrogator it is a real person, then the system has passed the Turing test. Strong AI proponents have put forward the Chinese room test. A person P1 communicates in Chinese with another person, P2, by passing written notes back and forth. P2 does not know Chinese, however. P2 has a room full of books that tell him what to do for each character in the note (similar to a Turing machine). Assuming all the rules are correct, does P2 speak Chinese? Other questions can be asked of intelligence. Goedel/Turing said that there are problems that computers are not able to compute (e.g., the halting problem), however the question must be asked - can humans? Therefore, are Turing machines the most powerful computational model? Further definitions of AI include: "AI involves using methods based on intelligent behaviour of humans (or animals) to solve complex problems" (Coppin). This is nature orriented AI. AI is concerned with making computers more useful and useable - this definition is very vague, so it can be applied to all AI projects, but also to more general CS problems, and indeed could be the basis for all CS. AI is what AI researchers do - this is probably the best definition to date
"An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators." (Russel and Norvig) However, thermostats (which respond to changes in temperature by turning heating on or off) could also be included in that definition, but is not an AI. Agents used to act only in closed systems, where the environment was very constrained and controlled, but now they are behaving in increasingly open environments. We should consider intelligent agents, which can be defined by three characteristics according to Wooldridge (1999): Reactivity - Agents are able to perceive the environment and respond in a timely fashion to changes Proactiveness - Agents are able to exhibit goal-directed behaviour by taking initiative Social Ability - Agents are capable of interacting with other agents (and possibly humans) This definition still includes thermostats, so it still has weaknesses. Intelligent agents consist of various components which map sensors to actuators. The most important component is that of reasoning, which consists of representations of the environment (more than just pixels from a camera, but a semantic model which is a representation of the images), formulating a course of action (planning), path finding and steering, learning, social reasoning (competing and cooperating) and dealing with uncertainty (where the effects of an action are not known, so a decision must be made based on this).
how. Computation is performed by an interpreter that must decide how to perform the computation. Logic programming is a form of declerative programming. Logic programs consist of statements of logic that say what is true of some domain. Computation is deduction; answers to queries are obtained by deducing the logical consequences of the logic program, thus, the interpreter is an inference engine. Programs can also contain information that helps guide the interpreter.
A problem representation is defined by five items: set of states initial state finite set of operators - each is a function from states to states. The function may be partial as some operators may not be applicable to some states. goal test - can be explicit or implicit path cost - additive, so can be derived from the action costs A solution is a sequence of operators that leads from the intial state to a state that satisfies the goal test. Instead of operators, we could have successor functions. If s is a state then Successors is defined to be { x | x = op , for some operator op } A problem representation can also be depicted as a state space - a graph in which each state is a node. If operator o maps state s1 to state s2 , then the graph has a directed arc from s1 to s2 and the arc is labelled o. Labels could also be added to indicate the intial state and the goal states. Arcs can also be labelled to indicate operator costs. Often a problem itself has a natural notion of configurations and actions. In such cases we can build a direct representation in which the state and operators correspond directly to the configurations and actions. However, operators in the representation might not correspond directly to actions in the world. Some problems can be solved both ways, for example both towards and from the goal. If the real world has a natural direction, then we can refer to the search process as either forwards (if it matches the direction in the natural world) or backwards search. An alternative view is that we can start with an empty sequence and fill in a middle state first, before filling in the first or last actions. In this view, states to not correspond directly to actions, but to the sequence built up so far - this is called indirect representation. In direct representations, there is a close correspondence between problems and their representations, however it is important not to confuse them, especially because some
representations are not direct. It is important to recognise that states are data structures (and they only reside inside a computer), and operators map data structures to data structures.
A problem representation implicitly defines a search tree. Root is a node containing the initial state. If a node contains s , then for each state s ′ in Successors, the node has one child node containing the state s ′. Each node in the search tree is called a search node. In practice, it can contain more than just a state, e.g., the path cost from the initial node. Search trees are not just state spaces, as two nodes in a tree can contain the same state. Search trees could contain infinite paths, which we need to eliminate. This could be due to an infinite number of states, or where the state space contains a cycle. Search trees are always finitary (each node has a finite number of children), since a problem representation has a finite number of operators.
As we saw earlier, given a problen representation, search is the process that builds some or all of the search tree for the representation in order to either identify one or more of the goals and the sequence of operators that produce each, or identify the least costly goal and the sequence of operators that produces it. Additionally, if the search tree is finite and does not contain a goal, then search should recognise this. The basic idea of tree search is that it is an offline, simulated exploration of state space by generating successors of already-explored states (a.k.a., expanding states). The general search algorithm follows the general idea that you maintain a list L containing the fringe nodes:
Depth limited search is DFS with depth limit l. That is, nodes deeper than l will not be expanded. This solution is not complete, as a solution will only be found if d > l. It has a time complexity Ο( bl ) and a space complexity Ο( bl ). Also, the solution is not optimal.
Depth limited search can be made complete using iterative deepening. The implementation of this is: set l = 0 do depth limited search with limit l l++ until solution found or no nodes at depth l have children This does have a lot of repetition of the nodes at the top of the search tree, so it's a class memory vs. CPU trade-off - this is CPU intensive, but only linear in memory. However, with a large b , the overhead is not too great, for example, when b = 10 and d = 5 the overhead is 11%. IDS is complete, has a time complexity of ( d + 1) b^0 + db^1 + ( d - 1) b^2 + ... + bd , or Ο( bd ) and a space complexity of Ο( bd ). Like BFS, it is optimal if step cost = 1.
Failure to detect repeated states can turn a linear space into an exponential one. Any cycles in a state space will always produce an infinite search tree. Sometimes, repeated states can be reduced or eliminated by changing the problem representation, e.g., by adding a precondition saying that the inverse of the previous operation is not allowed will eliminate cycles of length 2. Another way of handing repeated states is by checking whether or not a node is equal to one of its ancestors, and don't add it if it is. For DFS-type algorithms, this is relatively easy to implement as all ancestors are already on the node list, however for other algorithms, this takes Ο( d ) to traverse up the node list, or keeping a record of all the ancestors of a node, which consumes a lot of space. A better way to solve this is to use graph search, which keeps track of all generated states. When a node is removed from the node list (the open list), it is stored on another list (the closed list). The basic version is the same as tree search, but you don't expand a node if it has the same state as one on the closed list. A more sophisticated version is required to retain optimality: If the new node is "cheaper" than its duplicate on the closed list, then the one on the closed list and its descendants must be deleted.
Siblings can still be created, however, so another way would be compare the node to all nodes - this is very expensive, so the normal solution to repeated states is to rewrite the problem representation. We can consider the search algorithms above to be uninformed, that is, only the structure of the search tree and not at the states inside the nodes - these are blind search algorithms. We can improve these search algorithms by inspecting the contents of a node to see whether or not they are a good node to expand, we can call these type of algorithms informed search. The way of choosing whether or not a node is good is done using a heuristic, which makes a guess, using rules of thumb, as to whether that state is a good one or not. As these problems are NP-complete, heuristics are never accurate, but the guesses they make could be good. The general search algorithm for informed search is called best-first search, although this is a slight misnomer, as if it were truly best-first, we would be able to go straight to the goal state. The general idea here is to use an evaluation function ƒ( n ) for each node n , which gives us an estimate of desirability - only part of the evaluation functions needs to be a heuristic for the search to become informed. We then expand the most desirable unexpanded node. This is done by ordering the nodes in L in decreasing order of desirability, and nodes are always chosen from the front of L.
In Greedy Best-First Search, the evaluation function ƒ( n ) = h ( n ), our heuristic (an estimate of cost from n to the nearest goal). In our distance-finding example, this could be the straight line distance. Greedy Best-First Search therefore works by expanding the node that appears to be closest to the goal. Greedy Best-First Search is not complete, as there a variety of cases where completeness is lost, e.g., it can get stuck in loops. The time complexity is Ο( bm ), but a good heuristic can give dramatic improvement. The space complexity is also Ο( bm ), as all nodes are kept in memory. Greedy best-first search is also not optimal.
Greedy Best-First Search ignores the cost to get to the goal, which loses optimality. We therefore need to consider the cost to get to the node we are at. The basic idea of this is to avoid expanding paths that are already expensive. For this, we update our evaluation function to be ƒ( n ) = g ( n )
Theorem: If h ( n ) is consistent, A* using graph-search is optimal. The proof for this is similar to that for uniform cost. Admissible heuristics can be discovered by relaxing the problem to a simpler form (i.e., removing some constraints so it becomes easier to solve). If we have two heuristics where h 1 is a relaxed form of h 2 and both are admissible, then ∀ n h 2 ( n ) ≥ h 1 ( n ), then we can say that h 2 dominates h 1. Theorem: If h 2 domaintes h 1 then A* with h 1 expands at least every node expanded by A* with h 2.
Logic is the study of what follows from what, e.g., if two statements are true, then we can infer a third statement from it. It does not matter if the statements are actually true, just that if x and y is true, then z must also be true to be a valid statement. Logic is useful for: Reasoning about combinatorial circuits Reasoning about databases Giving semantics to programming languages Formally specifying software and hardware systems - model-checking and theorem-proving can be used to show that the system meets the specification or that the system has certain properties. Capturing complexity classes (e.g., there is a correspondance between problems in NP and the forumlas of existential second-order logic - more precisely, a forumla and a problem correspond if there is a one-to-one mapping between the models satisfying the formula and the solutions to the problem) AIMA 7.6SAT (the satisfiability problem) solvers can solve practical problems. Cook showed all problems in NP can be polynomial reduced to SAT, but until recently no SAT solver could practically solve the very large number of clauses mapping an NP problem to SAT generates. Modern SAT solvers can now support up to 1,000,000 clauses so many practical problems can be solved by mapping them to SAT. Logic is very important for AI as flexible, intelligent agents need to know facts about the world in which they operate - declerative knowledge and procedural knowledge - how to accomplish tasks. e.g., procedural - don't drink poison; declerative - drinking poison will kill you, and you want to stay alive. Every way we can represent the world is a model, thus any model where the statement x is true, and y is true, we can infer a condition z based on those two statements. However, if we can infer a counter model where the premises are true, but the condition isn't, the argument is invalid.
Some words in an argument have set logical meanings, such as Some or Every, but others have variable meanings, such as foo or bar. Words that don't very in meaning are called logical symbols. The semantics of a statement is whether or not a statement is true in a world, and is giving meaning to a statement. Rule based systems use proof theory to take our arguments and check their validity, e.g., some X is a Y, every Y is a Z → some X is a Z is valid. We can express this as X/Y, Y/Z ∴ X/Z, which is valid and we don't need to consider the rules. We need to consider a grammar, where we can express this formally, and the semantics that determine the validity of the arguments. Ways of doing this include propositional and first-order logic. The requirements for a declerative representation language are: The language should have syntax (a grammar defining the legal sentences) The language must have semantics (what must the world be like for a sentence to be true - truth-conditional semantics; there are other type of semantics dealing with other types of meaning, but we will not be dealing with that). Intelligent agents need to reason with their knowledge, and many kinds of reasoning can be done with declarative statements: educated guesses reasoning by analogy jump to conclusions make generalisations However, for LPA we will focus on sound, logical reasoning - i.e., deducing logical consequences of what is known, as determined by truth-conditional semantics.
As discussed above, we can discuss a declarative representation language using a syntax and a semantics. For propositional logic, our syntax consists of a lexicon and a grammar. The lexicon (non-logical symbols) of propositional logic consists of a set of proposition symbols. Throughout the examples, we can assume that, P, Q, R, S and T are among the propositional symbols. The logical symbols of propositional logic are ¬, ∨, ^, →, ↔. We can then define the sentences of propositional logic as: If α is a proposition letter, then α is an atomic sentence If α and β are sentences, then (¬α), (α ∨ β), (α ^ β), (α → β) and (α ↔ β) are molecular sentences.
I falsifies A if and only if [[α]]I^ = FALSE A (or α) is satisfiable if and only if it is satisfied by some model α is valid and unfalsifiable if and only if it is satisfied by every model Note that although each individual sentence in A may be satisfiable, yet A itself may be unsatisfiable. For example, {P, ¬P} is unsatisfiable, yet P and ¬P are each satisfiable. Thus, not every unsatisfiable set of sentences if a set of unsatisfiable sentences. As we can see, the notion of a valid sentence is therefore different to the notion of a valid argument, but it is related. There are some special definitions worth noting, however. The empty set of sentences if satisfied by every model, hence ∅ entail C if and only if C is a valid sentence An unsatisfiable sentences is entailed only by an unsatisfiable set of sentences A valid sentence is entailed by any set of sentences Two sets of sentences are logically equivalent if they are satisfied by precisely the same models (they have the same truth value in all models). Two sentences are logically equivalent if and only if they entail each other.
Again, we start by considering the syntax of FOPC. The lexicon (non-logical symbols) of FOPC consist of the disjoint sets of a set of predicate symbols, each having a specified arity ≥ 0 (we often refer to symbols with arity 0 as proposition symbols - propositional logic is where all predicates have no arguments), and a set of function symbols, each having a specified arity ≥ 0 (function symbols of arity 0 are often called individual symbols, or often a a misnomer, constants), and finally a set of variables. The logical symbols of FOPC consist of the quantifiers ∀ and ∃, and the logical connectives ¬, ^, ∨, → and ↔. We can define the terms of FOPC as individual symbols, variables, and function symbols, where if ƒ is a function symbol of arity n and t 1 , ..., tn are terms then ƒ( t 1 , ..., tn ) is a term. The formulas of FOPC are defined as atomic formulas, where if P is a predicate symbol of arity n and t 1 , ..., tn are terms, then P( t 1 , ..., tn ) is an atomic formula, and as molecular formulas, where if α and β are formulas, then ¬α, (α ∨ β), (α ^ β), (α → β) and (α ↔ β) are molecular formulas. Additionally, if x is a variable and α is a formula, then (∀ x α) and (∃ x α) are molecular formulas. We can consider variables to be either bound or free. We say that a variable x occuring in a formula α is bound in α if it occurs within α as a subformula of the form ∀ x β or ∃ x β. Otherwise we call the variable free. We call a formula α a sentence if there is no free occurance of a variable.
Sentences have truth values, as FOPC is based on compositional semantics, where the total truth value is equal to the sum of its parts. Like with propositional logic, we can drop paranthesis if no ambiguity results, and we often give connectives and quantifiers precedence from high to low (¬, ∨, ^, →, ↔, ∀, ∃). We often specifiy ∀ x 1 , x 2 , ..., xn as a shorthand for ∀ x 1 , ∀ x 2 , ..., ∀ xn , and similarly for ∃. If a term or formula contains no variables, we refer to it as ground. α ∨ β is a disjunction, where α and β are its disjuncts and α ^ β is a conjunction, where α and β are its conjuncts. We can also consider first order propositional logic, which is first order predicate calculus with equality. The equality symbol "=" is both a logical symbol and a binary predicate symbol. Atomic formulas using this predicate symbol are usually written as ( t 1 = t 2 ), instead of =( t 1 , t 2 ). Also, we usually write ( t 1 ≠ t 2 ) instead of ¬( t 1 = t 2 ). To consider the semantics of FOPC, we define a pair ( D , A ), where D is a potentially infinite non-empty set of individuals called the domain and A is a function that maps each n -ary function symbol to a function from D n^ to D and each n -ary predicate symbol to a function D n^ to {TRUE, FALSE}. Individual symbols (function symbols of 0-arity) always map to an element of D and a predicate symbol of arity 0 (i.e., a proposition symbol) is mapped to TRUE or FALSE. When we are considering formula with free variables, the truth value depends not only on what model we are considering, but what values we give to these variables. For this purpose, we will consider the value of an expression relative to a model and a function from variables to D. Such a function is called a value assignment. If α is an expression or a symbol of the language, then [[α]]I,^ g is the semantic value of α relative to model I and value assignment g. If g is a value assignment, then g [ x ↵ i ] is the same value assignment, with the possible exception that g x → i = i.
Proof systems work by a syntactic characterisation of valid arguments. Here, we will consider the Hilbert, or axiomatic, system. These systems work by starting with the set of premises of the argument, and repeatedly apply inference rules to members of the set to derive new sentences that are added to the set, the goal being to derive the conclusion of the argument. Some proof systems start with a possibly infinite set of logical axioms (e.g., every sentence of the form α ^ ¬α).
Many proof systems for propositional logic employ a wide variety of rules. Commonly used rules include and-introduction - from any two sentences α and β, derive α ^ β - and modus ponens - from any two sentences of the form α and α → β, derive β.
We can also reason backwards, where a proof can be turned upside down and we start from the conclusion and work towards [], the truth condition.
Each premise in a propositional Horn clause argument is a definite clause (α 1 ^ ... ^ α n ) → β, where n ≥ 0 and each α i and β is atomic. If n = 0, then we have that → β is a definite clause, and we usually write this as simply β. The conclusion in a propositional Horn clause argument is a conjunction of atoms α 1 ^ ... ^ α n. As a special case, we can consider [] when n = 0. We call this the empty conjunction and it is true in all models.
The SLD resolution inference rule is used to derive a goal clause from a goal clause and definite clause. From the goal clause G 1 ^ ... ^ G i - 1 ^ G i ^ G i + 1 ^ ... ^ G n ( n ≥ 1) and the definite clause B 1 ^ ... ^ B m → H ( m ≥ 0) we can derive the goal clause G 1 ^ ... ^ G i - 1 ^ B 1 ^ ... ^ B m ^ G i + 1 ^ ... ^ G n , provided that H and G i are identical. Because of their special form, SLD proofs are often shown simply as:
Where the number following is the number of the premise that SLD resolution was applied to. The element of the goal clause that is chosen to have SLD resolution applied to it is chosen using a selection function, and the most common selection functions are the leftmost and rightmost selection functions. We have the following properties about SLD inference:
The goal here is to generalise SLD resolution for propositional Horn-clause arguments to handle first order Horn-clause arguments (i.e., a subset of predicate calculus). If we let Φ be a forumla whose free (unbound) variables are x 1 , ..., xn , then ∀Φ is the universal closure of Φ, which abbreviates ∀ x 1 , ..., xn Φ. Furthermore, ∃Φ is the existential closure of Φ and abbreviates ∃ x 1 , ..., xn Φ. Each premise in a first order Horn-clause argument is a definite clause∀((α 1 ^ ... ^ α n ) → β), where n ≥ 0 and where each α i and β are atomic formulas of first order predicate calculus. If n = 0, then we have that ∀(→ β), which is a definite clause and we simply write this as ∀β. The conclusion in a propositional Horn-clause argument is a goal clause ∃(α 1 ^ ... ^ α n ), where each α i is an atomic formula of first-order predicate calculus. As a special case when n = 0, we can write [] - this is the empty conjunction which is true in all models. Since all variables in the definite clause are univerally quantified, and all those in the goal clause are existentially quantified, the closures are often not written, so in such cases, it is important to bear in mind that they are there implicitly. Substitutions A substitution is a function that maps every expression to an expression by replacing variables with expressions whilst leaving everything else alone. Application of a substitution θ to an
The theorem is: "Let P be a set of definite clauses and G be a goal clause. Then, P entails G if and only if Pgr entails some ground instance of G." The Herbrand theorem gives us an idea of how SLD resolution should work for first order Horn clause arguments. The best way to demonstrate this is with some example arguments and their SLD search spaces. (1) P( a ) (2) P( c ) → P( d ) (3) R( d ) → P( e ) (4) R( d ) P( x ) P( x ) (1) [] - considering x replaced by a (2) P( c ) - considering x replaced by d (3) R( d ) - considering x replaced by e (4) [] Where variables occur in the premises, they can be replaced by any constant in a similar way to variables in the goal, as long as the variable replacements are consistent. Unifiers A substitution θ is said to unify expressions e 1 and e 2 if e 1 θ = e 2 θ. We call these two expressions unifiable, and θ is the unifier. The set of the set of all unifiers of two expressions can be characterised by a greatest element, the most-general unifier. If we let e 1 and e 2 be two expressions that have no variables in common, then e 1 and e 2 are unifiable if and only if the intersection of ( e 1 )gr and ( e 2 )gr is non-empty. Furthermore, if they are unifiable and θ is their most general unifier, then ( e 1 θ)gr = ( e 2 θ)gr = ( e 1 )gr ∩ ( e 2 )gr. We can say that a substitution θ solves an equation e 1 = e 2 if e 1 θ= e 2 θ. We say that a substitution solves a set of equations if it solves every equation in the set. (Note that ∅ is solved by every substitution). Thus, we can view the problem of finding a most general unifier of e 1 and e 2 as that of finding the most general solution to e 1 = e 2. The unification algorithm finds a most general solution to any given finite set of equations by rewriting the set until it is in such a form that a most general solution to it is readily seen. An occurance of an equation in an equation set is in solved form if the equation is of the form x = t and x does not occur in t or in any other equation in the equation set. A set of equations is in solved form if every equation in the set is in solved form. { x 1 → t 1 , ..., xn → tn } is a most general solution to the solved form set of equations { x 1 = t 1 , ..., xn = tn }. The unification algorithm takes two expressions, s 1 and s 2 , and outputs either a substitution or failure. We let X be the singleton set of equations { s 1 and s 2 } and repeatedly perform any of the
four unification transformations until no transformation will apply. The output is of the form { x 1 → t 1 , ..., xn → tn }, where x 1 = t 1 , ..., xn = tn are the equations that remain in X. The four unification transactions are: