Title: Logic
1Logic
2Overview
- Scholastic logic
- Propositional logic
- Syntax and semantics
- Inference rules
- Predicate calculus
- Syntax and semantics
- Quantifiers
- Higher-order logics and modal operators
- Model theory
- The incremental, almost continuous nature of
meaning - Knowledge representation as an evolutionary
process
3Features of Logic KR Languages
- Vocabulary
- Logical symbols
- Constants
- Variables
- Punctuation
- Syntax
- Semantics
- Theory of reference
- Theory of truth
- Rules of inference
4Automated Reasoning
- Premise Given an appropriate KR language, new
knowledge can be inferred from existing truths
5Syllogisms
- Aristotle set out the concept of a three-sentence
structure to represent knowledge - All trailer trucks are 18 wheelers
- Some Peterbilt is a trailer truck
- Therefore, some Peterbilt is an 18 Wheeler
6Sentence Types
- A Universal affirmative All a is b
- I Particular affirmative Some a is b
- E Universal negative No a is b
- O Particular negative Some a is not b
7Valid Syllogisms
- bArbArA
- A All broad-leafed plants are deciduous
- A All vines are broadleaf plants
- A Therefore, all vines are deciduous
8Valid Syllogisms (cont.)
- cElArEnt
- E Nothing absent-minded is an elephant
- A All professors are absent-minded
- E Therefore, no professor is an elephant
9Valid Syllogisms (cont.)
- dArII
- A All trailer trucks are 18 wheelers
- I Some Peterbilt is a trailer truck
- I Therefore, some Peterbilt is an 18 Wheeler
10Valid Syllogisms (cont.)
- fErIO
- E No Corvette is a truck
- I Some Chevrolet is a Corvette
- O Therefore, some Chevrolet is not a truck
11Boolean Algebra
- George Boole
- System of representing and operating on truth
values - p x q AND
- p q OR
- -p NOT
12First Order Logic (FOL)
- Extensions of Boolean Algebra and Aristotles
syllogisms - Universal and existential quantifiers
- Changes in syntax
13Why FOL?
- Expressive power
- Extensive Semantics
- Best-defined model and proof theories
14Syntax of Propositional Logic
- Symbols
- Logical constants True, False
- Proposition symbols P, Q,
- Logical connectives
- not (aka ? )
- and (aka ? )
- or (aka ? )
- (aka ? )
- iff (aka ? )
- Sentences are made from these symbols
15Sentences
- True, False are sentences
- Any proposition symbol is a sentence
- Any sentences S1, Sn combined with a connective
is a sentence - (not S) is a sentence
- (and S1 S2) is a sentence
- (or S1 S2 S3 Sn) is a sentence
- ( Sa Sc) is a sentence
- (iff Sa Sc) is a sentence
16Semantics of propositional logic
- Formal semantics function from sentences to
true, false. - True means that the sentence is true of the world
- False means that the sentence isnt true of the
world - Truth tables define semantics of connectives
- See Sowa for details
- Example
- P Q (or P Q)
- false false false
- false true true
- true false true
- true true true
17Rules of Inference Examples
- Modus Ponens (aka implication-elimination)
- Given ( P Q), P, infer Q
- And-elimination
- Given (and P Q), infer P or infer Q
- And-introduction
- Given P, Q, infer (and P Q)
- Unit resolution
- Given (or P Q), (not P), infer Q
- Resolution
- Given (or P Q), (or (not Q) R), infer (or P R)
18Using inference rules
- On summer days in Memphis, it is either
scorching hot or overcast and muggy outside.
Today is a summer day in Memphis and it is not
scorching hot outside.
19Formalizing a situation
- On summer days in Memphis, it is either
scorching hot or overcast and muggy outside.
Today is a summer day in Memphis and it is not
scorching hot outside. - Summer It is a summer day in Memphis
- Hot It is scorching hot outside
- Overcast It is overcast outside
- Muggy It is muggy outside
- ( Summer (or Hot (and Overcast Muggy)))
- (and Summer (not Hot))
20Using the Inference Rules
- ( Summer (or Hot
- (and Overcast Muggy))) Given
- (and Summer (not Hot )) Given
- Summer AE 2
- (or Hot (and Overcast Muggy)) MP 1,3
- (not Hot) AE 2
- (and Overcast Muggy) UR 4,5
- Overcast AE 6
- Muggy AE 6
21Properties of inference rules
- They are sound if, when the premises are true,
the consequence is true - Many different sets of inference rules have been
created with the same expressive power (i.e.,
complete) - Sometimes restricted sets of inference rules used
for tractability - Example Horn clauses
- ( (and A1 An) C)
22Predicate Calculus
- Propositions can have structure
- ( . )
- Terms are either
- Constants denoting objects in some universe
(e.g., Block32) - Expressions denoting objects via a function
(e.g., (color Block32)) - Predicates describe attributes and relationships
- Examples
- (Red Block32)
- (On Block32 Table)
- (Above Block24 Block32)
23Propositions express facts
- Concrete facts via appropriate vocabulary of
relationships - Example The things sitting on top of a table
- Describing general facts of the world requires
variables - Well use ? to denote variables.
- The meaning of variables are defined via
quantifiers
24Universal Quantification
- (forall )
- is true exactly when is true for every
possible set of bindings for - Examples
- (forall ?x ( (block ?x)
- (solid-object ?x)))
- (forall (?x ?y)
- ( (and (person ?x) (person ?y)
- (friend-of ?x ?y))
- (friend-of ?y ?x)))
25Inference with universal quantifiers
- Elimination via substitution
- (forall ?x ( (block ?x)
- (solid-object ?x))),
- Let ?xBlock32
- ( (block Block32) (solid-object Block32))
- Introduction by proving statement for an
arbitrary individual about which nothing else is
known (a skolem) - ( (even-number Foobar)
- (not (prime-number Foobar)))
26Existential Quantification
- (exists )
- is true exactly when there is at least one set of
bindings for that make true. - Examples
- (for-all ?x
- ( (number ?x)
- (exists ?y ( ?y ?x))))
- (for-all ?x
- ( (block ?x)
- (or (on ?x table) (held ?x)
- (exists ?y (and (block ?y)
- (on ?x ?y))))))
27Using existential quantifiers
- Elimination by creating a skolem.
- (exists ?y (and (block ?y)
- (on Block32 ?y)))
- create novel entity, G0012, and substitute
- (and (block G0012)
- (on Block32 G0012))
- Introduction by generalizing from a specific
- example
- (and (block Block18)(on Block32 Block18))
- justifies the introduction of
- (exists (?x ?y)
- (and (block ?x) (on ?y ?x)))
28Tips for using quantifiers
- Be very careful of scoping when translating from
natural language - Wherever you go, there you are B. Banzi
- Heuristic Use inside forall
- (forall ?x (and (block ?x)
- (solid-object ?x)))
- Heuristic Use and inside exists
- (exists (?x ?y)
- ( (block ?x) (on ?x ?y)))
- Heuristic Use iff very sparingly
- (forall ?x (iff (block ?x)
- (solid-object ?x))
29Higher-order logic
- First order logic ? variables range over objects
- Second order logic ? variables can range over
predicates also - (for-all ?r
- (iff (transitive ?r)
- (forall (?x ?y ?x)
- ( (and (?r ?x ?y) (?r ?y ?z))
- (?r ?x ?z)))))
- Omega-order logics have been used at times
- Even second order is undecidable, however
30Aside Order in Structure-Mapping
- Not the same thing as the order of a logic
- Order of a logic indicates how expressive it can
be - In structure-mapping, the order of an expression
is - 0 for entities
- 1max(order(arguments)) for expressions
- Order of an expression indicates the degree of
nesting
31Types of Logic
- Variations of FOL
- Syntax
- Subsets
- Proof theory
- Model theory
- Ontology
- Metalanguage
32Reification
- Formal trick
- For each predicate, create a constant that stands
for it - In KIF, it is the tuple semantics of the
predicate - Requires an axiom schema (think macro)
- Use those constants in axioms
- Since they are constants, the resulting theory is
first-order - Useful for expressing control knowledge
- Reify facts, so one can say when they are relevant
33Reification Example
Include state 1
Include state 1
34Synthetic Item
The item node reifies the schema nodes
verification conditions
Wall to the left
35Synthetic Item
Bump
Context spin-offs refine the verification
conditions
1) Applicability of host schema nodes
2) Successful execution of host schema nodes
3) Prediction by being in the result set of a
schema node
Wall to the left
36Modal Operators
- Modal operators extend the expressive power of a
logic by specifying context - Metaphor quotation and backquote
- Can use reification of their semantics to drop
the reasoning to first order, but can still be
hairy - Classic examples from logic (necessary P),
(possible P) - (iff (necessary P) (not (possible (not P))))
- Classic examples from AI/Philosophy (Knows A P),
(Believes A P) - ( (knows John (visible morning-star))
- (knows John (visible evening-star)))
37Model Theory
- Meaning of a theory set of models that satisfy
it. - Model set of objects and relationships
- If statement is true in KB, then the
corresponding relationship(s) hold between the
corresponding objects in the modeled world - The objects and relationships in a model can be
formal constructs, or pieces of the physical
world, or whatever - Meaning of a predicate set of things in the
models for that theory which correspond to it. - E.g., above means above, sort of
38Caution Meaning pertains to simplestmodel
- There is usually an intended model, i.e., what
one is representing. - A sparse set of axioms can be satisfied by
dramatically simpler worlds than those intended - Example Classic blocks world axioms have ordered
pairs of integers as a model - ( ) ? block
- (on A B) ? p(A) p(B) h(A) h(B)1
- (above A B) ? p(A) p(B) h(A) h(B)
- Moral Use dense, rich set of axioms and make
sure you are defining what you think you are
defining
39Misconceptions about meaning
- Predicates have definitions
- Most dont. Their meaning is constrained by the
sum total of axioms that mention them. - Logic is too discrete to capture the dynamic
fluidity of how our concepts change as we learn - If you think of the set of axioms that constrain
the meaning of a predicate as large, then adding
(and removing) elements of that set leads to
changes in its models. - Sometimes small changes in the set of axioms can
lead to large changes in the set of models. This
is the logical version of a discontinuity.
40Representations as Sculptures
- How does one make a statue of an elephant?
- Start with a marble block. Carve away everything
that does not look like an elephant. - How does one represent a concept?
- Start with a vocabulary of predicates and other
axioms. Add axioms involving the new predicate
until it fits your intended model well. - Knowledge representation is an evolutionary
process - It isnt quick, but incremental additions lead to
incremental progress - All representations are by their nature imperfect