The document discusses challenges in verifying programs that involve complex mathematical operations. It presents examples involving functions of complex variables, like transformations of flow equations, and challenges in automatically demonstrating properties like injectivity. The key challenges are the complexity of cylindrical algebraic decomposition used in verification, and formulating injectivity questions in a way that exploits properties of continuous functions. Overall, the document argues that fully automated verification of programs involving complex math is very difficult with current techniques, and more research is needed to address these challenges.
SOLVING BVPs OF SINGULARLY PERTURBED DISCRETE SYSTEMSTahia ZERIZER
In this article, we study boundary value problems of a large
class of non-linear discrete systems at two-time-scales. Algorithms are given to implement asymptotic solutions for any order of approximation.
SOLVING BVPs OF SINGULARLY PERTURBED DISCRETE SYSTEMSTahia ZERIZER
In this article, we study boundary value problems of a large
class of non-linear discrete systems at two-time-scales. Algorithms are given to implement asymptotic solutions for any order of approximation.
Backtracking is a general algorithm for finding all (or some) solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons each partial candidate c ("backtracks") as soon as it determines that c cannot possibly be completed to a valid solution.
IIT JAM MATH 2018 Question Paper | Sourav Sir's ClassesSOURAV DAS
IIT JAM Math Previous Year Question Paper
IIT JAM Math 2018 Question Paper
IIT JAM Preparation Strategy
For full solutions contact us.
Call - 9836793076
Backtracking is a general algorithm for finding all (or some) solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons each partial candidate c ("backtracks") as soon as it determines that c cannot possibly be completed to a valid solution.
IIT JAM MATH 2018 Question Paper | Sourav Sir's ClassesSOURAV DAS
IIT JAM Math Previous Year Question Paper
IIT JAM Math 2018 Question Paper
IIT JAM Preparation Strategy
For full solutions contact us.
Call - 9836793076
The presentation I gave at WordCamp San Francisco 2011 - the annual official WordPress conference.
It's a great introduction to WordPress for enterprise use with specific reasons and case studies as examples.
Introduction to developing or migrating models to be compliant to the OpenMI Standard. OpenMI is an open standard which allows dynamic linking of numerical models, such as river models rainfall-runoff models and so on. See also:
http://www.lictek.com
We consider here k-valent plane and toroidal maps with faces of size a and b. The faces are said to be in a lego if the faces are organized in blocks that then tile the sphere. We expose some enumeration results and the technical enumeration methods.
Then we expose how we managed to draw the graphs from the combinatorial data.
Divide-and-Conquer & Dynamic Programming
Divide-and-Conquer: Divide a problem to independent subproblems, find the solutions of the subproblems, and then merge the solutions of the subproblems to the solution of the original problem.
Dynamic Programming: Solve the subproblems (they may overlap with each other) and save their solutions in a table, and then use the table to solve the original problem.
Example 1: Compute Fibonacci number f(0)=0, f(1)=1, f(n)=f(n-1)+f(n-2) Using Divide-and-Conquer:
F(n) = F(n-1) + F(n-2)
F(n-2) + F(n-3) + F(n-3) + F(n-4)
F(n-3)+F(n-4) + F(n-4)+F(n-5) + F(n-4)+F(n-5) + F(n-5) + F(n-6)
…………………….
Computing time: T(n) = T(n-1) + T(n-2), T(1) = 0 T(n)=O(2 ) Using Dynamic Programmin: Computing time=O(n)
n
Chapter 8 Dynamic Programming (Planning)
F(0)
F(1)
F(2)
F(3)
F(4)
……
F(n)
Example 2
The matrix-train mutiplication problem
*
Structure of an optimal parenthesization
Matrix Size
A1 30×35
A2 35×15
A3 15×5
A4 5×10
A5 10×20
A6 20×25
Input
6
5
3
2
4
1
3
3
3
3
3
3
3
3
5
1
2
3
4
5
i
j
1 2 3 4 5
s[i,j]
6
5
3
2
4
i
j
m[i,j]
15125
10500
5375
3500
5000
0
11875
7125
2500
1000
0
9375
4375
750
0
7875
2625
0
15750
0
0
1 2 3 4 5 6
1
i-1
k
j
Matrix-Chain-Order(p)
1 n := length[p] -1;
2 for i = 1 to n
3 do m[i,i] := 0;
4 for l =2 to n
5 do {for i=1 to n-l +1
6 do { j := i+ l-1;
7 m[i,j] := ;
8 for k = i to j-1
9 do {q := m[i,k]+m[k+1,j] +p p p ;
10 if q < m[i,j]
11 then {m[i,j] :=q; s[i,j] := k}; }; };
13 return m, s;
Input of algorithm: p , p , … , p (The size of A = p *p )
Computing time O(n )
8
0
1
n
i
i+1
i
3
Example 3
Longest common subsequence (LCS)
A problem from Bioinformatics: the DNA of one organism may be
S1 = ACCGGTCGAGTGCGCGGAAGCCGGCCGAAA, while the DNA of another organism may be S2 = GTCGTTCTTAATGCCGTTGCTCTGTAAA. One goal of comparing two strands of DNA is to determine how “similar” the two strands are, as some measure of how closely related the two organisms are.
Problem Formulization
Given a sequence X = ( ), another sequence Z = ( ) is a subsequence of X if there exists a strictly increasing sequence ( ) of indices of X such that for all j = 1, 2, …k, we have .
Theorem
Let X = ( ) and Y = ( ...
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?