Download presentation
Presentation is loading. Please wait.
Published byHope Ramsey Modified over 9 years ago
1
11 Artificial Intelligence CS 165A Tuesday, October 30, 2007 Knowledge and reasoning (Ch 7) Propositional logic First-order logic (Ch 8) 1
2
2 Notes HW#2 due today HW#3 due Thursday, November 8 th –Posted tonight Midterm on Tuesday, November 13 th Just in case there’s any confusion, in the slides: is the same as (implies) ↔ is the same as (equivalence)
3
3 Implication and entailment What is the difference between implication and entailment? P QP Q(P Q) P Q ImplicationEntailment P is a proposition (“It is raining”) Q is a proposition (“The grass is wet”) This sentence has a specific semantic interpretation – it’s not a general rule It may be true or false, depending on the values of P and Q P and Q are variables – they can stand for any propositions in the KB This sentence has no specific semantic interpretation – it is a general rule It is always true, independent of the values of P and Q
4
4 Implication and entailment What is the difference between implication and entailment? P QP Q( ) ImplicationEntailment P is a proposition (“It is raining”) Q is a proposition (“The grass is wet”) This sentence has a specific semantic interpretation – it’s not a general rule It may be true or false, depending on the values of P and Q and are variables – they can stand for any propositions in the KB This sentence has no specific semantic interpretation – it is a general rule It is always true, independent of the values of and ( )
5
5 Implication and entailment What is the difference between implication and entailment? P QP Q( ) ImplicationEntailment P is a proposition (“It is raining”) Q is a proposition (“The grass is wet”) This sentence has a specific semantic interpretation – it’s not a general rule It may be true or false, depending on the values of P and Q and are variables – they can stand for any propositions in the KB This sentence has no specific semantic interpretation – it is a general rule It is always true, independent of the values of and ( ),
6
6 Important Inference Rules for Propositional Logic Issues?
7
7 Example KB R S P W SS R P P QP Q What can we infer ( ) if we add this sentence with no inference rules? P Q What can we infer ( ) if we then add this inference procedure: ( ) Nothing Q and S ( ),
8
8 false Q Why is false Q always true? Answer #1: Since P Q ↔ P Q, so false Q ↔ true Q, which is always true Answer #2: That is how the symbol is defined and interpreted. (We could invent another logical symbol that is interpreted differently.)
9
9 Precedence of operators (logical connectives) Levels of precedence, evaluating left to right 1. (NOT) 2. (AND, conjunction) 3. (OR, disjunction) 4. (implies, conditional) 5. (equivalence, biconditional) P Q R –(P ( Q)) R P Q R –P (Q R) P Q R S –P ((Q R) S) Corrections
10
10 Things to know! What is a sound inference procedure? –The procedure only generates entailed sentences What is a complete inference procedure? –The procedure can find a proof for any sentence that is entailed What is a satisfiable sentence? –There are some interpretations for which it is true What is an unsatisfiable sentence? –There is no interpretation for which it is true What is a valid sentence? –It is true under all possible interpretations
11
11 Resolution Rule: one rule for all inferences Propositional calculus resolution or Remember: p q p q, so let’s rewrite it as: Resolution is really the “chaining” of implications. Would like to show that resolution is sound and (essentially) complete (use Deduction Rule for proof)
12
12 Show that (α β) ( β γ) (α γ) αβγ α βα β β γβ γαβ βγαβ βγα γ 0000100 0010101 0101000 0111111 1001111 1011111 1101001 1111111 This is always true for all propositions α, β, and γ, so we can make it an inference rule Soundness:
13
13 Show that ( α β ) (β γ) ( α γ) αβγ α βα ββ γβ γ α β β γ α γα γ 0000100 0010101 0101000 0111111 1001111 1011111 1101001 1111111 This is always true for all propositions α, β, and γ, so we can make it an inference rule Soundness:
14
14 Conversion to Conjunctive Normal Form: CNF Resolution rule is stated for conjunctions of disjunctions Question: –Can every statement in PC be represented this way? Answer: Yes –Can show every sentence in propositional logic is equivalent to conjunction of disjunctions Conjunctive normal form (CNF) Procedure for obtaining CNF –Replace (P Q) with (P Q) and (Q P) –Eliminate implications: Replace (P Q) with ( P Q) –Move inwards: , (P Q), (P Q) –Distribute over , e.g.: (P Q) R becomes (P R) (Q R) [What about (P Q) R ?] –Flatten nesting: (P Q) R becomes P Q R
15
15 Propositional logic is quite limited Propositional logic has simple syntax and semantics, and limited expressiveness –Though it is handy to illustrate the process of inference However, it only has one representational device, the proposition, and cannot generalize –Input: facts; Output: facts –Result: Many, many rules are necessary to represent any non- trivial world –It is impractical for even very small worlds The solution? –First-order logic, which can represent propositions, objects, and relations between objects –Worlds can be modeled with many fewer rules
16
16 First-Order Logic Chapter 8
17
17 First-Order Logic (FOL) Also known as First-Order Predicate Calculus –Propositional logic is also known as Propositional Calculus An extension to propositional logic in which quantifiers can bind variables in sentences –Universal quantifier ( ) –Existential quantifier ( ) –Variables: x, y, z, a, joe, table… Examples – x Beautiful (x) – x Beautiful (x) A method of analysis or calculation using a special symbolic notation
18
18 Propositional logic vs. FOL Propositional logic: –P stands for “All men are mortal” –Q stands for “Socrates is a man” –What can you infer from P and Q? Nothing! First-order logic: – x Man (x) Mortal (x) –Man (Socrates) –What can you infer from these? Can infer Mortal (Socrates)
19
19 First-Order Logic (cont.) FOL can express anything that can be programmed It is by far the most studied and best understood logic in use It does have limits, however –Quantifiers ( and ) can only be applied to objects, not to functions or predicates Cannot write P P (mom) = good This is why it’s called first-order –This limits its expressiveness Let’s look at the syntax of first-order logic –I.e., what logical expressions can you legally construct?
20
20 FOL Syntax Symbols –Object symbols (constants): P, Q, Fred, Desk, True, False, … These refer to things –Predicate symbols: Heavy, Smart, Mother, … These are true or false statements about objects: Smart(rock) –Function symbols: Cosine, IQ, MotherOf, … These return objects, exposing relations: IQ(rock) –Variables: x, y,, … These represent unspecified objects –Logical connectives to construct complex sentences: , , , , –Quantifiers: (universal), (existential) –Equality: = Usually variables will be lower-case, other symbols capitalized
21
21 FOL Syntax (cont.) Terms –Logical expressions that refer to objects (evaluates to an object) –Can be constants, variables, functions Examples –P–P –2001 –Richard –x–x –y–y –BrotherOf (Richard) –Age (NephewOf (x)) [Why not AgeOf ( ) ? (No reason...!)] Remember – syntax and semantics are different, and separate!!
22
22 FOL Syntax Note on predicates and functions: typical usage –Beautiful (y) “y is beautiful” –Mother (x) “x is a Mother” –BrotherOf (x, y) “x is a brother of y” –NextTo (x, y) “x is next to y” –BrotherOf (x) “the brother of x” –NextTo (y) “a thing next to y” –SquareRoot (x) “the square root of x” Predicates Functions
23
23 FOL Sentences Sentences state facts –Just like in propositional logic… 3 types of sentences: –Atomic sentences (atoms) –Logical (complex) sentences –Quantified sentences – (universal), (existential)
24
24 Sentences 1.Atomic sentence –A predicate applied to some terms Brothers (Bill, FatherOf (John)) [Does the reverse follow?] LessThan (3, 5) –Equality – states that two terms refer to the same object x = MotherOf (y) Instructor (cs165a) = Turk This is equivalent to the predicate: Equal (Instructor (cs165a), Turk) 2.Logical (complex) sentence – logical combination of other sentences – Brothers (Bill, HusbandOf (Sue)) –Above (Sky, Ground) Below (Ground, Sky) –Brothers (Bill, John) Brothers (John, Bill) 3.Quantified sentence – sentences with quantified variables – x,y ParentOf (x, y) ChildOf (y, x) – x US-President (x) Constant, variable, or function – evaluates to an object
25
25 Universal Quanitifer (“For all…”) – x – “For all x…” – x, y – “For all x and y…” Examples –“Everything is beautiful” x Beautiful (x) Equivalent to: i Beautiful (x i ) –Beautiful (Joe) Beautiful (Mary) Beautiful (apple) Beautiful (dirt) Beautiful (death) … –“All men are mortal” x Man (x) Mortal (x) –“Everyone in the class is smart” x Enrolled (x, cs165a) Smart (x) –What does this mean: x Enrolled (x, cs165a) Smart (x) “Everything is enrolled in cs165a and is smart” !!
26
26 Expansion of universal quantifier x Enrolled(x, cs165a) Smart(x) This is equivalent to –Enrolled (Tom, cs165a) Smart (Tom) Enrolled (Mary, cs165a) Smart (Mary) Enrolled (Chris, cs165a) Smart (Chris) Enrolled (chair, cs165a) Smart (chair) Enrolled (dirt, cs165a) Smart (dirt) Enrolled (surfboard, cs165a) Smart (surfboard) Enrolled (tooth, cs165a) Smart (tooth) Enrolled (Mars, cs165a) Smart (Mars) … –Everything! So, x Enrolled (x, cs165a) Smart (x) is equivalent to –Enrolled (Tom, cs165a) Smart (Tom) Enrolled (chair, cs165a) Smart (chair) …
27
27 Existential Quantifier (“There exists…”) – x – “There exists an x such that…” – x, y – “There exist x and y such that…” Examples –“Somebody likes me” x Likes (x, Me) ??? Equivalent to: i Likes (x i, Me) –Likes (Joe, Me) Likes (Mary, Me) Likes (apple, Me) Likes (dirt, Me) Likes (death, Me) … Really “Something likes me” – x Person (x) Likes (x, Me) – x Enrolled (x, cs165a) WillReceiveAnA+ (x)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.