SlideShare a Scribd company logo
1 of 23
Download to read offline
Can we verify a program if we can’t do the maths?

                      James Davenport (Bath)

 Thanks to Russell Bradford (Bath CS), Acyr Locatelli (Bath Maths), Gregory
  Sankaran (Bath Maths) and David Wilson (Bath CS) and Scott McCallum
                                (Macquarie)


        Computer Science Department 10th Anniversary
                      11 October 2012




                            Davenport   Can we verify a program if we can’t do the maths?
Traditional Classification of Problems



   blunder (of the coding variety) This is the sort of error
           traditionally addressed in “program verification”.
           Typically independent of the arithmetic.
parallelism Issues of deadlocks or races occurring due to the
            parallelism of an otherwise correct sequential
            program. Again, arithmetic-independent.
numerical Do truncation and round-off errors, individually or
          combined, mean that the program computes
          approximations to the “true” answers which are out
          of tolerance.




                       Davenport   Can we verify a program if we can’t do the maths?
Traditional Classification of Problems

How often are they considered?
Statistics from [CE05]
     blunder (of the coding variety) This is the sort of error
      (83%) traditionally addressed in “program verification”.
            Typically independent of the arithmetic.
  parallelism Issues of deadlocks or races occurring due to the
      (13%) parallelism of an otherwise correct sequential
            program. Again, arithmetic-independent.
  numerical Do truncation and round-off errors, individually or
       (3%) combined, mean that the program computes
            approximations to the “true” answers which are out
            of tolerance.
To this, I wish to add a fourth kind


                          Davenport    Can we verify a program if we can’t do the maths?
“The bug that dares not speak its name”




  manipulation A piece of algebra, which is “obviously correct”,
        (0%!) turns out not to be correct when interpreted, not as
              abstract algebra, but as the manipulation of
              functions R → R or C → C.




                           Davenport   Can we verify a program if we can’t do the maths?
A note on complex numbers



  Most of our examples involve complex numbers, and people say
      real programs don’t use complex numbers
  However
      COMPLEX in Fortran II (1958–61) was the first programming
      language data type not corresponding to a machine one
      Even C99 introduced Complex
      Many examples, notably in fluid mechanics.




                          Davenport   Can we verify a program if we can’t do the maths?
Kahan’s example [Kah87]

  Flow in a slotted strip, transformed by

                                        2z                           5z + 12
     w = g (z) := 2 arccosh 1 +                 − arccosh                                   (1)
                                         3                           3(z + 4)

  into a more tractable region.
  Is this the same transformation as

                ?                                            z +3
           w =q(z) := 2 arccosh 2(z + 3)                             ?                      (2)
                                                           27(z + 4)

  Or possibly
                                 √           √       √                      2
            ?                1       3 z + 12 z + 3 + z
          w =h(z) := 2 ln                  √      √                               ?         (3)
                             3           2 z +3+ z


                            Davenport        Can we verify a program if we can’t do the maths?
g − q might look OK




  “OK apart from a slight glitch.”

                           Davenport   Can we verify a program if we can’t do the maths?
But if we look closer




  Definitely not OK

                        Davenport   Can we verify a program if we can’t do the maths?
But, in fact g = h

  Most computer algebra systems (these days!) will refuse to
  “simplify” g to q
  But will also refuse to simplify g to h.
  Indeed Maple’s coulditbe(g<>h); returns true, which ought to
  indicate that there is a counter-example.
  If g = h then g − h is zero:

      d(g − h)          z   z + 3 3/2                √        z
               =2                  z    − 2 z 3/2 + 2 z + 3      ·
         dz           z +4 z +4                             z +4
        z +3     √               z     z + 3√        √        z
             z −z z +3+4                        z +8 z +3        ·
        z +4                 z +4 z +4                      z +4
    z +3     √      1     1  1       1                 √      √ -1
          −6 z √         √               (z + 4)−2 2 z + 3 + z
    z +4           z +3 z      z     z+3
                                      z+4     z+4

  and it’s a bold person who would say “= 0”

                          Davenport     Can we verify a program if we can’t do the maths?
Challenges

  Challenge (1)

  Demonstrate automatically that g and q are not equal, by
  producing a z at which they give different results.

  The technology described in [BBDP07] will isolate the curve
                  2
  y = ± (x+3) (−2x−9) as a potential obstacle (it is the branch cut
                2x+5
  of q), but the geometry questions are too hard for a
  fully-automated solution at the moment.
  Challenge (2)

  Demonstrate automatically that g and h are equal.

  Again, the technology in [BBDP07], implemented in a mixture of
  Maple and QEPCAD, could in principle do this

                           Davenport   Can we verify a program if we can’t do the maths?
Joukowski (a)


  Consider the Joukowski map [Hen74, pp. 294–298]:

                                     1         1
                           f :z →        z+           .                                 (4)
                                     2         z

  Lemma
  f is injective as a function from D := {z : |z| > 1}.

  This is also a function R2 → R2 :
                           1    1    x    1   1    y
          fR : (x, y ) →     x+          , y−
                                   2 + y2 2      2 + y2
                                                                                        (5)
                           2    2x            2x




                             Davenport   Can we verify a program if we can’t do the maths?
Joukowski challenge (a1)

  Challenge (3)

  Demonstrate automatically that fR is injective, i.e.

           ∀x1 ∀x2 ∀y1 ∀y2                      2    2        2    2
                                               x1 + y1 > 1 ∧ x2 + y2 > 1∧
              x1                 x2                        y1                      y2
    x1 +    2
           x1 +y12   = x2 +    2
                              x2 +y22   ∧     y1 −       2
                                                        x1 +y12   = y2 −         2
                                                                                x2 +y22


                                        ⇒             x1 = x2 ∧ y1 = y2 .
                                                                                            (6)

  We have failed to do this automatically, but Brown can
  reformulate manually then solve in QEPCAD (< 12 seconds)

  Challenge (4)

  Automate these techniques and transforms.

                                 Davenport   Can we verify a program if we can’t do the maths?
Joukowski challenge (a2)


  So it’s a bijection: what’s the inverse?

              Figure: Maple’s solve on inverting Joukowski

  > [solve(zeta = 1/2*(z+1/z), z)];
                  ζ + ζ 2 − 1, ζ − ζ 2 − 1


  The only challenge might be the choice implicit in the ± idea:
  which do we choose? Unfortunately, the answer is “neither”, or at
  least “neither, uniformly”.




                            Davenport   Can we verify a program if we can’t do the maths?
Joukowski challenge (a2 continued)

                      
                       +
                            ζ2 − 1       (ζ) > 0
                      
                        −    ζ2 − 1       ζ) < 0
                      
           f1 (ζ) = ζ                                                                    (7)
                       +
                            ζ2 − 1       (ζ) = 0 ∧ (ζ) > 1
                      
                        −    ζ2 − 1       (ζ) = 0 ∧ (ζ) < −1
                      

  In fact, a better (at least, free of case distinctions) definition is

                      f2 (ζ) = ζ +       ζ −1       ζ + 1.                               (8)

  The techniques of [BBDP07] are able to verify (8), in the sense of
  showing that f2 (f (z)) − z is the zero function on {z : |z| > 1}.

  Challenge (5)

  Derive automatically, and demonstrate the validity of, either (7) or
  (8). In terms of Maple, this would be . . .

                             Davenport    Can we verify a program if we can’t do the maths?
Joukowski challenge (a2 continued)


    Figure: Bad: Maple’s actual solve on inverting injective Joukowski

  > [solve(zeta = 1/2*(z+1/z), z)] assuming abs(z) > 1
                  ζ + ζ 2 − 1, ζ − ζ 2 − 1



        Figure: Good: Ideal software inverting injective Joukowski

  > solve(zeta = 1/2*(z+1/z), z) assuming abs(z) > 1
                     ζ + ζ −1 ζ +1

  As far as I can tell (supported by the documentation), Maple
  ignores the “assuming” as it’s on the codomain, not the domain.
  Currently, we can’t solve quadratics!

                            Davenport   Can we verify a program if we can’t do the maths?
Joukowski (b) challenge

  Lemma
  f is injective as a function from H := {z :                  z > 0}.

  Challenge (6)

  Demonstrate automatically the truth of

            ∀x1 ∀x2 ∀y1 ∀y2                                 y1 > 0 ∧ y2 > 0∧
               x1                 x2                           y1                      y2
     x1 +    2
            x1 +y12   = x2 +    2
                               x2 +y22       ∧    y1 −       2
                                                            x1 +y12   = y2 −         2
                                                                                    x2 +y22


                                         ⇒                x1 = x2 ∧ y1 = y2 .
                                                                                                (9)

  Brown’s ideas probably apply here as well, but this is unproven

                                 Davenport       Can we verify a program if we can’t do the maths?
Joukowski (b) challenge continued


  So it’s a bijection: what’s the inverse?
  [Hen74, (5.1-13), p. 298] argues for

                   f3 (ζ) = ζ +         ζ −1           ζ + 1.                         (10)
                                  arg∈(−π/2,π/2] arg∈(0,π]



  Challenge (7)

  Find a way to represent functions such as             ζ +1
                                                    arg∈(0,π]




                            Davenport    Can we verify a program if we can’t do the maths?
Alternative formulations

  Fortunately this one is soluble in this case, we can write

                         ζ +1=i             −ζ − 1 ,
                       arg∈(0,π]        arg∈(−π/2,π/2]

  so we have an inverse function

                    f4 (ζ) = ζ +        ζ − 1i     −ζ − 1.                             (11)



  Challenge (8)

  Demonstrate automatically that this is an inverse to f on
  {z : z > 0}.



                            Davenport     Can we verify a program if we can’t do the maths?
Why is this so hard? (1) — CAD

  The first truly algorithmic approach is ten years old ([BCD+ 02],
  refined in [BBDP07]), and has various difficulties.
  At its core is the use of Cylindrical Algebraic Decomposition of RN
  to find the connected components of CN/2  {branch cuts}. The
  complexity of this is doubly exponential in N: upper bound of
       N                          (N−1)/3
  d O(2 ) and lower bounds of 22          .               √
  While better algorithms are in principle known (d O(N N) ), we do
  not know of any accessible implementations.
  Furthermore, we are clearly limited to small values of N, at which
  point looking at O(. . .) complexity is of limited use. We note that
                                                  √
  the cross-over point between 2(N−1)/3 and N N is at N = 21.
  A more detailed comparison is given in [Hon91]. Hence there is a
  need for practical research on low-N Cylindrical Algebraic
  Decomposition.


                            Davenport   Can we verify a program if we can’t do the maths?
Why is this so hard? (1) — CAD continued



  While the fundamental branch cut of log is simple enough, being
  {z = x + iy |y = 0 ∧ x < 0}, actual branch cuts are messier. Part
  of the branch cut of (2) is

   2x 3 + 21x 2 + 72x + 2xy 2 + 5y 2 + 81 = 0 ∧ other conditions, (12)

  whose solution accounts for the curious boundary of the bad region.
  While there has been some progress in manipulating such images
  of half-lines (described in Phisanbut’s Bath PhD), there is almost
  certainly more to be done.




                           Davenport   Can we verify a program if we can’t do the maths?
Why is this so hard? (2) — Injectivity
  Lemmas 1, 2 are statements about complex functions of one
  variable, so why do we need statements about four real variables to
  prove them? There are three reasons.
    1   The statements require the | · | or functions, neither of
        which are C analytic functions. Hence some recourse to R
        (twice as many variables) seems inevitable (proof?)
    2   Equations (6) and (9) are the direct translations of the basic
        definition of injectivity. In practice, certainly if we were
        looking at functions R → R, we would want to use the fact
        that the function concerned was continuous.
  Challenge (9)

  Find a better formulation of injectivity questions RN → RN ,
  making use of the properties of the functions concerned (certainly
  continuity, possibly rationality).

                             Davenport   Can we verify a program if we can’t do the maths?
Why is this so hard? (2) — Injectivity continued


    1   While these injectivity equations are statements from the
        existential theory of the reals, and so the theoretically more
        efficient algorithms quoted in [Hon91] are in principle
        applicable, the more modern developments described in [PJ09]
        do not seem to be directly applicable. However, we can
        transform then into a disjunction of statements to each of
        which the Weak Positivstellensatz [PJ09, Theorem 1] is
        applicable.
  Challenge (10)

  Solve these problems using the techniques of [PJ09],




                            Davenport   Can we verify a program if we can’t do the maths?
Bibliography
J.C. Beaumont, RJB, JHD, and N. Phisanbut.
Testing Elementary Function Identities Using CAD.
AAECC, 18:513–543, 2007.
RJB, R.M. Corless, JHD, D.J. Jeffrey, and S.M. Watt.
Reasoning about the Elementary Functions of Complex Analysis.
Ann. Math. Artificial Intelligence, 36:303–318, 2002.
R. Cousot (Ed.).
Verification, Model Checking, and Abstract Interpretation.
Springer Lecture Notes in Computer Science 3385, 2005.
P. Henrici.
Applied and Computational Complex Analysis I. Wiley, 1974.
H. Hong. Comparison of several decision algorithms for the
existential theory of the reals. RISC Technical Report 91-41, 1991.
W. Kahan. Branch Cuts for Complex Elementary Functions.
Proc. The State of Art in Numerical Analysis, pages 165–211, 1987.
G.O. Passmore and P.B. Jackson.
Combined Decision Techniques for the Existential Theory of the
Reals. Proc. Intelligent Computer Mathematics, pages 122–137,
                      Davenport   Can we verify a program if we can’t do the maths?

More Related Content

What's hot

Xi trigonometric functions and identities (t) part 1
Xi trigonometric functions and identities  (t)   part 1 Xi trigonometric functions and identities  (t)   part 1
Xi trigonometric functions and identities (t) part 1 Mishal Chauhan
 
UPSEE - Mathematics -1998 Unsolved Paper
UPSEE - Mathematics -1998 Unsolved PaperUPSEE - Mathematics -1998 Unsolved Paper
UPSEE - Mathematics -1998 Unsolved PaperVasista Vinuthan
 
Magic graphs
Magic graphsMagic graphs
Magic graphsSpringer
 
IIT JAM MATH 2018 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2018 Question Paper | Sourav Sir's ClassesIIT JAM MATH 2018 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2018 Question Paper | Sourav Sir's ClassesSOURAV DAS
 
Class xii determinants revision worksheet (t)
Class xii determinants revision worksheet (t)Class xii determinants revision worksheet (t)
Class xii determinants revision worksheet (t)Mishal Chauhan
 
Functions revision worksheet (t) part 1
Functions revision worksheet (t)   part 1Functions revision worksheet (t)   part 1
Functions revision worksheet (t) part 1Mishal Chauhan
 
11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)Nigel Simmons
 
Lesson 27: Integration by Substitution (Section 041 slides)
Lesson 27: Integration by Substitution (Section 041 slides)Lesson 27: Integration by Substitution (Section 041 slides)
Lesson 27: Integration by Substitution (Section 041 slides)Matthew Leingang
 
Factoring GCF and Grouping
Factoring GCF and GroupingFactoring GCF and Grouping
Factoring GCF and Groupingswartzje
 
MODULE 4- Quadratic Expression and Equations
MODULE 4- Quadratic Expression and EquationsMODULE 4- Quadratic Expression and Equations
MODULE 4- Quadratic Expression and Equationsguestcc333c
 
UPSEE - Mathematics -2003 Unsolved Paper
UPSEE - Mathematics -2003 Unsolved PaperUPSEE - Mathematics -2003 Unsolved Paper
UPSEE - Mathematics -2003 Unsolved PaperVasista Vinuthan
 

What's hot (20)

Backtracking
BacktrackingBacktracking
Backtracking
 
Xi trigonometric functions and identities (t) part 1
Xi trigonometric functions and identities  (t)   part 1 Xi trigonometric functions and identities  (t)   part 1
Xi trigonometric functions and identities (t) part 1
 
UPSEE - Mathematics -1998 Unsolved Paper
UPSEE - Mathematics -1998 Unsolved PaperUPSEE - Mathematics -1998 Unsolved Paper
UPSEE - Mathematics -1998 Unsolved Paper
 
Magic graphs
Magic graphsMagic graphs
Magic graphs
 
IIT JAM MATH 2018 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2018 Question Paper | Sourav Sir's ClassesIIT JAM MATH 2018 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2018 Question Paper | Sourav Sir's Classes
 
Class xii determinants revision worksheet (t)
Class xii determinants revision worksheet (t)Class xii determinants revision worksheet (t)
Class xii determinants revision worksheet (t)
 
Functions revision worksheet (t) part 1
Functions revision worksheet (t)   part 1Functions revision worksheet (t)   part 1
Functions revision worksheet (t) part 1
 
Daa unit 4
Daa unit 4Daa unit 4
Daa unit 4
 
11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)11 X1 T01 08 Simultaneous Equations (2010)
11 X1 T01 08 Simultaneous Equations (2010)
 
Lesson 27: Integration by Substitution (Section 041 slides)
Lesson 27: Integration by Substitution (Section 041 slides)Lesson 27: Integration by Substitution (Section 041 slides)
Lesson 27: Integration by Substitution (Section 041 slides)
 
Factoring GCF and Grouping
Factoring GCF and GroupingFactoring GCF and Grouping
Factoring GCF and Grouping
 
MODULE 4- Quadratic Expression and Equations
MODULE 4- Quadratic Expression and EquationsMODULE 4- Quadratic Expression and Equations
MODULE 4- Quadratic Expression and Equations
 
Integration
IntegrationIntegration
Integration
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Em05 pe
Em05 peEm05 pe
Em05 pe
 
Simultaneous equations (2)
Simultaneous equations (2)Simultaneous equations (2)
Simultaneous equations (2)
 
AMU - Mathematics - 2007
AMU - Mathematics  - 2007AMU - Mathematics  - 2007
AMU - Mathematics - 2007
 
Sect1 4
Sect1 4Sect1 4
Sect1 4
 
UPSEE - Mathematics -2003 Unsolved Paper
UPSEE - Mathematics -2003 Unsolved PaperUPSEE - Mathematics -2003 Unsolved Paper
UPSEE - Mathematics -2003 Unsolved Paper
 
Complex Eigenvalues
Complex EigenvaluesComplex Eigenvalues
Complex Eigenvalues
 

Viewers also liked

Its Not The Effort You Put In That Counts, Its The Results You Get Out.“
Its Not The Effort You Put In That Counts, Its The Results You Get Out.“Its Not The Effort You Put In That Counts, Its The Results You Get Out.“
Its Not The Effort You Put In That Counts, Its The Results You Get Out.“Pozzolini
 
01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...
01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...
01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...Pozzolini
 
Informatie, Middel Voor Gezonde Sturing
Informatie, Middel Voor Gezonde SturingInformatie, Middel Voor Gezonde Sturing
Informatie, Middel Voor Gezonde SturingDaan Blinde
 
Asociatividad globalizacion
Asociatividad globalizacionAsociatividad globalizacion
Asociatividad globalizacionsmpchiclayo
 
Hawai'i Workshop
Hawai'i WorkshopHawai'i Workshop
Hawai'i WorkshopLen Edgerly
 
WordPress for Large-Scale Installs
WordPress for Large-Scale InstallsWordPress for Large-Scale Installs
WordPress for Large-Scale InstallsSara Rosso
 
Web2-es képzés kérdőívek összesítése
Web2-es képzés kérdőívek összesítéseWeb2-es képzés kérdőívek összesítése
Web2-es képzés kérdőívek összesítésebara1
 
Podcast Your Passion: 12 Steps to Mastery
Podcast Your Passion: 12 Steps to MasteryPodcast Your Passion: 12 Steps to Mastery
Podcast Your Passion: 12 Steps to MasteryLen Edgerly
 
OpenMI Developers Training
OpenMI Developers TrainingOpenMI Developers Training
OpenMI Developers TrainingJan Gregersen
 
Свой среди чужих
Свой среди чужихСвой среди чужих
Свой среди чужихGrigoriy Pechenkin
 
A vilag het_termeszeti_csodaja
A vilag het_termeszeti_csodajaA vilag het_termeszeti_csodaja
A vilag het_termeszeti_csodajabara1
 
Qliktechcorporateoverview
QliktechcorporateoverviewQliktechcorporateoverview
Qliktechcorporateoverviewivango1
 

Viewers also liked (20)

Its Not The Effort You Put In That Counts, Its The Results You Get Out.“
Its Not The Effort You Put In That Counts, Its The Results You Get Out.“Its Not The Effort You Put In That Counts, Its The Results You Get Out.“
Its Not The Effort You Put In That Counts, Its The Results You Get Out.“
 
JP deLange
JP deLangeJP deLange
JP deLange
 
Md2010 jl-wp7-sl-dev
Md2010 jl-wp7-sl-devMd2010 jl-wp7-sl-dev
Md2010 jl-wp7-sl-dev
 
01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...
01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...
01. Negotiating Presentation For The Seminar Generic 2009 September Beta Rele...
 
Informatie, Middel Voor Gezonde Sturing
Informatie, Middel Voor Gezonde SturingInformatie, Middel Voor Gezonde Sturing
Informatie, Middel Voor Gezonde Sturing
 
20160418_JTS Overview
20160418_JTS Overview20160418_JTS Overview
20160418_JTS Overview
 
Asociatividad globalizacion
Asociatividad globalizacionAsociatividad globalizacion
Asociatividad globalizacion
 
Science Cafe 2012
Science Cafe 2012Science Cafe 2012
Science Cafe 2012
 
Hawai'i Workshop
Hawai'i WorkshopHawai'i Workshop
Hawai'i Workshop
 
WordPress for Large-Scale Installs
WordPress for Large-Scale InstallsWordPress for Large-Scale Installs
WordPress for Large-Scale Installs
 
NúMeros En IngléS
NúMeros En IngléSNúMeros En IngléS
NúMeros En IngléS
 
Web2-es képzés kérdőívek összesítése
Web2-es képzés kérdőívek összesítéseWeb2-es képzés kérdőívek összesítése
Web2-es képzés kérdőívek összesítése
 
Podcast Your Passion: 12 Steps to Mastery
Podcast Your Passion: 12 Steps to MasteryPodcast Your Passion: 12 Steps to Mastery
Podcast Your Passion: 12 Steps to Mastery
 
OpenMI Developers Training
OpenMI Developers TrainingOpenMI Developers Training
OpenMI Developers Training
 
Job quitting
Job quittingJob quitting
Job quitting
 
Свой среди чужих
Свой среди чужихСвой среди чужих
Свой среди чужих
 
A vilag het_termeszeti_csodaja
A vilag het_termeszeti_csodajaA vilag het_termeszeti_csodaja
A vilag het_termeszeti_csodaja
 
Caims 2009
Caims 2009Caims 2009
Caims 2009
 
Qliktechcorporateoverview
QliktechcorporateoverviewQliktechcorporateoverview
Qliktechcorporateoverview
 
Base New Berlin
Base New BerlinBase New Berlin
Base New Berlin
 

Similar to Anniversary2012

Switkes01200543268
Switkes01200543268Switkes01200543268
Switkes01200543268Hitesh Wagle
 
Anti derivatives
Anti derivativesAnti derivatives
Anti derivativescanalculus
 
8-6 Solving Rational Functions
8-6 Solving Rational Functions8-6 Solving Rational Functions
8-6 Solving Rational Functionsrfrettig
 
Factorising for 3um
Factorising for 3umFactorising for 3um
Factorising for 3ummathssng3
 
Solving by factoring remediation notes
Solving by factoring remediation notesSolving by factoring remediation notes
Solving by factoring remediation notesMichelle Barnhill
 
Linear algebra-solutions-manual-kuttler-1-30-11-otc
Linear algebra-solutions-manual-kuttler-1-30-11-otcLinear algebra-solutions-manual-kuttler-1-30-11-otc
Linear algebra-solutions-manual-kuttler-1-30-11-otckjalili
 
Stochastic modelling and quasi-random numbers
Stochastic modelling and quasi-random numbersStochastic modelling and quasi-random numbers
Stochastic modelling and quasi-random numbersOlivier Teytaud
 
Lego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsLego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsMathieu Dutour Sikiric
 
Math lecture 9 (Absolute Value in Algebra)
Math lecture 9 (Absolute Value in Algebra)Math lecture 9 (Absolute Value in Algebra)
Math lecture 9 (Absolute Value in Algebra)Osama Zahid
 
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxDivide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxjacksnathalie
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniquesKrishna Gali
 
Algebra review
Algebra reviewAlgebra review
Algebra reviewMsKendall
 

Similar to Anniversary2012 (20)

9-5 Notes
9-5 Notes9-5 Notes
9-5 Notes
 
Switkes01200543268
Switkes01200543268Switkes01200543268
Switkes01200543268
 
Anti derivatives
Anti derivativesAnti derivatives
Anti derivatives
 
8-6 Solving Rational Functions
8-6 Solving Rational Functions8-6 Solving Rational Functions
8-6 Solving Rational Functions
 
Factorising for 3um
Factorising for 3umFactorising for 3um
Factorising for 3um
 
Solving by factoring remediation notes
Solving by factoring remediation notesSolving by factoring remediation notes
Solving by factoring remediation notes
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Linear algebra-solutions-manual-kuttler-1-30-11-otc
Linear algebra-solutions-manual-kuttler-1-30-11-otcLinear algebra-solutions-manual-kuttler-1-30-11-otc
Linear algebra-solutions-manual-kuttler-1-30-11-otc
 
Stochastic modelling and quasi-random numbers
Stochastic modelling and quasi-random numbersStochastic modelling and quasi-random numbers
Stochastic modelling and quasi-random numbers
 
Sect1 6
Sect1 6Sect1 6
Sect1 6
 
Taylor problem
Taylor problemTaylor problem
Taylor problem
 
Lego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsLego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawings
 
Math lecture 9 (Absolute Value in Algebra)
Math lecture 9 (Absolute Value in Algebra)Math lecture 9 (Absolute Value in Algebra)
Math lecture 9 (Absolute Value in Algebra)
 
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxDivide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
 
Jackson d.e.v.
Jackson d.e.v.Jackson d.e.v.
Jackson d.e.v.
 
Lab 5
Lab   5Lab   5
Lab 5
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniques
 
Algebra review
Algebra reviewAlgebra review
Algebra review
 
Section 7.4
Section 7.4Section 7.4
Section 7.4
 

Anniversary2012

  • 1. Can we verify a program if we can’t do the maths? James Davenport (Bath) Thanks to Russell Bradford (Bath CS), Acyr Locatelli (Bath Maths), Gregory Sankaran (Bath Maths) and David Wilson (Bath CS) and Scott McCallum (Macquarie) Computer Science Department 10th Anniversary 11 October 2012 Davenport Can we verify a program if we can’t do the maths?
  • 2. Traditional Classification of Problems blunder (of the coding variety) This is the sort of error traditionally addressed in “program verification”. Typically independent of the arithmetic. parallelism Issues of deadlocks or races occurring due to the parallelism of an otherwise correct sequential program. Again, arithmetic-independent. numerical Do truncation and round-off errors, individually or combined, mean that the program computes approximations to the “true” answers which are out of tolerance. Davenport Can we verify a program if we can’t do the maths?
  • 3. Traditional Classification of Problems How often are they considered? Statistics from [CE05] blunder (of the coding variety) This is the sort of error (83%) traditionally addressed in “program verification”. Typically independent of the arithmetic. parallelism Issues of deadlocks or races occurring due to the (13%) parallelism of an otherwise correct sequential program. Again, arithmetic-independent. numerical Do truncation and round-off errors, individually or (3%) combined, mean that the program computes approximations to the “true” answers which are out of tolerance. To this, I wish to add a fourth kind Davenport Can we verify a program if we can’t do the maths?
  • 4. “The bug that dares not speak its name” manipulation A piece of algebra, which is “obviously correct”, (0%!) turns out not to be correct when interpreted, not as abstract algebra, but as the manipulation of functions R → R or C → C. Davenport Can we verify a program if we can’t do the maths?
  • 5. A note on complex numbers Most of our examples involve complex numbers, and people say real programs don’t use complex numbers However COMPLEX in Fortran II (1958–61) was the first programming language data type not corresponding to a machine one Even C99 introduced Complex Many examples, notably in fluid mechanics. Davenport Can we verify a program if we can’t do the maths?
  • 6. Kahan’s example [Kah87] Flow in a slotted strip, transformed by 2z 5z + 12 w = g (z) := 2 arccosh 1 + − arccosh (1) 3 3(z + 4) into a more tractable region. Is this the same transformation as ? z +3 w =q(z) := 2 arccosh 2(z + 3) ? (2) 27(z + 4) Or possibly √ √ √ 2 ? 1 3 z + 12 z + 3 + z w =h(z) := 2 ln √ √ ? (3) 3 2 z +3+ z Davenport Can we verify a program if we can’t do the maths?
  • 7. g − q might look OK “OK apart from a slight glitch.” Davenport Can we verify a program if we can’t do the maths?
  • 8. But if we look closer Definitely not OK Davenport Can we verify a program if we can’t do the maths?
  • 9. But, in fact g = h Most computer algebra systems (these days!) will refuse to “simplify” g to q But will also refuse to simplify g to h. Indeed Maple’s coulditbe(g<>h); returns true, which ought to indicate that there is a counter-example. If g = h then g − h is zero: d(g − h) z z + 3 3/2 √ z =2 z − 2 z 3/2 + 2 z + 3 · dz z +4 z +4 z +4 z +3 √ z z + 3√ √ z z −z z +3+4 z +8 z +3 · z +4 z +4 z +4 z +4 z +3 √ 1 1 1 1 √ √ -1 −6 z √ √ (z + 4)−2 2 z + 3 + z z +4 z +3 z z z+3 z+4 z+4 and it’s a bold person who would say “= 0” Davenport Can we verify a program if we can’t do the maths?
  • 10. Challenges Challenge (1) Demonstrate automatically that g and q are not equal, by producing a z at which they give different results. The technology described in [BBDP07] will isolate the curve 2 y = ± (x+3) (−2x−9) as a potential obstacle (it is the branch cut 2x+5 of q), but the geometry questions are too hard for a fully-automated solution at the moment. Challenge (2) Demonstrate automatically that g and h are equal. Again, the technology in [BBDP07], implemented in a mixture of Maple and QEPCAD, could in principle do this Davenport Can we verify a program if we can’t do the maths?
  • 11. Joukowski (a) Consider the Joukowski map [Hen74, pp. 294–298]: 1 1 f :z → z+ . (4) 2 z Lemma f is injective as a function from D := {z : |z| > 1}. This is also a function R2 → R2 : 1 1 x 1 1 y fR : (x, y ) → x+ , y− 2 + y2 2 2 + y2 (5) 2 2x 2x Davenport Can we verify a program if we can’t do the maths?
  • 12. Joukowski challenge (a1) Challenge (3) Demonstrate automatically that fR is injective, i.e. ∀x1 ∀x2 ∀y1 ∀y2 2 2 2 2 x1 + y1 > 1 ∧ x2 + y2 > 1∧ x1 x2 y1 y2 x1 + 2 x1 +y12 = x2 + 2 x2 +y22 ∧ y1 − 2 x1 +y12 = y2 − 2 x2 +y22 ⇒ x1 = x2 ∧ y1 = y2 . (6) We have failed to do this automatically, but Brown can reformulate manually then solve in QEPCAD (< 12 seconds) Challenge (4) Automate these techniques and transforms. Davenport Can we verify a program if we can’t do the maths?
  • 13. Joukowski challenge (a2) So it’s a bijection: what’s the inverse? Figure: Maple’s solve on inverting Joukowski > [solve(zeta = 1/2*(z+1/z), z)]; ζ + ζ 2 − 1, ζ − ζ 2 − 1 The only challenge might be the choice implicit in the ± idea: which do we choose? Unfortunately, the answer is “neither”, or at least “neither, uniformly”. Davenport Can we verify a program if we can’t do the maths?
  • 14. Joukowski challenge (a2 continued)   +  ζ2 − 1 (ζ) > 0  − ζ2 − 1 ζ) < 0  f1 (ζ) = ζ (7)  +  ζ2 − 1 (ζ) = 0 ∧ (ζ) > 1  − ζ2 − 1 (ζ) = 0 ∧ (ζ) < −1  In fact, a better (at least, free of case distinctions) definition is f2 (ζ) = ζ + ζ −1 ζ + 1. (8) The techniques of [BBDP07] are able to verify (8), in the sense of showing that f2 (f (z)) − z is the zero function on {z : |z| > 1}. Challenge (5) Derive automatically, and demonstrate the validity of, either (7) or (8). In terms of Maple, this would be . . . Davenport Can we verify a program if we can’t do the maths?
  • 15. Joukowski challenge (a2 continued) Figure: Bad: Maple’s actual solve on inverting injective Joukowski > [solve(zeta = 1/2*(z+1/z), z)] assuming abs(z) > 1 ζ + ζ 2 − 1, ζ − ζ 2 − 1 Figure: Good: Ideal software inverting injective Joukowski > solve(zeta = 1/2*(z+1/z), z) assuming abs(z) > 1 ζ + ζ −1 ζ +1 As far as I can tell (supported by the documentation), Maple ignores the “assuming” as it’s on the codomain, not the domain. Currently, we can’t solve quadratics! Davenport Can we verify a program if we can’t do the maths?
  • 16. Joukowski (b) challenge Lemma f is injective as a function from H := {z : z > 0}. Challenge (6) Demonstrate automatically the truth of ∀x1 ∀x2 ∀y1 ∀y2 y1 > 0 ∧ y2 > 0∧ x1 x2 y1 y2 x1 + 2 x1 +y12 = x2 + 2 x2 +y22 ∧ y1 − 2 x1 +y12 = y2 − 2 x2 +y22 ⇒ x1 = x2 ∧ y1 = y2 . (9) Brown’s ideas probably apply here as well, but this is unproven Davenport Can we verify a program if we can’t do the maths?
  • 17. Joukowski (b) challenge continued So it’s a bijection: what’s the inverse? [Hen74, (5.1-13), p. 298] argues for f3 (ζ) = ζ + ζ −1 ζ + 1. (10) arg∈(−π/2,π/2] arg∈(0,π] Challenge (7) Find a way to represent functions such as ζ +1 arg∈(0,π] Davenport Can we verify a program if we can’t do the maths?
  • 18. Alternative formulations Fortunately this one is soluble in this case, we can write ζ +1=i −ζ − 1 , arg∈(0,π] arg∈(−π/2,π/2] so we have an inverse function f4 (ζ) = ζ + ζ − 1i −ζ − 1. (11) Challenge (8) Demonstrate automatically that this is an inverse to f on {z : z > 0}. Davenport Can we verify a program if we can’t do the maths?
  • 19. Why is this so hard? (1) — CAD The first truly algorithmic approach is ten years old ([BCD+ 02], refined in [BBDP07]), and has various difficulties. At its core is the use of Cylindrical Algebraic Decomposition of RN to find the connected components of CN/2 {branch cuts}. The complexity of this is doubly exponential in N: upper bound of N (N−1)/3 d O(2 ) and lower bounds of 22 . √ While better algorithms are in principle known (d O(N N) ), we do not know of any accessible implementations. Furthermore, we are clearly limited to small values of N, at which point looking at O(. . .) complexity is of limited use. We note that √ the cross-over point between 2(N−1)/3 and N N is at N = 21. A more detailed comparison is given in [Hon91]. Hence there is a need for practical research on low-N Cylindrical Algebraic Decomposition. Davenport Can we verify a program if we can’t do the maths?
  • 20. Why is this so hard? (1) — CAD continued While the fundamental branch cut of log is simple enough, being {z = x + iy |y = 0 ∧ x < 0}, actual branch cuts are messier. Part of the branch cut of (2) is 2x 3 + 21x 2 + 72x + 2xy 2 + 5y 2 + 81 = 0 ∧ other conditions, (12) whose solution accounts for the curious boundary of the bad region. While there has been some progress in manipulating such images of half-lines (described in Phisanbut’s Bath PhD), there is almost certainly more to be done. Davenport Can we verify a program if we can’t do the maths?
  • 21. Why is this so hard? (2) — Injectivity Lemmas 1, 2 are statements about complex functions of one variable, so why do we need statements about four real variables to prove them? There are three reasons. 1 The statements require the | · | or functions, neither of which are C analytic functions. Hence some recourse to R (twice as many variables) seems inevitable (proof?) 2 Equations (6) and (9) are the direct translations of the basic definition of injectivity. In practice, certainly if we were looking at functions R → R, we would want to use the fact that the function concerned was continuous. Challenge (9) Find a better formulation of injectivity questions RN → RN , making use of the properties of the functions concerned (certainly continuity, possibly rationality). Davenport Can we verify a program if we can’t do the maths?
  • 22. Why is this so hard? (2) — Injectivity continued 1 While these injectivity equations are statements from the existential theory of the reals, and so the theoretically more efficient algorithms quoted in [Hon91] are in principle applicable, the more modern developments described in [PJ09] do not seem to be directly applicable. However, we can transform then into a disjunction of statements to each of which the Weak Positivstellensatz [PJ09, Theorem 1] is applicable. Challenge (10) Solve these problems using the techniques of [PJ09], Davenport Can we verify a program if we can’t do the maths?
  • 23. Bibliography J.C. Beaumont, RJB, JHD, and N. Phisanbut. Testing Elementary Function Identities Using CAD. AAECC, 18:513–543, 2007. RJB, R.M. Corless, JHD, D.J. Jeffrey, and S.M. Watt. Reasoning about the Elementary Functions of Complex Analysis. Ann. Math. Artificial Intelligence, 36:303–318, 2002. R. Cousot (Ed.). Verification, Model Checking, and Abstract Interpretation. Springer Lecture Notes in Computer Science 3385, 2005. P. Henrici. Applied and Computational Complex Analysis I. Wiley, 1974. H. Hong. Comparison of several decision algorithms for the existential theory of the reals. RISC Technical Report 91-41, 1991. W. Kahan. Branch Cuts for Complex Elementary Functions. Proc. The State of Art in Numerical Analysis, pages 165–211, 1987. G.O. Passmore and P.B. Jackson. Combined Decision Techniques for the Existential Theory of the Reals. Proc. Intelligent Computer Mathematics, pages 122–137, Davenport Can we verify a program if we can’t do the maths?