Multi-Armed Bandits for Boolean Connectives in Hybrid System Falsification (Extended Version)

Hybrid system falsification is an actively studied topic, as a scalable quality assurance methodology for real-world cyber-physical systems. In falsification, one employs stochastic hill-climbing optimization to quickly find a counterexample input to a black-box system model. Quantitative robust semantics is the technical key that enables use of such optimization. In this paper, we tackle the so-called scale problem regarding Boolean connectives that is widely recognized in the community: quantities of different scales (such as speed [km/h] vs. RPM, or worse, RPH) can mask each other's contribution to robustness. Our solution consists of integration of the multi-armed bandit algorithms in hill climbing-guided falsification frameworks, with a technical novelty of a new reward notion that we call hill-climbing gain. Our experiments show our approach's robustness under the change of scales, and that it outperforms a state-of-the-art falsification tool.


Introduction
Hybrid System Falsification Quality assurance of cyber-physical systems (CPS) is attracting growing attention from both academia and industry, not only because it is challenging and scientifically interesting, but also due to the safety-critical nature of many CPS. The combination of physical systems (with continuous dynamics) and digital controllers (that are inherently discrete) is referred to as hybrid systems, capturing an important aspect of CPS. To verify hybrid systems is intrinsically hard, because the continuous dynamics therein leads to infinite search spaces.
More researchers and practitioners are therefore turning to optimization-based falsification as a quality assurance measure for CPS. The problem is formalized as follows.
The falsification problem -Given: a model M (that takes an input signal u and yields an output signal M(u)), and a specification ϕ (a temporal formula) -Find: a falsifying input, that is, an input signal u such that the corresponding output M(u) violates ϕ   In optimization-based falsification, the above problem is turned into an optimization problem. It is robust semantics of temporal formulas [12,17] that makes it possible. Instead of the Boolean satisfaction relation v |= ϕ, robust semantics assigns a quantity v, ϕ ∈ R ∪ {∞, −∞} that tells us, not only whether ϕ is true or not (by the sign), but also how robustly the formula is true or false. This allows one to employ hill-climbing optimization: we iteratively generate input signals, in the direction of decreasing robustness, hoping that eventually we hit negative robustness. An illustration of robust semantics is in Table 1. We use signal temporal logic (STL) [12], a temporal logic that is commonly used in hybrid system specification. The specification says the speed must always be below 120 during the time interval [0,30]. In the search of an input signal u (e.g. of throttle and brake) whose corresponding output M(u) violates the specification, the quantitative robustness M(u), ϕ gives much more information than the Boolean satisfaction M(u) |= ϕ. Indeed, in Table 1, while Boolean satisfaction fails to discriminate the first two signals, the quantitative robustness indicates a tendency that the second signal is closer to violation of the specification.
In the falsification literature, stochastic algorithms are used for hill-climbing optimization. Examples include simulated annealing (SA), globalized Nelder-Mead (GNM [30]) and covariance matrix adaptation evolution strategy (CMA-ES [6]). Note that the system model M can be black-box: we have only to observe the correspondence between input u and output M(u). Observing an error M(u ) for some input u is sufficient evidence for a system designer to know that the system needs improvement. Besides these practical advantages, optimization-based falsification is an interesting scientific topic: it combines two different worlds of formal reasoning and stochastic optimization.
Challenge: The Scale Problem in Boolean Superposition In the field of hybrid falsificationand more generally in search-based testing-the following problem is widely recognized. We shall call the problem the scale problem (in Boolean superposition).
A problem is that, in the supremum of two real values in (1), one component can totally mask the contribution of the other. In this specific example, the former (rpm) component can have values as big as thousands, while the latter (speed ) component will be in the order of tens. This means that in hill-climbing optimization it is hard to use the information of both signals, as one will be masked. Another related problem is that the efficiency of a falsification algorithm would depend on the choice of units of measure. Imagine replacing rpm with rph in (1), which makes the constant 4000 into 240000, and make the situation even worse.
These problems-that we call the scale problem-occur in many falsification examples, specifically when a specification involves Boolean connectives. We do need Boolean connectives in specifications: for example, many real-world specifications in industry are of the form 2 I (ϕ 1 → ϕ 2 ), requiring that an event ϕ 1 triggers a countermeasure ϕ 2 all the time.
One could use different operators for interpreting Boolean connectives. For example, in [21], ∨ and ∧ are interpreted by + and × over R, respectively. However, these choices do not resolve the scale problem, either. In general, it does not seem easy to come up with a fixed set of operators over R that interpret Boolean connectives and are free from the scale problem. Contribution: Integrating Multi-Armed Bandits into Optimization-Based Falsification As a solution to the scale problem in Boolean superposition that we just described, we introduce a new approach that does not superpose robustness values. Instead, we integrate multi-armed bandits (MAB) in the existing framework of falsification guided by hill-climbing optimization. The MAB problem is a prototypical reinforcement learning problem: a gambler sits in front of a row of slot machines; their performance (i.e. average reward) is not known; the gambler plays a machine in each round and he continues with many rounds; and the goal is to optimize cumulative rewards. The gambler needs to play different machines and figure out their performance, at the cost of the loss of opportunities in the form of playing suboptimal machines.
In this paper, we focus on specifications of the form 2 I (ϕ 1 ∧ ϕ 2 ) and 2 I (ϕ 1 ∨ ϕ 2 ); we call them (conjunctive/disjunctive) safety properties. We identify an instance of the MAB problem in the choice of the formula (out of ϕ 1 , ϕ 2 ) to try to falsify by hill climbing. See Fig. 1. We combine MAB algorithms (such as ε-greedy and UCB1, see §3.2) with hill-climbing optimization, for the purpose of coping with the scale problem in Boolean superposition. This combination is made possible by introducing a novel reward notion for MAB, called hill-climbing gain, that is tailored for this purpose.
We have implemented our MAB-based falsification framework in MATLAB, building on Breach [11]. 3 Our experiments with benchmarks from [7,24,25] demonstrate that our MAB-based approach is a viable one against the scale problem. In particular, our approach is observed to be (almost totally) robust under the change of scaling (i.e. changing units of measure, such as from rpm to rph that we discussed after the formula (1)). Moreover, for the benchmarks taken from the previous works-they do not suffer much from the scale problem-our algorithm performs better than the state-ofthe-art falsification tool Breach [11].
Related Work Besides those we mentioned, we shall discuss some related works.
Formal verification approaches to correctness of hybrid systems employ a wide range of techniques, including model checking, theorem proving, rigorous numerics, nonstandard analysis, and so on [8,14,18,20,22,23,29,32]. These are currently not very successful in dealing with complex real-world systems, due to issues like scalability and black-box components.
Our use of MAB in falsification exemplifies the role of the exploration-exploitation trade-off, the core problem in reinforcement learning. The trade-off has been already discussed in some works on falsification. A recent example is [35], where they use Monte Carlo tree search to force systematic exploration of the space of input signals. Besides MCTS, Gaussian process learning (GP learning) has also attracted attention in machine learning as a clean way of balancing exploitation and exploration. The GP-UCB algorithm is a widely used strategy there. Its use in hybrid system falsification is pursued e.g. in [3,33].
More generally, coverage-guided falsification [1,9,13,28] aims at coping with the exploration-exploitation trade-off. One can set the current work in this context-the difference is that we force systematic exploration on the specification side, not in the input space.
There have been efforts to enhance expressiveness of MTL and STL, so that engineers can express richer intentions-such as time robustness and frequency-in specifications [2,31]. This research direction is orthogonal to ours; we plan to investigate the use of such logics in our current framework.
A similar masking problem around Boolean connectives is discussed in [10,19]. Compared to those approaches, our technique does not need the explicit declaration of input vacuity and output robustness, but it relies on the "hill-climbing gain" reward to learn the significance of each signal.
Finally, the interest in the use of deep neural networks is rising in the field of falsification (as well as in many other fields). See e.g. [4,27].

Preliminaries: Hill Climbing-Guided Falsification
We review a well-adopted methodology for hybrid system falsification, namely the one guided by hill-climbing optimization. It makes essential use of quantitative robust semantics of temporal formulas, which we review too.

Robust Semantics for STL
Our definitions here are taken from [12,17].
Definition 1 ((time-bounded) signal). Let T ∈ R + be a positive real. An M -dimensional signal with a time horizon T is a function w : One main advantage of optimization-based falsification is that a system model can be a black box-observing the correspondence between input and output suffices. We therefore define a system model simply as a function. Definition 3 (STL syntax). We fix a set Var of variables. In STL, atomic propositions and formulas are defined as follows, respectively: α ::≡ f (x 1 , . . . , x N ) > 0, and ϕ :: Here f is an N -ary function f : R N → R, x 1 , . . . , x N ∈ Var, and I is a closed non-singular interval in R ≥0 , i.e. I = [a, b] or [a, ∞) where a, b ∈ R and a < b.
We omit subscripts I for temporal operators if I = [0, ∞). Other common connectives such as →, , 2 I (always) and 3 I (eventually), are introduced as abbreviations: 3 I ϕ ≡ U I ϕ and 2 I ϕ ≡ ¬3 I ¬ϕ. An atomic formula f (x) ≤ c, where c ∈ R, is accommodated using ¬ and the function f (x) := f (x) − c.
Definition 4 (robust semantics [12]). Let w : [0, T ] → R N be an N -dimensional signal, and t ∈ [0, T ). The t-shift of w, denoted by w t , is the time-bounded signal Let w : [0, T ] → R |Var| be a signal, and ϕ be an STL formula. We define the robustness w, ϕ ∈ R ∪ {∞, −∞} as follows, by induction on the construction of formulas. Here and denote infimums and supremums of real numbers, respectively. Their binary version and denote minimum and maximum.
For atomic formulas, w, f (x) > c stands for the vertical margin f (x) − c for the signal w at time 0. A negative robustness value indicates how far the formula is from being true. It follows from the definition that the robustness for the eventually modality is given by w, The above robustness notion taken from [12] is therefore spatial. Other robustness notions take temporal aspects into account, too, such as "how long before the deadline the required event occurs." See e.g. [2,12]. Our choice of spatial robustness in this paper is for the sake of simplicity, and is thus not essential.
The original semantics of STL is Boolean, given as usual by a binary relation |= between signals and formulas. The robust semantics refines the Boolean one in the following sense: w, ϕ > 0 implies w |= ϕ, and w, ϕ < 0 implies w |= ϕ, see [17,Prop. 16]. Optimization-based falsification via robust semantics hinges on this refinement.

Hill Climbing-Guided Falsification
As we discussed in the introduction, the falsification problem attracts growing industrial and academic attention. Its solution methodology by hill-climbing optimization is an established field, too: see [1, 3, 5, 9, 11-13, 15, 26, 28, 33, 36] and the tools Breach [11] and S-TaLiRo [5]. We formulate the problem and the methodology, for later use in describing our multi-armed bandit-based algorithm.
Definition 5 (falsifying input). Let M be a system model, and ϕ be an STL formula.
The use of quantitative robust semantics M(u), ϕ ∈ R ∪ {∞, −∞} in the above problem enables the use of hill-climbing optimization.
Definition 6 (hill climbing-guided falsification). Assume the setting in Def. 5. For finding a falsifying input, the methodology of hill climbing-guided falsification is presented in Algorithm 1.
Here the function HILL-CLIMB makes a guess of an input signal u k , aiming at minimizing the robustness M(u k ), ϕ . It does so, learning from the previous observations u l , M(u l ), ϕ l∈[1,k−1] of input signals u 1 , . . . , u k−1 and their corresponding robustness values (cf. Table 1).
The HILL-CLIMB function can be implemented by various stochastic optimization algorithms. Examples are CMA-ES [6] (used in our experiments), SA, and GNM [30].

Our Multi-Armed Bandit-Based Falsification Algorithm
In this section, we present our contribution, namely a falsification algorithm that addresses the scale problem in Boolean superposition (see §1). The main novelties in the algorithm are as follows.

Algorithm 1 Hill climbing-guided falsification
Require: a system model M, an STL formula ϕ, and a budget K 1: function HILL-CLIMB-FALSIFY(M, ϕ, K) 2: rb ← ∞ ; k ← 0 rb is the smallest robustness so far, initialized to ∞ 3: while rb ≥ 0 and k ≤ K do 4: , ϕ < 0 Failure otherwise, that is, no falsifying input found within budget K 9: return u 1. (Use of MAB algorithms) For binary Boolean connectives, unlike most works in the field, we do not superpose the robustness values of the constituent formulas ϕ 1 and ϕ 2 using a fixed operator (such as and in (2)). Instead, we view the situation as an instance of the multi-armed bandit problem (MAB): we use an algorithm for MAB to choose one formula ϕ i to focus on (here i ∈ {1, 2}); and then we apply hill climbing-guided falsification to the chosen formula ϕ i . 2. (Hill-climbing gain as rewards in MAB) For our integration of MAB and hillclimbing optimization, the technical challenge is find a suitable notion of reward for MAB. We introduce a novel notion that we call hill-climbing gain: it formulates the (downward) robustness gain that we would obtain by applying hill-climbing optimization, suitably normalized using the scale of previous robustness values. Later, in §4, we demonstrate that combining those two features gives rise to falsification algorithms that successfully cope with the scale problem in Boolean superposition.
Our algorithms focus on a fragment of STL as target specifications. They are called (disjunctive and conjunctive) safety properties. In §3.1 we describe this fragment of STL, and introduce necessary adaptation of the semantics. After reviewing the MAB problem in §3.2, we present our algorithms in §3.3-3.4.

Conjunctive and Disjunctive Safety Properties
Definition 7 (conjunctive/disjunctive safety property). An STL formula of the form 2 I (ϕ 1 ∧ϕ 2 ) is called a conjunctive safety property; an STL formula of the form 2 I (ϕ 1 ∨ ϕ 2 ) is called a disjunctive safety property.
It is known that, in industry practice, a majority of specifications is of the form 2 I (ϕ 1 → ϕ 2 ), where ϕ 1 describes a trigger and ϕ 2 describes a countermeasure that should follow. This property is equivalent to 2 I (¬ϕ 1 ∨ ϕ 2 ), and is therefore a disjunctive safety property.
In §3.3-3.4, we present two falsification algorithms, for conjunctive and disjunctive safety properties respectively. For the reason we just discussed, we expect the disjunctive algorithm should be more important in real-world application scenarios. In fact, the disjunctive algorithm turns out to be more complicated, and it is best introduced as an extension of the conjunctive algorithm.
We define the restriction of robust semantics to a (sub)set of time instants. Note that we do not require S ⊆ [0, T ] to be a single interval.
be a signal, ψ be an STL formula, and S ⊆ [0, T ] be a subset. We define the robustness of w under ψ restricted to S by w, ψ S := t∈S w t , ψ . ( Obviously, w, ψ S < 0 implies that there exists t ∈ S such that w t , ψ S < 0. We derive the following easy lemma; it is used later in our algorithm. Lemma 9. In the setting of Def. 8, consider a disjunctive safety property ϕ ≡ 2 I (ϕ 1 ∨ ϕ 2 ), and let S :

The Multi-Armed Bandit (MAB) Problem
The multi-armed bandit (MAB) problem describes a situation where, a gambler sits in front of a row A 1 , . . . , A n of slot machines; each slot machine A i gives, when its arm is played (i.e. in each attempt), a reward according to a prescribed (but unknown) probability distribution µ i ; and the goal is to maximize the cumulative reward after a number of attempts, playing a suitable arm in each attempt. The best strategy of course is to keep playing the best arm A max , i.e. the one whose average reward avg(µ max ) is the greatest. This best strategy is infeasible, however, since the distributions µ 1 , . . . , µ n are initially unknown. Therefore the gambler must learn about µ 1 , . . . , µ n through attempts.
The MAB problem exemplifies the "learning by trying" paradigm of reinforcement learning, and is thus heavily studied. The greatest challenge is to balance between exploration and exploitation. A greedy (i.e. exploitation-only) strategy will play the arm whose empirical average reward is the maximum. However, since the rewards are random, this way the gambler can miss another arm whose real performance is even better but which is yet to be found so. Therefore one needs to mix exploration, too, occasionally trying empirically non-optimal arms, in order to identity their true performance.
The relevance of MAB to our current problem is as follows. Falsifying a conjunctive safety property 2 I (ϕ 1 ∧ ϕ 2 ) amounts to finding a time instant t ∈ I at which either ϕ 1 or ϕ 2 is falsified. We can see the two subformulas (ϕ 1 and ϕ 2 ) as two arms, and this constitutes an instance of the MAB problem. In particular, playing an arm translates to a falsification attempt by hill climbing, and collecting rewards translates to spending time to minimize the robustness. We show in §3.3-3.4 that this basic idea extends to disjunctive safety properties 2 I (ϕ 1 ∨ ϕ 2 ), too.
A rigorous formulation of the MAB problem is presented for the record.

Algorithm 2 The ε-greedy algorithm for multi-armed bandits
Require: the setting of Def. 10, and a constant ε > 0 (typically very small) At the k-th attempt, choose the arm Ai k as follows 1: jemp-opt ← arg max the arm that is empirically optimal Definition 10 (the multi-armed bandit problem). The multi-armed bandit (MAB) problem is formulated as follows. Input: arms (A 1 , . . . , A n ), the associated probability distributions µ 1 , . . . , µ n over R, and a time horizon Here the reward rew k of the k-th attempt is sampled from the distribution µ i k associated with the arm A i k played at the k-th attempt.
We introduce some notations for later use. Let (A i1 . . . A i k , rew 1 . . . rew k ) be a history, i.e. the sequence of arms played so far (here i 1 , . . . , i k ∈ [1, n]), and the sequence of rewards obtained by those attempts (rew l is sampled from µ i l ). For the average return of the arm A j in the history. When the history is obvious from the context, we simply write N (j, k) and R(j, k).

MAB Algorithms
There have been a number of algorithms proposed for the MAB problem; each of them gives a strategy (also called a policy) that tells which arm to play, based on the previous attempts and their rewards. The focus here is how to resolve the exploration-exploitation trade-off. Here we review two well-known algorithms.
The ε-Greedy Algorithm This is a simple algorithm that spares a small fraction ε of chances for empirically non-optimal arms. The spared probability ε is uniformly distributed. See Algorithm 2.
The UCB1 Algorithm The UCB1 (upper confidence bound) algorithm is more complex; it comes with a theoretical upper bound for regrets, i.e. the gap between the expected cumulative reward and the optimal (but infeasible) cumulative reward (i.e. the result of keep playing the optimal arm A max ). It is known that the UCB1 algorithm's regret is at most O( √ nH log H) after H attempts, improving the naive random strategy (which has the expected regret O(H)).
See Alg. 3. The algorithm is deterministic, and picks the arm that maximizes the value shown in Line 1. The first term R(j, k − 1) is the exploitation factor, reflecting the arm's empirical performance. The second term is the exploration factor. Note that it is bigger if the arm A j has been played less frequently. Note also that the exploration rb ← ∞ ; k ← 0 rb is the smallest robustness seen so far, for either 2I ϕ1 or 2I ϕ2 3: while rb ≥ 0 and k ≤ K do iterate if not yet falsified, and within budget 4: k ← k + 1 5: such that i l =i k suggestion of the next input u k by hill climbing, based on the previous observations on the formula ϕi k (those on the other formula are ignored) 7: The same as Algorithm 4, except that Line 7 is replaced by the following Line 7'.
, ϕ i k < 0 here ϕ i k denotes the other formula than ϕi k , among ϕ1, ϕ2 factor eventually decays over time: the denominator grows roughly with O(k), while the numerator grows with O(ln k).

Our MAB-Guided Algorithm I: Conjunctive Safety Properties
Our first algorithm targets at conjunctive safety properties. It is based on our identification of MAB in a Boolean conjunction in falsification-this is as we discussed just above Def. 10. The technical novelty lies in the way we combine MAB algorithms and hill-climbing optimization; specifically, we introduce the notion of hill-climbing gain as a reward notion in MAB (Def. 11). This first algorithm paves the way to the one for disjunctive safety properties, too ( §3.4).
The algorithm is in Algorithm 4. Some remarks are in order.
Algorithm 4 aims to falsify a conjunctive safety property ϕ ≡ 2 I (ϕ 1 ∧ ϕ 2 ). Its overall structure is to interleave two sequences of falsification attempts, both of which are hill climbing-guided. These two sequences of attempts aim to falsify 2 I ϕ 1 and 2 I ϕ 2 , respectively. Note that M(u), ϕ ≤ M(u), 2 I ϕ 1 , therefore falsification of 2 I ϕ 1 implies falsification of ϕ; the same holds for 2 I ϕ 2 , too.
In Line 5 we run an MAB algorithm to decide which of 2 I ϕ 1 and 2 I ϕ 2 to target at in the k-th attempt. The function MAB takes the following as its arguments: 1) the list of arms, given by the formulas ϕ 1 , ϕ 2 ; 2) their rewards R(ϕ 1 ), R(ϕ 2 ); 3) the history ϕ i1 . . . ϕ i k−1 of previously played arms (i l ∈ {1, 2}); and 4) the history rew 1 . . . rew k−1 of previously observed rewards. This way, the type of the MAB function in Line 5 matches the format in Def. 10, and thus the function can be instantiated with any MAB algorithm such as Algorithms 2-3.
The only missing piece is the definition of the rewards R(ϕ 1 ), R(ϕ 2 ). We introduce the following notion, tailored for combining MAB and hill climbing.

Definition 11 (hill-climbing gain). In Algorithm 4, in Line 5, the reward
if ϕ i has been played before 0 otherwise Here max-rb(i, k − 1) := max{rb l | l ∈ [1, k − 1], i l = i} (i.e. the greatest rb l so far, in those attempts where ϕ i was played), and last-rb(i, k − 1) := rb l last with l last being the greatest l ∈ [1, k − 1] such that i l = i (i.e. the last rb l for ϕ i ).
Since we try to minimize the robustness values rb l through falsification attempts, we can expect that rb l for a fixed arm ϕ i decreases over time. (In the case of the hillclimbing algorithm CMA-ES that we use, this is in fact guaranteed). Therefore the value max-rb(i, k − 1) in the definition of R(ϕ i ) is the first observed robustness value. The numerator max-rb(i, k − 1) − last-rb(i, k − 1) then represents how much robustness we have reduced so far by hill climbing-hence the name "hill-climbing gain." The denominator max-rb(i, k − 1) is there for normalization. In Algorithm 4, the value rb k is given by the robustness M(u k ), 2 I ϕ i k . Therefore the MAB choice in Line 5 essentially picks i k for which hill climbing yields greater effect (but also taking exploration into account-see §3.2).
In Line 6 we conduct hill-climbing optimization-see §2.2. The function HILL-CLIMB learns from the previous attempts u l1 , . . . , u lm regarding the same formula ϕ i k , and their resulting robustness values rb l1 , . . . , rb lm . Then it suggests the next input signal u k that is likely to minimize the (unknown) function that underlies the correspondences u lj → rb lj j∈ [1,m] .
Lines 6-8 read as follows: the hill-climbing algorithm suggests a single input u k , which is then selected or rejected (Line 8) based on the robustness value it yields (Line 7). We note that this is a simplified picture: in our implementation that uses CMA-ES (it is an evolutionary algorithm), we maintain a population of some ten particles, and each of them is moved multiple times (our choice is three times) before the best one is chosen as u k .

Our MAB-Guided Algorithm II: Disjunctive Safety Properties
The other main algorithm of ours aims to falsify a disjunctive safety property ϕ ≡ 2 I (ϕ 1 ∨ ϕ 2 ). We believe this problem setting is even more important than the conjunctive case, since it encompasses conditional safety properties (i.e. of the form 2 I (ϕ 1 → ϕ 2 )). See §3.1 for discussions.
In the disjunctive setting, the challenge is that falsification of 2 I ϕ i (with i ∈ {1, 2}) does not necessarily imply falsification of 2 I (ϕ 1 ∨ ϕ 2 ). This is unlike the conjunctive setting. Therefore we need some adaptation of Algorithm 4, so that the two interleaved sequences of falsification attempts for ϕ 1 and ϕ 2 are not totally independent of each other. Our solution consists of restricting time instants to those where ϕ 2 is false, in a falsification attempt for ϕ 1 (and vice versa), in the way described in Def. 8.
Algorithm 5 shows our MAB-guided algorithm for falsifying a disjunctive safety property 2 I (ϕ 1 ∨ ϕ 2 ). The only visible difference is that Line 7 in Algorithm 4 is replaced with Line 7'. The new Line 7' measures the quality of the suggested input signal u k in the way restricted to the region S k in which the other formula is already falsified. Lem. 9 guarantees that, if rb k < 0, then indeed the input signal u k falsifies the original specification 2 I (ϕ 1 ∨ ϕ 2 ).
The assumption that makes Alg. 5 sensible is that, although it can be hard to find a time instant at which both ϕ 1 and ϕ 2 are false (this is required in falsifying 2 I (ϕ 1 ∨ ϕ 2 )), falsifying ϕ 1 (or ϕ 2 ) individually is not hard. Without this assumption, the region S k in Line 7' would be empty most of the time. Our experiments in §4 demonstrate that this assumption is valid in many problem instances, and that Alg. 5 is effective.

Experimental Evaluation
We name MAB-UCB and MAB--greedy the two versions of MAB algorithm using strategies ε-Greedy (see Alg. 2) and UCB1 (see Alg. 3). We compared the proposed approach (both versions MAB-UCB and MAB--greedy) with a state-of-the-art falsification framework, namely Breach [11]. Breach encapsulates several hill-climbing optimization algorithms, including CMA-ES (covariance matrix adaptation evolution strategy) [6], SA (simulated annealing), GNM (global Nelder-Mead) [30], etc. According to our experience, CMA-ES outperforms other hill-climbing solvers in Breach, so the experiments for both Breach and our approach rely on the CMA-ES solver.
Benchmarks We selected three benchmark models from the literature, each one having different specifications. The first one is the Automatic Transmission (AT) model [16,24]. It has two input signals, throttle∈[0, 100] and brake∈[0, 325], and computes the car's speed , engine rotation in rounds per minute rpm, and the automatically selected gear . The specifications concern the relation between the three output signals to check whether the car is subject to some unexpected or unsafe behaviors. The second benchmark is the Abstract Fuel Control (AFC) model [16,25]. It takes two input signals, pedal angle∈ [8.8, 90] and engine speed∈[900, 1100], and outputs the critical signal airfuel ratio (AF ), which influences fuel efficiency and car performance. The value is

(b) Sbench
Spec ID scaled factor 10 k output AT11 speed k ∈{-2,0,1,3} expected to be close to a reference value AFref ; mu≡ |AF −AFref | /AFref is the deviation of AF from AFref . The specifications check whether this property holds under both normal mode and power enrichment mode. The third benchmark is a model of a magnetic levitation system with a NARMA-L2 neurocontroller (NN) [7,16]. It takes one input signal, Ref ∈ [1,3], which is the reference for the output signal Pos, the position of a magnet suspended above an electromagnet. The specifications say that the position should approach the reference signal in a few seconds when these two are not close.
We built the benchmark set Bbench, as shown in Table 2a that reports the name of the model and its specifications (ID and formula). In total, we found 11 specifications. In order to increase the benchmark set and obtain specifications of different complexity, we artificially modified a constant (turned into a parameter named τ if it is contained in a time interval, named ρ otherwise) of the specification: for each specification S, we generated m different versions, named as S i with i ∈ {1, . . . , m}; the complexity of the specification (in terms of difficulty to falsify it) increases with increasing i. 4 In total, we produced 60 specifications. Column parameter in the table shows which concrete values we used for the parameters ρ and τ . Note that all the specifications but one are disjunctive safety properties (i.e., 2 I (ϕ 1 ∨ ϕ 2 )), as they are the most difficult case and they are the main target of our approach; we just add AT5 as example of conjunctive safety property (i.e., 2 I (ϕ 1 ∧ ϕ 2 )).
Our approach has been proposed with the aim of tackling the scale problem. Therefore, to better show how our approach mitigates this problem, we generated a second benchmark set Sbench as follows. We selected 15 specifications from Bbench (with concrete values for the parameters) and, for each specification S, we changed the corresponding Simulink model by multiplying one of its outputs by a factor 10 k , with k ∈ {−2, 0, 1, 2, 3} (note that we also include the original one using scale factor 10 0 ); the specification has been modified accordingly, by multiplying with the scale factor the constants that are compared with the scaled output. We name a specification S scaled with factor 10 k as S k . Table 2b reports the IDs of the original specifications, the output that has been scaled, and the used scaled factors; in total, the benchmark set Sbench contains 60 specifications . Experiment In our context, an experiment consists in the execution of an approach A (either Breach, MAB--greedy, or MAB-UCB) over a specification S for 30 trials, using different initial seeds. For each experiment, we record the success SR as the number of trials in which a falsifying input was found, and average execution time of the trials. Complete experimental results are reported in Appendix A 5 . We report aggregated results in Table 3. For benchmark set Bbench, it reports aggregated results for each group of specifications obtained from S (i.e., all the different versions S i obtained by changing the value of the parameter); for benchmark set Sbench, instead, results are aggregated for each scaled specification S k (considering the versions S k i obtained by changing the parameter value). We report minimum, maximum and average number of successes SR, and time in seconds. For MAB--greedy and MAB-UCB, both for SR and time, we also report the average percentage difference 6 (∆) w.r.t. to the corresponding value of Breach. Comparison In the following, we compare two approaches A 1 , A 2 ∈ {Breach, MAB---greedy, MAB-UCB } by comparing the number of their successes SR and average execution time using the non-parametric Wilcoxon signed-rank test with 5% level of 5 The code, models, and specifications are available online at https://github.com/ ERATOMMSD/FalStar-MAB. 6 ∆= ((m−b) * 100) /(0.5 * (m+b)) where m is the result of MAB and b the one of Breach. significance 7 [34]; the null hypothesis is that there is no difference in applying A 1 A 2 in terms of the compared measure (SR or time).

Evaluation
We evaluate the proposed approach with some research questions.
RQ1 Which is the best MAB algorithm for our purpose?
In § 3.2, we described that the proposed approach can be executed using two different strategies for choosing the arm in the MAB problem, namely MAB--greedy and MAB-UCB. We here assess which one is better in terms of SR and time. From the results in Table 3, it seems that MAB-UCB provides slightly better performance in terms of SR; this has been confirmed by the Wilcoxon test applied over all the experiments (i.e., on the non-aggregated data reported in Appendix A ): the null hypothesis that using anyone of the two strategies has no impact on SR is rejected with p-value equal to 0.005089, and the alternative hypothesis that SR is better is accepted with p-value=0.9975; in a similar way, the null hypothesis that there is no difference in terms of time is rejected with p-value equal to 3.495e-06, and the alternative hypothesis that is MAB-UCB is faster is accepted with p-value=1. Therefore, in the following RQs, we compare Breach with only the MAB-UCB version of our approach.
RQ2 Does the proposed approach effectively solve the scale problem?
We here assess if our approach is effective in tackling the scale problem. Table 4 reports the complete experimental results over Sbench for Breach and MAB-UCB; for each specification S, all its scaled versions are reported in increasing order of the scaling factor. We observe that changing the scaling factor affects (sometimes greatly) the number of successes SR of Breach; for example, for AT5 5 and AT5 7 it goes from 30 to 0. For MAB-UCB, instead, SR is similar across the scaled versions of each specification: this shows that the approach is robust w.r.t. to the scale problem as the "hill-climbing gain" reward in Def. 11 eliminates the impact of scaling and UCB1 algorithm balances the exploration and exploitation of two sub-formulas. The observation is confirmed by the Wilcoxon test over SR: the null hypothesis is rejected with p-value=1.808e-09, and the alternative hypothesis accepted with p-value=1. Instead, the null hypothesis that there is no difference in terms of time cannot be rejected with p-value=0.3294.
RQ3 How does the proposed process behave with not scaled benchmarks?
In RQ2, we checked whether the proposed approach is able to tackle the scale problem for which it has been designed. Here, instead, we are interested in investigating how it behaves on specifications that have not been artificially scaled (i.e., those in Bbench). From Table 3 (upper part), we observe that MAB-UCB is always better than Breach both in terms of SR and time, which is shown by the highlighted cases. This is confirmed by Wilcoxon test over SR and time: null hypotheses are rejected with pvalues equal to, respectively, 6.02e-08 and 1.41e-08, and the alternative hypotheses that MAB-UCB is better are both accepted with p-value=1. This means that the proposed approach can also handle specifications that do not suffer from the scale problem, and so it can be used with any kind of specification.
RQ4 Is the proposed approach more effective than an approach based on rescaling?
A naïve solution to the scale problem could be to rescale the signals used in specification at the same scale. Thanks to the results of RQ2, we can compare to this possible baseline approach, using the scaled benchmark set Sbench. For example, AT5 suffers from the scale problem as speed is one order of magnitude less than rpm. However, from Table 3, we observe that the scaling that would be done by the baseline approach (i.e., running Breach over AT5 1 ) is not effective, as SR is 0.4/30, that is much lower than the original SR 14.1/30 of the unscaled approach using Breach. Our approach, instead, raises SR to 28.4/30 and to 27.6/30 using the two proposed versions.
The detailed reason is as follows. For example AT5 1 6 , the specification is After artificial scaling of the speed unit (× 10), the scalings for speed and rpm are comparable. Therefore, the baseline approach will consist of simply running Breach for the specification AT5 1 6 . By monitoring Breach execution, we notice that the naïve approach fails because it tries to falsify rpm<4780, which, however, is not falsifiable; our approach, instead, understands that it must try to falsify speed <ρ.
As a result, our MAB-based falsification for Boolean connectives improves efficiency, even in absence of the scale problem. It does so by taking balance between exploration and exploitation, while original Breach (interpreting ∧ by infimum) is purely exploiting.

Conclusion and Future work
In this paper, we propose a solution to the scale problem that affects falsification of specifications containing Boolean connectives. The approach combines multi-armed bandit algorithms with hill climbing-guided falsification. Experiments show that the approach is robust under the change of scales, and it outperforms a state-of-the-art falsification tool. The approach currently handles binary specifications. As future work, we plan to generalize it to complex specifications having more than two Boolean connectives.