Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis...

30
Nonlinear real arithmetic and δ -satisfiability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides courtesy of Sicun Gao, MIT) 1 / 26

Transcript of Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis...

Page 1: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Nonlinear real arithmetic and δ-satisfiability

Paolo Zuliani

School of Computing ScienceNewcastle University, UK

(Slides courtesy of Sicun Gao, MIT)

1 / 26

Page 2: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Introduction

I We use hybrid systems for modelling and verifying biologicalsystem models

I prostate cancer therapyI psoriasis UVB treatment

I Hybrid systems combine continuous dynamics with discretestate changes

2 / 26

Page 3: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Why Nonlinear Real Arithmetic and Hybrid Systems? (I)

A prostate cancer model1

dx

dt=

(αx

1 + e(k1−z)k2− βx

1 + e(z−k3)k4−m1

(1− z

z0

)− c1

)x + c2

dy

dt=m1

(1− z

z0

)x +

(αy

(1− d0

z

z0

)− βy

)y

dz

dt=− zγ − c3

v =x + y

I v - prostate specific antigen (PSA)

I x - hormone sensitive cells (HSCs)

I y - castration resistant cells (CRCs)

I z - androgen

1A.M. Ideta, G. Tanaka, T. Takeuchi, K. Aihara: A mathematical model of intermittent androgen suppression

for prostate cancer. Journal of Nonlinear Science, 18(6), 593–614 (2008)

3 / 26

Page 4: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Why Nonlinear Real Arithmetic and Hybrid Systems? (I)Intermittent androgen deprivation therapy

mode 1;

𝑑𝑆1𝑑𝑡

= 𝑣01 + 𝑎𝑎1 ∗ 𝑡

𝑑𝑆2

𝑑𝑡= 𝑣02

𝑑𝑣1

𝑑𝑡= 𝑎𝑎1

mode 2;

𝑑𝑆1𝑑𝑡

= 𝑣01

𝑑𝑆2

𝑑𝑡= 𝑣02

mode 3;

𝑑𝑆1𝑑𝑡

= 𝑣01 + 𝑎𝑑1 ∗ 𝑡

𝑑𝑆2

𝑑𝑡= 𝑣02

𝑑𝑣1

𝑑𝑡= 𝑎𝑑1

mode 4;

𝑑𝑆1𝑑𝑡

= 𝑣01 + 𝑎𝑑1 ∗ 𝑡

𝑑𝑆2

𝑑𝑡= 𝑣02 + 𝑎𝑑2 ∗ 𝑡

𝑑𝑣1

𝑑𝑡= 𝑎𝑑1

𝑑𝑣2

𝑑𝑡= 𝑎𝑑2

mode 5;

𝑑𝑆2

𝑑𝑡= 𝑣02 + 𝑎𝑑2 ∗ 𝑡

𝑑𝑣2

𝑑𝑡= 𝑎𝑑2

𝑣1 = 𝑣𝑚𝑎𝑥

𝑆1 ≥ 𝑆2 + 𝑣01 ∗ 𝑡𝑠𝑎𝑓𝑒

𝑡 = 𝑡𝑟𝑒𝑎𝑐𝑡

𝑣1 = 0

on-therapy

𝑑𝑥

𝑑𝑡=

𝛼𝑥

1 + 𝑒 𝑘1−𝑧 𝑘2−

𝛽𝑥

1 + 𝑒 𝑧−𝑘3 𝑘4− 𝑚1 1 −

𝑧

𝑧0 − 𝑐1 𝑥 + 𝑐2

𝑑𝑦

𝑑𝑡= 𝑚1 1 −

𝑧

𝑧0 𝑥 + 𝛼𝑦 1 −

𝑑0𝑧

𝑧0 − 𝛽 𝑦

𝑑𝑧

𝑑𝑡= −𝑧𝛾 + 𝑐3

off-therapy

𝑑𝑥

𝑑𝑡=

𝛼𝑥

1 + 𝑒 𝑘1−𝑧 𝑘2−

𝛽𝑥

1 + 𝑒 𝑧−𝑘3 𝑘4− 𝑚1 1 −

𝑧

𝑧0 − 𝑐1 𝑥 + 𝑐2

𝑑𝑦

𝑑𝑡= 𝑚1 1 −

𝑧

𝑧0 𝑥 + 𝛼𝑦 1 −

𝑑0𝑧

𝑧0 − 𝛽 𝑦

𝑑𝑧

𝑑𝑡= 𝑧0 − 𝑧 𝛾 + 𝑐3

𝑥 + 𝑦 ≤ 𝑟0 𝑥 + 𝑦 ≥ 𝑟1

4 / 26

Page 5: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Why Nonlinear Real Arithmetic and Hybrid Systems? (II)

A model of psoriasis development and UVB treatment2

dSC

dt= γ1

ω(1− SC+λSCdSCmax

)SC

1 + (ω − 1)(TA+TAdPta,h

)n− β1InASC −

k1sω

1 + (ω − 1)(TA+TAdPta,h

)nSC + k1TA

dTA

dt=

k1a,sωSC

1 + (ω − 1)(TA+TAdPta,h

)n+

2k1sω

1 + (ω − 1)(TA+TAdPta,h

)n + γ2GA− β2InATA− k2sTA− k1TA

dGA

dt= (k2a,s + 2k2s )TA− k2GA− k3GA− β3GA

dSCd

dt= γ1d (1−

SC + SCd

SCmax,tSCd − β1d InASCd − k1sdSCd −

kpSC2d

k2a + SC2

d

+ k1dTAd )

dTAd

dt= k1a,sdSCd + 2k1sdSCd + γ2dTAd + k2dGAd − β2d InATAd − k2sdTAd − k1dTAd

dGAd

dt= (k2a,sd + 2k2sd )TAd − k2dGAd − k3dGAd − β3dGAd

I Therapy episode: 48 hours of irradiation + 8 hours of rest

I Therapy episode = multiply β1 and β2 by a constant InA

2H. Zhang, W. Hou, L. Henrot, S. Schnebert, M. Dumas, C. Heusele, and J. Yang. Modelling epidermis

homoeostasis and psoriasis pathogenesis. Journal of The Royal Society Interface, 12(103), 2015.

5 / 26

Page 6: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Why Nonlinear Real Arithmetic and Hybrid Systems? (II)

A model of psoriasis development and UVB treatment2

dSC

dt= γ1

ω(1− SC+λSCdSCmax

)SC

1 + (ω − 1)(TA+TAdPta,h

)n− β1 InASC −

k1sω

1 + (ω − 1)(TA+TAdPta,h

)nSC + k1TA

dTA

dt=

k1a,sωSC

1 + (ω − 1)(TA+TAdPta,h

)n+

2k1sω

1 + (ω − 1)(TA+TAdPta,h

)n + γ2GA− β2 InATA− k2sTA− k1TA

dGA

dt= (k2a,s + 2k2s )TA− k2GA− k3GA− β3GA

dSCd

dt= γ1d (1−

SC + SCd

SCmax,tSCd − β1d InASCd − k1sdSCd −

kpSC2d

k2a + SC2

d

+ k1dTAd )

dTAd

dt= k1a,sdSCd + 2k1sdSCd + γ2dTAd + k2dGAd − β2d InATAd − k2sdTAd − k1dTAd

dGAd

dt= (k2a,sd + 2k2sd )TAd − k2dGAd − k3dGAd − β3dGAd

I Therapy episode: 48 hours of irradiation + 8 hours of rest

I Therapy episode = multiply β1 and β2 by a constant InA

2H. Zhang, W. Hou, L. Henrot, S. Schnebert, M. Dumas, C. Heusele, and J. Yang. Modelling epidermis

homoeostasis and psoriasis pathogenesis. Journal of The Royal Society Interface, 12(103), 2015.

5 / 26

Page 7: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Real-World Applications

I Psoriasis Stratification to Optimise Relevant Therapy(PSORT)

I Large (∼£5m)I Primarily biomarkers discoveryI We use computational modelling for understanding psoriasis’

mechanisms

I Personalised ultraviolet B treatment of psoriasis throughbiomarker integration with computational modelling ofpsoriatic plaque resolution

I Starts February 2017I PIs: P.Z. and Nick Reynolds (Institute of Cellular Medicine)I Computational modelling to inform UVB therapies used

in the clinic — real impact on people’s health!

6 / 26

Page 8: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Real-World Applications

I Psoriasis Stratification to Optimise Relevant Therapy(PSORT)

I Large (∼£5m)I Primarily biomarkers discoveryI We use computational modelling for understanding psoriasis’

mechanisms

I Personalised ultraviolet B treatment of psoriasis throughbiomarker integration with computational modelling ofpsoriatic plaque resolution

I Starts February 2017I PIs: P.Z. and Nick Reynolds (Institute of Cellular Medicine)I Computational modelling to inform UVB therapies used

in the clinic — real impact on people’s health!

6 / 26

Page 9: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Bounded Reachability

I Reachability is a key property in verification, also for hybridsystems

I Reachability is undecidable even for linear hybrid systems(Alur, Courcoubetis, Henzinger, Ho. 1993)

I [Bounded Reachability] Does the hybrid system reach a goalstate within a finite time and number of (discrete) steps?

I “Can a 5-episode UVB therapy remit psoriasis for a year?”

I Reasoning about nonlinear real arithmetic is hard . . .

7 / 26

Page 10: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Bounded Reachability

I Reachability is a key property in verification, also for hybridsystems

I Reachability is undecidable even for linear hybrid systems(Alur, Courcoubetis, Henzinger, Ho. 1993)

I [Bounded Reachability] Does the hybrid system reach a goalstate within a finite time and number of (discrete) steps?

I “Can a 5-episode UVB therapy remit psoriasis for a year?”

I Reasoning about nonlinear real arithmetic is hard . . .

7 / 26

Page 11: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Bounded Reachability

I Reachability is a key property in verification, also for hybridsystems

I Reachability is undecidable even for linear hybrid systems(Alur, Courcoubetis, Henzinger, Ho. 1993)

I [Bounded Reachability] Does the hybrid system reach a goalstate within a finite time and number of (discrete) steps?

I “Can a 5-episode UVB therapy remit psoriasis for a year?”

I Reasoning about nonlinear real arithmetic is hard . . .

7 / 26

Page 12: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Type 2 Computability

Turning machines operate on finite strings, i.e., integers, whichcannot capture real-valued functions.

I Real numbers can be encoded on infinite tapes.

I Real numbers are functions over integers.

I Real functions can be computed by machines that take infinitetapes as inputs, and output infinite tapes encoding the values.

Definition (Name of a real number)

A real number a can be encoded by an infinite sequence ofrationals γa : N→ Q such that

∀i ∈ N |a− γa(i)| < 2−i .

8 / 26

Page 13: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Type 2 Computability

A function f (x) = y is computable if any name of x can bealgorithmically mapped to a name of y

...

...

...

M

... k input tapes

work tapes

output tape

fM (y1, . . . , yk) = y

y

y1

yk

... ...

...

... ...

}}

Writing on any finite segment of the output tape takes finite time.

9 / 26

Page 14: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Type 2 Computability

I Type 2 computability implies continuity

I “Numerically computable” roughly means Type 2 computable

I Approximation up to arbitrary numerical precisions

Ker-I Ko. Complexity Theory of Real Functions. 1991.

10 / 26

Page 15: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Facts

Type 2 Computable:

I polynomials, sin, exp, . . .

I numerically feasible ODEs, PDEs, . . .

Type 2 Complexity:

I sin, exp, etc. are in P[0,1]

I Lipschitz-continuous ODEs are in PSPACE[0,1]; in fact, can bePSPACE[0,1]-complete (Kawamura, CCC 2009).

See Ko’s book for many more results . . .

11 / 26

Page 16: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

LRF -Formulas (Gao, Avigad, and Clarke. LICS 2012)

Let F be the class of all Type 2 computable real functions.

Definition (LRF -Formulas)

First-order language over 〈>,F〉:

t := x | f (t(~x))

ϕ := t(~x) > 0 | ¬ϕ | ϕ ∨ ϕ | ∃xiϕ | ∀xiϕ

Example

Let dx/dt = f (x) be an n-dimensional dynamical system.Lyapunov stability is expressed as:

∀ε∃δ∀t∀x0∀xt .(||x0|| < δ ∧ xt = x0 +

∫ t

0f (s)ds

)→ ||xt || < ε

12 / 26

Page 17: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Hybrid Automata

A hybrid automaton is a tuple

H = 〈X ,Q, {flowq(~x , ~y , t) : q ∈ Q}, {jumpq→q′(~x , ~y) : q, q′ ∈ Q},{invq(~x) : q ∈ Q}, {initq(~x) : q ∈ Q}〉

I X ⊆ Rn for some n ∈ NI Q = {q1, ..., qm} is a finite set of modes

I Other components are finite sets of quantifier-freeLRF -formulas.

13 / 26

Page 18: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Example: Nonlinear Bouncing Ball

I X = R2 and Q = {qu, qd}.I flowqd (x0, v0, xt , vt , t), dynamics in the falling phase:

(xt = x0 +

∫ t

0v(s)ds) ∧ (vt = v0 +

∫ t

0g(1 + βv(s)2)ds)

I jumpqu→qd (x , v , x ′, v ′):

(v = 0 ∧ x ′ = x ∧ v ′ = v)

I invqd : (x >= 0 ∧ v >= 0).

I initqd : (x = 10 ∧ v = 0).

14 / 26

Page 19: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Encode Reachability

Continuous case:

init(~x0) ∧ flow(~x0, t, ~xt) ∧ goal(~xt)

Make one jump:

init(~x0) ∧ flow(~x0, t, ~xt) ∧ jump(~xt , ~x′t) ∧ goal(~x ′t)

15 / 26

Page 20: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Encode Reachability: invariant-free case

∃X~x0∃X~x t0 · · · ∃X~xk∃X~x tk∃[0,M]t0 · · · ∃[0,M]tk∨q∈Q

(initq(~x0) ∧ flowq(~x0, ~x

t0, t0)

)

∧k−1∧i=0

( ∨q,q′∈Q

(jumpq→q′(~x

ti , ~xi+1) ∧ flowq′(~xi+1, ~x

ti+1, ti+1)

))∧

∨q∈Q

(goalq(~x tk))

(There’s some simplification here.)

16 / 26

Page 21: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Difficulty

Suppose F is {+,×}.

R |= ∃a∀b∃c (ax2 + bx + c > 0)?

I Decidable [Tarski 1948] but double-exponential lower-bound.

Suppose F further contains sine.

R |= ∃x , y , z (sin2(πx) + sin2(πy) + sin2(πz) = 0∧x3 + y3 = z3)?

I Undecidable.

17 / 26

Page 22: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Towards Delta-Decisions

We now define the delta-decision problems of LRF -formulas, whichwill lead to a totally different outlook.

18 / 26

Page 23: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Bounded LF -Sentences

Definition (Normal Form)

Any bounded LF -sentence ϕ can be written in the form

Q[u1,v1]1 xn · · ·Q [un,vn]

n xn∧

(∨

t(~x) > 0 ∨∨

t(~x) ≥ 0)

I Negations are pushed into atoms.

I Bounded quantifiers: the bounds can use any terms thatcontain previously-quantified variables.

19 / 26

Page 24: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

δ-Variants

Definition (Numerical Perturbation)

Let δ ∈ Q+ ∪ {0}. The δ-weakening ϕ−δ of ϕ is

Q[u1,v1]1 x1 · · ·Q [un,vn]

n xn∧

(∨

t(~x) > −δ ∨∨

t(~x) ≥ −δ)

I Obviously, ϕ→ ϕ−δ (but not the other way round!)

I δ-strengthening ϕ+δ is defined by replacing −δ by δ.

20 / 26

Page 25: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

δ-Decisions

Let δ ∈ Q+ be arbitrary.

Definition (δ-Decisions)

Decide, for any given bounded ϕ and δ ∈ Q+, whether

I ϕ is false, or

I ϕ−δ is true.

When the two cases overlap, either answer can be returned.

The dual can be defined on δ-strengthening.

21 / 26

Page 26: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

δ-Decisions

There is a grey area that aδ-complete algorithm can bewrong about.

UNSAT SATdeltaSAT

Corollary

In undecidable theories, it is undecidable whether a formula fallsinto this grey area.

22 / 26

Page 27: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

δ-Decidability

Let F be an arbitrary collection of Type 2 computable functions.

TheoremThe δ-decision problem over RF is decidable.

See [Gao et al. LICS 2012].

It stands in sharp contrast to the high undecidability of simpleformulas containing sine.

23 / 26

Page 28: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Complexity

Let S be some class of LF -sentences such that all the termsappearing in S are in Type 2 complexity class C. Then for anyδ ∈ Q+:

TheoremThe δ-decision problem for a Σk-sentence from S is in (ΣP

k )C.

Corollary

I F = {+,×, exp, sin, ...}: ΣPk -complete.

I F = {ODEs with P right-hand sides}: PSPACE-complete.

These are very reasonable!

24 / 26

Page 29: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Exactness

The definition of δ-decisions is exact in the following sense.

TheoremIf F is allowed to be arbitrary, then ϕ is decidable iff we considerbounded δ-decisions.

TheoremBounded sentences are δ-decidable iff F is computable.

25 / 26

Page 30: Nonlinear real arithmetic and -satis ability Paolo Zuliani · Nonlinear real arithmetic and -satis ability Paolo Zuliani School of Computing Science Newcastle University, UK (Slides

Conclusions

The notion of delta-complete decision procedures allows formalanalysis and use of numerical algorithms in decision procedures.

I Standard completeness is impossible.

I Delta-completeness: strong enough and achievable.I Correctness guarantees on both sides

26 / 26