860 likes | 1.03k Views
KNOWLEDGE REPRESENTATION 최윤정. Knowledge Representation Methods. Declarative Methods --knowledge is knowing WHAT Logical Approach Predicate Calculus Nonstandard Logics Fuzzy Logic Non-Logical Approach Semantic Net Frame (procedural features) Conceptual Dependency.
E N D
Knowledge Representation Methods • Declarative Methods --knowledge is knowing WHAT • Logical Approach • Predicate Calculus • Nonstandard Logics • Fuzzy Logic • Non-Logical Approach • Semantic Net • Frame (procedural features) • Conceptual Dependency • Procedural Methods --knowledge is knowing HOW • PLANNER, CONNIVER • Rule-based systems
Tweety Robin Bird isa isa Wings Wings Wings Semantic Net(1/3) (Quillian(1968) Psychological Model) • Basic Constructs • Node-Object, Concept • Links-Relation property inheritance -Property Inheritance is the main inferencemechanism! has-part
Semantic Net(2/3) Example Sold-by Furniture store Furniture isa Chair Seat has-part isa Park My-Chair owner cover isa Person Leather Black Color
Semantic Net(3/3) • Internal Representation(LISP) • My-Chair: ((ISA CHAIR)(COLOR BLACK) (OWNER PARK)(COVER LEATHER)) • Chair: ((ISA FURNITURE)(HASPART SEAT)) (get `My-CHAIR `COLOR)= `BLACK
Action and Event(1/2) • “John gave the book to Mary.” Event isa agent isa object John EV-1 BK-1 Book beneficiary time Mary action Give Past
Action and Event(2/2) • “John is taller than Bill.” John Bill Is-taller Bill John height height H1 Number H2 isa isa greater-than
Reasoning with Semantic Nets(1/2) • Spreading Activation “What is the relation between John and Mary?” John ? Mary
Reasoning with Semantic Nets(2/2) • Matching Fact Goal Net Direct Match vs. Semantic Match • What is Tweety? isa Tweety Robin Bird isa isa Tweety ? isa
Problems of Semantic Net(1/2) 1. Different people use different nets to represent the same thing. John Mary married Event isa Marriage isa M1 male female John Mary
Problems of Semantic Net(2/2) 2. Same Net interpreted differently by different person. 3. Quantification Jack Tom Father-of
Dealing with Exceptions(1/2) Fly CAN Exception node Bird ISA Ostrich ISA Henry
Grey COLOR Elephant ISA isa Royal Elephant ISA Circus Elephant ISA Clyde Dealing with Exceptions(2/2) • Inferential Distance(Touretzky)
Frame (1/2) -Minsky • Slot-Filler Concept : Typical Expected Situation • [frame: Vehicle ISA: Object Slots: (Weight (a wt-measure)) (color (a color(default black))) (number-of-wheel (a integer))] • [frame: Trailer-Truck ISA: Vehicle Slots: (trailer-size (a length-measure)) (weight (default 8)) (number-of-wheel (default 18))] • [frame: Sedan ISA: Vehicle Slots: (number-of-wheel 4)] • [frame: My-truck instance-of: Trailer-Truck Slots: (trailer-size = 12) (color red)]
Frame(2/2) weight= color= black wheel= Object ISA weight=8 trailer-size= wheel=18 Color=black Vehicle ISA Trailer-truck Weight=8 Trailer-size=12 Wheel=18 Color=red ISA My-Truck
Procedural Attachment(1/2)-Procedural knowledge is attached to slots If-Added: Triggered to fill in If-Needed: Triggered when filled in If-Modified: Triggered when changed Employee: ISA: Person Sex: (M, F) Birthday: Date Age: integer If-Needed: CALC-AGE Skill: code If-Added: ADD-TO-SKILL-FILE
Procedural Attachment(2/2) Proc CALC-AGE; x:= get-current-year; y:= get-birth-year; age:= x-y end; Proc ADD-TO-FILE; c:= get-code; open-file(skill); put-file(c, skill) end;
LOGICAL PRELIMINARIES • LOGIC- ARTIFICIAL LANGUAGE TALKING ABOUT “TRUTH” • LOGIC AS LANGUAGE • SYNTAX(GRAMMAR) -Symbol -WFF(Well Formed Formula) -Deductive Closure -Proof Theory • SEMANTICS -Meaning -Model -Validity, Consistency -Model Theory • LOGIC AS A PROGRAMMING LANGUAGE • SYNTAX • SEMANTICS
PROPOSITIONAL LOGIC (1/2) • (P∧Q)R Falsifying Model
PROPOSITIONAL LOGIC (2/2) • ((PQ)∧~Q)~P • VALID TRUE in Every Model(Tautology) • INCONSISTENT FALSE in Every Model • CONSISTENT TRUE in at least ONE Model VALID INVALID INCONSISTENT CONSISTENT (Unsatisfiable) (Satisfiable)
FORMAL SYSTEM Well Formed Formula Language AXIOM + THEOREM ├ A INFERENCE RULES VALID ╞ A PROOF THEORY MODEL THEORY THEOREM VALID SOUNDNESS (→) COMPLETENESS (←)
Types of Logical Reasoning • Deduction Given A, AB infer B • Induction Given A, B find the rule AB • Abduction (Not logically valid!) Given AB, B infer A • Refutation Proof
Proof by Cases • Is there a Red Box right next to a Non-Red Box? ?
Refutation Proof • A, AB want to prove B Assume ¬B and find a contradiction Most Common Method using Computer - Resolution, Tableau Method etc.
PROVING VALIDITY in PROPOSITIONAL LOGIC • 1. TRUTH TABLE • 2. TABLEAU METHOD • 3. SEQUENT CALCULUS • 4. RESOLUTON
TABLEAU METHOD • Refutation Method (Assuming FALSE and draw CONTRADICTION) (( P Q) ∧ -Q ) -P F T F T T T T F CONTRADICTION
RESOLUTION (Robinson) • A B, B C, A C? -A ∨ B -B ∨ C A -C -A ∨ C C
Example 1 (1/2) “Head I win, Tail you lose.” Prove I win. H: head T: tail H W W: I win T L L: You lose (Hidden information) H ∨ T W L L W
Example 1 (2/2) -H∨W -T∨L H∨T -W∨L -L∨W -W ~L ~T H W
Example: Lion Sleeps Tonight • Lion always sleeps except when he is hunting. • Lion cannot sleep when he is hungry. • When he is tired he cannot hunt. • Lion is tired when he does not sleep. • Prove Lion is not hungry.
Resolution Strategies (1/4) • 1. UNIT RESOLUTION (Wos) • Not complete • UNIT PREFERENCE RESOLUTION • Unit clause always reduces the size! P ∨ Q P ∨ -Q -P ∨ Q -P ∨ -Q P Q -Q
Resolution Strategies (2/4) • 2. INPUT RESOLUTION • Not complete • INPUT CLAUSES HAVE MEANINGFUL INFORMATION P ∨ Q INPUT CLAUSES P ∨ -Q -P ∨ Q -P ∨ -Q P Q -Q
Resolution Strategies (3/4) • 3. LINEAR RESOLUTION(Loveland) • Chain of Reasoning • Depth First • COMPLETE P ∨ Q P ∨ -Q -P ∨ Q -P ∨ -Q P Q -P
Resolution Strategies (4/4) • 4. LOCK RESOLUTION(BOYER) • COMPLETE • Index every literal (Lock) : consider smallest P1 Q2 P3-Q4 -P6Q5 -P8-Q7 -P6 -Q4 Q2
Predicate Calculus • Variable : object x, y, z, .. • Constant : a, b, c, tom, 1, 2, .. • Function : f, g, h, father(tom),… • Predicate : P, Q, R • Quantifier : ∀, ∃
Well Formed Formula • Term constant, variable, f(t1, .. tn): ti term • Atom P(t1,..tn) • Formula(wff) 1. atom 2. F∨G, -F, FG 3. (∀x)F, (∃x)F
Nested Quantifiers • Describe each statement ∀x ∀y Love(x, y) ∀x ∃y Love(x, y) ∃x ∀y Love(x, y) ∃x ∃yLove(x, y) ∀x ∃y Love(y, x) ∃x ∀y Love(y, x) Negation of these?
Symbolize the Statement • Every rational number is a real number. • There exists a number that is prime. • For every number x, there exists a number y such that x<y. • Not every real number is a rational number. • Everybody has somebody who loves him. • There is someone whom everybody loves. • Mimi loves only those who is younger than her. • Everyone who eats BigMac listens Jazz music.
Clausal Form Conversion • 1. Eliminate • 2. Reduce the scope of ~ • 3. Rename the variables • 4. Move quantifiers to the left (prenex normal form) • 5. Eliminate ∃ : Skolemize • 6. Eliminate ∀ • 7. Conjunctive Normal Form
Reducing the Scope of ~ • ~ (p ∧ q) = ~p ∨ ~q ~ (p ∨ q) = ~p ∧ ~q • ~ Q1Q2..Qn P(x,y,..) = Q’1Q’2..Q’n ~P(x,y,..) where Q’ = ∃ if Q=∀ ∀ if Q= ∃
Prenex Normal Form • Prenex normal form: Q1Q2..Qn P(x,y,..) where Q i = ∀, ∃ • ∀x (P(x) ∨ ∀y (Q(y))) = ∀x ∀y (P(x) ∨ Q(y)) • ∀x (P(x) ∨∃y (Q(x, y))) = ∀x ∃y (P(x) ∨ Q(x, y))
Skolem Function • Eliminating ∃’s ∃x P(x) P(sk1) : sk1 is skolem constant ∃x ∀y P(x,y) ∀y P(sk1, y) ∀y ∃x P(x,y) ∀y P(sk1(y),y) ∀x ∃y ∀z ∃w P(x,y,z,w) ∀x ∀z P(x,sk1(x),z,sk2(x,z))
Example : Clausal Form • ∀x((∀y P(x,y) ~∀y(Q(x,y) R(x,y))) ∀x( ~∀y P(x,y) ∨ ~∀y (~Q(x,y) ∨ R(x,y))) … (1) ∀x( ∃y ~P(x,y) ∨∃y (Q(x,y) ∧~R(x,y))) … (2) ∀x( ∃y ~P(x,y) ∨∃z (Q(x,z) ∧~R(x,z))) … (3) ∀x∃y∃z (~P(x,y) ∨((Q(x,z) ∧~R(x,z))) … (4) ∀x(~P(x,s1(x))∨((Q(x,s2(x))∧~R(x,s2(x)))) … (5) ~P(x,s1(x))∨((Q(x,s2(x))∧~R(x,s2(x))) … (6) (~P(x,s1(x))∨Q(x,s2(x)))∧(~P(x,s1(x))∨~R(x,s2(x)))
Matching • Rule : Mother(x, y) Like(x, y) “Every Mother Like their Son” • Fact Like(Joe, Jack), Like(Kim, Mary) Mother(Judy, Jack), Mother(Mary, Jay) • Query Like(Judy Jack)? Like(Mary, ?)
Unification(2-way Matching) • Find a substitution σ(unifier) which makes two clause equal • Essential step for Resolution of Predicate Calculus • Usually unification tries to find a most general unifier
Most General Unifier (mgu) • Substitution : σ C = Like(x, father(x)) σ = {jack/x} C • σ = Like(Jack, father(Jack)) • C, D are unifiable iff there is σ s.t. C • σ = D • σ (σ is called unifier) • Mgu least specific unifier Like(x, y), Like(Jack, y) σ1={Jack/x}, σ2={Jack/x, Mary/y}
Unification - Examples Like(x, y) Like(joe, father(joe)) Like(jack, y) Like(x, father(x)) Like(x, father(x)) Like(joe, y) Like(x, father(joe)) Like(jack, father(y)) Like(x, father(x)) Like(jack, father(joe)) Like(x, father(x)) Like(father(y),z) Like(x, x) Like(father(z), z) ?
Factoring • If 2 literals in a clause C have mgu σ then C • σ is called a factor of C • If C = P(x) ∨ P(f(y))∨ ~Q(x) Then σ = {f(y)/x} P(f(y))∨P(f(y))∨~Q(f(y)) P(f(y))∨~Q(f(y)) : factor of C
Subsumption • Clause C subsumes D iff ∀ C D • (A ∧B) subsumes A A subsumes A ∨ B • Subsumed clause can be deleted • C=P(x) D=P(a) delete P(a) • Note: factoring – within a clause subsumption – between two clauses