Knowledge Representation - PPT Unit3
Knowledge Representation - PPT Unit3
DISADVANTAGE:
General mechanism for deriving facts from other facts.
B)PROPOSITIONAL LOGIC:
Compositionality meaning of sentence.
Advantage:
Declarative.
Context-independent.
Unambiguous.
Difficult to understand.
FIRST ORDER LOGIC:
Adopt the foundation of propositional logic
Borrowing representation ideas from natural languages.
- objects
- domain set of objects
- domain elements
EXAMPLE: “ A model containing 5 objects ”
1. Richard the lion heart.
2. His younger brother.
3. The evil john king.
4. The left legs of richard & john.
5. A crown.
Tuplerelations
{(Richard the lion heart ,king john),(king john,Richard the lion
heart)}
Onhead relations
(the crown,king john)
Unary functionleft leg.
(King john)john’s left leg.
(Richard the lion heart)Richard’s left leg.
3 kinds
1. Constant symbols objects
ConstantA|x1|john|….
Variables a |x |s |…
1.TERMS:
Logical expression objects
CASES:
Quantifiers are of same type.
Example:”Father (John)=Henry”
Sentence that are added to a knowledge base using TELL.
Example:”John is a King & that kings are persons”.
Queries:
Questions of the knowledge base can be asked using ASK.
Peano axioms:
Defines natural numbers and additions
NatNum(0)
- n NatNum(n) =>NatNum(S(n))
Syntactic sugar:
uses of infix notations
sentence that uses the sugar can be “de-sugared ” to produce an equivalent
sentences in ordinary FOL.
1. Identify the task
2. Assemble the relevant knowledge
3. Decide on a vocabulary of predicates, functions, and constants
4. Encode general knowledge about the domain
5. Encode a description of the specific problem instance
6. Pose queries to the inference procedure and get answers
7. Debug the knowledge base.
The electronic circuits domain
1.Identify the task
Does the circuit actually add properly? (circuit verification)
2. Assemble the relevant knowledge
◦ Composed of wires and gates; Types of gates (AND, OR, XOR,
NOT)
◦ Irrelevant: size, shape, color, cost of gates
3. Decide on a vocabulary
◦ Alternatives:
Type(X1) = XOR
Type(X1, XOR)
XOR(X1)
4. Encode general knowledge of the domain
◦ t1,t2 Connected(t1, t2) Signal(t1) = Signal(t2)
◦ t Signal(t) = 1 Signal(t) = 0
◦ 1≠0
Connected(Out(1,X1),In(1,X2)) Connected(In(1,C1),In(1,X1))
Connected(Out(1,X1),In(2,A2)) Connected(In(1,C1),In(1,A1))
Connected(Out(1,A2),In(1,O1)) Connected(In(2,C1),In(2,X1))
Connected(Out(1,A1),In(2,O1)) Connected(In(2,C1),In(2,A1))
Connected(Out(1,X2),Out(1,C1)) Connected(In(3,C1),In(2,X2))
Connected(Out(1,O1),Out(2,C1)) Connected(In(3,C1),In(1,A2))
6. Pose queries to the inference procedure and get answers
What are the possible sets of values of all the terminals for the adder circuit?
i1,i2,i3,o1,o2 Signal(In(1,C_1)) = i1 Signal(In(2,C1)) = i2 Signal(In(3,C1)) = i3
Signal(Out(1,C1)) = o1 Signal(Out(2,C1)) = o2
7. Debug the knowledge base.
◦
Forward chaining:
Start with the atomic sentences in the knowledge base
Apply modus ponens in the forward direction
Applying new atomic sentences
Example:”King(x)^Greedy(x)=>Evil(x)”
“King(John)”
“Greedy(y)”
“It is a crime for an American to sell weapons to hostile nations”
Example:”American(x)^Weapon(x)^Sells( x, y,
z)^Hostile(z)
=>Criminal(x)”
A simple forward chaining algorithm:
Triggers all the rule.
Adding their conclusions to the known facts
Process repeats until the query is added or new facts are added
Every sentence concluded by forward chaining is already contained
explicitly in the KB fixed point.
FOL-FC-Ask is easy to analyze
Sound-application of generalized modus person
complete-clause knowledge base
Example: NatNum(0)
n NatNum(n)=>NatNum(S(0))
Forward chaining adds
NatNum(s(0)),NatNum(s(s(0))),NatNum(s(s(s(0)))),….
Efficient forward chaining:
“Inner loop” of the algorithm-finding all possible unifiers – pattern
matching.
The algorithm rechecks every rules on every iterations.
Missile(x)^Owns(nono,x)=>Sells(west,x,nono)
3 WAYS…
1) Real world knowledge bases are small & simple.
2) Sub classes of rules which matching is efficient
3) Eliminate redundant rule making attempts.
Incremental forward chaining:
Every new fact inferred on iteration t must be derived from atleast one new
fact inferred on iteration t-1.
Gradually complete the partial matches as new facts arrive.
Incremental forward chaining algorithm
Rete:
Rete algorithm
Occur Check
When matching a variable against a complex term one must check
FETCH(a) returns all unifiers seen that the query unifies with some
sentence in knowledge .
keep all the facts in the KB in one long list
Subsumption lattice:
Example queries
Employs(x,y)
Employs(AIMA.org,y)
Employs(x,richard)
completeness.
LOGIC PROGRAMMING:
Prolog:
Logic programming language.
Rapid prototyping language for symbol manipulation tasks.
Legal, medical, financial and other domains.
Set of definite classes written in a notation.
Uppercase letter for variables and lowercase for constants.
Example:
criminal(X) :- american(X), Weapon(Y), sells(X,Y,Z),
hostile(Z)
Some aspects of prolog :
Set of built-in-function for arithmetic.
Built in predicates.
Allows a form of negation called negation or failure.
Equality operator (=).
Occur check is omitted.
Efficient implementation of logic programs:
Interpreted and compiled.
Removing the FOL-BC-ASK algorithm.
Designed to maximize speed.
Generate one answer and promise to generate the rest, solves
the current answers has been fully explored.
Choice point.
Good deal of time generating and composing.
SUBSTITUTIONS:
Keeping track of all variables that have been bound in
stack is called the trial.
Open code - the unification routine for each different
cell.
Use of continuations to implement choke points.
Two Principle Sources of parallelism:
1.OR parallelism.
2.AND parallelism.
Redundant inferences and infinite loops:
Consider the following logic program that decides if a
path exists between two points on a directed graph.
Path(X,Z) : link(X,Z)
Path(X,Z) : Path(X,Y) link(Y,Z)
Path(a,c)
Fail {}
Link(a,y)
(y/b)
Path(a,y) Link(y,c)
Path(a,y) Link(y’,y)
b) Infinite proof tree:
Incomplete as a theorem proves for definite clauses
Memorization
Robins algebra
Simple set of axioms that appeared to define Boolean
algebra
Verification and synthesis of both hardware and software
Deductive synthesis
Designing several novel and sophisticated algorithms
AURA theorem prover.