Upload
christiana-harrell
View
218
Download
1
Tags:
Embed Size (px)
Citation preview
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 1
CMPUT 272CMPUT 272Formal Systems Logic in Formal Systems Logic in
CSCS
CMPUT 272CMPUT 272Formal Systems Logic in Formal Systems Logic in
CSCS
I. E. LeonardUniversity of Alberta
http://www.cs.ualberta.ca/~isaac/cmput272/f03
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 2
TodayTodayTodayToday
Chapter 3.1
Chapter 3.2
Chapter 3.3
All
imag
es
are
cop
yri
gh
ted
to t
heir
resp
ect
ive c
op
yri
gh
t h
old
ers
an
d r
ep
rod
uce
d h
ere
for
aca
dem
ic p
urp
ose
s u
nd
er
the c
on
dit
ion
of
“fair
usi
ng
”.
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 3
AnnouncementsAnnouncementsAnnouncementsAnnouncements
The class notes for Thursday’s lecture
on Properties of the Integers are on
my webpage
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 4
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 5
NumbersNumbersNumbersNumbers
We will work with numbers for the next little whileR is the set of all real numbers
0, 1, -5.27, Pi, …
Q is the set of rational numbers0, 1, -5.27, …
Z is the set of integer numbers0, 1, -1, 2, …
N is the set of natural numbers0, 1, 2, …
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 6
Odd / EvenOdd / EvenOdd / EvenOdd / Even
Define predicate even(n):n is an even integer iffExists an integer k such that n=2knZ [even(n) kZ [n=2k]]
Define predicate odd(n):n is an even integer iffExists an integer k such that n=2k+1nZ [odd(n) kZ [n=2k+1]]
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 7
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 8
A theoremA theoremA theoremA theorem
“Every integer is even or odd. But not both”
nZ [(odd(n) v even(n)) & ~(odd(n) & even(n))]
Need some premises:Integer numbers are closed under +, *Trichotomy law: any number >0, =0, <0Well ordering principle: Every non-empty set of naturals contains its smallest element
Proof – recall how we introduced integers
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 9
Lemma 1Lemma 1Lemma 1Lemma 1
Let’s prove an auxiliary statement first:
For any r,xR if 0<r,x<1 then rx<rr,xR [0<r,x<1 rx<r]
Proof:x<1r>0 rx<r
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 10
Lemma 2Lemma 2Lemma 2Lemma 2
Let’s prove another auxiliary statement:There are no integers between 0 and 1~ ( nN [0<n<1] )
Proof:Suppose notThen nN [0<n<1]Consider set S={n, n2, n3, …}Every sS is integer and non-negative (i.e., natural)Therefore min(S)=sm S
Consider sm*n then: sm*nS and sm*n<sm (by Lemma 1)Thus, smmin(S) Contradiction
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 11
Theorem (part 1)Theorem (part 1)Theorem (part 1)Theorem (part 1)
“Every integer is even or odd”nZ [ odd(n) v even(n) ]
Proof:Suppose not
Then nZ [~(odd(n) v even(n))]
Then let’s find the minimum m=2k such that n<mClearly, 2k-2<n<2kSubtract 2k from both sides: 0<n-2k+2<2Then n-2k+2 is : between 0,1 or between 1,2 or 1
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 12
Theorem (part 2)Theorem (part 2)Theorem (part 2)Theorem (part 2)
“No integer is even and odd”~ nZ [ odd(n) & even(n) ]
Proof:Suppose not
Then nZ [odd(n) & even(n)]
By the definitions: n=2k and n=2m+1Thus, 2k=2m+1Subtract 2m from both sides: 2(k-m)=1Thus, k-m=½ not an integer
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 13
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 14
Prime / CompositePrime / CompositePrime / CompositePrime / Composite
Define predicate prime(n):n is a prime number iffn>1 and for any its positive integer factors r and s one of them is 1nZ [prime(n) n>1 & r,sN [n=rs r=1 v s=1]]
Define predicate composite(n):n is a composite integer iffn is not prime and |n| is greater than 1nZ [composite(n) |n|>1 & ~prime(n)]
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 15
Existential StatementsExistential StatementsExistential StatementsExistential Statements
x P(x)Proofs:
ConstructiveConstruct an example of such x
Non-constructiveBy contradiction
Show that if such x does NOT exist than a contradiction can be derived
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 16
Example 1Example 1Example 1Example 1
Prove that nN a,b prime(a) & prime(b) & (a+b=n)
Proof:n=210a=113b=97
// Piece of cake…
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 17
Example 2Example 2Example 2Example 2Proof of an existentially quantified statement by contradictionA challenge:
Devise an original concrete statement:x P(x)
Prove it by showing that if x ~P(x)then a contradiction (i.e., P & ~P) can be derived for some statement P (e.g., P=“0<1”)Your statement x P(x) should be difficult (not obvious) to prove constructively
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 18
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 19
Universal StatementsUniversal StatementsUniversal StatementsUniversal Statements
x P(x)x [Q(x) R(x)]
Proof techniques:ExhaustionDirect
Generalizing from an arbitrary particular member
Mathematical induction (chapter 4)
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 20
Example 1Example 1Example 1Example 1
Exhaustion:Any even number between 4 and 30 can be written as a sum of two primes:
4=2+26=3+38=3+5…30=11+19
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 21
Problems?Problems?Problems?Problems?
Works for finite domains only
What if I want to prove that for any integer n the product of n and n+1 is even?
Can I exhaust all integer values of n?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 22
Example 2Example 2Example 2Example 2
Theorem: nZ [ even(n*(n+1)) ]Proof:
Consider a particular but arbitrary chosen integer n n is odd or evenCase 1: n is odd
Then n=2k+1, n+1=2k+2n(n+1) = (2k+1)(2k+2) = 2(2k+1)(k+1) = 2p for some integer pSo n(n+1) is even
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 23
Example 2 (cont’d)Example 2 (cont’d)Example 2 (cont’d)Example 2 (cont’d)
Case 2: n is evenThen n=2k, n+1=2k+1n(n+1) = 2k(2k+2) = 2p
for some integer p
So n(n+1) is even
Done!
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 24
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 25
Non-mathematical Non-mathematical InductionInduction
Non-mathematical Non-mathematical InductionInduction
Generalizing from a particular but NOT arbitrarily chosen exampleI.e., using some additional properties of nExample:
“all odd numbers are prime”“Proof”:
Consider odd number 3It is primeThus for any odd n prime(n) holds
Such “proofs” can be given for correct statements as well!
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 26
PreventionPreventionPreventionPrevention
Try to stay away from specific instances (e.g., 3)
Make sure that you are not using any additional properties of n considered
Challenge your proofTry to play the devil’s advocate and find holes in it…
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 27
Other Common Other Common MistakesMistakes
Other Common Other Common MistakesMistakes
Pages 120-121 in the book
Using the same letter to mean different things
Jumping to a conclusionInsufficient justification
Begging the questionassuming the claim first
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 28
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 29
Rational NumbersRational NumbersRational NumbersRational Numbers
A real number is rational iff it can be represented as a ratio/quotient/fraction of integers a and b where b0
rR [rQ a,bZ [r=a/b & b0]]
Notes:a is called the numeratorb is called the denominatorAny rational number can be represented in infinitely many waysThe fractional part of any rational number written in any natural radix has a period in it
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 30
Rational or not?Rational or not?Rational or not?Rational or not?
-12-12/1
3.14593+1459/10000
0.56895689568956895689…5689/9999
1+1/2+1/4+1/8+…2
00/1
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 31
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 32
Theorem 1Theorem 1Theorem 1Theorem 1
Any number with a periodic fractional part in a natural radix representation is rationalProof:
Constructive, radix=10, no whole part:x=0.n1…nmn1…nm…
x=0.(n1…nm)
x*10m-x=n1…nm
x=n1…nm/(10m-1)
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 33
Theorem 2Theorem 2Theorem 2Theorem 2
Any geometric series:S=q0+q1+q2+q3+…where -1<q<1evaluates to S=1/(1-q)
ProofProof idea (informally)More formal proofDefinitions of limits and partial sums
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 34
Z Z Q QZ Z Q Q
Every integer is a rational number
Proof : set the denominator to 1Book : page 127
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 35
QQ is algebraically is algebraically closedclosed
QQ is algebraically is algebraically closedclosed
The set of rational numbers is closed with respect to arithmetic operations +, -, *, /
Partial proofs : textbook pages 121-131
Formal proof
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 36
Questions?Questions?Questions?Questions?
Sept 25, 2003 © Vadim Bulitko : CMPUT 272, Fall 2003, UofA 37
Irrational NumbersIrrational NumbersIrrational NumbersIrrational Numbers
So far all the examples were of rational numbersHow about some irrationals?
esqrt(2)
How about ln e :Rational/irrational?
How about ln :Rational/irrational?