Knowledge Representation with Logic First Order Predicate Calculus










![Combining Logical Symbols • Terms: logical expressions referring to objects – first([a, b, c]), Combining Logical Symbols • Terms: logical expressions referring to objects – first([a, b, c]),](https://slidetodoc.com/presentation_image/25bc28381445d4b8747ec6bf674ab1ce/image-11.jpg)













- Slides: 24

Knowledge Representation with Logic: First Order Predicate Calculus Outline – Introduction to First Order Predicate Calculus (FOPC) • syntax • semantics – Entailment – Soundness and Completeness CSE 391 - 2005 1 Pred. Logic

Modeling Our World with Propositional Logic • Limited. – Quickly gets explosive and cumbersome, can’t express generalizations – Can’t distinguish between objects and relations CSE 391 - 2005 2 Pred. Logic

Comparing Logics Ontology (ont = ‘to be’; logica = ‘word’): kinds of things one can talk about in the language Examples: • Propositional Logic • Predicate Logic Facts Objects, Relationships among Objects Time Points or Intervals (divorce) • Temporal Logics CSE 391 - 2005 3 Pred. Logic

Syntax of Predicate Logic • Symbol set – give examples for: – – – constants Boolean connectives variables functions predicates (aka relations) Quantifiers • Terms: variables, constants, functional expressions (can be arguments to predicates) CSE 391 - 2005 4 Pred. Logic

Syntax of Predicate Logic • Sentences: – atomic sentences (predicate expressions, literals) Ground literal? – complex sentences (atomic sentences connected by Booleans) – quantified sentences CSE 391 - 2005 5 Pred. Logic

Examples of Terms: Constants, Variables and Functions • Constants – Alan, Sam, R 225, R 216 • Variables – Person. X, Person. Y, Room. S, Room. T • Functions – father_of(Person. X) – product_of(Number 1, Number 2) CSE 391 - 2005 6 Pred. Logic

Examples of Predicates and Quantifiers • Predicates – in(Alan, R 225) – part. Of(R 225, Pender) – father. Of(Person. X, Person. Y) • Quantifiers – All dogs are mammals. – Some birds can’t fly. – 3 birds can’t fly. CSE 391 - 2005 7 Pred. Logic

Semantics of Predicate Logic • A term is a reference to an object – constants – variables – functional expressions • Sentences make claims about objects – Well-formed formulas, (wffs) CSE 391 - 2005 8 Pred. Logic

Semantics, part 2 • Object constants refer to individuals • There is a correspondence between – functions, which return values – Predicates (or relations), which are true or false Function: father_of(Mary) = Bill Predicate: father_of(Mary, Bill) CSE 391 - 2005 9 Pred. Logic

Semantics, part 3 • Referring to individuals – Jackie – son-of(Jackie), Sam • Referring to states of the world – person(Jackie), female(Jackie) – mother(Sam, Jackie) CSE 391 - 2005 10 Pred. Logic
![Combining Logical Symbols Terms logical expressions referring to objects firsta b c Combining Logical Symbols • Terms: logical expressions referring to objects – first([a, b, c]),](https://slidetodoc.com/presentation_image/25bc28381445d4b8747ec6bf674ab1ce/image-11.jpg)
Combining Logical Symbols • Terms: logical expressions referring to objects – first([a, b, c]), sq_root(9), sq_root(n), tail([a, b, c]) • Atomic Sentences: – loves(John, Mary), brother_of(John, Ted) • Complex Sentences: – loves(John, Mary) brother_of(John, Ted) teases(Ted, John) CSE 391 - 2005 11 Pred. Logic

Encoding Facts pass(John, courses, 40) => graduate(John) cavity(molar) => x-ray_shadow(molar) leak(pipe, kitchen) / full(pipe, water) => location(water, kitchen_floor) CSE 391 - 2005 12 Pred. Logic

KB Design Choices Design choice: Implication of choice: • red(block 1) • color(block 1, red) • val(color, block 1, red) ? ? ? nice(red) property(color) 2 nd order predicate calculus. . CSE 391 - 2005 13 Pred. Logic

Quantifiers • Universal Quantifiers. – All cats are mammals. • Existential Quantifiers. – There is a cat owned by John. CSE 391 - 2005 14 Pred. Logic

Restricting Quantifiers To say “All lawyers ___. ” ( x Lawyer(x) _____ ) To say “a lawyer ___. ” “some lawyers ___. ” ( x Lawyer(x) _____ ) To say “no lawyers ___. ” ( x Lawyer(x) _____ ) All lawyers do not ___. ( x Lawyer(x) _____ ) There does not exist a lawyer who ___. CSE 391 - 2005 15 Pred. Logic

Negation and Quantification • When you move negation inside or outside of a quantifier, then and get flipped. “All lawyers are not naïve. ” is equivalent to “There is no lawyer that is naïve. ” (Conditional Law) (De. Morgan’s Law) (Flip Quantifier) CSE 391 - 2005 16 Pred. Logic

Nested Quantification Order matters when some are and some . There is some cat that has some owner. All cats have an owner (but that owner could be different). There is some person who owns all the cats in the world. For all the owners and ownees in the world, the owner loves the ownee. CSE 391 - 2005 17 Pred. Logic

The Power of Expressivity • Indirect knowledge: Tall(Mother. Of(john)) • Counterfactuals: ¬Tall(john) • Partial knowledge (disjunction): Is. Sister. Of(b, a) Is. Sister. Of(c, a) • Partial knowledge (indefiniteness): x. Is. Sister. Of(X, a) CSE 391 - 2005 18 Pred. Logic

Inference Procedures • Mechanical rules that compute (derive) a new sentence from a set of sentences. • Proof theory: set of rules for deducing the entailments of a set of sentences. • Terminology: – proof = sequence of inference rule applications – derived wff = result of proof, theorem CSE 391 - 2005 19 Pred. Logic

General Resolution • Unit resolution with variables (requires unification) and more complex sentences • Complete – if something can be proven from KB, general resolution will prove it CSE 391 - 2005 20 Pred. Logic

Entailment is a Strong Requirement Q is a sentence; KB is a set of sentences If whenever the sentences in KB are true, Q is true, then KB Q (KB “entails” Q) CSE 391 - 2005 21 Pred. Logic

Logic as a representation of the World entails Representation: Sentences Sentence Refers to (semantics) follows World: CSE 391 - 2005 Facts Fact 22 Pred. Logic

Soundness & Completeness • Soundness: anything derived is entailed; inference procedure (rule) only produces entailments. • Completeness: anything entailed is derived; inference procedure (rules) produces all entailments. CSE 391 - 2005 23 Pred. Logic

General Resolution • Complete, but only semi-decidable • If its true it can be proven • If its not true, theorem prover might not halt, may not be able to prove that its not true • Closed World Assumption – no missing information, if P can’t be proven, assume P is false. CSE 391 - 2005 24 Pred. Logic