verifying switched system stability with logic

19
Verifying Switched System Stability With Logic Yong Kiam Tan Carnegie Mellon University Pittsburgh, PA, USA [email protected] Stefan Mitsch Carnegie Mellon University Pittsburgh, PA, USA [email protected] Andrรฉ Platzer Carnegie Mellon University Pittsburgh, PA, USA [email protected] ABSTRACT Switched systems are known to exhibit subtle (in)stability behav- iors requiring system designers to carefully analyze the stability of closed-loop systems that arise from their proposed switching control laws. This paper presents a formal approach for verifying switched system stability that blends classical ideas from the con- trols and veri๏ฌcation literature using di๏ฌ€erential dynamic logic (dL), a logic for deductive veri๏ฌcation of hybrid systems. From controls, we use standard stability notions for various classes of switching mechanisms and their corresponding Lyapunov function-based analysis techniques. From veri๏ฌcation, we use dLโ€™s ability to verify quanti๏ฌed properties of hybrid systems and dL models of switched systems as looping hybrid programs whose stability can be for- mally speci๏ฌed and proven by ๏ฌnding appropriate loop invariants, i.e., properties that are preserved across each loop iteration. This blend of ideas enables a trustworthy implementation of switched system stability veri๏ฌcation in the KeYmaera X prover based on dL. For standard classes of switching mechanisms, the implementation provides fully automated stability proofs, including searching for suitable Lyapunov functions. Moreover, the generality of the deduc- tive approach also enables veri๏ฌcation of switching control laws that require non-standard stability arguments through the design of loop invariants that suitably express speci๏ฌc intuitions behind those control laws. This ๏ฌ‚exibility is demonstrated on three case studies: a model for longitudinal ๏ฌ‚ight control by Branicky, an automatic cruise controller, and Brockettโ€™s nonholonomic integrator. CCS CONCEPTS โ€ข Theory of computation โ†’ Logic and veri๏ฌcation; Timed and hybrid models; โ€ข Computing methodologies โ†’ Computa- tional control theory; โ€ข Computer systems organization โ†’ Em- bedded systems. KEYWORDS switched system stability, loop invariants, di๏ฌ€erential dynamic logic 1 INTRODUCTION Switched systems provide a powerful mathematical paradigm for the design and analysis of discontinuous (or nondi๏ฌ€erentiable) con- trol mechanisms [10, 22, 28, 44]. Examples of such mechanisms include: bang-bang controllers that switch between on/o๏ฌ€ modes; gain schedulers that switch between a family of locally valid linear controllers; and supervisory control, where a supervisor switches between candidate controllers based on logical criteria [22, 28]. However, switched systems are known to exhibit subtle (in)stability behaviors, e.g., switching between stable subsystems can lead to instability [22], so it is important for system designers to adequately justify the stability of their proposed switching designs. Veri๏ฌcation and validation are complementary approaches for such justi๏ฌca- tions: validation approaches, such as system simulations or lab experiments, allow designers to check that their models and con- trollers conform to real world behavior; veri๏ฌcation approaches yield formal mathematical proofs that the stability properties hold for all possible switching decisions everywhere in the modelโ€™s in๏ฌ- nite state space, not just for ๏ฌnitely-many simulated trajectories. This paper presents a logic-based, deductive approach for veri- fying switched system stability under various classes of switching mechanisms. The key insight is that control-theoretic stability ar- guments for switching control can be formally justi๏ฌed by blending techniques from discrete program veri๏ฌcation with continuous dif- ferential equations analysis using di๏ฌ€erential dynamic logic (dL), a logic for deductive veri๏ฌcation of hybrid systems [33, 34]. In- tuitively, switched systems are modeled in dL as looping hybrid programs [46], as in the following snippet ({ยท} โˆ— denotes repetition): { := ( ) ; // switching controller (discrete dynamics) โ€ฒ = ( ) // actuate decision (continuous dynamics) } โˆ— @invariant( ... ) // switching loop with invariant annotation Accordingly, switched system stability is formally speci๏ฌed in dL as ๏ฌrst-order quanti๏ฌed safety properties of such loops (Section 2.2), and these safety properties can then be proved rigorously by com- bining fundamental ideas from veri๏ฌcation and control, namely: i) identi๏ฌcation of loop invariants (@invariant above), i.e., proper- ties of the (discrete) loop that are preserved across all executions of the loop body, ii) compositional veri๏ฌcation for separately ana- lyzing the discrete and continuous dynamics of the loop body, and iii) Lyapunov functions, i.e., auxiliary energy functions that enable stability analysis for the continuous dynamics. Section 3 identi๏ฌes key loop invariants underlying stability ar- guments for various classes of switching mechanisms and derives sound stability proof rules for those mechanisms. Crucially, these syntactic derivations are built from dLโ€™s sound foundations for hy- brid program reasoning [33, 34], without the need to introduce new mathematical concepts such as non-classical weak solutions or nondi๏ฌ€erentiable Lyapunov functions [9, 16]. Section 4 uses these derivations to implement support for switched systems in the KeY- maera X prover based on dL [12], including a modeling interface for switched systems, automatic search for Lyapunov function can- didates, and sound veri๏ฌcation of switched system stability spec- i๏ฌcations. Notably, the implementation requires no extensions to KeYmaera Xโ€™s soundness-critical core and thereby directly inherits all of KeYmaera Xโ€™s correctness guarantees [12, 25]. This trustwor- thiness is necessary for computer-aided veri๏ฌcation of complex, controlled switching designs, where the number of correctness con- ditions on their Lyapunov functions scales quadratically with the number of switching modes (Section 3.2), making pen-and-paper arXiv:2111.01928v1 [eess.SY] 2 Nov 2021

Upload: others

Post on 11-Dec-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Verifying Switched System Stability With Logic

Verifying Switched System Stability With LogicYong Kiam Tan

Carnegie Mellon University

Pittsburgh, PA, USA

[email protected]

Stefan Mitsch

Carnegie Mellon University

Pittsburgh, PA, USA

[email protected]

Andrรฉ Platzer

Carnegie Mellon University

Pittsburgh, PA, USA

[email protected]

ABSTRACTSwitched systems are known to exhibit subtle (in)stability behav-

iors requiring system designers to carefully analyze the stability

of closed-loop systems that arise from their proposed switching

control laws. This paper presents a formal approach for verifying

switched system stability that blends classical ideas from the con-

trols and verification literature using differential dynamic logic (dL),a logic for deductive verification of hybrid systems. From controls,

we use standard stability notions for various classes of switching

mechanisms and their corresponding Lyapunov function-based

analysis techniques. From verification, we use dLโ€™s ability to verify

quantified properties of hybrid systems and dL models of switched

systems as looping hybrid programs whose stability can be for-

mally specified and proven by finding appropriate loop invariants,i.e., properties that are preserved across each loop iteration. This

blend of ideas enables a trustworthy implementation of switched

system stability verification in the KeYmaera X prover based on dL.For standard classes of switching mechanisms, the implementation

provides fully automated stability proofs, including searching for

suitable Lyapunov functions. Moreover, the generality of the deduc-

tive approach also enables verification of switching control laws

that require non-standard stability arguments through the design of

loop invariants that suitably express specific intuitions behind those

control laws. This flexibility is demonstrated on three case studies:

a model for longitudinal flight control by Branicky, an automatic

cruise controller, and Brockettโ€™s nonholonomic integrator.

CCS CONCEPTSโ€ข Theory of computation โ†’ Logic and verification; Timedand hybrid models; โ€ข Computing methodologies โ†’ Computa-tional control theory; โ€ข Computer systems organization โ†’ Em-bedded systems.

KEYWORDSswitched system stability, loop invariants, differential dynamic logic

1 INTRODUCTIONSwitched systems provide a powerful mathematical paradigm for

the design and analysis of discontinuous (or nondifferentiable) con-

trol mechanisms [10, 22, 28, 44]. Examples of such mechanisms

include: bang-bang controllers that switch between on/off modes;

gain schedulers that switch between a family of locally valid linear

controllers; and supervisory control, where a supervisor switches

between candidate controllers based on logical criteria [22, 28].

However, switched systems are known to exhibit subtle (in)stability

behaviors, e.g., switching between stable subsystems can lead to

instability [22], so it is important for system designers to adequately

justify the stability of their proposed switching designs. Verification

and validation are complementary approaches for such justifica-

tions: validation approaches, such as system simulations or lab

experiments, allow designers to check that their models and con-

trollers conform to real world behavior; verification approaches

yield formal mathematical proofs that the stability properties hold

for all possible switching decisions everywhere in the modelโ€™s infi-

nite state space, not just for finitely-many simulated trajectories.

This paper presents a logic-based, deductive approach for veri-

fying switched system stability under various classes of switching

mechanisms. The key insight is that control-theoretic stability ar-

guments for switching control can be formally justified by blending

techniques from discrete program verification with continuous dif-

ferential equations analysis using differential dynamic logic (dL),a logic for deductive verification of hybrid systems [33, 34]. In-

tuitively, switched systems are modeled in dL as looping hybridprograms [46], as in the following snippet ({ยท}โˆ— denotes repetition):

{ ๐‘ข := ๐‘๐‘ก๐‘Ÿ๐‘™ (๐‘ฅ); // switching controller (discrete dynamics)

๐‘ฅ โ€ฒ = ๐‘“๐‘ข (๐‘ฅ) // actuate decision (continuous dynamics)

}โˆ—@invariant( ... ) // switching loop with invariant annotation

Accordingly, switched system stability is formally specified in dLas first-order quantified safety properties of such loops (Section 2.2),

and these safety properties can then be proved rigorously by com-

bining fundamental ideas from verification and control, namely:

i) identification of loop invariants (@invariant above), i.e., proper-

ties of the (discrete) loop that are preserved across all executions

of the loop body, ii) compositional verification for separately ana-

lyzing the discrete and continuous dynamics of the loop body, and

iii) Lyapunov functions, i.e., auxiliary energy functions that enable

stability analysis for the continuous dynamics.

Section 3 identifies key loop invariants underlying stability ar-

guments for various classes of switching mechanisms and derives

sound stability proof rules for those mechanisms. Crucially, these

syntactic derivations are built from dLโ€™s sound foundations for hy-

brid program reasoning [33, 34], without the need to introduce

new mathematical concepts such as non-classical weak solutions or

nondifferentiable Lyapunov functions [9, 16]. Section 4 uses these

derivations to implement support for switched systems in the KeY-

maera X prover based on dL [12], including a modeling interface

for switched systems, automatic search for Lyapunov function can-

didates, and sound verification of switched system stability spec-

ifications. Notably, the implementation requires no extensions toKeYmaera Xโ€™s soundness-critical core and thereby directly inherits

all of KeYmaera Xโ€™s correctness guarantees [12, 25]. This trustwor-

thiness is necessary for computer-aided verification of complex,

controlled switching designs, where the number of correctness con-

ditions on their Lyapunov functions scales quadratically with the

number of switching modes (Section 3.2), making pen-and-paper

arX

iv:2

111.

0192

8v1

[ee

ss.S

Y]

2 N

ov 2

021

Page 2: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

proofs error-prone or infeasible. Section 5 further applies the deduc-

tive approach on three case studies, chosen because each require

subtle twists to standard switched system stability arguments:

โ€ข Longitudinal flight control [4]: This model is parametric (5

parameters, 2 state variables) and its stability justification

due to Branicky [4] uses a โ€œnoncustomaryโ€ Lyapunov func-

tion [10], whose correctness requires intricate arithmetic

reasoning. The proof is enabled through the use of ghostswitching where virtual switching modes are introduced for

the sake of the stability analysis, similar to the use of ghost

variables in program verification [30, 34, 35].

โ€ข Automatic cruise control [29]: This hybrid automaton switches

between several operating modes, e.g., standard/emergency

braking, accelerating, and PI control, based on specific guard

conditions. Lyapunov function candidates can be numeri-

cally generated [26], but must be corrected for soundness.

โ€ข Brockettโ€™s nonholonomic integrator [7]: A large class of con-

trol systems can be transformed to the nonholonomic in-

tegrator but this system is not stabilizable by continuous

feedback [7, 22]. Instead, the system must be initially con-

trolled into a suitable region where a stabilizing control law

can be applied. The stability argument must show that the

initial control mode does not destabilize the system.

These case studies are verified semi-automatically in KeYmaera X,

with user guidance to design and prove modified loop invariants

that suitably capture the specific intuitions behind their respective

control laws. The flexibility and generality of this paperโ€™s deductive

approach enables suchmodifications while ensuring that the overall

stability argument remains valid. In fact, these modified stability

proofs enjoy exactly the same, strong correctness guarantees thanks

to their formalization within the uniform dL logical foundations.

All proofs are in the appendix.

2 BACKGROUNDThis section briefly recalls switched systems and their hybrid pro-

gram models introduced by Tan and Platzer [46]. The section then

explains how stability for these models can be formally specified

and verified using differential dynamic logic (dL) [33, 34].

2.1 Switched Systems as Hybrid Programs2.1.1 Hybrid Programs. The language of hybrid programs is gen-erated by the following grammar, where ๐‘ฅ is a variable, ๐‘’ is a dLterm, and ๐‘„ is a formula of first-order real arithmetic [33, 34].

๐›ผ, ๐›ฝ ::= ๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„ | ๐‘ฅ := ๐‘’ | ?๐‘„ | ๐›ผ ; ๐›ฝ | ๐›ผ โˆช ๐›ฝ | ๐›ผโˆ—

Continuous dynamics are modeled using systems of ordinary

differential equations (ODEs) ๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„ evolving within do-

main ๐‘„ ; the ODE is written as ๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) when there is no domain

constraint, i.e., ๐‘„ โ‰ก true. Discrete dynamics are modeled using

assignments (๐‘ฅ := ๐‘’ assigns the value of term ๐‘’ to ๐‘ฅ) and tests (?๐‘„

checks whether condition ๐‘„ is true in the current state). The pro-

gram combinators are used to piece together sub-programs to form

programs with hybrid dynamics; the combinators are: sequential

composition (๐›ผ ; ๐›ฝ runs ๐›ผ followed by ๐›ฝ), nondeterministic choice

(๐›ผ โˆช ๐›ฝ runs ๐›ผ or ๐›ฝ nondeterministically), and nondeterministic

repetition (๐›ผโˆ— repeats ๐›ผ for any number of iterations).

Throughout this paper, ๐‘ฅ = (๐‘ฅ1, . . . , ๐‘ฅ๐‘›) denotes the vector

of continuous state variables for the system under consideration.

Other variables are used for program auxiliaries, e.g., to describe

memory and timing components of switching controllers.

2.1.2 Switched systems. A switched system is described by a finite

family P of ODEs ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P and a set of switching signals๐œŽ : [0,โˆž) โ†’ P that prescribe the ODE ๐‘ฅ โ€ฒ = ๐‘“๐œŽ (๐‘ก ) (๐‘ฅ) to follow

at time ๐‘ก along the systemโ€™s evolution. Tan and Platzer [46] use

hybrid programs as formal models for various classes of switching

mechanisms; one example is arbitrary switching [22], where the

system is allowed to follow any switching signal, i.e., it switches

arbitrarily (at any time) between the ODEs ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P. This

can be used to model real world systems whose switching behavior

is uncontrolled or a priori unknown. Arbitrary switching is modeled

by the hybrid program ๐›ผarb [46, Proposition 1]:

๐›ผarb โ‰ก( โ‹ƒ๐‘โˆˆP

๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ))โˆ—

(1)

The behavior of program ๐›ผarb is analogous to a computer simula-

tion of arbitrary switching: on each iteration, the program makes a

(discrete) nondeterministic choice of switching decision

โ‹ƒ๐‘โˆˆP

(ยท)

to select an ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ) which it then follows continuously for

some duration before repeating the simulation loop.

The hybrid programs language can be used to model various

other classes of switching mechanisms [22, 46], including general

controlled switching, as illustrated in Section 1, where a (discrete)

control law ๐‘ข := ๐‘๐‘ก๐‘Ÿ๐‘™ (๐‘ฅ) decides the ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ข (๐‘ฅ) to switch to

on each loop iteration. Stability for these models is explained next.

2.2 Stability as Quantified Loop SafetyThis paper studies uniform global pre-asymptotic stability (UGpAS)

for switched systems [16, 17, 22], defined as follows:

Definition 1 (UGpAS [16, 17]). Let ฮฆ(๐‘ฅ) denote the set of all

(domain-obeying) solutions1 ๐œ‘ : [0,๐‘‡๐œ‘ ] โ†’ R๐‘› for a switched

system from state ๐‘ฅ โˆˆ R๐‘› . The origin 0 โˆˆ R๐‘› is:

โ€ข uniformly globally pre-asymptotically stable if the sys-tem is uniformly stable and uniformly globally pre-attractive,

โ€ข uniformly stable if, for all Y > 0, there exists ๐›ฟ > 0 such

that from all initial states ๐‘ฅ โˆˆ R๐‘› with โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , all solutions

๐œ‘ โˆˆ ฮฆ(๐‘ฅ) satisfy โˆฅ๐œ‘ (๐‘ก)โˆฅ < Y for all times 0 โ‰ค ๐‘ก โ‰ค ๐‘‡๐œ‘ , and

โ€ข uniformly globally pre-attractive if, for all Y > 0, ๐›ฟ > 0,

there exists ๐‘‡ โ‰ฅ 0 such that from all initial states ๐‘ฅ โˆˆ R๐‘›with โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , all solutions ๐œ‘ โˆˆ ฮฆ(๐‘ฅ) satisfy โˆฅ๐œ‘ (๐‘ก)โˆฅ < Y for

all times ๐‘‡ โ‰ค ๐‘ก โ‰ค ๐‘‡๐œ‘ .

The UGpAS definition can be understood intuitively for a system

with a switching control mechanism:

โ€ข stability means the mechanism keeps the system close to the

origin if the system is initially perturbed close to the origin,

โ€ข global pre-attractivity means the mechanism drives the sys-

tem to the origin asymptotically as ๐‘ก โ†’ โˆž, and

โ€ข uniform means the stability and pre-attractivity properties

are independent of both the nondeterminism in the switching

1A formal construction of the (right-maximal) solution ๐œ™ for a given switching signal

๐œŽ is available elsewhere [46, Appendix A].

Page 3: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

mechanism (e.g., arbitrary switching) and the choice of initial

states satisfying โˆฅ๐‘ฅ โˆฅ < ๐›ฟ ; for brevity in subsequent sections,

โ€œuniformโ€ is elided when describing stability properties.

Remark 1. Switched systems whose solutions are all uniformly

bounded in time, i.e., there exists ๐‘‡๐‘š such that for all solutions ๐œ‘ ,

๐‘‡๐œ‘ โ‰ค ๐‘‡๐‘š , are trivially pre-attractive. Goebel et al. [16, 17] intro-

duce the notion of pre-attractivity as opposed to attractivity for

hybrid systems because it separates considerations about whether

a hybrid systemโ€™s solutions are complete, i.e., solutions exist forall (forward) time, from conditions for stability and attractivity.

Indeed, it is common in the hybrid and switched systems literature

to either ignore incomplete solutions or assume the models under

consideration only have complete solutions [22, 26, 49]. Instead of

predicating proofs on these hypotheses, this paper formalizes the

(weaker) notion of UGpAS for switched systems directly.

The definition of UGpAS nests alternating quantification over

real numbers with temporal quantification over the solutions ๐œ‘ of

switched systems. This combination of quantifiers can be expressed

formally using the formula language of dL [33, 34], whose grammar

is shown below, โˆผ โˆˆ {=,โ‰ , โ‰ฅ, >, โ‰ค, <} is a comparison operator

between dL terms ๐‘’, ๐‘’ and ๐›ผ is a hybrid program:

๐œ™,๐œ“ ::= ๐‘’ โˆผ ๐‘’ | ๐œ™ โˆง๐œ“ | ๐œ™ โˆจ๐œ“ | ยฌ๐œ™ | โˆ€๐‘ฃ ๐œ™ | โˆƒ๐‘ฃ ๐œ™ | [๐›ผ]๐œ™ | โŸจ๐›ผโŸฉ๐œ™This grammar extends the first-order language of real arithmetic

(FOLR) with the box ([๐›ผ]๐œ™) and diamond (โŸจ๐›ผโŸฉ๐œ™) modality formulas

which express that all or some runs of hybrid program ๐›ผ satisfy

postcondition ๐œ™ , respectively. Real arithmetic FOLR is decidable by

quantifier elimination [47] and serves as a useful base specification

language. Various specifications are equivalently definable in FOLR,

e.g., Euclidean norm bounds โˆฅ๐‘ฅ โˆฅ โˆผ Ydefโ‰ก โˆฅ๐‘ฅ โˆฅ2 โˆผ Y2 (for Y โ‰ฅ 0) and

topological operations such as the boundary ๐œ•๐œ™ and closure ๐œ™ of

the set characterized by formula ๐œ™ [3].

The box modality formula [๐›ผ]๐œ™ expresses safety properties ๐œ™ of

program ๐›ผ that must hold along all of its executions [34]. When ๐›ผ

models a switched system, the box modality quantifies (uniformly)

over all times for all solutions arising from the switching mecha-

nism. Accordingly, UGpAS for switched systems is formally speci-

fied by nesting the box modality with the first-order quantifiers.

Lemma 2 (UGpAS in differential dynamic logic). The origin0 โˆˆ R๐‘› for a switched system modeled by program ๐›ผ is UGpAS iff thedL formula UGpAS(๐›ผ) is valid. Variables Y, ๐›ฟ,๐‘‡ , ๐‘ก are fresh in ๐›ผ :

UGpAS(๐›ผ) โ‰ก UStab(๐›ผ) โˆง UGpAttr(๐›ผ)UStab(๐›ผ) โ‰ก โˆ€Y>0โˆƒ๐›ฟ>0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผ] โˆฅ๐‘ฅ โˆฅ < Y

)UGpAttr(๐›ผ) โ‰ก โˆ€Y>0โˆ€๐›ฟ>0โˆƒ๐‘‡โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’

[๐‘ก := 0;๐›ผ, ๐‘ก โ€ฒ = 1] (๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y))

Here, UStab(๐›ผ) and UGpAttr(๐›ผ) characterize stability and globalpre-attractivity of ๐›ผ , respectively. In UGpAttr(๐›ผ), ๐›ผ, ๐‘ก โ€ฒ = 1 denotesthe hybrid program obtained from ๐›ผ by augmenting its continuousdynamics so that variable ๐‘ก tracks the progression of time.

Formulas UStab(๐›ผ) and UGpAttr(๐›ผ) syntactically formalize in

dL the corresponding quantifiers in Def. 1. In UGpAttr(๐›ผ), the freshclock variable ๐‘ก is initialized to 0 and syntactically tracks the pro-

gression of time along switched system solutions. The program

๐›ผ, ๐‘ก โ€ฒ = 1 can, e.g., be constructed by adding a clock ODE ๐‘ก โ€ฒ = 1 to

all ODEs in the switched system model ๐›ผ . Accordingly, the post-

condition ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y expresses that the system state norm is

bounded by Y after๐‘‡ time units along any switching trajectory, as re-

quired in Def. 1. Various other stability notions are of interest in the

continuous and hybrid systems literature [13, 17, 22, 29, 36, 44, 45].

These variations can also be formally specified in dL [45] but are

left out of scope for this paper.

2.3 Proof CalculusThe dL proof calculus enables formal, deductive verification of

UGpAS stability specifications through compositional reasoning

principles for hybrid programs [33, 34] and a complete axiomatiza-

tion for ODE invariants [35]. For example, an important syntactic

tool for differential equations reasoning is the Lie derivative of term

๐‘’ along ODE ๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ), defined as L๐‘“(๐‘’) def

= โˆ‡๐‘’ ยท ๐‘“ . The soundcalculation and manipulation of Lie derivatives is enabled in dLthrough the use of syntactic differentials [33].

All proofs are presented in a classical sequent calculus with the

usual rules for manipulating logical connectives and sequents. The

semantics of sequent ฮ“ โŠข ๐œ™ is equivalent to the formula (โˆง๐œ“ โˆˆฮ“๐œ“ ) โ†’๐œ™ and a sequent is valid iff its corresponding formula is valid. The

key (derived) dL proof rule used in this paper is:

loop

ฮ“ โŠข Inv Inv โŠข [๐›ผ] Inv Inv โŠข ๐œ™

ฮ“ โŠข [๐›ผโˆ—]๐œ™

The loop rule says that, in order to prove validity of the conclu-

sion (below the rule bar), it suffices to prove the three premises

(above the rule bar), respectively from left to right: i) the initial

assumptions ฮ“ imply Inv, ii) Inv is preserved across the loop body ๐›ผ ,i.e., Inv is a loop invariant for ๐›ผโˆ—, and iii) Inv implies the postcondi-

tion ๐œ™ . The identification of loop invariants Inv is crucial for formal

proofs of UGpAS, as illustrated by the following deductive proof

skeleton for stability (a similar skeleton is used for pre-attractivity):

Deductionxloop

.

.

.

ฮ“ โŠข Inv

ฮ“1 โŠข ๐œ™1 ยท ยท ยท ฮ“๐‘˜ โŠข ๐œ™๐‘˜

.

.

.

(hybrid program

reasoning for ๐›ผ

)Inv โŠข [๐›ผ] Inv

.

.

.

Inv โŠข โˆฅ๐‘ฅ โˆฅ < Y

ฮ“ โŠข [๐›ผโˆ—] โˆฅ๐‘ฅ โˆฅ < Y

.

.

.

(logic/arithmetic

reasoning for ฮ“

)โŠข UStab(๐›ผโˆ—)

Proofs proceed upwards by deduction, where each reasoning step

is justified by sound dL axioms and rules of inference, e.g., the loop

rule. The skeleton above syntactically derives a proof rule that

reduces a stability proof for ๐›ผโˆ— to proofs of the top-most premises,

ฮ“1 โŠข ๐œ™1 ยท ยท ยท ฮ“๐‘˜ โŠข ๐œ™๐‘˜ , which corresponding to required logical

and arithmetical conditions on Lyapunov functions for various

switching mechanisms. The loop invariant step (highlighted in red)

crucially ties together these conditions on Lyapunov functions and

hybrid program reasoning for switched systems.

Page 4: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

Y

๐›ฟ

0

๐‘‰<๐‘Š

L๐‘“๐‘(๐‘‰ ) โ‰ค0

Y

๐›ฟ

0

๐‘‰<๐‘Š(bounded)

๐‘‰ โ‰ฅ๐‘ˆโ†’๐‘‰<๐‘Š +๐‘˜๐‘ก๐‘‰<๐‘ˆ

Figure 1: Loop invariants for UGpAS (arbitrary switching),stability (left) and pre-attractivity (right). Switching trajec-tories are illustrated by alternating black and green arrows.

3 LOOP INVARIANTS FOR SWITCHEDSYSTEM STABILITY

This section identifies loop invariants for proving UGpAS under

various classes of switching mechanisms with Lyapunov func-

tions [5, 21, 22]; relevant mathematical arguments are presented

briefly, see AppendixA for more details. Throughout the section,

loop invariants are progressively tweaked to account for new design

insights behind increasingly complex switching mechanisms.

3.1 Arbitrary and State-Dependent Switching3.1.1 Arbitrary Switching. Stability for the arbitrary switching

model ๐›ผarb from (1) can be verified by finding a so-called com-mon Lyapunov function ๐‘‰ for all of the ODEs ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ Psatisfying the following arithmetical conditions [22, 44]:

i) ๐‘‰ (0) = 0 and ๐‘‰ (๐‘ฅ) > 0 for all โˆฅ๐‘ฅ โˆฅ > 0,

ii) ๐‘‰ is radially unbounded, i.e., for all ๐‘, there exists ๐›พ > 0 such

that โˆฅ๐‘ฅ โˆฅ < ๐›พ for all ๐‘‰ (๐‘ฅ) โ‰ค ๐‘, and

iii) for each ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P, the Lie derivative L๐‘“๐‘(๐‘‰ )

satisfies: L๐‘“๐‘(๐‘‰ ) (0) = 0 and L

๐‘“๐‘(๐‘‰ ) (๐‘ฅ) < 0 for all โˆฅ๐‘ฅ โˆฅ > 0.

Conditions i)โ€“iii) are generalizations of well-known conditions

for stability of ODEs [8, 21] to arbitrary switching. Intuitively, con-

ditions i) and iii) ensure that๐‘‰ acts as an auxiliary energy function

whose value decreases asymptotically to zero (at the origin) along

all switching trajectories of the system; the radial unboundedness

condition ii) ensures that this argument applies to all system states

for global pre-attractivity [21]. Correctness of these conditions can

be proved in dL using loop invariants, see Fig. 1 (explained below).

Stability. The specification UStab(๐›ผarb) requires that all trajec-tories of ๐›ผarb stay in the grey ball โˆฅ๐‘ฅ โˆฅ < Y, starting from a chosen

ball โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , see Fig. 1 (left). Condition i) guarantees that theball โˆฅ๐‘ฅ โˆฅ < Y contains a sublevel set of the Lyapunov function

satisfying ๐‘‰ < ๐‘Š (dashed blue curve) and this sublevel set con-

tains a smaller ball โˆฅ๐‘ฅ โˆฅ < ๐›ฟ [8, 21]. Condition iii) shows that thissublevel set is invariant for each ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P because

L๐‘“๐‘(๐‘‰ ) (๐‘ฅ) โ‰ค 0, as illustrated by the dashed black and green arrows

for two different switching choices ๐‘ โˆˆ P both locally pointing

inwards on the boundary of the sublevel set. Thus, the formula

Inv๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Y โˆง๐‘‰ <๐‘Š , which characterizes the blue sublevel set,

is an invariant for all possible switching choices in the loop body of

๐›ผarb, which makes Inv๐‘  a suitable loop invariant for UStab(๐›ผarb).

Pre-attractivity. The specification UGpAttr(๐›ผarb) requires thatall trajectories of ๐›ผarb stay in the grey ball โˆฅ๐‘ฅ โˆฅ < Y after a chosen

time ๐‘‡ , starting from the initial ball โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , see Fig. 1 (right).

The ball โˆฅ๐‘ฅ โˆฅ < ๐›ฟ is compact, i.e., contained in a sublevel set sat-

isfying ๐‘‰ < ๐‘Š for some๐‘Š > 0 (outer dashed blue curve); this

sublevel set is bounded by condition ii). Like the stability argu-

ment, condition i) guarantees that there is a sublevel set ๐‘‰ < ๐‘ˆ

(inner dashed blue curve) contained in the ball โˆฅ๐‘ฅ โˆฅ < Y, and con-

dition iii) shows that both sublevel sets characterized by ๐‘‰ < ๐‘Š

and ๐‘‰ < ๐‘ˆ are invariants for every ODE in the loop body of ๐›ผarb.

The set characterized by formula ๐‘‰ โ‰ฅ ๐‘ˆ โˆง๐‘‰ โ‰ค๐‘Š is compact and

bounded away from the origin, which implies by condition iii) thatthere is a uniform bound ๐‘˜ < 0 on this set, where for each ODE

๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P, L๐‘“๐‘(๐‘‰ ) (๐‘ฅ) โ‰ค ๐‘˜ . Thus, the value of Lyapunov

function ๐‘‰ decreases at rate ๐‘˜ , regardless of switching choices in

the loop body of ๐›ผarb, as long as it has not entered๐‘‰ < ๐‘ˆ . The loop

invariant for UGpAttr(๐›ผarb) syntactically expresses this intuition:

Inv๐‘Ž โ‰ก ๐‘‰ <๐‘Š โˆง (๐‘‰ โ‰ฅ ๐‘ˆ โ†’ ๐‘‰ <๐‘Š + ๐‘˜๐‘ก). For a sufficiently large

choice of ๐‘‡ with๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , trajectories at time ๐‘ก โ‰ฅ ๐‘‡ satisfy

๐‘‰ < ๐‘ˆ so they are contained in the โˆฅ๐‘ฅ โˆฅ < Y ball.

The loop invariants identified above enable derivation of a for-

mal dL stability proof rule for ๐›ผarb (deferred to a more general

version in Corollary 3 below). In fact, since arbitrary switching is

the most permissive form of switching [22], UGpAS for any switch-

ing mechanism can be soundly justified using the loop invariants

above in case a suitable common Lyapunov function can be found.

3.1.2 State-dependent Switching. The state-dependent switchingmechanism [22] constrains arbitrary switching by allowing execu-

tion of (and switching to) an ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P only when

the system state is in domain ๐‘„๐‘ . This is modeled by the hybrid

program ๐›ผstate โ‰ก( โ‹ƒ

๐‘โˆˆP ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘

)โˆ—[46, Proposition 2],

where arbitrary switching ๐›ผarb corresponds to the special case with

๐‘„๐‘ โ‰ก true for all ๐‘ โˆˆ P.

The same loop invariants for ๐›ผarb are used for ๐›ผstate to derive

the following proof rule. For brevity, premises of all derived stability

proof rules are implicitly conjunctively quantified over ๐‘ โˆˆ P.

Corollary 3 (UGpAS for state-dependent switching, CLF).

The following proof rule for common Lyapunov function๐‘‰ with threestacked premises is derivable in dL.

CLF

โŠข ๐‘‰ (0) = 0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ > 0 โ†’ ๐‘‰ (๐‘ฅ) > 0)โŠข โˆ€๐‘ โˆƒ๐›พ โˆ€๐‘ฅ (๐‘‰ (๐‘ฅ) โ‰ค ๐‘ โ†’ โˆฅ๐‘ฅ โˆฅ โ‰ค ๐›พ)โŠข L

๐‘“๐‘(๐‘‰ ) (0) = 0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ > 0 โˆง๐‘„๐‘ โ†’ L

๐‘“๐‘(๐‘‰ ) (๐‘ฅ) < 0)

โŠข UGpAS(๐›ผstate)

Corollary 3 syntactically derives a slight generalization of condi-

tions i)โ€“iii) from Section 3.1.1 for ๐›ผstate, where the Lie derivatives

L๐‘“๐‘(๐‘‰ ) (๐‘ฅ) for each ๐‘ โˆˆ P are required to be negative on their re-

spective domain closures2 ๐‘„๐‘ . This generalization is justified by the

same loop invariants in Section 3.1.1 because the ODE invariance

properties are only required to hold in their respective domains.

2The topological closure๐‘„ of domain๐‘„ is needed for soundness of a technical com-

pactness argument used in the pre-attractivity proof, see AppendixA for details.

Page 5: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

๐‘ : ๐‘ฅโ€ฒ1=โˆ’4.6๐‘ฅ

1+5.5๐‘ฅ

2,๐‘ฅโ€ฒ2=โˆ’5.5๐‘ฅ

1+4.4๐‘ฅ

2&๐‘ฅ

1๐‘ฅ2โ‰ฅ0

๐‘ž: ๐‘ฅโ€ฒ1=4.4๐‘ฅ

1+5.5๐‘ฅ

2,๐‘ฅโ€ฒ2=โˆ’5.5๐‘ฅ

1โˆ’4.6๐‘ฅ

2&๐‘ฅ

1๐‘ฅ2โ‰ค0

-0.2 -0.1 0.1 0.2 x1

-0.15

-0.1

-0.05

0.05

0.1

0.15

x2

๐‘‰๐‘=๐‘ฅ21โˆ’1.65๐‘ฅ

1๐‘ฅ2+๐‘ฅ2

2

๐‘‰๐‘ž=๐‘ฅ21+1.65๐‘ฅ

1๐‘ฅ2+๐‘ฅ2

2

0 2 4 6 t

0.005

0.01

0.015

0.02

0.025

V

Figure 2: A switching trajectory for Example 7 from Sec-tion 4.2 with state-dependent switching (left) and the valueof two Lyapunov functions along that trajectory (right).Solid lines indicate the active Lyapunov function at time ๐‘ก .Two sublevel sets ๐‘‰๐‘ ,๐‘‰๐‘ž < ๐‘Š = 0.012 are shown dashed onthe left withinwhich the switching trajectory is respectivelytrapped at any given time.

The domain asymmetry in ๐›ผstate suggests another way of gener-

alizing the stability arguments, namely, through the use of multipleLyapunov functions, where a (possibly) different Lyapunov function๐‘‰๐‘ is associated to each ๐‘ โˆˆ P [5]. Here, the function๐‘‰๐‘ is responsi-

ble for justifying stability within domain๐‘„๐‘ , i.e., its value decreases

along system trajectories whenever the system is within ๐‘„๐‘ , as il-

lustrated in Fig. 2. Constraints on these functions are obtained by

modifying the loop invariants to account for this intuition.

Stability. The stability loop invariant is modified by case split-

ting disjunctively on the domains ๐‘„๐‘ , ๐‘ โˆˆ P, and requiring that

the sublevel set characterized by ๐‘‰๐‘ < ๐‘Š is invariant within its

respective domain: Inv๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Yโˆงโˆจ๐‘โˆˆP

(๐‘„๐‘ โˆง๐‘‰๐‘ <๐‘Š

). Similar

to Section 3.1.1, the bound๐‘Š is chosen so that each sublevel set

characterized by ๐‘‰๐‘ <๐‘Š is contained in the ball โˆฅ๐‘ฅ โˆฅ < Y.

Pre-attractivity. The pre-attractivity loop invariant is similarly

modified by disjunctively requiring that ๐‘‰๐‘ decreases along system

trajectories when the system is in their respective domains ๐‘„๐‘ :

Inv๐‘Ž โ‰ก โˆจ๐‘โˆˆP

(๐‘„๐‘ โˆง ๐‘‰๐‘ < ๐‘Š โˆง (๐‘‰๐‘ โ‰ฅ ๐‘ˆ โ†’ ๐‘‰๐‘ < ๐‘Š + ๐‘˜๐‘ก)

).

The constants ๐‘ˆ ,๐‘Š ,๐‘˜,๐‘‡ are chosen as appropriate lower or upper

bounds for all the Lyapunov functions (see proof of Corollary 4).

Arithmetical conditions for the Lyapunov functions ๐‘‰๐‘ , ๐‘ โˆˆ Pare derived from the modified invariants in the following rule.

Corollary 4 (UGpAS for state-dependent switching, MLF).

The following proof rule for multiple Lyapunov functions ๐‘‰๐‘ , ๐‘ โˆˆ Pwith four stacked premises is derivable in dL.

MLF

โŠข ๐‘‰๐‘ (0) = 0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ > 0 โ†’ ๐‘‰๐‘ (๐‘ฅ) > 0)โŠข โˆ€๐‘ โˆƒ๐›พ โˆ€๐‘ฅ (๐‘‰๐‘ (๐‘ฅ) โ‰ค ๐‘ โ†’ โˆฅ๐‘ฅ โˆฅ โ‰ค ๐›พ)โŠข L

๐‘“๐‘(๐‘‰๐‘ ) (0)=0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ>0 โˆง๐‘„๐‘ โ†’ L

๐‘“๐‘(๐‘‰๐‘ ) (๐‘ฅ)<0)

โŠข โˆง๐‘žโˆˆP

(๐‘„๐‘ โˆง๐‘„๐‘ž โ†’ ๐‘‰๐‘ = ๐‘‰๐‘ž

)โŠข UGpAS(๐›ผstate)

The top three premises of Corollary 4 are similar to those of Corol-

lary 3, but are now required to hold for each Lyapunov function

๐‘‰๐‘ , ๐‘ โˆˆ P separately. The (new) bottom premise corresponds to a

compatibility condition between the Lyapunov functions arising

from the loop invariants. For example, consider the stability loop

invariant (similarly for pre-attractivity) and suppose the system

currently satisfies disjunct๐‘„๐‘ โˆง๐‘‰๐‘ < ๐‘ค with๐‘‰๐‘ justifying stability

in domain๐‘„๐‘ . If the system switches to the ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ž (๐‘ฅ) withindomain ๐‘„๐‘ž , then Lyapunov function ๐‘‰๐‘ž becomes the active Lya-

punov function which must satisfy๐‘‰๐‘ž < ๐‘ค to preserve the stability

loop invariant. The premise ๐‘„๐‘ โˆง ๐‘„๐‘ž โ†’ ๐‘‰๐‘ = ๐‘‰๐‘ž says that the

Lyapunov functions ๐‘‰๐‘ ,๐‘‰๐‘ž are equal whenever such a switch is

possible (in either direction), i.e., when their domains overlap.

3.2 Controlled SwitchingThis section turns to controlled switching models [46], where an ex-

plicit controller program is responsible for making logical switching

decisions between the ODEs ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ โˆˆ P. This is in contrast

to earlier models ๐›ผarb, ๐›ผstate which exhibit autonomous switching,i.e., without an explicit control logic [6, 22]. General controlled

switching is modeled by the hybrid program ๐›ผctrl:

๐›ผctrl โ‰ก ๐›ผ๐‘–โ†“

initialization

;

(switching controller

โ†‘๐›ผ๐‘ข ;

๐›ผ๐‘ (plant, actuate decision)๏ธท ๏ธธ๏ธธ ๏ธทโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ,๐‘ฆ), ๐‘ฆโ€ฒ = ๐‘”๐‘ (๐‘ฅ,๐‘ฆ) &๐‘„๐‘

) )โˆ—The model ๐›ผctrl uses three subprograms: ๐›ผ๐‘– initializes the sys-

tem, then ๐›ผ๐‘ข (modeling the switching controller) and ๐›ผ๐‘ (modeling

the continuous plant dynamics) are run in a switching loop. The

discrete programs ๐›ผ๐‘– , ๐›ผ๐‘ข decide on values for the control output

๐‘ข = ๐‘, ๐‘ โˆˆ P and the program ๐›ผ๐‘ responds to this output by evolv-

ing the corresponding ODE ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ,๐‘ฆ), ๐‘ฆโ€ฒ = ๐‘”๐‘ (๐‘ฅ,๐‘ฆ) &๐‘„๐‘ . The

programs ๐›ผ๐‘– , ๐›ผ๐‘ข must not modify the system state variables ๐‘ฅ , but

they may modify other auxiliaries, including auxiliary continuousstate variables ๐‘ฆ used to model timers or integral terms used in con-

trollers, see Section 5.2. This control-plant loop is a typical structure

for hybrid systems modeled in dL [32, 34], e.g., the controller ๐›ผ๐‘ขbelow models the discrete switching logic present in hybrid au-

tomata [6, 18, 32] (without jumps in the system state):

๐›ผ๐‘ข โ‰กโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;

โ‹ƒ๐‘žโˆˆP

(?๐บ๐‘,๐‘ž ;๐‘…๐‘,๐‘ž ;๐‘ข :=๐‘ž

) )๐‘…๐‘,๐‘ž โ‰ก ๐‘ฆ1 := ๐‘’1;๐‘ฆ2 := ๐‘’2; . . . ;๐‘ฆ๐‘˜ := ๐‘’๐‘˜

(2)

For each mode ๐‘ โˆˆ P, the switching controller may decide to

transition to mode ๐‘ž โˆˆ P. This transition can only be taken if the

guard formula ๐บ๐‘,๐‘ž is true in the current state3; if the transition is

taken, the reset map ๐‘…๐‘,๐‘ž sets the values of auxiliary state variables

๐‘ฆ1, . . . , ๐‘ฆ๐‘˜ respectively to the value of terms ๐‘’1, . . . , ๐‘’๐‘˜ .

Stability analysis for controlled switching proceeds by identify-

ing suitable loop invariants Inv for ๐›ผctrl. A powerful proof tech-

nique applied here is compositional reasoning [32, 34] which sepa-

rately analyses the discrete (๐›ผ๐‘– , ๐›ผ๐‘ข ) and continuous (๐›ผ๐‘ ) dynamics,

and then lifts those results to the full hybrid dynamics. This idea is

exemplified by the following derived variation of the loop rule:

loopT

ฮ“ โŠข [๐›ผ๐‘– ]Inv Inv โŠข [๐›ผ๐‘ข ]Inv Inv โŠข [๐›ผ๐‘ ]Inv Inv โŠข ๐œ™

ฮ“ โŠข [๐›ผ๐‘– ; (๐›ผ๐‘ข ;๐›ผ๐‘ )โˆ—]๐œ™

3The controller can allow trivial self-transitions with๐บ๐‘,๐‘ โ‰ก true.

Page 6: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

The premises of rule loopT say that system initialization ๐›ผ๐‘– puts

the system in a state satisfying the invariant Inv, and that Inv is

compositionally preserved by both the discrete switching logic ๐›ผ๐‘ขand the continuous dynamics ๐›ผ๐‘ . This rule is applied to analyze

stability for two important special instances of ๐›ผctrl next.

3.2.1 Guarded State-dependent Switching. The instance ๐›ผguard cor-responds to the automata controller from (2) with ๐›ผ๐‘– โ‰ก

โ‹ƒ๐‘โˆˆP ๐‘ข := ๐‘

and guard formulas ๐บ๐‘,๐‘ž . It does not use auxiliaries ๐‘ฆ nor the reset

map ๐‘…๐‘,๐‘ž . This model adds hysteresis [19] to the state-dependent

switching model from Section 3.1.2, so that switching decisions

at each ๐บ๐‘,๐‘ž depend explicitly on the current discrete mode ๐‘ข in

addition to the continuous state. This design change is reflected in

the loop invariants and in the corresponding proof rule below.

Stability. The stability loop invariant ismodified (cf. Section 3.1.2)

to case split on the possible discrete modes ๐‘ข = ๐‘ rather than the

ODE domains: Inv๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Y โˆงโˆจ๐‘โˆˆP

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š

).

Pre-attractivity. The pre-attractivity loop invariant is modified

similarly: Inv๐‘Ž โ‰ก โˆจ๐‘โˆˆP

(๐‘ข=๐‘โˆง๐‘‰๐‘<๐‘Š โˆง (๐‘‰๐‘ โ‰ฅ ๐‘ˆ โ†’ ๐‘‰๐‘ <๐‘Š +๐‘˜๐‘ก)

).

Corollary 5 (UGpAS for guarded state-dependent switch-

ing, MLF). The following proof rule for multiple Lyapunov functions๐‘‰๐‘ , ๐‘ โˆˆ P with four stacked premises is derivable in dL.

MLF๐บ

โŠข ๐‘‰๐‘ (0) = 0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ > 0 โ†’ ๐‘‰๐‘ (๐‘ฅ) > 0)โŠข โˆ€๐‘ โˆƒ๐›พ โˆ€๐‘ฅ (๐‘‰๐‘ (๐‘ฅ) โ‰ค ๐‘ โ†’ โˆฅ๐‘ฅ โˆฅ โ‰ค ๐›พ)โŠข L

๐‘“๐‘(๐‘‰๐‘ ) (0)=0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ>0 โˆง๐‘„๐‘ โ†’ L

๐‘“๐‘(๐‘‰๐‘ ) (๐‘ฅ)<0)

โŠข โˆง๐‘žโˆˆP

(๐บ๐‘,๐‘ž โ†’ ๐‘‰๐‘ž โ‰ค ๐‘‰๐‘

)โŠข UGpAS(๐›ผguard)

The premises of rule MLF๐บ are identical to those from MLF ex-

cept the bottom premise, which derives from loopT and unfolding

the controller ๐›ผ๐‘ข with dLโ€™s hybrid program axioms, e.g., the fol-

lowing proof skeleton shows the unfolding for the stability loop

invariant Inv๐‘  corresponding to a switch from mode ๐‘ to mode ๐‘ž:

xUnfold

โŠข ๐บ๐‘,๐‘ž โ†’ ๐‘‰๐‘ž โ‰ค ๐‘‰๐‘๐‘‰๐‘ <๐‘Š โŠข ๐บ๐‘,๐‘ž โ†’ ๐‘‰๐‘ž <๐‘Š

๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š โŠข [?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž] (๐‘ข = ๐‘ž โˆง๐‘‰๐‘ž <๐‘Š )Inv๐‘  โŠข [๐›ผ๐‘ข ]Inv๐‘ 

ArithmeticxUnlike rule MLF, the bottom premise of rule MLF๐บ only uses an in-

equality, because the guards ๐บ๐‘,๐‘ž determine permissible switching.

3.2.2 Time-dependent Switching. The instance ๐›ผtime shown below

models time-dependent switching, where the controller ๐›ผ๐‘ข makes

switching decisions based on the time ๐œ elapsed in each mode.

๐›ผtime โ‰ก

๐›ผ๐‘– โ‰ก ๐œ := 0;

โ‹ƒ๐‘โˆˆP

๐‘ข := ๐‘

๐›ผ๐‘ข โ‰กโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;

โ‹ƒ๐‘žโˆˆP

(?\๐‘,๐‘ž โ‰ค ๐œ ;๐œ := 0;๐‘ข :=๐‘ž

) )๐›ผ๐‘ โ‰ก

โ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œ โ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘

)The controller ๐›ผ๐‘ข enables switching from mode ๐‘ to ๐‘ž when a

minimum dwell time 0 โ‰ค \๐‘,๐‘ž โ‰ค ๐œ has elapsed and resets the timer

whenever such a switch occurs. Conversely, the plant ๐›ผ๐‘ restricts

modes with a maximum dwell time ๐œ โ‰ค ฮ˜๐‘ ,ฮ˜๐‘ > 0; an unbounded

dwell time ฮ˜๐‘ = โˆž is represented by the domain constraint true.Dwell time restrictions can be used to stabilize systems that switch

between stable and unstable modes [48]. Intuitively, the system

should stay in stable modes for sufficient duration (\๐‘,๐‘ž โ‰ค ๐œ) while

it should avoid staying in unstable modes for too long (๐œ โ‰ค ฮ˜๐‘ ).

To reason about stability for ๐›ผtime, consider Lyapunov function

conditions L๐‘“๐‘(๐‘‰๐‘ ) (๐‘ฅ) โ‰ค โˆ’_๐‘๐‘‰๐‘ , where _๐‘ is a constant associated

with each mode ๐‘ โˆˆ P. This condition bounds the value of๐‘‰๐‘ along

the solution of ๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ) by either a decaying exponential for

stable modes (_๐‘ > 0) or a growing exponential for unstable modes

(_๐‘ โ‰ค 0). Let S = {๐‘ โˆˆ P, _๐‘ > 0} and U = {๐‘ โˆˆ P, _๐‘ โ‰ค 0} bethe indexes of the stable and unstable modes in the loop invariants

below, and let ๐‘’ ( ยท) denote the real exponential function, which is

definable in dL by differential axiomatization [32, 35].

Stability. The stability loop invariant expresses the required ex-

ponential bounds with a case split depending if ๐‘ โˆˆ S or ๐‘ โˆˆ U:

Inv๐‘  โ‰ก ๐œ โ‰ฅ 0 โˆง โˆฅ๐‘ฅ โˆฅ < Y โˆง

ยฉยญยญยญยญยซโˆจ๐‘โˆˆS

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ

)โˆจโˆจ

๐‘โˆˆU

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) โˆง ๐œ โ‰ค ฮ˜๐‘

)ยชยฎยฎยฎยฎยฌFor ๐‘ โˆˆ S, ๐‘’โˆ’_๐‘๐œ is the accumulated decay factor for ๐‘‰๐‘ after

staying in the stable mode for time ๐œ . For ๐‘ โˆˆ U, ๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ )is

a buffer factor for the growth of ๐‘‰๐‘ in the unstable mode so that

๐‘‰๐‘ < ๐‘Š still holds at the maximum dwell time ๐œ = ฮ˜๐‘ . In both

cases, the internal timer variable is non-negative (๐œ โ‰ฅ 0).

Pre-attractivity. The pre-attractivity loop invariant has similar

exponential decay and growth bounds for each ๐‘ โˆˆ P in the current

mode. In addition, it has an overall exponential decay term ๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)

for some ๐œŽ > 0, which ensures that the value of ๐‘‰๐‘ tends to 0 as

๐‘ก โ†’ โˆž for all switching trajectories; recall ๐‘ก is the global clock

introduced in the specification of pre-attractivity in Lemma 2.

Inv๐‘Ž โ‰ก ๐œ โ‰ฅ 0 โˆง ๐‘ก โ‰ฅ ๐œ โˆง

ยฉยญยญยญยญยซโˆจ๐‘โˆˆS

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘๐œ

)โˆจโˆจ

๐‘โˆˆU

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) โˆง ๐œ โ‰ค ฮ˜๐‘

)ยชยฎยฎยฎยฎยฌIntuitively, ๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ) is the accumulated overall decay factor for

๐‘‰๐‘ until the previous switch, which occurred at time ๐‘ก โˆ’ ๐œ .

Corollary 6 (UGpAS for time-dependent switching, MLF).

The following proof rule for multiple Lyapunov functions ๐‘‰๐‘ , ๐‘ โˆˆ Pwith five stacked premises is derivable in dL.

MLF๐œ

โŠข ๐‘‰๐‘ (0) = 0 โˆง โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ > 0 โ†’ ๐‘‰๐‘ (๐‘ฅ) > 0)โŠข โˆ€๐‘ โˆƒ๐›พ โˆ€๐‘ฅ (๐‘‰๐‘ (๐‘ฅ) โ‰ค ๐‘ โ†’ โˆฅ๐‘ฅ โˆฅ โ‰ค ๐›พ)โŠข L

๐‘“๐‘(๐‘‰๐‘ ) โ‰ค โˆ’_๐‘๐‘‰๐‘

Inv๐‘  โŠข [๐›ผ๐‘ข ]Inv๐‘  Inv๐‘Ž โŠข [๐›ผ๐‘ข ]Inv๐‘ŽโŠข UGpAS(๐›ผtime)

The two red premises on the bottom row are expanded to arithmeti-cal conditions on ๐‘‰๐‘ in Appendix A.

Page 7: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

The bottom premises of MLF๐œ and MLF๐บ exemplify a key benefit

of dL stability reasoning: arithmetical conditions on ๐‘‰๐‘ that arise

from ๐›ผ๐‘ข , Inv๐‘  , Inv๐‘Ž are derived in a correct-by-construction manner

by systematically unfolding the discrete dynamics of ๐›ผ๐‘ข with sound

dL axioms. This is especially important for controlled switching,

where the number of possible transitions scales quadratically with

the number of switching modes.

4 KEYMAERA X IMPLEMENTATIONThis section presents a prototype implementation of switched sys-

tems support in the KeYmaera X prover based on dL [12]. The

implementation consists of โ‰ˆ2700 lines and, crucially, does not re-quire any extension to KeYmaera Xโ€™s existing soundness-critical

core. Accordingly, verification results for switched systems obtained

through this implementation directly inherit the strong correctness

properties guaranteed by KeYmaera Xโ€™s design [12, 25].

4.1 Modeling and Proof InterfaceThe implementation builds on KeYmaera Xโ€™s proof IDE [24] to pro-

vide a convenient interface for modeling switching mechanisms,

as shown in Fig. 3. The interface allows users to express switch-

ing mechanisms intuitively by rendering automaton plots while

abstracting away the underlying hybrid programs. It provide tem-

plates for switched systems following the switching mechanisms of

Section 3: state-dependent, guarded, timed, and general controlled

switching (tabs โ€œAutonomousโ€, โ€œTimedโ€, โ€œGuardedโ€, โ€œGenericโ€ in

Fig. 3). From these templates, KeYmaera X automatically generates

programs and stability specifications, ensuring that they have the

correct structure. This saves user effort from having to manually

expand switching designs to correctly structured hybrid programs.

Moreover, the generated programs and specifications follow a uni-

form structure that the proof tactics discussed below can rely on.

Figure 3: Screenshot of the KeYmaera X switched systemsmodeling editor: automata input on top-left, rendered au-tomaton top-right, generated hybrid program and specifica-tion(s) in dL at the bottom

Switched systems are represented internally with a common

interface SwitchedSystem which is currently implemented by four

classes: StateDependent๐›ผstate, Guarded๐›ผguard, Timed๐›ผtime, andControlled ๐›ผctrl. The SwitchedSystem interface provides defaultstability and pre-attractivity specifications, which can be adapted

Table 1: Available tactics in KeYmaera X for switched sys-tems stability proofs and Lyapunov function generation.

SwitchedSystemCommon Lyap. Multiple Lyap.

Proof Gen. Proof Gen.

StateDependent ๐›ผstate โœ“ โœ“ โœ“ โœ“Guarded ๐›ผguard โœ“ โœ“ โœ“ โœ“Timed ๐›ผtime โœ“ โœ“ โœ“ โ€”

Controlled ๐›ผctrl โœ“ โœ“ โ€” โ€”

Table 2: Stability proofs for examples drawn from the lit-erature. The โ€œTimeโ€ columns indicate time (in seconds) torun the KeYmaera X proofs, ร— indicates incomplete proof. Aโœ“ in the โ€œGen.โ€ column indicates successful Lyapunov func-tion(s) generation, ? indicates that a candidatewas generatedbut with numerical issues, and โ€” indicates inapplicability.

Example Model Time (Stab.) Time (Attr.) Gen.

1 [5, Ex. 2.1] ๐›ผstate 2.6 3.0 โœ“2 [19, Motiv. ex.] ๐›ผstate 2.2 2.3 โœ“3 [19, Ex. 1] ๐›ผstate 3.3 4.1 โœ“4 [19, Ex. 2 & 3] ๐›ผguard 2.8 3.8 ?

5 [38, Ex. 6] ๐›ผguard ร— ร— ?

6 [44, Ex. 2.45] ๐›ผarb 19.4 11.1 โœ“7 [44, Ex. 3.25] ๐›ผstate 2.4 2.9 โœ“8 [44, Ex. 3.49] ๐›ผtime 4.4 5.6 โ€”

9 [48, Ex. 1] ๐›ผtime 4.7 5.3 โ€”

10 [48, Ex. 2] ๐›ผtime 256.9 ร— โ€”

by users on the UI if needed. Corollaries 3โ€“6 are implemented as UG-

pAS proof tactics in KeYmaera Xโ€™s Bellerophon tactic language [11].

These tactics automate all of the reasoning steps underlying sta-

bility proofs for their respective switching mechanisms, so that

users only need to input candidate Lyapunov functions for KeY-

maera X to (attempt to) complete their proofs. Additionally, when

candidates are not provided by the user, the implementation uses

sum-of-squares programming [31, 38] to automatically generate

candidate Lyapunov functions for a subset of switching designs. The

generated candidates are checked for correctness by KeYmaera X

so the generator does not need to be trusted for correctness of the

resulting proofs. Table 1 summarizes the available proof tactics and

Lyapunov function generation for classes of switching mechanisms.

4.2 ExamplesThe implementation is tested on a suite of examples drawn from

the literature [5, 19, 38, 44] featuring various switching mecha-

nisms. These examples have a 2 dimensional state space and switch

between 2modes except Example 6 (3 dimensions, 2modes) and Ex-

ample 4 (2 dimensions, 4modes). Results are summarized in Table 2;

Lyapunov functions from the literature were used (if available) in

cases where generation failed or is inapplicable.

The proof tactics successfully prove most of the examples across

various switching mechanisms. For Example 6, a suitable Lyapunov

function (without numerical errors) could not be found. For the

Page 8: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

time-dependent switching models (Examples 8โ€“10), KeYmaera X

internally uses verified polynomial Taylor approximations to the ex-

ponential function for decidability of arithmetic [3, 47]. Example 10

requires a high degree approximation (15 terms) and its attractivity

proof could not be completed in reasonable time.

5 CASE STUDIESThis section presents three case studies applying the deductive

verification approach to justify various non-standard stability argu-

ments in KeYmaera X.

5.1 Canonical Max SystemBranicky [4] investigates the longitudinal dynamics of an aircraft

with an elevator controller that mediates between two control ob-

jectives: i) tracking potentially unsafe pilot input and ii) respectingsafety constraints on the aircraftโ€™s angle of attack. Assuming a state

feedback control law, the model is transformed to the following

canonical max system [4, Remark 5], with state variables ๐‘ฅ,๐‘ฆ and

parameters ๐‘Ž, ๐‘, ๐‘“ , ๐‘”,๐›พ satisfying ๐‘Ž, ๐‘, ๐‘Ž โˆ’ ๐‘“ , ๐‘ โˆ’ ๐‘” > 0 and ๐›พ โ‰ค 0.

๐‘ฅ โ€ฒ = ๐‘ฆ,๐‘ฆโ€ฒ = โˆ’๐‘Ž๐‘ฅ โˆ’ ๐‘๐‘ฆ +max(๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ, 0) (3)

The right-hand side of system (3) is non-differentiable but the

equations can be equivalently rewritten as a family of two ODEs

corresponding to either possibility for themax(๐‘“ ๐‘ฅ +๐‘”๐‘ฆ +๐›พ, 0) termin the equation for ๐‘ฆโ€ฒ as follows, where the system follows ODE A

in domain ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ค 0 and ODE B in domain ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ฅ 0.

A โ‰ก ๐‘ฅ โ€ฒ = ๐‘ฆ,๐‘ฆโ€ฒ = โˆ’๐‘Ž๐‘ฅ โˆ’ ๐‘๐‘ฆ

B โ‰ก ๐‘ฅ โ€ฒ = ๐‘ฆ,๐‘ฆโ€ฒ = โˆ’(๐‘Ž โˆ’ ๐‘“ )๐‘ฅ โˆ’ (๐‘ โˆ’ ๐‘”)๐‘ฆ + ๐›พStability of this parametric system is not directly provable us-

ing standard techniques for state-dependent switching presented

in Section 3.1.2. For example, the ODE A stabilizes the system to

the origin but the ODE B stabilizes to the point (โˆ’ ๐›พ

๐‘Žโˆ’๐‘“ , 0) (awayfrom the origin for ๐›พ < 0). Branicky proves global asymptotic

stability of (3) with the following โ€œnoncustomaryโ€ [10] Lyapunov

function involving a nondifferentiable integrand:

๐‘‰ =1

2

๐‘ฆ2 +โˆซ ๐‘ฅ

0

๐‘Žb โˆ’max(๐‘“ b + ๐›พ, 0)๐‘‘b (4)

Instead, the key idea used to prove stability in this paper is ghostswitching: analogous to ghost variables in program verification

which are added for the sake of program proofs [30, 34, 35], ghost

switchingmodes do not change the physical dynamics of the system

but are introduced for the purposes of the stability analysis. Here,

ghost switching between ๐‘“ ๐‘ฅ + ๐›พ โ‰ค 0 and ๐‘“ ๐‘ฅ + ๐›พ โ‰ฅ 0 is used to

obtain closed form representations for the integral in (4). This yields

an instance of state-dependent switching ๐›ผstate with 4 switching

modes and the corresponding stability specification ๐‘ƒ๐‘š :

A1โ‰ก A & ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ค 0 โˆง ๐‘“ ๐‘ฅ + ๐›พ โ‰ค 0

A2โ‰ก A & ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ค 0 โˆง ๐‘“ ๐‘ฅ + ๐›พ โ‰ฅ 0

B1โ‰ก B & ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ฅ 0 โˆง ๐‘“ ๐‘ฅ + ๐›พ โ‰ค 0

B2โ‰ก B & ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ฅ 0 โˆง ๐‘“ ๐‘ฅ + ๐›พ โ‰ฅ 0

๐›ผ๐‘š โ‰ก(A

1โˆช A

2โˆช B

1โˆช B

2

)โˆ—๐‘ƒ๐‘š โ‰ก ๐‘Ž>0 โˆง ๐‘>0 โˆง ๐‘Žโˆ’๐‘“ >0 โˆง ๐‘โˆ’๐‘”>0 โˆง ๐‘“ โ‰ 0 โˆง ๐›พโ‰ค0 โ†’ UGpAS(๐›ผ๐‘š)

The ghost switching modes enable a multiple Lyapunov function

argument for stability using the following modified closed-form

representations of Branickyโ€™s Lyapunov function (4), with ๐‘‰1 =1

2(๐‘๐‘๐‘ฅ2 + 2๐‘๐‘ฅ๐‘ฆ + ๐‘ฆ2) + ๐‘Ž

2๐‘ฅ2 for A

1, B

1and ๐‘‰2 =

1

2(๐‘๐‘๐‘ฅ2 + 2๐‘๐‘ฅ๐‘ฆ +

๐‘ฆ2)+ ๐‘Ž2๐‘ฅ2 โˆ’ (๐‘“ ๐‘ฅ+๐›พ )2

2๐‘“for A

2, B

2.4The sub-terms highlighted in red

for๐‘‰1,๐‘‰2 are closed form expressions for

โˆซ ๐‘ฅ

0๐‘Žb โˆ’max(๐‘“ b +๐›พ, 0)๐‘‘b

where ๐‘“ b + ๐›พ โ‰ค 0 and ๐‘“ b + ๐›พ โ‰ฅ 0 respectively. The Lyapunov

functions ๐‘‰1,๐‘‰2 are modified from (4) to use a quadratic form with

an additional constant ๐‘ satisfying constraints 0 < ๐‘ < ๐‘, ๐‘ <

๐‘ โˆ’ ๐‘”, ๐‘ <(๐‘Žโˆ’๐‘“ ) (๐‘โˆ’๐‘”)๐‘Žโˆ’๐‘“ +๐‘”2 , ๐‘ <

๐‘Ž (๐‘โˆ’๐‘”)๐‘Ž+๐‘”2 (such a constant always exists

under the assumptions on ๐‘Ž, ๐‘, ๐‘“ , ๐‘”). This technical modification

is required to prove UGpAS for ๐›ผ๐‘š directly with the Lyapunov

functions. Branickyโ€™s earlier proof requires LaSalleโ€™s principle [4].

Another challenging aspect of this case study is verification of

the parametric arithmetical conditions for ๐‘‰1,๐‘‰2, i.e., stability is

verified for all possible parameter values ๐‘Ž, ๐‘, ๐‘“ , ๐‘”,๐›พ that satisfy

the assumptions in ๐‘ƒ๐‘š . Such questions are decidable in theory [3,

47], but are difficult for automated solvers in practice (even out of

reach of solvers that require numerically bounded parameters [14]).

KeYmaera X enables a user-aided proof of the required arithmetic

conditions. For example, the Lie derivative of the Lyapunov function

๐‘‰1 for B1is given by๐‘‰ โ€ฒ

1= โˆ’(๐‘โˆ’๐‘)๐‘ฆ2โˆ’๐‘Ž๐‘๐‘ฅ2 + (๐‘๐‘ฅ +๐‘ฆ) (๐‘“ ๐‘ฅ +๐‘”๐‘ฆ +๐›พ),

where๐‘‰ โ€ฒ1is required to be strictly negative away from the origin for

stability. The arithmetical argument is as follows: if ๐‘๐‘ฅ +๐‘ฆ โ‰ค 0, then

by constraint ๐‘“ ๐‘ฅ + ๐‘”๐‘ฆ + ๐›พ โ‰ฅ 0, ๐‘‰ โ€ฒ1satisfies ๐‘‰ โ€ฒ

1โ‰ค โˆ’(๐‘ โˆ’ ๐‘)๐‘ฆ2 โˆ’ ๐‘Ž๐‘๐‘ฅ2.

Otherwise, ๐‘๐‘ฅ + ๐‘ฆ > 0, then by constraint ๐‘“ ๐‘ฅ + ๐›พ โ‰ค 0, ๐‘‰ โ€ฒ1satisfies

๐‘‰ โ€ฒ1โ‰ค โˆ’(๐‘โˆ’๐‘”โˆ’๐‘)๐‘ฆ2โˆ’๐‘Ž๐‘๐‘ฅ2+๐‘”๐‘๐‘ฅ๐‘ฆ. In either case, the RHS bound is a

negative definite quadratic form by the earlier choice of parameter

๐‘ and therefore, ๐‘‰ โ€ฒ1is negative away from the origin.

5.2 Automated Cruise ControlOehlerking [29, Sect. 4.6] verifies the stability of an automatic

cruise controller modeled as a hybrid automaton with 6 operat-

ing modes and 11 transitions between them: normal proportional-

integral (PI) control, acceleration, service braking (2 modes), and

emergency braking (2 modes). Figure 4 shows an abridged version

of the corresponding KeYmaera X model (using ๐›ผctrl) with the PI

control mode, where ๐‘ฃ is the relative velocity to be controlled to

๐‘ฃ = 0 and ๐‘ฅ, ๐‘ก are auxiliary integral and timer variables used in the

controller. Briefly, this controller is designed to use the PI controller

near ๐‘ฃ = 0 for stability, while its other control modes drive the

system toward ๐‘ฃ = 0 by accelerating or braking.

Lyapunov function candidates for this model can be successfully

generated using the Stabhyli [26] stability tool for hybrid automata.

However, Stabhyli (with default configurations) outputs a Lyapunov

function candidate for the PI control mode that is numerically un-

sound, see Appendix B for the output and a counterexample; this is

a known issue with Stabhyli for control modes at the origin [26]. For

this case study, the issue is manually resolved by truncating terms

with very small magnitude coefficients in the generated output and

then checking in KeYmaera X that the arithmetical conditions for

the PI mode are satisfied exactly for the truncated candidate.

4An important technical requirement for๐‘‰2 to be well-defined is ๐‘“ โ‰  0. The case with

๐‘“ = 0 is also verified in KeYmaera X but the details are omitted here for brevity. It

does not require ghost switching and uses only๐‘‰1 as its common Lyapunov function.

Page 9: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

normalPI("v' = -0.001*x-0.052*v, x' = v, t' = 0& -15 <= v & v <= 15 & -500 <= x & x <= 500")

normalPI -->|"?(13 <= v & v <= 15 &-500 <= x & x <= 500); t := 0;"| sbrakeact

normalPI -->|"?(-15 <= v & v <= -14 &-500 <= x & x <= 500);"| accelerate

... // Other modes

\forall eps ( eps > 0 -> // Abridged stability specification...[ ... // Initialize{ { ... ++ // Transitions for other modes

?mode = normalPI();{ {?13 <= v & v <= 15 & -500 <= x & x <= 500; t := 0;}

mode := sbrakeact(); ++?-15 <= v & v <= -14 & -500 <= x & x <= 500;mode := accelerate(); ++mode := mode; } }

{ ... ++ // Plant ODEs for other modes?mode = normalPI();{ v' = -0.001*x-0.052*v, x' = v, t' = 0 &

-15 <= v & v <= 15 & -500 <= x & x <= 500 } }}*] v^2 < eps^2

Figure 4: Snippets of an automated cruise controller [29]modeled as a (switching) hybrid automaton. Users express the automa-ton within the description language (top left) and KeYmaera X visualizes the automaton on-the-fly (bottom left). The imple-mentation automatically generates the appropriate hybrid program representation and UGpAS specification (right); ++,&,()denote choice, conjunction, and constants in KeYmaera Xโ€™s ASCII syntax respectively.

Further insights from the controller design are used in the UGpAS

proof in KeYmaera X. Briefly, stability only concerns states and

modes that are active near the origin. Hence, the stability argument

and loop invariant only need to mention a single Lyapunov function

for the PI control mode, while choosing ๐›ฟ (in Def. 1) sufficiently

small so that none of the other modes can be entered.5Similarly, pre-

attractivity only requires reasoning about asymptotic convergenceto the origin for the PI control mode, hence it suffices to show that

the system leaves all other modes in finite time.

5.3 Brockettโ€™s Nonholonomic IntegratorVerification of stabilizing control laws for Brockettโ€™s nonholonomic

integrator [7] is of significant interest because stability for a large

class of models can be reduced to that of the integrator via co-

ordinate transformations, e.g., Liberzon [22] transforms a unicy-

cle model to the integrator and provides a stabilizing switching

control law corresponding to parking of the unicycle. The non-

holonomic integrator is described by the system of differential

equations ๐‘ฅ โ€ฒ = ๐‘ข,๐‘ฆโ€ฒ = ๐‘ฃ, ๐‘งโ€ฒ = ๐‘ฅ๐‘ฃ โˆ’ ๐‘ฆ๐‘ข, with state variables ๐‘ฅ,๐‘ฆ, ๐‘ง

and state feedback control inputs ๐‘ข = ๐‘ข (๐‘ฅ,๐‘ฆ, ๐‘ง), ๐‘ฃ = ๐‘ฃ (๐‘ฅ,๐‘ฆ, ๐‘ง) (to be

determined below). Notably, this is a classical example of a system

that is not stabilizable by purely continuous feedback control. In-

tuitively, no choice of controls ๐‘ข, ๐‘ฃ can produce motion along the

๐‘ง-axis (๐‘ฅ = ๐‘ฆ = 0). Thus, to stabilize the system to the origin, the

controller must first drive the system away from the ๐‘ง-axis before

switching to a control law that stabilizes the system from states

away from the ๐‘ง-axis. This intuition can be realized using two differ-

ent switching strategies that are analogous to the event-triggered

and time-triggered CPS design paradigms respectively [34].

5.3.1 Event-triggered Controller. Bloch and Drakunov [2] use the

switching controller ๐‘ข = โˆ’๐‘ฅ + ๐‘Ž๐‘ฆ sign(๐‘ง), ๐‘ฃ = โˆ’๐‘ฆ โˆ’ ๐‘Ž๐‘ฅ sign(๐‘ง) toasymptotically stabilize the integrator in the region

๐‘Ž2(๐‘ฅ2+๐‘ฆ2) โ‰ฅ |๐‘ง |

5In fact, the PI controller equations are exactly those of a linearized pendulum, which

has known Lyapunov functions [21, 45]. It could be interesting to modify Stabhyli to

accept user-provided Lyapunov function hints for certain modes.

for any given constant ๐‘Ž > 0. This controller first drives the system

towards the plane ๐‘ง = 0 and, once it reaches the plane, slides alongthe plane towards the origin. The closed-loop system is modeled

as an instance of state-dependent switching ๐›ผstate with 3 modes

depending on the sign of ๐‘ง and specification ๐‘ƒ๐‘’ :

A โ‰ก ๐‘ฅ โ€ฒ = โˆ’๐‘ฅ + ๐‘Ž๐‘ฆ,๐‘ฆโ€ฒ = โˆ’๐‘ฆ โˆ’ ๐‘Ž๐‘ฅ, ๐‘งโ€ฒ = โˆ’๐‘Ž(๐‘ฅ2 + ๐‘ฆ2) & ๐‘ง โ‰ฅ 0

B โ‰ก ๐‘ฅ โ€ฒ = โˆ’๐‘ฅ โˆ’ ๐‘Ž๐‘ฆ,๐‘ฆโ€ฒ = โˆ’๐‘ฆ + ๐‘Ž๐‘ฅ, ๐‘งโ€ฒ = ๐‘Ž(๐‘ฅ2 + ๐‘ฆ2) & ๐‘ง โ‰ค 0

C โ‰ก ๐‘ฅ โ€ฒ = โˆ’๐‘ฅ,๐‘ฆโ€ฒ = โˆ’๐‘ฆ, ๐‘งโ€ฒ = 0& ๐‘ง = 0

๐›ผ๐‘’ โ‰ก(A โˆช B โˆช C

)โˆ—๐‘ƒ๐‘’ โ‰ก ๐‘Ž > 0 โ†’ UStab(๐›ผ)โˆง

โˆ€๐›ฟ>0โˆ€Y>0โˆƒ๐‘‡โ‰ฅ0โˆ€๐‘ฅ,๐‘ฆ, ๐‘ง(โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ < ๐›ฟ โˆง ๐‘Ž

2

(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง | โ†’

[๐‘ก := 0;๐›ผ๐‘’ , ๐‘กโ€ฒ = 1] (๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ < Y

)The specification ๐‘ƒ๐‘’ is identical to UGpAS except it restricts

pre-attractivity to the applicable region๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง | for the

controller.6Its verification uses the squared norm ๐‘‰ = ๐‘ฅ2 + ๐‘ฆ2 + ๐‘ง2

as a common Lyapunov function. The key modification to the pre-

attractivity proof, cf. Section 3.1, is to use (and verify) the fact that

๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง | is a loop invariant of ๐›ผ๐‘’ . This additional invariant

corresponds to the fact that the controller keeps the system within

its applicable region (if the system is initially within that region).

In fact, ๐›ผ๐‘’ can be extended to a globally stabilizing controller,

as modeled by ๐›ผ๐‘’ below (if, else branching is supported as an

6The applicable region is equivalently characterized by the real arithmetic for-

mula (๐‘งโ‰ฅ0 โ†’ ๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ๐‘ง) โˆง (๐‘งโ‰ค0 โ†’ ๐‘Ž

2(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅโˆ’๐‘ง) but this is omitted for

brevity.

Page 10: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

abbreviation in KeYmaera X [34]):

D โ‰ก ๐‘ฅ โ€ฒ = ๐‘ข,๐‘ฆโ€ฒ = ๐‘ฃ, ๐‘งโ€ฒ = ๐‘ฅ๐‘ฃ โˆ’ ๐‘ฆ๐‘ข &๐‘Ž

2

(๐‘ฅ2 + ๐‘ฆ2) โ‰ค |๐‘ง |

E โ‰ก ๐‘ฅ โ€ฒ = ๐‘ข,๐‘ฆโ€ฒ = ๐‘ฃ, ๐‘งโ€ฒ = ๐‘ฅ๐‘ฃ โˆ’ ๐‘ฆ๐‘ข &๐‘Ž

2

(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง |

๐›ผ๐‘’ โ‰ก(if

(๐‘Ž2

(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง |) {

A โˆช B โˆช C

}else

{if((๐‘ฅ โˆ’ ๐‘ฆ)๐‘ง โ‰ค 0){๐‘ข := ๐‘; ๐‘ฃ := ๐‘}

else{๐‘ข :=โˆ’๐‘; ๐‘ฃ :=โˆ’๐‘};{D โˆช E

} })โˆ—If the system is in the applicable region (outer if branch), then

the previous controller from ๐›ผ๐‘’ is used. Otherwise, outside the

applicable region (outer else branch), the system applies a constant

control ๐‘ > 0 chosen to drive the system into the applicable region.

The pair of ODEs D and E model an event-trigger in dL [34],

where the switching controller is triggered to make its next decision

when the system reaches the switching surface๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) = |๐‘ง |.

The specification ๐‘ƒ๐‘’ โ‰ก ๐‘Ž > 0 โˆง ๐‘ > 0 โ†’ UGpAS(๐›ผ๐‘’ ) is provedby modifying the loop invariants to account for the initial pe-

riod where the system is outside the applicable region, e.g., the

stability loop invariant Inv๐‘  โ‰ก (ยฌ๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง | โ†’ |๐‘ง |<๐›ฟ) โˆง

( ๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) โ‰ฅ |๐‘ง | โ†’ โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ<Y) expresses that the controller keeps

|๐‘ง | sufficiently small to preserve stability outside the applicable re-

gion.

5.3.2 Time-triggered Controller. The time-triggered switching strat-

egy [34], modeled by ๐›ผ๐œ below, is similar to that proposed by Liber-

zon [22, Section 4.2]. If the system is on the ๐‘ง-axis and away from

the origin A , the controller sets an internal stopwatch ๐œ and drives

the system away from the axis for maximum duration ๐‘‡0 > 0 with

๐‘ข = ๐‘ง, ๐‘ฃ = ๐‘ง. Otherwise B , the controller drives the system towards

the origin along a parabolic curve of the form๐‘Ž2(๐‘ฅ2 + ๐‘ฆ2) = ๐‘ง.

๐›ผ๐œ โ‰ก(if(๐‘ฅ = 0 โˆง ๐‘ฆ = 0 โˆง ๐‘ง โ‰  0)

{A ๐œ := 0;๐‘ฅ โ€ฒ = ๐‘ง,๐‘ฆโ€ฒ = ๐‘ง, ๐‘งโ€ฒ = ๐‘ฅ๐‘ง โˆ’ ๐‘ฆ๐‘ง &๐œ โ‰ค ๐‘‡0

}else

{๐‘Ž :=

2๐‘ง

๐‘ฅ2 + ๐‘ฆ2;

B ๐‘ฅ โ€ฒ = โˆ’๐‘ฅ + ๐‘Ž๐‘ฆ,๐‘ฆโ€ฒ = โˆ’๐‘ฆ โˆ’ ๐‘Ž๐‘ฅ, ๐‘งโ€ฒ = โˆ’๐‘Ž(๐‘ฅ2 + ๐‘ฆ2)})โˆ—

The specification ๐‘ƒ๐œ โ‰ก ๐‘‡0 > 0 โ†’ UGpAS(๐›ผ๐œ ) is again proved by

analyzing both cases of the controller in the loop invariants, e.g.,

with the pre-attractivity invariant Inv๐‘Ž :(๐‘ฅ = 0 โˆง ๐‘ฆ = 0 โˆง ๐‘ง โ‰  0 โ†’ |๐‘ง | < ๐›ฟ โˆง ๐‘ก = 0

)โˆง(

ยฌ(๐‘ฅ = 0 โˆง ๐‘ฆ = 0 โˆง ๐‘ง โ‰  0) โ†’โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ > Y โ†’ โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ2 < ๐›ฟ2 (2๐‘‡ 2

0+ 1) โˆ’ Y2 (๐‘ก โˆ’๐‘‡0)

)The left conjunct says the system may start transiently on the

๐‘ง-axis (away from ๐‘ง = 0) at time ๐‘ก = 0. The right conjunct gives ex-

plicit bounds on โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ , which, for sufficiently large ๐‘ก โ‰ฅ ๐‘‡ implies

that the system enters โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ < Y as required for pre-attractivity.

The transient term ๐›ฟ2 (2๐‘‡ 2

0+ 1) upper bounds the (squared) norm of

the system state after starting on the ๐‘ง-axis in ball โˆฅ๐‘ฅ,๐‘ฆ, ๐‘งโˆฅ < ๐›ฟ and

following mode A for the maximum stopwatch duration ๐œ = ๐‘‡0.

6 RELATEDWORKSwitched Systems. Comprehensive introductions to the analysis

and design of switching control can be found in the literature [10, 22,

44]. An important design consideration (which this paper sidesteps,

cf. Remark 1) is whether a given switched or hybrid system has com-

plete solutions [16, 17, 23, 49]. Justification of such design consider-

ations, and other stability notions of interest for switching designs,

e.g., quadratic, region, or set-based stability [16, 17, 22, 36, 44], can

be done in dL with appropriate formal specifications of the desired

properties from the literature [32, 34, 45, 46]. Another complemen-

tary question is how to design a switching control law that stabilizesa given system. Switching design approaches are often guided by

underlying stability arguments [22, 39, 44]; the loop invariants

from Section 3 are expected to help guide correct-by-construction

synthesis of such controllers.

Stability Analysis and Verification. Corollaries 3โ€“6 formalize var-

ious Lyapunov function-based stability arguments from the litera-

ture [5, 48] using loop invariants, yielding trustworthy, computer-

checked stability proofs in KeYmaera X [11, 12]. Other computer-

aided approaches for switched system stability analysis are based

on finding Lyapunov functions that satisfy the requisite arith-

metical conditions [20, 26, 29, 38, 41, 42]. Although the search for

such functions can often be done efficiently with numerical tech-

niques [26, 31, 38], various authors have emphasized the need to

check that their outputs satisfy the arithmetical conditions exactly,i.e., without numerical errors compromising the resulting stabil-

ity claims [1, 20, 40] (see, e.g., Section 5.2). This paperโ€™s deductive

approach goes further as it comprehensively verifies all steps ofthe stability argument down to its underlying discrete and contin-

uous reasoning steps [33, 34]. The generality of this approach is

precisely what enables verification of various classes of switching

mechanisms all within a common logical framework (Section 3)

and verification of non-standard stability arguments (Section 5).

Alternative approaches to stability verification are based on ab-

straction [15, 43] and model checking [36].

7 CONCLUSIONThis paper shows how to deductively verify switched system sta-

bility, using dLโ€™s nested quantification over hybrid programs to

specify stability, and dLโ€™s axiomatics to prove those specifications.

Loop invariantsโ€”a classical technique from verificationโ€”are used

to succinctly capture the desired properties of a given switching

design; through deductive proofs, these invariants yield system-

atic, correct-by-construction derivation of the requisite arithmetical

conditions on Lyapunov functions for stability arguments in imple-

mentations. An interesting direction for future work is to use other

Lyapunov function generation techniques [20, 26, 29, 42], whichโ€”

thanks to the presented approachโ€”do not have to be trusted since

their results can be checked independently by KeYmaera X. This

would enable fully automated, yet sound and trustworthy verifica-

tion of switched system stability based on dLโ€™s parsimonious hybrid

program reasoning principles.

Page 11: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

ACKNOWLEDGMENTSThis research was sponsored by the AFOSR under grant number

FA9550-16-1-0288. The first author was also supported by A*STAR,

Singapore.

The views and conclusions contained in this document are those

of the authors and should not be interpreted as representing the

official policies, either expressed or implied, of any sponsoring

institution, the U.S. government or any other entity.

REFERENCES[1] Daniele Ahmed, Andrea Peruffo, and Alessandro Abate. 2020. Automated and

Sound Synthesis of Lyapunov Functions with SMT Solvers. In TACAS (LNCS),Armin Biere and David Parker (Eds.), Vol. 12078. Springer, 97โ€“114. https://doi.

org/10.1007/978-3-030-45190-5_6

[2] Anthony Bloch and Sergey Drakunov. 1996. Stabilization and tracking in the

nonholonomic integrator via sliding modes. Systems & Control Letters 29, 2 (1996),91โ€“99. https://doi.org/10.1016/S0167-6911(96)00049-7

[3] Jacek Bochnak, Michel Coste, and Marie-Franรงoise Roy. 1998. Real AlgebraicGeometry. Springer, Heidelberg. https://doi.org/10.1007/978-3-662-03718-8

[4] Michael S. Branicky. 1994. Analyzing continuous switching systems: theory and

examples. In ACC, Vol. 3. 3110โ€“3114. https://doi.org/10.1109/ACC.1994.735143

[5] Michael S. Branicky. 1998. Multiple Lyapunov functions and other analysis

tools for switched and hybrid systems. IEEE Trans. Autom. Control. 43, 4 (1998),475โ€“482. https://doi.org/10.1109/9.664150

[6] Michael S. Branicky. 2005. Introduction to Hybrid Systems. In Handbook of Net-worked and Embedded Control Systems, Dimitrios Hristu-Varsakelis andWilliam S.

Levine (Eds.). Birkhรคuser, 91โ€“116. https://doi.org/10.1007/0-8176-4404-0_5

[7] R. W. Brockett. 1983. Asymptotic stability and feedback stabilization. In Differen-tial Geometric Control Theory. Birkhauser, 181โ€“191.

[8] Carmen Chicone. 2006. Ordinary Differential Equations with Applications, SecondEdition. Springer-Verlag New York. https://doi.org/10.1007/0-387-35794-7

[9] Jorge Cortes. 2008. Discontinuous dynamical systems. IEEE Control SystemsMagazine 28, 3 (2008), 36โ€“73. https://doi.org/10.1109/MCS.2008.919306

[10] Raymond A. Decarlo, Michael S. Branicky, Stefan Pettersson, and Bengt Lennart-

son. 2000. Perspectives and results on the stability and stabilizability of hybrid

systems. Proc. IEEE 88, 7 (2000), 1069โ€“1082. https://doi.org/10.1109/5.871309

[11] Nathan Fulton, Stefan Mitsch, Brandon Bohrer, and Andrรฉ Platzer. 2017.

Bellerophon: Tactical Theorem Proving for Hybrid Systems. In ITP (LNCS),Mauricio Ayala-Rincรณn and Cรฉsar A. Muรฑoz (Eds.), Vol. 10499. Springer, 207โ€“224.

https://doi.org/10.1007/978-3-319-66107-0_14

[12] Nathan Fulton, Stefan Mitsch, Jan-David Quesel, Marcus Vรถlp, and Andrรฉ Platzer.

2015. KeYmaera X: An Axiomatic Tactical Theorem Prover for Hybrid Systems.

In CADE (LNCS), Amy P. Felty and Aart Middeldorp (Eds.), Vol. 9195. Springer,

Cham, 527โ€“538. https://doi.org/10.1007/978-3-319-21401-6_36

[13] Sicun Gao, James Kapinski, Jyotirmoy V. Deshmukh, Nima Roohi, Armando Solar-

Lezama, Nikos Arรฉchiga, and Soonho Kong. 2019. Numerically-Robust Inductive

Proof Rules for Continuous Dynamical Systems. In CAV (LNCS), Isil Dillig andSerdar Tasiran (Eds.), Vol. 11562. Springer, 137โ€“154. https://doi.org/10.1007/978-

3-030-25543-5_9

[14] Sicun Gao, Soonho Kong, and Edmund M. Clarke. 2013. dReal: An SMT Solver for

Nonlinear Theories over the Reals. In CADE (LNCS), Maria Paola Bonacina (Ed.),

Vol. 7898. Springer, 208โ€“214. https://doi.org/10.1007/978-3-642-38574-2_14

[15] Miriam Garcรญa Soto and Pavithra Prabhakar. 2020. Abstraction based verification

of stability of polyhedral switched systems. Nonlinear Analysis: Hybrid Systems36 (2020), 100856. https://doi.org/10.1016/j.nahs.2020.100856

[16] Rafal Goebel, Ricardo G. Sanfelice, and Andrew R. Teel. 2009. Hybrid dynamical

systems. IEEE Control Systems Magazine 29, 2 (2009), 28โ€“93. https://doi.org/10.

1109/MCS.2008.931718

[17] Rafal Goebel, Ricardo G. Sanfelice, and Andrew R. Teel. 2012. Hybrid DynamicalSystems: Modeling, Stability, and Robustness. Princeton University Press.

[18] Thomas A. Henzinger. 1996. The Theory of Hybrid Automata. In LICS. IEEEComputer Society, 278โ€“292.

[19] Martin Johansson and Anders Rantzer. 1998. Computation of piecewise quadratic

Lyapunov functions for hybrid systems. IEEE Trans. Autom. Control. 43, 4 (1998),555โ€“559. https://doi.org/10.1109/9.664157

[20] James Kapinski, Jyotirmoy V. Deshmukh, Sriram Sankaranarayanan, and Nikos

Arรฉchiga. 2014. Simulation-guided Lyapunov analysis for hybrid dynamical

systems. In HSCC, Martin Frรคnzle and John Lygeros (Eds.). ACM, 133โ€“142. https:

//doi.org/10.1145/2562059.2562139

[21] Hassan K. Khalil. 1992. Nonlinear systems. Macmillan Publishing Company, New

York. xii+564 pages.

[22] Daniel Liberzon. 2003. Switching in Systems and Control. Birkhรคuser. https:

//doi.org/10.1007/978-1-4612-0017-8

[23] John Lygeros, Karl Henrik Johansson, Slobodan N. Simic, Jun Zhang, and

Shankar S. Sastry. 2003. Dynamical properties of hybrid automata. IEEE Trans.Autom. Control. 48, 1 (2003), 2โ€“17. https://doi.org/10.1109/TAC.2002.806650

[24] Stefan Mitsch and Andrรฉ Platzer. 2016. The KeYmaera X proof IDE: Concepts

on usability in hybrid systems theorem proving. In 3rd Workshop on FormalIntegrated Development Environment (EPTCS), Catherine Dubois, Paolo Masci,

and Dominique Mรฉry (Eds.), Vol. 240. 67โ€“81. https://doi.org/10.4204/EPTCS.240.5

[25] Stefan Mitsch and Andrรฉ Platzer. 2020. A Retrospective on Developing Hybrid

Systems Provers in the KeYmaera Family - A Tale of Three Provers. In DeductiveSoftware Verification: Future Perspectives - Reflections on the Occasion of 20 Yearsof KeY, Wolfgang Ahrendt, Bernhard Beckert, Richard Bubel, Reiner Hรคhnle, and

Matthias Ulbrich (Eds.). LNCS, Vol. 12345. Springer, 21โ€“64. https://doi.org/10.

1007/978-3-030-64354-6_2

[26] Eike Mรถhlmann and Oliver E. Theel. 2013. Stabhyli: a tool for automatic stability

verification of non-linear hybrid systems. In HSCC, Calin Belta and Franjo Ivancic(Eds.). ACM, 107โ€“112. https://doi.org/10.1145/2461328.2461347

[27] Eike Mรถhlmann and Oliver E. Theel. 2021. Stabhyli. https://uol.de/svs/forschung/

avacs/stabhyli [Online; accessed 27-October-2021].

[28] A. S. Morse. 1995. Control Using Logic-Based Switching. In Trends in Control,Alberto Isidori (Ed.). Springer London, London, 69โ€“113. https://doi.org/10.1007/

978-1-4471-3061-1_4

[29] Jens Oehlerking. 2011. Decomposition of stability proofs for hybrid systems. Ph.D.Dissertation. Carl von Ossietzky University of Oldenburg. https://oops.uni-

oldenburg.de/id/eprint/1375

[30] Susan S. Owicki and David Gries. 1976. Verifying Properties of Parallel Programs:

An Axiomatic Approach. Commun. ACM 19, 5 (1976), 279โ€“285. https://doi.org/

10.1145/360051.360224

[31] A. Papachristodoulou, J. Anderson, G. Valmorbida, S. Prajna, P. Seiler, P. A.

Parrilo, M. M. Peet, and D. Jagt. 2021. SOSTOOLS: Sum of squares optimizationtoolbox for MATLAB. http://arxiv.org/abs/1310.4716. Available from

https://github.com/oxfordcontrol/SOSTOOLS.[32] Andrรฉ Platzer. 2010. Logical Analysis of Hybrid Systems - Proving Theorems for

Complex Dynamics. Springer. https://doi.org/10.1007/978-3-642-14509-4

[33] Andrรฉ Platzer. 2017. A Complete Uniform Substitution Calculus for Differential

Dynamic Logic. J. Autom. Reasoning 59, 2 (2017), 219โ€“265. https://doi.org/10.

1007/s10817-016-9385-1

[34] Andrรฉ Platzer. 2018. Logical Foundations of Cyber-Physical Systems. Springer,Cham. https://doi.org/10.1007/978-3-319-63588-0

[35] Andrรฉ Platzer and Yong Kiam Tan. 2020. Differential Equation Invariance Axiom-

atization. J. ACM 67, 1, Article 6 (2020), 66 pages. https://doi.org/10.1145/3380825

[36] Andreas Podelski and Silke Wagner. 2006. Model Checking of Hybrid Systems:

From Reachability Towards Stability. In HSCC (LNCS), Joรฃo P. Hespanha and

Ashish Tiwari (Eds.), Vol. 3927. Springer, 507โ€“521. https://doi.org/10.1007/

11730637_38

[37] Stephen Prajna, Ali Jadbabaie, and George J. Pappas. 2007. A Framework for

Worst-Case and Stochastic Safety Verification Using Barrier Certificates. IEEETrans. Automat. Contr. 52, 8 (2007), 1415โ€“1428. https://doi.org/10.1109/TAC.2007.

902736

[38] S. Prajna and A. Papachristodoulou. 2003. Analysis of switched and hybrid

systems - beyond piecewise quadratic methods. In ACC, Vol. 4. 2779โ€“2784 vol.4.https://doi.org/10.1109/ACC.2003.1243743

[39] Hadi Ravanbakhsh and Sriram Sankaranarayanan. 2015. Counter-Example

Guided Synthesis of control Lyapunov functions for switched systems. In CDC.IEEE, 4232โ€“4239. https://doi.org/10.1109/CDC.2015.7402879

[40] Pierre Roux, Yuen-Lam Voronin, and Sriram Sankaranarayanan. 2018. Validating

numerical semidefinite programming solvers for polynomial invariants. FormalMethods Syst. Des. 53, 2 (2018), 286โ€“312. https://doi.org/10.1007/s10703-017-

0302-y

[41] Sriram Sankaranarayanan, Xin Chen, and Erika รbrahรกm. 2013. Lyapunov

Function Synthesis Using Handelman Representations. In NOLCOS, Sophie Tar-bouriech and Miroslav Krstic (Eds.). International Federation of Automatic Con-

trol, 576โ€“581. https://doi.org/10.3182/20130904-3-FR-2041.00198

[42] Zhikun She and Bai Xue. 2014. Discovering Multiple Lyapunov Functions for

Switched Hybrid Systems. SIAM J. Control. Optim. 52, 5 (2014), 3312โ€“3340.

https://doi.org/10.1137/130934313

[43] Miriam Garcรญa Soto and Pavithra Prabhakar. 2018. Averist: Algorithmic Verifier

for Stability of Linear Hybrid Systems. In HSCC, Maria Prandini and Jyotirmoy V.

Deshmukh (Eds.). ACM, 259โ€“264. https://doi.org/10.1145/3178126.3178154

[44] Zhendong Sun and Shuzhi Sam Ge. 2011. Stability Theory of Switched DynamicalSystems. Springer. https://doi.org/10.1007/978-0-85729-256-8

[45] Yong Kiam Tan and Andrรฉ Platzer. 2021. Deductive Stability Proofs for Ordinary

Differential Equations. In TACAS (LNCS), Jan Friso Groote and Kim Guldstrand

Larsen (Eds.), Vol. 12652. Springer, 181โ€“199. https://doi.org/10.1007/978-3-030-

72013-1_10

[46] Yong KiamTan andAndrรฉ Platzer. 2021. Switched Systems as Hybrid Programs. In

ADHS (IFAC-PapersOnLine), Raphaรซl M. Jungers, Necmiye Ozay, and Alessandro

Abate (Eds.), Vol. 54. Elsevier, 247โ€“252. https://doi.org/10.1016/j.ifacol.2021.08.506

Page 12: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

[47] Alfred Tarski. 1951. A Decision Method for Elementary Algebra and Geometry.RAND Corporation, Santa Monica, CA.

[48] Guisheng Zhai, Bo Hu, Kazunori Yasuda, and Anthony N. Michel. 2001. Stability

analysis of switched systems with stable and unstable subsystems: An average

dwell time approach. Int. J. Syst. Sci. 32, 8 (2001), 1055โ€“1061. https://doi.org/10.

1080/00207720116692

[49] Jun Zhang, Karl Henrik Johansson, John Lygeros, and Shankar Sastry. 2001.

Zeno hybrid systems. Int. J. Robust Nonlinear Control. 11, 5 (2001), 435โ€“451.

https://doi.org/10.1002/rnc.592

A PROOFSThis appendix provides proofs for the results presented in the main

paper. Relevant background for dLโ€™s semantics and axiomatics is

given, expanding on the material in Section 2. Full definitions are

available in the literature [33, 34].

A dL state ๐œ” : V โ†’ R assigns a real value to each variable in

V . The set of variables V consists of the continuously evolving

state variables ๐‘ฅ = (๐‘ฅ1, . . . , ๐‘ฅ๐‘›) of a switched system model and

additional variables V \ {๐‘ฅ} used as program auxiliaries for those

models. Following Tan and Platzer [46], dL states are projected on

the state variables ๐‘ฅ and the (projected) dL states๐œ” are equivalently

treated as points in R๐‘› . The semantics of program auxiliaries is as

usual [34]. The axioms and proof rules of dL used in the proofs are

as follows.

[:=] [๐‘ฅ := ๐‘’]๐‘ƒ (๐‘ฅ) โ†” ๐‘ƒ (๐‘’) (๐‘’ free for ๐‘ฅ in ๐‘ƒ )

[?] [?๐‘„]๐‘ƒ โ†” (๐‘„ โ†’ ๐‘ƒ)

[;] [๐›ผ ; ๐›ฝ]๐‘ƒ โ†” [๐›ผ] [๐›ฝ]๐‘ƒ

[โˆช] [๐›ผ โˆช ๐›ฝ]๐‘ƒ โ†” [๐›ผ]๐‘ƒ โˆง [๐›ฝ]๐‘ƒ

[โˆ—] [๐›ผโˆ—]๐‘ƒ โ†” ๐‘ƒ โˆง [๐›ผ] [๐›ผโˆ—]๐‘ƒ

loop

ฮ“ โŠข Inv Inv โŠข [๐›ผ] Inv Inv โŠข ๐œ™

ฮ“ โŠข [๐›ผโˆ—]๐œ™

loopT

ฮ“ โŠข [๐›ผ๐‘– ]Inv Inv โŠข [๐›ผ๐‘ข ]Inv Inv โŠข [๐›ผ๐‘ ]Inv Inv โŠข ๐œ™

ฮ“ โŠข [๐›ผ๐‘– ; (๐›ผ๐‘ข ;๐›ผ๐‘ )โˆ—]๐œ™

G

โŠข ๐‘ƒ

ฮ“ โŠข [๐›ผ]๐‘ƒ M[ยท]๐‘… โŠข ๐‘ƒ ฮ“ โŠข [๐›ผ]๐‘…

ฮ“ โŠข [๐›ผ]๐‘ƒ

dIโ‰ฝ

ฮ“, ๐‘„ โŠข ๐‘โ‰ฝ๐‘ž ๐‘„ โŠข L๐‘“ (๐‘ฅ) (๐‘)โ‰ฅL๐‘“ (๐‘ฅ) (๐‘ž)

ฮ“ โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„]๐‘โ‰ฝ๐‘ž (โ‰ฝ is either โ‰ฅ or >)

dC

ฮ“ โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„]๐ถ ฮ“ โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„ โˆง๐ถ]๐‘ƒฮ“ โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„]๐‘ƒ

dW

๐‘„ โŠข ๐‘ƒ

ฮ“ โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„]๐‘ƒ

dbxโ‰ฝ

๐‘„ โŠข L๐‘“ (๐‘ฅ) (๐‘) โ‰ฅ ๐‘”๐‘

๐‘ โ‰ฝ 0 โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„]๐‘ โ‰ฝ 0

(โ‰ฝ is either โ‰ฅ or >)

Barr

๐‘„, ๐‘ = 0 โŠข L๐‘“ (๐‘ฅ) (๐‘) > 0

ฮ“, ๐‘ โ‰ฝ 0 โŠข [๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„]๐‘ โ‰ฝ 0

(โ‰ฝ is either โ‰ฅ or >)

DCC

[๐‘ฅ โ€ฒ=๐‘“ (๐‘ฅ) &๐‘„โˆง๐‘ƒ]๐‘… โˆง [๐‘ฅ โ€ฒ=๐‘“ (๐‘ฅ) &๐‘„] (ยฌ๐‘ƒโ†’[๐‘ฅ โ€ฒ=๐‘“ (๐‘ฅ) &๐‘„]ยฌ๐‘ƒ)โ†’ [๐‘ฅ โ€ฒ=๐‘“ (๐‘ฅ) &๐‘„] (๐‘ƒ โ†’ ๐‘…)

DX [๐‘ฅ โ€ฒ=๐‘“ (๐‘ฅ) &๐‘„]๐‘ƒ โ†” (๐‘„ โ†’ ๐‘ƒ โˆง [๐‘ฅ โ€ฒ=๐‘“ (๐‘ฅ) &๐‘„]๐‘ƒ) (๐‘ฅ โ€ฒ โˆ‰ ๐‘ƒ,๐‘„)

Axioms [:=], [?], [;], [โˆช], [โˆ—] unfold box modalities of their re-

spective hybrid programs according to their semantics [33, 34].

These equivalences are especially useful for obtaining correct-by-

construction arithmetical conditions on Lyapunov functions in

derivations and implementations (see Corollaries 5 and 6). The de-

rived loop induction rules loop, loopT are used to prove stability

properties of switched system models with suitably chosen loop

invariants Inv (see Section 3). Rule G is Gรถdel generalization, and

rule M[ยท] is the derived monotonicity rule for box modality post-

conditions; antecedents that have no free variables bound in ๐›ผ are

soundly kept across uses of rules loop, loopT, G, M[ยท] [33, 34].The remaining axioms and proof rules are used in dL to reason

about differential equations ๐‘ฅ โ€ฒ = ๐‘“ (๐‘ฅ) &๐‘„ [33โ€“35, 45]. Differential

invariants dIโ‰ฝ proves ODE invariance for an inequality ๐‘ โ‰ฝ ๐‘ž

if their Lie derivatives satisfy L๐‘“ (๐‘ฅ) (๐‘) โ‰ฅ L

๐‘“ (๐‘ฅ) (๐‘ž). Differentialcuts dC say that if one can separately prove that formula ๐ถ is al-

ways satisfied along the solution, then ๐ถ may be assumed in the

domain constraint when proving the same for formula ๐‘ƒ . Differ-

ential weakening dW says that postcondition ๐‘ƒ is always satisfied

along solutions if it is already implied by the domain constraint.

Rule dbxโ‰ฝ is the Darboux inequality proof rule for the invariance

of ๐‘ โ‰ฝ 0, where ๐‘” is an arbitrary cofactor term [35]. Rule Barr is

a dL rendition of the strict barrier certificates proof rule [37] for

invariance of ๐‘ โ‰ฝ 0. Axiom DCC says that to prove that an impli-

cation ๐‘ƒ โ†’ ๐‘… is always true along an ODE, it suffices to prove it

assuming ๐‘ƒ in the domain if ยฌ๐‘ƒ is invariant along the ODE [45].

Differential skip DX unfolds the effect of a differential equation on

the initial state in the box modality.

To improve readability in the proofs below, formula and premises

are often abbreviated, e.g., with aโ—‹, 1โ—‹. To avoid confusion, the scope

of these abbreviations always extend to the end of each paragraphlabel, i.e., the abbreviations used in the Stability proofs should not

be confused with those used in the Pre-attractivity proofs.

Proof of Lemma 2. Letฮฆ(๐‘ฅ) denote the set of all domain-obeying

solutions ๐œ‘ : [0,๐‘‡๐œ‘ ] โ†’ R๐‘› for a given switched system from state

๐‘ฅ โˆˆ R๐‘› as in Def. 1. Hybrid program ๐›ผ models this switched system

if for any initial state ๐œ” โˆˆ R๐‘› , the state a is reachable from ๐œ” , i.e.,

(๐œ”, a) โˆˆ [[๐›ผ]] , iff a = ๐œ‘ (๐œ) for some ๐œ‘ โˆˆ ฮฆ(๐œ”) and ๐œ โˆˆ [0,๐‘‡๐œ‘ ]. Forthe augmented program๐›ผ, ๐‘ก โ€ฒ = 1, in particular, ๐‘ก syntactically tracks

the progression of time so that (๐œ”, a) โˆˆ [[๐›ผ, ๐‘ก โ€ฒ = 1]] iff a = ๐œ‘ (๐œ) forsome ๐œ‘ โˆˆ ฮฆ(๐œ”) and ๐œ = a (๐‘ก) โˆ’๐œ” (๐‘ก). Tan and Platzer [46] prove the

adequacy of hybrid program models for several switching designs.

The formulas UStab(๐›ผ) and UGpAttr(๐›ผ) syntactically express

their respective quantifiers from Def. 1, where the box modality [ยท]is used in both formulas to quantify over all reachable states of ๐›ผ

(and ๐›ผ, ๐‘ก โ€ฒ = 1), i.e., all times ๐œ โˆˆ [0,๐‘‡๐œ‘ ] along all solutions ๐œ‘ โˆˆ ฮฆ.Thus, the correctness of these specifications follows directly from

the definition of dLโ€™s formula semantics [33, 34]. In UGpAttr(๐›ผ),variable ๐‘ก is set to 0 initially, so the implication ๐‘ก โ‰ฅ ๐‘‡ โ†’ . . . in

the postcondition of the box modality further restricts temporal

quantification to all times ๐œ” (๐‘‡ ) โ‰ค ๐œ โ‰ค ๐‘‡๐œ‘ for ๐œ‘ โˆˆ ฮฆ(๐œ”), as requiredin the definition of uniform pre-attractivity. โ–ก

Proof of Corollary 3. The proof rule CLF is an instance of

rule MLF from Corollary 4 where the Lyapunov functions for all

modes ๐‘ โˆˆ P are chosen identically with ๐‘‰๐‘ = ๐‘‰ . Nevertheless, a

full derivation of CLF is given here because it provides the building

blocks used in later derivations. The stability and pre-attractivity

conjuncts of UGpAS(๐›ผstate) are proved separately with โˆงR:

Page 13: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

โŠข UStab(๐›ผstate) โŠข UGpAttr(๐›ผstate)โˆงR โŠข UGpAS(๐›ผstate)

Stability. The derivation for stability begins by Skolemizing the

succedent with โˆ€R,โ†’R, followed by two arithmetic cuts which are

justified as follows. For any Y > 0, the Lyapunov function๐‘‰ attains a

minimum value on the compact set characterized by โˆฅ๐‘ฅ โˆฅ = Y. From

the first (topmost) premise of rule CLF, this minimum is attained

away from the origin so it is positive, which proves the first cut

of formula โˆƒ๐‘Š >0 aโ—‹ where aโ—‹ โ‰ก โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ = Y โ†’ ๐‘‰ โ‰ฅ ๐‘Š ). AfterSkolemizing๐‘Š withโˆƒL, the premise๐‘‰ (0) = 0 implies, by continuity

of dL term semantics [33], that the sublevel set characterized by

๐‘‰ <๐‘Š with๐‘Š > 0 (see Fig. 1) contains a sufficiently small ๐›ฟ ball

around the origin. This proves the second arithmetic cut with the

formula โˆƒ๐›ฟ (0 < ๐›ฟ โ‰ค Y โˆง bโ—‹) where bโ—‹ โ‰ก โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰ <๐‘Š ).After both cuts, the antecedent ๐›ฟ is used to witness the succedent

by โˆƒR.aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)โˆƒR

aโ—‹, 0 < ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹ โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)cut, R, โˆƒL Y>0 โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)โˆ€R,โ†’R โŠข UStab(๐›ผstate)

The derivation continues from the open premise by Skolemiz-

ing with โˆ€R, โ†’R and proving the LHS of the implication in bโ—‹with โˆ€L, โ†’L. Then, the loop rule is used with the stability loop in-

variant Inv๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Y โˆง๐‘‰ <๐‘Š . This results in three premises, 1โ—‹which shows that the invariant is implied by the initial antecedent

assumptions, 2โ—‹, the crucial premise, which shows that the invari-

ant Inv๐‘  is preserved across the loop body of ๐›ผstate, and 3โ—‹ which

shows that the invariant implies the postcondition. These premises

are shown and proved further below.

1โ—‹ 2โ—‹ 3โ—‹loop

aโ—‹, ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,๐‘‰ <๐‘Š โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Yโˆ€L, โ†’L

aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Yโˆ€R, โ†’R

aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ<๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)Premise 1โ—‹ proves by R from the antecedents using the inequali-

ties โˆฅ๐‘ฅ โˆฅ < ๐›ฟ and ๐›ฟ โ‰ค Y.

โˆ—R๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,๐‘‰ <๐‘Š โŠข Inv๐‘ 

Premise 3โ—‹ proves trivially since the postcondition โˆฅ๐‘ฅ โˆฅ < Y is

part of the loop invariant:

โˆ—RInv๐‘  โŠข โˆฅ๐‘ฅ โˆฅ < Y

The derivation continues from premise 2โ—‹ by unfolding the loop

body of ๐›ผstate with [โˆช], โˆงR. This results in one premise for each

switching choice ๐‘ โˆˆ P, indexed below by ๐‘ .

aโ—‹, Inv๐‘  โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ [โˆช], โˆงR

aโ—‹, Inv๐‘  โŠข [โ‹ƒ๐‘โˆˆP ๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ Each of these ๐‘ โˆˆ P premises is an ODE invariance question,

which is decidable in dL [35]. The derivation below shows how

to derive arithmetical conditions on ๐‘‰ from these premises. The

right conjunct of Inv๐‘  , ๐‘‰ <๐‘Š , is added to the domain constraint

with a dC step; the cut premise is labeled 4โ—‹ and proved below. A

subsequent dC step adds โˆฅ๐‘ฅ โˆฅ โ‰  Y to the domain constraint using

the contrapositive of antecedent aโ—‹ and the derivation is completed

with rule Barr since the resulting assumptions are contradictory.

โˆ—R โˆฅ๐‘ฅ โˆฅ โ‰  Y, โˆฅ๐‘ฅ โˆฅ=Y โŠข false

Barr โˆฅ๐‘ฅ โˆฅ < Y โŠข [๐‘ฅโ€ฒ=๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ โˆง๐‘‰ <๐‘Š โˆง โˆฅ๐‘ฅ โˆฅ โ‰  Y ] โˆฅ๐‘ฅ โˆฅ < YdC

aโ—‹, โˆฅ๐‘ฅ โˆฅ < Y โŠข [๐‘ฅโ€ฒ=๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ โˆง๐‘‰ <๐‘Š ] โˆฅ๐‘ฅ โˆฅ < Y 4โ—‹dC

aโ—‹, Inv๐‘  โŠข [๐‘ฅโ€ฒ=๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ The derivation from 4โ—‹ is completed with a dIโ‰ฝ step whose

resulting arithmetic is implied by the bottom premise of rule CLF.

โˆ—R ๐‘„๐‘ โŠข L

๐‘“๐‘(๐‘‰ ) โ‰ค 0

dIโ‰ฝ๐‘‰ <๐‘Š โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]๐‘‰ <๐‘Š

Pre-attractivity. The derivation for pre-attractivity begins by

Skolemizing ๐›ฟ, Y with โˆ€R, โ†’R, followed by a series of arithmetic

cuts which are justified stepwise. First, the Lyapunov function ๐‘‰ is

bounded above on the ball characterized by โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , which justifies

a cut of the formula โˆƒ๐‘Š >0 aโ—‹ with aโ—‹ โ‰ก โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰ <๐‘Š

).

After Skolemizing the upper bound๐‘Š , note that the set charac-

terized by formula ๐‘‰ โ‰ค ๐‘Š is compact by radial unboundedness

(middle premise of rule CLF). Therefore, the set characterized by

formula ๐‘‰ โ‰ค ๐‘Š โˆง โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y is an intersection of a compact and

closed set, which is itself compact. Thus, ๐‘‰ attains a minimum

๐‘ˆ on that set which, by the first (topmost) premise is positive.

This justifies the next arithmetic cut of the formula โˆƒ๐‘ˆ>0 bโ—‹ with

bโ—‹ โ‰ก โˆ€๐‘ฅ (๐‘‰ โ‰ค๐‘Š โˆง โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y โ†’ ๐‘‰ โ‰ฅ ๐‘ˆ ), where ๐‘ˆ is subsequently

Skolemized with โˆƒL. The steps are shown below, with the box

modality in UGpAttr(๐›ผstate) temporarily hidden with . . . as it is

not relevant for this part of the derivation.

Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0 โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)โˆ€R,โ†’R โŠข UGpAttr(๐›ผstate)

Intuitively (see Fig. 1) the next arithmetic steps syntactically

determine ๐‘‡ โ‰ฅ 0 such that the value of ๐‘‰ is guaranteed to decrease

from๐‘Š to๐‘ˆ along all switching trajectories within time๐‘‡ . Consider

the set characterized by formula ๐‘„๐‘ โˆง๐‘ˆ โ‰ค ๐‘‰ โ‰ค ๐‘Š , which is the

set of states (before reaching ๐‘‰ < ๐‘ˆ ) where switching to ODE

๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ , ๐‘ โˆˆ P is possible. From the third (bottom) premise

of rule CLF, L๐‘“๐‘(๐‘‰ ) is negative on the set characterized by the

formula ๐‘„๐‘ โˆง๐‘ˆ โ‰ค ๐‘‰ โ‰ค๐‘Š because conjunct๐‘ˆ โ‰ค ๐‘‰ bounds the set

away from the origin as๐‘ˆ > 0. Using radial unboundedness again,

๐‘‰ โ‰ค๐‘Š is compact, so the set characterized by ๐‘„๐‘ โˆง๐‘ˆ โ‰ค ๐‘‰ โ‰ค๐‘Š is

an intersection of closed sets and compact sets which is therefore

compact. Accordingly, L๐‘“๐‘(๐‘‰ ) attains a maximum value ๐‘˜๐‘ < 0

on that set, which justifies the following arithmetic cut, where the

bound ๐‘˜ < 0 is chosen uniformly across all choices of ๐‘ , e.g., as the

maximum over all ๐‘˜๐‘ for ๐‘ โˆˆ P:

โˆƒ๐‘˜<0โˆง๐‘โˆˆP

โˆ€๐‘ฅ(๐‘„๐‘ โˆง๐‘ˆ โ‰ค ๐‘‰ โ‰ค๐‘Š โ†’ L

๐‘“๐‘(๐‘‰ ) โ‰ค ๐‘˜

)๏ธธ ๏ธท๏ธท ๏ธธ

cโ—‹

After Skolemizing ๐‘˜ , it suffices to pick ๐‘‡ โ‰ฅ 0 for the succedent

such that๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ . Such a ๐‘‡ always exists since ๐‘˜ < 0.

aโ—‹, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ โŠข โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)โˆƒR Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹, ๐‘˜<0, cโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)

Page 14: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

The derivation continues by Skolemizing with โˆ€R,โ†’R and prov-

ing the LHS of the implication in aโ—‹ with โˆ€L,โ†’L. The assignment

๐‘ก := 0 is unfolded with axioms [;], [:=], then the loop rule is used

with the pre-attractivity loop invariant Inv๐‘Ž โ‰ก ๐‘‰ <๐‘Š โˆง (๐‘‰ โ‰ฅ ๐‘ˆ โ†’๐‘‰ <๐‘Š +๐‘˜๐‘ก). Similar to the stability derivation, this results in three

premises, where the crucial premise 2โ—‹ requires showing that Inv๐‘Žis preserved across the loop body, while the other premises are

labeled 1โ—‹ and 3โ—‹ (all three premises are shown further below).

1โ—‹ 2โ—‹ 3โ—‹loop ๐‘‰<๐‘Š, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , ๐‘ก=0 โŠข [๐›ผstate, ๐‘ก

โ€ฒ = 1] . . .[;], [:=] ๐‘‰<๐‘Š, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ โŠข [๐‘ก := 0;๐›ผstate, ๐‘ก

โ€ฒ = 1] . . .โˆ€L,โ†’L

aโ—‹, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , โˆฅ๐‘ฅ โˆฅ<๐›ฟ โŠข [๐‘ก := 0;๐›ผstate, ๐‘กโ€ฒ = 1] . . .

โˆ€R, โ†’Raโ—‹, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ โŠข โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ<๐›ฟ โ†’ . . .

)Premise 1โ—‹ proves by R from the antecedents.

โˆ—R๐‘‰<๐‘Š, ๐‘ก = 0 โŠข Inv๐‘Ž

Premise 3โ—‹ proves by R from the loop invariant using the fol-

lowing arithmetic argument. Suppose for contradiction that there

is a state satisfying the negation of the postcondition, i.e., assume

the negation ๐‘ก โ‰ฅ ๐‘‡ โˆง โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y. Then, using the left conjunct of Inv๐‘Žtogether with โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y to prove the LHS of the implication in bโ—‹gives assumption ๐‘‰ โ‰ฅ ๐‘ˆ . The right conjunct of Inv๐‘Ž then yields

the chain of inequalities ๐‘‰ < ๐‘Š + ๐‘˜๐‘ก โ‰ค ๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , which is a

contradiction. The steps are outlined below.

โˆ—R๐‘‰ โ‰ฅ ๐‘ˆ ,๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ ,๐‘‰ <๐‘Š + ๐‘˜๐‘ก, ๐‘ก โ‰ฅ ๐‘‡ โŠข falseR ๐‘‰ โ‰ฅ ๐‘ˆ ,๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , Inv๐‘Ž, ๐‘ก โ‰ฅ ๐‘‡ โŠข falseR

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , Inv๐‘Ž, ๐‘ก โ‰ฅ ๐‘‡, โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y โŠข falseR

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , Inv๐‘Ž โŠข ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y

The proof for premise 2โ—‹ proceeds by unfolding the loop body

with [โˆช], โˆงR, yielding one premise for each switching choice ๐‘ โˆˆ P.

A dC step proves the invariance of the left conjunct ๐‘‰ <๐‘Š of Inv๐‘Žwith dIโ‰ฝ (see the stability proof, sublevel sets of ๐‘‰ are invariant).

The right conjunct of Inv๐‘Ž is the implication abbreviated ๐ผ โ‰ก ๐‘‰ โ‰ฅ๐‘ˆ โ†’ ๐‘‰ <๐‘Š +๐‘˜๐‘ก and this is proved below using axiom DCC, which

results in premises 4โ—‹ and 5โ—‹ (shown and proved further below).

4โ—‹ 5โ—‹DCC, โˆงR

cโ—‹, ๐ผ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ โˆง๐‘‰ <๐‘Š ]๐ผdC, dIโ‰ฝ

cโ—‹, Inv๐‘Ž โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘Ž[โˆช], โˆงR

cโ—‹, Inv๐‘Ž โŠข [โ‹ƒ๐‘โˆˆP ๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘ŽFrom premise 4โ—‹, the proof is completed with a dIโ‰ฝ step using

the quantified assumption cโ—‹ and the domain constraint. Note that

the Lie derivative of the RHS๐‘Š + ๐‘˜๐‘ก is ๐‘˜ using ๐‘ก โ€ฒ = 1.

dIโ‰ฝ

Rโˆ—

cโ—‹,๐‘„๐‘ โˆง๐‘‰ <๐‘Š โˆง๐‘‰ โ‰ฅ ๐‘ˆ โŠข L๐‘“๐‘(๐‘‰ ) โ‰ค ๐‘˜

cโ—‹, ๐ผ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ โˆง๐‘‰ <๐‘Š โˆง๐‘‰ โ‰ฅ ๐‘ˆ ]๐‘‰ <๐‘Š + ๐‘˜๐‘กFrom premise 5โ—‹, the proof is completed with a generalization G

step followed by dIโ‰ฝ to prove the invariance of formula ๐‘‰ < ๐‘ˆ

(see the stability proof, sublevel sets of ๐‘‰ are invariant). The ODE

in the outer box modality is elided with . . . here.

โˆ—dIโ‰ฝ ๐‘‰<๐‘ˆ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ โˆง๐‘‰<๐‘Š ]๐‘‰<๐‘ˆ

G, โ†’R โŠข [. . .] (๐‘‰<๐‘ˆ โ†’ [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ โˆง๐‘‰<๐‘Š ]๐‘‰<๐‘ˆ ) โ–ก

Proof of Corollary 4. The derivation of rule MLF builds on

the ideas of the derivation of rule CLF so similar proof steps are

explained in less detail here. The derivation starts with an โˆงR step

for the stability and pre-attractivity conjuncts which are proved

separately below.

โŠข UStab(๐›ผstate) โŠข UGpAttr(๐›ผstate)โˆงR โŠข UGpAS(๐›ผstate)

Stability. The derivation for stability similarly begins with cut

and Skolemization steps. The difference compared to the deriva-

tion of rule CLF is the cut formulas are now conjunctions over all

possible modes ๐‘ โˆˆ P for the Lyapunov functions ๐‘‰๐‘ . The first cut

is โˆƒ๐‘Š >0 aโ—‹ with aโ—‹ โ‰ก โˆง๐‘โˆˆP โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ = Y โ†’ ๐‘‰๐‘ โ‰ฅ๐‘Š ), where the

upper bound๐‘Š >0 is chosen to be the maximum of the respective

bounds for each ๐‘‰๐‘ on the compact set characterized by โˆฅ๐‘ฅ โˆฅ = Y.

After Skolemizing ๐‘Š , the second arithmetic cut is the formula

โˆƒ๐›ฟ (0 < ๐›ฟ โ‰ค Y โˆง bโ—‹) with bโ—‹ โ‰ก โˆง๐‘โˆˆP โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰๐‘ <๐‘Š ).

Such a ๐›ฟ exists by continuity for each ๐‘‰๐‘ , ๐‘ โˆˆ P since ๐‘‰๐‘ (0) = 0

from the first (topmost) premise of rule MLF. After both cuts, the

antecedent ๐›ฟ is used to witness the succedent by โˆƒR.aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)โˆƒR

aโ—‹, 0 < ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹ โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)cut, R, โˆƒL Y>0 โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)โˆ€R, โ†’R โŠข UStab(๐›ผstate)The derivation continueswith logical simplification steps, Skolem-

izing the succedent and then proving the LHS of the implications

in antecedent bโ—‹.

โˆ€R, โ†’R

โˆ€L,โ†’L

aโ—‹, ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,โˆง

๐‘โˆˆP ๐‘‰๐‘ <๐‘Š โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ<๐›ฟ โ†’ [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

)Next, a cut, โˆจL step case splits on whether the switched system

is initially in its domain of definition characterized by formula

๐‘„ โ‰ก โˆจ๐‘โˆˆP ๐‘„๐‘ . The case where the system is not in its domain is

labeled 0โ—‹, and the proof of this case is deferred to the end. In case

the system is in its domain, the loop rule is used with stability loop

invariant Inv๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Yโˆงโˆจ๐‘โˆˆP

(๐‘„๐‘ โˆง๐‘‰๐‘ <๐‘Š

). This yields three

premises labeled 1โ—‹โ€“ 3โ—‹ shown and proved further below.

1โ—‹ 2โ—‹ 3โ—‹loop

aโ—‹, ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,โˆง

๐‘โˆˆP ๐‘‰๐‘ <๐‘Š,๐‘„ โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y 0โ—‹cut, โˆจL

aโ—‹, ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,โˆง

๐‘โˆˆP ๐‘‰๐‘ <๐‘Š โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

Premise 1โ—‹ proves by R from the antecedents using the inequal-

ities โˆฅ๐‘ฅ โˆฅ < ๐›ฟ and ๐›ฟ โ‰ค Y for the left conjunct and propositionally

from antecedents ๐‘„ and

โˆง๐‘โˆˆP ๐‘‰๐‘ <๐‘Š for the right conjunct.

โˆ—R๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,

โˆง๐‘โˆˆP ๐‘‰๐‘ <๐‘Š,๐‘„ โŠข Inv๐‘ 

Premise 3โ—‹ proves trivially since the postcondition โˆฅ๐‘ฅ โˆฅ < Y is

part of the loop invariant:

โˆ—RInv๐‘  โŠข โˆฅ๐‘ฅ โˆฅ < Y

The derivation continues from premise 2โ—‹ by unfolding the loop

body of ๐›ผstate with [โˆช], โˆงR. Premises are indexed by ๐‘ โˆˆ P in

the derivation. The M[ยท] step propositionally strengthens the post-

condition to its constituent disjunct โˆฅ๐‘ฅ โˆฅ < Y โˆง ๐‘‰๐‘ < ๐‘Š for the

chosen mode ๐‘ . Then, DX assumes domain ๐‘„๐‘ in the antecedent

and a cut step adds the assumption โˆฅ๐‘ฅ โˆฅ < Y โˆง ๐‘‰๐‘ < ๐‘Š . This cut

corresponds to the last (bottom) premise of rule MLF. It is labeled

4โ—‹ and explained below. The rest of the proof after the cut proceeds

Page 15: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

identically to the corresponding derivation for rule CLF using the

respective conjunct for ๐‘ โˆˆ P from aโ—‹. The steps are omitted here.

โˆ—aโ—‹, โˆฅ๐‘ฅ โˆฅ<Y โˆง๐‘‰๐‘<๐‘Š โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ] ( โˆฅ๐‘ฅ โˆฅ<Y โˆง๐‘‰๐‘<๐‘Š ) 4โ—‹

cutaโ—‹, Inv๐‘  ,๐‘„๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ] ( โˆฅ๐‘ฅ โˆฅ<Y โˆง๐‘‰๐‘<๐‘Š )

DXaโ—‹, Inv๐‘  โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ] ( โˆฅ๐‘ฅ โˆฅ<Y โˆง๐‘‰๐‘<๐‘Š )

M[ยท]aโ—‹, Inv๐‘  โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ 

[โˆช], โˆงRaโ—‹, Inv๐‘  โŠข [โ‹ƒ๐‘โˆˆP ๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ 

The cut premise 4โ—‹ is proved by splitting the disjunction in

Inv๐‘  (indexed by ๐‘ž โˆˆ P below). The disjunct corresponding to

mode ๐‘ proves trivially. For modes ๐‘ž โ‰  ๐‘ , the derivation yields

a compatibility condition which is proved using the last (bottom)

premise of rule MLF.

โˆ—R ๐‘„๐‘ž,๐‘„๐‘ โŠข ๐‘‰๐‘ โ‰ค ๐‘‰๐‘žR ๐‘ โ‰  ๐‘ž,๐‘„๐‘ž,๐‘‰๐‘ž <๐‘Š,๐‘„๐‘ โŠข ๐‘‰๐‘<๐‘ŠโˆจLโˆจ

๐‘žโˆˆP(๐‘„๐‘ž โˆง๐‘‰๐‘ž <๐‘Š

),๐‘„๐‘ โŠข ๐‘‰๐‘<๐‘Š

Inv๐‘  ,๐‘„๐‘ โŠข โˆฅ๐‘ฅ โˆฅ<Y โˆง๐‘‰๐‘<๐‘Š

Returning to premise 0โ—‹, for initial states not in the switched

systemโ€™s domain, i.e., satisfying ยฌ๐‘„ , no continuous motion is pos-

sible within the model. This is proved using the loop invariant

Inv0๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Y โˆง ยฌ๐‘„ . The first and third premise resulting from

the loop rule are proved trivially (not shown below). For the remain-

ing premise, ยฌ๐‘„ is preserved (trivially) across the loop body after

unfolding it with [โˆช], โˆงR and using DX to show that the system is

unable to switch to the ODE with domain ๐‘„๐‘ .

โˆ—ยฌ๐‘„,๐‘„๐‘ โŠข false

DX ยฌ๐‘„ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv0๐‘ [โˆช], โˆงR Inv0๐‘Ž โŠข [โ‹ƒ๐‘โˆˆP ๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv0๐‘ loop ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,ยฌ๐‘„ โŠข [๐›ผstate ] โˆฅ๐‘ฅ โˆฅ < Y

Pre-attractivity. The derivation for pre-attractivity begins with

logical simplification followed by a series of arithmetic cuts. First,

the multiple Lyapunov functions ๐‘‰๐‘ , ๐‘ โˆˆ P are simultaneously

bounded above on the ball characterized by โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , with the cut

โˆƒ๐‘Š >0 aโ—‹ where aโ—‹ โ‰ก โˆง๐‘โˆˆP โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰๐‘ <๐‘Š

). The upper

bound๐‘Š is Skolemized, then the next arithmetic cut uses โˆƒ๐‘ˆ>0 bโ—‹with bโ—‹ โ‰ก โˆง

๐‘โˆˆP โˆ€๐‘ฅ (๐‘‰๐‘ โ‰ค๐‘Š โˆง โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y โ†’ ๐‘‰๐‘ โ‰ฅ ๐‘ˆ ) (using radialunboundedness of all functions๐‘‰๐‘ from the second premise of MLF).

Then,๐‘ˆ is Skolemized with โˆƒL. The steps are shown below, with

the box modality in UGpAttr(๐›ผstate) temporarily hidden with . . .

as it is not relevant for this part of the derivation.

Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0 โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)โˆ€R, โ†’R โŠข UGpAttr(๐›ผstate)

Identically to rule CLF, the premises of rule MLF prove that, for

each ๐‘ โˆˆ P, the respective Lie derivatives L๐‘“๐‘(๐‘‰๐‘ ) are bounded

above by some ๐‘˜๐‘ < 0 on the compact set characterized by formula

๐‘„๐‘ โˆง ๐‘ˆ โ‰ค ๐‘‰๐‘ โ‰ค ๐‘Š . This justifies the following arithmetic cut,

where the bound ๐‘˜ < 0 is chosen to be the maximum over all ๐‘˜๐‘across all switching choices ๐‘ โˆˆ P:

โˆƒ๐‘˜<0โˆง๐‘โˆˆP

โˆ€๐‘ฅ(โ†’ L

๐‘“๐‘(๐‘‰๐‘ ) โ‰ค ๐‘˜

)๏ธธ ๏ธท๏ธท ๏ธธ

cโ—‹

The derivation proceeds similarly to rule CLF, picking๐‘‡ > 0 such

that๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , then unfolding the quantifiers in the succedent.

aโ—‹, bโ—‹, ๐‘˜<0, cโ—‹,๐‘‡>0,๐‘Š +๐‘˜๐‘‡ โ‰ค๐‘ˆ , โˆฅ๐‘ฅ โˆฅ<๐›ฟ โŠข . . .โˆ€R,โ†’R

aโ—‹, bโ—‹, ๐‘˜<0, cโ—‹,๐‘‡>0,๐‘Š +๐‘˜๐‘‡ โ‰ค๐‘ˆ โŠข โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ<๐›ฟ โ†’ . . .

)โˆƒR Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹, ๐‘˜<0, cโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0. . .

cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0. . .

The LHS in antecedent aโ—‹ is proved and the succedent is further

unfolded with [;], [:=]. The antecedents are abbreviated with ฮ“ โ‰กbโ—‹, ๐‘˜<0, cโ—‹,๐‘‡ > 0,๐‘Š +๐‘˜๐‘‡ โ‰ค ๐‘ˆ below. Similar to the stability proof,

the derivation continues with a cut, โˆจL step that case splits on

whether the switched system is initially in its domain of definition

๐‘„ โ‰ก โˆจ๐‘โˆˆP ๐‘„๐‘ . The case where the system is not in its domain is

labeled 0โ—‹, and its proof is deferred to the end. In case the system

is in domain ๐‘„ , the loop rule is used with pre-attractivity loop

invariant Inv๐‘Ž โ‰ก โˆจ๐‘โˆˆP

(๐‘„๐‘ โˆง๐‘‰๐‘ <๐‘Š โˆง (๐‘‰๐‘ โ‰ฅ ๐‘ˆ โ†’ ๐‘‰๐‘ <๐‘Š +๐‘˜๐‘ก)

).

This results in three premises 1โ—‹โ€“ 3โ—‹ which are proved below.

1โ—‹ 2โ—‹ 3โ—‹loop ฮ“,

โˆง๐‘โˆˆP ๐‘‰๐‘<๐‘Š, ๐‘ก = 0,๐‘„ โŠข [๐›ผstate, ๐‘ก

โ€ฒ = 1] . . . 0โ—‹cut, โˆจL ฮ“,

โˆง๐‘โˆˆP ๐‘‰๐‘<๐‘Š, ๐‘ก = 0 โŠข [๐›ผstate, ๐‘ก

โ€ฒ = 1] . . .[;], [:=] ฮ“,

โˆง๐‘โˆˆP ๐‘‰๐‘<๐‘Š โŠข [๐‘ก := 0;๐›ผstate, ๐‘ก

โ€ฒ = 1] . . .โˆ€L, โ†’L ฮ“, aโ—‹, โˆฅ๐‘ฅ โˆฅ<๐›ฟ โŠข [๐‘ก := 0;๐›ผstate, ๐‘ก

โ€ฒ = 1] . . .

Premise 1โ—‹ proves by R from the antecedents.

โˆ—Rโˆง

๐‘โˆˆP ๐‘‰๐‘<๐‘Š, ๐‘ก = 0,๐‘„ โŠข Inv๐‘Ž

Premise 3โ—‹ proves by R from the loop invariant after using โˆจLto split the disjuncts of the loop invariant. The disjunct for mode

๐‘ โˆˆ P is abbreviated ๐‘… โ‰ก ๐‘‰๐‘ <๐‘Š โˆง (๐‘‰๐‘ โ‰ฅ ๐‘ˆ โ†’ ๐‘‰๐‘ <๐‘Š +๐‘˜๐‘ก). Therest of the arithmetic argument is identical to the corresponding

premise for CLF using the conjunct for ๐‘ in bโ—‹ (summarized below).

โˆ—R๐‘‰๐‘ โ‰ฅ ๐‘ˆ ,๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ ,๐‘‰๐‘ <๐‘Š + ๐‘˜๐‘ก, ๐‘ก โ‰ฅ ๐‘‡ โŠข falseR ๐‘‰๐‘ โ‰ฅ ๐‘ˆ ,๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ ,๐‘…, ๐‘ก โ‰ฅ ๐‘‡ โŠข falseR

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ ,๐‘…, ๐‘ก โ‰ฅ ๐‘‡, โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y โŠข falseR

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ ,๐‘… โŠข ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < YโˆจL

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , Inv๐‘Ž โŠข ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y

The derivation from premise 2โ—‹ proceeds by unfolding the loop

body with [โˆช], โˆงR, DX, yielding one premise for each switching

choice ๐‘ โˆˆ P. The M[ยท] step selects the disjunct ๐‘… (as defined above

for premise 3โ—‹) in the postcondition corresponding to mode ๐‘ and

the cut adds this disjunct to the antecedents (the cut premise 4โ—‹is shown and proved below). The rest of the proof after the cut is

omitted here as it is identical to the corresponding derivation for

rule CLF using the respective conjunct in cโ—‹.

โˆ—4โ—‹ cโ—‹, ๐‘… โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]๐‘…

cutcโ—‹, Inv๐‘Ž,๐‘„๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]๐‘…

M[ยท]cโ—‹, Inv๐‘Ž,๐‘„๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘Ž

[โˆช], โˆงR, DXcโ—‹, Inv๐‘Ž โŠข [โ‹ƒ๐‘โˆˆP ๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘Ž

The cut premise 4โ—‹ is proved by splitting the disjunction in

Inv๐‘Ž with โˆจL (indexed by ๐‘ž โˆˆ P below). For modes ๐‘ž โ‰  ๐‘ , the

derivation leaves a compatibility condition which proves using the

last (bottom) premise of rule MLF. Note that the rule uses succedent

๐‘‰๐‘ = ๐‘‰๐‘ž since a symmetric condition (๐‘‰๐‘ž โ‰ค ๐‘‰๐‘ ) is obtained when

the roles of modes ๐‘, ๐‘ž โˆˆ P are swapped.

Page 16: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

โˆ—R ๐‘„๐‘ž,๐‘„๐‘ โŠข ๐‘‰๐‘ โ‰ค ๐‘‰๐‘žR ๐‘ โ‰  ๐‘ž,๐‘„๐‘ž โˆง๐‘‰๐‘ž <๐‘Š โˆง (๐‘‰๐‘ž โ‰ฅ ๐‘ˆ โ†’ ๐‘‰๐‘ž <๐‘Š + ๐‘˜๐‘ก ),๐‘„๐‘ โŠข ๐‘…โˆจLโˆจ

๐‘žโˆˆP(๐‘„๐‘ž โˆง๐‘‰๐‘ž <๐‘Š โˆง (๐‘‰๐‘ž โ‰ฅ ๐‘ˆ โ†’ ๐‘‰๐‘ž <๐‘Š + ๐‘˜๐‘ก )

),๐‘„๐‘ โŠข ๐‘…

Inv๐‘Ž,๐‘„๐‘ โŠข ๐‘…

Returning to premise 0โ—‹, similar to the case for stability, initial

states satisfying ยฌ๐‘„ have no continuous motion possible so they

are stuck at the initial state (with global clock ๐‘ก = 0). This is proved

using the loop invariant Inv0๐‘Ž โ‰ก ๐‘ก = 0 โˆง ยฌ๐‘„ . The first and third

premise resulting from the loop rule are proved trivially (not shown

below). For the remaining premise,ยฌ๐‘„ is preserved (trivially) across

the loop body after unfolding it with [โˆช], โˆงR and using DX to show

that the system is unable to switch to the ODE with domain ๐‘„๐‘ .

โˆ—ยฌ๐‘„,๐‘„๐‘ โŠข false

DX ยฌ๐‘„ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv0๐‘Ž[โˆช], โˆงR Inv0๐‘Ž โŠข [โ‹ƒ๐‘โˆˆP ๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv0๐‘Žloop ๐‘‡ > 0, ๐‘ก = 0,ยฌ๐‘„ โŠข [๐›ผstate, ๐‘ก

โ€ฒ = 1] (๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y) โ–ก

Proof of Corollary 5. The derivation of rule MLF๐บ is similar

to MLF, but adapted to the shape of the guarded switching model

๐›ผguard and its corresponding loop invariants. The derivation starts

with an โˆงR step for the stability and pre-attractivity conjuncts

which are proved separately below.

โŠข UStab(๐›ผguard) โŠข UGpAttr(๐›ผguard)โˆงR โŠข UGpAS(๐›ผguard)

Stability. The derivation for stability proceeds identically to the

derivation for rule MLF until the step before the stability loop

invariant is used. These steps are omitted below with . . . and

the resulting premise has antecedent formula abbreviated aโ—‹ โ‰กโˆง๐‘โˆˆP โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ = Y โ†’ ๐‘‰๐‘ โ‰ฅ๐‘Š ).

aโ—‹, ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,โˆง

๐‘โˆˆP ๐‘‰๐‘ <๐‘Š โŠข [๐›ผguard ] โˆฅ๐‘ฅ โˆฅ < Y

. . .

โŠข UStab(๐›ผguard)

The derivation continues using the loopT rule with stability loop

invariant Inv๐‘  โ‰ก โˆฅ๐‘ฅ โˆฅ < Y โˆงโˆจ๐‘โˆˆP

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ < ๐‘Š

). This yields

four premises labeled 1โ—‹โ€“ 4โ—‹, shown and proved further below.

1โ—‹ 2โ—‹ 3โ—‹ 4โ—‹loopT

aโ—‹, ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,โˆง

๐‘โˆˆP ๐‘‰๐‘ <๐‘Š โŠข [๐›ผguard ] โˆฅ๐‘ฅ โˆฅ < Y

Premise 1โ—‹ shows that the system state satisfies the invariant

Inv๐‘  after running the initialization program ๐›ผ๐‘– โ‰ก โ‹ƒ๐‘โˆˆP ๐‘ข := ๐‘ .

This is proved by R after unfolding ๐›ผ๐‘– using [โˆช], [:=].โˆ—

R ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,โˆง

๐‘โˆˆP ๐‘‰๐‘ <๐‘Š,๐‘ข = ๐‘ โŠข Inv๐‘ [โˆช], [:=] ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ,

โˆง๐‘โˆˆP ๐‘‰๐‘ <๐‘Š โŠข [๐›ผ๐‘– ]Inv๐‘ 

Premise 4โ—‹ proves trivially since the postcondition โˆฅ๐‘ฅ โˆฅ < Y is

part of the loop invariant.

โˆ—RInv๐‘  โŠข โˆฅ๐‘ฅ โˆฅ < Y

The derivation from premise 2โ—‹ yields correct-by-constructionarithmetical conditions on the Lyapunov functions from unfolding

the guarded switching controller in ๐›ผguard, recall

๐›ผ๐‘ข โ‰กโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;

โ‹ƒ๐‘žโˆˆP

(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

) )

Axiom [โˆช] unfolds the outer choice

โ‹ƒ๐‘โˆˆP

(ยท), yielding one

premise for each mode ๐‘ โˆˆ P. Then, axioms [;], [?] add the cur-

rent mode ๐‘ข = ๐‘ (before switching) to the assumptions. The cut

step propositionally unfolds antecedent loop invariant assumption

Inv๐‘  to the corresponding disjunct for ๐‘ข = ๐‘ . The inner choiceโ‹ƒ๐‘žโˆˆP

(ยท)is unfolded next with axioms [โˆช], [;], [?], yielding one

premise for each possible transition to mode ๐‘ž โˆˆ P guarded by

formula ๐บ๐‘,๐‘ž . The assignment ๐‘ข := ๐‘ž is unfolded with [:=], so the

succedent simplifies to the disjunct for ๐‘ข = ๐‘ž in Inv๐‘  . An arithmetic

simplification step yields the bottom premise of rule MLF๐บ .

โˆ—R ๐บ๐‘,๐‘ž โŠข ๐‘‰๐‘ž โ‰ค ๐‘‰๐‘R ๐‘‰๐‘ <๐‘Š,๐บ๐‘,๐‘ž โŠข ๐‘‰๐‘ž <๐‘Š[:=] โˆฅ๐‘ฅ โˆฅ < Y,๐‘‰๐‘ <๐‘Š,๐บ๐‘,๐‘ž โŠข [๐‘ข :=๐‘ž ]Inv๐‘ 

[โˆช], [;], [?] โˆฅ๐‘ฅ โˆฅ < Y,๐‘‰๐‘ <๐‘Š โŠข [โ‹ƒ๐‘žโˆˆP(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

)]Inv๐‘ 

cut Inv๐‘  ,๐‘ข = ๐‘ โŠข [โ‹ƒ๐‘žโˆˆP(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

)]Inv๐‘ 

[;], [?] Inv๐‘  โŠข [?๐‘ข = ๐‘ ;โ‹ƒ

๐‘žโˆˆP(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

)]Inv๐‘ 

[โˆช] Inv๐‘  โŠข [๐›ผ๐‘ข ]Inv๐‘ 

The derivation from premise 3โ—‹ unfolds the plant model ๐›ผ๐‘ โ‰กโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ,๐‘ฆ) &๐‘„๐‘

). The choice

โ‹ƒ๐‘โˆˆP

(ยท)is unfolded

first with axiom [โˆช], yielding one premise for each mode ๐‘ โˆˆ P.

Then, axioms [;], [?] adds the mode selected by ๐›ผ๐‘ข to the an-

tecedent, where the antecedent loop invariant assumption Inv๐‘  issimplified by cut to the disjunct for ๐‘ข = ๐‘ . Similarly M[ยท] strength-ens the postcondition to the disjunct for๐‘ข = ๐‘ . The rest of the proof

proceeds identically to the corresponding derivation for rule CLF

so it is omitted here.

โˆ—aโ—‹, โˆฅ๐‘ฅ โˆฅ<Y,๐‘‰๐‘<๐‘Š โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ] ( โˆฅ๐‘ฅ โˆฅ<Y โˆง๐‘‰๐‘<๐‘Š )

M[ยท]aโ—‹, โˆฅ๐‘ฅ โˆฅ<Y,๐‘‰๐‘<๐‘Š,๐‘ข = ๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ 

cutaโ—‹, Inv๐‘  ,๐‘ข = ๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ) &๐‘„๐‘ ]Inv๐‘ 

[;], [?]aโ—‹, Inv๐‘  โŠข [?๐‘ข = ๐‘ ;๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ, ๐‘ฆ) &๐‘„๐‘ ]Inv๐‘ 

[โˆช]aโ—‹, Inv๐‘  โŠข [๐›ผ๐‘ ]Inv๐‘ 

Pre-attractivity. The derivation for pre-attractivity is also identi-

cal to MLF until the step before the pre-attractivity loop invariant

is used. These steps are omitted below with . . . and the resulting

premise has antecedent formulas abbreviated with:

bโ—‹ โ‰กโˆง๐‘โˆˆP

โˆ€๐‘ฅ (๐‘‰๐‘ โ‰ค๐‘Š โˆง โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y โ†’ ๐‘‰๐‘ โ‰ฅ ๐‘ˆ )

cโ—‹ โ‰กโˆง๐‘โˆˆP

โˆ€๐‘ฅ(๐‘„๐‘ โˆง๐‘ˆ โ‰ค ๐‘‰๐‘ โ‰ค๐‘Š โ†’ L

๐‘“๐‘(๐‘‰๐‘ ) โ‰ค ๐‘˜

)โˆง

๐‘โˆˆP ๐‘‰๐‘<๐‘Š, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , ๐‘ก = 0 โŠข [๐›ผguard, ๐‘กโ€ฒ = 1] . . .

. . .

โŠข UGpAttr(๐›ผguard)

The derivation continues using the loopT rulewith pre-attractivity

loop invariant Inv๐‘Ž โ‰ก โˆจ๐‘โˆˆP

(๐‘ข=๐‘โˆง๐‘‰๐‘<๐‘Šโˆง(๐‘‰๐‘โ‰ฅ๐‘ˆ โ†’ ๐‘‰๐‘<๐‘Š +๐‘˜๐‘ก)

).

This yields four premises labeled 1โ—‹โ€“ 4โ—‹ which are shown and

proved further below.

1โ—‹ 2โ—‹ 3โ—‹ 4โ—‹loopT

โˆง๐‘โˆˆP ๐‘‰๐‘<๐‘Š, bโ—‹, ๐‘˜<0, cโ—‹,๐‘Š +๐‘˜๐‘‡ โ‰ค๐‘ˆ , ๐‘ก=0 โŠข [๐›ผguard, ๐‘ก

โ€ฒ = 1] . . .

Premise 1โ—‹ proves the invariant Inv๐‘Ž after unfolding the initial-

ization program ๐›ผ๐‘– using [โˆช], [:=].

Page 17: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

โˆ—R โˆง

๐‘โˆˆP ๐‘‰๐‘<๐‘Š, ๐‘ก=0,๐‘ข = ๐‘ โŠข Inv๐‘Ž[โˆช], [:=] โˆง

๐‘โˆˆP ๐‘‰๐‘<๐‘Š, ๐‘ก=0 โŠข [๐›ผ๐‘– ]Inv๐‘Ž

Premise 4โ—‹ is proved by R after unfolding the disjuncts of the

loop invariant with โˆจL (the arithmetical argument is identical to

earlier proofs). The selected disjunct (indexed by ๐‘) is abbreviated

๐‘… โ‰ก ๐‘ข=๐‘ โˆง๐‘‰๐‘<๐‘Š โˆง (๐‘‰๐‘โ‰ฅ๐‘ˆ โ†’ ๐‘‰๐‘<๐‘Š +๐‘˜๐‘ก).

โˆ—R

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ ,๐‘… โŠข ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < YโˆจL

bโ—‹, ๐‘˜<0,๐‘Š + ๐‘˜๐‘‡ โ‰ค ๐‘ˆ , Inv๐‘Ž โŠข ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y

The derivation from premise 2โ—‹ unfolds ๐›ผ๐‘ข using dLโ€™s hybridprogram axioms similar to the stability proof, and an arithmetic

simplification step yields the premises of MLF๐บ for guarded mode

switches from ๐‘ to ๐‘ž, ๐‘, ๐‘ž โˆˆ P.

โˆ—R ๐บ๐‘,๐‘ž โŠข ๐‘‰๐‘ž โ‰ค ๐‘‰๐‘R ๐‘…,๐บ๐‘,๐‘ž โŠข ๐‘‰๐‘ž<๐‘Š โˆง (๐‘‰๐‘žโ‰ฅ๐‘ˆ โ†’ ๐‘‰๐‘ž<๐‘Š +๐‘˜๐‘ก )[:=] ๐‘…,๐บ๐‘,๐‘ž โŠข [๐‘ข :=๐‘ž ]Inv๐‘Ž

[โˆช], [;], [?] ๐‘… โŠข [โ‹ƒ๐‘žโˆˆP(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

)]Inv๐‘Ž

cut Inv๐‘Ž,๐‘ข = ๐‘ โŠข [โ‹ƒ๐‘žโˆˆP(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

)]Inv๐‘Ž

[;], [?] Inv๐‘Ž โŠข [?๐‘ข = ๐‘ ;โ‹ƒ

๐‘žโˆˆP(?๐บ๐‘,๐‘ž ;๐‘ข :=๐‘ž

)]Inv๐‘Ž

[โˆช] Inv๐‘Ž โŠข [๐›ผ๐‘ข ]Inv๐‘Ž

The derivation from premise 3โ—‹ unfolds the plant model and then

proceeds identically to the corresponding derivation for rule CLF.

โˆ—cโ—‹, ๐‘… โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]๐‘…

M[ยท]cโ—‹, ๐‘… โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘Ž

cutcโ—‹, Inv๐‘Ž,๐‘ข = ๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘Ž

[;], [?]cโ—‹, Inv๐‘Ž โŠข [?๐‘ข = ๐‘ ;๐‘ฅโ€ฒ=๐‘“๐‘ (๐‘ฅ, ๐‘ฆ), ๐‘ก โ€ฒ = 1&๐‘„๐‘ ]Inv๐‘Ž

[โˆช]cโ—‹, Inv๐‘Ž โŠข [๐›ผ๐‘ , ๐‘ก โ€ฒ = 1]Inv๐‘Ž โ–ก

Proof of Corollary 6. The derivation of rule MLF๐œ departs

more significantly from the derivations of rules CLF, MLF, MLF๐บ .

For this proof, Rexp is used to indicate arithmetic steps that use

properties of the real exponential function. Tools are available for

answering such questions [14] although they are not known to

be decidable; additional explanation is given below for steps that

only require elementary properties of the exponential function. The

proof also shows how to derive arithmetic conditions (arising from

the time-dependent switching controller) in a correct by construc-

tion manner. Recall from that the modes ๐‘ โˆˆ P are partitioned

into two subsets consisting of the stable S = {๐‘ โˆˆ P, _๐‘ > 0} andunstable U = {๐‘ โˆˆ P, _๐‘ โ‰ค 0} modes. The derivation starts with

an โˆงR step for the stability and pre-attractivity conjuncts which

are proved separately below.

โŠข UStab(๐›ผtime) โŠข UGpAttr(๐›ผtime)โˆงR โŠข UGpAS(๐›ผtime)

Stability. The stability derivation begins with cut and Skolem-

ization steps. The first cut is โˆƒ๐‘Š >0 aโ—‹ with the abbreviation aโ—‹ โ‰กโˆง๐‘โˆˆP โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ = Y โ†’ ๐‘‰๐‘ โ‰ฅ๐‘Š ), where the upper bound๐‘Š >0 is

chosen to be the maximum of the respective bounds for each ๐‘‰๐‘on the compact set characterized by โˆฅ๐‘ฅ โˆฅ = Y. After Skolemizing

๐‘Š , the second arithmetic cut is the formula โˆƒ๐›ฟ (0 < ๐›ฟ โ‰ค Y โˆง bโ—‹),

where the conjuncts for ๐‘ โˆˆ U use ๐‘’_๐‘ฮ˜๐‘ > 0.

bโ—‹ โ‰กโˆง๐‘โˆˆS

โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰๐‘ <๐‘Š )

โˆงโˆง๐‘โˆˆU

โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰๐‘ <๐‘Š๐‘’_๐‘ฮ˜๐‘ )

Such a ๐›ฟ exists by continuity for each ๐‘‰๐‘ , ๐‘ โˆˆ P, ๐‘‰๐‘ (0) = 0 from

the premise of rule MLF๐œ . After both cuts, the antecedent ๐›ฟ is used

to witness the succedent by โˆƒR.aโ—‹, ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ < Y

)โˆƒR

aโ—‹, 0 < ๐›ฟ โ‰ค Y, bโ—‹ โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ < Y

)cut, Rexp , โˆƒL Y>0,๐‘Š >0, aโ—‹ โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ < Y

)cut, R, โˆƒL Y>0 โŠข โˆƒ๐›ฟ>0 โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ < Y

)โˆ€R, โ†’R โŠข UStab(๐›ผtime)

The derivation continues after both cuts similarly to MLF by

unfolding and proving the LHS of the implications in antecedent

bโ—‹. The resulting assumption on the initial state is abbreviated

๐ต โ‰ก โˆง๐‘โˆˆS ๐‘‰๐‘<๐‘Š โˆง โˆง

๐‘โˆˆU ๐‘‰๐‘<๐‘Š๐‘’_๐‘ฮ˜๐‘. Then, the loopT rule is

used with the following stability loop invariant Inv๐‘  , which yields

premises 1โ—‹โ€“ 4โ—‹ shown and proved further below:

Inv๐‘  โ‰ก ๐œ โ‰ฅ 0 โˆง โˆฅ๐‘ฅ โˆฅ < Y โˆง

ยฉยญยญยญยญยซโˆจ๐‘โˆˆS

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ

)โˆจโˆจ

๐‘โˆˆU

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) โˆง ๐œ โ‰ค ฮ˜๐‘

)ยชยฎยฎยฎยฎยฌ1โ—‹ 2โ—‹ 3โ—‹ 4โ—‹

loopTaโ—‹, ๐›ฟโ‰คY, โˆฅ๐‘ฅ โˆฅ<๐›ฟ, ๐ต โŠข [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ<Y

โˆ€L,โ†’Laโ—‹, ๐›ฟโ‰คY, bโ—‹, โˆฅ๐‘ฅ โˆฅ<๐›ฟ โŠข [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ<Y

โˆ€R, โ†’Raโ—‹, ๐›ฟโ‰คY, bโ—‹ โŠข โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ<๐›ฟ โ†’ [๐›ผtime ] โˆฅ๐‘ฅ โˆฅ<Y

)Premise 1โ—‹ shows that the system state satisfies the invariant

Inv๐‘  after initialization with program ๐›ผ๐‘– โ‰ก ๐œ := 0;

โ‹ƒ๐‘โˆˆP ๐‘ข := ๐‘ . This

is proved from ๐ต after unfolding ๐›ผ๐‘– using [โˆช], [:=] and substituting๐œ = 0 in the loop invariant (using ๐‘’0 = 1).

โˆ—Rexp ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ, ๐ต, ๐œ = 0,๐‘ข = ๐‘ โŠข Inv๐‘ 

[โˆช], [:=] ๐›ฟ โ‰ค Y, โˆฅ๐‘ฅ โˆฅ < ๐›ฟ, ๐ต โŠข [๐›ผ๐‘– ]Inv๐‘ 

Premise 4โ—‹ proves trivially since the postcondition โˆฅ๐‘ฅ โˆฅ < Y is

part of the loop invariant.

โˆ—RInv๐‘  โŠข โˆฅ๐‘ฅ โˆฅ < Y

The derivation from premise 2โ—‹ unfolds the switching controller

๐›ผ๐‘ข in ๐›ผtime with dLโ€™s hybrid program axioms, recall:

๐›ผ๐‘ข โ‰กโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;

โ‹ƒ๐‘žโˆˆP

(?\๐‘,๐‘ž โ‰ค ๐œ ;๐œ := 0;๐‘ข :=๐‘ž

) )This unfolding yields four possible shapes of premises (abbrevi-

ated as . . . and shown immediately below) for a switch from the

current mode ๐‘ to mode ๐‘ž. In each case, the antecedent assumption

corresponds to the disjunct of Inv๐‘  for mode ๐‘ , while the succedent

assumption corresponds to the disjunct for mode ๐‘ž with timer ๐œ

reset to 0 by the switching controller. The four cases correspond to

Page 18: Verifying Switched System Stability With Logic

Yong Kiam Tan, Stefan Mitsch, and Andrรฉ Platzer

whether ๐‘ โˆˆ S or ๐‘ โˆˆ U and similarly for ๐‘ž, as labeled below.

[โˆช]

[;], [?]

[โˆช], [;], [?], [:=]. . .

Inv๐‘  ,๐‘ข = ๐‘ โŠข [โ‹ƒ๐‘žโˆˆP(?\๐‘,๐‘ž โ‰ค ๐œ ;๐œ := 0;๐‘ข :=๐‘ž

)]Inv๐‘ 

Inv๐‘  โŠข [?๐‘ข = ๐‘ ;โ‹ƒ

๐‘žโˆˆP(?\๐‘,๐‘ž โ‰ค ๐œ ;๐œ := 0;๐‘ข :=๐‘ž

)]Inv๐‘ 

Inv๐‘  โŠข [๐›ผ๐‘ข ]Inv๐‘ 

\๐‘,๐‘ž โ‰ค ๐œ,๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ โŠข ๐‘‰๐‘ž <๐‘Š (๐‘โˆˆS, ๐‘žโˆˆS)

\๐‘,๐‘ž โ‰ค ๐œ,๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ โŠข ๐‘‰๐‘ž <๐‘Š๐‘’_๐‘žฮ˜๐‘ž (๐‘โˆˆS, ๐‘žโˆˆU)

\๐‘,๐‘ž โ‰ค ๐œ,๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) , ๐œ โ‰ค ฮ˜๐‘ โŠข ๐‘‰๐‘ž <๐‘Š (๐‘โˆˆU, ๐‘žโˆˆS)

\๐‘,๐‘ž โ‰ค ๐œ,๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) , ๐œ โ‰ค ฮ˜๐‘ โŠข ๐‘‰๐‘ž <๐‘Š๐‘’_๐‘žฮ˜๐‘ž (๐‘โˆˆU, ๐‘žโˆˆU)

These premises are correct-by-construction and can be handed

to an arithmetic solver directly. They can also be simplified, e.g., for

๐‘โˆˆS, ๐‘žโˆˆS, the inequalities can be rearranged to eliminate๐‘Š and ๐œ .

The first R step uses transitivity of < . โ‰ค, while the second Rexp stepuses ๐‘’_๐‘\๐‘,๐‘ž โ‰ค ๐‘’_๐‘๐œ whenever _๐‘ > 0 (since ๐‘ โˆˆ S) and \๐‘,๐‘ž โ‰ค ๐œ .

โŠข ๐‘‰๐‘ž โ‰ค ๐‘‰๐‘๐‘’_๐‘\๐‘,๐‘ž

Rexp \๐‘,๐‘ž โ‰ค ๐œ โŠข ๐‘‰๐‘ž โ‰ค ๐‘‰๐‘๐‘’_๐‘๐œ

R \๐‘,๐‘ž โ‰ค ๐œ,๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ โŠข ๐‘‰๐‘ž <๐‘Š

Intuitively, the resulting (simplified) premise says that by choos-

ing sufficiently large dwell time \๐‘,๐‘ž (for stable mode ๐‘), one can

offset an increase in value when switching from๐‘‰๐‘ to๐‘‰๐‘ž . The proof

of this premise requires Rexp.

The derivation from premise 3โ—‹ unfolds the plant model ๐›ผ๐‘ โ‰กโ‹ƒ๐‘โˆˆP

(?๐‘ข = ๐‘;๐‘ฅ โ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œ โ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘

)using dL axioms. There

are two possible shapes of the premises resulting from this unfold-

ing, depending if ๐‘ โˆˆ S or ๐‘ โˆˆ U, these are abbreviated 5โ—‹ and 6โ—‹respectively. In either case, the derivation shows that the appropri-

ate upper bound on ๐‘‰๐‘ is preserved for the invariant.

5โ—‹ 6โ—‹[;], [?]

aโ—‹, Inv๐‘  ,๐‘ข = ๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]Inv๐‘ [;], [?]

aโ—‹, Inv๐‘  โŠข [?๐‘ข = ๐‘ ;๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]Inv๐‘ [โˆช]

aโ—‹, Inv๐‘  โŠข [๐›ผ๐‘ ]Inv๐‘ For premise 5โ—‹, the proof uses dbxโ‰ฝ with cofactor โˆ’_๐‘ , where

the Lie derivative of subterm๐‘Š๐‘’โˆ’_๐‘๐œ is (โˆ’_๐‘ )๐‘Š๐‘’โˆ’_๐‘๐œ from ๐œ โ€ฒ = 1.

The resulting premise simplifies to the third premise of rule MLF๐œ .

โˆ—โŠข L

๐‘“๐‘(๐‘‰๐‘ ) โ‰คโˆ’_๐‘๐‘‰๐‘

โŠข L๐‘“๐‘(๐‘‰๐‘ )โˆ’(โˆ’_๐‘ )๐‘Š๐‘’โˆ’_๐‘๐œ โ‰คโˆ’_๐‘ (๐‘‰๐‘โˆ’๐‘Š๐‘’โˆ’_๐‘๐œ )

dbxโ‰ฝ ๐‘‰๐‘โˆ’๐‘Š๐‘’โˆ’_๐‘๐œ < 0 โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1&๐œโ‰คฮ˜๐‘ ]๐‘‰๐‘โˆ’๐‘Š๐‘’โˆ’_๐‘๐œ < 0

cut, M[ยท] ๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1&๐œโ‰คฮ˜๐‘ ]๐‘‰๐‘ <๐‘Š๐‘’โˆ’_๐‘๐œ

The proof for premise 6โ—‹ similarly uses dbxโ‰ฝ with cofactor โˆ’_๐‘ ,yielding the third premise of rule MLF๐œ .

โˆ—โŠข L

๐‘“๐‘(๐‘‰๐‘ ) โ‰ค โˆ’_๐‘๐‘‰๐‘

dbxโ‰ฝ๐‘‰๐‘<๐‘Š๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]๐‘‰๐‘<๐‘Š๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ )

Pre-attractivity. The derivation for pre-attractivity begins with

logical simplification followed by a series of arithmetic cuts. First,

the multiple Lyapunov functions ๐‘‰๐‘ , ๐‘ โˆˆ P are simultaneously

bounded above on the ball characterized by โˆฅ๐‘ฅ โˆฅ < ๐›ฟ , with the cut

โˆƒ๐‘Š >0 aโ—‹ where

aโ—‹ โ‰กโˆง๐‘โˆˆS

โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰๐‘ <๐‘Š )โˆง

โˆงโˆง๐‘โˆˆU

โˆ€๐‘ฅ (โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ ๐‘‰๐‘ <๐‘Š๐‘’_๐‘ฮ˜๐‘ )

The upper bound๐‘Š is Skolemized, then the next arithmetic cut

usesโˆƒ๐‘ˆ>0 bโ—‹with bโ—‹ โ‰ก โˆง๐‘โˆˆP โˆ€๐‘ฅ (๐‘‰๐‘ โ‰ค๐‘Š โˆง โˆฅ๐‘ฅ โˆฅ โ‰ฅ Y โ†’ ๐‘‰๐‘ โ‰ฅ ๐‘ˆ ),

where๐‘ˆ is Skolemized with โˆƒL.

Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0,๐‘Š >0, aโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)cut, R, โˆƒL Y>0 โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)โˆ€R,โ†’R โŠข UGpAttr(๐›ผtime)

The derivation continues by picking ๐‘‡ โ‰ฅ 0 such that ๐‘… โ‰ก๐‘Š โ‰ค๐‘ˆ๐‘’๐œŽ๐‘‡ โˆงโˆง

๐‘โˆˆU๐‘Š โ‰ค ๐‘ˆ๐‘’๐œŽ๐‘‡ ๐‘’โˆ’๐œŽฮ˜๐‘, such a ๐‘‡ exists since ๐œŽ > 0. The

quantifiers in the succedent are unfolded and the LHS of the im-

plications in aโ—‹ are proved. The resulting antecedent (from aโ—‹)

is abbreviated ๐ต โ‰ก โˆง๐‘โˆˆS ๐‘‰๐‘<๐‘Š โˆงโˆง

๐‘โˆˆU ๐‘‰๐‘<๐‘Š๐‘’_๐‘ฮ˜๐‘. The loopT

rule is used with the following pre-attractivity loop invariant Inv๐‘  ,which yields premises 1โ—‹โ€“ 4โ—‹ shown and proved further below:

Inv๐‘Ž โ‰ก ๐œ โ‰ฅ 0 โˆง ๐‘ก โ‰ฅ ๐œ โˆง

ยฉยญยญยญยญยซโˆจ๐‘โˆˆS

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘๐œ

)โˆจโˆจ

๐‘โˆˆU

(๐‘ข = ๐‘ โˆง๐‘‰๐‘ <๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) โˆง ๐œ โ‰ค ฮ˜๐‘

)ยชยฎยฎยฎยฎยฌ1โ—‹ 2โ—‹ 3โ—‹ 4โ—‹

loopTbโ—‹,๐‘‡ โ‰ฅ 0, ๐‘…, ๐ต, ๐‘ก = 0 โŠข [๐›ผguard, ๐‘ก

โ€ฒ = 1] . . .โˆ€L,โ†’L

aโ—‹, bโ—‹,๐‘‡ โ‰ฅ 0, ๐‘…, โˆฅ๐‘ฅ โˆฅ<๐›ฟ, ๐‘ก = 0 โŠข [๐›ผguard, ๐‘กโ€ฒ = 1] . . .

[;], [:=]aโ—‹, bโ—‹,๐‘‡ โ‰ฅ 0, ๐‘…, โˆฅ๐‘ฅ โˆฅ<๐›ฟ โŠข [๐‘ก := 0;๐›ผguard, ๐‘ก

โ€ฒ = 1] . . .โˆ€R,โ†’R

aโ—‹, bโ—‹,๐‘‡ โ‰ฅ 0, ๐‘… โŠข โˆ€๐‘ฅ(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)โˆƒR Y>0,๐‘Š >0, aโ—‹,๐‘ˆ>0, bโ—‹ โŠข โˆƒ๐‘‡ โ‰ฅ0โˆ€๐‘ฅ

(โˆฅ๐‘ฅ โˆฅ < ๐›ฟ โ†’ . . .

)Premise 1โ—‹ is proved by unfolding the initialization program ๐›ผ๐‘–

This is proved from ๐ต after unfolding ๐›ผ๐‘– using axioms [โˆช], [:=] andsubstituting ๐œ = 0 and ๐‘ก = 0 in the loop invariant (using ๐‘’0 = 1).

โˆ—Rexp ๐ต, ๐‘ก = 0, ๐œ = 0,๐‘ข = ๐‘ โŠข Inv๐‘Ž

[โˆช], [:=] ๐ต, ๐‘ก = 0 โŠข [๐›ผ๐‘– ]Inv๐‘Ž

Premise 4โ—‹ is proved by unfolding the loop invariant with โˆจL.This yields two possible premise shapes, corresponding to ๐‘ โˆˆ S or

๐‘ โˆˆ U. In both cases, assuming the negation of the succedent proves

the corresponding implication LHS in the antecedent assumption

bโ—‹, which gives๐‘‰ < ๐‘ˆ as an assumption. The remaining arithmetic

argument underlying these premises proceeds by contradicting this

assumption (below).

โˆ—โˆจL, R

bโ—‹, ๐‘…, Inv๐‘Ž โŠข ๐‘ก โ‰ฅ ๐‘‡ โ†’ โˆฅ๐‘ฅ โˆฅ < Y

Page 19: Verifying Switched System Stability With Logic

Verifying Switched System Stability With Logic

For ๐‘ โˆˆ S, the following sequence of inequalities is used (note

that ๐œŽ < _๐‘ is implied by the later premises):

๐‘‰๐‘ <๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘๐œ (from invariant)

=๐‘Š๐‘’โˆ’๐œŽ๐‘ก๐‘’โˆ’๐œ (_๐‘โˆ’๐œŽ)

โ‰ค๐‘Š๐‘’โˆ’๐œŽ๐‘‡ ๐‘’โˆ’๐œ (_๐‘โˆ’๐œŽ) (from ๐‘ก โ‰ฅ ๐‘‡, ๐œŽ > 0)

โ‰ค ๐‘ˆ๐‘’โˆ’๐œ (_๐‘โˆ’๐œŽ) (from ๐‘…)

โ‰ค ๐‘ˆ (from ๐œŽ < _๐‘ , ๐œ โ‰ฅ 0, contradiction)

For ๐‘ โˆˆ U, the following sequence of inequalities is used (note

that ๐œ โ‰ค ฮ˜๐‘ is in the invariant Inv๐‘Ž for ๐‘ โˆˆ U):

๐‘‰๐‘ <๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ )(from invariant)

โ‰ค๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ) (from ๐œ โ‰ค ฮ˜๐‘ , _๐‘ โ‰ค 0)

=๐‘Š๐‘’โˆ’๐œŽ๐‘ก๐‘’๐œŽ๐œ

โ‰ค๐‘Š๐‘’โˆ’๐œŽ๐‘ก๐‘’๐œŽฮ˜๐‘(from ๐œŽ > 0, ๐œ โ‰ค ฮ˜๐‘ )

โ‰ค๐‘Š๐‘’โˆ’๐œŽ๐‘‡ ๐‘’๐œŽฮ˜๐‘(from ๐‘ก โ‰ฅ ๐‘‡, ๐œŽ > 0)

โ‰ค ๐‘ˆ (from ๐‘…, contradiction)

The derivation from premise 2โ—‹ unfolds the switching controller

๐›ผ๐‘ข in ๐›ผtime with dLโ€™s hybrid program axioms. Similar to the deriva-

tion for the stability conjunct, this unfolding yields four possible

shapes of premises (abbreviated as . . . and shown immediately

below) for maintaining the invariant Inv๐‘Ž after a switch from the

current mode ๐‘ to the next mode ๐‘ž.

[โˆช]

[;], [?]

[โˆช], [;], [?], [:=]. . .

Inv๐‘Ž,๐‘ข = ๐‘ โŠข [โ‹ƒ๐‘žโˆˆP(?\๐‘,๐‘ž โ‰ค ๐œ ;๐œ := 0;๐‘ข :=๐‘ž

)]Inv๐‘Ž

Inv๐‘Ž โŠข [?๐‘ข = ๐‘ ;โ‹ƒ

๐‘žโˆˆP(?\๐‘,๐‘ž โ‰ค ๐œ ;๐œ := 0;๐‘ข :=๐‘ž

)]Inv๐‘Ž

Inv๐‘Ž โŠข [๐›ผ๐‘ข ]Inv๐‘Ž

๐‘ก โ‰ฅ๐œ, \๐‘,๐‘žโ‰ค๐œ,๐‘‰๐‘<๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ )๐‘’โˆ’_๐‘๐œ โŠข๐‘‰๐‘ž<๐‘Š๐‘’โˆ’๐œŽ๐‘ก

(๐‘โˆˆS, ๐‘žโˆˆS)

๐‘ก โ‰ฅ๐œ, \๐‘,๐‘žโ‰ค๐œ,๐‘‰๐‘<๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ )๐‘’โˆ’_๐‘๐œ โŠข๐‘‰๐‘ž<๐‘Š๐‘’โˆ’๐œŽ๐‘ก๐‘’_๐‘žฮ˜๐‘ž

(๐‘โˆˆS, ๐‘žโˆˆU)

๐‘ก โ‰ฅ๐œ, \๐‘,๐‘žโ‰ค๐œ,๐‘‰๐‘<๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ )๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) , ๐œโ‰คฮ˜๐‘โŠข๐‘‰๐‘ž<๐‘Š๐‘’โˆ’๐œŽ๐‘ก

(๐‘โˆˆU, ๐‘žโˆˆS)

๐‘ก โ‰ฅ๐œ, \๐‘,๐‘žโ‰ค๐œ,๐‘‰๐‘<๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ )๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ) , ๐œโ‰คฮ˜๐‘โŠข๐‘‰๐‘ž<๐‘Š๐‘’โˆ’๐œŽ๐‘ก๐‘’_๐‘žฮ˜๐‘ž

(๐‘โˆˆU, ๐‘žโˆˆU)

The derivation from premise 3โ—‹ unfolds the plant model ๐›ผ๐‘ . This

results in two possible shapes of premises, depending if ๐‘ โˆˆ S or

๐‘ โˆˆ U, which are abbreviated 5โ—‹ and 6โ—‹ respectively. In either

case, the key step shows that the appropriate upper bound on ๐‘‰๐‘ is

preserved.

5โ—‹ 6โ—‹[;], [?]Inv๐‘Ž,๐‘ข = ๐‘ โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1, ๐‘ก โ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]Inv๐‘Ž[;], [?] Inv๐‘Ž โŠข [?๐‘ข = ๐‘ ;๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1, ๐‘ก โ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]Inv๐‘Ž[โˆช] Inv๐‘Ž โŠข [๐›ผ๐‘ ]Inv๐‘ŽFor premise 5โ—‹, the proof uses dbxโ‰ฝ with cofactor โˆ’_๐‘ , with

abbreviation ๐‘ƒ๐‘  =๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘๐œ , noting that the Lie derivativeof ๐‘ƒ๐‘  is โˆ’_๐‘๐‘ƒ๐‘  . This yields the third premise of rule MLF๐œ .

โˆ—โŠข L

๐‘“๐‘(๐‘‰๐‘ ) โ‰ค โˆ’_๐‘๐‘‰๐‘

dbxโ‰ฝ๐‘‰๐‘<๐‘ƒ๐‘  โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1, ๐‘ก โ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]๐‘‰๐‘<๐‘ƒ๐‘ The proof for premise 6โ—‹ is similar using dbxโ‰ฝ with cofactor

โˆ’_๐‘ , with abbreviation ๐‘ƒ๐‘ข = ๐‘Š๐‘’โˆ’๐œŽ (๐‘กโˆ’๐œ)๐‘’โˆ’_๐‘ (๐œโˆ’ฮ˜๐‘ ), noting that

the Lie derivative of ๐‘ƒ๐‘Ž is โˆ’_๐‘๐‘ƒ๐‘Ž . This yields the third premise of

rule MLF๐œ .

โˆ—โŠข L

๐‘“๐‘(๐‘‰๐‘ ) โ‰ค โˆ’_๐‘๐‘‰๐‘

dbxโ‰ฝ๐‘‰๐‘<๐‘ƒ๐‘ข โŠข [๐‘ฅโ€ฒ = ๐‘“๐‘ (๐‘ฅ), ๐œโ€ฒ = 1, ๐‘ก โ€ฒ = 1&๐œ โ‰ค ฮ˜๐‘ ]๐‘‰๐‘<๐‘ƒ๐‘ข โ–ก

B COUNTEREXAMPLEThe cruise controller automaton from Section 5.2 is taken from

the suite of examples for the Stabhyli tool [26, 27]. Using the de-

fault instructions on a Linux machine, Stabhyli generates a success

message with the following output (newlines added for readability):

...SOSSolution( Problem is solved. (accepted); ......### Lyapunov template for mode normal_PI: \

+V_23*relV^2+V_22*intV^2+V_21*intV*relV \+V_20*relV+V_19*intV

### Lyapunov function for mode normal_PI: \+572572089848357/144115188075855872*intV*relV \+256336575597239/281474976710656*relV^2 \+6008302119812893/4611686018427387904*intV^2 \+5787253314511645/618970019642690137449562112*relV \+5661677770976729/39614081257132168796771975168*intV

...The hybrid system is stable

The generated Lyapunov function candidate ๐‘‰ does not exactly

satisfy all of the required arithmetical conditions for the normal PI

mode [26]. For example, one requirement is that it should be non-

negative in the mode invariant โˆ’15โ‰ค๐‘Ÿ๐‘’๐‘™๐‘‰โ‰ค15 โˆง โˆ’500โ‰ค๐‘–๐‘›๐‘ก๐‘‰โ‰ค500.It can be checked that ๐‘–๐‘›๐‘ก๐‘‰ = โˆ’ 1

17179869184, ๐‘Ÿ๐‘’๐‘™๐‘‰ = 0 is a counterex-

ample, with ๐‘‰ = โˆ’3.90488 ร— 10โˆ’24

.

A heuristic approach to resolve this numerical issue is to truncate

terms in the candidate๐‘‰ with extremely small coefficients and then

check the resulting truncated candidate. This heuristic is applied

for the case study in Section 5.2, where the KeYmaera X proof

succeeded using the truncated candidate together with the rest of

the Lyapunov function candidates generated by Stabhyli (for other

automaton modes).