Predicate logic part 1 ch3_w3l8&9

25
Formal Logic Predicate Logic Part 1 By Mr. Sharif Salem 1

description

Just for Test

Transcript of Predicate logic part 1 ch3_w3l8&9

Page 1: Predicate logic part 1 ch3_w3l8&9

Formal LogicPredicate Logic

Part 1

By Mr. Sharif Salem

Page 2: Predicate logic part 1 ch3_w3l8&9

Proposition are not enough

In general Propositional Logic is not enough to describe properties and its related specs.

Page 3: Predicate logic part 1 ch3_w3l8&9

Syntax of Predicate Logic

Page 4: Predicate logic part 1 ch3_w3l8&9

Variables and Statements

Variables

• A variable is a symbol that stands for an individual in a collection or

set. For example, the variable x may stand for one of the days. We

may let x = Monday or x = Tuesday, etc.

• A collection of objects is called the domain of a variable.

– For the above example, the days in the week is the domain of variable x.

Months have 30 days.

– Domain or Set is Months of the year ≔ x

– Individuals or objects are Jan, Feb, …… Dec.

– Property or Predicate is “ has 30 days” ≔ P

– Predicate Formula P(x)

Page 5: Predicate logic part 1 ch3_w3l8&9

Quantifiers and Predicates

Quantifiers:

• Quantifiers are phrases that refer to given quantities.

• Two kinds of quantifiers: Universal and Existential

Universal Quantifier: represented by

• The symbol is translated as and means “for all”, “given any”, “for each,” or “for

every,” and is known as the universal quantifier.

Existential Quantifier: represented by

• The symbol is translated as and means variously “for some,” “there exists,”

“there is a,” or “for at least one”.

Some months has 30 days.

– Predicate Formula (x)P(x)

Page 6: Predicate logic part 1 ch3_w3l8&9

Quantifiers and Predicates

Predicate

• It is the verbal statement that describes the property of a variable.

• Usually represented by the letter P, the notation P(x) is used to

represent some unspecified property or predicate that x may have

– e.g. P(x) = x has 30 days.

– P(April) = April has 30 days.

• The collection of objects that satisfy the property P(x) is called the

domain of interpretation.

• Truth value of expressions formed using quantifiers and predicates

– What is the truth value of (x)P(x)

– x is all the months

– P(x) = x has less than 32 days.

– The above formula is true since no month has 32 days.

Page 7: Predicate logic part 1 ch3_w3l8&9

Truth value of the following expressions

• Truth of expression (x)P(x)1. P(x) is the property that x is yellow, and the domain of

interpretation is the collection of all flowers:

2. P(x) is the property that x is a plant, and the domain of interpretation is the collection of all flowers:

3. P(x) is the property that x is positive, and the domain of interpretation consists of integers:

– Can you find one interpretation in which both (x)P(x) is true and (x)P(x) is false?

– Can you find one interpretation in which both (x)P(x) is true and (x)P(x) is false?

not true

not true

true

Case 1 as mentioned above

Not possible

Page 8: Predicate logic part 1 ch3_w3l8&9

Unary, Binary, Ternary, … N-ary Predicate

• A predicate Formula for a single variable is known as unary predicate All days has 24 hours ≔ (x)P(x)

• A predicate Formula for two variables is known as Binary predicate For every University there exists a talent students .

≔ (x) (y) Q(x,y)

• A predicate Formula for N variables is known as N-ary predicate.

Page 9: Predicate logic part 1 ch3_w3l8&9

Interpretation

• Formal definition: An interpretation for an expression

involving predicates consists of the following:

1. A collection of objects, called the domain of

interpretation, which must include at least one object.

2. An assignment of a property of the objects in the

domain to each predicate in the expression.

3. An assignment of a particular object in the domain to

each constant symbol in the expression.

Page 10: Predicate logic part 1 ch3_w3l8&9

WFF

• Predicate wffs can be built similar to propositional

wffs using logical connectives with predicates and

quantifiers.

• Examples of predicate wffs

– (x)[P(x) Q(x)]

– (x) ((y)[P(x,y) V Q(x,y)] R(x))

– S(x,y) Λ R(x,y)

Page 11: Predicate logic part 1 ch3_w3l8&9

Translation: Verbal statements to symbolic form

• “Every person is nice”

can be rephrased as

“For any thing, if it is a person, then it is nice.”

P(x) ≔ “x is a person”

Q(x) ≔ “x is nice” the statement can be

symbolized as

For any thing, if it is a person, then it is nice

(x) [ P(x) Q(x) ]

– “All persons are nice” or “Each person is nice” will also have

the same symbolic formula.

– always related with (implication)

Page 12: Predicate logic part 1 ch3_w3l8&9

Translation: Verbal statements to symbolic form

• “There is a nice person”

can be rewritten as

“There exists something that is both a person and nice.”

In symbolic form,

(x)[P(x) Λ Q(x)].

– Variations: “Some persons are nice” or “There are nice

persons.”

– always related with Λ (conjunction)

• What would the following form mean for the example above?

(x)[P(x) Q(x)] ???????

Page 13: Predicate logic part 1 ch3_w3l8&9

Translation

• Example for forming symbolic forms from predicate symbols

– All dogs chase all rabbits ≔

For anything, if it is a dog, Then for any other thing, if it is a

rabbit, then the dog chases it ≔

(x)[ D(x) (y)( R(y) C(x,y) ) ]

D(x) “≔ x is a dog”R(y) “≔ y is a rabbit”C(x,y) “≔ x chases y”

Page 14: Predicate logic part 1 ch3_w3l8&9

Translation

– Some dogs chase all rabbits ≔

There is something that is a dog and for any other thing, if that thing is a rabbit, then

the dog chases it ≔

(x)[D(x) Λ (y)(R(y) C(x,y) ) ]

– Only dogs chase rabbits ≔

For any things, If it chase rabbits, then it is a dog.

≔ For any things and for any other things if the other things is rabbits and chases by

the first thing, then that first thing is a dog

≔ For any two things, if one is a rabbit and the other chases it, then the other is a dog

≔ (y) (x)[R(y) Λ C(x,y) D(x)]

D(x) “≔ x is a dog”R(y) “≔ y is a rabbit”C(x,y) “≔ x chases y”

Page 15: Predicate logic part 1 ch3_w3l8&9

Negation of statements

• Everything is fun ≔ (x)A(x)

– Negation will be “it is false that everything is fun,” ≔ [(x)A(x)]

– i.e. “something is non-fun.” ≔ (x)[A(x)]

– In symbolic form, [(x)A(x)] ↔ (x)[A(x)]

• Similarly negation of “Something is fun” ≔ (x)A(x)

– Negation will be “it is false that Something is fun,”

“Nothing is fun” ≔ [(x)A(x)]

– i.e. “Everything is boring.” ≔ (x)[A(x)]

– Hence, [(x)A(x)] ↔ (x)[A(x)]

Page 16: Predicate logic part 1 ch3_w3l8&9

Negation of statements

What is the negation of the following statements?

• Some pictures are old and faded.

• All people are tall and thin.

Every picture is neither old nor faded.

Someone is short or fat.

Page 17: Predicate logic part 1 ch3_w3l8&9

Class exercise

• Write wffs that express the following statements:

– All players are good.

– Some good players, score goals.

For anything, if it is a player, then it is good ≔ (x)[S(x) I (x)]

There is something that is good and it is a player and it score goals

≔ (x)[I(x) Λ S(x) Λ M(x)]

S(x) ≔ x is a player I(x) ≔ x is good M(x) ≔ x scores goals

Page 18: Predicate logic part 1 ch3_w3l8&9

Class exercise

– Everyone who scores goals is a bad player.

– Only good player, scores goals.

For anything, if that thing scores goals, then it is a player and it is not good

≔ (x)[ M(x) S(x) Λ (I (x)) ]

For any thing, if it scores goals , then it is a player and it is good

≔ (x)(M(x) S(x) Λ I(x))

S(x) ≔ x is a player I(x) ≔ x is good M(x) ≔ x scores goals

Page 19: Predicate logic part 1 ch3_w3l8&9

Validity

• Similar to a tautology of propositional logic.

• Truth of a predicate wff depends on the interpretation.

• A predicate wff is valid if it is true in all possible interpretations just like a propositional

wff is true if it is true for all rows of the truth table.

• A valid predicate wff is intrinsically true

• Free Variable (x)[P(x,y) (y) Q(x,y)]

variable y is not defined for P(x,y) hence y is called a free variable. Such expressions

might not have a truth value at all.

Propositional Wffs Predicate Wffs

Truth values True or false – depends on the truth value of statement letters

True, false or neither (if the wff has a free variable)

Intrinsic truth

Tautology – true for all truth values of its statements

Valid wff – true for all interpretations

Methodology(Validity Porve)

Truth Table/Proof sequence using rules

Proof sequence using rules/others

Page 20: Predicate logic part 1 ch3_w3l8&9

Bound and Free variable

Page 21: Predicate logic part 1 ch3_w3l8&9

Validity examples

• (x)P(x) (x)P(x)– This is valid because if every object of the domain has a certain property,

then there exists an object of the domain that has the same property.

• (x)P(x) P(a)– Valid – quite obvious since “a” is a member (object) of the domain of x.

• (x)P(x) (x)P(x)– Not valid since the property cannot be valid for all objects in the domain

if it is valid for some objects of than domain. Can use a mathematical

context to check as well.

– Say P(x) = “x is even,” then there exists an integer that is even but not

every integer is even.

Page 22: Predicate logic part 1 ch3_w3l8&9

Validity examples

• (x)[P(x) V Q(x)] (x)P(x) V (x)Q(x) – Invalid, can prove by mathematical context by taking P(x) = x is even and

Q(x) = x is odd.

– In that case, the hypothesis is true but not the conclusion is false because it

is not the case that every integer is even or that every integer is odd.

Page 23: Predicate logic part 1 ch3_w3l8&9

Class Exercise

• What is the truth of the following wffs where the domain consists of

integers:

• (x)[L(x) O(x)] where O(x) is “x is odd” and L(x) is “x < 10”?

• Using predicate symbols and appropriate quantifiers, write the symbolic

form of the following English statement:

– D(x) is “x is a day” M is “Monday” T is “Tuesday”

– S(x) is “x is sunny” R(x) is “x is rainy”

• Some days are sunny and rainy.

• It is always a sunny day only if it is a rainy day.

• It rained both Monday and Tuesday.

• Every day that is rainy is not sunny.

Page 24: Predicate logic part 1 ch3_w3l8&9

Conclusion

• Propositional Logic is not enough to describe properties and its related specs.

• Predicate Logic Syntax are variables, quantifiers, predicate and connectives.

• A collection of objects is called the domain of a variable.

• Two kinds of quantifiers: Universal and Existential.

• The collection of objects that satisfy the property P(x) is called the domain of

interpretation.

• always related with (implication)

• always related with Λ (conjunction)

• Negation of statements represented by the formula

• [(x)A(x)] ↔ (x)[A(x)]

• [(x)A(x)] ↔ (x)[A(x)]

• Bound variable is the variable within the scope of the quantifier. Free variable is

the one out of the scope.

• A predicate wff is valid if it is true in all possible interpretations

Page 25: Predicate logic part 1 ch3_w3l8&9

End of Lecture