ACAS-Xu stands for Aircraft Collision Avoidance System. Introduced for instance
in [Manfredi2016]_, it is a specification of a program which aim to output
...
...
@@ -129,11 +129,9 @@ and the relevant arithmetic operations according to the IEEE 754 floating-point
standard in a theory, astutely called ``ieee_float``. Specifically, we will
import the ``Float64`` sub-theory, that defines everything we need for 64-bit
precision floating-point numbers. We thus import it in our theory using the
``use`` keyword.
This currently requires to write exact IEEE 754 floating
point values in the specification file, which is
understandably a setback in terms of usability, but have the
advantage of being unambiguous on the specification.
``use`` keyword. This currently requires to write exact IEEE 754 floating point
values in the specification file, which is understandably a setback in terms of
usability, but have the advantage of making the specification unambiguous.
Our file looks like this so far:
...
...
@@ -148,12 +146,20 @@ CAISAR provide WhyML extensions to recognize and apply
neural networks in ONNX and NNet formats on vector inputs.
Given a file of such formats, CAISAR is able to provide the following:
* a logical symbol of type ``nn``, built using the ``read_neural_network`` function, of type ``string -> format -> nn``. The first argument is the path to the neural network file, ``format`` is either ``ONNX`` or ``NNet``, and ``nn`` is the type of the neural network in WhyML;
* a function symbol that returns the output of the application of the neural network to a given input;
* a logical symbol of type ``nn``, built using the ``read_neural_network``
function, of type ``string -> format -> nn``. The first argument is the path
to the neural network file, ``format`` is either ``ONNX`` or ``NNet``, and
``nn`` is the type of the neural network in WhyML;
* a function symbol that returns the output of the application of the neural
network to a given input;
* types and predicates to manipulate inputs vectors;
The full reference for those WhyML extensions is available under the
`stdlib/interpretation.mlw <https://git.frama-c.com/pub/caisar/-/blob/master/stdlib/interpretation.mlw>`_ file. To create a logical symbol for a neural network located in "nets/onnx/ACASXU_1_1.onnx", we can import the relevant theories in our file and use the ``read_neural_network`` function symbol like this:
A future release of CAISAR will provide a way for specifying and perform such
a normalization process in order to bridge the gap between the original
properties and the actual specifications.
We must then define the result of the application of ``nn_1_1`` on the inputs.
The built-in function ``@@`` serves this purpose. Its type, ``nn -> vector 'a -> vector 'a``, describes what it does: given a neural network ``nn`` and an input vector ``x``, return the vector that is the result of the application of ``nn`` on ``x``.
Note that thanks to type polymorphism, ``@@`` can be used to
describe a variety of input vectors, including floating points, integers, or strings.
We can finally define the output constraint
we want to enforce on the first coordinate of the output vector that we use to
model the advisory *COC*. We use the WhyML extension
predicate ``has_length`` to further check that our inputs
The built-in function ``@@`` serves this purpose. Its type, ``nn -> vector 'a ->
vector 'a``, describes what it does: given a neural network ``nn`` and an input
vector ``x``, return the vector that is the result of the application of ``nn``
on ``x``. Note that thanks to type polymorphism, ``@@`` can be used to describe
a variety of input vectors, including floating points, integers, or strings. We
can finally define the output constraint we want to enforce on the first
coordinate of the output vector that we use to model the advisory *COC*. We use
the WhyML extension predicate ``has_length`` to further check that our inputs
are of valid length.
The final WhyML file looks like this:
...
...
@@ -232,11 +238,11 @@ The final WhyML file looks like this:
constant nn_1_1: nn = read_neural_network "nets/onnx/ACASXU_1_1.onnx" ONNX