Академический Документы
Профессиональный Документы
Культура Документы
Varmo Vene
30 years later, . . .
we still spend often more time for debugging and testing
than for actual programming;
despite that, the software we are using and/or developing
has bugs (sometimes quite serious ones).
Introduction
Possible reasons
Human imperfection
To err is human, to forgive divine.
(Alexander Pope, 1688–1744)
Laws of nature
Program testing can be used to show the presence of
bugs, but never to show their absence!
(Edsger Dijkstra, 1970)
Imperfection of tools
The most effective debugging tool is still careful
thought, coupled with judiciously placed print state-
ments.
(Brian Kernighan, 1979)
Introduction
A goal of Semantics (among others)
To develop programming tools that give strong guarantees
about properties of programs.
– Eg. guarantee the absence of certain kind of errors.
Proactive tools
– Eg. program extraction.
Preventive tools
– Eg. programming languages with powerful type systems.
Retroactive tools
– Eg. static program analyzers.
Outline
Total Functional Programming
– Inductive types
– Comonadic recursion
– Recursive coalgebra
– Mendler-style recursion
Goblint
– Path-sensitivity
– Concurrent analysis
Working Group and Plans
Total Functional Programming
Total Functional Programming
In total functional programming paradigm all programs are
terminating.
In particular, there is no general recursion.
Instead, only some restricted forms of recursion are allowed,
which are guaranteed to terminate.
Usually, these are simple iteration or primitive recursion over
inductive types.
Sometimes also corecursive definitions of coinductive types
are allowed.
While not Turing complete, most of the interesting programs
are in principle expressible in such paradigm.
Total Functional Programming
Inductive Types and Iteration
Categorically, inductive types (such as natural numbers,
lists, trees, etc) are initial algebras of endofunctors.
The most basic form of recursion (known as iteration or fold)
corresponds to the unique homomorphism property of initial
algebras. in
FF F
Ff 9!f = fold(')
8'
FA A
A
where : 8X:(X ! A) ! (FX ! A).
Idea originates from (Mendler, 1987).
And extends to other recursion schemes.
Total Functional Programming
Mendler-style recursion
The scheme looks quite similar to the general recursion,
hence is (hopefully) more intuitive.
But the termination is still guaranteed.
Ie. we have termination checking by type-checking.
Total Functional Programming
Mendler-style recursion
The scheme looks quite similar to the general recursion,
hence is (hopefully) more intuitive.
But the termination is still guaranteed.
Ie. we have termination checking by type-checking.
Soundness vs. C
Restrict to the ”safe” subset of C:
no setjmp and getjmp;
no dynamic data structures;
no recursion;
...
Goblint
Main conflicts
Soundness vs. C
Efficiency vs. Precision
Soundness vs. C
Restrict to the ”safe” subset of C: Not as bad as it looks:
no setjmp and getjmp; we can still handle
no dynamic data structures; these constructs,
no recursion; but do not guarantee
the soundness.
...
Goblint
Main conflicts
Soundness vs. C
Efficiency vs. Precision
i n t save_y ;
i f ( change_y ) save_y = y , y = new_y ;
...
i f ( change_y ) y = save_y ;
i n t save_y ;
i f ( change_y ) save_y = y , y = new_y ;
...
i f ( change_y ) y = save_y ;
Our solution
We only track the paths that are relevant to the analysis
result.
In this example, paths are relevant when the set of
uninitialized variables are different.
In general, relevance depends on the user-analysis. . .
Goblint: Concurrent Analysis
State explosion
Precise concurrent analysis leads to state explosion.
Eg. if there are two threads with 10 instructions each, then
there are 184756 possible interleavings!
Additional information
Goblint has an Open Source license
You can download it from web:
http://goblin.at.mt.ut.ee/goblint/tracker/
Working Group and Plans
Programming Languages and Systems at EXCS
Senior staff
Keiko Nakata (IoC) Jaan Penjam (IOC)
Härmel Nestra (UT) Tarmo Uustalu (IOC)
Hellis Tamm (IOC) Varmo Vene (IOC/UT)
PhD students
Ando Saabas (IOC) Vesal Vojdani (UT)
Jevgeni Kabanov (UT) Andres Toom (IOC)
Aivar Annamaa (UT) Martin Pettai (UT)
Best friend
Peeter Laud (CybAS)
Working Group and Plans
Other research directions
Comonadic data-flow (Uustalu, Vene)
Proof transformation (Saabas, Uustalu)
Automata theory (Tamm, Penjam)
Transfinite semantics (Nestra)
Domain specific languages in Java (Kabanov)
Code generation for data-flow (Toom)