Propositional and First-Order Logic

Similar documents
Propositional Logic: Review

Artificial Intelligence Knowledge Representation I

Reasoning. Inference. Knowledge Representation 4/6/2018. User

Logic. (Propositional Logic)

Propositional and First-Order Logic

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Logic and Proof. Aiichiro Nakano

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes:

First order Logic ( Predicate Logic) and Methods of Proof

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Logic and Propositional Calculus

CSC Discrete Math I, Spring Propositional Logic

Logic and Propositional Calculus

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Discrete Mathematics and Its Applications

Logic Overview, I. and T T T T F F F T F F F F

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Mat 243 Exam 1 Review

Section Summary. Section 1.5 9/9/2014

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

ICS141: Discrete Mathematics for Computer Science I

Logic and Proofs. (A brief summary)

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

Introduction to Decision Sciences Lecture 2

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

Chapter 4, Logic using Propositional Calculus Handout

A. Propositional Logic

First-Order Logic. Announcements. General Logic. PL Review: Truth Tables. First-Order Logic. PL Review: Inference Rules

Chapter 2: The Logic of Quantified Statements

III. Elementary Logic

ECOM Discrete Mathematics

Compound Propositions

Proposition/Statement. Boolean Logic. Boolean variables. Logical operators: And. Logical operators: Not 9/3/13. Introduction to Logical Operators

ICS141: Discrete Mathematics for Computer Science I

Introduction to Sets and Logic (MATH 1190)

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

DISCRETE MATHEMATICS BA202

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Unit I LOGIC AND PROOFS. B. Thilaka Applied Mathematics

CSCE 222 Discrete Structures for Computing. Predicate Logic. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

PROPOSITIONAL CALCULUS

Definition 2. Conjunction of p and q

Predicate Logic & Quantification

MAT 243 Test 1 SOLUTIONS, FORM A

Propositional Logic Part 1

First-Order Logic: Review

2-4: The Use of Quantifiers

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

CSCI-495 Artificial Intelligence. Lecture 17

15414/614 Optional Lecture 1: Propositional Logic

Review: Potential stumbling blocks

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

EECS 1028 M: Discrete Mathematics for Engineers

It rains now. (true) The followings are not propositions.

J Propositional logic is declarative J Propositional logic is compositional: q meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of P 1,2

Propositional Logic Not Enough

! Predicates! Variables! Quantifiers. ! Universal Quantifier! Existential Quantifier. ! Negating Quantifiers. ! De Morgan s Laws for Quantifiers

Chapter 16. Logic Programming. Topics. Logic Programming. Logic Programming Paradigm

Discrete Mathematics and Applications COT3100

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

1 The Foundation: Logic and Proofs

Propositional Functions. Quantifiers. Assignment of values. Existential Quantification of P(x) Universal Quantification of P(x)

Supplementary Logic Notes CSE 321 Winter 2009

Propositional logic (revision) & semantic entailment. p. 1/34

Proving logical equivalencies (1.3)

Propositional Logic. Spring Propositional Logic Spring / 32

software design & management Gachon University Chulyun Kim

Logic and Proofs. (A brief summary)

Predicates and Quantifiers. Nested Quantifiers Discrete Mathematic. Chapter 1: Logic and Proof

Rules Build Arguments Rules Building Arguments

1 The Foundation: Logic and Proofs

Chapter 1 Elementary Logic

Announcement. Homework 1

Logic and Proof. On my first day of school my parents dropped me off at the wrong nursery. There I was...surrounded by trees and bushes!

Predicate Logic. Andreas Klappenecker

Inference in Propositional Logic

First-Order Logic. Propositional logic. First Order logic. First Order Logic. Logics in General. Syntax of FOL. Examples of things we can say:

Chapter 1: The Logic of Compound Statements. January 7, 2008

On my first day of school my parents dropped me off at the wrong nursery. There I was...surrounded by trees and bushes! 26-Aug-2011 MA

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

HANDOUT AND SET THEORY. Ariyadi Wijaya

1.1 Language and Logic

Quantifiers Here is a (true) statement about real numbers: Every real number is either rational or irrational.

CS 2336 Discrete Mathematics

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Discrete Mathematical Structures: Theory and Applications

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

The Logic of Compound Statements cont.

Lecture 4. Predicate logic

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

MAT2345 Discrete Math

Intro to Logic and Proofs

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Logic and Inferences

Transcription:

Propositional and irst-order Logic 1

Propositional Logic 2

Propositional logic Proposition : A proposition is classified as a declarative sentence which is either true or false. eg: 1) It rained yesterday. Propositional symbols/variables: P, Q, S,... (atomic sentences) Sentences are combined by Connectives:...and...or...implies [conjunction] [disjunction] [implication / conditional]..is equivalent [biconditional]...not [negation] Literal: atomic sentence or negated atomic sentence 3

Propositional logic (PL) Sentence or well formed formula A sentence (well formed formula) 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 are sentences, then (S ), (S ), (S ), and (S ) are sentences A sentence results from a finite number of applications of the above rules 5

Laws of Algebra of Propositions Idempotent: p V p p p Λ p p Commutative: p V q q V p p Λ q q Λ p Complement: p V ~p p Λ ~p Double Negation: ~(~p) p 7

Associative: p V (q V r) (p V q) V r p Λ (q Λ r) (p Λ q) Λ r Distributive: p V (q Λ r) (p V q) Λ (p V r) p Λ (q V r) (p Λ q) V (p Λ r) Absorbtion: p V (p Λ q) p p Λ (p V q) p Identity: p V p Λ p p V p p Λ 8

De Morgan s ~(p V q) ~p Λ ~q ~(p Λ q) ~p V ~q Equivalence of Contrapositive: p q ~q ~p Others: p q ~p V q p q (p q) Λ (q p) 9

autologies and contradictions A tautology is a sentence that is rue under all interpretations. An contradiction is a sentence that is alse under all interpretations. p p p p p p p p 10 L3

autology by truth table p q p p q p (p q ) [ p (p q )] q 11 L3

Propositional Logic - one last proof Show that [p (p q)] q is a tautology. We use to show that [p (p q)] q. [p (p q)] q [p ( p q)] q [(p p) (p q)] q [ (p q)] q (p q) q (p q) q ( p q) q p ( q q ) p 4/4/2016 substitution for distributive complement identity substitution for DeMorgan s associative complement identity 12

Logical Equivalence of Conditional and Contrapositive he easiest way to check for logical equivalence is to see if the truth tables of both variants have identical last columns: p q p q p q q p q p 13 L3

able of Logical Equivalences Identity laws Like adding 0 Domination laws Like multiplying by 0 Idempotent laws Delete redundancies Double negation I don t like you, not Commutativity Like x+y = y+x Associativity Like (x+y)+z = y+(x+z) Distributivity Like (x+y)z = xz+yz De Morgan 14 L3

able of Logical Equivalences Excluded middle Negating creates opposite Definition of implication in terms of Not and Or 15 L3

Inference rules Logical inference is used to create new sentences that logically follow from a given set of predicate calculus sentences (KB). 16

Sound rules of inference Here are some examples of sound rules of inference A rule is sound if its conclusion is true whenever the premise is true Each can be shown to be sound using a truth table RULE PREMISE CONCLUSION Modus Ponens A, A B B And Introduction/Conjuction A, B A B And Elimination/SimplificationA B A Double Negation A A Unit Resolution A B, B A Resolution A B, B C A C 17

Soundness of modus ponens A B A B OK? rue rue rue rue alse alse alse rue rue alse alse rue 18

Soundness of the resolution inference rule 19

Proving things A proof is a sequence of sentences, where each sentence is either a premise or a sentence derived from earlier sentences in the proof by one of the rules of inference. he last sentence is the theorem (also called goal or query) that we want to prove. Example for the weather problem given above. 1 Hu Premise It is humid 2 Hu Ho Premise If it is humid, it is hot 3 Ho Modus Ponens(1,2) It is hot 4 (Ho Hu) R Premise If it s hot & humid, it s raining 5 Ho Hu And Introduction(1,3) It is hot and humid 6 R Modus Ponens(4,5) It is raining 20

Problems with Propositional Logic 21

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 ) irst-order Logic (abbreviated OL or OPC) is expressive enough to concisely represent this kind of information OL adds relations, variables, and quantifiers, e.g., Every elephant is gray : x (elephant(x) gray(x)) here is a white alligator : x (alligator(x) ^ white(x)) 22

irst-order Logic 23

irst-order logic irst-order logic (OL) 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 unctions, 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,... unctions: father-of, best-friend, second-half, one-more-than... 24

User provides Constant symbols, which represent individuals in the world Mary 3 Green unction 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) 25

OL Provides 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) 26

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) Permits one to make a statement about some object without naming it 27

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 here is a student who is smart A common mistake is to represent this English sentence as the OL sentence: ( x) student(x) smart(x) But what happens when there is a person who is not a student? 28

Quantifier Scope Switching the order of universal quantifiers does not change the meaning: ( x)( y)p(x,y) ( y)( x) P(x,y) Similarly, you can switch the order of existential quantifiers: ( x)( y)p(x,y) ( y)( x) P(x,y) Switching the order of universals and existentials does change meaning: Everyone likes someone: ( x)( y) likes(x,y) Someone is liked by everyone: ( y)( x) likes(x,y) 29

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) P(x) ( x) P(x) ( x) P(x) ( x) P(x) ( x) P(x) 30

Quantified inference rules Universal instantiation x P(x) P(A) Universal generalization P(A) P(B) x P(x) Existential instantiation x P(x) P() Existential generalization P(A) x P(x) 31

Universal instantiation (a.k.a. universal elimination) 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) 32

ranslating English to OL Every gardener likes the sun. x gardener(x) likes(x,sun) You can fool some of the people all of the time. x t person(x) time(t) can-fool(x,t) You can fool all of the people some of the time. x t (person(x) time(t) can-fool(x,t)) x (person(x) t (time(t) can-fool(x,t)) All purple mushrooms are poisonous. x (mushroom(x) purple(x)) poisonous(x) No purple mushroom is poisonous. x purple(x) mushroom(x) poisonous(x) x (mushroom(x) purple(x)) poisonous(x) Clinton is not tall. tall(clinton) Equivalent Equivalent 33