of 43/43
Artiﬁcial Artiﬁcial Intelligence Intelligence Dr. Eng. Ahmed Moustafa Elmahalawy Computer Science and Engineering Department

# Artificial Intelligence Dr. Eng. Ahmed Moustafa Elmahalawy Computer Science and Engineering Department

• View
224

5

Tags:

Embed Size (px)

### Text of Artificial Intelligence Dr. Eng. Ahmed Moustafa Elmahalawy Computer Science and Engineering...

• Slide 1

Artificial Intelligence Dr. Eng. Ahmed Moustafa Elmahalawy Computer Science and Engineering Department Slide 2 Artificial Intelligence Chapter 4: Knowledge Representation 4.5 Propositional Logic Propositional Logic is a formal system in which knowledge is represented as propositions. Further, these propositions can be joined in various ways using logical operators. These expressions can then be interpreted as truth-preserving inference rules that can be used to derive new knowledge from the old, or test the existing knowledge. Slide 3 First, lets introduce the proposition. A proposition is a statement, or a simple declarative sentence. For example, the book is expensive is a proposition. Note that a definition of truth is not assigned to this proposition; it can be either true or false. Artificial Intelligence Chapter 4: Knowledge Representation Slide 4 In terms of binary logic, this proposition could be false in Cairo, but true in England. But a proposition always has a truth value. So, for any proposition, we can define the true-value based on a truth table (see the following figure). This simply says that for any given proposition, it can be either true or false. Slide 5 We can also negate our proposition to transform it into the opposite truth value. For example, if P (our proposition) is the book is expensive, then ~P is the book is not expensive. Artificial Intelligence Chapter 4: Knowledge Representation Slide 6 Propositions can also be combined to create compound propositions. The first, called a conjunction, is true only if both of the conjuncts are true (P and Q). The second called a disjunction, is true if at least one of the disjuncts are true (P or Q). Slide 7 The truth tables for these are shown in the following figure. These are obviously the AND and OR truth tables from Boolean logic. Artificial Intelligence Chapter 4: Knowledge Representation Slide 8 The power of propositional logic comes into play using the conditional forms. The two most basic forms are called 1- Modus Ponens. 2- Modus Tollens. Slide 9 1- Modus Ponens is defined as: P, (P->Q), infer Q which simply means that given two propositions (P and Q), if P is true then Q is true. In English, lets say that P is the propositionthe light is on and Q is the proposition the switch is on. The conditional here can be defined as: if the light is on then the switch is on Artificial Intelligence Chapter 4: Knowledge Representation Slide 10 The truth table for Modus Ponens is shown in the following Figure. Artificial Intelligence Chapter 4: Knowledge Representation Slide 11 Modus Tollens takes the contradictory approach of Modus Ponens. With Modus Tollens, we assume that Q is false and then infer that the P must be false. Modus Tollens is defined as: P, (P->Q), not Q, therefore not P. Slide 12 Returning to our switch and light example, we can say the switch is not on, therefore the light is not on. The formal name for this method is proof by contra positive. The truth table for Modus Tollens is provided in the following figure. Artificial Intelligence Chapter 4: Knowledge Representation Slide 13 Slide 14 A famous inference rule from propositional logic is the hypothetical syllogism. This has the form: ((P->Q) ^ (Q->R), therefore (P->R) In this example, P is the major premise, Q is the minor premise. Both P and Q have one common term with the conclusion, P->R. Artificial Intelligence Chapter 4: Knowledge Representation Slide 15 Propositional logic includes a number of additional inference rules (beyond Modus Ponens and Modus Tollens). These inferences rules can be used to infer knowledge from existing knowledge (or deduce conclusions from an existing set of true premises). Slide 16 4.5.1 Deductive Reasoning with Propositional Logic In deductive reasoning, the conclusion is reached from a previously known set of premises. If the premises are true, then the conclusion must also be true. Artificial Intelligence Chapter 4: Knowledge Representation Slide 17 Lets now explore a couple of examples of deductive reasoning using propositional logic. As deductive reasoning is dependent on the set of premises, lets investigate these first. 1) If its raining, the ground is wet. 2) If the ground is wet, the ground is slippery. Slide 18 The two facts (knowledge about the environment) are Premise 1 and Premise 2. These are also inference rules that will be used in deduction. Now we introduce another premise that it is raining. 3) Its raining. Artificial Intelligence Chapter 4: Knowledge Representation Slide 19 Now, lets prove that its slippery. First, using Modus Ponens with Premise 1 and Premise 3, we can deduce that the ground is wet: 4) The ground is wet. (Modus Ponens: Premise 1, Premise 3) Again, using Modus Ponens with Premise 3 and 4, we can prove that its slippery: 5) The ground is slippery. (Modus Ponens: Premise 3, Premise 4) Slide 20 4.5.2 Limitations of Propositional Logic While propositional logic is useful, it cannot represent general-purpose logic in a compact and summary way. For example, a formula with N variables has 2^N different interpretations. It also doesnt support changes in the knowledge base easily. Artificial Intelligence Chapter 4: Knowledge Representation Slide 21 Truth values of propositions can also be problematic, for example; consider the compound proposition below. This is considered true (using Modus Ponens where P -> Q is true when P is false and Q is false, see the truth table of Modus Ponens). If dogs can fly, then cats can fly. Slide 22 Both statements are obviously false, and further, theres no connection between the two. But from the standpoint of propositional logic, they are syntactically correct. A major problem with propositional logic is that entire propositions are represented as a single symbol. Artificial Intelligence Chapter 4: Knowledge Representation Slide 23 4.6 First-Order Logic (Predicate Logic) One issue with propositional logic is that its not very expressive. For example, when we declare a proposition such as: _ The ground is wet. Slide 24 Its not clear which ground were referring to. Nor can we determine what liquid is making the ground wet. Propositional logic lacks the ability to talk about specifics. In the other hand, well explore predicate calculus (otherwise known as First-Order Logic, or FOL). Using FOL, we can use both predicates and variables to add greater expressiveness as well as more generalization to our knowledge. Artificial Intelligence Chapter 4: Knowledge Representation Slide 25 In FOL, knowledge is built up from 1- Constants (the objects of the knowledge) 2- A set of predicates (relationships between the knowledge) 3- Some number of functions (indirect references to other knowledge). Artificial Intelligence Chapter 4: Knowledge Representation Slide 26 4.6.1 Atomic Sentences A constant refers to a single object in our domain. A sample set of constants include: ali, mona, bicycle, scooter, the-stranger, colorado Slide 27 A predicate expresses a relationship between objects, or defines properties of those objects. A few examples of relationships and properties are defined below: owns, rides, knows, person, sunny, book, two- wheeled Artificial Intelligence Chapter 4: Knowledge Representation Slide 28 With our constants and predicates defined, we can now use the predicates to define relationships and properties of the constants (also called Atomic sentences). First, we define that both Ali and Mona are Persons. The Person is a property for the objects (Ali and Mona). _Person( ali) _Person( mona) Slide 29 The above may appear as a function, with Person as the function and Ali or Mona as the argument. But in this context, Person(x) is a unary relation that simply means that Ali and Mona fall under the category of Person. Now we define that Ali and Mona both know each other. Artificial Intelligence Chapter 4: Knowledge Representation Slide 30 We use the knows predicate to define this relationship. Note that predicates have arity, which refers to the number of arguments. The Person predicate has an arity if one where the predicate knows has an arity of two. _Knows( ali, mona ) _Knows( mona, ali ) Slide 31 We can then extend our domain with a number of other atomic sentences, shown and defined below: _Rides( ali, bicycle ) - ali rides a bicycle. _Rides( mona, scooter ) - mona rides a scooter. _Two-Wheeled (bicycle)- A Bicycle is two- wheeled. _Book( the-stranger ) - The-Stranger is a book. _Owns( mona, Book(the-stranger) ) - mona owns a book called The Stranger. Artificial Intelligence Chapter 4: Knowledge Representation Slide 32 Finally, a function allows us to transform a constant into another constant. For example, the sister_of function is demonstrated below: _Knows( ali, sister_of( hassan ) ) -ali knows Hassans sister. Artificial Intelligence Chapter 4: Knowledge Representation Slide 33 4.6.2 Compound Sentences Recall from propositional logic that we can apply Boolean operators to build more complex sentences. In this way, we can take two or more atomic sentences and with connectives, build a compound sentence. A sample set of connectives is shown below: Slide 34 Artificial Intelligence Chapter 4: Knowledge Representation AND OR NOT Logical Conditional (then) Logical Biconditional Slide 35 Artificial Intelligence Chapter 4: Knowledge Representation Examples of compound sentences are shown below: - ali and mona know one another. Knows(ali, mona) Knows(mona, ali) - ali knows mona, and mona does not know ali. Knows( ali, mona ) Knows( mona, ali ) -ali rides a scooter or ali rides a bicycle. Rides( ali, scooter) Rides( ali, bicycle) Slide 36 We can also build conditionals using the logical conditional connective, for example: - If ali knows mona, then mona knows ali. Knows( ali, mona ) Knows( mona, ali ) Artificial Intelligence Chapter 4: Knowledge Representation Slide 37 This can also be written as a biconditional, which changes the meaning slightly. The biconditional, a b simply means b if a and a if b, or b implies a and a implies b. - ali knows mona if mona knows ali. Knows( ali, mona ) Knows( mona, ali ) Slide 38 NOTE Another way to think about the biconditional is from the construction of two conditionals in the form of a conjunction, or: (a b) (b a) This implies that both are true or both are false. Artificial Intelligence Chapter 4: Knowledge Representation Slide 39 4.6.3 Variables So far, weve explored sentences where all of the information was present, but to be useful, we need the ability to construct abstract sentences that dont specify specific objects. This can be done using variables. Artificial Intelligence Chapter 4: Knowledge Representation Slide 40 For example: - If x Knows mona, then x is a Person. Knows( x, mona ) Person( x ) If we also knew that: Knows( ali, mona) then we could deduce that ali is a person (Person(ali)). Slide 41 4.6.4 Quantifiers A quantifier is used to determine the quantity of a variable. In first-order logic, there are two quantifiers, 1- The universal quantifier ( ) 2- The existential quantifier ( ) Artificial Intelligence Chapter 4: Knowledge Representation Slide 42 The universal quantifier is used to indicate that a sentence should hold when anything is substituted for the variable. The existential quantifier indicates that there is something that can be substituted for the variable such that the sentence holds. Lets look at an example of each. Slide 43 - There exists x, that is a Person. x. Person( x ) - For all people, there exists someone that Knows ali or mona. x. x. Person( x ) (Knows( x, mona) Knows (x, ali)) - For any x, if there is someone x that Knows mona, then x is a Person. x. x. Knows( x, mona ) Person( x ) Artificial Intelligence Chapter 4: Knowledge Representation

Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Documents
Science
Documents
Documents
Documents
Documents
Technology
Documents
Documents
Documents
Documents
Documents
Documents