Download presentation
Presentation is loading. Please wait.
1
Representation Website available for the course : suraj.lums.edu.pk/~cs531a06
2
2 Problem Solving CS 531 Dr M M Awais Representation vs Data Structure Representational methods are different from data structures Why? They relate what they contain to the some thing in the real world, i.e, convey meanings of things (Semantics)
3
3 Problem Solving CS 531 Dr M M Awais Propositional Logic Propositions are possible conditions present in the real world. Interrelationships between propositions describe the real world, under various interpretations of propositions.
4
4 Problem Solving CS 531 Dr M M Awais Syntax Simple Sentences (Atomic) Compound Sentences Negations Conjunctions and Disjunctions Implications Reductions Operators
5
5 Problem Solving CS 531 Dr M M Awais Semantics Meaning attached to the sentences How would you relate semantics and logic? Logic itself is unconcerned with what sentences say about the world being described. What is interesting is the relationship between the truth of simple sentences and the truth of compound sentences within which the simple sentences are contained. Logical reasoning methods are designed to work no matter what meanings or values are assigned to the logical “variables” used in sentences.
6
6 Problem Solving CS 531 Dr M M Awais Semantics ? How is semantics incorporated within the defined structures? Sentences are evaluated under different interpretations Every interpretation represents semantics of its own One is free to assign a meaning to a variable
7
7 Problem Solving CS 531 Dr M M Awais Semantics We say that an interpretation i satisfies a sentence if and only if it is true under that interpretation. Examples
8
8 Problem Solving CS 531 Dr M M Awais Interpretations As an example, consider the interpretation i shown below. p i true, q i false, r i true (interpretation ‘i’, PL does not use subscripts, just to show that the values are assigned under ‘ith’ interpretation) We can see that i satisfies (p q) ( q r). ( p q) ( q r) (true false) ( false true) true ( false true) true (true true) true true true
9
9 Problem Solving CS 531 Dr M M Awais Reverse Interpretations Find an interpretation under which the sentence below is not satisfied? (p q) ( q r).
10
10 Problem Solving CS 531 Dr M M Awais Model Model:If a sentence “S” is satisfied under a given interpretation “I” for all possible variables bindings (values) then I is a model of S Satisfy: If S maps to T (true) under an interpretation I then I satisfy S (interpretation that makes the sentence true)
11
11 Problem Solving CS 531 Dr M M Awais Definitions Logically Follows: X logically follows from a set of predicate calculus expressions S if every interpretation that satisfy S also satisfy X (X F S) Satisfiable: S is satisfiable iff there exists an interpretation and variable assignments that satisfy it
12
12 Problem Solving CS 531 Dr M M Awais Validity and satisfiability VALID A sentence is valid if it is true in all models, e.g., True,A A, A A, (A (A B)) B SATISFIABLE A sentence is satisfiable if it is true in some model e.g., A B UNSATISFIABLE A sentence is unsatisfiable if it is true in no models e.g., A A
13
13 Problem Solving CS 531 Dr M M Awais S F X S: All birds fly S: Sparrow is bird X: Sparrow flies All humans are mortal Shahid is a human Shahid is mortal All students at LUMS are hardworking Farooq is a student at LUMS Farooq is a hard working student
14
14 Problem Solving CS 531 Dr M M Awais Definitions Inconsistent: If a set of expressions are not satisfiable Sound: If an expression logically follows from another expression then the inferential rule is sound Complete: When inferential rule produces every expression that logically follows a particular expression
15
15 Problem Solving CS 531 Dr M M Awais Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the "meaning" of sentences; –i.e., define truth of a sentence in a world
16
16 Problem Solving CS 531 Dr M M Awais Knowledge Characteristics Knowledge about facts in the domain, –Declarative knowledge Knowledge of how to use this declarative knowledge, –Procedural or operational knowledge
17
17 Problem Solving CS 531 Dr M M Awais Declarative Knowledge Observations made in the real world Can be made by a person/automatic devices Characteristics of declarative knowledge Incompleteness –Missing observations (may be because of malfunctioning of instruments) Uncertainty –Range of observation within which the inference cannot be done with certainty –Example: a person with temperature 100 degrees is most certainty diagnosed as suffering from fever compare to a person with 98.9 degrees of temperature
18
18 Problem Solving CS 531 Dr M M Awais Procedural Knowledge Transformed Knowledge obtained through observation/data manipulation Observations converted useful information This transformation is brought about through computer programmes Characteristics: –Generality –Certainty –Knowledge level
19
19 Problem Solving CS 531 Dr M M Awais Generality Knowledge is more generic if described ina causal manner. The working of a power plant in general vs working of a nuclear power plant. The second one is more specific compare to the first. Heuristic knowledge is more specific (defining heuristic associations)
20
20 Problem Solving CS 531 Dr M M Awais Knowledge Level Symbolic Knowledge Level: Knowledge is easier to represent using symbols (structured). The symbols then use intelligent reasoning modules to implement inferencing. Subsymbolic Knowledge Level: Knowledge that cannot be represented using symbols (unstructured). Certain feature extraction techniques transform the knowledge into subsymbolic form that cannot be interpreted easily.
21
21 Problem Solving CS 531 Dr M M Awais Certainty If the declarative knowledge is uncertain then any procedural system developed on it is also uncertain Generally biological systems are described in uncertain terms and hence the procedural systems are also based on uncertain interpretations
22
22 Problem Solving CS 531 Dr M M Awais Brief Overview of PL Reference: Chapter Two The predicate Calculus Luger’s Book Examples included from Stuart and Russel.
23
23 Problem Solving CS 531 Dr M M Awais Representational Methods Formal Methods Propositional Logic Predicate Logic
24
24 Problem Solving CS 531 Dr M M Awais Propositional Logic Represent FACTS only Is declarative in nature Can infer the truth value of fact only Context free Compositional: Can combine facts
25
25 Problem Solving CS 531 Dr M M Awais Propositional Logic SymbolsP,Q,R,S …….. Truth SymbolsTrue (T), False (F) Connectives ^ (and), v (or), (Implication), (Equality, equivalence) (not) Statements (Propositions) could be true/false FACTS are also called Atomic Proposition
26
26 Problem Solving CS 531 Dr M M Awais Truth Table PQ P Q P v Q P Q TTFFTT TFFTFF FTTFTT FFTTTT Are same
27
27 Problem Solving CS 531 Dr M M Awais Possible Sentences (Well Formed Formulas-WFF) P ^ QConjuncts P v QDisjuncts P QP=Premise/Antecedent Q=conclusion/Consequent P (P v Q) = ( P Q)Inter conversion
28
28 Problem Solving CS 531 Dr M M Awais Propositional logic: Syntax Propositional logic is the simplest logic – illustrates basic ideas The proposition symbols P 1, P 2 etc are sentences –If S is a sentence, S is a sentence (negation) –If S 1 and S 2 are sentences, S 1 S 2 is a sentence (conjunction) –If S 1 and S 2 are sentences, S 1 S 2 is a sentence (disjunction) –If S 1 and S 2 are sentences, S 1 S 2 is a sentence (implication) –If S 1 and S 2 are sentences, S 1 S 2 is a sentence (biconditional)
29
29 Problem Solving CS 531 Dr M M Awais Propositional logic: Semantics Each model specifies true/false for each proposition symbol E.g. P 1,2 P 2,2 P 3,1 falsetruefalse With these symbols, 8 possible models, can be enumerated automatically. Rules for evaluating truth with respect to a model m: Sis true iff S is false S 1 S 2 is true iff S 1 is true and S 2 is true S 1 S 2 is true iff S 1 is true or S 2 is true S 1 S 2 is true iffS 1 is false orS 2 is true i.e., is false iffS 1 is true andS 2 is false S 1 S 2 is true iffS 1 S 2 is true and S 2 S 1 is true Simple recursive process evaluates an arbitrary sentence, e.g., P 1,2 (P 2,2 P 3,1 ) = true (true false) = true true = true
30
30 Problem Solving CS 531 Dr M M Awais Laws of Propositional Expressions Demorgan’s Law (P v Q)=( P ^ Q) Distributive Law P v (Q ^ R) = (P v Q) ^ (P v R) Commutative Law P ^ Q= Q ^ P Associative Law (P ^ Q) ^ R=P ^ (Q ^ R) Contrapositive Law P Q= Q P
31
31 Problem Solving CS 531 Dr M M Awais Inferencing Assigns Facts to symbols If simple facts are known to be true one can find the truth value for the expressions Thus INTERPRETATIONS can be done. Interpretation is the assignment of truth values to the sentences SymbolsT/F Mapping
32
32 Problem Solving CS 531 Dr M M Awais Expressions for KR Fact 1: Ali likes carsP Fact 2: Ali drives carsQ P v Q : Ali likes cars or drives cars P ^ Q : Ali likes cars and drives cars Q : Ali does not like cars P Q: If Ali likes cars then he drives cars P Q: ????? –Above and vice versa
33
33 Problem Solving CS 531 Dr M M Awais Implicative Statements P Q: If Ali likes cars then he drives cars If P is FALSE and Q is TRUE, it means: ALI DOESNOT LIKE CARS BUT STILL HE DRIVES THEM Truth Table: PQP Q TTT FFT (of our interest) TFF FTT ( bizarre )
34
34 Problem Solving CS 531 Dr M M Awais Interpretation Selection Suppose we have a model p^q r What are the possible interpretations for this model? Lets relate it to the real world p=presence of fuel, q=presence of air, and r is combustion of fuel Now find the interpretation for the given model. Only interpretation that satisfies the model now is p=true, q=true, and r=true and vice versa
35
35 Problem Solving CS 531 Dr M M Awais Example: Wumpus World Performance measure –gold +1000, death -1000 –-1 per step, -10 for using the arrow Environment –Squares adjacent to wumpus are smelly –Squares adjacent to pit are breezy –Glitter iff gold is in the same square –Shooting kills wumpus if you are facing it –Shooting uses up the only arrow –Grabbing picks up gold if in same square –Releasing drops the gold in same square Sensors: Stench, Breeze, Glitter, Bump, Scream Actuators: Left turn, Right turn, Forward, Grab, Release, Shoot
36
36 Problem Solving CS 531 Dr M M Awais Wumpus world characterization Fully Observable Deterministic Episodic Static Discrete Single-agent?
37
37 Problem Solving CS 531 Dr M M Awais Wumpus world characterization Fully Observable No – only local perception Deterministic Yes – outcomes exactly specified Episodic No – sequential at the level of actions Static Yes – Wumpus and Pits do not move Discrete Yes Single-agent? Yes – Wumpus is essentially a natural feature
38
38 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
39
39 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
40
40 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
41
41 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
42
42 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
43
43 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
44
44 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
45
45 Problem Solving CS 531 Dr M M Awais Exploring a wumpus world
46
46 Problem Solving CS 531 Dr M M Awais Finding wumpus world W 43214321 1 2 3 4 If Wumpus is in [1,3], How can we prove it using Propositional logic
47
47 Problem Solving CS 531 Dr M M Awais Finding wumpus world W 43214321 1 2 3 4 Knowledge base Contains: ~S1,1~B1,1 ~S2,1 B2,1 S1,2 B1,2
48
48 Problem Solving CS 531 Dr M M Awais Finding wumpus world W 43214321 1 2 3 4 Rules: R1: ~ S 1,1 ~W 1,1 ^ ~W 1,2 ^ ~W 2,1 R2: ~ S 2,1 ~W 1,1 ^ ~W 2,1 ^ ~W 2,2 ^ ~W 3,1 R3: S 1,2 W 1,3 V W 2,1 V W 2,2 V W 1,1 Assumption: The square with wumpus is also smelly otherwise s
49
49 Problem Solving CS 531 Dr M M Awais Inference rules in PL Modus Ponens And-elimination: from a conjuction any conjunction can be inferred: Resolution: Unit resolution when l 3 is empty
50
50 Problem Solving CS 531 Dr M M Awais Inferencing/Reasoning Direct (forward) –Start from the antecedents (facts) –Not limited under a particular interpretation –Exploratory in nature –Explores possible goals Indirect (Backward) –Starts from the conclusion –Limited under an interpretation –Explores what facts can establish a conclusion
51
51 Problem Solving CS 531 Dr M M Awais Modus Ponen Direct Approach: For given model (implication here), if condition alpha is true then truth of Beta can be established
52
52 Problem Solving CS 531 Dr M M Awais Modus Ponen Direct Approach: For given model (implication here), if condition alpha is true then truth of Beta can be established T given T
53
53 Problem Solving CS 531 Dr M M Awais Modus Ponen Direct Approach: For given model (implication here), if condition alpha is true then truth of Beta can be established ? found
54
54 Problem Solving CS 531 Dr M M Awais Modus Ponen Indirect Approach: For given model (implication here), if conclusion is established The the truth value of alpha can be established HOW ?
55
55 Problem Solving CS 531 Dr M M Awais Modus Ponen Indirect Approach: For given model (implication here), if conclusion is established The the truth value of alpha can be established Under a given interpretation
56
56 Problem Solving CS 531 Dr M M Awais Modus Ponen Indirect Approach: For given model (implication here), if conclusion is established Then the truth value of alpha can be established T given T
57
57 Problem Solving CS 531 Dr M M Awais Modus Ponen Indirect Approach: For given model (implication here), if conclusion is established The the truth value of alpha can be established ? found
58
58 Problem Solving CS 531 Dr M M Awais Modus Ponen Indirect Approach: For given model (implication here), if conclusion is established The the truth value of alpha can be established ? found Only possible under a given interpretation
59
59 Problem Solving CS 531 Dr M M Awais Resolution Direct Approach: If l 1 or l 2 are known, and not l 2 or l 3 are known then one can conclude l 1 or l 3 Interpretation independent
60
60 Problem Solving CS 531 Dr M M Awais Resolution Direct Approach: If l 1 or l 2 are known, and not l 2 or l 3 are known then one can conclude l 1 or l 3 TT
61
61 Problem Solving CS 531 Dr M M Awais Resolution Direct Approach: If l 1 or l 2 are known, and not l 2 or l 3 are known then one can conclude l 1 or l 3 TT May lead to a possible conflict (l 2 and not l 2 may be true)
62
62 Problem Solving CS 531 Dr M M Awais Resolution Direct Approach: If l 1 or l 2 are known, and not l 2 or l 3 are known then one can conclude l 1 or l 3 T Drop conflicting propositions And combine the rest with or operator
63
63 Problem Solving CS 531 Dr M M Awais Resolution Indirect Approach: If l 1 or l 2 are known, and l 1 or l 3 are known then CAN YOU conclude not l 2 or l 3 TT?
64
64 Problem Solving CS 531 Dr M M Awais Resolution Indirect Approach: If l 1 or l 2 are known, and l 1 or l 3 are known then CAN YOU conclude not l 2 or l 3 No Conflict Arises at all Does not remain a resolution problem Indirect Approach not Applicable
65
65 Problem Solving CS 531 Dr M M Awais Proof of W presence W 43214321 1 2 3 4 Knowledge base Contains: ~S1,1~B1,1 ~S2,1 B2,1 S1,2 B1,2 Rules: R1: ~ S 1,1 ~W 1,1 ^ ~W 1,2 ^ ~W 2,1 R2: ~ S 2,1 ~W 1,1 ^ ~W 2,1 ^ ~W 2,2 ^ ~W 3,1 R3: S 1,2 W 1,3 V W 1,2 V W 2,2 V W 1,1 Modus Ponen on R1: ~ S 1,1 ~W 1,1 ^ ~W 1,2 ^ ~W 2,1 ~W 1,1 ^ ~W 1,2 ^ ~W 2,1 And Elimination: ~W 1,1 ~W 1,2 ~W 2,1 Results: ~W 1,1 ~W 1,2 ~W 2,1
66
66 Problem Solving CS 531 Dr M M Awais Proof of W presence W 43214321 1 2 3 4 Knowledge base Contains: ~ S1,1~B1,1 ~S2,1 B2,1 S1,2 B1,2 Rules: R1: ~ S 1,1 ~W 1,1 ^ ~W 1,2 ^ ~W 2,1 R2: ~ S 2,1 ~W 1,1 ^ ~W 2,1 ^ ~W 2,2 ^ ~W 3,1 R3: S 1,2 W 1,3 V W 1,2 V W 2,2 V W 1,1 Modus Ponen on R2: ~ S 2,1 ~W 1,1 ^ ~W 2,1 ^ ~W 2,2 ^ ~W 3,1 ~W 1,1 ^ ~W 2,1 ^ ~W 2,2 ^ ~W 3,1 And Elimination: ~W 1,1 ~W 2,1 ~W 2,2 ~W 3,1 Results: ~W 1,1 ~W 1,2 ~W 2,1 ~W 1,1 ~W 2,1 ~W 2,2 ~W 3,1
67
67 Problem Solving CS 531 Dr M M Awais Proof of W presence W 43214321 1 2 3 4 Knowledge base Contains: ~S1,1~B1,1 ~S2,1 B2,1 S1,2 B1,2 Rules: R1: ~ S 1,1 ~W 1,1 ^ ~W 1,2 ^ ~W 2,1 R2: ~ S 2,1 ~W 1,1 ^ ~W 2,1 ^ ~W 2,2 ^ ~W 3,1 R3: S 1,2 W 1,3 V W 1,2 V W 2,2 V W 1,1 Modus Ponen on R3: S 1,2 W 1,3 V W 1,2 V W 2,2 V W 1,1 W 1,3 V W 1,2 V W 2,2 V W 1,1 Unit Resolution: Alpha:W 1,3 V W 1,2 V W 2,2 and Beta: W 1,1 W 1,3 V W 1,2 V W 2,2 Unit Resolution again with : W 1,2 and W 2,2 W 1,3 Results: ~W 1,1 ~W 1,2 ~W 2,1 ~W1,1 ~W2,1 ~W2,2 ~W3,1 W 1,3 Simply drop all facts that can create conflict
68
68 Problem Solving CS 531 Dr M M Awais Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated information –(unlike most data structures and databases) Propositional logic is compositional: –meaning of (B P ) is derived from meaning of B and of P Meaning in propositional logic is context-independent –(unlike natural language, where meaning depends on context) Propositional logic has very limited expressive power –(unlike natural language) –E.g., cannot say “Music cause disturbance to all neighbors“ except by writing one sentence for each neighbor
69
69 Problem Solving CS 531 Dr M M Awais Second Assignment Assignment –Select an industry –Identify data/information sources –Identify declarative and procedural knowledge within it –Comment on the characteristics associated with the two knowledge types –Suggest a way or ways to represent the knowledge within the scope of that industry Notes: –You can form groups of three students (maximum) –Submit your findings in the form of a report (format will be communicated later) (Sept 22, 2006), 12:00 (midnight) –Once you select an industry talk to the TA in order to avoid any clash between groups
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.