arxiv:2005.09348v1 [cs.sc] 19 may 2020wealth of diverse techniques presents a number of challenges,...

39
Noname manuscript No. (will be inserted by the editor) Pegasus: Sound Continuous Invariant Generation Andrew Sogokon · Stefan Mitsch · Yong Kiam Tan · Katherine Cordwell · Andr´ e Platzer Received: date / Accepted: date Abstract Continuous invariants are an important component in deductive verification of hybrid and continuous systems. Just like discrete invariants are used to reason about correctness in discrete systems without unrolling their loops forever, continuous invariants are used to reason about differential equations without having to solve them. Automatic generation of continuous invariants remains one of the biggest practical challenges to the automation of formal proofs of safety for hybrid systems. There are at present many dis- parate methods available for generating continuous invariants; however, this wealth of diverse techniques presents a number of challenges, with different methods having different strengths and weaknesses. To address some of these challenges, we develop Pegasus : an automatic continuous invariant generator which allows for combinations of various methods, and integrate it with the KeYmaera X theorem prover for hybrid systems. We describe some of the ar- chitectural aspects of this integration, comment on its methods and challenges, and present an experimental evaluation on a suite of benchmarks. Keywords invariant generation, continuous invariants, ordinary differential equations, theorem proving. This material is based upon work supported by the National Science Foundation under Award CNS-1739629 and under Graduate Research Fellowship Grants Nos. DGE1252522, DGE1745016, and DGE 1530068, by AFOSR under grant number FA9550-16-1-0288, and by the Alexander von Humboldt Foundation. The third author was supported by A * STAR, Singapore. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of any sponsoring institution, the U.S. government or any other entity. A. Sogokon * , S. Mitsch, Y.K. Tan, K. Cordwell and A. Platzer Computer Science Department Carnegie Mellon University 5000 Forbes Avenue Pittsburgh, PA 15213, USA E-mail: {asogokon|smitsch|yongkiat|kcordwel|aplatzer}@cs.cmu.edu * Now at ECS, University of Southampton, UK. arXiv:2005.09348v1 [cs.SC] 19 May 2020

Upload: others

Post on 22-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Noname manuscript No.(will be inserted by the editor)

Pegasus: Sound Continuous Invariant Generation

Andrew Sogokon · Stefan Mitsch ·Yong Kiam Tan · Katherine Cordwell ·Andre Platzer

Received: date / Accepted: date

Abstract Continuous invariants are an important component in deductiveverification of hybrid and continuous systems. Just like discrete invariantsare used to reason about correctness in discrete systems without unrollingtheir loops forever, continuous invariants are used to reason about differentialequations without having to solve them. Automatic generation of continuousinvariants remains one of the biggest practical challenges to the automationof formal proofs of safety for hybrid systems. There are at present many dis-parate methods available for generating continuous invariants; however, thiswealth of diverse techniques presents a number of challenges, with differentmethods having different strengths and weaknesses. To address some of thesechallenges, we develop Pegasus: an automatic continuous invariant generatorwhich allows for combinations of various methods, and integrate it with theKeYmaera X theorem prover for hybrid systems. We describe some of the ar-chitectural aspects of this integration, comment on its methods and challenges,and present an experimental evaluation on a suite of benchmarks.

Keywords invariant generation, continuous invariants, ordinary differentialequations, theorem proving.

This material is based upon work supported by the National Science Foundation underAward CNS-1739629 and under Graduate Research Fellowship Grants Nos. DGE1252522,DGE1745016, and DGE 1530068, by AFOSR under grant number FA9550-16-1-0288, andby the Alexander von Humboldt Foundation. The third author was supported by A∗STAR,Singapore. Any opinions, findings, and conclusions or recommendations expressed in thismaterial are those of the authors and do not necessarily reflect the views of any sponsoringinstitution, the U.S. government or any other entity.

A. Sogokon∗, S. Mitsch, Y.K. Tan, K. Cordwell and A. PlatzerComputer Science DepartmentCarnegie Mellon University5000 Forbes AvenuePittsburgh, PA 15213, USAE-mail: {asogokon|smitsch|yongkiat|kcordwel|aplatzer}@cs.cmu.edu∗Now at ECS, University of Southampton, UK.

arX

iv:2

005.

0934

8v1

[cs

.SC

] 1

9 M

ay 2

020

Page 2: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

2 Andrew Sogokon et al.

1 Introduction

Safety verification problems for ordinary differential equations (ODEs) arecontinuous analogues to Hoare triples: the objective is to show that an ODEcannot evolve out of a designated set of safe states from any of its designatedinitial states. The role of continuous invariants is broadly analogous to that ofinductive invariants for discrete program verification. A continuous invariantis a set of states that can never be left when following the ODE from that set;such an invariant implies safety when it contains all of the initial states andis also a subset of the safe states. The problem of automatically generatinginvariants (also known as invariant synthesis) is one of the greatest practicalchallenges in deductive verification of both continuous and discrete systems.In theory, it is even the only challenge for hybrid systems safety [53].

The proliferation of published techniques [5,36,41,57,63,65,75,83,85] forcontinuous invariant generation—targeting various classes of systems, and hav-ing different strengths and weaknesses—presents a challenge: ideally, one doesnot want to be restricted by the limitations of one particular generation tech-nique (or a small family of techniques). Instead, it is far more desirable tohave a framework that accommodates existing generation methods, allows fortheir combination, and is extensible with new methods as they become avail-able. In this article we (partially) meet the above challenge by developing asingle framework which allows us to combine invariant generation methodsinto novel invariant generation strategies. In our work, we are guided by thefollowing considerations:

1. Specialized invariant generation methods are effective only when the prob-lem falls within their domain; their use must therefore be targeted.

2. A combination of invariant generation methods can be more practical thanany of the methods considered in isolation. A flexible and reconfigurablemechanism for combining these methods is thus highly desirable.

3. Reasoning with automatically generated invariants needs to be done ina sound fashion: any deficiencies in the generation procedure must notcompromise the final verification result.

Our interest in automatic invariant generation is motivated by the pressingneed to enhance the level of proof automation in deductive verification tools forhybrid systems. In this work we target the KeYmaera X theorem prover [24].

Contributions. This article is an extended version of the conference paper [78].The article describes the design and implementation of a continuous invariantgenerator (Pegasus)1 and its integration into KeYmaera X. It outlines some of

1 An etymological note on naming conventions. The KeY [3] prover provided thefoundation for developing KeYmaera [58], an interactive theorem prover for hybrid systems.The name KeYmaera was a pun on the Chimera, a hybrid monster from Classical Greekmythology. The tactic language of the new (aXiomatic) KeYmaera X prover [24] is calledBellerophon [23], after the hero who defeats the Chimera in the myth. In keeping with anestablished tradition, the invariant generation framework is called Pegasus because the aidof this winged horse was crucial to the hero Bellerophon in his feat.

Page 3: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 3

the principles behind this coupling, the techniques used to generate invariants,and the mechanism used for combining them into more powerful invariantgeneration strategies. An evaluation of this integration on a set of verificationbenchmarks is presented—with very promising results. The present articleextends our previous work [78] with:

1. Extensive coverage of the methods for generating continuous invariants em-ployed by Pegasus (Section 3.3), including extended descriptions of severalinvariant generation methods, as well as new material on conic abstrac-tions [6] and on the theory and practice of generating rational first integralsfor non-linear and linear systems [20,21,28,44,45,72]. The extended articlealso includes a detailed account of the pitfalls and caveats associated withthe various invariant generation and checking methods (Sections 3–6).

2. New insights on invariant generation strategies based on combining variousinvariant generation methods (Section 5), including various configurationoptions for the differential saturation [57] strategy and a new strategybased on differential divide-and-conquer [75].

3. An extended benchmark suite with 51 new problems on top of the 90existing ones (Section 6), together with extended experimental evaluationand analysis of various invariant generation strategy configurations.

Structure of this article. Mathematical preliminaries and definitions are re-viewed in 2. Section 3 recalls the problem of continuous invariant checkingand describes our architecture for sound invariant checking and generation.Sections 3.3 and 5 describe some of the methods employed by Pegasus for gen-erating continuous invariants, along with mechanisms for their combination.Section 6 presents an empirical evaluation of our integration with KeYmaera Xon a suite of verification benchmarks. Section 7 reviews related work and Sec-tion 8 discusses the outlook and possible further extensions. Section 9 endswith a summary and concluding remarks.

2 Preliminaries

Ordinary Differential Equations. An n-dimensional autonomous system of first-order ODEs has the form: x′ = f(x), where x = (x1, . . . , xn) ∈ Rn is a vectorof state variables, x′ = (x′1, . . . , x

′n) denotes their time-derivatives, i.e. dxi

dtfor each i = 1, . . . , n, and f(x) = (f1(x), . . . , fn(x)) specify the RHS of theequations that these time-derivatives must obey along solutions to the ODEs.Geometrically, such a system of ODEs defines a vector field f : Rn → Rn,associating to each point x ∈ Rn the vector f(x) = (f1(x), . . . , fn(x)) ∈ Rnspecifying in which direction the continuous system evolves at x. Wheneverthe state of the system is required to be confined within some prescribed setof states Q ⊆ Rn, called evolution constraint2, we will write x′ = f(x) & Q.

2 Evolution domain constraints are also called mode invariants in the context of hybridautomata. We avoid this name to prevent fundamental confusion with generated invariants.

Page 4: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

4 Andrew Sogokon et al.

If no evolution constraint is specified, Q is all of Rn. A solution to the initialvalue problem for the system of ODEs x′ = f(x) with initial value x0 ∈ Rnis a differentiable function x(x0, t) : (a, b) → Rn defined for all times t ∈(a, b) ⊆ R ∪ {∞,−∞} where a < 0 < b, and such that x(x0, 0) = x0 andddtx(x0, t) = f(x(x0, t)) for all t ∈ (a, b). The Lie derivative of a continuouslydifferentiable function p : Rn → R with respect to vector field f is defined asp′ ≡

∑ni=1

∂p∂xi

fi and provably [56,60] equals the time-derivative of p evaluatedalong the solutions to the system x′ = f(x).

Semi-algebraic Sets. A set S ⊆ Rn is semi-algebraic iff it is characterized bya finite Boolean combination of polynomial equations and inequalities:

l∨i=1

mi∧j=1

pij < 0 ∧Mi∧

j=mi+1

pij = 0

(1)

where pij ∈ R[x1, . . . , xn] are polynomials. By quantifier elimination, everyfirst-order formula of real arithmetic characterizes a semi-algebraic set andcan be put into form (1) (see e.g. Mishra [46, §8.6]). By an abuse of notation,this article uses formulas and the sets they characterize interchangeably.

Continuous Invariants in Verification. Safety specifications for ODEs and hy-brid systems can be rigorously verified in formal logics, such as differentialdynamic logic (dL ) [52,55,56] as implemented in the KeYmaera X proof assis-tant [24] and hybrid Hoare logic [40] as implemented in the HHL prover [86].The use of appropriate continuous invariants is key to these verification ap-proaches as they allow the complexities of the continuous dynamics to be han-dled rigorously even for ODEs without closed-form solutions. For example, thedL formula Init → [x′ = f(x) & Q] Safe states that the safety property Safeis satisfied throughout the continuous evolution of the system x′ = f(x) & Qwhenever the system begins its evolution from a state satisfying Init . The in-variant reasoning principle for verifying such a safety property is given by thefollowing sound rule of inference in dL , with three premisses above the barand the conclusion below:

(Safety)Init → I I → [x′ = f(x) & Q] I I → Safe

Init → [x′ = f(x) & Q] Safe

In this rule, the first and third premiss respectively state that the initialset Init is contained within the set I, and that I lies entirely inside the safe setof states Safe. The second premiss states that I is a continuous invariant, i.e.I is maintained throughout the continuous evolution of the system wheneverit starts inside I, that is, the following dL formula is true in all states:

I → [x′ = f(x) & Q] I (2)

Thus, the problem of verifying safety properties of ODEs reduces to findingan invariant I that can be proved to satisfy all three premisses. Semantically,a continuous invariant can also be defined as follows:

Page 5: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 5

Definition 1 (Continuous invariant) Given a system x′ = f(x) & Q, theset I ⊆ Rn is a continuous invariant iff the following statement holds:

∀x0 ∈ I ∀ t ≥ 0 :((∀ τ ∈ [0, t] : x(x0, τ) ∈ Q) =⇒ x(x0, t) ∈ I

)For any given set of initial states Init ⊆ Rn, a continuous invariant I such

that Init ⊆ I provides a sound over-approximation of the states reachable bythe system from Init by following the solutions to the ODEs within the domainconstraint Q. Indeed, the exact set of states reachable by a continuous systemfrom Init provides the smallest such invariant.3 While Def. 1 above featuresthe solution x(x0, t), which may not be available explicitly, a crucial advantageafforded by continuous invariants is the possibility of checking whether a givenset is a continuous invariant without computing the solution, i.e. by workingdirectly with the ODEs.

3 Sound Invariant Checking and Generation

The problem of checking whether a semi-algebraic set I ⊆ Rn is a continu-ous invariant of a polynomial system of ODEs x′ = f(x) &Q was shown tobe decidable by Liu, Zhan, and Zhao [41]. This decision procedure, henceforthreferred to as LZZ, provides a way of automatically checking continuous invari-ants (2) by exploiting facts about higher-order Lie derivatives of multivariatepolynomials appearing in the syntactic description of I and the Noetherianproperty of the ring R[x] [27,41]; its implementation requires an algorithm forconstructing Grobner bases [14], as well as a decision procedure for the univer-sal fragment of real arithmetic [68]. A logical alternative for invariant checkingis provided by the complete dL axiomatization for differential equation invari-ants [60]. Whereas using LZZ results in a yes/no answer to an invariance ques-tion (2), dLmakes it possible to construct a formal proof of invariance froma small set of ODE axioms [60] whenever the property holds (or a refutationwhenever it does not).

3.1 Invariant Generation with Template Enumeration

Given a means to perform invariant checking with real arithmetic, an obvioussolution to the invariant generation problem (which has been suggested bynumerous authors [41,57,80]) involves the method of template enumeration,which yields a theoretically complete semi-algorithm, in the sense that it ter-minates with a positive answer iff that is possible with the given templates. Atemplate is a parametric formula, such as e.g.

a0 + a1x+ a2y + a3x2 + a4xy + a5y

2 < 0 ∧ b0 + b1x+ b2y ≥ 0 ,

3 Unfortunately, reachable sets rarely have a simple description as semi-algebraic sets.

Page 6: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

6 Andrew Sogokon et al.

composed from polynomials in the state variables (in this example x, y) withsymbolic coefficients (here a0,a1,a2,a3,a4,a5 and b0,b1,b2), which are inter-preted over the reals. All it takes in theory is to exhaustively enumerate para-metric templates matching all real arithmetic formulas describing all semi-algebraic sets, and use a quantifier elimination algorithm (such as CAD [13])to identify whether choices for the template parameters exist that meet therequired arithmetic constraints. While templates make this British MuseumAlgorithm-like approach more successful than, e.g. exhaustively enumeratingall proofs [31], the method is nevertheless quite impractical for the resultingreal arithmetic [54]. To appreciate why, let us only remark that quantifier elim-ination algorithms for real arithmetic used in practice have doubly-exponentialtime complexity in the number of variables [64]. Template enumeration treatsevery monomial coefficient in the template as a fresh variable, leading to ex-ponentially many real arithmetic variables, which makes this approach highlyunscalable. In practice, invariant generation is achieved by using incomplete—but more efficient—generation methods. These methods are numerous andvary considerably in their strengths and limitations, creating a wide spectrumof possible trade-offs in performance, the quality, and the form of invariantsthat one can generate. Effectively navigating this spectrum is an importantpractical challenge that this article seeks to address.

3.2 Soundness: Proof Assistants and Invariant Generation

There are a number of design decisions that can be exercised in how reasoningwith continuous invariants is performed within a deductive verification frame-work. A fundamental design decision is how tightly (i) continuous invariancechecking and (ii) continuous invariant generation are to be coupled with theimplementation of the prover. This space of design choices is exemplified bythe HHL prover and the KeYmaera X prover.

The HHL prover [11,86] implements (i) the LZZ decision procedure forinvariant checking and (ii) the method of template enumeration for invariantgeneration based on real quantifier elimination and Grobner bases. From theperspective of the HHL prover, these are trusted external oracles for checkingthe validity of statements about continuous invariance; trusting the output ofthe HHL prover includes trusting the implementation of its LZZ procedureand the invariant generator (and any arithmetic tool either of them use).

In contrast, KeYmaera X [24] pursues an LCF-style approach, seeking tominimize the soundness-critical code that needs to be trusted in its output.For continuous invariants, it achieves this by (i) checking invariance withinthe axiomatic framework of dL (rather than trusting external checking proce-dures) and (ii) accepting conjectured invariants generated from a variety ofsources but separately checking the result. Invariant checking in KeYmaera Xis automatic [60], which is made possible by the use of specialized proof tac-tics [23]; these additionally allow it to use a variety of other (incomplete, butcomputationally inexpensive) methods for proving continuous invariance [27].

Page 7: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 7

LZZ procedureassistant

prover core

soundness-critical

soundness-critical

yes/noinvariant?

I → [x′ = f(x) &Q] IHHL

porver

External oracle

(a) PVS-style

dL coreassistant

dL tactics

soundness-critical

non-critical

proof from dL axioms

I → [x′ = f(x) &Q] I

KeYm

aera

X

(b) LCF-style

Fig. 1: Alternative prover architectures for checking conjectured continuousinvariants, i.e. formulas for the form I → [x′ = f(x) & Q] I

Remark 1 The difference between these two approaches (Fig. 1) is broadlyanalogous to the use of trusted decision procedures in PVS [17] and oraclesin HOL [7,88] on the one hand, and LCF-style proof reconstruction (e.g. inIsabelle [87]) on the other.

Remark 2 KeYmaera X also supports witness checking for the universal frag-ment of real arithmetic [59] resulting from ODE invariance checking [60]. Intheory, this leads to a complete LCF-style approach, but in practice, the per-formance of real arithmetic witness generation is only competitive with second-tier quantifier elimination [59].

3.3 Syntactic Representation of Invariants

A subtle issue that arises when interfacing with provers like KeYmaera X orthe HHL prover is which terms can be syntactically represented in the prover.The choice of representation limits the kinds of invariants that can be de-scribed (or generated), but it is an important consideration for computationalefficiency and soundness purposes. For example, Noetherian functions supporta sound and complete axiomatization of invariants [60] but can lead to unde-cidable arithmetic. Rational functions and roots could also be supported [8]but would increase the complexity of the required symbolic computations. Fordecidability of the invariance and arithmetic questions, this article only con-siders semi-algebraic invariants, i.e., those built from polynomials as in (1).

A similar issue arises even when restricted to polynomial terms. Naıvely, formaximum flexibility, one would like to describe invariants using polynomialsp ∈ R[x] that have arbitrary real-valued coefficients. In practice though, onlycomputable subfields K of R can be effectively represented and used on a com-puter. Thus, any computational tool must necessarily work with polynomialsp ∈ K[x] over some choice of representation for the field of coefficients K.Real algebraic numbers K = Q would work as coefficients, but they increasethe complexity of symbolic computations due to the added need to work with

Page 8: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

8 Andrew Sogokon et al.

polynomial ideal arithmetic for coefficients and can also lead to some sub-tleties with the nondifferentiability of the resulting root function itself [8]. Onthe other extreme, floating point numbers are computationally efficient butthey do not form a field, and would also cause numerical errors that make itharder to obtain sound and exact answers in the end. For these reasons, KeY-maera X works with polynomials p ∈ Q[x] that have rational coefficients.4

This results in fast evaluations and symbolic computations, and a reasonable(although nontrivial) complexity for the resulting real arithmetic validity de-cision problem. Many invariant generation techniques described in this articleimplements are fairly general and agnostic to the precise choice of field K.Thus, the rest of this article elides this subtlety and describes the invariantgeneration algorithms over p ∈ R[x], i.e., with R as the coefficient field.

KeYmaera X

Tactics(non-soundness-critical)

dL core(checks all proof steps)

guide the core

Pegasus

Classifier

Generation Strategy

Qualitative Analysis

Polynomial First Integrals

Darboux Polynomials

Rational First Integrals

Barrier Certificates

safety problem

+ proof hints

invariant

Fig. 2: Sound invariant generation: invariant generator analyses safety problemto provide invariants and proof hints to tactics; the invariants are formallyverified to be correct within the soundness-critical dL core

4 Invariant Generation Methods in Pegasus

Pegasus is a continuous invariant generator implemented in the Wolfram Lan-guage with an interface accessible through both Mathematica and KeYmaera X.5

When KeYmaera X is faced with a continuous safety verification problem thatit is unable to prove directly, it automatically invokes Pegasus to help find anappropriate invariant (if possible). KeYmaera X checks all the invariants itis supplied with—including those provided by Pegasus (see Fig. 2). This de-

4 In practice, some generation methods may need to internally use floating point arith-metic when interfacing with numerical solvers, but must then apply rounding procedures toobtain polynomials with rational coefficients.

5 Pegasus (http://pegasus.keymaeraX.org/) is linked to KeYmaera X through the Math-ematica interface of KeYmaera X, which translates between the internal data structures ofthe prover core and the Mathematica data structures.

Page 9: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 9

sign ensures that correctness of Pegasus is not integral to the soundness ofKeYmaera X. It also presents implementation opportunities for Pegasus:

1. Pegasus can freely integrate numerical procedures and heuristic meth-ods while providing best-effort guarantees of correctness. Final correctnesschecks for the generated invariants are left to the purview of KeYmaera X.6

2. Pegasus records proof hints corresponding to various methods that wereused to generate continuous invariants. These hints enable KeYmaera X tobuild more efficient shortcut proofs of continuous invariance [27].

Pegasus currently implements an array of powerful invariant generationmethods, which we describe below, beginning with a large family of relatedmethods that are based on qualitative analysis, which can be best explainedusing the machinery of discrete abstraction of continuous systems. We firstbriefly recall the main idea behind this approach.

4.1 Exact Discrete Abstraction

Discrete abstraction is the subject of numerous works [1,82,84]. Briefly, thesteps are: (i) discretize the continuous state space of a system by definingpredicates that correspond to discrete states, (ii) compute a (local) transitionrelation between the discrete states obtained from the previous step, yielding adiscrete transition system which abstracts the behaviour of the original contin-uous system, and finally (iii) compute reachable sets in the discrete abstractionto obtain an over-approximation of the reachable sets of the continuous system.

A discrete abstraction is sound iff the relation computed in step (ii) hasa transition between two discrete states whenever there is a correspondingcontinuous trajectory of the original system between the two neighboring setscorresponding to those discrete states. The abstraction is exact iff these are theonly transitions computed in step (ii). Soundness of the discrete abstractionguarantees that any invariant extracted from the discretization corresponds toan invariant for the original system.

Fig. 3 illustrates a discretization of a system of ODEs (Fig. 3a), which re-sults in 9 discrete states in a sound and exact abstraction (Fig. 3b). The statespace is discretized using predicates built from sign conditions on polynomials,p1, p2 ∈ R[x1, x2]. The discrete states of the abstraction are given by formulassuch as S1 ≡ p1 < 0 ∧ p2 = 0, S2 ≡ p1 < 0 ∧ p2 > 0, and so on.

The ability to construct sound and exact discrete abstractions [75] has animportant consequence: if an appropriate semi-algebraic continuous invariantI exists at all, it can always be extracted from a discrete abstraction built fromdiscretizing the state space using sign conditions on the polynomials describ-ing I. The problem of (semi-algebraic) invariant generation therefore reduces

6 Naturally, the output from Pegasus can also be checked using a trusted implementationof the LZZ decision procedure before anything is returned. When used with KeYmaera X,though, this additional (soundness-critical) check is unnecessary.

Page 10: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

10 Andrew Sogokon et al.

x1

x2

S5

S1S3

S2

S4

S6

S7

S8

S9

p 1=

0

p2 =

0

(a) Discretization with p1, p2 ∼ 0

S1 S2 S3

S4 S5 S6

S7 S8 S9

(b) Sound discrete abstraction

Fig. 3: Discrete abstraction of a two-dimensional system

to finding appropriate polynomials whose sign conditions can yield suitablediscrete abstractions and computing reachable states in these abstractions.

Remark 3 Reachable sets (from the initial states) in discrete abstractions arethe smallest invariants with respect to ⊆ (set inclusion) that are representablein that abstraction. The smallest invariant is the most informative because itallows one to prove the most safety properties, but it may not be the mostuseful invariant in practice. In particular, one often wants to work with invari-ants that have low descriptive complexity and are easy to prove in the formalproof calculus. This leads naturally to consider alternative ways of extractinginvariants. Pegasus is able to extract reachable sets of discrete abstractions,but favours less costly techniques, such as differential saturation [57], whichoften succeed in quickly extracting more conservative invariants.

Finding “good” polynomials that can abstract the system in useful waysand allow proving properties of interest is generally difficult. While abstractionusing predicates that are extracted from the verification problem itself can besurprisingly effective, in certain cases useful predicates may not be syntacti-cally extracted from the problem statement. In order to improve the qualityof discrete abstractions, Pegasus employs a separate classifier, which extractsfeatures from the verification problem which can then be used to suggest poly-nomials that are more tailored to the problem at hand. Certain systems havestructure that, to a human expert, might suggest an “obvious” choice of goodpredicates. Below we sketch some basic examples of what is currently possible.

4.2 Targeted Qualitative Analysis

As a motivating example, consider the class of one-dimensional ODEs x′ = f(x),where f ∈ R[x]. A standard way of studying qualitative behaviour in thesesystems is to inspect the graph of the function f(x) [79]. Fig. 4 illustrates sucha graph of f(x), along with a vector field induced by such a system on thereal line. The ODE x′ = f(x) is at an equilibrium without any motion atpoints where f(x) = 0. By computing the real roots of the polynomial in the

Page 11: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 11

x

x′ f(x)

Fig. 4: Qualitative analysis of one-dimensional ODEs x′ = f(x)

right-hand side, i.e the real roots r1, . . . , rk ∈ R of f(x), we may form a list ofpolynomials x− r1, . . . , x− rk that can be used for an algebraic decompositionof R into invariant subregions corresponding to real intervals from which anover-approximation of the reachable set can be constructed. Such an algebraicdecomposition can be further refined by augmenting the list of polynomialswith x − b1, . . . , x − bl, where b1, . . . , bl ∈ R are the boundary points of theinitial set in the safety specification. From this augmented list, one can exactlyconstruct the reachable set of the system by computing the reachable set ofthe corresponding exact abstraction.

Remark 4 If x′ = f(x) is one-dimensional one can exploit another useful fact:every one-dimensional system is a gradient system, i.e. its motion is generatedby a potential function F (x) which can be computed directly by integrating−f(x) with respect to x, i.e. F (x) = −

∫f(x) dx. For any k ∈ R, F (x) ≤ k

defines a continuous invariant of the one-dimensional system x′ = f(x).

In higher dimensions, the behaviour of linear systems x′ = Ax with aconstant coefficient matrix A can be studied qualitatively by examining theeigenvalues and eigenvectors7 of the matrix A [2]. Pegasus implements meth-ods targeted at linear systems that take advantage of facts such as these tosuggest useful abstractions from which invariants can be extracted. The cur-rent strategy is similar in spirit to the abstraction methods proposed in thework of Tiwari [81], and works by computing linear forms describing the in-variant half-spaces in the state space of linear systems. Briefly, whenever thesystem matrix A has a real eigenvalue λ ∈ R, by considering an eigenvector vof the transpose matrix AT , which is associated with the eigenvalue λ (recallthat the eigenvalues of square matrices A and AT are the same), one mayconstruct the linear form p = vTx, which has the property that [81, §2]:

p′ = vTx′ = vTAx = (Av)Tx = (λv)Tx = λp .

Such linear forms correspond to a special case of so-called Darboux polynomials,which will be described in more detail in Section 4.4.2 and have the propertythat p > 0, p = 0, and p < 0 define invariant regions in state space (the factthat λ is a real number in the equation p′ = λp also allows us to construct

7 A vector v ∈ Rn is an eigenvector for eigenvalue λ ∈ C of matrix A ∈ Rn×n iff Av = λv.In direction v, the ODE x′ = Ax, thus, converges to 0 if λ < 0 or diverges if λ > 0.

Page 12: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

12 Andrew Sogokon et al.

invariants p ≤ k, where k is an appropriately chosen offset depending on thesign of λ).

Additionally, when all the eigenvalues of the system matrix A have strictlynegative real parts, the origin 0 is asymptotically stable and one may con-struct a Lyapunov function (see [35, Ch. 3]) for the linear system by solvingthe Lyapunov equation ATP + PA = Q where Q is some given negative def-inite matrix, and the solution P is positive definite; the quadratic Lyapunovfunction V for the stable system is given by V (x) = xTPx. Every sub-level setV ≤ k defines a continuous invariant of the system; Fig. 5 (right) illustrates thekind of invariants that can be obtained by using Lyapunov functions togetherwith invariant half-planes to perform abstraction of linear systems.

Example 1 The linear systems in Fig. 5 exhibit different qualitative behaviours.The invariants (shown in blue), demonstrate unreachability of the unsafe states(shown in red) from the initial states (shown as green discs in Fig. 5).

x′1 = −4x2, x′1 = 2x1 − x2, x′1 = −2x1 + x2,

x′2 = x1, x′2 = −3x1 + x2, x′2 = x1 − 3x2.

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

Fig. 5: Automatically generated invariants for linear systems

In the leftmost system, all eigenvalues of the system matrix A are purelyimaginary. Pegasus generates annular invariants containing the green discs be-cause trajectories of such systems are always elliptical. For the middle system,the (asymptotic) behaviour of its trajectories is determined by the eigenvectorsof its system matrix (eigenvalues are real and of opposite sign [2]). Pegasususes these eigenvectors to generate two invariant half-planes, one for each greendisc. Invariant half-planes are also generated for the rightmost system whichis asymptotically stable (all real parts of eigenvalues are negative [2]). Pegasusfurther refines these half-planes with elliptical regions containing the greendiscs because elliptical regions are invariants for such systems.

B In textbook examples of linear systems, one usually finds matrices witheigenvalues and eigenvectors that can be described using rational numbers.However, the situation is not always that nice in practice: eigenvectors of ma-trices will often feature irrational components, which in the case of the exampleabove leads to invariant half-planes described by linear polynomials with irra-tional coefficients. It is therefore important to have the means of working withirrational real numbers in the invariant generator and the prover.

Page 13: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 13

In special cases when the verification problem features a purely algebraicinitial set, the strongest algebraic invariants for linear systems (i.e. the smallestcontinuous invariants that can be described by polynomial equalities p = 0)can be computed following the method of Rodrıguez-Carbonell & Tiwari [65],which we implement in Pegasus.

Remark 5 Bogomolov et al. [6] introduced a technique called conic abstrac-tions that combines discrete abstraction of affine systems with an associatedreachability analysis method. It is particularly powerful for diagonalizable sys-tems, where the authors’ experiments suggest it outperforms other tools forlinear reachability analysis, like SpaceEx[22]. The eponymous idea behind themethod is to partition state space into a number of regions (i.e., cones), sothat within each cone the change in angle of the vector field (i.e., the twist-ing) is bounded by a tunable parameter θ. Given any point in the vectorfield, then, this construction gives a known range of possible slopes for thevector at that point. This is useful information for the subsequent reacha-bility analysis—instead of simply computing the transition relation betweenneighboring cones, as in Section 4.1, their algorithm uses the twisting infor-mation to determine what portions of each cone is potentially reachable froman initial set. We experimented with the conic abstraction method in a limitedsetting: bounded linear 2-dimensional systems. The major obstacle inhibiting acomplete implementation is that Mathematica’s native support for polyhedracomputations does not quite meet the demands of the algorithm. Our limitedimplementation is not able to return an exact invariant region—instead, weproduce promising visualizations of the invariant generated for two examplesfrom Fig. 5 (see Fig. 6).8 With better support for polyhedra computations,this could be an exciting direction for future implementation by interfacingPegasus with the Parma Polyhedra Library.

4.3 Qualitative Analysis for Non-Linear Systems

General non-linear polynomial systems present a hard class of problems forinvariant generation. A number of useful heuristics can be applied to partitionthe continuous state space, in the hope that the resulting abstraction exhibitsa suitable invariant. For example, factorizing the RHS of a differential equationx′i = fi(x) yields a set of irreducible polynomial factors p1, . . . , pk such that

fi =∏kj=1 pj , which implies that the flow along the curves pj = 0 vanish in the

xi direction. This information can be used to cheaply approximate the tran-sition relation in the discrete abstraction and to efficiently extract invariantcandidates. For the non-linear ODE in Fig. 3, the discretization polynomialsp1, p2 are chosen such that x′2 = 0 and x′1 = 0 on their respective level curves.

8 The conic abstractions approach does not work directly with the leftmost examplefrom Fig. 5 because the example’s system matrix has purely imaginary eigenvalues andis consequently not diagonalizable (a key requirement for termination of the approach [6]).

Page 14: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

14 Andrew Sogokon et al.

x′1 = 2x1 − x2,x′2 = −3x1 + x2

(Fig. 5 middle example)

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

x′1 = −2x1 + x2,

x′2 = x1 − 3x2

(Fig. 5 right example)

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

Fig. 6: A visualization of our implementation of the conic abstractions method(each example is shown row-wise). The left figures show the generated conicpartition into 20 cones (alternating red and blue colours). The right figuresshow the reachable set computation (in blue) from the same green initial setsas in Fig. 5. These reachable sets, which are also invariant sets, also sufficeto show that the ODE never reaches any unsafe states (in red). The methodautomatically produces finer partitions of the state space (using more cones)when the direction of the vector field changes more drastically. For example,the top partition concentrates several cones around its unstable manifold [12,79] (the line y = 1

6 (1 +√

13)x), while the bottom partition has more evenlyspaced out cones.

This yields a useful discrete abstraction e.g. S4 is an invariant for the result-ing abstraction (Fig. 3b). Other useful sources of polynomials for qualitativeanalysis of non-linear systems are found in e.g. the summands and irreduciblefactors of the right-hand sides of the ODEs, the Lie derivatives of the factors,and physically meaningful quantities such as the divergence of the system’svector field.

Locally orthogonal linear forms A particularly simple geometric idea can some-times be profitably applied to generate linear polynomials for abstraction. Itmay be concisely described as follows: for a system of ODEs x′ = f(x), whichmay be non-linear, and given a regular point x0 ∈ Rn with f(x0) 6= 0, onemay use the linear form f(x0)·(x−x0) which has the property that its zero setis locally orthogonal to the direction of the vector f(x0). These linear formsonly yield local invariants, but sufficiently many of them put together have agood chance of describing invariant regions. In problems where the evolutiondomain constraint describes a bounded set, it is possible to obtain useful ab-stractions by choosing a finite number of sample points x0 within the set and

Page 15: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 15

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

Fig. 7: Abstraction using locally orthogonal linear forms from a set of points

partitioning the constraint with the corresponding locally orthogonal linearforms (as illustrated in Fig. 7). Of course, choosing “good” points is the mainproblem in this method; one possible heuristic is to use evenly-spaced pointsforming a grid covering the domain constraint.

4.4 General-Purpose Methods

Beyond qualitative analysis, Pegasus implements several general-purpose in-variant generation techniques which represent restricted, but tractable frag-ments of the general method of template enumeration. The search for symbolicparameters in these methods is not performed using real quantifier elimination,but instead takes place in more tractable theories.

4.4.1 Polynomial First Integrals

A polynomial p ∈ R[x] is a first integral [29, 2.4.1] of the system x′ = f(x) iffits Lie derivative p′ with respect to the vector field f is the zero polynomial.First integrals are also known as conserved quantities because they have animportant property: their value never changes along the solutions to ODEs;that is to say, for any k ∈ R, p = k is an invariant of the system. For a singlefirst integral p, if one were to use (the signs of) the polynomial p−k to build anabstraction, the abstract state space would not feature any transitions betweenits states (illustrated in Fig. 8). Thus, one has the freedom to choose values kfor which the resulting discrete abstraction suitably partitions the state space.For example, if the initial states lie entirely within p < k and the unsafe oneswithin p > k, then p < k is an invariant separating those sets.

p < k p = k p > k

Fig. 8: Discrete abstraction with first integral p− k (k ∈ R)

Pegasus can search for all polynomial first integrals up to a configurable de-gree bound by solving a system of linear equations whose solutions provide thecoefficients of the bounded degree polynomial template for the first integral.

Page 16: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

16 Andrew Sogokon et al.

This is known as the method of undetermined coefficients and we illustrate themain steps of the method in the following example.

Example 2 (Kasner’s equations) Consider the non-linear system of ODEs de-scribing a special case of Einstein’s gravitational equations [34]

x′ = yz − x2,y′ = zx− y2,z′ = xy − z2,

and a polynomial template of maximum degree 2 in the state variables x, y, z:

pa,2 = a0 + a1x+ a2y + a3z + a4x2 + a5xy + a6xz + a7y

2 + a8yz + a9z2 .

Computing the Lie derivative of this template with respect to the system, i.e.(pa,2)′ =

∂pa,2∂x x′+

∂pa,2∂y y′+

∂pa,2∂z z′ gives a parametric polynomial of degree 3:

(pa,2)′ = −a1x2 + a3xy + a2xz − a2y2 + a1yz − a3z2 − 2a4x3 + (a6 − a5)x2y

+ (a5 − a6)x2z + (a8 − a5)xy2 + (2a4 + 2a7 + 2a9)xyz + (a8 − a6)xz2

− 2a7y3 + (a5 − a8)y2z + (a6 − a8)yz2 − 2a9z

3.

In order to find a first integral, one is required to solve the equation (pa,2)′ = 0,but a polynomial is 0 precisely when all of its coefficients are 0. Thus, byequating all coefficients of the Lie derivative to 0, finding a first integral reducesto solving a linear system of equations over the symbolic coefficients a0, . . . ,a9:

−a1 = 0, a3 = 0, a2 = 0,−a2 = 0, a1 = 0,−a3 = 0,−2a4 = 0, (a6 − a5) = 0,

(a5 − a6) = 0, (a8 − a5) = 0, (2a4 + 2a7 + 2a9) = 0, (a8 − a6) = 0,

−2a7 = 0, (a5 − a8) = 0, (a6 − a8) = 0,−2a9 = 0 .

Solutions are efficiently found using linear algebra [29,71]. In this example, anon-trivial solution yields the polynomial first integral xy + xz + yz. More-over, all first integrals of degree (up to) two provide concrete instances of thecoefficients a and so must correspond to a solution of these equations.

When a polynomial first integral p is computed, one has the freedom ofchoosing its initial value, which is guaranteed to remain invariant throughoutthe evolution of the system. In the above example, one may choose any realnumber k and partition the state space into invariant regions defined by thesign conditions on the polynomial xy+xz+yz−k. Generally, to obtain a tightover-approximation of the reachable set from the initial set of states given inthe verification problem, one may choose k by attempting to maximize andminimize the value of the first integral p on the initial set of states within thedomain constraint, i.e., one may search for the real values (if they exist):

kmax = maxx∈Init∩Q

p(x) kmin = minx∈Init∩Q

p(x)

If finite values kmax and kmin can be obtained, one may generate a contin-uous invariant kmin ≤ p ∧ p ≤ kmax (or just p = kmin if kmax = kmin).

Page 17: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 17

B Maximizing/minimizing multivariate polynomials subject to semi-algebraicconstraints often leads to irrational and real algebraic numbers as exact max-ima/minima. Numerical algorithms will yield values that are near-optimal,which may require them to be increased/decreased by some amount before agenuine invariant is constructed as described above.

B The set Init ∩ Q may have multiple connected components, and tighterinvariants may be obtained from first integrals when the value k is optimizedsubject to each connected component separately. A cheap way to approximatethe connected components is to normalize Init ∩Q to disjunctive normal formand consider each disjunct as a separate component.

If more than one independent first integral for a system is found, one mayconstruct finer abstractions and generate tighter invariants over-approximatingthe reachable set. A particularly interesting case is when an n-dimensionalsystem of ODEs has n − 1 functionally independent algebraic first integrals:such a system is said to be algebraically integrable [29,48]. In such a system,given any state x0 ∈ Rn, one may evaluate the first integrals p1, p2, . . . , pn−1at that state to obtain a continuous invariant given by:

p1 = p1(x0) ∧ p2 = p2(x0) ∧ · · · ∧ pn−1 = pn−1(x0)

If the first integrals are functionally independent, i.e. when the matrix

[∇p1 ∇p2 · · · ∇pn−1]

whose columns are formed by the gradients ∇pi ≡(∂pi∂x1

, ∂pi∂x2, . . . ∂pi∂xn

)Thas

full rank at x0 (i.e. when the vectors ∇pi evaluated at x0 are linearly inde-pendent, see e.g. [48]), the resulting conjunctive formula (locally) describes a1-dimensional invariant curve in n-dimensional state space and provides thetightest possible algebraic invariant containing x0. Local invariance is a nec-essary criterion, because only local invariants can be global invariants.

4.4.2 Darboux Polynomials

Darboux polynomials were first introduced in 1878 [16] to study integrabilityof polynomial ODEs. A polynomial p ∈ R[x] is said to be a Darboux polynomialfor the system x′ = f(x) if and only if p′ = αp for some polynomial α ∈ R[x],which is known as the cofactor of p. Like first integrals, discrete abstractionsproduced with Darboux polynomials result in three states with no transitionsbetween them (as illustrated in Fig. 8, but with k = 0). Unlike first integrals,only p = 0 is guaranteed to be an invariant of the system. Darboux polynomialshave been used for predicate abstraction of continuous systems by Zaki etal. [91], who successfully applied them to verify electrical circuit designs.

The problem of generating Darboux polynomials is generally far more dif-ficult than that of generating polynomial first integrals (which represent thespecial case of Darboux polynomials where the cofactor α is 0 in the equation

Page 18: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

18 Andrew Sogokon et al.

p′ = αp). A modification of the method of undetermined coefficients describedin the previous section can likewise be applied to search for Darboux poly-nomials. However, in order to apply this method, one is required to providea polynomial template for both the Darboux polynomial and for its cofactor.Whenever one has a polynomial system of ODEs x′ = f(x) in which the max-imum polynomial degree of the components f1, f2, . . . , fn of f is some r ≥ 0,then the maximum possible degree of the Lie derivative of a polynomial p ofmaximum degree d is given by d + r − 1. Consequently, to search for a Dar-boux polynomial of maximum degree d, the maximum degree of the cofactorα in the equation p′ = αp that one needs to consider is given by r − 1. Toapply the method of undetermined coefficients, one requires a template pa,dfor the Darboux polynomial and a separate template αb,r−1 for the cofactor.The equation to be solved is the following:

(pa,d)′ − αb,r−1pa,d = 0 .

By expanding the resulting polynomial on the left-hand side and equatingeach of its monomial coefficients to 0, one obtains a system of equations inthe symbolic parameters a,b; however, while this system is linear in the pa-rameter variables a and b considered separately, it is a non-linear system ofequations in a,b simultaneously. In practice, solving such a non-linear systemis far more computationally expensive than solving a linear system in the caseof polynomial first integrals; the naıve method of undetermined coefficientsdoes not provide a practically appealing solution to the problem of Darbouxpolynomial generation.

Fortunately, automatic generation of Darboux polynomials is an activearea of research, owing largely to their importance as a crucial componentin the Prelle-Singer method [62] for computing elementary closed-form solu-tions to ODEs. In order to implement the Prelle-Singer method, more sophis-ticated algorithms for Darboux polynomial generation have been developedin the computer algebra community, e.g. two algorithms were reported byMan [44]. Indeed, in our experiments we have found the algorithms ps 1 andnew ps 1 [44] to be much more practical and implement them in Pegasus.

Remark 6 We remark also that several algorithms for generating (what areessentially) Darboux polynomials have more recently been developed withinthe verification community [36,63,71]. However, our experience with some ofthese procedures has been less positive. The method by Rebiha et al. [63] wasin practice found to be very inefficient and incomplete, i.e. unable in general tofind all the Darboux polynomials matching a given polynomial template; thetechnique by Kong et al. [36] is significantly faster but is likewise incomplete.

B Determining whether an arbitrary system of polynomial ODEs possessesa Darboux polynomial (and finding a bound on its degree if it does) remainsan open problem [92, §4.1].

Page 19: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 19

4.4.3 Rational First Integrals

Beyond polynomial functions, a much larger class of algebraic conserved quan-tities is that of rational first integrals; these are first integrals represented byrational functions, i.e. functions of the form a

b , where a, b are polynomials andb 6= 0. Searching for this kind of first integral is (unsurprisingly) more difficultthan is the case with polynomials; however, it is made possible by exploitingan idea from the seminal work of Darboux (see e.g. Schlomiuk [72]).

Theorem 1 Let p1, p2, . . . , pk be independent Darboux polynomials for thesystem x′ = f(x), with p′i = αipi, where αi is some polynomial cofactor foreach i = 1, . . . , k. If the equation

λ1α1 + λ2α2 + · · ·+ λkαk = 0 (3)

has a non-trivial integer solution, i.e. λ = (λ1, λ2, . . . , λk) ∈ Zk \ {0}, thenthe system has a rational first integral rλ ∈ R(x) given by the product

rλ = pλ11 pλ2

2 · · · pλk

k .

Proof By applying the product rule to compute the Lie derivative r′λ, we get

(pλ11 pλ2

2 · · · pλk

k )′ = λ1pλ1−11 p′1(pλ2

2 · · · pλk

k ) + · · ·+ λkpλk−1k p′k(pλ1

1 · · · pλk−1

k−1 )

= λ1pλ1−11 α1p1(pλ2

2 · · · pλk

k ) + · · ·+ λkpλk−1k αkpk(pλ1

1 · · · pλk−1

k−1 )

= (λ1α1 + λ2α2 + · · ·+ λkαk)(pλ11 pλ2

2 · · · pλk

k ).

From equation (3) it follows that r′λ = 0 and rλ is therefore a first integral. ut

Remark 7 Obviously, if the solution to (3) is such that λ ∈ Zk≥0, then thefirst integral is polynomial; at least one negative component in λ is thereforerequired in order to construct a non-polynomial rational first integral. We alsonote that one may search for rational solutions to Eq. (3), i.e. λ ∈ Qk, whichwill in general result in first integrals featuring radicals. Any such first integralcan be turned into a rational first integral by raising it to an integer powercorresponding to the least common multiple of the denominators of the rationalnumbers λ1, . . . , λk. In general, λ1, . . . , λk need not be rational or even realnumbers in order for the construction given in Theorem 1 to work; however,irrational solutions lead to first integrals that are not rational functions.

In light of the above theorem, a straightforward procedure for generatingrational first integrals (which has previously been suggested by Man [45]) in-volves (i) generating Darboux polynomials p1, p2 . . . , pk for the system x′ = f(x),e.g. using an implementation of Man’s algorithms [44], and (ii) finding integer(or rational) solutions to the linear system of equations (3) in Theorem 1.If the coefficients of the cofactors α1, α2, . . . , αk in equation (3) are all ratio-nal numbers, the problem reduces to solving a system of linear Diophantineequations, for which there exist polynomial-time algorithms. If a rational firstintegral rλ = a

b is found, then ab = l defines an invariant hypersurface for any

choice of l ∈ R, assuming b 6= 0; rewriting this, we get that a − lb = 0 isinvariant for any l ∈ R (when b 6= 0).

Page 20: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

20 Andrew Sogokon et al.

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

Fig. 9: Rational first integral rλ constructed from three Darboux polynomials.Zero sets of the three Darboux polynomials shown in solid green, blue andred. Invariant level sets of the rational first integral shown in dashed black forvalues rλ = 1

10 , 1,−2, respectively.

Example 3 Consider the following non-linear system of ODEs [21]:

x′1 = 6x41 + 27x31 − 9x21x2 + 42x21 − 24x1x2 + 21x1 + 4x22 − 7x2 + 4,

x′2 = 18x41 + 99x31 − 39x21x2 + 150x21 + 2x1x22 − 80x1x2 + 71x1 + 12x22 − 21x2 + 12 .

Using our implementation of Man’s algorithm [44], we obtain the followinglist of Darboux polynomials in under one second of computation time:

(p1, p2, p3) =

(x1 −

x23

+2

3, x21 + 2x1 −

2x23

+1

3, x21 + 3x1 − x2 + 1

).

Solving Eq. 3 in Theorem 1, we obtain the solution (λ1, λ2, λ3) = (2, 1,−1),from which we obtain the rational first integral (illustrated in Fig. 9)

rλ = p21p12p−13 =

(x1 − x2

3 + 23 )2(x21 + 2x1 − 2x2

3 + 13 )

x21 + 3x1 − x2 + 1.

Remark 8 Before attempting to search for algebraic first integrals (whetherpolynomials or rational functions) it is helpful to have static criteria thatdetermine whether such first integrals can arise in a given system of ODEs.Criteria for non-existence of various kinds of first integrals have been studiedby numerous authors (notably by Poincare [92, §7.2]) and typically make useof the linearization x′ = Ax of the system x′ = f(x) around a point of equi-librium (i.e. a point x∗ where f(x∗) = 0). In particular, a sufficient criterionfor non-existence of rational first integrals in non-linear systems of ODEs isgiven by Shi [73, Theorem 1]; it requires that the eigenvalues λ1, . . . , λn ofthe matrix A are such that k1λ1 + · · ·+ knλn = 0 does not have a non-trivialinteger solution (k1, . . . , kn) ∈ Zn \ 0. A similar criterion, which furthermoreaccounts for repeated eigenvalues, is given by Goriely [29, Ch. 5, Prop. 5.5].

Combining Darboux Polynomials and Rational First Integrals. As a first hintof its flexibility for combining invariant generation methods, Pegasus imple-ments rational first integral generation by combining several ideas describedthus far in Section 3.3 as follows. This flexibility is further exploited in thediscussion of strategies in Section 5.

Page 21: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 21

1. Compute a list of Darboux polynomials p1, . . . , pn of some maximum poly-nomial degree d using generation methods from Section 4.4.2.

2. Abstract the state space into sign invariant cells using those polynomials,e.g., S1 ≡ p1 < 0 ∧ p2 = 0, S2 ≡ p1 < 0 ∧ p2 > 0, S3 ≡ p1 < 0 ∧ p2 < 0,etc., as described in Section 4.1. Notably, the resulting abstraction has notransitions between its discrete states, as illustrated in Fig. 8.

3. Prune away those invariant cells that do not intersect the initial set ofstates, e.g., delete S1 if Init∩S1 = ∅ since S1 is then unreachable. Similarly,prune away cells that do not intersect the unsafe set, e.g., delete S2 ifUnsafe ∩ S2 = ∅ because no initial states in S2 can reach the unsafe set.

4. The remaining unpruned conflict cells, say S3, define new invariant gen-eration subproblems, where the original domain constraint Q is restrictedto Q ∧ S3. Each of the Darboux polynomials are sign-invariant in thesecells; moreover, those Darboux polynomials that are sign-definite (eitherstrictly positive or negative) in each cell, e.g. p1, p2 with domain constraintp1 < 0 ∧ p2 > 0 for S3, can be used to compute rational first integralsrλ (following Theorem 1). The denominator of rλ is guaranteed to be aproduct of (powers of) sign-definite polynomials so these rational functionsare always defined within each conflict cell.

5. Using their respective rational first integrals rλ, refine each conflict cell bymaximizing and minimizing the values of rλ to obtain invariant sub-levelsets kmin ≤ rλ ∧ rλ ≤ kmax over the initial set (restricted to that cell), asdescribed in Section 4.4.1.

6. If conflict cells remain, increase the polynomial degree d and go to step 1.

Rational First Integrals of Linear Systems. In the case of linear systems ofODEs x′ = Ax, more efficient methods exist that allow us to directly constructrational first integrals from the eigenvalues and eigenvectors of the system ma-trix A. These explicit constructions are described, e.g. in the work of Gorbuzov& Pranevich [28] and Falconi & Llibre [20]; in Pegasus, we implement and de-ploy techniques described in the former.

It is instructive to compare the results obtained by Lafferriere, Pappas andYovine [38] (which state that semi-algebraic reachable sets of linear ODEsx′ = Ax can be constructed from semi-algebraic initial sets in cases when Ais diagonalizable and all of its eigenvalues are rational) to analogous resultsindependently obtained in the study of integrability of linear systems, e.g. [28,Property 1.1], which states that a linear system x′ = Ax has a basis of rationalfirst integrals (i.e. is algebraically integrable) whenever the eigenvalues of Aare rational and of multiplicity 1. Indeed, such a basis of rational first integralsenables one to construct reachable sets described by polynomials.

4.4.4 Barrier Certificates

The method of barrier certificates is a popular Lyapunov-like technique forsafety verification of continuous and hybrid systems [61]. Barrier certificates

Page 22: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

22 Andrew Sogokon et al.

are differentiable functions p that define an invariant region p ≤ 0 which sepa-rates the initial states (wholly contained within p ≤ 0) from the unsafe states(wholly contained within p > 0). In order to ensure continuous invariance ofthe region defined by p ≤ 0, the Lie derivative p′ of the barrier certificateneeds to satisfy certain criteria; differences in these criteria give rise to a num-ber of variations of barrier certificates in the literature. The original work byPrajna and Jadbabaie [61] introduced convex barrier certificates, which em-ploy the differential inequality p′ ≤ 0 to guarantee invariance of p ≤ 0 underthe flow of the system. Later work by Kong et al. [37] introduced so-calledexponential-type barrier certificates, which provide a generalization employingthe differential inequality p′ ≤ λp, where λ ∈ R; this was generalized furtheryet in the work of Dai et al. [15], who introduced general barrier certificatesemploying the differential inequality p′ ≤ ω(p), where ω is a specifically craftedscalar function to guarantee invariance of p ≤ 0. All of the above developmentsare fundamentally based on the classical notion of comparison systems [66, ChII, §3, Ch. IX] in the theory of ODEs. A unified understanding of these gener-alizations is described in our earlier work [77], in which we introduced a furthergeneralization of the barrier certificate framework: vector barrier certificates,employing multidimensional comparison systems in a way analogous to vectorLyapunov functions introduced by Bellman [4].

Barrier certificates are practically interesting because one may apply themethod of undetermined coefficients to automatically search for them usingtractable techniques: either sum-of-squares programming (SOS) [61] or linearprogramming (LP) [89]. Pegasus is able to search for convex [61], exponential-type [37], and vector barrier certificates [77] using both SOS and LP tech-niques. However, the resulting barrier certificates often suffer from numericalinaccuracies arising from the use of semi-definite solvers and interior pointmethods [67]. Pegasus currently uses a simple rounding heuristic on the nu-merical result and explicitly checks invariance for the resulting (exact) barriercertificate candidates using real quantifier elimination. An example barriercertificate generation technique implemented in Pegasus, and an illustrationof its numerical issues is given next.

Example 4 Consider the safety verification problem illustrated in Fig. 10 (left).The task is to generate an invariant showing that ODE solutions startingwithin the initial set Init (in green) do not enter the unsafe set Unsafe (inred). A candidate continuous invariant p ≤ 0 (shown in blue in Fig. 10, left) isfound using numerical barrier certificate generation techniques.

The (exponential-type) barrier certificate p is generated from a polynomialtemplate pa,d of degree d over variables x, y, by solving (and then substituting)for appropriate concrete values of the template coefficients a. For clarity below,the notation pa,d is used in steps where the generation algorithm producesconstraints on the coefficients a, while p always refers to the final, generatedbarrier certificate. Logically, it suffices to find real values for a so that the

Page 23: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 23

-4 -2 0 2 4 x1

-4

-2

0

2

4

x2

-200 -100 0 100 200 x1

-400

-300

-200

-100

0

x2

Fig. 10: (Left) A candidate invariant generated using numerical barrier cer-tificates (in blue) for the safety verification problem of showing that solutionsfrom the green initial state never reach the red unsafe states. (Right) A zoomedout view of the safety verification problem, showing that the candidate invari-ant is, in fact, not an invariant of the ODE because some states can exit theinvariant (highlighted with a dashed red circle).

following formulas are simultaneously valid:

Init → pa,d ≤ 0 , (4)

Unsafe → pa,d > 0 , (5)

(pa,d)′ ≤ λpa,d . (6)

Constraints (4) and (5) ensure that the generated barrier separates theinitial set from the unsafe set, e.g., in Fig. 10 (left) the green initial region iswholly contained in the blue candidate invariant region p ≤ 0, while the redunsafe region lies entirely outside. Constraint (6) ensures that the sub-level setp ≤ 0 is a continuous invariant, intuitively, the vector field points “inwards”along the boundary of p ≤ 0 (blue region in Fig. 10), so it is impossible to flowfrom within p ≤ 0 to p > 0. A more general version of these constraints, anda soundness proof, is available elsewhere [37].

Sum-of-squares (SOS) programming [49] provides a tractable way of solvingfor coefficients a. Suppose that Init ,Unsafe are described with polynomialinequalities Init ≡

∧ai=1 Ii ≥ 0, Unsafe ≡

∧bi=1 Ui ≥ 0. The inequalities (4)–

(6) are respectively implied by the following SOS inequalities, where ε > 0 isa small positive constant and σIi , σUi

are template SOS polynomials [49]:

− pa,d −a∑i=1

σIiIi ≥ 0 , (7)

pa,d −b∑i=1

σUiUi − ε ≥ 0 , (8)

λpa,d − (pa,d)′ ≥ 0 . (9)

Sum-of-squares solvers, such as SOSTOOLS [49], witness the inequali-ties (7)– (9) by finding an SOS representation for their LHS. For example,

Page 24: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

24 Andrew Sogokon et al.

a set of polynomials g1, . . . , gn satisfying the polynomial identity −pa,d −∑ai=1 σIiIi =

∑ni=1 g

2i proves (7) because the RHS of this inequality is a

sum-of-squares , which is non-negative. These polynomial identities are foundefficiently by semidefinite programming [51], which is also where numericalsolvers are used. In practice, Pegasus loops through a range of values for theparameters d, λ, ε as well as the degrees of the SOS polynomials σIi , σUi andattempts to solve these constraints for each concrete choice of parameters.

The efficiency of numerical solvers is also a drawback because the generatedcoefficients a need not strictly satisfy all the required constraints. This is whyPegasus (and KeYmaera X) treats the generated barrier certificate p only as acandidate invariant and performs additional arithmetical checks to ensure thatthe constraints are truly met. As a cautionary example, Fig. 10 (left) rathermisleadingly suggests that p ≤ 0 is an invariant within its small plot domain.Indeed, Fig. 10 (right) is a zoomed out version of the same plot which showsthat the constraint (6) fails to hold for large values of x, y.

Linear Programming (LP) was employed as an alternative to sum-of-squaresprogramming by Sankaranarayanan et al. [70] to generate Lyapunov functions,and later applied by Yang et al. [89] to similarly generate barrier certificates.The main idea behind this approach is to employ a linear relaxation, wherebynon-negativity of a polynomial p is witnessed, subject to non-negativity of (ba-sis) polynomials p1, p2, . . . , pk, i.e. p1 ≥ 0 ∧ p2 ≥ 0 ∧ · · · ∧ pk ≥ 0→ p ≥ 0 is re-duced to the existence of non-negative Lagrangian multipliers λ1, λ2, . . . , λksuch that λ1p1 + λ2p2 + · · ·+ λkpk = p.

In cases when the evolution constraint Q is described using a conjunctionof polynomial inequalities Q ≡ q1 ≥ 0 ∧ · · · ∧ ql ≥ 0 (e.g. in the case ofhyperboxes or polyhedra), one may form all products pi = qα1i

1 · · · qαli

l ofmaximum degree less than or equal to that of the parametric template pa,dand use them to solve the linear relaxation for p1 ≥ 0∧· · ·∧pk ≥ 0→ pa,d ≥ 0using linear programming, obtaining a polynomial which is non-negative onQ. The conditions for barrier certificates are encoded in an obvious way.

B In using SOS or LP to search for barrier certificates, one is not concernedwith optimizing the value of any particular objective function (which can be setto be the zero function); one is rather interested in finding a feasible solutionto a set of constraints. For LP, it is possible to use an SMT solver whichsupports the theory of linear real arithmetic (LRA, e.g., as supported by Z3) tosearch for models of formulas describing the constraints to obtain instantia-tions of the parameter variables in the template; however, in our experience,implementations of linear programming solvers (especially employing interiorpoint algorithms) in Mathematica and MATLAB offer considerably better per-formance compared to Z3 (which implements the Dual Simplex algorithm [19]).

5 Strategies for Invariant Generation

The implementation of primitive invariant generation methods from Section 3.3in a single framework is a significant undertaking in itself. The overall goal be-

Page 25: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 25

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

Fig. 11: Invariant synthesis using the differential saturation loop in Pegasus

hind Pegasus, however, is to enable these heterogeneous methods to be effec-tively deployed and fruitfully combined into strategies for invariant generationthat are tailored to specific classes of verification problems. Different invariantgeneration strategies are invoked in Pegasus, depending on the classificationof the input problem it receives from the problem classifier. In this section,and for the evaluation, we focus on the most challenging and general class ofnon-linear systems in which no further structure is known or assumed beyondthe fact that the right-hand sides of the ODEs are polynomials.

5.1 Differential Saturation

The main invariant generation strategy Pegasus uses for general non-linearsystems is based on a differential saturation procedure [57]. Briefly, the pro-cedure loops through a prescribed sequence of invariant generation methodsand successively attempts to strengthen the domain constraint using invari-ants found by those methods until the desired safety condition is proved.9

Notably, this loop allows Pegasus to exploit the strengths of different invari-ant generation methods, even if it is a priori unclear whether one is betterthan the other. The precise sequencing of invariant generation methods is alsoimportant in this strategy to avoid redundancy. Pegasus orders the methodsby computational efficiency, e.g. it first searches for first integrals, followed byDarboux polynomials and barrier certificates. This sequencing allows slowermethods to exploit invariants that are quickly generated by earlier methods.

Example 5 The synergy between individual methods exploited by differentialsaturation is illustrated in Fig. 11 for an example from our benchmarks.

Initially (leftmost plot), the entire plane (in blue) is under considerationand Pegasus wants to show the safety property that trajectories from theinitial states (in green) never reach the unsafe states (in red). In the secondplot, Pegasus confines its search to the domain x1 > 0 using the generatedDarboux polynomial x1. In the third plot, using x1 > 0, qualitative analysis

9 Pegasus partitions problems into subsystems according to variable dependencies in theirdifferential equations [57]. For x′1 = x1, x′2 = x1 +x2, for example, Pegasus first searches forinvariants involving only x1, before searching for those involving both x1 and x2.

Page 26: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

26 Andrew Sogokon et al.

finds the invariant x2 > 0 (whose invariance depends on x1 > 0) which furtherconfines the evolution domain. Finally (rightmost plot), Pegasus finds a barriercertificate (of polynomial degree 2) that suffices to show the safety propertywithin the strengthened domain (which, by construction, is invariant). Thefinal invariant region contains several sharp corners and thus cannot be directlyobtained as the sub-level set of a single polynomial barrier certificate. Instead,it incorporates a conjunction of invariants discovered earlier by other means.

Remark 9 Pegasus extracts proof hints from the internal reasoning sequenceused in its differential saturation strategy, e.g., it tracks the order of construc-tion of the invariants x1 > 0, x2 > 0, . . . from Example 5 and how they wereindividually proved. These hints are useful for deductive tools like KeYmaera Xbecause they can be used to guide its proofs for the generated invariants ina corresponding, step-by-step manner, with the most appropriate verificationtechnique for the invariant used at each step.

Given an input safety verification problem, it is a priori unknown whichof the invariant generation methods used for differential saturation would suc-ceed; and even for those that do succeed, it is difficult to predict the preciseduration required. The overall strategy in Pegasus imposes carefully balancedtimeouts, where each method called by differential saturation attempts to:

– detect their applicability efficiently to conserve time budgets for othermethods if they are not applicable,

– keep track of intermediate results and report partial results (if applicable)when their individual timeouts are hit,

– efficiently check when they are done.

Pegasus uses configuration parameters to adjust timeouts and method be-haviour, e.g., maximum degree of barrier certificate templates. In addition,Pegasus supports configuration of the overall strategy behaviour in terms ofcombining method results, how it handles method timeouts, and how it detectswhen the methods succeeded. In the current implementation, and in Section 6,we explore the following strategy configuration options:

C1 Auto-Reduction: whether or not to filter redundant invariants when com-bining results

C2 Heuristic Search: whether or not to apply qualitative analysis and otherheuristic search methods

C3 Budget Redistribution: strict method timeouts or redistribution of unusedtime budget to later methods

C4 Subsystem Splitting: whether or not to analyse subsystems separately

Option C1 allows Pegasus to find invariants of lower descriptive complexity,which may be more insightful for users and easier to prove in KeYmaera X.Options C2–C4 allow expert users finer control over how Pegasus searchesfor invariants. For example, C4 is useful when the input problem is known toconsist of many subsystems of ODEs [57] that can be tackled separately. Thetradeoff between these options is qualitatively evaluated in Section 6.

Page 27: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 27

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

-2 -1 0 1 2 x1

-2

-1

0

1

2

x2

Fig. 12: Invariant synthesis using differential divide-and-conquer in Pegasus

5.2 Differential Divide-and-Conquer

The differential saturation strategy uses a melting pot of primitive invariantgeneration methods without (directly) adding more logical or mathematicalconsiderations. The differential divide-and-conquer (DDC) proof rule [75] isan example logical technique that also fits well into the Pegasus framework.

Briefly, the rule says that if p = 0 is an invariant for both the forwards ODEx′ = f(x) and the backwards ODE x′ = −f(x), then the state space partitionsinto three invariant subspaces p < 0, p = 0, p > 0, and it suffices to considerthe invariant generation subproblems (restricted to each subspace) separately.All Darboux polynomials p (Section 4.4.2) meet the forwards-and-backwardsinvariance criteria and can be used to partition the state space. Indeed, thisDDC strategy is already implicitly used in the invariant generation methodfor rational first integrals in Section 4.4.3, which partitions the state spaceusing Darboux polynomials, and then generates rational first integrals on theresulting subproblems. Pegasus generalizes this by looking for invariants oneach subproblem instead, i.e., by replacing steps 4 and 5 from the methoddescribed in Section 4.4.2 as follows:

4* For each unpruned conflict cell S, define a new invariant generation sub-problem, with the original domain constraint Q restricted to Q ∧ S.

5* Call the differential saturation strategy (Section 5.1) to find an invarianton all newly generated subproblems.

Example 6 The differential divide-and-conquer strategy is illustrated in Fig. 12for a tweaked version Example 5 with larger initial set and smaller unsafe set.

As before, initially (leftmost plot), the entire plane (in blue) is under con-sideration and Pegasus wants to show the safety property that trajectoriesfrom the initial states (in green) never reach the unsafe states (in red). Pega-sus partitions the problem into three subproblems, shown in the subsequentplots, using the Darboux polynomial x1; in those plots, only the part of theplane relevant to each subproblem is drawn. Note that in the third plot, thedomain constraint x1 = 0 is slightly (but soundly) enlarged to −0.2 ≤ x1 ≤ 0.2for visibility in the illustration as it would otherwise be an infinitesimal strip.In the second (domain constraint x1 < 0) and third (domain constraint x1 = 0,enlarged) plots, the subproblems are proved trivially because they contain no

Page 28: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

28 Andrew Sogokon et al.

2-dim.

70

3-dim.

27

higher

30 product14

(a) Problem dimension

Linear15

Affine

4

Multi-affine

24

Homo-geneous

5

Poly-nomial

93

(b) Problem class

InitialSet

UnsafeSet

EvolutionDomain

AllSetsUniformly

0

50

100

Boundedness

Bounded Unbounded

Precondition

Postcondition

EvolutionDomain

Algebraity

Algebraic Semi-algebraic

Precondition

Postcondition

EvolutionDomain

Structure

Atomic Conjunctive Disjunctive General

Precondition

Postcondition

EvolutionDomain

Topology

Closed Open Clopen Neither

(c) Set and condition properties

Fig. 13: Benchmark suite classification

unsafe states. In the rightmost (domain constraint x1 > 0) plot, Pegasus findsa barrier certificate (in blue) that solves the subproblem.

6 Evaluation

This section presents a qualitative evaluation of the invariant generation ca-pabilities of Pegasus and its interaction with the ODE proving tactics of KeY-maera X. The insights obtained from these benchmarks provide useful defaultconfiguration options for Pegasus, e.g., those described in Section 5.

6.1 Benchmark Suite

The benchmark suite consists of 141 continuous safety verification problems,with 90 earlier problems [78] and 51 new ones, all drawn from the literature [5,15,18,21,26,28,30,32,33,36,41,42,50,69,76,89,90,91]. Some of the problemsare drawn from papers that present and discuss properties of a system ofODEs without explicitly providing initial and safe conditions; in such cases,we design our own initial and safe sets based on the provided discussion.

The suite consists of linear, affine, multi-affine, and polynomial problems,see Fig. 13: 70 two-dimensional systems, 27 three-dimensional systems, 30higher-dimensional (≥4, ≤16) systems, and 14 product systems that were

Page 29: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 29

Linea

r

Affi

ne

Mul

ti-affi

ne

Hom

ogen

eous

Polyn

omial

0

20

40

60

80

Per

centa

geso

lved

(%)

(a) Success percentage per class

Linea

r

Affi

ne

Mul

ti-affi

ne

Hom

ogen

eous

Polyn

omial

0

50

100

Du

rati

on

[s]

Qualitative AnalysisBarrier CertificatesDarboux PolynomialsFirst Integrals

(b) Average and maximum duration

Bounded

Unbounded

Mixed

AlgebraicPrecondition

ClosedPostcondition

OpenPostcondition

OtherPostcondition

AtomicPostcondition

ConjunctivePostcondition

DisjunctivePostcondition

GeneralPostcondition

0

20

40

60

Percentage

solved

(%)

(c) Success percentage per condition property

Bounded

Unbounded

Mixed

AlgebraicPrecondition

ClosedPostcondition

OpenPostcondition

OtherPostcondition

AtomicPostcondition

ConjunctivePostcondition

DisjunctivePostcondition

GeneralPostcondition

0

50

100

Duration

[s]

(d) Average and maximum duration

Fig. 14: Methods tested in isolation with a timeout of 120s

formed by randomly combining pairs of two- and three-dimensional systems.The experiment was run on commodity hardware10.

We briefly analyse how the invariant generation methods individually per-form on the benchmark set when run with a timeout of 120s. Fig. 14 illustratesthat none of the methods outperforms the others on a given problem class,with the exception of Darboux polynomials which works very well on homoge-neous problems. Overall, Qualitative Analysis performs well except on linearsystems (with some variation in duration), Darboux Polynomials and Barriercertificates perform consistently well across classes, but on average requiresignificant computation time (Darboux Polynomials vary widely in durationexcept for homogeneous polynomial or affine problems), and First Integralsare inexpensive when successful.

6.2 Differential Saturation Performance

We analyse the differential saturation strategy compared to each invariantgeneration method in isolation, measuring the duration of invariant generation,duration of checking the generated invariants, and the total proof duration.

10 MacBook Pro 2013 with 2.4GHz Intel Core i7 (model 3635QM) and 16GB memory(1600MHz DDR3 SDRAM), Mathematica 11.3 and MATLAB 2018b with SOSTOOLS 3.03.

Page 30: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

30 Andrew Sogokon et al.

We analyse the effect of exposing proof hints with the generated invariants,and the effect of strategy configuration options C1–C4 from Section 5.

BC (T)BC (G)BC (C)DP (T)DP (G)DP (C)FI (T)FI (G)FI (C)

QA (T)QA (G)QA (C)

DS’19 (T)DS’19 (G)DS’19 (C)

DS (T)DS (G)DS (C)

Class

2D 3D 4D 7 8D 9 P4D P5D

MP - - - PHP - - - - - PHP - - - - - - - - - PHP - - - - - - - - - - PHP - - - - - - - - - PMPM-MHPPM-MPPMAMAAML - LMPMP - - - - - - - - - - - - P

Benchmark problems (dimension: 2D-9D, followed by 4D and 5D product systems)

0

10

100

Duration (sec)

(a) 90 benchmark problems from conference version [78]

BC (T)BC (G)BC (C)DP (T)DP (G)DP (C)FI (T)FI (G)FI (C)

QA (T)QA (G)QA (C)DS (T)DS (G)DS (C)

Class P - - - - - - - - - - - - PMPMMPP L - - - LM - - - - - ML - L P - - PAPPAPPML - L PP

0

10

100

Duration (sec)

(b) 51 additional benchmark problems

Fig. 15: Comparison of invariant generation methods. Each column representsone benchmark problem and the colour encodes duration (lighter is faster).Empty columns are unsolved. Legend: the combined Differential Saturation(DS) strategy against Qualitative Analysis (QA), First Integrals (FI), Dar-boux Polynomials (DP), and Barrier Certificates (BC), on total proof dura-tion (T), generation duration (G), and checking duration (C). Earlier reportedresults [78] are also shown for comparison (DS’19). ODE classification is an-notated at the top: homogeneous polynomial (H), polynomial (P), linear (L),affine (A), multi-affine (M), dashes indicate same class as the enclosing labels.

6.2.1 Differential Saturation versus Individual Generation Methods

The results comparing differential saturation against individual methods foreach benchmark problem are shown in Fig. 15. Several experimental insightscan be drawn from these results: (i) different invariant generation methods gen-erally solve different subsets of the problems, (ii) invariant generation almostalways dominates overall proof duration although invariant checking becomesmore expensive as problem dimension increases, (iii) when multiple methodssolve a problem, qualitative analysis and first integrals are often quickest,followed by Darboux polynomials and then barrier certificates, (iv) the differ-ential saturation strategy effectively combines invariant generation methods;

Page 31: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 31

it solves 11 additional problems (of which 6 are product systems) that no indi-vidual method solves by itself. Differential saturation is especially effective onproduct systems because each part of the product may be only solvable using aspecific method, (v) Pegasus has improved compared to its earlier version [78]and now solves 7 previously unsolved benchmarks.

To further evaluate the effectiveness of combining methods by differen-tial saturation, Fig. 16 plots the accumulated duration for solving the fastestn problems. The main insights here are: (i) differential saturation solves thelargest number of problems per accumulated time, which means that, despitesequential execution, it often succeeds in trying out the most efficient methodfirst and fails fast when earlier methods fail to apply, (ii) first integrals are inex-pensive (especially in terms of checking) when they solve problems, (iii) check-ing barrier certificates and Darboux polynomials is much faster than gener-ating them, and (iv) qualitative analysis is less expensive for generation thanother methods, but is most expensive for checking due to missing proof hints.

0 50 1000.1

1

10

100

103

Problems

Cu

mu

lati

veti

me

(sec

)

Diff. Sat. Barrier Darboux First Integrals Qualitative

(a) Total duration

0 50 100

(b) Generation

0 50 100

(c) Checking

Fig. 16: Cumulative logarithmic time (in seconds) taken to solve the fastest nproblems (more problems solved and flatter is better)

6.2.2 Differential Saturation Configuration Options

We explored the effect of configuration options on the invariant generationand subsequent checking duration by disabling features of the differential sat-uration procedure. Specifically, we executed differential saturation:

C1��AR No Auto-Reduction, which is expected to speed up generation butmay cause redundant cuts.

C2��HS No Heuristic Search, which is expected to produce more principledinvariants and more specific proof hints but solve fewer problems.

C3��BR No Budget Redistribution, which is expected to result in a more pre-dictable generation duration but solve fewer problems.

C4��SS No Subsystem Splitting, which is expected to result in faster perfor-mance on problems without clear subsystems, but solve fewer prob-lems overall (e.g., the product problems should benefit from C4).

Page 32: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

32 Andrew Sogokon et al.

DS (G)C1:�AR (G)C2:�HS (G)C3:�BR (G)C4:�SS (G)

2D 3D 4D 7 8D 9 P4D P5D

��� ��� ��� ��� ��� ��� ��� ��� ������!��� ��� ��� ������������ ��� ��� ��� ��� ��� ���

0

10

100

Duration (sec)

(a) Invariant generation

DSC1�ARC2�HS

C3�BRC4�SS

110

30

60

Increase (×)

(b) Invariant generation duration in multiples of fastest method

DS (C)�PH (C)C1:�AR (C)C2:�HS (C)C3:�BR (C)C4:�SS (C)

2D 3D 4D 7 8D 9 P4D P5D

��� ������ ��� ��� ������������ ��� ��� ������ ��� ��� ��� ��� ��� ������ ��� ��� ���

��� ������

Dimension: 2D-9D, followed by 4D and 5D product systems

0

10

100

Duration (sec)

(c) Invariant checking

Fig. 17: Influence of configuration options: no Auto-Reduction (C1��AR), noHeuristic Search (C2��HS), no Budget Redistribution (C3��BR), no SubsystemSplitting (C4��SS), and no Proof Hints (��PH). Legend: the configuration changesmay significantly reduce duration (�), significantly increase duration (�), failfinding ( ), fail checking despite finding ( ), find more (!)

��PH No Proof Hints, which is expected to slow down invariant checkingbut have no effect on invariant generation.

Figure 17 shows the benefits and drawbacks of each configuration option,separated in invariant generation and checking, while Fig. 18 summarizes thecumulative effect of configuration options.11

Except for Auto-Reduction (C1), which is a post-processing step aftergenerating invariants, disabling features mostly results in faster generationon some problems at the expense of slowing down or not solving others atall (see Fig. 17b). Overall, the configuration options have little effect on mostexamples for proof checking (see Fig. 17c), but can make a difference on someselect single examples:

– No Proof Hints (��PH): Several examples vastly increase in checking dura-tion or fail to check entirely. Conclusion: KeYmaera X’s checking proce-dures spend time to rediscover efficient proofs that were already known byconstruction during the generation. Proof hints should be kept whereverpossible, especially since they are inexpensive to produce in Pegasus.

– No Auto-Reduction (C1��AR): slight increase in proof duration on some ex-amples, but compensated well by decrease in generation duration. Conclu-

11 The configuration options are tuning parameters that offer fine-grained control overdifferential saturation: their cumulative effect is small.

Page 33: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 33

sion: Auto-Reduction is not an essential technique in invariant generationor proof checking.

– No Heuristic Search (C2��HS): slight decrease in generation and checkingduration on most examples at the expense of considerably increasing orentirely failing to generate invariants for some of the examples. Conclusion:option C2 should be configurable by users.

– No Budget Redistribution (C3��BR): slight decrease in generation durationon some examples at the expense of just not solving others, mostly withouteffect on proof duration. Conclusion: C3 is a useful technique in invariantgeneration, and should typically be enabled.

– No Subsystem Splitting (C4��SS): little effect on both generation and check-ing duration for solved problems, but solves considerably fewer problemsincluding several that are not product systems. Conclusion: C4 is a usefultechnique in invariant generation, and should typically be enabled.

0 50 1000.1

1

10

100

103

Problems

Cu

mu

lati

veti

me

(sec

)

Diff. Sat. ��AR ��HS ��BR ��SS ��PH

(a) Total duration

0 50 100

(b) Generation

0 50 100

(c) Checking

Fig. 18: Configuration options: cumulative logarithmic time (in seconds) takento solve the fastest n problems (more problems solved and flatter is better)

7 Related Work

Techniques developed for qualitative simulation have been applied to provetemporal properties of continuous systems in the work of Shults and Kuipers [74],as well as Loeser, Iwasaki and Fikes [43]. Zhao [93] developed a tool, MAPS,to automatically identify significant features of dynamical systems, such asstability regions, equilibria, and limit cycles. Since our ultimate goal is soundinvariant generation, we are less interested in a full qualitative analysis of thestate space. In the verification community, discrete abstraction of hybrid sys-tems was studied by Alur et al. [1]. The case of systems whose continuousmotion is governed by non-linear ODEs was studied in the work of Tiwariand Khanna [82,84]. Tiwari further studied reachability of linear systems [81],using information from real eigenvectors and ideas from qualitative abstrac-tion to generate invariants. Zaki et al. [91] were the first to apply Darboux

Page 34: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

34 Andrew Sogokon et al.

polynomials to verification of continuous systems using discrete abstraction.Numerous works employ barrier certificates for verification [15,37,61,77,89].Since we implement many of the above techniques as methods for invariantgeneration in our framework, our work draws heavily upon ideas developed pre-viously in the verification and hybrid systems communities. Previously [75],we introduced a construction of exact abstractions and applied rudimentarymethods from qualitative analysis to compute invariants; in certain ways, ourpresent work also builds on this experience, incorporating some of the tech-niques as special methods in a more general framework. The coupling betweenKeYmaera X and Pegasus that we pursue in our work is quite distinct fromthe use of trusted oracles in the work of Wang et al. [86] (for the HHL prover)and provides a sound framework for reasoning with continuous invariants thatis significantly less exposed to soundness issues in external tools.

A complete semi-algorithm for computing algebraic invariants (describedby zero sets of polynomial functions) for polynomial systems of ODEs was de-veloped by Ghorbal and Platzer [26]. An interesting development along verysimilar lines was also recently pursued by Boreale [10], whose method makesuse of the algebraic nature of the precondition (initial set) in the verificationproblem in order to speed up the algebraic invariant generation. Both of these(semi-)algorithms involve enumeration of polynomial templates; the biggestpractical difficulty stems from the computational cost of minimizing the rankof symbolic matrices in [26], and computing the generators of real radical idealsin [10], both of which are difficult problems with the latter having few algo-rithms with robust implementations currently in existence. In the future, wehope to extend Pegasus with an implementation of these techniques, therebyextending our current capabilities.

8 Outlook and Challenges

The improvements in continuous invariant generation have a significant impacton the overall proof automation capabilities of KeYmaera X and serve toincrease overall system usability and improve user experience. Better proofautomation will certainly also be useful in future applications of provablycorrect runtime monitoring frameworks, such as ModelPlex [47], as well asframeworks for generating verified controller executables, such as VeriPhy [9].Some interesting directions for extending our work include implementation ofreachable set computation algorithms for all classes of problems where this ispossible. For instance, semi-algebraic reachable sets for diagonalizable classesof linear systems with tame eigenvalues [25,38]. The complexity of invariantsobtained using these methods may not always make them practical, but theywould provide a valuable fallback in cases where simpler invariants cannot beobtained using our currently implemented methods.

A more pressing challenge lies in expanding the collection of safety verifi-cation problems for continuous systems. While we have done our best to findcompelling examples from the literature, a larger corpus of problems would

Page 35: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 35

allow for a more comprehensive empirical evaluation of invariant generationstrategies and could reveal interesting new insights that can suggest moreeffective strategies.

Correctness of decision procedures for real arithmetic is another importantchallenge. KeYmaera X currently uses Mathematica’s implementation of realquantifier elimination to close first-order real arithmetic goals, primarily dueto the impressive performance afforded by this implementation (compared tocurrently existing alternatives). Removing this reliance by efficiently buildingfully formal proofs of real arithmetic formulas within dL (e.g. through exhibit-ing appropriate witnesses [39,59]) is an important task for the future.

9 Conclusion

Among verification practitioners, the amount of manual effort required for for-mal verification of hybrid systems is one of the chief criticisms leveled againstthe use of deductive verification tools. Manually crafting continuous invariantsoften requires expertise and ingenuity, just like manually selecting supportfunction templates for reachability tools [22], and presents the major practicalhurdle in the way of wider industrial adoption of this technology. In this arti-cle, we describe our development of a system designed to help overcome thishurdle by automating the discovery of continuous invariants. To our knowl-edge, this work represents the first large-scale effort at combining continuousinvariant generation methods into a single invariant generation framework andmaking it possible to create more powerful invariant generation strategies. Theapproach we pursue is unique in its integration with a theorem prover, whichprovides formal guarantees that the generated invariants are indeed correct (inthe form of dL proofs, automatically). The results we observe in our evaluationare highly encouraging and suggest that invariant discovery can be improvedconsiderably, opening many exciting avenues for applications and extensions.

Acknowledgements. The authors would like to thank the anonymous FM’19reviewers for their feedback on an earlier conference version of this work.

References

1. Alur, R., Henzinger, T.A., Lafferriere, G., Pappas, G.J.: Discrete abstractions of hybridsystems. Proceedings of the IEEE 88(7), 971–984 (2000). DOI 10.1109/5.871304

2. Arrowsmith, D., Place, C.M.: Dynamical Systems: Differential Equations, Maps, andChaotic Behaviour, vol. 5. CRC Press (1992)

3. Beckert, B., Giese, M., Hahnle, R., Klebanov, V., Rummer, P., Schlager, S., Schmitt,P.H.: The KeY system 1.0 (deduction component). In: F. Pfenning (ed.) CADE, LNCS,vol. 4603, pp. 379–384. Springer (2007). DOI 10.1007/978-3-540-73595-3 26

4. Bellman, R.: Vector Lyapunov functions. SIAM J. Control Optim. 1(1), 32–34 (1962)5. Ben Sassi, M.A., Girard, A., Sankaranarayanan, S.: Iterative computation of polyhedral

invariants sets for polynomial dynamical systems. In: CDC, pp. 6348–6353. IEEE (2014).DOI 10.1109/CDC.2014.7040384

Page 36: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

36 Andrew Sogokon et al.

6. Bogomolov, S., Giacobbe, M., Henzinger, T.A., Kong, H.: Conic abstractions for hybridsystems. In: A. Abate, G. Geeraerts (eds.) FORMATS, LNCS, vol. 10419, pp. 116–132.Springer (2017). DOI 10.1007/978-3-319-65765-3 7

7. Bohme, S., Weber, T.: Fast LCF-style proof reconstruction for Z3. In: M. Kaufmann,L.C. Paulson (eds.) ITP, LNCS, vol. 6172, pp. 179–194. Springer (2010). DOI 10.1007/978-3-642-14052-5 14

8. Bohrer, B., Fernandez, M., Platzer, A.: dLι: Definite descriptions in differential dynamiclogic. In: P. Fontaine (ed.) CADE, LNCS, vol. 11716, pp. 94–110. Springer (2019). DOI10.1007/978-3-030-29436-6 6

9. Bohrer, B., Tan, Y.K., Mitsch, S., Myreen, M.O., Platzer, A.: VeriPhy: verified controllerexecutables from verified cyber-physical system models. In: J.S. Foster, D. Grossman(eds.) PLDI, pp. 617–630. ACM (2018). DOI 10.1145/3192366.3192406

10. Boreale, M.: Complete algorithms for algebraic strongest postconditions and weakestpreconditions in polynomial ODEs. Science of Computer Programming 193 (2020)

11. Chen, M., Han, X., Tang, T., Wang, S., Yang, M., Zhan, N., Zhao, H., Zou, L.: MARS:A toolchain for modelling, analysis and verification of hybrid systems. In: M.G. Hinchey,J.P. Bowen, E. Olderog (eds.) Provably Correct Systems, NASA Monographs in Systemsand Software Engineering, pp. 39–58. Springer (2017). DOI 10.1007/978-3-319-48628-43

12. Chicone, C.: Ordinary Differential Equations with Applications, second edn. Springer,New York (2006). DOI 10.1007/0-387-35794-7

13. Collins, G.E.: Quantifier elimination for real closed fields by cylindrical algebraic decom-postion, LNCS, vol. 33, pp. 134–183. Springer (1975). DOI 10.1007/3-540-07407-4 17

14. Cox, D.A., Little, J., O’Shea, D.: Ideals, Varieties, and Algorithms, fourth edn. Springer(2015). DOI 10.1007/978-3-319-16721-3

15. Dai, L., Gan, T., Xia, B., Zhan, N.: Barrier certificates revisited. J. Symb. Comput. 80,62–86 (2017). DOI 10.1016/j.jsc.2016.07.010

16. Darboux, J.G.: Memoire sur les equations differentielles algebriques du premier ordreet du premier degre. Bull. Sci. Math. 2(1), 151–200 (1878)

17. Denman, W., Munoz, C.A.: Automated real proving in PVS via MetiTarski. In: C.B.Jones, P. Pihlajasaari, J. Sun (eds.) FM, LNCS, vol. 8442, pp. 194–199. Springer (2014).DOI 10.1007/978-3-319-06410-9 14

18. Djaballah, A., Chapoutot, A., Kieffer, M., Bouissou, O.: Construction of parametricbarrier functions for dynamical systems using interval analysis. Autom. 78, 287–296(2017). DOI 10.1016/j.automatica.2016.12.013

19. Dutertre, B., de Moura, L.M.: A fast linear-arithmetic solver for DPLL(T). In: T. Ball,R.B. Jones (eds.) CAV, LNCS, vol. 4144, pp. 81–94. Springer (2006). DOI 10.1007/11817963 11

20. Falconi, M., Llibre, J.: n− 1 independent first integrals for linear differential systems inRn and Cn. Qualitative theory of dynamical systems 4(2), 233–254 (2004)

21. Ferragut, A., Giacomini, H.: A new algorithm for finding rational first integrals of poly-nomial vector fields. Qualitative Theory of Dynamical Systems 9(1-2), 89–99 (2010)

22. Frehse, G., Le Guernic, C., Donze, A., Cotton, S., Ray, R., Lebeltel, O., Ripado, R.,Girard, A., Dang, T., Maler, O.: SpaceEx: Scalable verification of hybrid systems. In:G. Gopalakrishnan, S. Qadeer (eds.) CAV, LNCS, vol. 6806, pp. 379–395. Springer(2011). DOI 10.1007/978-3-642-22110-1 30

23. Fulton, N., Mitsch, S., Bohrer, B., Platzer, A.: Bellerophon: Tactical theorem provingfor hybrid systems. In: M. Ayala-Rincon, C.A. Munoz (eds.) ITP, LNCS, vol. 10499,pp. 207–224. Springer (2017). DOI 10.1007/978-3-319-66107-0 14

24. Fulton, N., Mitsch, S., Quesel, J., Volp, M., Platzer, A.: KeYmaera X: An axiomatictactical theorem prover for hybrid systems. In: A.P. Felty, A. Middeldorp (eds.) CADE,LNCS, vol. 9195, pp. 527–538. Springer (2015). DOI 10.1007/978-3-319-21401-6 36

25. Gan, T., Chen, M., Li, Y., Xia, B., Zhan, N.: Reachability analysis for solvable dynamicalsystems. IEEE Trans. Automat. Contr. 63(7), 2003–2018 (2018). DOI 10.1109/TAC.2017.2763785

26. Ghorbal, K., Platzer, A.: Characterizing algebraic invariants by differential radical in-variants. In: E. Abraham, K. Havelund (eds.) TACAS, LNCS, vol. 8413, pp. 279–294.Springer (2014). DOI 10.1007/978-3-642-54862-8 19

Page 37: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 37

27. Ghorbal, K., Sogokon, A., Platzer, A.: A hierarchy of proof rules for checking posi-tive invariance of algebraic and semi-algebraic sets. Computer Languages, Systems &Structures 47(1), 19–43 (2017). DOI 10.1016/j.cl.2015.11.003

28. Gorbuzov, V.N., Pranevich, A.F.: First integrals of ordinary linear differential systems(2012)

29. Goriely, A.: Integrability and Nonintegrability of Dynamical Systems. World Scientific(2001). DOI 10.1142/3846

30. Gulwani, S., Tiwari, A.: Constraint-based approach for analysis of hybrid systems. In:A. Gupta, S. Malik (eds.) CAV, LNCS, vol. 5123, pp. 190–203. Springer (2008). DOI10.1007/978-3-540-70545-1 18

31. Herbrand, J.: Recherches sur la theorie de la demonstration. Ph.D. thesis, Universitede Paris, Faculte des Sciences (1930)

32. Immler, F., Althoff, M., Chen, X., Fan, C., Frehse, G., Kochdumper, N., Li, Y., Mitra,S., Tomar, M.S., Zamani, M.: ARCH-COMP18 category report: Continuous and hybridsystems with nonlinear dynamics. In: G. Frehse, M. Althoff, S. Bogomolov, T.T. Johnson(eds.) ARCH, EPiC Series in Computing, vol. 54, pp. 53–70. EasyChair (2018)

33. Kapinski, J., Deshmukh, J.V., Sankaranarayanan, S., Arechiga, N.: Simulation-guidedLyapunov analysis for hybrid dynamical systems. In: M. Franzle, J. Lygeros (eds.)HSCC, pp. 133–142. ACM (2014). DOI 10.1145/2562059.2562139

34. Kasner, E.: Solutions of the Einstein equations involving functions of only one variable.Transactions of the American Mathematical Society 27(2), 155–162 (1925)

35. Khalil, H.K.: Nonlinear Systems. Macmillan Publishing Company (1992)36. Kong, H., Bogomolov, S., Schilling, C., Jiang, Y., Henzinger, T.A.: Safety verification

of nonlinear hybrid systems based on invariant clusters. In: G. Frehse, S. Mitra (eds.)HSCC, pp. 163–172. ACM (2017). DOI 10.1145/3049797.3049814

37. Kong, H., He, F., Song, X., Hung, W.N.N., Gu, M.: Exponential-condition-based bar-rier certificate generation for safety verification of hybrid systems. In: N. Shary-gina, H. Veith (eds.) CAV, LNCS, vol. 8044, pp. 242–257. Springer (2013). DOI10.1007/978-3-642-39799-8 17

38. Lafferriere, G., Pappas, G.J., Yovine, S.: Symbolic reachability computation for familiesof linear vector fields. J. Symb. Comput. 32(3), 231–253 (2001). DOI 10.1006/jsco.2001.0472

39. Li, W., Passmore, G.O., Paulson, L.C.: Deciding univariate polynomial problems usinguntrusted certificates in Isabelle/HOL. J. Autom. Reasoning 62(1), 69–91 (2019). DOI10.1007/s10817-017-9424-6

40. Liu, J., Lv, J., Quan, Z., Zhan, N., Zhao, H., Zhou, C., Zou, L.: A calculus for hybridCSP. In: K. Ueda (ed.) APLAS, LNCS, vol. 6461, pp. 1–15. Springer (2010). DOI10.1007/978-3-642-17164-2 1

41. Liu, J., Zhan, N., Zhao, H.: Computing semi-algebraic invariants for polynomial dy-namical systems. In: S. Chakraborty, A. Jerraya, S.K. Baruah, S. Fischmeister (eds.)EMSOFT, pp. 97–106. ACM (2011). DOI 10.1145/2038642.2038659

42. Llibre, J., Zhang, X.: Invariant algebraic surfaces of the Lorenz system. Journal ofMathematical Physics 43(3), 1622–1645 (2002). DOI 10.1063/1.1435078

43. Loeser, T., Iwasaki, Y., Fikes, R.: Safety verification proofs for physical systems. In:Proc. of the 12th Intl. Workshop on Qualitative Reasoning, pp. 88–95 (1998)

44. Man, Y.: Computing closed form solutions of first order ODEs using the Prelle-Singerprocedure. J. Symb. Comput. 16(5), 423–443 (1993). DOI 10.1006/jsco.1993.1057

45. Man, Y.: First integrals of autonomous systems of differential equations and the Prelle-Singer procedure. Journal of Physics A: Mathematical and General 27(10), L329–L332(1994). DOI 10.1088/0305-4470/27/10/005

46. Mishra, B.: Algorithmic Algebra. Springer (1993). DOI 10.1007/978-1-4612-4344-147. Mitsch, S., Platzer, A.: ModelPlex: verified runtime validation of verified cyber-

physical system models. Formal Methods Syst. Des. 49(1-2), 33–74 (2016). DOI10.1007/s10703-016-0241-z

48. Olver, P.J.: Applications of Lie groups to differential equations, Graduate Texts inMathematics, vol. 107, second edn. Springer (2000)

49. Papachristodoulou, A., Anderson, J., Valmorbida, G., Prajna, S., Seiler, P., Parrilo,P.A.: SOSTOOLS version 3.00 sum of squares optimization toolbox for MATLAB.CoRR abs/1310.4716 (2013)

Page 38: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

38 Andrew Sogokon et al.

50. Papachristodoulou, A., Prajna, S.: On the construction of Lyapunov functions using thesum of squares decomposition. In: CDC, vol. 3, pp. 3482–3487 vol.3 (2002)

51. Parrilo, P.A.: Structured semidefinite programs and semialgebraic geometry methods inrobustness and optimization. Ph.D. thesis, California Institute of Technology (2000)

52. Platzer, A.: Differential dynamic logic for hybrid systems. J. Autom. Reas. 41(2), 143–189 (2008). DOI 10.1007/s10817-008-9103-8

53. Platzer, A.: The complete proof theory of hybrid systems. In: LICS, pp. 541–550. IEEEComputer Society (2012). DOI 10.1109/LICS.2012.64

54. Platzer, A.: A differential operator approach to equational differential invariants - (in-vited paper). In: L. Beringer, A.P. Felty (eds.) ITP, LNCS, vol. 7406, pp. 28–48. Springer(2012). DOI 10.1007/978-3-642-32347-8 3

55. Platzer, A.: Logics of dynamical systems. In: LICS, pp. 13–24. IEEE Computer Society(2012). DOI 10.1109/LICS.2012.13

56. Platzer, A.: A complete uniform substitution calculus for differential dynamic logic. J.Autom. Reasoning 59(2), 219–265 (2017). DOI 10.1007/s10817-016-9385-1

57. Platzer, A., Clarke, E.M.: Computing differential invariants of hybrid systems asfixedpoints. Formal Methods Syst. Des. 35(1), 98–120 (2009). DOI 10.1007/s10703-009-0079-8

58. Platzer, A., Quesel, J.: KeYmaera: A hybrid theorem prover for hybrid systems (systemdescription). In: A. Armando, P. Baumgartner, G. Dowek (eds.) IJCAR, LNCS, vol.5195, pp. 171–178. Springer (2008). DOI 10.1007/978-3-540-71070-7 15

59. Platzer, A., Quesel, J., Rummer, P.: Real world verification. In: R.A. Schmidt(ed.) CADE, LNCS, vol. 5663, pp. 485–501. Springer (2009). DOI 10.1007/978-3-642-02959-2 35

60. Platzer, A., Tan, Y.K.: Differential equation invariance axiomatization. J. ACM 67(1)(2020). DOI 10.1145/3380825

61. Prajna, S., Jadbabaie, A.: Safety verification of hybrid systems using barrier certificates.In: R. Alur, G.J. Pappas (eds.) HSCC, LNCS, vol. 2993, pp. 477–492. Springer (2004).DOI 10.1007/978-3-540-24743-2 32

62. Prelle, M.J., Singer, M.F.: Elementary first integrals of differential equations. Transac-tions of the American Mathematical Society 279(1), 215–229 (1983)

63. Rebiha, R., Moura, A.V., Matringe, N.: Generating invariants for non-linear hybridsystems. Theor. Comput. Sci. 594, 180–200 (2015). DOI 10.1016/j.tcs.2015.06.018

64. Renegar, J.: Recent progress on the complexity of the decision problem for the reals. In:J.E. Goodman, R. Pollack, W. Steiger (eds.) Discrete and Computational Geometry:Papers from the DIMACS Special Year, vol. 6, pp. 287–308. DIMACS/AMS (1990)

65. Rodrıguez-Carbonell, E., Tiwari, A.: Generating polynomial invariants for hybrid sys-tems. In: M. Morari, L. Thiele (eds.) HSCC, LNCS, vol. 3414, pp. 590–605. Springer(2005). DOI 10.1007/978-3-540-31954-2 38

66. Rouche, N., Habets, P., Laloy, M.: Stability Theory by Liapunov’s Direct Method, Appl.Math. Sci., vol. 22. Springer (1977). DOI 10.1007/978-1-4684-9362-7

67. Roux, P., Voronin, Y., Sankaranarayanan, S.: Validating numerical semidefinite pro-gramming solvers for polynomial invariants. Form. Methods Syst. Des. 53(2), 286–312(2018). DOI 10.1007/s10703-017-0302-y

68. Roy, M.F.: Basic algorithms in real algebraic geometry and their complexity: fromSturm’s theorem to the existential theory of reals. De Gruyter Expositions in Mathe-matics 23, 1–67 (1996)

69. Sankaranarayanan, S.: Automatic invariant generation for hybrid systems using idealfixed points. In: K.H. Johansson, W. Yi (eds.) HSCC, pp. 221–230. ACM (2010). DOI10.1145/1755952.1755984

70. Sankaranarayanan, S., Chen, X., Abraham, E.: Lyapunov function synthesis usingHandelman representations. In: NOLCOS, pp. 576–581 (2013). DOI 10.3182/20130904-3-FR-2041.00198

71. Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Constructing invariants for hybrid sys-tems. Form. Methods Syst. Des. 32(1), 25–55 (2008). DOI 10.1007/s10703-007-0046-1

72. Schlomiuk, D.: Algebraic and Geometric Aspects of the Theory of Polynomial VectorFields, NATO ASI Series, vol. 408, pp. 429–467. Springer Netherlands (1993)

Page 39: arXiv:2005.09348v1 [cs.SC] 19 May 2020wealth of diverse techniques presents a number of challenges, with di erent methods having di erent strengths and weaknesses. To address some

Pegasus: Sound Continuous Invariant Generation 39

73. Shi, S.: On the nonexistence of rational first integrals for nonlinear systems and semi-quasihomogeneous systems. Journal of Mathematical Analysis and Applications 335(1),125–134 (2007)

74. Shults, B., Kuipers, B.: Proving properties of continuous systems: Qualitative simulationand temporal logic. Artif. Intell. 92(1-2), 91–129 (1997). DOI 10.1016/S0004-3702(96)00050-1

75. Sogokon, A., Ghorbal, K., Jackson, P.B., Platzer, A.: A method for invariant generationfor polynomial continuous systems. In: B. Jobstmann, K.R.M. Leino (eds.) VMCAI,LNCS, vol. 9583, pp. 268–288. Springer (2016). DOI 10.1007/978-3-662-49122-5 13

76. Sogokon, A., Ghorbal, K., Johnson, T.T.: Non-linear continuous systems for safety ver-ification. In: G. Frehse, M. Althoff (eds.) ARCH, EPiC Series in Computing, vol. 43,pp. 42–51. EasyChair (2016)

77. Sogokon, A., Ghorbal, K., Tan, Y.K., Platzer, A.: Vector barrier certificates and com-parison systems. In: K. Havelund, J. Peleska, B. Roscoe, E.P. de Vink (eds.) FM, LNCS,vol. 10951, pp. 418–437. Springer (2018). DOI 10.1007/978-3-319-95582-7 25

78. Sogokon, A., Mitsch, S., Tan, Y.K., Cordwell, K., Platzer, A.: Pegasus: A framework forsound continuous invariant generation. In: M.H. ter Beek, A. McIver, J.N. Oliveira (eds.)FM, LNCS, vol. 11800, pp. 138–157. Springer (2019). DOI 10.1007/978-3-030-30942-810

79. Strogatz, S.H.: Nonlinear Dynamics And Chaos. Studies in Nonlinearity. WestviewPress (2001)

80. Sturm, T., Tiwari, A.: Verification and synthesis using real quantifier elimination. In:E. Schost, I.Z. Emiris (eds.) ISSAC, pp. 329–336. ACM (2011). DOI 10.1145/1993886.1993935

81. Tiwari, A.: Approximate reachability for linear systems. In: O. Maler, A. Pnueli (eds.)HSCC, LNCS, vol. 2623, pp. 514–525. Springer (2003). DOI 10.1007/3-540-36580-X 37

82. Tiwari, A.: Abstractions for hybrid systems. Form. Methods Syst. Des. 32(1), 57–83(2008). DOI 10.1007/s10703-007-0044-3

83. Tiwari, A.: Generating box invariants. In: M. Egerstedt, B. Mishra (eds.) HSCC, LNCS,vol. 4981, pp. 658–661. Springer (2008). DOI 10.1007/978-3-540-78929-1 58

84. Tiwari, A., Khanna, G.: Series of abstractions for hybrid automata. In: C. Tomlin,M.R. Greenstreet (eds.) HSCC, LNCS, vol. 2289, pp. 465–478. Springer (2002). DOI10.1007/3-540-45873-5 36

85. Tiwari, A., Khanna, G.: Nonlinear systems: Approximating reach sets. In: R. Alur,G.J. Pappas (eds.) HSCC, LNCS, vol. 2993, pp. 600–614. Springer (2004). DOI 10.1007/978-3-540-24743-2 40

86. Wang, S., Zhan, N., Zou, L.: An improved HHL prover: An interactive theorem proverfor hybrid systems. In: M.J. Butler, S. Conchon, F. Zaıdi (eds.) ICFEM, LNCS, vol.9407, pp. 382–399. Springer (2015). DOI 10.1007/978-3-319-25423-4 25

87. Weber, T.: Integrating a SAT solver with an LCF-style theorem prover. Electr. NotesTheor. Comput. Sci. 144(2), 67–78 (2006). DOI 10.1016/j.entcs.2005.12.007

88. Weber, T.: SMT solvers: new oracles for the HOL theorem prover. STTT 13(5), 419–429(2011). DOI 10.1007/s10009-011-0188-8

89. Yang, Z., Huang, C., Chen, X., Lin, W., Liu, Z.: A linear programming relaxation basedapproach for generating barrier certificates of hybrid systems. In: J.S. Fitzgerald, C.L.Heitmeyer, S. Gnesi, A. Philippou (eds.) FM, LNCS, vol. 9995, pp. 721–738 (2016).DOI 10.1007/978-3-319-48989-6 44

90. Yang, Z., Wu, M., Lin, W.: An efficient framework for barrier certificate generation ofuncertain nonlinear hybrid systems. Nonlinear Analysis: Hybrid Systems 36, 100837(2020). DOI 10.1016/j.nahs.2019.100837

91. Zaki, M.H., Denman, W., Tahar, S., Bois, G.: Integrating abstraction techniques forformal verification of analog designs. J. Aeros. Comp. Inf. Com. 6(5), 373–392 (2009).DOI 10.2514/1.44289

92. Zhang, X.: Integrability of Dynamical Systems: Algebra and Analysis, Developments inMathematics, vol. 47. Springer

93. Zhao, F.: Extracting and representing qualitative behaviors of complex systems in phasespace. Artif. Intell. 69(1-2), 51–92 (1994). DOI 10.1016/0004-3702(94)90078-7