show the students that they can reason on the results
of the execution of a program only considering the
meaning of the program itself and ignoring complex
operational details.
We have tested the TVT tool through the academic
courses 2009/ 2010 and 2010/2011, performing some
educational experiments to estimate the benefits for
our students of using the tool as a complement to
scheduled regular classes. This evaluation has been
carried out by means of several tests, some of them
managed in an online platform with open access to
the students, and the other ones in a CS laboratory
with a controlled group. We show the results of these
educational experiments and the benefits of using the
TVT tool in the teaching of advanced CS concepts
involving the formal verification and the algorithmic
debugging of imperative programs. We believe that
these educational experiences prove that our imple-
mentation based on tableaux provides an excellent
training to the students in the practical application
of advanced logic concepts to perform different CS
tasks.
2 THE TVT TOOL
Solving logical exercises is usually done with pen
and paper, but educational tools can offer more use-
ful pedagogical possibilities. The role of this edu-
cational software is to facilitate the student’s grasp
of the target procedures of education, and to provide
teamwork and communication between teachers and
students (van ditmarsch, 2005).
Our Tableaux Verification Tool,
named TVT (see the current version at
gpd.sip.ucm.es/CSEDU2012/TVT.zip), is an edu-
cational application based on first-order semantic
tableaux with equality and unification (Fitting, 1990)
used as a support for the teaching of deductive rea-
soning at an elementary university level for Computer
Science students. The tool helps our students to learn
how to build semantic tableaux, and to understand
the philosophy of this proof device using it not only
to establish consistency/inconsistency or to draw
conclusions from a given set of premises, but also for
verification and debugging purposes as we propose
in this paper. Our first year students have learnt
tableau calculus in the classroom and this software
has helped them to understand advanced CS concepts
visualizing and producing their own proof trees.
The tool consists of two main parts: one that pro-
duces first-order tableaux, and another one based on
this tableaux methodology for verification and debug-
ging of algorithms. In both cases, the application pos-
sesses a drawing window where trees will be graphi-
cally displayed. The major functional interface of the
TVT tool is shown in Figure 1. The user interacts with
the prover through this graphical interface. In the fol-
lowing sections we describe the use of the tool and
their main features by means of a running example.
3 FORMAL VERIFICATION
The main novelty of the TVT tool is to train our stu-
dents in the art and science of specifying correctness
properties of algorithms and proving them correct.
For this purpose, we use the classical approach de-
veloped by Edsger W. Dijkstra and others during the
1970s (Dijkstra, 1976). We use a guarded command
language to denote our algorithms A, represented by
functions fun A ffun that may contain variables (x, y,
z, etc.), value expressions (e) and boolean expressions
(B). The code of an algorithm is built out of the skip
(skip) and assignment statements (x := e) using se-
quential composition (S
1
;S
2
), conditional branching
(if B then S
1
else S
2
fif), and while-loops (while
B do S fwhile). This language is quite modest but
rich enough to represent sequential algorithms in a
succinct and elegant way. As an illustrative example,
we consider a simple algorithm divide to compute the
positive integer (int) division between a and b with
quotient c and remainder r (represented in TVT on
the left and bottom of Figure 1):
fun divide (a, b : int ) dev < c, r : int >
c := 0 ; r := a ;
while r ≥ b do
c := c + 1; r := r − b
fwhile
ffun
It becomes obvious that neither tracing nor testing
can guarantee the absence of errors in algorithms.
To be sure of the correctness of an algorithm one
has to prove that it meets its specification (Dijkstra,
1976). A specification of an algorithm A consists
of the definition of a state space (a set of program
variables), a precondition P and a postcondition Q
(both predicates expressing properties of the values
of variables), denoted as {P} A {Q}. Such a triple
means that Q holds in any state reached by executing
A from an initial state in which P holds. For exam-
ple, a formal specification for the divide function
(represented in TVT on the left and top of Figure 1) is:
{P : a ≥ 0 ∧ b > 0 }
fun divide (a, b : int ) dev < c, r : int >
{Q : a = b ∗ c + r ∧ r ≥ 0 ∧ r < b }
CSEDU2012-4thInternationalConferenceonComputerSupportedEducation
78