<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Formal Design of Cyber-Physical Systems with Learning-Enabled Components</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Thao Dang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Univertity Grenoble Alpes</institution>
          ,
          <addr-line>CNRS, Grenoble INP, VERIMAG, Grenoble</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We present two learning methods for designing Cyber-Physical Systems with Learning-Enabled Components: one is imitation learning of feedback controllers, and the other is learning of temporal specifications.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;AI</kwd>
        <kwd>Formal Methods</kwd>
        <kwd>Overlay</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Artificial intelligence (AI) and data sciences are revolutionizing information systems used for
control and supervision of various devices (e.g., sensors, robots, IoT devices) with higher levels
of autonomy in uncertain and dynamically changing environments. Among such information
systems are Cyber-Physical Systems (CPS) from which emerges a new generation of AI-intensive
Cyber-Physical Systems. There are a number of challenges in designing such systems. On one
hand, the existing CPS design methodologies, relying on rather fixed models, face a fundamental
problem because these systems containing learning-enabled components are supposed to learn
from experience and interactions with the environment, and adapt their behaviors accordingly.
It is thus imperative to ensure that their learning-enabled components work correctly. On the
other hand, AI techniques are “unpredictable” due to a lack of formal framework to provide safety
guarantees. In general, the outcomes of learning activities in AI components (e.g., deep neural
nets) are not well-understood and interpretable. When coupling CPS with AI, the increased
heterogeneity in dynamics and behaviors can aggravate the reliability and explainability issues,
if the learning activities are not properly formalized.</p>
      <p>
        In this work we present our recent results in this direction, namely making design of
learningenabled components in AI-intensive CPS more formal. More concretely, we first describe a
method for imitation learning of feedback controllers satisfying temporal specifications. We
then describe an approach for learning temporal specifications from labelled data. In both of
these learning problems, temporal specifications are given in Signal Temporal Logic (STL) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ],
a formal language that finds widespread use in formal methods and increasing adoption in
industry [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
2. Imitation learning for synthesizing state feedback controllers
satisfying temporal specifications
Our goal is to integrate formal specification and validation techniques in the Imitation Learning
(IL) methodology for synthesizing feedback controllers for complex dynamical systems. While
formal methods have the advantage of rigorous formalization and reasoning, they are very
limited in the complexity and scalability of the problems that can be practically solved. Imitation
Learning, also known as learning from demonstrations, involves the process of learning how
to mimic the behavior of an expert by observing their actions in a given task [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. It has many
successful applications in various fields such as robotics, natural language processing, image
and speech recognition.
      </p>
      <p>
        We focus on the problem of training a neural network (NN) (playing the role of a learner)
to imitate a complex controller (playing the role of an expert). The ultimate goal is to replace
this complex controller with a trained NN. NNs have long been used to control dynamical
systems from inverted pendulums to quadcopters, learning from scratch to control the plant
by maximizing an expected reward, e.g. [
        <xref ref-type="bibr" rid="ref4 ref5">4, 5</xref>
        ]. NNs can also be trained to replace an existing
controller that is unsatisfactory for non-functional reasons, e.g., computationally expensive
(consider model-predictive control [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]), slow, or energy intensive. A well-trained NN controller
can provide similar control performance much faster and is readily implemented on cheap and
energy-eficient embedded platforms [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>To make such an imitation learning framework more formal and more eficient, we add the
following novel features: (i) a formalization of performance evaluation for both the learner’s
and expert’s policies using their abilities to satisfy requirements specified by temporal logic, (ii)
a leverage of the power of existing temporal logic property falsification tools to create correct
training data, (iii) a new method of data aggregation in order to guarantee a good performance
of NN in terms of imitation and generalization.</p>
      <p>To explain these features, we point out some major dificulties in this problem. Training a NN
to imitate a feedback controller is more complex than the problem of approximating a function
using pairs of input and output values, since feedback controllers can themselves be stateful
dynamical systems. We identify the following dificulties in data generation by executing the
nominal controller in closed loop:
• Infinite behavior space. The behavior space is not only large but can also be infinite. It is
thus important to define a coverage measure to quantify how representative the generated
training data is.
• Non-uniform accuracy. Depending on the control requirement, the NN may need to
be very precise around some region of the state space while in other regions a rough
approximation is acceptable.</p>
      <p>
        Formal control requirements. The problem of non-uniform accuracy is particularly
pronounced when the requirement depends on time or sequences of events. This is frequently the
case in control applications, where properties such as rise time, settling time, and overshoot are
typical. We consider complex properties that can include not only time but also causal
relationships. They can be conveniently described in Signal Temporal Logic (STL) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. An STL formula 
consists of atomic predicates along with logical and temporal operators. Atomic predicates are
defined over signal values and have the form (()) ∼ 0, where  is a scalar-valued function
over the signal  evaluated at time  and ∼∈ { &lt;, ≤ , &gt;, ≥ , =, ̸=}. Temporal operators “always”
(□ ), “eventually” (♢ ), and “until” ( ) have the usual meaning and are scoped using intervals of
the form (, ), (, ], [, ), [, ], or (, ∞), where ,  ∈ R0+ and  &lt; .
      </p>
      <p>Additionally, in order to allow some quantitative behavioral flexibility, we use parametric
STL (PSTL) to specify the expected properties of a nominal controller. Then, we want to train
a neural network-based controller achieving performance comparable to that of the nominal
controller, as measured by valid parameters of the PSTL requirement. Parametric STL (PSTL)
is a variant of STL which makes it possible to replace numeric constants in an STL formula
with symbolic variables or parameters. For instance, the formula  = □ [0, ](‖()‖ &lt; ) with
two parameters  and  expresses the requirement that during  seconds, the norm of signal
 should be less than . For example, (2) defines a formula requiring that if the system is not
stabilizing (that is, the formula  st is not satisfied), then it should eventually stabilize, i.e., after
at most  tr seconds,  st should remain true for at least  st seconds.</p>
      <p>
        st := ‖()‖ &lt; st
 st := ¬ st ⇒ ♢ [0, tr]□ [0, st] st
(1)
(2)
Control policy performance measure and imitation learning quality. In imitation
learning, it is essential to have an appropriate measure of performance of control policies,
especially when it is unclear what reward function is being optimized [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. In our framework, we
use the relation between the parameters in the PSTL requirements to compare the performance
of diferent controllers. E.g., for the stabilization requirement (2), for a given size st of the
neighborhood around the equilibrium, the smaller the stabilization time  st is, the faster the
controller is. Given a compact set (Φ) parameter valuations for a formula Φ is compact, any
controller  defines a partition of this set into falsified and valid formulas, which are separated
by the Pareto front [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]; that means no parameter can be improved without compromising the
others. We use the relative volumes of the validity and invalidity sets to measure and compare
performance of controllers. This notion of policy performance to quantify the diference between
the policy of the learner and the expert is necessary to assess the imitation quality.
      </p>
      <p>Finally our state feedback controller imitation learning can be formally stated as follows.
Given a plant , a nominal controller  such that the closed-loop system || satisfies a PSTL
specification Φ , our problem is to learn a neural network controller  to imitate  such that
the closed-loop system  || satisfies Φ , and the performance similarity  ,Φ(,  ) is as small
as possible.</p>
      <p>Learning guidance. The learning guidance here is provided using positive examples, i.e. good
behaviors, generated by the nominal controller which already satisfies the desired requirement.</p>
      <p>
        While observing closed-loop behaviors may reduce the number of behaviors to be sampled,
we still need to find good training samples that are relevant to an STL property. To do this, we
ifnd counter-examples that are closed-loop behaviors violating this property by leveraging the
existing falsification tools [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. A falsification process can also be useful in providing correctness
guarantees for the resulting NN. Indeed, if no counter-example is found after a suficiently large
number of scenarios, we consider the NN controller satisfactory and stop. If a counter-example
is found, we replay the nominal controller from the counter-example situation in order to obtain
new training data, and retrain the neural network. This new data creation is crucial for the
eficiency of the process of correcting counter-examples as well as assuring good generalization
of the NN. To this end, we propose a dataset aggregation-based learning methodology. This
methodology also tailored to provide data representing diverse settings that the NN should
learn to cope with, which is captured by a coverage measure using -net [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] to quantify how
well a finite set of sampled states covers the reachable set. We propose a simple grid-based
method to construct -nets satisfying a separation requirement.
      </p>
      <p>Finally, we demonstrate our approach on a robotic case study where a NN controller is
designed to imitate a model-predictive controller.</p>
    </sec>
    <sec id="sec-2">
      <title>3. Temporal Logic Specification Learning</title>
      <p>
        The success of learning in AI has also impacted the field of formal modelling and specification.
We focus here on supervised learning, and use parametric temporal logics (PSTL) [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] to
represent the hypothesis class, and observations given as time-series labelled by experts. Note that
this work has also been extended to Parametric Timed Regular Expressions [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] as specification
formalism [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. From the labelled data we compute the hypothesis that is most suitable in
expressing the relation between the observations and the labelling. Given a PSTL formula,
the structure of the formula is known but the parameters are not. The process of finding the
parameter values for which the resulting STL formula is satisfied over all the observations is
called parametric identification. Instead of strict parametric identification, we compute the
parameter values for which the formula approximately matches the observations within the user
defined bounds on the false positive and false negative error rates. To define such quantities, we
show that one can use neither counts of time points or of intervals nor the Lebesgue measure
since, and hence we adapt the notion of  -separated set from information theory [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] to propose
a new measure with suitable properties, called  -count, to reflect how much a Boolean signal is
true.
      </p>
      <p>
        Parametric Pattern Predictors (PPP) can be defined as specifications, for a given value of
parameters, take an observation and produce a Boolean signal which is true where a pattern
is predicted an false elsewhere [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. Increasing Parametric Pattern Predictors (IPPP) are the
class where increasing the parameter values augments the set of time points where the pattern
is predicted. We show how finding pattern predictors is linked to the problem of exploring
Pareto optimal sets using queries, and propose an algorithm that approximately computes
the intersection set contained between two Pareto optimal sets of opposite polarities. The
crucial idea behind the algorithm is binary search adapted to continuous intervals and multiple
dimensions. We demonstrate the approach with analysis of labelled electrocardiograms (ECG).
Acknowledgments. The results discussed in this extended abstract were obtained within
the collaboration with Eugene Asarin, Nicolas Basset, Alexandre Donzé, Inzemamul Haque,
Nikolaos Kekatos, Akshay Mambakam, José Ignacio Requeno Jarabo, and Indranil Saha. This
work is partially supported by the Indo-French Collaborative research project FOVERAS funded
by IFCPAR/CEFIPRA, joint French-Japanese ANR-JST project CyPhAI, the ANR project Maveriq,
and the Auvergne-Rhône-Alpes Region Project DetAI.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>O.</given-names>
            <surname>Maler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nickovic</surname>
          </string-name>
          ,
          <article-title>Monitoring temporal properties of continuous signals</article-title>
          ,
          <source>in: FORMATS/FTRTFT</source>
          , volume
          <volume>3253</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2004</year>
          , pp.
          <fpage>152</fpage>
          -
          <lpage>166</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>E.</given-names>
            <surname>Bartocci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Deshmukh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Donzé</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Fainekos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Maler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Ničković</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sankaranarayanan</surname>
          </string-name>
          ,
          <article-title>Specification-based monitoring of cyber-physical systems: a survey on theory, tools and applications</article-title>
          ,
          <source>in: Lectures on Runtime Verification</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>135</fpage>
          -
          <lpage>175</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Schaal</surname>
          </string-name>
          ,
          <article-title>Learning from demonstration</article-title>
          ,
          <source>in: Advances in Neural Information Processing Systems</source>
          ,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M. T.</given-names>
            <surname>Hagan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. B.</given-names>
            <surname>Demuth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O. D.</given-names>
            <surname>Jesús</surname>
          </string-name>
          ,
          <article-title>An introduction to the use of neural networks in control systems</article-title>
          ,
          <source>International Journal of Robust and Nonlinear Control: IFAC-Afiliated Journal</source>
          <volume>12</volume>
          (
          <year>2002</year>
          )
          <fpage>959</fpage>
          -
          <lpage>985</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>C.</given-names>
            <surname>Nicol</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. J. B.</given-names>
            <surname>Macnab</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ramirez-Serrano</surname>
          </string-name>
          ,
          <article-title>Robust neural network control of a quadrotor helicopter</article-title>
          ,
          <source>in: Canadian Conference on Electrical and Computer Engineering</source>
          ,
          <year>2008</year>
          , pp.
          <fpage>1233</fpage>
          -
          <lpage>1238</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>C. E.</given-names>
            <surname>Garcia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. M.</given-names>
            <surname>Prett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Morari</surname>
          </string-name>
          ,
          <article-title>Model predictive control: Theory and practice-a survey</article-title>
          ,
          <source>Automatica</source>
          <volume>25</volume>
          (
          <year>1989</year>
          )
          <fpage>335</fpage>
          -
          <lpage>348</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>P.</given-names>
            <surname>Varshney</surname>
          </string-name>
          , G. Nagar,
          <string-name>
            <surname>I. Saha</surname>
          </string-name>
          , Deepcontrol:
          <article-title>Energy-eficient control of a quadrotor using a deep neural network</article-title>
          ,
          <source>in: IEEE/RSJ International Conference on Intelligent Robots and Systems</source>
          ,
          <year>2019</year>
          , pp.
          <fpage>43</fpage>
          -
          <lpage>50</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>T.</given-names>
            <surname>Osa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Pajarinen</surname>
          </string-name>
          , G. Neumann,
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Bagnell</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Abbeel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Peters</surname>
          </string-name>
          ,
          <article-title>An algorithmic perspective on imitation learning</article-title>
          , CoRR abs/
          <year>1811</year>
          .06711 (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>V.</given-names>
            <surname>Pareto</surname>
          </string-name>
          ,
          <article-title>Manuel d'é conomie politique</article-title>
          ,
          <source>Bull. Amer. Math. Soc 18</source>
          (
          <year>1912</year>
          )
          <fpage>462</fpage>
          -
          <lpage>474</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>A.</given-names>
            <surname>Donzé</surname>
          </string-name>
          ,
          <article-title>Breach, A toolbox for verification and parameter synthesis of hybrid systems</article-title>
          , in: Computer Aided Verification, 22nd International Conference, Springer,
          <year>2010</year>
          , pp.
          <fpage>167</fpage>
          -
          <lpage>170</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>A. N.</given-names>
            <surname>Kolmogorov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. M.</given-names>
            <surname>Tikhomirov</surname>
          </string-name>
          , -entropy and
          <article-title>-capacity of sets in function spaces</article-title>
          ,
          <source>Uspekhi Matematicheskikh Nauk</source>
          <volume>14</volume>
          (
          <year>1959</year>
          )
          <fpage>3</fpage>
          -
          <lpage>86</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>E.</given-names>
            <surname>Asarin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Donzé</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Maler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nickovic</surname>
          </string-name>
          ,
          <article-title>Parametric identification of temporal properties</article-title>
          , in: RV, volume
          <volume>7186</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2011</year>
          , pp.
          <fpage>147</fpage>
          -
          <lpage>160</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>E.</given-names>
            <surname>Asarin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Caspi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Maler</surname>
          </string-name>
          , Timed regular expressions,
          <source>J. ACM</source>
          <volume>49</volume>
          (
          <year>2002</year>
          )
          <fpage>172</fpage>
          -
          <lpage>206</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>A.</given-names>
            <surname>Mambakam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Asarin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Basset</surname>
          </string-name>
          , T. Dang,
          <article-title>Pattern matching and parameter identification for parametric timed regular expressions</article-title>
          ,
          <source>in: Proceedings of the 26th ACM International Conference on Hybrid Systems: Computation and Control</source>
          ,
          <string-name>
            <surname>HSCC</surname>
          </string-name>
          <year>2023</year>
          , San Antonio, TX, USA, May 9-
          <issue>12</issue>
          ,
          <year>2023</year>
          , ACM,
          <year>2023</year>
          , pp.
          <volume>14</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>14</lpage>
          :
          <fpage>13</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>N.</given-names>
            <surname>Basset</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Dang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Mambakam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. R.</given-names>
            <surname>Jarabo</surname>
          </string-name>
          ,
          <article-title>Learning specifications for labelled patterns</article-title>
          , in: N.
          <string-name>
            <surname>Bertrand</surname>
          </string-name>
          , N. Jansen (Eds.),
          <source>Formal Modeling and Analysis of Timed Systems - 18th International Conference, FORMATS 2020</source>
          , Vienna, Austria, September 1-
          <issue>3</issue>
          ,
          <year>2020</year>
          , Proceedings, volume
          <volume>12288</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2020</year>
          , pp.
          <fpage>76</fpage>
          -
          <lpage>93</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>