Download N - University of Alberta

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Brouwer–Hilbert controversy wikipedia , lookup

List of important publications in mathematics wikipedia , lookup

Large numbers wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Four color theorem wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Fermat's Last Theorem wikipedia , lookup

Addition wikipedia , lookup

Theorem wikipedia , lookup

Collatz conjecture wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Mathematical proof wikipedia , lookup

Elementary mathematics wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
CMPUT 272
Formal Systems
Logic in CS
I. E. Leonard
University of Alberta
http://www.cs.ualberta.ca/~isaac/cmput272/f03
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
1
Chapter 3.1
Chapter 3.2
Chapter 3.3
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
All images are copyrighted to their respective copyright holders and reproduced here for academic purposes under the condition of “fair using”.
Today
2
Announcements
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
3
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
4
Numbers
We will work with numbers for the next little
while
R is the set of all real numbers
0, 1, -5.27, Pi, …
Q is the set of rational numbers
0, 1, -5.27, …
Z is the set of integer numbers
0, 1, -1, 2, …
N is the set of natural numbers
0, 1, 2, …
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
5
Odd / Even
Define predicate even(n):
n is an even integer iff
Exists an integer k such that n=2k
nZ [even(n)  kZ [n=2k]]
Define predicate odd(n):
n is an even integer iff
Exists an integer k such that n=2k+1
nZ [odd(n)  kZ [n=2k+1]]
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
6
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
7
A theorem
“Every integer is even or odd. But not
both”
nZ [(odd(n) v even(n)) & ~(odd(n) & even(n))]
Need some premises:
Integer numbers are closed under +, *
Trichotomy law: any number >0, =0, <0
Well 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
8
Lemma 1
Let’s prove an auxiliary statement
first:
For any r,xR if 0<r,x<1 then rx<r
r,xR [0<r,x<1  rx<r]
Proof:
x<1
r>0  rx<r
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
9
Lemma 2
Let’s prove another auxiliary statement:
There are no integers between 0 and 1
~ ( nN [0<n<1] )
Proof:
Suppose not
Then nN [0<n<1]
Consider set S={n, n2, n3, …}
Every sS is integer and non-negative (i.e., natural)
Therefore min(S)=sm  S
Consider sm*n then: sm*nS and sm*n<sm (by Lemma 1)
Thus, smmin(S)  Contradiction
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
10
Theorem (part 1)
“Every integer is even or odd”
nZ [ odd(n) v even(n) ]
Proof:
Suppose not
Then nZ [~(odd(n) v even(n))]
Then let’s find the minimum m=2k such that n<m
Clearly, 2k-2<n<2k
Subtract 2k from both sides: 0<n-2k+2<2
Then n-2k+2 is : between 0,1 or between 1,2 or 1
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
11
Theorem (part 2)
“No integer is even and odd”
~ nZ [ odd(n) & even(n) ]
Proof:
Suppose not
Then nZ [odd(n) & even(n)]
By the definitions: n=2k and n=2m+1
Thus, 2k=2m+1
Subtract 2m from both sides: 2(k-m)=1
Thus, k-m=½  not an integer
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
12
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
13
Prime / Composite
Define predicate prime(n):
n is a prime number iff
n>1 and
for any its positive integer factors r and s one of
them is 1
nZ [prime(n) 
n>1 & r,sN [n=rs  r=1 v s=1]]
Define predicate composite(n):
n is a composite integer iff
n is not prime and |n| is greater than 1
nZ [composite(n)  |n|>1 & ~prime(n)]
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
14
Existential Statements
x P(x)
Proofs:
Constructive
Construct an example of such x
Non-constructive
By 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
15
Example 1
Prove that
nN a,b prime(a) & prime(b) & (a+b=n)
Proof:
n=210
a=113
b=97
// Piece of cake…
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
16
Example 2
Proof of an existentially quantified
statement by contradiction
A 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
17
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
18
Universal Statements
x P(x)
x [Q(x)  R(x)]
Proof techniques:
Exhaustion
Direct
Generalizing from an arbitrary particular
member
Mathematical induction (chapter 4)
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
19
Example 1
Exhaustion:
Any even number between 4 and 30 can
be written as a sum of two primes:
4=2+2
6=3+3
8=3+5
…
30=11+19
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
20
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
21
Example 2
Theorem: nZ [ even(n*(n+1)) ]
Proof:
Consider a particular but arbitrary chosen
integer n
n is odd or even
Case 1: n is odd
Then n=2k+1, n+1=2k+2
n(n+1) = (2k+1)(2k+2) = 2(2k+1)(k+1) = 2p
for some integer p
So n(n+1) is even
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
22
Example 2 (cont’d)
Case 2: n is even
Then n=2k, n+1=2k+1
n(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
23
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
24
Non-mathematical Induction
Generalizing from a particular but NOT
arbitrarily chosen example
I.e., using some additional properties of n
Example:
“all odd numbers are prime”
“Proof”:
Consider odd number 3
It is prime
Thus 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
25
Prevention
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 proof
Try to play the devil’s advocate and find
holes in it…
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
26
Other Common Mistakes
Pages 120-121 in the book
Using the same letter to mean different
things
Jumping to a conclusion
Insufficient justification
Begging the question
assuming the claim first
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
27
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
28
Rational Numbers
A real number is rational iff it can be
represented as a ratio/quotient/fraction of
integers a and b where b0
rR [rQ  a,bZ [r=a/b & b0]]
Notes:
a is called the numerator
b is called the denominator
Any rational number can be represented in
infinitely many ways
The 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
29
Rational or not?
-12
-12/1
3.1459
3+1459/10000
0.56895689568956895689…
5689/9999
1+1/2+1/4+1/8+…
2
0
0/1
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
30
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
31
Theorem 1
Any number with a periodic fractional
part in a natural radix representation is
rational
Proof:
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
32
Theorem 2
Any geometric series:
S=q0+q1+q2+q3+…
where -1<q<1
evaluates to S=1/(1-q)
Proof
Proof idea (informally)
More formal proof
Definitions of limits and partial sums
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
33
ZQ
Every integer is a rational number
Proof : set the denominator to 1
Book : page 127
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
34
Q is algebraically closed
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
35
Questions?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
36
Irrational Numbers
So far all the examples were of rational
numbers
How about some irrationals?

e
sqrt(2)
How about ln e :
Rational/irrational?
How about ln  :
Rational/irrational?
Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
37
Questions

Sept 25, 2003
© Vadim Bulitko : CMPUT 272, Fall 2003, UofA
38