FMSE Lect 07
FMSE Lect 07
Figure 2.2
4. SUBSTIUTION CONTD..
4. SUBSTIUTION CONTD..
• substitutions can give rise to undesired side effects.
• In performing a substitution φ[t/x], the term t may contain a variable y,
where free occurrences of x in φ are under the scope of ∃y or ∀y in φ.
• By carrying out this substitution φ[t/x], the value y, which might have been
fixed by a concrete context, gets caught in the scope of ∃y or ∀y.
• This binding capture overrides the context specification of the concrete
value of y, for it will now stand for ‘some unspecified’ or ‘all ,’ respectively.
• Such undesired variable captures are to be avoided at all costs
Definition 2.8 substitution contd..
• Given a term t, a variable x and a formula φ, we say that t is free for x
in φ if no free x leaf in φ occurs in the scope of ∀y or ∃y for any
variable y occurring in t.
• For example
• Given the parse tree of φ and the parse tree of t, we can perform the
substitution [t/x] on φ to obtain the formula φ[t/x].
• The latter has a parse tree where all free x leaves of the parse tree of φ are
replaced by the parse tree of t.
• What ‘t is free for x in φ’ means is that the variable leaves of the parse tree of
t won’t become bound if placed into the bigger parse tree of φ[t/x].
4. SUBSTIUTION CONTD..
• For example, if we consider x, t and φ in Figure 2.3, then t is free for x
in φ since the new leaf variables x and y of t are not under the scope
of any quantifiers involving x or y.
(∀x (P(x) ∧ Q(x))) → (¬P(x) ∨ Q(y))
Figure 2.2
• Example
• Consider the φ with parse tree in Figure 2.4
• and let t be f(y, y).
• All two occurrences of x in φ are free.
• The leftmost occurrence of x could be substituted since it is not in the
scope of any quantifier, but substituting the rightmost x leaf
introduces a new variable y in t which becomes bound by ∀y.
Therefore, f(y, y) is not free for x in φ
Figure 2.4
Mixing Quantifiers
• “Every even integer greater than 2 is the sum of two primes.”
• For every even integer n greater than 2, there exist primes p and q such that n
= p + q.
• Let Evens be the set of even integers greater than 2, and let Primes be the set
of primes.
• ∀n ∈ Evens ∃p ∈ Primes ∃q ∈ Primes. n = p + q.
Evens={4,6,8,10,12…..}
Primes={2,3,5,7,11,13,17,19}
N=4, 2+2 true,
6=3+3,true
Order of Quantifiers contd..
There is some number n which is greater than any number m
n= {0,1,2,3…..}, m={0,1,2,3…..}
n=10,
m<n
0<10 true
1<10 true
2<10 true
;;;;;;;;;
10<10 false
Scope of quantifiers
0<6hypothesis true
0<-1 conclusion false
• w=-1 Implication is false
Ɐ
n.(n n={0,1,2,3….}, serve=10, next 25
n=0, 10+1<4+ 0 true
n=1, 11<4+1V 1<25 true
n=5 11<4+25 V 5<25
N=25 11<4+625 V25<25
Ɐn.(n
Mathematical Data Types
Sets
• Set is a bunch of objects, which are called the elements.
• Order of elements is not significant.
• For example, here are some sets:
• A = {Alex, Tippy, Shells, Shadow} dead pets
• B = {red, blue, yellow} primary colors
• C = {{a,b} , {a,c} , {b,c}} a set of sets
Sets contd..
• The expression e ∈ S asserts that e is an element of set S
• For example
• blue ∈ B
Some popular sets
• Mathematicians have devised special symbols to represent some common sets.
• symbol set elements
• ∅ the empty set none
• Nat (N) nonnegative integers {0, 1, 2, 3,...}
• Nat1 (N1) integers greater than 0 { 1, 2, 3,...}
• Z integers {...,−3,−2,−1, 0, 1, 2, 3,...}
• Q rational numbers 1 , −5 , 16, etc.
2 3
• For example
• Ran(owns)={canon, kodak, hasselblad, minolta, pentax}
Solve
P(Member)={},{fred},{ginger},{harold},{fred,ginger},{fred,harold},{ginger,fred}
{fred,ginger,harold} (2^n)
MemberxMember={fred,ginger},{fred,harold},{ginger,fred}{ginger,Harold},{Harold,fred},
{Harold,ginger},{fred, fred},{ginger,ginger},{Harold,harold} nxn
CARD(MemberxMember)=9
CARD(P(MemberxMember))=2^9
CARD(P(P(MEMBER))=(2^3)
=(2^8)=
Solve contd…
P(Member)={},{fred},{ginger},{harold},{fred,ginger},{fred,harold},{ginger,fred}{fred,ginger,harold}
TO DO list
• Read chapter 2 from the b- method an introduction Steve Schneider
and solve its examples and exercises.
• Read chapter 1 from logic in computer science, related to contents
covered in lecture 4,5, 6 and 7 and solve relevant exercises.
• Quiz 03 will be held in next (8th) lecture.
• Submit individual project proposal on real time systems. Assignments
shall be covered from project.
Any questions?