Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Art of Effective Reasoning Roland Backhouse Tallinn, Estonia, 19th November 2002.

Similar presentations


Presentation on theme: "The Art of Effective Reasoning Roland Backhouse Tallinn, Estonia, 19th November 2002."— Presentation transcript:

1 The Art of Effective Reasoning Roland Backhouse Tallinn, Estonia, 19th November 2002

2 “The hallmark of a science is the avoidance of error” J. Robert Oppenheimer Quote of Oppenheimer

3  for all  there exists Logic (anno 1966)

4 Calculational Logic

5

6 For all non-zero y and z y × z is positive = (y is positive = z is positive)

7 Calculational Logic For all non-zero y and z y × z is positive = (y is positive = z is positive) (y × z is positive = y is positive) = z is positive

8 Calculational Logic For all non-zero y and z y × z is positive = (y is positive = z is positive) (y × 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

9 Inequalities (Trichotomy) If a  b then either a < b or b < a (Translation) If a < b then a+c < b+c If a 0 then ac < bc

10 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 0 then ac < bc

11 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 0 then ac < bc

12 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 0 then ac < bc For all a,b,c, where a  b and c  0, a < b  ac < bc  0 < c

13 Formal Proof

14 224 > 9 > 0  2 +  7 >  3 +  5

15 Goal-Directed Construction

16  { property of squaring, and arithmetic } ? is “ > ”.  2 +  7 ?  3 +  5 ={ property of squaring } (  2 +  7) 2 ? (  3 +  5) 2 =

17 Complicating Proof 0 + 0 = 0Rule (i) with a = 0 0  (0+0) = 0  0multiplying both sides by 0 0  0 + 0  0 = 0  0“distributive rule”: a  (b+c) = a  b + a  c (0  0 + 0  0) + x = 0  0 + x adding x to both sides, where x is the solution of 0  0 + x = 0 guaranteed by rule (ii) 0  0 + (0  0 + x) = 0  0 + x “associative rule”: a + (b+c) = (a+b) + c 0  0 + 0 = 0using the property of x 0  0 = 0using rule (i) with a = 0  0

18 Complicating Proof 0 + 0 = 0Rule (i) with a = 0 0  (0+0) = 0  0multiplying both sides by 0 0  0 + 0  0 = 0  0“distributive rule”: a  (b+c) = a  b + a  c (0  0 + 0  0) + x = 0  0 + xadding x to both sides, where x is the solution of 0  0 + x = 0 guaranteed by rule (ii) 0  0 + (0  0 + x) = 0  0 + x “associative rule”: a + (b+c) = (a+b) + c 0  0 + 0 = 0using the property of x 0  0 = 0using rule (i) with a = 0  0 0 + 0 = 0 0  0 = 0

19 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...

20 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.

21 Construction versus Verification

22 Verification versus Construction

23

24 Inductive Construction 1° + 2° +  + n°  n 1¹ + 2¹ +  + n¹  n(n+1)/2 1² + 2² +  + n²  n(n+1)(2n+1)/6 Conjecture: 1 k + 2 k +  + n k is a polynomial in n of degree k+1.

25 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]

26 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 = ½

27 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)

28 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.

29 Invariant The value of even.n  d remains constant for every call of H. Hence: n The direction of movement of individual disks is constant. n Alternate disks move in alternate directions. n The direction of movement of disk 0 (the smallest disk) is given by even.0  d 0  even.n  d n where d k donates the direction of movement of disk k.

30 Invariant Equivalently, d 0  d n  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.

31 Summary n Calculational Logic n Goal-directed n Construction, not Verification


Download ppt "The Art of Effective Reasoning Roland Backhouse Tallinn, Estonia, 19th November 2002."

Similar presentations


Ads by Google