Download The Art of Effective Reasoning

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
no text concepts found
Transcript
The Art of
Effective
Reasoning
Roland Backhouse
Tallinn, Estonia, 19th November 2002
Quote of Oppenheimer
“The hallmark of a science is
the avoidance of error”
J. Robert Oppenheimer
Logic

for all

there exists
(anno 1966)
Calculational Logic
Equality of propositions ( if and only if )
=
True
False
True
True
False
False
False
True
Calculational Logic
Equality of propositions ( if and only if )
=
True
False
True
True
False
False
False
True
Equality of numbers ( is )
=
0
1
2
3
4
0
True
False
False
False
False
1
False
True
False
False
False
2
False
False
True
False
False
3
False
False
False
True
False
4
False
False
False
False
True
Calculational Logic
For all non-zero y and z
y × z is positive = (y is positive
= z is positive)
Calculational Logic
For all non-zero y and z
y × z is positive = (y is positive
(y × z is positive =
= z is positive)
y is positive) = z is positive
Calculational Logic
For all non-zero y and z
y × z is positive = (y is positive
(y × z is positive =
= z is positive)
y is positive) = z is positive
“The purpose of logic is not to mimic verbal reasoning but to
provide a calculational alternative.”
Edsger W. Dijkstra
Inequalities
(Trichotomy) If a  b then either a < b or b < a
(Translation) If a < b then a+c < b+c
If a < b and c > 0 then ac < bc
Inequalities
(Trichotomy) If a  b then either a < b or b < a
ab

a<b  b<a
(Translation) If a < b then a+c < b+c
If a < b and c > 0 then ac < bc
Inequalities
(Trichotomy) If a  b then either a < b or b < a
ab

a<b  b<a
(Translation) If a < b then a+c < b+c
a<b

a+c < b+c
If a < b and c > 0 then ac < bc
Inequalities
(Trichotomy) If a  b then either a < b or b < a
ab

a<b  b<a
(Translation) If a < b then a+c < b+c
a<b

a+c < b+c
If a < b and c > 0 then ac < bc
For all a,b,c, where ab and c0,
a < b  ac < bc  0 < c
Formal Proof
0.
if a > 0 and b > c > 0 then a + b > a + c > 0
1.
if a > b > 0 then a > b > 0
2.
224 > 9 > 0
3.
224 > 9 > 0
( 1 and 2 )
4.
414 > 3 > 0
( 3 and arithmetic )
5.
57 + 414 > 57 + 3 > 0
( 0 and 4 )
6.
(57 + 414) > (57 + 3) > 0
( 1 and 5 )
7.
1 + 214 > 215 > 0
( 6 and arithmetic )
8.
8 + 1 + 214 > 8 + 215 > 0
( 0 and 7 )
9.
(8 + 1 + 214) > (8 + 215) > 0
( 1 and 8 )
10. 2 + 7 > 3 + 5 > 0
( 9 and arithmetic )
Formal Proof
0.
if a > 0 and b > c > 0 then a + b > a + c > 0
1.
if a > b > 0 then a > b > 0
2.
224 > 9 > 0
3.
224 > 9 > 0
( 1 and 2 )
4.
414 > 3 > 0
( 3 and arithmetic )
5.
57 + 414 > 57 + 3 > 0
( 0 and 4 )
6.
(57 + 414) > (57 + 3) > 0
( 1 and 5 )
7.
1 + 214 > 215 > 0
( 6 and arithmetic )
8.
8 + 1 +214 > 8 + 215 >0
( 0 and 7 )
9.
(8 + 1 + 214) (8 + 215) > 0
( 1 and 8 )
10.
2 + 7 > 3 + 5 > 0
( 9 and arithmetic )
224 > 9 > 0
2 + 7 > 3 + 5
Goal-Directed Construction
=
2 + 7 ? 3 + 5
{ property of squaring
}
(2 + 7)2 ? (3 + 5)2
=
{ arithmetic
}
9 + 214 ? 8 + 215
=
{ property of arithmetic
}
1 + 214 ? 215
=
{ property of squaring
}
(1 + 214)2 ? (215)2
=
{ arithmetic
}
57 + 414 ? 60
=
{ property of arithmetic
}
414 ? 3

{ property of squaring, and arithmetic }
? is “ > ”.
Goal-Directed Construction
2 + 7
  ? 3
 + 5
=
{ property
of squaring }
 
 
(2 + 7) 2 ?  (3 + 5)2
=


2+ 7 ?
=
{
3+ 5
property of squaring
}
( 2 + 7)2 ? ( 3 + 5)2
=
{
arithmetic
}
9 + 2 14 ? 8 + 2 15
=
{
property of arithmetic
}
1 + 2 14 ? 2 15
=
{
property of squaring
}
(1 + 214)2 ? (215)2
=
{
arithmetic
}
57 + 414 ? 60

=
{
property of arithmetic
}

{ property
of squaring, and arithmetic }
? is “ > ”.
4 14 ? 3

{
property of squaring, and arithmetic
? is “ > ”.
}
Complicating Proof
0+0 = 0
0(0+0) = 00
00 + 00 = 00
(00 + 00) + x = 00 + x
00 + (00 + x) = 00 + x
00 + 0 = 0
00 = 0
Rule (i) with a = 0
multiplying both sides by 0
“distributive rule”:
a(b+c) = ab + ac
adding x to both sides, where x
is the solution of 00 + x = 0
guaranteed by rule (ii)
“associative rule”:
a + (b+c) = (a+b) + c
using the property of x
using rule (i) with a = 00
Complicating Proof
0+0 = 0
0+0 = 0
0(0+0) = 00
00 + 00 = 00
(00 + 00) + x = 00 + x
00 + (00 + x) = 00 + x
00 + 0 = 0
00 = 0
00 = 0
Rule (i) with a = 0
multiplying both sides by 0
“distributive rule”:
a(b+c) = ab + ac
adding x to both sides, where x
is the solution of 00 + x = 0
guaranteed by rule (ii)
“associative rule”:
a + (b+c) = (a+b) + c
using the property of x
using rule (i) with a = 00
Goal-Directed Proof
=
=
=

00 = 0
{ a+0 = a }
00 + 0 = 0
{ assume 00 + x = 0, Leibniz }
00 + (00 + x) = 00 + x
{ associativity of + }
(00 + 00) + x = 00 + x
{ Leibniz }
00 + 00 = 00
First four steps are the crucial ones ...
Goal-Directed Proof
00 + 00 = 00
=
{ distributivity }
0(0 + 0) = 00

{ Leibniz }
0+0 = 0
=
{ a+0 = a }
true .
… the rest is easy.
Construction versus
Verification
1 + 2 + … + n = n ( n + 1) / 2
12 + 22 + … + n2 = n ( n + 1) ( 2n + 1) / 6
13 + 23 + … + n3 = ?
127 + 227 + … + n27 = ?
Verification versus
Construction
1 + 2 + … + n = n ( n + 1) / 2
12 + 22 + … + n2 = n ( n + 1) ( 2n + 1) / 6
13 + 23 + … + n3 = ?
127 + 227 + … + n27 = ?
Verification versus
Construction
1 + 2 + … + n = n ( n + 1) / 2
12 + 22 + … + n2 = n ( n + 1) ( 2n + 1) / 6
13 + 23 + … + n3 = ?
127 + 227 + … + n27 = ?
Inductive Construction
1° + 2° +  + n°  n
1¹ + 2¹ +  + n¹  n(n+1)/2
1² + 2² +  + n²  n(n+1)(2n+1)/6
Conjecture: 1k + 2k +  + nk
is a polynomial in n of degree k+1.
Let
S.n = 1 + 2 +  + n
P.n = (S.n = a + bn + cn² )
Then,
 n:: P.n 
=
{ induction }
P.0   n:: P.n  P.(n+1)
=
{ P.0 = (S.0 = a) }
0 = a   n:: P.n  P.(n+1)
=
{ substitution of equals for equals }
0 = a   n:: P.n  P.(n+1) [a:= 0]
P.(n+1) [a:= 0]
=
{ definition }
S.(n+1) = b(n+1) + c(n+1)²
=
{ S.(n+1) = S.n + (n+1) }
S.n + n + 1 = b(n+1) + c(n+1)²
=
{ assume S.n = bn + cn² }
bn + cn² + n + 1 = b(n+1) + c(n+1)²
=
0 = (b + c - 1) + (2c - 1)n
Hence n:: P.n

a=0  b=½  c=½
Towers of Hanoi
An atomic move is a pair k,d  where k is the disk
number and d is the direction (clockwise or
anticlockwise) the disk is to be moved.
H.(n,d) is a sequence of atomic moves that results in
moving the top n disks from one pole to the next pole
in a direction d.
H.(0,d)
=
H.(n+1,d) =
[]
H.(n,d) ; [n,d] ; H.(n,d)
Invariant
The value of
even.n  d
remains constant for every call of H.
Proof: Compare
H.(n+1,d) = H.(n,d) ; [n,d] ; H.(n,d)
with
even.(n+1)  d
=
{ contraposition: p  q  p  q }
(even.(n+1))  d
=
{ property of even }
even.n  d .
Invariant
The value of
even.n  d
remains constant for every call of H.
Hence:
 The direction of movement of individual disks is constant.
 Alternate disks move in alternate directions.
 The direction of movement of disk 0 (the smallest disk) is
given by
even.0  d0  even.n  dn
where dk donates the direction of movement of disk k.
Invariant
Equivalently,
d0  dn

even.n
.
That is, the smallest disk is moved in the same direction as
the largest disk exactly when the number given to the
largest disk is even.
Summary



Calculational Logic
Goal-directed
Construction, not Verification
Related documents