TACO mainly works on .ta or .eta files, which are very close to the actual
threshold automata model. You can find a full formal definition of the accepted
syntax in the parser crate of TACO.
This section will give you an introduction to the format by encoding the threshold automaton depicted in Figure 2. If you want to find out more about the purpose of the individual components you can refer to the Theoretical Background section.
Skeleton¶
Every threshold automaton starts with an outer skeleton block which begins with
ta (or skel or thresholdAutomaton) followed by the name of the threshold
automaton.
For example, if we want to encode Figure 2 and name it SRB, we
would start by using:
Declaration of Shared Variables¶
Next, we need to declare the components of the threshold automaton, starting
with the shared variables. In this case, our threshold automaton has two nsnt
and rec, which are declared using:
Declaration of Parameters¶
Afterward, we can declare the parameters of the threshold automaton similarly:
(Optional) Declaration of Macros¶
Even though not included in the official grammar, ByMC and many of the
benchmarks written for ByMC use macros for frequently used expressions. They
can be defined inside a define block:
Instead of writing n - f or t + 1 - f in the specification file, you can now
use THRESH_0 or THRESH_1 respectively.
Assumptions / Resilience Condition¶
After the parameters have been declared, we need to specify the resilience conditions ( in the formal definitions see).
In this case, we have the resilience conditions
which are translated into individual statements separated by a ;:
Declaring Locations¶
After the shared variables and parameters, as well as the resilience conditions
have been defined, we still have to declare the locations exist, which is done
in a locations block.
Note that TACO does neither use the number of locations (i.e., the n in
locations (n) {) nor the indices of locations (i.e., the numbers in the []
brackets). You could also just write 0 for TACO.
However, we decided to keep them to maintain compatibility with ByMC.
Initial Conditions¶
The inits block in a .ta file has two main purposes:
it declares the initial conditions on variables, and
it declares which locations are initial
Initial Variable Conditions¶
The initial variable conditions define with what values the variables start.
In most cases, we do assume that initially the variables are set to 0, which
is achieved for a variable nsnt by specifying
Initial Location Constraints¶
The inits block also allows you to define which locations of a threshold
automaton can be initial. When using the name of a location in the inits
block, you refer to the number of processes that are allowed in that initial
state.
Additionally, the inits block also defines the relation between the parameters
and the processes, which we model explicitly.
A threshold automaton only models the correct processes explicitly
(see Theoretical Background). In our case, the number of correct processes is
given by , and we now want these processes to start in one of the
initial states.
Since the initial states in Figure 2 are V1 and V0 we can achieve
this with the constraint:
or using the previously defined macro:
Additionally, you have to define that all other locations, for example AC,
cannot have any process starting in it, by writing:
The Full inits Block¶
For Figure 2, the full inits block is then given by:
Defining Rules¶
Next, we have to define how processes can move from one location to the other,
i.e., we need to declare the rules of the threshold automaton. This is done
inside a rules block.
Example Rule¶
Let’s, for example, define the rule from location SE to V1 with the guard
that resets the variables rec and nsnt. In a .ta file we first have to
give the rule a unique id (lets say 6) then the rule is specified as:
where when contains the rule guard and do specifies the update.
Note that the variable to be updated has an additional ' and we use the
assignment operator :=.
Alternatively, the rule can be specified with the previously defined macros:
To specify an update like an increment, you can also refer to the old variable value in the condition after the assignment. For example:
specifies an increment of variable rec by one. You can find an encoding of all
the rules of Figure 2 in section Full Specification.
Correctness Property¶
After having specified the full automaton, we also have to specify its
correctness properties. This is done inside a specifications block. To
specify a property validity in of the form
we simply write:
Full Specification¶
If we put everything together, we get the full encoding of Figure 2 as:
Full ByMC specification for threshold automaton depicted in Figure 2