Predicate Logic
Upcoming SlideShare
Loading in...5
×
 

Predicate Logic

on

  • 33,053 views

Predicate Logic is the Bases of all the Logic used in Formal Methods in Software Engineering

Predicate Logic is the Bases of all the Logic used in Formal Methods in Software Engineering

Statistics

Views

Total Views
33,053
Views on SlideShare
32,949
Embed Views
104

Actions

Likes
7
Downloads
639
Comments
2

5 Embeds 104

http://www.slideshare.net 98
http://search.mywebsearch.com 2
http://mmbs.wordpress.com 2
http://www.downloader9.com 1
http://bb-app.csufresno.edu 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Predicate Logic Predicate Logic Presentation Transcript

    • Logic & Formal Methods Predicate Logic Instructor: Dr H. Farooq Ahmad Sarmad Sadik TA: Muhammad Afzal, Maqbool Reference: Discrete Mathematics with Examples by Simpson
    • Topics
      • Universal quantification
      • Existential quantification
      • Satisfaction and validity
      • The negation of quantifiers
      • Free and bound variables
      • Substitution
      • Restriction
      • Uniqueness
      • Equational reasoning
      • Natural deduction
      • One point rule
      Page
    • Pros and cons of propositional logic
      • Propositional logic is declarative
      • Propositional logic allows conjunction, disjunction, negated information
      • Propositional logic is compositional :
        • meaning of B 1,1  P 1,2 is derived from meaning of B 1,1 and of P 1,2
      • Meaning in propositional logic is context-independent (unlike natural language, where meaning depends on context)
      • Propositional logic has very limited expressive power (unlike natural language)
    • First-order logic
      • Whereas propositional logic assumes the world contains facts ,
      • first-order logic (like natural language) assumes the world contains
        • Objects: people, houses, numbers, colors, baseball games, wars, …
        • Relations & functions: red, round, prime, brother of, bigger than, part of, comes between, father of, best friend, one more than, plus, …
    • Syntax of FOL: Basic elements
      • Constants KingJohn, 2, NUS,...
      • Functions Sqrt, LeftLegOf,...
      • Variables x, y, a, b,...
      • Connectives  ,  ,  ,  , 
      • Equality =
      • Quantifiers  , 
    • Predicates
      • A predicate is a proposition whose truth depends on the value of one or more variables.
      • For example, “n is a perfect square” is a predicate whose truth depends on the value of n.
      • A function like notation is used to denote a predicate supplied with specific variable values. P(n)=“n is a perfect square”
      • P(4) is true and P(5) is false.
      Page
    • Universal Quantification
      • Universal Quantification denoted as
      • Universal Quantification allows us to capture statements of the form “for all” or “for every”.
      • For example, “every natural number is greater than or equal to zero” can be written formally as
      Page
    • Universal Quantification
      • A quantified statement consists of three parts: the quantifier, the quantification, which describes the variables and the type of variable with which the statement is concerned and the predicate which is normally some statement about the quantified variables.
      • Every predicate logic statement can be considered as follows
      Page
    • Universal Quantification Page
    • Exercise
      • Everybody likes Jaffa cakes
      • All vegetarians don’t like Jaffa cakes
      • Everybody either likes Jaffa cakes or is a vegetarian
      • Either every body likes Jaffa cakes or everybody is a vegetarian
      Page
    • Solution Page
    • Universal Quantification
      • Law 1
      • Example
      Page
    • Universal Quantification
      • Law 2
      • Example
      Page
    • Existential quantification
      • Existential quantifier denoted by
      • As universal quantification is used to assert that a certain property holds of every element of a set, existential quantification is used to assert that such a property holds of some (or at least) elements of a set
      • “ Some natural numbers are divisible by 3” may be written as
      Page
    • Exercise
      • Some people like Jaffa cakes
      • Some vegetarians don’t like Jaffa cakes
      • Some people either like Jaffa cakes or are vegetarian
      • Either some people like Jaffa cakes or some people are vegetarian
      Page
    • Solution Page
    • Existential quantification
      • Law 3
      • Example
      Page
    • Existential quantification
      • Law 4
      • Example
      Page
    • Satisfaction and validity
      • The predicate n>3 can be considered neither true nor false unless we know the value associated with n
      • A predicate p is valid if and only if it is true for all possible values of the appropriate type. That is, if a predicate p is associated with a variable x of type X, then p is valid if, and only if,
      • Example
      Page
    • Satisfaction and validity
      • A predicate p is satisfiable if and only if it is true for some values of the appropriate type. That is, if a predicate p is associated with a variable x of type X, then p is satisfiable if, and only if ,
      • Example
      Page
    • Satisfaction and validity
      • A predicate p is unsatisfiable if, and only if, it is false for all possible values of the appropriate type.
      • If a predicate p is associated with a variable x of type X, then p is unsatisfiable if, and only if,
      Page
    • Satisfaction and validity
      • The analogies between valid, satisfiable and unsatisfiable predicates, and tautologies, contingencies and contradictions:
      • valid predicates and tautologies are always true
      • satisfiable predicates and contingencies are sometimes true and sometimes false
      • unsatisfiable predicates and contradictions are never true
      Page
    • The negation of quantifiers
      • The statement “some body like Brian” may be expressed via predicate logic as
      • To negate this expression, we may write as,
      • which in natural language may be expressed as “nobody likes Brian”
      Page
    • The negation of quantifiers
      • Logically saying “nobody likes Brian” is equivalent to saying “everybody does not like Brian”.
      • The negation of quantifiers behaves exactly in this fashion, just as in natural language, “nobody likes Brian” and “everybody does not like Brian” are equivalent so in predicate logic
      • And
      • are equivalent.
      Page
    • The negation of quantifiers
      • Law 5
      • When negation is applied to a quantified expression it flips quantifiers as it moves inwards(i.e negation turns all universal quantifiers to existential quantifiers and vice versa, and negates all predicates)
      Page
    • The negation of quantifiers
      • Consider the statement,
      • The effect of negation of this expression can be determined as,
      Page
    • Exercise
      • Everyone likes everyone
      • Everyone likes someone
      • Someone likes everyone
      • Someone likes someone
      Page
    • Free and bound variables
      • Consider two predicates
      • n>5…..Eq. 1
      • In equation 2, the variable n is bound, it is existentially quantified variable.
      • In equation 1, n is free as its value may not be determined or restricted
      Page
    • Free and bound variables
      • Example
      • In this statement, y and x are two variables. y is universally quantified and it is bound, while x is free variable.
      • In statement,
      • The occurrence of x in the declaration is binding, any occurrences of x in p are bound, and any occurrences of any variables other than x are free
      Page
    • Free and bound variables
      • Example
      • Exercise, Determine the scope of the universal and existential quantifiers of the following predicate,
      • The distinction between predicates and propositions can be stated as predicates are logical statements which can contain free variables while propositions are logical statements which contain no such holes
      Page
    • Substitution
      • Consider statement,
      • we may replace the name n with any term t, provided that t is of the same type as n. This process is called substitution: the expression p[t/n] denotes the fact that the term t is being substituted for the variable name n in the predicate p.
      • Example, we may denote the substitution of 3 for n in the predicate n>5 by
      Page
    • Substitution
      • Also, we may denote the substitution of 3+4 for n in n>5 by
      • n>5[3+4/n]
      • Substitution is only for free variables
      Page
    • Substitution
      • More than one substitution in case of more than one free variable
      • Consider predicate,
      • Here x and y are both free variables. We may substitute nigel for x as follows,
      • Now substituting ken for y,
      Page
    • Substitution
      • Similarly, in one step, overall substitution may be denoted as,
      • These two substitutions take place sequentially, first nigel is substituted for x, then ken is substituted for y. However, for simultaneous substitutions,
      Page
    • Substitution
      • To illustrate the difference between sequential and simultaneous substitution, consider the example,
      • In former there is only one occurrence of y and in latter there are two occurrences of y
      Page
    • Restriction
      • Filters role in predicate logic
      • Considering an example, all natural numbers which are prime numbers and are greater than 2 are odd, may be written as,
      • Using a filter, statement may be written as,
      • Form of restricted predicates as,
      Page
    • Restriction
      • Restriction can also be used in existential quantification, “there has been a female British Prime Minister”, may be written as
      Page
    • Restriction
      • Law 6
      • Law 7
      Page
    • Exercise
      • Represent the following statement in the form,
      • Everyone who likes cheese likes spam
      • There is a person who likes cheese that likes spam
      • Everyone who likes cheese also likes spam and likes bananas
      Page
    • Solution Page
    • Uniqueness
      • Existential quantifier, allows us to represent statements such as “there is at least one x, such that…”.
      • In order to be more specific, consider, “there is exactly one x, such that…”
      • Consider an example statement,
      • it is the case that the predicate x+1=1 is true for exactly one natural number:0
      Page
      • The operator which allow us to state that “ there is exactly one natural number, x, is denoted as
      • As an example,
      Uniqueness Page
    • Uniqueness
      • Assuming the statement
      • It is sometimes useful to pinpoint exactly which element of X for which predicate p holds. Also, it is convenient to perform some operation on this value.
      • The µ operator allows us to do exactly this, the statement ( µ x:X | p) is read as “ the unique x from set X such that p holds of x ”
      • Example, ( µ x:N | x+1=1) where µ is associated with value 0
      Page
    • Uniqueness
      • When a unique element of the relevant type does possess the relevant property, then we are free to construct statements as given previously
      • On the other hand, µ expressions that are not associated with a unique element generate an undefined value.
      • As an example, the µ expressions
      • ( µ n:N | n is even)
      • and
      • ( µ c:Country | population (c) > 10,000,000)
      • are both undefined
      Page
    • Uniqueness
      • We can incorporate terms into set comprehensions, so we can apply terms in µ expressions. Expressions of the form,
      • return the result of applying the term t to the unique element of the set X which satisfies the predicate p
      • gives the value Washington
      Page
    • Uniqueness
      • If there is no unique element which possesses the relevant property, then the result is undefined
      • and
      • are both undefined.
      Page
    • Exercise
      • Write the following in terms of µ expressions
        • The tallest mountain in the world
        • The height of the tallest mountain
        • The oldest person in the world
        • The nationality of the oldest person in the world
        • The smallest natural number
      Page
    • Solution Page
    • Equational Reasoning
      • Two methods of reasoning
        • Equational reasoning
        • Natural deduction
      • Also,
      Page
    • Equational Reasoning
      • Law 8
      • If a predicate holds for all elements of a set, then it holds for some of them
      • Law 9
      • If a predicate holds for exactly one element of a set, then it holds for at least one of them
      Page
    • Equational Reasoning
      • Law 10
      • If p holds for all elements of X and t is a term of type X, then p holds for t
      • Example,
      • The predicate
      • holds for all natural numbers. The term 3+4 is of type N and as such,
      • holds.
      Page
    • Equational Reasoning
      • Law 11
      • This law states that if t is a term of type X and p holds of t, then we can conclude that p holds for some elements of X
      • Example
      • The proposition 7 ε N is true and furthermore 7 is prime. As such,
      Page
    • Equational Reasoning
      • The quantification of any variables with regards to propositions which are always true or always has absolutely no effect. This notion is captured by following laws,
      • Law 12
      • Law 13
      • Law 14
      • Law 15
      Page
    • Equational Reasoning
      • The predicate is concerned with three variables: x, y and z.
      • x is bound and y and z are free. As x does not appear in the predicate y=z, we are free to assume that the existential quantification of x has no effect on the truth or falsity of that predicate.
      • We conclude that following equivalence holds.
      Page
    • Equational Reasoning
      • Law 16
      • It states that as x does not appear free in q, the following holds
      • Example,
      Page
    • Equational Reasoning
      • Law 17
      • It states that as x does not appear free in q, the following holds,
      • Example
      Page
    • Equational Reasoning
      • Law 18
      • It states as x does not appear free in q, the following holds
      • Example
      Page
    • Equational Reasoning
      • Law 19
      • It states as x does not appear free in q, the following holds
      • Example
      Page
    • Equational Reasoning
      • Example: A theorem in predicate logic
      • Proof:
      Page
    • Equational Reasoning
      • Example Theorem
      Page
    • Exercise Page
    • Solution Page
    • Natural deduction
      • Natural deduction can also be extended to predicate logic
      • Natural deduction rules for universal quantification
      • Rule1 states that if p holds for all values of X, then provided that t is of type X- p holds for t
      Page
    • Natural deduction
      • Example:
      • All natural numbers which are prime and greater than 2 are odd. 7 is prime and greater than 2 and we may conclude that it is odd.
      Page
    • Natural deduction
      • Rules for existential quantification
      • If x ε X such that p holds for x, then if we are able to define further predicate, q in which x does not appear free, then we may conclude q
      Page
    • Natural deduction
      • Intro rule
      • If p is true for any term t of set X, then we conclude that, holds
      Page
    • Natural deduction
      • Example
      Page
    • The one-point rule
      • It states that p is a person that likes Emily, but also that the name of person is Rick
      • We can conclude that rick ε Person and rick likes emily are both true
      • Law 20
      Page
    • The one-point rule
      • Example
      Page
    • References
      • Discrete Mathematics with Examples by Simpson
      Page
    • Thank you! Page