Formal Methods - Lecture03
-
Upload
naeemkashif -
Category
Documents
-
view
5 -
download
0
description
Transcript of Formal Methods - Lecture03
-
Lecture No. 3
Equality and Definite Description
Dr. Nazir A. Zafar Formal Methods
-
Now we extend our language by adding a theory of equality between expressions.
Predicate calculus with equality is more expressive, because of asserting identity of two objects, or distinguishing between them.
The expressions which are equal may be substituted one for the other, without affecting the
Introduction
substituted one for the other, without affecting the truth of a statement.
This forms basis of our theory of equality. Properties such as symmetry and transitivity can
be derived from them.
Dr. Nazir A. Zafar Formal Methods
-
Addition of equality allows us to formulate a simple rule for reasoning with quantifications:
the one-point rule. We show how this rule may be used to
introduce existential quantifier and eliminate the existential quantifier.
We also show how equality may be used in
Introduction
We also show how equality may be used in statements expressing uniqueness and numerical quantity.
We will conclude lecture by introducing notations for identifying objects by using a description of their properties, rather than referring by name.
Dr. Nazir A. Zafar Formal Methods
-
The notion of equality is a familiar one: We learn that 1+1 equals 2
In the Christian religion, 25th Dec. equals Christmas Day.
It shows that the two expressions concerned have same value, or denote the same object.
Equality
In a formal description, we identify expressions using the equality symbol: e.g. 1+1 = 2 and 25th Dec. = Christmas Day.
Consequently, e = f, means e is identical to f and we cannot distinguish between them
Dr. Nazir A. Zafar Formal Methods
-
Example 4.1:
In an identity parade, a witness may state that the man on the right is the man who stole my idea, is equivalent to:
man on the right = man who stole my idea
Equality
Reflection:
Everything is identical to itself: thus, if t is any expression, then t is equal to t .
This principle is known as the law of reflection:
Note: This principle is an axiom of standard Z
Dr. Nazir A. Zafar Formal Methods
-
Leibnizs law: Another axiom involving equality is Leibnizs law, or the substitution of equals i.e.if s = t , then whatever is true of s is true of t .
Example 4.3:
Equality
Example 4.3: If s = t then p [t / x] = p [s / x] (by substitution)
Dr. Nazir A. Zafar Formal Methods
-
Example 4.3
If we know that
1. Christmas Day = 25th December, and
2. 25th December falls on a Sunday this year
Then we may apply the Leibniz's law rule and conclude that
Equality
conclude that
Christmas Day falls on a Sunday this year
Note:
If two expressions e and f are not identical, then we write e f .
This is simply an abbreviation for : (e = f)
Dr. Nazir A. Zafar Formal Methods
-
If the identity of bound variable is revealed within the quantified expression, then we may replace all instances of that variable, and remove the existential quantifier.
x : a p x = t If t is in a, and p holds with t substituted for x, then
The One Point Rule
If t is in a, and p holds with t substituted for x, then t is a good candidate for this value.
This is the basis of the one-point rule
( x : a p x = t) t a p [t / x]
Dr. Nazir A. Zafar Formal Methods
-
The predicate , n : N 4 + n = 6 n = 2is equivalent to 2 N 4 + 2 = 6 and n does not appear free in expression 2,
Hence the proposition 2 N 4 + 2 = 6 is true
Example: One Point Rule
The predicate , n : N 6 + n = 4 n = -2 is equivalent -2 N 6 + (-2) = 4and n does not appear free in expression -2,
Hence proposition -2 N 6 - 2 = 4 is false.
Dr. Nazir A. Zafar Formal Methods
-
Example:
The predicate
n : N ( m : N n m ) n = n +1can not be simplified using one point rule.
This is because n is free in the expression n + 1
The One Point Rule
This is because n is free in the expression n + 1
Dr. Nazir A. Zafar Formal Methods
-
Example 4.8
Symbolize only Romeo likes Juliet using a conjunction
Symbolization:
1. Let L(x, y) means x likes y, and
Uniqueness and Equality (use of Only)
1. Let L(x, y) means x likes y, and
2. let Person be the set of all people then
L(Romeo, Juliet) p : Person L(p, Juliet) p = Romeo
That is, any person likes Juliet must be Romeo
Dr. Nazir A. Zafar Formal Methods
-
Example 4.9:
Formalize he statement:
there is at most one person to whom Romeo likes
Formalization:
Uniqueness and Equality (use of At most)
1. Let L(x, y) mean that x likes y, and
2. let Person be the set of all people then
p, q : Person L(Romeo, p) L(Romeo, q) p = q
Dr. Nazir A. Zafar Formal Methods
-
Example 4.10:
Formalize the statement:
no more than two visitors are permitted
Formalization:
let Visitors be the set of all visitors then
Use of at most and at least
let Visitors be the set of all visitors then
p, q, r : Visitors p = q q = r r = pExample 4.11:
The statement at least two person has appliedcould be formalized as
p, q : Applicants p q
Dr. Nazir A. Zafar Formal Methods
-
Example 4.12:Formalize the statement:there is exactly one book on my desk.
Formalization:1. let Book be the set of all books
Uniqueness and Equality (use of Exactness)
1. let Book be the set of all books2. Desk(x) means that x is on my desk, then
b : Book Desk(b) ( c : Book | Desk(c) c = b) OR
1 b : Book Desk(c)
Dr. Nazir A. Zafar Formal Methods
-
We often use a descriptive phrase to denote anobject, rather than a name.
For example, when a crime is committed, and the police have not yet learned who committed, the question is referred to as
the driver of the white car or
Definite Description
the driver of the white car or
the cat in the hat etc.
Here, the word the is important which indicates existence and uniqueness.
Dr. Nazir A. Zafar Formal Methods
-
Example 4.14 :
Following phrases indicate that there is a unique object with a certain property
The man who shot John Lennon
The woman who discovered radium
Definite Description
The oldest college in Oxford
Notation in Z: ( x : a | p)denotes unique object x from a such that p.
Dr. Nazir A. Zafar Formal Methods
-
Example 4.15 :
The phrases in Example 4.14 can be formalized as above:
1. ( x : Person | Shot(x, John Lennon))
Definite Description
2. ( y : Person | Discovered(x, radium))3. ( z : Colleges | Oldest-College(x , Oxford))
Dr. Nazir A. Zafar Formal Methods