Representation in Artificial Intelligence Module 3
Knowledge Representation
REPRESENTATION Induction puzzles are logic puzzles that are solved via the identification and subsequent elimination of perhaps a series of obvious cases. One such puzzle is the well-known King’s Wise Men.
The King’s Wise Men puzzle
The King’s Wise Men problem Representation Before we can solve this puzzle (by machine) we must have a suitable representation. Predicate logic will be used for this puzzle because it allows each state to be denoted by a distinct expression. For example, we can let the predicate WM_1( ) denote that wise man 1 has a hat of some color (to be specified), then the situation in which wise man one has a blue hat and both wise men two and three are wearing white hats is represented by: WM_1 (B) ˄ WM_2 (W) ˄ WM_3 (W) -- (1) If a representation for this puzzle is to be useful, then it must be possible to make inferences, in other words, to draw conclusions that help to solve the puzzle. Scanning Expression (1) for example, you should be able to conclude that wise man one will raise his hand and declare that his hat is blue.
The King’s Wise Men problem Representation He can correctly do so because the king promised that at least one of the three hats must be blue, and he observes that both other wise men are wearing white hats, hence his hat must be blue. By consulting Table, you should be able to deduce the outcome for the other two cases in which only one blue hat is present (Expressions 2 and 3). The king has promised that at least one of the hats will be blue, so we do not include the expression WM_1(W) ˄ WM_2(W) ˄ WM_3(W), which denotes that all three wise men are wearing white hats. The cases with two blue hats are more subtle. We consider the situation depicted by Expression (4) in Table.
Knowledge Representation Issues Issue #1: Expressiveness Issue #2: Uncertainty and Incomplete Information Issue #3: Ontologies and Semantic Interoperability Issue #4: Knowledge Acquisition and Maintenance Note: Expressiveness = Emotion, Feeling, Soulfulness Ontologies = Ontology is a formal way of representing knowledge in a structured and organized manner.
Issue #1: Expressiveness
Issue #2: Uncertainty and Incomplete Information
Issue #3: Ontologies and Semantic Interoperability
Ontologies: with Example Suppose you are creating an ontology for a restaurant. Here are some of the concepts and relationships that might be included: In this example, the ontology defines the concepts of "Restaurant," " FoodItem ," "Ingredient," and "Chef," along with their relationships. For example, a restaurant "Serves" a " FoodItem ," which is " ComposedOf " one or more "Ingredient." A "Chef" " SpecializesIn " a certain type of cuisine and has a "Name.“ Concept: Restaurant Relationships: Serves: FoodItem Has: Chef Has: Address Concept: FoodItem Relationships: ComposedOf : Ingredient Has: Price Concept: Ingredient Relationships: Is: Meat Is: Vegetable Is: Dairy Concept: Chef Relationships: SpecializesIn : Cuisine Has: Name By using an ontology like this, it becomes easier to define and reason about concepts related to restaurants and food. For example, an AI system could use this ontology to answer questions like: What are the ingredients in a particular food item? Which restaurants serve a specific type of cuisine? What is the price range for a particular restaurant? Which chefs are associated with a particular restaurant? By defining these concepts and relationships in a structured way, an ontology can help an AI system understand and reason about complex relationships and concepts in a more sophisticated manner.
Semantic Interoperability: with Example Semantic interoperability refers to the ability of different computer systems to understand and share data in a meaningful way. Specifically, it involves ensuring that data from different sources has the same meaning or semantics, so that it can be accurately interpreted and used by different systems. For example, suppose you have two computer systems that are used to manage medical data. One system stores patient information using the term "heart attack," while the other system uses the term "myocardial infarction" to refer to the same condition. If these systems are not designed to understand each other's terminology, they will not be able to communicate effectively, and there is a risk of data being misinterpreted or lost. Semantic interoperability can be achieved in a number of ways, but one of the most common approaches is to use ontologies. An ontology is a formal description of the concepts and relationships within a particular domain, and it provides a way to ensure that different systems are using the same terminology to describe the same things. For example, a medical ontology might define the concept of "heart attack" and specify that it is the same as "myocardial infarction." This would allow different computer systems to recognize that these two terms refer to the same condition, even if they use different terminology to describe it. Another way to achieve semantic interoperability is through the use of standardized data formats and protocols. For example, the HL7 (Health Level Seven) standard is a widely used protocol for exchanging medical information between different systems. By ensuring that all systems are using the same format and protocol, it becomes easier to ensure that data is being interpreted and used consistently across different systems. Overall, semantic interoperability is an important consideration in any system that involves the exchange of data between different systems or organizations. By ensuring that data has the same meaning across different systems, it becomes easier to share and use that data in meaningful ways, which can help to improve healthcare outcomes, support scientific research, and more
Issue #4: Knowledge Acquisition and Maintenance
Predicate Logic
Syntax of Predicate Logic The syntax of predicate logic consists of three main elements: Predicates , Variables , and Quantifiers . Predicates are used to represent properties or relations between objects. They are denoted by uppercase letters such as P, Q, and R. Predicates can have one or more variables, which are denoted by lowercase letters such as x, y, and z. Variables are used to represent individual objects. They can take on values from a given domain, which is usually specified in the context of the problem. Variables are denoted by lowercase letters such as x, y, and z. Quantifiers are used to specify the scope of a variable in a statement. There are two main quantifiers in predicate logic: the universal quantifier (∀) and the existential quantifier (∃). The universal quantifier (∀) is used to make statements about all objects in a given domain, while the existential quantifier (∃) is used to make statements about some objects in a given domain.
Semantics of Predicate Logic
Applications of Predicate Logic
Common Symbols Used in Predicate Logic Symbol Meaning Example D(x) Predicate symbol representing a property or relation D(x) means "x is a dog" ∀ Universal quantifier meaning "for all" ∀x(D(x)) means "For all x, x is a dog" ∃ Existential quantifier meaning "there exists" ∃x(D(x)) means "There exists an x such that x is a dog" ~ Negation meaning "not" ~D(x) means "x is not a dog" ∧ Conjunction meaning "and" D(x) ∧ B(x) means "x is a dog and x barks" ∨ Disjunction meaning "or" D(x) ∨ C(x) means "x is a dog or x is a cat" → Implication meaning "if...then" D(x) → B(x) means "If x is a dog, then x barks" ↔ Biconditional meaning "if and only if" D(x) ↔ F(x) means "x is a dog if and only if x is furry" x, y, z Variables representing objects or entities D(x) ∧ B(x) means "x is a dog and x barks" where x is a variable representing an object or entity Symbol Meaning ⊤ Tautology, meaning "true" ⊥ Contradiction, meaning "false" ≡ Logical equivalence, meaning "if and only if" ¬∀ Existential negation, meaning "there does not exist" ¬∃ Universal negation, meaning "for all, it is not the case that" ≺ Strict partial order, meaning "less than" ≻ Strict partial order, meaning "greater than" ≼ Partial order, meaning "less than or equal to" ≽ Partial order, meaning "greater than or equal to" ⊨ Logical consequence, meaning "entails" ⊭ Logical non-consequence, meaning "does not entail"
Predicate Logic : Example
Propositional Logic – Basics In this text, we use lower case letters from the middle of the English alphabet to denote propositional logic variables: p, q, r. These variables are the primitives, or basic building blocks in this logic. Table shows various compound expressions that can be formed by applying logical connectives (sometimes called functions).
Propositional Logic – Basics The semantics or meaning of these logical connectives is defined by a truth table, in which the value of the compound expression is given for each value of the variables. F denotes false and T denotes true. (Some texts use 0 and 1 respectively for these two truth-values.)
Propositional Logic – Basics Implication (⇒) and the biconditional (⇔) functions are defined in Table. When we say “p implies q,” or “if p then q” in everyday parlance we mean that if some condition p is present, then q will result. For example, “If it rains, then the streets will get wet” is taken to mean that if p: “it rains” is true, then q: “the streets will get wet” is necessarily true. This interpretation is provided in Table by the last row of the truth table for p ⇒ q. This table defines each of F ⇒ F and F ⇒ T as true; there is no rationale from everyday life why this should be so. In propositional logic, however, you can argue that it is impossible to prove that “p does not imply q” when p is false, and hence, in a vacuous sense, the implication is defined as true. Finally, you should have no trouble accepting as false the third line for p ⇒ q, the case in which p is true and q is false. The rightmost column in Table defines the biconditional operator: p ⇔ q, which can be interpreted as “p if and only if q”; we can represent this last phrase as “p iff q.” Observe that p ⇔ q is true whenever both p and q have the same truth-value (both are false, or both true); for this reason, the biconditional operator is sometimes referred to as the equivalence operator.
The inverse of an implication is formed by negating both the antecedent and consequent. The inverse of p ⇒ q is ~p ⇒ ~q. The inverse for our example is: “If a number is not divisible by four, then it is not even.” You are asked to find a counterexample for this assertion. We use the symbol ≡ to denote that two logical expressions are equivalent. For example, (p ⇒ q) ≡ ~p ˅ q. Such a compound expression is referred to as a theorem. Observe that parentheses are employed to clarify the interpretation of an expression. Propositional Logic – Basics
Propositional Logic – Basics
Predicate logic (First order Logic) expressions
Unification in the Predicate Logic
Unification Algorithm: The unification algorithm takes two expressions as input and returns a substitution that makes the two expressions identical. The algorithm works as follows: If both expressions are constants, they must be the same for unification to be possible. Otherwise, unification fails. If one of the expressions is a variable, it can be unified with any expression by substituting the variable with the expression. The resulting substitution is the identity of the variable. If both expressions are variables, a unification is possible if they are the same variable. The resulting substitution is the identity of the variable. If both expressions are predicates with the same predicate symbol, their arguments are unified recursively. If the unification of any argument fails, the unification of the entire expression fails. If the unification of all arguments succeeds, the resulting substitution is the composition of the substitutions for the individual arguments.
Unification : Example:
Uses of Unification:
Resolution in the Predicate Logic
Resolution refutation proofs
Resolution refutation proofs - Example Premise 1) Socrates is a mortal. Premise 2) All mortals will die. ----------------------------------------------- Conclusion: Socrates will die. First we represent this argument in the predicate logic. We use the predicates Mortal(x) and Will Die (x).
Resolution Example
Second Order Logic
Second Order Logic: Example using Gauss The Gauss formula is a second-order logical formula that can be used to calculate the sum of the first n natural numbers: ∀n [n(n+1)/2 = 1+2+3+...+n] Here, the variable n is quantified by the universal quantifier ∀, which means "for all." The formula states that for any natural number n, the sum of the first n natural numbers is equal to n times (n+1) divided by 2. For example, let's say we want to calculate the sum of the first 5 natural numbers using the Gauss formula. We substitute n=5 into the formula: 5(5+1)/2 = 1+2+3+4+5 Simplifying the left-hand side: 5(6)/2 = 15 So the sum of the first 5 natural numbers is 15, which we can verify by adding them up: 1+2+3+4+5 = 15.
The knowledge hierarchy Let us consider the hierarchical spectrum from data, facts, and information, to knowledge: Data can be numbers without any meaning or units attached to them. Facts are numbers with units. Information is the conversion of facts into meaning. Finally, knowledge is the higher order expression and processing of information to facilitate complex decision-making and understanding.
The knowledge hierarchy: Example-1 In Example 1, you are trying to determine whether conditions are right for swimming outdoors. The data you have is the integer 70. When you add a unit to the data, you have facts: the temperature is 70° Fahrenheit. To convert these facts into information, add meaning to the facts: The temperature outside is 70° Fahrenheit. By applying conditions to this information, you provide knowledge: If the temperature is over 70° Fahrenheit, then you can go swimming.
The knowledge hierarchy: Example-2 In Example 2, you want to explain who is eligible for military service. The data you have is the integer 18. Adding the unit of years to the data, you produce facts: 18 years. To add meaning to the facts and convert them to information, you can explain that 18 is the age of eligibility. The knowledge you provide is that if you are 18 year of age or older, you are eligible for military service.
GRAPHICAL SKETCHES Graphical sketches are visual representations used to convey information, often in the form of diagrams, charts, or maps. They are an effective way to communicate complex ideas and data in a simplified and easy-to-understand format. Graphical sketches can take many forms, including flowcharts, Venn diagrams, mind maps, bar graphs, pie charts, and many others. They can be used in various fields such as education, business, engineering, and science to present information in a clear and concise manner.
Human window aspects of five solutions to KPK (King and Pawn against King). The task of King and Pawn against King (KPK) is a well-known endgame in chess, where a player with a king and a pawn tries to checkmate an opposing king with the help of their pawn. This task has been used as a benchmark problem in artificial intelligence research. In a PhD thesis work, " Kopec " compared five representations of knowledge for the same task and analyzed them using the Human Window approach. Here are the human window aspects of each solution:
Decision tree A decision tree is a special type of a search tree that can be used to find a solution to a problem by choosing from alternatives starting from a root node. A decision tree will logically split a problem space into separate paths, which can be independently followed in the search for a solution, or for the answer to a question. An example would be to try to determine how many homes there are of self-employed people who earn over $200K from their businesses. First, we would take the space of all people who are taxpayers in this country and determine who is self-employed, and then we would divide that space into those who earn over $200K.
FRAMES
FRAMES - Example For example, a child’s birthday party always involves a child who is turning a certain age; the party is held at a specified place, date, and time. To plan the party, you can create a frame which can include slots for the name of the child, the age of the child, the date, the location of the party, the time of the party, the number of attendees, and the props used. Figure shows how such a frame is constructed with its slots, their respective types, and how the slots can be filled with values.
FRAMES - Example A car frame can have slots for various attributes, such as: Make: the make of the car (e.g. Honda, Toyota, Ford) Model: the model of the car (e.g. Civic, Camry, Mustang) Color: the color of the car (e.g. red, blue, green) Year: the year the car was made (e.g. 2010, 2022, etc.) Owner: the owner of the car (e.g. John, Jane, etc.) Mileage: the number of miles on the car (e.g. 50,000, 100,000, etc.) Make: Honda Model: Civic Color: Red Year: 2020 Owner: John Mileage: 30,000
Semantic networks Semantic networks are a useful form of knowledge representation and are intended to be a model of how human associative memory works. They are a convenient formalism that helps to tell a story about an object, concept, event, or situation (represented by nodes—circles or boxes) and lines with arrows (arcs) representing the relationship between nodes. Semantic networks have certainly been useful for computer programmers and AI researchers as a form of knowledge representation