Title: Notes 7: Knowledge Representation, The Propositional Calculus
1Notes 7 Knowledge Representation, The
Propositional Calculus
2Outline
- Representing knowledge using logic
- Agent that reason logically
- A knowledge based agent
- Using constraints on feature values
- A rich and implicit representation of the world
state. - Representing and reasoning with logic
- Propositional logic
- Syntax
- Semantic
- validity and models
- Rules of inference for propositional logic
- Resolution
- Complexity of propositional inference.
- Reading Nillson Chapters 13,14, Russel and
Norvig, Chapter 7
3Why knowledge-base
- The state of the world
- may require lots of information..
- The agent knowledge of the state of the world
- If s is world state K(s) is what the agent
knows. - For economy
- Not everything explicitly specified. Some facts
can be inferred. - Agent may infer whatever he does not know
explicitly. - Nillson Constraints on feature values
- Block A is not on the floor
- Issues
- In what language to express what the agent knows
about the world. How explicit to make this
knowledge. How to infer.
Agent knowledge of state
Description of the world
Agent explicit specification of what he knows
4Knowledge RepresentationDefined by syntax,
semantix
Computer
Inference
Assertions Conclusions (knowledge
base) Facts Facts
Semantics
Imply
Real-World
Reasoning in the syntactic level Example
5Constraints on the world
- World so far were described by feature values
- On(block,floor) On(A,B) Clear(C)
- But some information is more complex
- Law all human are mortal, all blue box are
pushable - Negative information block a is not on the floor
- Either A or B are pushable
- Examples A lifting robot features
- Bat_ok, liftable, moves
- Constraints on the worlds can be written in
logic - Bat_ok and liftable ? moves
- If moves is false and Bat_ok is true, we infer
liftable is false. - Logical languages involve
- Syntax, the grammar
- Semantics the meaning of words and sentences
- Inference rules deriving new information that is
correct.
6The party example
- If Alex goes, then Beki goes A ? B
- If Chris goes, then Alex goes C ? A
- Beki does not go not B
- Chris goes C
- Query Is it possible to satisfy all these
conditions? - Should I go to the party?
7Knowledge Representation
- Knowledge representation
- defined by syntax and semantics
- Syntax says what sets of symbols are legal
sentences. - Semantics says what a legal sentence means in the
world. - Entailment
- Generating new sentences that are true given old
sentences that are true. KB alpha. - Sound inference
- Given a knowledge base KB, generates a new
sentence that is entailed by KB or verify
entailment. KB -- ? - Soundness we infer only what can be entailed
(what is true). - Proof A sequence of sound inferences.
- Completeness
- An inference is complete if it can prove
everything that is true. - Proof theory
- Example algebra language
8Example of Languages for Representation
- Programming languages
- Formal languages, not ambiguous, but cannot
express partial information. Not expressive
enough. - Natural languages
- very expressive but ambiguous ex small dogs and
cats. - Good representation language
- Both formal and can express partial information,
can accommodate inference - Main approach used in AI Logic-based languages.
9Propositional Logic
- Syntax
- Alphabet true,false,P,Q
- Connectives
- Well-Formed formulas (wffs or sentences) w1, w2
-
-
- If Alex_goes ? Beki_goes
- Semantics
- True means true
- False means false
- Symbols means objects in the world and they are
true or false relative to a scenario, or a world,
we refer to. - Meaning of a sentence is derived from its parts
as defined by truth-tables.
10Truth tables for the logical connectives
11A grammer for sentences in propositional logic
12Truth Tables
- Truth tables can be used to compute the truth
value of any wff. - Can be used to find the truth of
- Given n features there are 2n different worlds,
different interpretations. - Interpretation any assignment of true and false
to atoms - An interpretation satisfies a wff if the wff is
assigned true under the interpretation - A model An interpretation is a model of a wff if
the wff is satisfied in that interpretation. - Satisfiability of a wff can be determined by the
truth-table - Bat_on and turns-key_on ? Engine-starts
- Wff is unsatisfiable or inconsistent it has no
models -
-
13Validity
14Validity, Equivalence
- Validity A wff is Valid if it is true in all
interpretations - P ? P
- Equivalence two wffs are equivalent iff they
have the same models. - DeMorgan laws, law of contrapositive
- If w1 is equivalent to w2 then w1 ? w2 and w2 ?
w1 - Associative
- Distributive
- DeMorgans
15Logical Entailmenttruth in the world
- KB ( ) entails a sentence, iff all the models
of KB are models of alpha (in other words, any
interpretation that satisfies KB satisfies
alpha.) - If some sentences are true in the world it
implies that some other sentences are true. - statement P is true whenever some other set KB of
statements is true, then KB entails P. - Whenever means
- In any possible world (model) in which every
sentence of KB is true.
16 Rules of Inference
- Producing an additional wffs from a set of wffs
- From alpha infer beta
-
-
- Sound inference rule
- The conclusion is true whenever the premises are
true. - Examples
- Modus ponens A and A ? B -- B is sound,
resolution is sound. - Proof
- A sequence of inference rules generating the
desired conclusion from the KB. - Example KB
- From
- From
- KB
17Rules of inference
18Complete inference rules
- An inference rule is complete if
- it can be used to prove anything that is true.
- Is modes ponens complete?
- PvQ, P --gtA, Q --gt A
- can we prove A by modes-ponens?
- Cab we prove A by resolution?
- Is resolution complete?
- Example the party problem
- Resolution implies forward-chaining and backword
chaining. - Example
- Resolution is complete
19Resolution in Propositional Calculus
- Using clauses as wffs
- Literal, clauses, conjunction of clauses (cnfs)
- Resolution rule
- Resolving (P V Q) and (P V ? Q) P
- Generalize modus ponens, chaining .
- Resolving a literal with its negation yields
empty clause. - Resolution is sound
- Resolution is NOT complete
- P and R entails P V R but you cannot infer P V R
- From (P and R) by resolution
- Resolution is complete for refutation adding
(?P) and (?R) to (P and R) we can infer the empty
clause. - Decidability of propositional calculus by
resolution refutation if a wff w is not entailed
by KB then resolution refutation will terminate
without generating the empty clause.
20Soundness of resolution
21The party example
- If Alex goes, then Beki goes A ? B
- If Chris goes, then Alex goes C ? A
- Beki does not go not B
- Chris goes C
- Query Is it possible to satisfy all these
conditions? - Should I go to the party?
22Example of proof by Refutation
- Assume the claim is false and prove
inconsistency - Example can we prove that Chris will not come to
the party? - Prove by generating the desired goal.
- Prove by refutation add the negation of the goal
and prove no model - Proof
- Refutation
23The moving robot examplebat_ok,liftable
?movesmoves, bat_ok
24Converting wffs to Conjunctive clauses
- 1. Eliminate implications (P?Q) or (R ? P)
- 2. Reduce the scope of negation sign
- 3. Convert to cnfs using the associative and
distributive laws
25Converting wffs to Conjunctive clauses
- 1. Eliminate implications
- 2. Reduce the scope of negation sign
- 3. Convert to cnfs using the associative and
distributive laws
26Proof by refutation
- Given a database in clausal normal form KB
- Find a sequence of resolution steps from KB to
the empty clauses - Use the search space paradigm
- States current cnf KB new clauses
- Operators resolution
- Initial state KB negated goal
- Goal State a database containing the empty
clause - Search using any search method
27Proof by refutation (contd.)
- Or
- Prove that KB has no model - PSAT
- A cnf theory is a constraint satisfaction
problem - variables the propositions
- domains true, false
- constraints clauses (or their truth tables)
- Find a solution to the csp. If no solution no
model. - This is the satisfiability question
- Methods Backtracking arc-consistency ? unit
resolution, local search
28Resolution refutation search strategies
- Ordering strategies
- Breadth-first, depth-first
- I-level resolvents are generated from level-(I-1)
or less resolvents - Unit-preference prefer resolutions with a
literal - Set of support
- Allows reslutions in which one of the resolvents
is in the set of support - The set of support those clauses coming from
negation of the theorem or their decendents. - The set of support strategy is refutation
complete - Linear input
- Restricted to resolutions when one member is in
the input clauses - Linear input is not refutation complete
- Example (PVQ) (P V not Q) (not P V Q) (not P V
not Q) have no model
29Complexity of propositional inference
- Checking truth tables is exponential
- Satisfiability is NP-complete
- However, frequently generating proofs is easy.
- Propositional logic is monotonic
- If you can entail alpha from knowledge base KB
and if you add sentences to KB, you can infer
alpha from the extended knowledge-base as well. - Inference is local
- Tractable Classes Horn, 2-SAT
- Horn theories
- Q lt-- P1,P2,...Pn
- Pi is an atom in the language, Q can be false.
- Solved by modus ponens or unit resolution.
30Summary
- Representing knowledge using logic
- Using logic to represent and reason about
knowledge - Logic, syntax, semantics and proof theory
- Representing and reasoning with logic
- Propositional logic
- Syntax
- Semantic
- validity and models
- Rules of inference for propositional logic
- Complexity of propositional inference.
- Reading Nillson Chaters 13, 14 Russel and Norvig
Chapter 7.
31The Wumpus world
- The state of world is still simple to specify,
not too many facts. - However the agents knowledge is partial and he
needs to infe and think about his state in order
to choose a good action. - Goal find gold, return to 1,1, climb out.
- in wumpus square and near, perceive a stench
- near a pit, breeze
- in gold, percieve glitter
- in wall, bump
- actions turn 90, grab,shoot, climb