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