21
PROPOSITIONAL LOGIC & PREDICATE LOGIC Nidheesh Chittil

Artificial intelligence propositional logic

Embed Size (px)

DESCRIPTION

Propositional logic

Citation preview

Page 1: Artificial intelligence propositional logic

PROPOSITIONAL LOGIC & PREDICATE LOGIC

Nidheesh Chittil

Page 2: Artificial intelligence propositional logic

1. Propositional Logic

A proposition – a sentence that can be either true or false.

Propositional logic consists of:

– The logical values true and false (T and F)

– Propositions: “Sentences,” which

● Are atomic (that is, they must be treated as indivisible units, with no internal structure), and

● Have a single logical value, either true or false

– Operators, both unary and binary; when applied to logical values, yield logical values

● The usual operators are and, or, not, and implies

Page 3: Artificial intelligence propositional logic

Well formed formula

· Propositional Calculus (PC) is a language of propositions basically refers – to set of rules used to combine the propositions to form compound

propositions using logical operators often called connectives such as , V, ~, ,

· Well-formed formula is defined as:– An atom is a well-formed formula.– If is a well-formed formula, then ~ is a well-formed formula.– If and are well formed formulae, then ( ), ( V ), ( ),

( ) are also well-formed formulae.– A propositional expression is a well-formed formula if and only if it

can be obtained by using above conditions.

Page 4: Artificial intelligence propositional logic

Equivalence lawsCommutation

1. P Q Q P

2. P V Q Q V P

Association

1. P (Q R) (P Q) R

2. P V (Q V R) (P V Q) V R

Double Negation

~ (~ P) P

Distributive Laws

1. P ( Q V R) (P Q) V (P R)

2. P V ( Q R) (P V Q) (P V R)

De Morgan’s Laws

1. ~ (P Q) ~ P V ~ Q

2. ~ (P V Q) ~ P ~ Q

Law of Excluded Middle

P V ~ P T (true)

Law of Contradiction

P ~ P F (false)

Page 5: Artificial intelligence propositional logic

Truth table

● Truth table gives us operational definitions of important logical operators.

– By using truth table, the truth values of well-formed formulae are calculated.

● Truth table elaborates all possible truth values of a formula. ● The meanings of the logical operators are given by the following truth

table.

P Q ~P P Q P V Q P Q P QT T F T T T T

T F F F T F F

F T T F T T F

F F T F F T T

Page 6: Artificial intelligence propositional logic

Syntax

1. symbols

– logical constants True, False

– propositional symbols P, Q, …

– logical connectives

● conjunction ∧, disjunction ∨,

● negation ¬,

● implication ⇒, equivalence ⇔

– parentheses (, )

2. sentences

– constructed from simple sentences

– conjunction, disjunction, implication, equivalence, negation

Page 7: Artificial intelligence propositional logic

Propositional logic : Syntax

Page 8: Artificial intelligence propositional logic

Cont.

The symbols of the language:

– Propositional symbols (Prop): A, B, C,…

– Connectives:

● and

● or

● not

● implies

● equivalent to

● © xor (different than)

● , > False, True

– Parenthesis:(, ).

Page 9: Artificial intelligence propositional logic

Semantics

1. interpretation of the propositional symbols and constants

– symbols can stand for any arbitrary fact

● sentences consisting of only a propositional symbols are satisfiable, but not valid

– the value of the symbol can be True or False

– must be explicitly stated in the model

– the constants True and False have a fixed interpretation

● True indicates that the world is as stated

● False indicates that the world is not as stated

2. specification of the logical connectives

– frequently explicitly via truth tables

Page 10: Artificial intelligence propositional logic

Semantics

Page 11: Artificial intelligence propositional logic

2. Predicate Logic

Predicate calculus is also known as “First Order Logic” (FOL)

Predicate calculus includes:

– All of propositional logic

● Logical values true, false

● Variables x, y, a, b,...

● Connectives , , , , – Constants KingJohn, 2, Villanova,...

– Predicates Brother, >,...

– Functions Sqrt, MotherOf,...

– Quantifiers ,

Page 12: Artificial intelligence propositional logic

Constants, functions and predicates

A constant represents a “thing”--it has no truth value, and it does not occur “bare” in a logical expression

Examples: DavidMatuszek, 5, Earth, goodIdea

Given zero or more arguments, a function produces a constant as its value:

Examples: motherOf(DavidMatuszek), add(2, 2), thisPlanet()

A predicate is like a function, but produces a truth value

Examples: greatInstructor(DavidMatuszek), isPlanet(Earth), greater(3, add(2, 2))

Page 13: Artificial intelligence propositional logic

Universal quantifier The universal quantifier, , is read as “for each”

or “for every”

Example: x, x2 0 (for all x, x2 is greater than or equal to zero)

Typically, is the main connective with :

x, at(x,Villanova) smart(x)

means “Everyone at Villanova is smart”

Common mistake: using as the main connective with :

x, at(x,Villanova) smart(x)

means “Everyone is at Villanova and everyone is smart”

If there are no values satisfying the condition, the result is true

Example: x, isPersonFromMars(x) smart(x) is true

Page 14: Artificial intelligence propositional logic

Existential quantifier The existential quantifier, , is read “for some” or “there exists”

Example: x, x2 < 0 (there exists an x such that x2 is less than zero)

Typically, is the main connective with :

x, at(x,Villanova) smart(x)

means “There is someone who is at Villanova and is smart”

Common mistake: using as the main connective with :

x, at(x,Villanova) smart(x)

This is true if there is someone at Villanova who is smart...

...but it is also true if there is someone who is not at Villanova

By the rules of material implication, the result of F T is T

Page 15: Artificial intelligence propositional logic

Properties of quantifiers x y is the same as y x x y is the same as y x

x y is not the same as y x x y Loves(x,y)

– “There is a person who loves everyone in the world”– More exactly: x y (person(x) person(y) Loves(x,y))

y x Loves(x,y)– “Everyone in the world is loved by at least one person”

Quantifier duality: each can be expressed using the other x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli)

Page 16: Artificial intelligence propositional logic

Parentheses Parentheses are often used with quantifiers Examples:

– (x) person(x) likes(x,iceCream)– (x) (person(x) likes(x,iceCream))– (x) [ person(x) likes(x,iceCream) ]– x, person(x) likes(x,iceCream)– x (person(x) likes(x,iceCream))

Parentheses are preferred that show the scope of the quantifier

– x (x > 0) x (x < 0)

Page 17: Artificial intelligence propositional logic

Syntax

based on sentences– more complex than propositional logic

• constants, predicates, terms, quantifiers

1.constant symbols A, B, C, Franz, Square1,3, …

– stand for unique objects ( in a specific context)

2. predicate symbols Adjacent-To, Younger-Than, ...

– describes relations between objects

3. function symbolsFather-Of, Square-Position, …

– the given object is related to exactly one other object

Page 18: Artificial intelligence propositional logic

Semanticsrelates sentences to models

– in order to determine their truth values

provided by interpretations for the basic constructs– usually suggested by meaningful names (intended interpretations)

constants– the interpretation identifies the object in the real world

predicate symbols– the interpretation specifies the particular relation in a model– may be explicitly defined through the set of tuples of objects that

satisfy the relation

function symbols– identifies the object referred to by a tuple of objects– may be defined implicitly through other functions, or explicitly

through tables

Page 19: Artificial intelligence propositional logic

Syntax and SemanticPredicate Symbol

It is a particular relation in the model between pair of objects Predicate(Term,,,,,)

< (1,2) > (3,4) Brother(mohamed,Mostefa)

Function Symbol

A given object it is related to exactly one other object by the relation Function(Term,,,,,)

FatherOf(Ahmad) Equal(Plus(1,2))

Page 20: Artificial intelligence propositional logic

Syntax and Semantic

Terms

It is an expression that refers to an object Function(Term,,,) | variable | constant

FatherOf( Khalid) x y 2 Riyadh Ahmad

Atomic Sentence

Is formed from a predicate symbol followed by a parenthesized list of terms.

Predicate(Term,,,) or term =term

Older(Youssef, 30) 1 = 1

Page 21: Artificial intelligence propositional logic

Syntax and Semantic

Complex sentences

We can use logical connective to construct more complex sentences

S1 S1 S2 S1 S2 S1 => S2 S1 S2

> (1,2) (1,2)

> (1,2) >(1,2)