Chapter 1: Propositional and First-Order Logic

Slides:



Advertisements
Similar presentations
Moving on to First-Order Logic Language, Meaning, Logic USEM 40a James Pustejovsky.
Advertisements

First-Order Logic.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
First-Order Logic (FOL) aka. predicate calculus. First-Order Logic (FOL) Syntax User defines these primitives: –Constant symbols (i.e., the "individuals"
Basic Knowledge Representation in First Order Logic Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
First-Order Logic Chapter 8.
Propositional Calculus Knowledge based agent Knowledge is contained in agents in the form of sentences in a knowledge representation language stored in.
Discrete Mathematics Math 6A Instructor: M. Welling.
Predicate Calculus.
Predicates and Quantifiers
The Foundations: Logic and Proofs
Logical Equivalence & Predicate Logic
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
Review I Rosen , 3.1 Know your definitions!
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Pattern-directed inference systems
ARTIFICIAL INTELLIGENCE Lecture 3 Predicate Calculus.
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
1 Predicate (Relational) Logic 1. Introduction The propositional logic is not powerful enough to express certain types of relationship between propositions.
First Order Logic Chapter 8 Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
1 Propositional Logic Introduction. 2 What is propositional logic? Propositional Logic is concerned with propositions and their interrelationships. 
Artificial Intelligence First-Order Logic (FOL). Outline of this Chapter The need for FOL? What is a FOL? Syntax and semantics of FOL Using FOL.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
For Friday Read chapter 8 Homework: –Chapter 7, exercises 2 and 10 Program 1, Milestone 2 due.
First-Order Logic Chapter 8 (not 8.1). Outline Why FOL? Why FOL? Syntax and semantics of FOL Syntax and semantics of FOL Using FOL Using FOL Wumpus world.
LOGIC. Logic in general  Logics are formal languages for representing information such that conclusions can be drawn  Syntax defines the sentences in.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
1 First Order Logic CS 171/271 (Chapter 8) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Basic Knowledge Representation in First Order Logic Chapter 7 Some material adopted from notes by Tim Finin And Andreas Geyer-Schulz.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Chapter 7. Propositional and Predicate Logic
2. The Logic of Compound Statements Summary
Knowledge Representation using First-Order Logic
Advanced Algorithms Analysis and Design
CSE15 Discrete Mathematics 01/23/17
Knowledge Representation and Reasoning
First-Order Logic: Review
CMSC Discrete Structures
The Foundations: Logic and Proofs
Predicate logic Also known as predicate calculus or First-Order-Logic(FOL) or First- Order-Predicate-Calculus (FOPC). Meant to overcome the weaknesses.
CSCI 3310 Mathematical Foundation of Computer Science
CS201: Data Structures and Discrete Mathematics I
First Order Logic Chapter 8
Nested Quantifiers Nested quantifiers are often necessary to express the meaning of sentences in English as well as important concepts in computer science.
1st-order Predicate Logic (FOL)
Artificial Intelligence
Back to “Serious” Topics…
MA/CSSE 474 More Math Review Theory of Computation
Computer Security: Art and Science, 2nd Edition
Logical Agents Chapter 7.
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Chapter 7. Propositional and Predicate Logic
Predicates and Quantifiers
TRUTH TABLES.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
CS201: Data Structures and Discrete Mathematics I
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
First-Order Logic: Review
Representations & Reasoning Systems (RRS) (2.2)
Logical Agents Chapter 7 Andreas Geyer-Schulz and Chuck Dyer
1st-order Predicate Logic (FOL)
Presentation transcript:

Chapter 1: Propositional and First-Order Logic DM552: Part 2 Programing Logic Chapter 1: Propositional and First-Order Logic Dr Youcef Djenouri djenouri@imada.sdu.dk 2017-2018

Propositional Logic

Propositional logic  ...and [conjunction]  ...or [disjunction] Logical constants: true, false Propositional symbols: P, Q, S, ... (atomic sentences) Wrapping parentheses: ( … ) Sentences are combined by connectives:  ...and [conjunction]  ...or [disjunction] ...implies [implication / conditional] ..is equivalent [biconditional]  ...not [negation] Literal: atomic sentence or negated atomic sentence

Example P means “Assist course.” Q means “do exercise .” R means “Succeed.” (P  Q)  R “If you assist course and do exercise, then you succeed”

Propositional logic (PL) A simple language useful for showing key ideas and definitions User defines a set of propositional symbols, like P and Q. User defines the semantics of each propositional symbol: P means “Assist course” Q means “do exercise” R means “succeed” A sentence is defined as follows: A symbol is a sentence If S is a sentence, then S is a sentence If S is a sentence, then (S) is a sentence If S and T are sentences, then (S  T), (S  T), (S  T), and (S ↔ T) are sentences

Definitions The meaning or semantics of a sentence determines its interpretation. Given the truth values of all symbols in a sentence, it can be “evaluated” to determine its truth value (True or False). A valid sentence or tautology is a sentence that is True under all interpretations, no matter what the world is actually like or how the semantics are defined. Example: “It’s succeed or it’s not succeed.” An inconsistent sentence or contradiction is a sentence that is False under all interpretations. The world is never like what it describes, as in “It’s succeed and it’s not succeed.” P entails Q, written P |= Q, means that whenever P is True, so is Q. In other words, all models of P are also models of Q.

Truth table P Q P P  Q P  Q P  Q P ↔Q False True

Propositional logic is a weak language Hard to identify “individuals” (e.g., Mary, 3) Can’t directly talk about properties of individuals or relations between individuals (e.g., “Bill is tall”) Generalizations, patterns, regularities can’t easily be represented (e.g., “all triangles have 3 sides”) First-Order Logic (FOL) is expressive enough to concisely represent this kind of information FOL adds relations, variables, and quantifiers, e.g., “Every elephant is gray”:  x (elephant(x) → gray(x)) “There is a white alligator”:  x (alligator(X) ^ white(X))

Classwork Construct a truth table for the following formulas: 1- ((P  Q)   Q) 2- ((( P  Q)   Q)  P) Which of the previous formulas are considered as tautologies?

First-Order Logic

First-order logic First-order logic (FOL) models the world in terms of Objects, which are things with individual identities Properties of objects that distinguish them from other objects Relations that hold among sets of objects Functions, which are a subset of relations where there is only one “value” for any given “input” Examples: Objects: Students, lectures, companies, cars ... Relations: Brother-of, bigger-than, outside, part-of, has-color, occurs-after, owns, visits, precedes, ... Properties: blue, oval, even, large, ... Functions: father-of, best-friend, second-half, one-more-than ...

Syntax (1/3) Constant symbols, which represent individuals in the world Mary 3 Green Function symbols, which map individuals to individuals father-of(Mary) = John color-of(Sky) = Blue Predicate symbols, which map individuals to truth values greater(5,3) green(Grass) color(Grass, Green)

Syntax (2/3) Variable symbols E.g., x, y, foo Connectives Same as in PL: not (), and (), or (), implies (), if and only if (biconditional ) Quantifiers Universal x or (Ax) Existential x or (Ex)

Syntax(3/3) A term (denoting a real-world individual) is a constant symbol, a variable symbol, or an n-place function of n terms. x and f(x1, ..., xn) are terms, where each xi is a term. A term with no variables is a ground term An atomic sentence (which has value true or false) is an n-place predicate of n terms A complex sentence is formed from atomic sentences connected by the logical connectives: P, PQ, PQ, PQ, PQ where P and Q are sentences A quantified sentence adds quantifiers  and  A well-formed formula (wff) is a sentence containing no “free” variables. That is, all variables are “bound” by universal or existential quantifiers. (x)P(x,y) has x bound as a universally quantified variable, but y is free.

Quantifiers Universal quantification (x)P(x) means that P holds for all values of x in the domain associated with that variable E.g., (x) dolphin(x)  mammal(x) Existential quantification ( x)P(x) means that P holds for some value of x in the domain associated with that variable E.g., ( x) mammal(x)  lays-eggs(x)

Quantifiers Universal quantifiers are often used with “implies” to form “rules”: (x) student(x)  smart(x) means “All students are smart” Universal quantification is rarely used to make blanket statements about every individual in the world: (x)student(x)smart(x) means “Everyone in the world is a student and is smart” Existential quantifiers are usually used with “and” to specify a list of properties about an individual: (x) student(x)  smart(x) means “There is a student who is smart

Quantifier Scope (x)(y)P(x,y) ↔ (y)(x) P(x,y) Switching the order of universal and existential quantifiers does not change the meaning: (x)(y)P(x,y) ↔ (y)(x) P(x,y) (x)(y)P(x,y) ↔ (y)(x) P(x,y) (x)(y) likes(x,y) ↔ (y)(x) likes(x,y)

Connections between All and Exists We can relate sentences involving  and  using De Morgan’s laws: (x) P(x) ↔ (x) P(x) (x) P(x) ↔ (x) P(x) (x) P(x) ↔  (x) P(x) (x) P(x) ↔ (x) P(x)

Universal instantiation and Existential generalization If (x) P(x) is true, then P(C) is true, where C is any constant in the domain of x Example: (x) eats(Ziggy, x)  eats(Ziggy, IceCream) If P(C) is true, then (x) P(x) is inferred. Example eats(Ziggy, IceCream)  (x) eats(Ziggy, x)

Semantics of FOL Domain M: the set of all objects in the world (of interest) Interpretation I: includes Assign each constant to an object in M Define each function of n arguments as a mapping Mn => M Define each predicate of n arguments as a mapping Mn => {T, F} Therefore, every ground predicate with any instantiation will have a truth value In general there is an infinite number of interpretations because |M| is infinite Define logical connectives: ~, ^, , =>, <=> as in PL Define semantics of (x) and (x) (x) P(x) is true iff P(x) is true under all interpretations (x) P(x) is true iff P(x) is true under some interpretation

Logical consequence: S |= X if all models of S are also models of X Model: an interpretation of a set of sentences such that every sentence is True A sentence is satisfiable if it is true under some interpretation valid if it is true under all possible interpretations inconsistent if there does not exist any interpretation under which the sentence is true Logical consequence: S |= X if all models of S are also models of X

Interpretation: Example Consider the set of formulas: {(x) P(x), (x) Q(x) } An interpretation will need to specify a domain, e.g. D = {1, 2} an assignment for all predicate symbol from D to the set {True, False}, for example {P(1) = True, P(2) = False} and {Q(1) = False, Q(2) = True}.

Classwork Facts: Rules for genealogical relations Query husband(Joe, Mary), son(Fred, Joe) spouse(John, Nancy), male(John), child(Nancy, Jack) daughter(Linda, Jack), male (Jack). Rules for genealogical relations (x,y) parent(x, y) ↔ child (y, x) (x,y) father(x, y) ↔ parent(x, y)  male(x) (similarly for mother(x, y)) (x,y) daughter(x, y) ↔ child(x, y)  female(x) (similarly for son(x, y)) (x,y) husband(x, y) ↔ spouse(x, y)  male(x) (similarly for wife(x, y)) (x,y) spouse(x, y) ↔ spouse(y, x) (spouse relation is symmetric) Query father(Jack, Nancy)?